@microsoft/applicationinsights-channel-js 2.7.5-nightly.2204-03 → 2.7.6
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-channel-js.integrity.json +9 -9
- package/browser/applicationinsights-channel-js.js +446 -1218
- package/browser/applicationinsights-channel-js.js.map +1 -1
- package/browser/applicationinsights-channel-js.min.js +2 -2
- package/browser/applicationinsights-channel-js.min.js.map +1 -1
- package/dist/applicationinsights-channel-js.api.json +89 -32
- package/dist/applicationinsights-channel-js.api.md +2 -0
- package/dist/applicationinsights-channel-js.d.ts +2 -1
- package/dist/applicationinsights-channel-js.js +446 -1218
- package/dist/applicationinsights-channel-js.js.map +1 -1
- package/dist/applicationinsights-channel-js.min.js +2 -2
- package/dist/applicationinsights-channel-js.min.js.map +1 -1
- package/dist/applicationinsights-channel-js.rollup.d.ts +2 -1
- package/dist-esm/EnvelopeCreator.js +2 -2
- package/dist-esm/EnvelopeCreator.js.map +1 -1
- package/dist-esm/Interfaces.js +1 -1
- package/dist-esm/Offline.js +65 -77
- package/dist-esm/Offline.js.map +1 -1
- package/dist-esm/SendBuffer.js +1 -1
- package/dist-esm/Sender.js +62 -72
- package/dist-esm/Sender.js.map +1 -1
- package/dist-esm/Serializer.js +1 -1
- package/dist-esm/TelemetryProcessors/Sample.js +3 -3
- package/dist-esm/TelemetryProcessors/Sample.js.map +1 -1
- package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.js +1 -1
- package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.js +1 -1
- package/dist-esm/applicationinsights-channel-js.js +1 -1
- package/package.json +54 -57
- package/src/EnvelopeCreator.ts +2 -2
- package/src/Offline.ts +76 -88
- package/src/Sender.ts +90 -83
- package/src/Serializer.ts +8 -4
- package/src/TelemetryProcessors/Sample.ts +1 -1
- package/src/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.ts +1 -3
- package/types/Offline.d.ts +11 -8
- package/types/Sender.d.ts +1 -0
- package/types/TelemetryProcessors/Sample.d.ts +2 -2
- package/types/tsdoc-metadata.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Channel, 2.7.
|
|
2
|
+
* Application Insights JavaScript SDK - Channel, 2.7.6
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -75,9 +75,7 @@
|
|
|
75
75
|
var __assignFn = ObjAssign || __objAssignFnImpl;
|
|
76
76
|
var extendStaticsFn = function (d, b) {
|
|
77
77
|
extendStaticsFn = ObjClass["setPrototypeOf"] ||
|
|
78
|
-
({ __proto__: [] } instanceof Array && function (d, b) {
|
|
79
|
-
d.__proto__ = b;
|
|
80
|
-
}) ||
|
|
78
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
81
79
|
function (d, b) {
|
|
82
80
|
for (var p in b) {
|
|
83
81
|
if (b[strShimHasOwnProperty](p)) {
|
|
@@ -92,14 +90,12 @@
|
|
|
92
90
|
throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
93
91
|
}
|
|
94
92
|
extendStaticsFn(d, b);
|
|
95
|
-
function __() {
|
|
96
|
-
this.constructor = d;
|
|
97
|
-
}
|
|
93
|
+
function __() { this.constructor = d; }
|
|
98
94
|
d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
|
|
99
95
|
}
|
|
100
96
|
|
|
101
97
|
/*!
|
|
102
|
-
* Microsoft Dynamic Proto Utility, 1.1.
|
|
98
|
+
* Microsoft Dynamic Proto Utility, 1.1.6
|
|
103
99
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
104
100
|
*/
|
|
105
101
|
var Constructor = 'constructor';
|
|
@@ -113,11 +109,14 @@
|
|
|
113
109
|
var DynAllowInstChkTag = DynInstChkTag;
|
|
114
110
|
var DynProtoDefaultOptions = '_dfOpts';
|
|
115
111
|
var UnknownValue = '_unknown_';
|
|
116
|
-
var str__Proto
|
|
112
|
+
var str__Proto = "__proto__";
|
|
113
|
+
var DynProtoBaseProto = "_dyn" + str__Proto;
|
|
114
|
+
var DynProtoCurrent = "_dynInstProto";
|
|
117
115
|
var strUseBaseInst = 'useBaseInst';
|
|
118
116
|
var strSetInstFuncs = 'setInstFuncs';
|
|
119
117
|
var Obj = Object;
|
|
120
|
-
var _objGetPrototypeOf
|
|
118
|
+
var _objGetPrototypeOf = Obj["getPrototypeOf"];
|
|
119
|
+
var _objGetOwnProps = Obj["getOwnPropertyNames"];
|
|
121
120
|
var _dynamicNames = 0;
|
|
122
121
|
function _hasOwnProperty(obj, prop) {
|
|
123
122
|
return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
|
|
@@ -128,23 +127,26 @@
|
|
|
128
127
|
function _isObjectArrayOrFunctionPrototype(target) {
|
|
129
128
|
return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
|
|
130
129
|
}
|
|
131
|
-
function _getObjProto
|
|
130
|
+
function _getObjProto(target) {
|
|
131
|
+
var newProto;
|
|
132
132
|
if (target) {
|
|
133
|
-
if (_objGetPrototypeOf
|
|
134
|
-
return _objGetPrototypeOf
|
|
133
|
+
if (_objGetPrototypeOf) {
|
|
134
|
+
return _objGetPrototypeOf(target);
|
|
135
135
|
}
|
|
136
|
-
var
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
var curProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
|
|
137
|
+
newProto = target[DynProtoBaseProto] || curProto;
|
|
138
|
+
if (!_hasOwnProperty(target, DynProtoBaseProto)) {
|
|
139
|
+
delete target[DynProtoCurrent];
|
|
140
|
+
newProto = target[DynProtoBaseProto] = target[DynProtoCurrent] || target[DynProtoBaseProto];
|
|
141
|
+
target[DynProtoCurrent] = curProto;
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
|
-
return
|
|
144
|
+
return newProto;
|
|
142
145
|
}
|
|
143
146
|
function _forEachProp(target, func) {
|
|
144
147
|
var props = [];
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
props = getOwnProps(target);
|
|
148
|
+
if (_objGetOwnProps) {
|
|
149
|
+
props = _objGetOwnProps(target);
|
|
148
150
|
}
|
|
149
151
|
else {
|
|
150
152
|
for (var name_1 in target) {
|
|
@@ -199,16 +201,16 @@
|
|
|
199
201
|
_forEachProp(instFuncs, function (name) {
|
|
200
202
|
baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
|
|
201
203
|
});
|
|
202
|
-
var baseProto = _getObjProto
|
|
204
|
+
var baseProto = _getObjProto(classProto);
|
|
203
205
|
var visited = [];
|
|
204
206
|
while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
|
|
205
207
|
_forEachProp(baseProto, function (name) {
|
|
206
|
-
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf
|
|
208
|
+
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
|
|
207
209
|
baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
|
|
208
210
|
}
|
|
209
211
|
});
|
|
210
212
|
visited.push(baseProto);
|
|
211
|
-
baseProto = _getObjProto
|
|
213
|
+
baseProto = _getObjProto(baseProto);
|
|
212
214
|
}
|
|
213
215
|
return baseFuncs;
|
|
214
216
|
}
|
|
@@ -222,7 +224,7 @@
|
|
|
222
224
|
}
|
|
223
225
|
if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
|
|
224
226
|
var canAddInst = !_hasOwnProperty(target, funcName);
|
|
225
|
-
var objProto = _getObjProto
|
|
227
|
+
var objProto = _getObjProto(target);
|
|
226
228
|
var visited = [];
|
|
227
229
|
while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
|
|
228
230
|
var protoFunc = objProto[funcName];
|
|
@@ -231,7 +233,7 @@
|
|
|
231
233
|
break;
|
|
232
234
|
}
|
|
233
235
|
visited.push(objProto);
|
|
234
|
-
objProto = _getObjProto
|
|
236
|
+
objProto = _getObjProto(objProto);
|
|
235
237
|
}
|
|
236
238
|
try {
|
|
237
239
|
if (canAddInst) {
|
|
@@ -249,7 +251,7 @@
|
|
|
249
251
|
function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
|
|
250
252
|
var protoFunc = proto[funcName];
|
|
251
253
|
if (protoFunc === currentDynProtoProxy) {
|
|
252
|
-
protoFunc = _getObjProto
|
|
254
|
+
protoFunc = _getObjProto(proto)[funcName];
|
|
253
255
|
}
|
|
254
256
|
if (typeof protoFunc !== strFunction) {
|
|
255
257
|
_throwTypeError("[" + funcName + "] is not a " + strFunction);
|
|
@@ -283,18 +285,19 @@
|
|
|
283
285
|
}
|
|
284
286
|
}
|
|
285
287
|
function _checkPrototype(classProto, thisTarget) {
|
|
286
|
-
if (_objGetPrototypeOf
|
|
288
|
+
if (_objGetPrototypeOf) {
|
|
287
289
|
var visited = [];
|
|
288
|
-
var thisProto = _getObjProto
|
|
290
|
+
var thisProto = _getObjProto(thisTarget);
|
|
289
291
|
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
290
292
|
if (thisProto === classProto) {
|
|
291
293
|
return true;
|
|
292
294
|
}
|
|
293
295
|
visited.push(thisProto);
|
|
294
|
-
thisProto = _getObjProto
|
|
296
|
+
thisProto = _getObjProto(thisProto);
|
|
295
297
|
}
|
|
298
|
+
return false;
|
|
296
299
|
}
|
|
297
|
-
return
|
|
300
|
+
return true;
|
|
298
301
|
}
|
|
299
302
|
function _getObjName(target, unknownValue) {
|
|
300
303
|
if (_hasOwnProperty(target, Prototype)) {
|
|
@@ -327,7 +330,7 @@
|
|
|
327
330
|
var instFuncs = _getInstanceFuncs(target);
|
|
328
331
|
var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
|
|
329
332
|
delegateFunc(target, baseFuncs);
|
|
330
|
-
var setInstanceFunc = !!_objGetPrototypeOf
|
|
333
|
+
var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
|
|
331
334
|
if (setInstanceFunc && options) {
|
|
332
335
|
setInstanceFunc = !!options[strSetInstFuncs];
|
|
333
336
|
}
|
|
@@ -339,24 +342,105 @@
|
|
|
339
342
|
};
|
|
340
343
|
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
341
344
|
|
|
342
|
-
var
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
var
|
|
348
|
-
|
|
349
|
-
|
|
345
|
+
var LoggingSeverity;
|
|
346
|
+
(function (LoggingSeverity) {
|
|
347
|
+
LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
|
|
348
|
+
LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
|
|
349
|
+
})(LoggingSeverity || (LoggingSeverity = {}));
|
|
350
|
+
var _InternalMessageId = {
|
|
351
|
+
BrowserDoesNotSupportLocalStorage: 0,
|
|
352
|
+
BrowserCannotReadLocalStorage: 1,
|
|
353
|
+
BrowserCannotReadSessionStorage: 2,
|
|
354
|
+
BrowserCannotWriteLocalStorage: 3,
|
|
355
|
+
BrowserCannotWriteSessionStorage: 4,
|
|
356
|
+
BrowserFailedRemovalFromLocalStorage: 5,
|
|
357
|
+
BrowserFailedRemovalFromSessionStorage: 6,
|
|
358
|
+
CannotSendEmptyTelemetry: 7,
|
|
359
|
+
ClientPerformanceMathError: 8,
|
|
360
|
+
ErrorParsingAISessionCookie: 9,
|
|
361
|
+
ErrorPVCalc: 10,
|
|
362
|
+
ExceptionWhileLoggingError: 11,
|
|
363
|
+
FailedAddingTelemetryToBuffer: 12,
|
|
364
|
+
FailedMonitorAjaxAbort: 13,
|
|
365
|
+
FailedMonitorAjaxDur: 14,
|
|
366
|
+
FailedMonitorAjaxOpen: 15,
|
|
367
|
+
FailedMonitorAjaxRSC: 16,
|
|
368
|
+
FailedMonitorAjaxSend: 17,
|
|
369
|
+
FailedMonitorAjaxGetCorrelationHeader: 18,
|
|
370
|
+
FailedToAddHandlerForOnBeforeUnload: 19,
|
|
371
|
+
FailedToSendQueuedTelemetry: 20,
|
|
372
|
+
FailedToReportDataLoss: 21,
|
|
373
|
+
FlushFailed: 22,
|
|
374
|
+
MessageLimitPerPVExceeded: 23,
|
|
375
|
+
MissingRequiredFieldSpecification: 24,
|
|
376
|
+
NavigationTimingNotSupported: 25,
|
|
377
|
+
OnError: 26,
|
|
378
|
+
SessionRenewalDateIsZero: 27,
|
|
379
|
+
SenderNotInitialized: 28,
|
|
380
|
+
StartTrackEventFailed: 29,
|
|
381
|
+
StopTrackEventFailed: 30,
|
|
382
|
+
StartTrackFailed: 31,
|
|
383
|
+
StopTrackFailed: 32,
|
|
384
|
+
TelemetrySampledAndNotSent: 33,
|
|
385
|
+
TrackEventFailed: 34,
|
|
386
|
+
TrackExceptionFailed: 35,
|
|
387
|
+
TrackMetricFailed: 36,
|
|
388
|
+
TrackPVFailed: 37,
|
|
389
|
+
TrackPVFailedCalc: 38,
|
|
390
|
+
TrackTraceFailed: 39,
|
|
391
|
+
TransmissionFailed: 40,
|
|
392
|
+
FailedToSetStorageBuffer: 41,
|
|
393
|
+
FailedToRestoreStorageBuffer: 42,
|
|
394
|
+
InvalidBackendResponse: 43,
|
|
395
|
+
FailedToFixDepricatedValues: 44,
|
|
396
|
+
InvalidDurationValue: 45,
|
|
397
|
+
TelemetryEnvelopeInvalid: 46,
|
|
398
|
+
CreateEnvelopeError: 47,
|
|
399
|
+
CannotSerializeObject: 48,
|
|
400
|
+
CannotSerializeObjectNonSerializable: 49,
|
|
401
|
+
CircularReferenceDetected: 50,
|
|
402
|
+
ClearAuthContextFailed: 51,
|
|
403
|
+
ExceptionTruncated: 52,
|
|
404
|
+
IllegalCharsInName: 53,
|
|
405
|
+
ItemNotInArray: 54,
|
|
406
|
+
MaxAjaxPerPVExceeded: 55,
|
|
407
|
+
MessageTruncated: 56,
|
|
408
|
+
NameTooLong: 57,
|
|
409
|
+
SampleRateOutOfRange: 58,
|
|
410
|
+
SetAuthContextFailed: 59,
|
|
411
|
+
SetAuthContextFailedAccountName: 60,
|
|
412
|
+
StringValueTooLong: 61,
|
|
413
|
+
StartCalledMoreThanOnce: 62,
|
|
414
|
+
StopCalledWithoutStart: 63,
|
|
415
|
+
TelemetryInitializerFailed: 64,
|
|
416
|
+
TrackArgumentsNotSpecified: 65,
|
|
417
|
+
UrlTooLong: 66,
|
|
418
|
+
SessionStorageBufferFull: 67,
|
|
419
|
+
CannotAccessCookie: 68,
|
|
420
|
+
IdTooLong: 69,
|
|
421
|
+
InvalidEvent: 70,
|
|
422
|
+
FailedMonitorAjaxSetRequestHeader: 71,
|
|
423
|
+
SendBrowserInfoOnUserInit: 72,
|
|
424
|
+
PluginException: 73,
|
|
425
|
+
NotificationException: 74,
|
|
426
|
+
SnippetScriptLoadFailure: 99,
|
|
427
|
+
InvalidInstrumentationKey: 100,
|
|
428
|
+
CannotParseAiBlobValue: 101,
|
|
429
|
+
InvalidContentBlob: 102,
|
|
430
|
+
TrackPageActionEventFailed: 103,
|
|
431
|
+
FailedAddingCustomDefinedRequestContext: 104,
|
|
432
|
+
InMemoryStorageBufferFull: 105
|
|
433
|
+
};
|
|
350
434
|
|
|
435
|
+
var strOnPrefix = "on";
|
|
436
|
+
var strAttachEvent = "attachEvent";
|
|
437
|
+
var strAddEventHelper = "addEventListener";
|
|
351
438
|
var strToISOString = "toISOString";
|
|
352
439
|
var strIndexOf = "indexOf";
|
|
353
440
|
var strMap = "map";
|
|
354
441
|
var cStrTrim = "trim";
|
|
355
442
|
var strToString = "toString";
|
|
356
|
-
var
|
|
357
|
-
var strConstructor = "constructor";
|
|
358
|
-
var _objDefineProperty$1 = ObjDefineProperty;
|
|
359
|
-
var _objFreeze = ObjClass.freeze;
|
|
443
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
360
444
|
var _objKeys = ObjClass.keys;
|
|
361
445
|
var StringProto = String[strShimPrototype];
|
|
362
446
|
var _strTrim = StringProto[cStrTrim];
|
|
@@ -365,23 +449,7 @@
|
|
|
365
449
|
var _isArray = Array.isArray;
|
|
366
450
|
var _objToString = ObjProto[strToString];
|
|
367
451
|
var _fnToString = ObjHasOwnProperty[strToString];
|
|
368
|
-
|
|
369
|
-
var rCamelCase = /-([a-z])/g;
|
|
370
|
-
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
371
|
-
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
372
|
-
var _objGetPrototypeOf = Object["getPrototypeOf"];
|
|
373
|
-
function _getObjProto(target) {
|
|
374
|
-
if (target) {
|
|
375
|
-
if (_objGetPrototypeOf) {
|
|
376
|
-
return _objGetPrototypeOf(target);
|
|
377
|
-
}
|
|
378
|
-
var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];
|
|
379
|
-
if (newProto) {
|
|
380
|
-
return newProto;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
return null;
|
|
384
|
-
}
|
|
452
|
+
_fnToString.call(ObjClass);
|
|
385
453
|
function isUndefined(value) {
|
|
386
454
|
return value === undefined || typeof value === strShimUndefined;
|
|
387
455
|
}
|
|
@@ -394,18 +462,24 @@
|
|
|
394
462
|
function isFunction(value) {
|
|
395
463
|
return !!(value && typeof value === strShimFunction);
|
|
396
464
|
}
|
|
397
|
-
function
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
465
|
+
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
466
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
467
|
+
var result = false;
|
|
468
|
+
if (!isNullOrUndefined(obj)) {
|
|
469
|
+
try {
|
|
470
|
+
if (!isNullOrUndefined(obj[strAddEventHelper])) {
|
|
471
|
+
obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);
|
|
472
|
+
result = true;
|
|
473
|
+
}
|
|
474
|
+
else if (!isNullOrUndefined(obj[strAttachEvent])) {
|
|
475
|
+
obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
476
|
+
result = true;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
catch (e) {
|
|
480
|
+
}
|
|
407
481
|
}
|
|
408
|
-
return
|
|
482
|
+
return result;
|
|
409
483
|
}
|
|
410
484
|
function objForEachKey(target, callbackfn) {
|
|
411
485
|
if (target) {
|
|
@@ -435,25 +509,6 @@
|
|
|
435
509
|
function isNumber(value) {
|
|
436
510
|
return typeof value === "number";
|
|
437
511
|
}
|
|
438
|
-
function isBoolean(value) {
|
|
439
|
-
return typeof value === "boolean";
|
|
440
|
-
}
|
|
441
|
-
function isPlainObject(value) {
|
|
442
|
-
var result = false;
|
|
443
|
-
if (value && typeof value === "object") {
|
|
444
|
-
var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
|
|
445
|
-
if (!proto) {
|
|
446
|
-
result = true;
|
|
447
|
-
}
|
|
448
|
-
else {
|
|
449
|
-
if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
|
|
450
|
-
proto = proto[strConstructor];
|
|
451
|
-
}
|
|
452
|
-
result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
return result;
|
|
456
|
-
}
|
|
457
512
|
function toISOString(date) {
|
|
458
513
|
if (date) {
|
|
459
514
|
return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
|
|
@@ -573,7 +628,7 @@
|
|
|
573
628
|
return result;
|
|
574
629
|
}
|
|
575
630
|
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
576
|
-
if (_objDefineProperty
|
|
631
|
+
if (_objDefineProperty) {
|
|
577
632
|
try {
|
|
578
633
|
var descriptor = {
|
|
579
634
|
enumerable: true,
|
|
@@ -585,7 +640,7 @@
|
|
|
585
640
|
if (setProp) {
|
|
586
641
|
descriptor.set = setProp;
|
|
587
642
|
}
|
|
588
|
-
_objDefineProperty
|
|
643
|
+
_objDefineProperty(target, prop, descriptor);
|
|
589
644
|
return true;
|
|
590
645
|
}
|
|
591
646
|
catch (e) {
|
|
@@ -593,10 +648,6 @@
|
|
|
593
648
|
}
|
|
594
649
|
return false;
|
|
595
650
|
}
|
|
596
|
-
function _doNothing(value) {
|
|
597
|
-
return value;
|
|
598
|
-
}
|
|
599
|
-
var objFreeze = _objFreeze || _doNothing;
|
|
600
651
|
function dateNow() {
|
|
601
652
|
var dt = Date;
|
|
602
653
|
return dt.now ? dt.now() : new dt().getTime();
|
|
@@ -605,7 +656,7 @@
|
|
|
605
656
|
if (isError(object)) {
|
|
606
657
|
return object.name;
|
|
607
658
|
}
|
|
608
|
-
return
|
|
659
|
+
return "";
|
|
609
660
|
}
|
|
610
661
|
function setValue(target, field, value, valChk, srcChk) {
|
|
611
662
|
var theValue = value;
|
|
@@ -624,33 +675,6 @@
|
|
|
624
675
|
function throwError(message) {
|
|
625
676
|
throw new Error(message);
|
|
626
677
|
}
|
|
627
|
-
function _createProxyFunction(source, funcName) {
|
|
628
|
-
var srcFunc = null;
|
|
629
|
-
var src = null;
|
|
630
|
-
if (isFunction(source)) {
|
|
631
|
-
srcFunc = source;
|
|
632
|
-
}
|
|
633
|
-
else {
|
|
634
|
-
src = source;
|
|
635
|
-
}
|
|
636
|
-
return function () {
|
|
637
|
-
var originalArguments = arguments;
|
|
638
|
-
if (srcFunc) {
|
|
639
|
-
src = srcFunc();
|
|
640
|
-
}
|
|
641
|
-
if (src) {
|
|
642
|
-
return src[funcName].apply(src, originalArguments);
|
|
643
|
-
}
|
|
644
|
-
};
|
|
645
|
-
}
|
|
646
|
-
function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
|
|
647
|
-
if (overwriteTarget === void 0) { overwriteTarget = true; }
|
|
648
|
-
if (target && name && source) {
|
|
649
|
-
if (overwriteTarget || isUndefined(target[name])) {
|
|
650
|
-
target[name] = _createProxyFunction(source, theFunc);
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
678
|
function createClassFromInterface(defaults) {
|
|
655
679
|
return /** @class */ (function () {
|
|
656
680
|
function class_1() {
|
|
@@ -664,67 +688,12 @@
|
|
|
664
688
|
return class_1;
|
|
665
689
|
}());
|
|
666
690
|
}
|
|
667
|
-
function createEnumStyle(values) {
|
|
668
|
-
var enumClass = {};
|
|
669
|
-
objForEachKey(values, function (field, value) {
|
|
670
|
-
enumClass[field] = value;
|
|
671
|
-
if (!isUndefined(enumClass[value])) {
|
|
672
|
-
throwError("[" + value + "] exists for " + field);
|
|
673
|
-
}
|
|
674
|
-
enumClass[value] = field;
|
|
675
|
-
});
|
|
676
|
-
return objFreeze(enumClass);
|
|
677
|
-
}
|
|
678
691
|
function optimizeObject(theObject) {
|
|
679
692
|
if (theObject && ObjAssign) {
|
|
680
693
|
theObject = ObjClass(ObjAssign({}, theObject));
|
|
681
694
|
}
|
|
682
695
|
return theObject;
|
|
683
696
|
}
|
|
684
|
-
function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
|
|
685
|
-
var theArgs = arguments;
|
|
686
|
-
var extended = theArgs[0] || {};
|
|
687
|
-
var argLen = theArgs.length;
|
|
688
|
-
var deep = false;
|
|
689
|
-
var idx = 1;
|
|
690
|
-
if (argLen > 0 && isBoolean(extended)) {
|
|
691
|
-
deep = extended;
|
|
692
|
-
extended = theArgs[idx] || {};
|
|
693
|
-
idx++;
|
|
694
|
-
}
|
|
695
|
-
if (!isObject(extended)) {
|
|
696
|
-
extended = {};
|
|
697
|
-
}
|
|
698
|
-
for (; idx < argLen; idx++) {
|
|
699
|
-
var arg = theArgs[idx];
|
|
700
|
-
var isArgArray = isArray(arg);
|
|
701
|
-
var isArgObj = isObject(arg);
|
|
702
|
-
for (var prop in arg) {
|
|
703
|
-
var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
|
|
704
|
-
if (!propOk) {
|
|
705
|
-
continue;
|
|
706
|
-
}
|
|
707
|
-
var newValue = arg[prop];
|
|
708
|
-
var isNewArray = void 0;
|
|
709
|
-
if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
|
|
710
|
-
var clone = extended[prop];
|
|
711
|
-
if (isNewArray) {
|
|
712
|
-
if (!isArray(clone)) {
|
|
713
|
-
clone = [];
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
else if (!isPlainObject(clone)) {
|
|
717
|
-
clone = {};
|
|
718
|
-
}
|
|
719
|
-
newValue = objExtend(deep, clone, newValue);
|
|
720
|
-
}
|
|
721
|
-
if (newValue !== undefined) {
|
|
722
|
-
extended[prop] = newValue;
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
return extended;
|
|
727
|
-
}
|
|
728
697
|
|
|
729
698
|
var strWindow = "window";
|
|
730
699
|
var strDocument = "document";
|
|
@@ -732,13 +701,8 @@
|
|
|
732
701
|
var strNavigator = "navigator";
|
|
733
702
|
var strConsole = "console";
|
|
734
703
|
var strJSON = "JSON";
|
|
735
|
-
var strCrypto = "crypto";
|
|
736
|
-
var strMsCrypto = "msCrypto";
|
|
737
704
|
var strMsie = "msie";
|
|
738
705
|
var strTrident = "trident/";
|
|
739
|
-
var strXMLHttpRequest = "XMLHttpRequest";
|
|
740
|
-
var _isTrident = null;
|
|
741
|
-
var _navUserAgentCheck = null;
|
|
742
706
|
var _useXDomainRequest = null;
|
|
743
707
|
var _beaconsSupported = null;
|
|
744
708
|
function _hasProperty(theClass, property) {
|
|
@@ -818,28 +782,13 @@
|
|
|
818
782
|
}
|
|
819
783
|
return null;
|
|
820
784
|
}
|
|
821
|
-
function getCrypto() {
|
|
822
|
-
return getGlobalInst(strCrypto);
|
|
823
|
-
}
|
|
824
|
-
function getMsCrypto() {
|
|
825
|
-
return getGlobalInst(strMsCrypto);
|
|
826
|
-
}
|
|
827
|
-
function isIE() {
|
|
828
|
-
var nav = getNavigator();
|
|
829
|
-
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
830
|
-
_navUserAgentCheck = nav.userAgent;
|
|
831
|
-
var userAgent = (_navUserAgentCheck || strEmpty$1).toLowerCase();
|
|
832
|
-
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
833
|
-
}
|
|
834
|
-
return _isTrident;
|
|
835
|
-
}
|
|
836
785
|
function getIEVersion(userAgentStr) {
|
|
837
786
|
if (userAgentStr === void 0) { userAgentStr = null; }
|
|
838
787
|
if (!userAgentStr) {
|
|
839
788
|
var navigator_1 = getNavigator() || {};
|
|
840
|
-
userAgentStr = navigator_1 ? (navigator_1.userAgent ||
|
|
789
|
+
userAgentStr = navigator_1 ? (navigator_1.userAgent || "").toLowerCase() : "";
|
|
841
790
|
}
|
|
842
|
-
var ua = (userAgentStr ||
|
|
791
|
+
var ua = (userAgentStr || "").toLowerCase();
|
|
843
792
|
if (strContains(ua, strMsie)) {
|
|
844
793
|
var doc = getDocument() || {};
|
|
845
794
|
return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
|
|
@@ -854,7 +803,7 @@
|
|
|
854
803
|
}
|
|
855
804
|
function dumpObj(object) {
|
|
856
805
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
857
|
-
var propertyValueDump =
|
|
806
|
+
var propertyValueDump = "";
|
|
858
807
|
if (objectTypeDump === "[object Error]") {
|
|
859
808
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
860
809
|
}
|
|
@@ -872,7 +821,8 @@
|
|
|
872
821
|
function isFetchSupported(withKeepAlive) {
|
|
873
822
|
var isSupported = false;
|
|
874
823
|
try {
|
|
875
|
-
|
|
824
|
+
var fetchApi = getGlobalInst("fetch");
|
|
825
|
+
isSupported = !!fetchApi;
|
|
876
826
|
var request = getGlobalInst("Request");
|
|
877
827
|
if (isSupported && withKeepAlive && request) {
|
|
878
828
|
isSupported = _hasProperty(request, "keepalive");
|
|
@@ -884,9 +834,9 @@
|
|
|
884
834
|
}
|
|
885
835
|
function useXDomainRequest() {
|
|
886
836
|
if (_useXDomainRequest === null) {
|
|
887
|
-
_useXDomainRequest = (typeof XDomainRequest !==
|
|
837
|
+
_useXDomainRequest = (typeof XDomainRequest !== "undefined");
|
|
888
838
|
if (_useXDomainRequest && isXhrSupported()) {
|
|
889
|
-
_useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst(
|
|
839
|
+
_useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst("XMLHttpRequest"), "withCredentials");
|
|
890
840
|
}
|
|
891
841
|
}
|
|
892
842
|
return _useXDomainRequest;
|
|
@@ -894,7 +844,7 @@
|
|
|
894
844
|
function isXhrSupported() {
|
|
895
845
|
var isSupported = false;
|
|
896
846
|
try {
|
|
897
|
-
var xmlHttpRequest = getGlobalInst(
|
|
847
|
+
var xmlHttpRequest = getGlobalInst("XMLHttpRequest");
|
|
898
848
|
isSupported = !!xmlHttpRequest;
|
|
899
849
|
}
|
|
900
850
|
catch (e) {
|
|
@@ -925,9 +875,9 @@
|
|
|
925
875
|
var strWarnToConsole = "warnToConsole";
|
|
926
876
|
function _sanitizeDiagnosticText(text) {
|
|
927
877
|
if (text) {
|
|
928
|
-
return "\"" + text.replace(/\"/g,
|
|
878
|
+
return "\"" + text.replace(/\"/g, "") + "\"";
|
|
929
879
|
}
|
|
930
|
-
return
|
|
880
|
+
return "";
|
|
931
881
|
}
|
|
932
882
|
function _logToConsole(func, message) {
|
|
933
883
|
var theConsole = getConsole();
|
|
@@ -949,12 +899,12 @@
|
|
|
949
899
|
_self.message =
|
|
950
900
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
951
901
|
msgId;
|
|
952
|
-
var strProps =
|
|
902
|
+
var strProps = "";
|
|
953
903
|
if (hasJSON()) {
|
|
954
904
|
strProps = getJSON().stringify(properties);
|
|
955
905
|
}
|
|
956
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
957
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
906
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : "") +
|
|
907
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : "");
|
|
958
908
|
_self.message += diagnosticText;
|
|
959
909
|
}
|
|
960
910
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -981,10 +931,10 @@
|
|
|
981
931
|
if (isUserAct === void 0) { isUserAct = false; }
|
|
982
932
|
var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
|
|
983
933
|
if (_self.enableDebugExceptions()) {
|
|
984
|
-
throw message;
|
|
934
|
+
throw dumpObj(message);
|
|
985
935
|
}
|
|
986
936
|
else {
|
|
987
|
-
var logFunc = severity ===
|
|
937
|
+
var logFunc = severity === LoggingSeverity.CRITICAL ? strErrorToConsole : strWarnToConsole;
|
|
988
938
|
if (!isUndefined(message.message)) {
|
|
989
939
|
var logLevel = _self.consoleLoggingLevel();
|
|
990
940
|
if (isUserAct) {
|
|
@@ -1002,7 +952,7 @@
|
|
|
1002
952
|
_self.logInternalMessage(severity, message);
|
|
1003
953
|
}
|
|
1004
954
|
else {
|
|
1005
|
-
_debugExtMsg("throw" + (severity ===
|
|
955
|
+
_debugExtMsg("throw" + (severity === LoggingSeverity.CRITICAL ? "Critical" : "Warning"), message);
|
|
1006
956
|
}
|
|
1007
957
|
}
|
|
1008
958
|
};
|
|
@@ -1034,13 +984,13 @@
|
|
|
1034
984
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
1035
985
|
_self.queue.push(message);
|
|
1036
986
|
_messageCount++;
|
|
1037
|
-
_debugExtMsg((severity ===
|
|
987
|
+
_debugExtMsg((severity === LoggingSeverity.CRITICAL ? "error" : "warn"), message);
|
|
1038
988
|
}
|
|
1039
989
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
1040
990
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
1041
|
-
var throttleMessage = new _InternalLogMessage(
|
|
991
|
+
var throttleMessage = new _InternalLogMessage(_InternalMessageId.MessageLimitPerPVExceeded, throttleLimitMessage, false);
|
|
1042
992
|
_self.queue.push(throttleMessage);
|
|
1043
|
-
if (severity ===
|
|
993
|
+
if (severity === LoggingSeverity.CRITICAL) {
|
|
1044
994
|
_self.errorToConsole(throttleLimitMessage);
|
|
1045
995
|
}
|
|
1046
996
|
else {
|
|
@@ -1069,10 +1019,6 @@
|
|
|
1069
1019
|
}
|
|
1070
1020
|
return DiagnosticLogger;
|
|
1071
1021
|
}());
|
|
1072
|
-
function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
|
|
1073
|
-
if (isUserAct === void 0) { isUserAct = false; }
|
|
1074
|
-
(logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
|
|
1075
|
-
}
|
|
1076
1022
|
|
|
1077
1023
|
var strExecutionContextKey = "ctx";
|
|
1078
1024
|
var PerfEvent = /** @class */ (function () {
|
|
@@ -1186,616 +1132,207 @@
|
|
|
1186
1132
|
return func();
|
|
1187
1133
|
}
|
|
1188
1134
|
|
|
1189
|
-
var
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
|
-
function random32(signed) {
|
|
1211
|
-
var value = 0;
|
|
1212
|
-
var c = getCrypto() || getMsCrypto();
|
|
1213
|
-
if (c && c.getRandomValues) {
|
|
1214
|
-
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1215
|
-
}
|
|
1216
|
-
if (value === 0 && isIE()) {
|
|
1217
|
-
if (!_mwcSeeded) {
|
|
1218
|
-
_autoSeedMwc();
|
|
1219
|
-
}
|
|
1220
|
-
value = mwcRandom32() & MaxUInt32;
|
|
1221
|
-
}
|
|
1222
|
-
if (value === 0) {
|
|
1223
|
-
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1224
|
-
}
|
|
1225
|
-
if (!signed) {
|
|
1226
|
-
value >>>= 0;
|
|
1227
|
-
}
|
|
1228
|
-
return value;
|
|
1229
|
-
}
|
|
1230
|
-
function mwcRandom32(signed) {
|
|
1231
|
-
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
1232
|
-
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
1233
|
-
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
1234
|
-
if (!signed) {
|
|
1235
|
-
value >>>= 0;
|
|
1236
|
-
}
|
|
1237
|
-
return value;
|
|
1238
|
-
}
|
|
1239
|
-
function newId(maxLength) {
|
|
1240
|
-
if (maxLength === void 0) { maxLength = 22; }
|
|
1241
|
-
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1242
|
-
var number = random32() >>> 0;
|
|
1243
|
-
var chars = 0;
|
|
1244
|
-
var result = strEmpty$1;
|
|
1245
|
-
while (result.length < maxLength) {
|
|
1246
|
-
chars++;
|
|
1247
|
-
result += base64chars.charAt(number & 0x3F);
|
|
1248
|
-
number >>>= 6;
|
|
1249
|
-
if (chars === 5) {
|
|
1250
|
-
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1251
|
-
chars = 0;
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
return result;
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
1258
|
-
var version = "2.7.5-nightly.2204-03";
|
|
1259
|
-
var instanceName = "." + newId(6);
|
|
1260
|
-
var _dataUid = 0;
|
|
1261
|
-
function _createAccessor(target, prop, value) {
|
|
1262
|
-
if (_objDefineProperty) {
|
|
1263
|
-
try {
|
|
1264
|
-
_objDefineProperty(target, prop, {
|
|
1265
|
-
value: value,
|
|
1266
|
-
enumerable: false,
|
|
1267
|
-
configurable: true
|
|
1268
|
-
});
|
|
1269
|
-
return true;
|
|
1270
|
-
}
|
|
1271
|
-
catch (e) {
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
return false;
|
|
1275
|
-
}
|
|
1276
|
-
function _canAcceptData(target) {
|
|
1277
|
-
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1278
|
-
}
|
|
1279
|
-
function _getCache(data, target) {
|
|
1280
|
-
var theCache = target[data.id];
|
|
1281
|
-
if (!theCache) {
|
|
1282
|
-
theCache = {};
|
|
1283
|
-
try {
|
|
1284
|
-
if (_canAcceptData(target)) {
|
|
1285
|
-
if (!_createAccessor(target, data.id, theCache)) {
|
|
1286
|
-
target[data.id] = theCache;
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
catch (e) {
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
return theCache;
|
|
1294
|
-
}
|
|
1295
|
-
function createUniqueNamespace(name, includeVersion) {
|
|
1296
|
-
if (includeVersion === void 0) { includeVersion = false; }
|
|
1297
|
-
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1298
|
-
}
|
|
1299
|
-
function createElmNodeData(name) {
|
|
1300
|
-
var data = {
|
|
1301
|
-
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1302
|
-
accept: function (target) {
|
|
1303
|
-
return _canAcceptData(target);
|
|
1304
|
-
},
|
|
1305
|
-
get: function (target, name, defValue, addDefault) {
|
|
1306
|
-
var theCache = target[data.id];
|
|
1307
|
-
if (!theCache) {
|
|
1308
|
-
if (addDefault) {
|
|
1309
|
-
theCache = _getCache(data, target);
|
|
1310
|
-
theCache[normalizeJsName(name)] = defValue;
|
|
1311
|
-
}
|
|
1312
|
-
return defValue;
|
|
1313
|
-
}
|
|
1314
|
-
return theCache[normalizeJsName(name)];
|
|
1315
|
-
},
|
|
1316
|
-
kill: function (target, name) {
|
|
1317
|
-
if (target && target[name]) {
|
|
1318
|
-
try {
|
|
1319
|
-
delete target[name];
|
|
1320
|
-
}
|
|
1321
|
-
catch (e) {
|
|
1322
|
-
}
|
|
1135
|
+
var TelemetryPluginChain = /** @class */ (function () {
|
|
1136
|
+
function TelemetryPluginChain(plugin, defItemCtx) {
|
|
1137
|
+
var _self = this;
|
|
1138
|
+
var _nextProxy = null;
|
|
1139
|
+
var _hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1140
|
+
var _hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1141
|
+
_self._hasRun = false;
|
|
1142
|
+
_self.getPlugin = function () {
|
|
1143
|
+
return plugin;
|
|
1144
|
+
};
|
|
1145
|
+
_self.getNext = function () {
|
|
1146
|
+
return _nextProxy;
|
|
1147
|
+
};
|
|
1148
|
+
_self.setNext = function (nextPlugin) {
|
|
1149
|
+
_nextProxy = nextPlugin;
|
|
1150
|
+
};
|
|
1151
|
+
_self.processTelemetry = function (env, itemCtx) {
|
|
1152
|
+
if (!itemCtx) {
|
|
1153
|
+
itemCtx = defItemCtx;
|
|
1323
1154
|
}
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
var pluginStateData = createElmNodeData("plugin");
|
|
1330
|
-
function _getPluginState(plugin) {
|
|
1331
|
-
return pluginStateData.get(plugin, "state", {}, true);
|
|
1332
|
-
}
|
|
1333
|
-
|
|
1334
|
-
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1335
|
-
var strHasRunFlags = "_hasRun";
|
|
1336
|
-
var strGetTelCtx = "_getTelCtx";
|
|
1337
|
-
var _chainId = 0;
|
|
1338
|
-
function _getNextProxyStart(proxy, config, core, startAt) {
|
|
1339
|
-
while (proxy) {
|
|
1340
|
-
if (proxy.getPlugin() === startAt) {
|
|
1341
|
-
return proxy;
|
|
1342
|
-
}
|
|
1343
|
-
proxy = proxy.getNext();
|
|
1344
|
-
}
|
|
1345
|
-
return createTelemetryProxyChain([startAt], config, core);
|
|
1346
|
-
}
|
|
1347
|
-
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1348
|
-
var _nextProxy = null;
|
|
1349
|
-
var _onComplete = [];
|
|
1350
|
-
if (startAt !== null) {
|
|
1351
|
-
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1352
|
-
}
|
|
1353
|
-
var context = {
|
|
1354
|
-
_next: _moveNext,
|
|
1355
|
-
ctx: {
|
|
1356
|
-
core: function () {
|
|
1357
|
-
return core;
|
|
1358
|
-
},
|
|
1359
|
-
diagLog: function () {
|
|
1360
|
-
return safeGetLogger(core, config);
|
|
1361
|
-
},
|
|
1362
|
-
getCfg: function () {
|
|
1363
|
-
return config;
|
|
1364
|
-
},
|
|
1365
|
-
getExtCfg: _getExtCfg,
|
|
1366
|
-
getConfig: _getConfig,
|
|
1367
|
-
hasNext: function () {
|
|
1368
|
-
return !!_nextProxy;
|
|
1369
|
-
},
|
|
1370
|
-
getNext: function () {
|
|
1371
|
-
return _nextProxy;
|
|
1372
|
-
},
|
|
1373
|
-
setNext: function (nextPlugin) {
|
|
1374
|
-
_nextProxy = nextPlugin;
|
|
1375
|
-
},
|
|
1376
|
-
iterate: _iterateChain,
|
|
1377
|
-
onComplete: _addOnComplete
|
|
1378
|
-
}
|
|
1379
|
-
};
|
|
1380
|
-
function _addOnComplete(onComplete, that) {
|
|
1381
|
-
var args = [];
|
|
1382
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1383
|
-
args[_i - 2] = arguments[_i];
|
|
1384
|
-
}
|
|
1385
|
-
if (onComplete) {
|
|
1386
|
-
_onComplete.push({
|
|
1387
|
-
func: onComplete,
|
|
1388
|
-
self: !isUndefined(that) ? that : context.ctx,
|
|
1389
|
-
args: args
|
|
1390
|
-
});
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
function _moveNext() {
|
|
1394
|
-
var nextProxy = _nextProxy;
|
|
1395
|
-
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1396
|
-
if (!nextProxy) {
|
|
1397
|
-
var onComplete = _onComplete;
|
|
1398
|
-
if (onComplete && onComplete.length > 0) {
|
|
1399
|
-
arrForEach(onComplete, function (completeDetails) {
|
|
1155
|
+
var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
|
|
1156
|
+
doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
|
|
1157
|
+
if (plugin && _hasProcessTelemetry) {
|
|
1158
|
+
_self._hasRun = true;
|
|
1400
1159
|
try {
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1160
|
+
itemCtx.setNext(_nextProxy);
|
|
1161
|
+
if (_hasSetNext) {
|
|
1162
|
+
plugin.setNextPlugin(_nextProxy);
|
|
1163
|
+
}
|
|
1164
|
+
_nextProxy && (_nextProxy._hasRun = false);
|
|
1165
|
+
plugin.processTelemetry(env, itemCtx);
|
|
1405
1166
|
}
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
return nextProxy;
|
|
1411
|
-
}
|
|
1412
|
-
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1413
|
-
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1414
|
-
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
1415
|
-
var theConfig;
|
|
1416
|
-
if (config) {
|
|
1417
|
-
var extConfig = config.extensionConfig;
|
|
1418
|
-
if (extConfig && identifier) {
|
|
1419
|
-
theConfig = extConfig[identifier];
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1422
|
-
if (!theConfig) {
|
|
1423
|
-
theConfig = defaultValue;
|
|
1424
|
-
}
|
|
1425
|
-
else if (isObject(defaultValue)) {
|
|
1426
|
-
if (mergeDefault !== 0 ) {
|
|
1427
|
-
var newConfig_1 = objExtend(true, defaultValue, theConfig);
|
|
1428
|
-
if (config && mergeDefault === 2 ) {
|
|
1429
|
-
objForEachKey(defaultValue, function (field) {
|
|
1430
|
-
if (isNullOrUndefined(newConfig_1[field])) {
|
|
1431
|
-
var cfgValue = config[field];
|
|
1432
|
-
if (!isNullOrUndefined(cfgValue)) {
|
|
1433
|
-
newConfig_1[field] = cfgValue;
|
|
1434
|
-
}
|
|
1167
|
+
catch (error) {
|
|
1168
|
+
var hasRun = _nextProxy && _nextProxy._hasRun;
|
|
1169
|
+
if (!_nextProxy || !hasRun) {
|
|
1170
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
|
|
1435
1171
|
}
|
|
1436
|
-
|
|
1172
|
+
if (_nextProxy && !hasRun) {
|
|
1173
|
+
_nextProxy.processTelemetry(env, itemCtx);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1437
1176
|
}
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1177
|
+
else if (_nextProxy) {
|
|
1178
|
+
_self._hasRun = true;
|
|
1179
|
+
_nextProxy.processTelemetry(env, itemCtx);
|
|
1180
|
+
}
|
|
1181
|
+
}, function () { return ({ item: env }); }, !(env.sync));
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
return TelemetryPluginChain;
|
|
1185
|
+
}());
|
|
1186
|
+
|
|
1187
|
+
function _createProxyChain(plugins, itemCtx) {
|
|
1188
|
+
var proxies = [];
|
|
1189
|
+
if (plugins && plugins.length > 0) {
|
|
1190
|
+
var lastProxy = null;
|
|
1191
|
+
for (var idx = 0; idx < plugins.length; idx++) {
|
|
1192
|
+
var thePlugin = plugins[idx];
|
|
1193
|
+
if (thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
1194
|
+
var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
|
|
1195
|
+
proxies.push(newProxy);
|
|
1196
|
+
if (lastProxy) {
|
|
1197
|
+
lastProxy.setNext(newProxy);
|
|
1198
|
+
}
|
|
1199
|
+
lastProxy = newProxy;
|
|
1460
1200
|
}
|
|
1461
1201
|
}
|
|
1462
1202
|
}
|
|
1463
|
-
return
|
|
1203
|
+
return proxies.length > 0 ? proxies[0] : null;
|
|
1464
1204
|
}
|
|
1465
|
-
function
|
|
1466
|
-
var
|
|
1467
|
-
var
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1205
|
+
function _copyProxyChain(proxy, itemCtx, startAt) {
|
|
1206
|
+
var plugins = [];
|
|
1207
|
+
var add = startAt ? false : true;
|
|
1208
|
+
if (proxy) {
|
|
1209
|
+
while (proxy) {
|
|
1210
|
+
var thePlugin = proxy.getPlugin();
|
|
1211
|
+
if (add || thePlugin === startAt) {
|
|
1212
|
+
add = true;
|
|
1213
|
+
plugins.push(thePlugin);
|
|
1214
|
+
}
|
|
1215
|
+
proxy = proxy.getNext();
|
|
1477
1216
|
}
|
|
1478
|
-
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1479
1217
|
}
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
return context;
|
|
1483
|
-
}
|
|
1484
|
-
function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
|
|
1485
|
-
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1486
|
-
var context = internalContext.ctx;
|
|
1487
|
-
function _processNext(unloadState) {
|
|
1488
|
-
var nextPlugin = internalContext._next();
|
|
1489
|
-
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1490
|
-
return !nextPlugin;
|
|
1491
|
-
}
|
|
1492
|
-
function _createNew(plugins, startAt) {
|
|
1493
|
-
if (plugins === void 0) { plugins = null; }
|
|
1494
|
-
if (isArray(plugins)) {
|
|
1495
|
-
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1496
|
-
}
|
|
1497
|
-
return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
|
|
1218
|
+
if (!add) {
|
|
1219
|
+
plugins.push(startAt);
|
|
1498
1220
|
}
|
|
1499
|
-
|
|
1500
|
-
context.createNew = _createNew;
|
|
1501
|
-
return context;
|
|
1221
|
+
return _createProxyChain(plugins, itemCtx);
|
|
1502
1222
|
}
|
|
1503
|
-
function
|
|
1504
|
-
var
|
|
1505
|
-
var
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1223
|
+
function _copyPluginChain(srcPlugins, itemCtx, startAt) {
|
|
1224
|
+
var plugins = srcPlugins;
|
|
1225
|
+
var add = false;
|
|
1226
|
+
if (startAt && srcPlugins) {
|
|
1227
|
+
plugins = [];
|
|
1228
|
+
arrForEach(srcPlugins, function (thePlugin) {
|
|
1229
|
+
if (add || thePlugin === startAt) {
|
|
1230
|
+
add = true;
|
|
1231
|
+
plugins.push(thePlugin);
|
|
1510
1232
|
}
|
|
1511
1233
|
});
|
|
1512
1234
|
}
|
|
1513
|
-
|
|
1514
|
-
if (plugins
|
|
1515
|
-
|
|
1516
|
-
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1235
|
+
if (startAt && !add) {
|
|
1236
|
+
if (!plugins) {
|
|
1237
|
+
plugins = [];
|
|
1517
1238
|
}
|
|
1518
|
-
|
|
1239
|
+
plugins.push(startAt);
|
|
1519
1240
|
}
|
|
1520
|
-
|
|
1521
|
-
context.createNew = _createNew;
|
|
1522
|
-
return context;
|
|
1241
|
+
return _createProxyChain(plugins, itemCtx);
|
|
1523
1242
|
}
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
add = true;
|
|
1243
|
+
var ProcessTelemetryContext = /** @class */ (function () {
|
|
1244
|
+
function ProcessTelemetryContext(plugins, config, core, startAt) {
|
|
1245
|
+
var _self = this;
|
|
1246
|
+
var _nextProxy = null;
|
|
1247
|
+
if (startAt !== null) {
|
|
1248
|
+
if (plugins && isFunction(plugins.getPlugin)) {
|
|
1249
|
+
_nextProxy = _copyProxyChain(plugins, _self, startAt || plugins.getPlugin());
|
|
1532
1250
|
}
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
firstProxy = newProxy;
|
|
1251
|
+
else {
|
|
1252
|
+
if (startAt) {
|
|
1253
|
+
_nextProxy = _copyPluginChain(plugins, _self, startAt);
|
|
1537
1254
|
}
|
|
1538
|
-
if (
|
|
1539
|
-
|
|
1255
|
+
else if (isUndefined(startAt)) {
|
|
1256
|
+
_nextProxy = _createProxyChain(plugins, _self);
|
|
1540
1257
|
}
|
|
1541
|
-
lastProxy_1 = newProxy;
|
|
1542
1258
|
}
|
|
1543
|
-
});
|
|
1544
|
-
}
|
|
1545
|
-
if (startAt && !firstProxy) {
|
|
1546
|
-
return createTelemetryProxyChain([startAt], config, core);
|
|
1547
|
-
}
|
|
1548
|
-
return firstProxy;
|
|
1549
|
-
}
|
|
1550
|
-
function createTelemetryPluginProxy(plugin, config, core) {
|
|
1551
|
-
var nextProxy = null;
|
|
1552
|
-
var hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1553
|
-
var hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1554
|
-
var chainId;
|
|
1555
|
-
if (plugin) {
|
|
1556
|
-
chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
|
|
1557
|
-
}
|
|
1558
|
-
else {
|
|
1559
|
-
chainId = "Unknown-0-" + _chainId++;
|
|
1560
|
-
}
|
|
1561
|
-
var proxyChain = {
|
|
1562
|
-
getPlugin: function () {
|
|
1563
|
-
return plugin;
|
|
1564
|
-
},
|
|
1565
|
-
getNext: function () {
|
|
1566
|
-
return nextProxy;
|
|
1567
|
-
},
|
|
1568
|
-
processTelemetry: _processTelemetry,
|
|
1569
|
-
unload: _unloadPlugin,
|
|
1570
|
-
update: _updatePlugin,
|
|
1571
|
-
_id: chainId,
|
|
1572
|
-
_setNext: function (nextPlugin) {
|
|
1573
|
-
nextProxy = nextPlugin;
|
|
1574
|
-
}
|
|
1575
|
-
};
|
|
1576
|
-
function _getTelCtx() {
|
|
1577
|
-
var itemCtx;
|
|
1578
|
-
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1579
|
-
itemCtx = plugin[strGetTelCtx]();
|
|
1580
|
-
}
|
|
1581
|
-
if (!itemCtx) {
|
|
1582
|
-
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1583
1259
|
}
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
hasRunContext[nextId] = false;
|
|
1601
|
-
}
|
|
1602
|
-
hasRun = processPluginFn(itemCtx);
|
|
1603
|
-
}
|
|
1604
|
-
catch (error) {
|
|
1605
|
-
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
1606
|
-
if (hasNextRun) {
|
|
1607
|
-
hasRun = true;
|
|
1608
|
-
}
|
|
1609
|
-
if (!nextProxy || !hasNextRun) {
|
|
1610
|
-
_throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1611
|
-
}
|
|
1260
|
+
_self.core = function () {
|
|
1261
|
+
return core;
|
|
1262
|
+
};
|
|
1263
|
+
_self.diagLog = function () {
|
|
1264
|
+
return safeGetLogger(core, config);
|
|
1265
|
+
};
|
|
1266
|
+
_self.getCfg = function () {
|
|
1267
|
+
return config;
|
|
1268
|
+
};
|
|
1269
|
+
_self.getExtCfg = function (identifier, defaultValue) {
|
|
1270
|
+
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1271
|
+
var theConfig;
|
|
1272
|
+
if (config) {
|
|
1273
|
+
var extConfig = config.extensionConfig;
|
|
1274
|
+
if (extConfig && identifier) {
|
|
1275
|
+
theConfig = extConfig[identifier];
|
|
1612
1276
|
}
|
|
1613
|
-
}, details, isAsync);
|
|
1614
|
-
}
|
|
1615
|
-
return hasRun;
|
|
1616
|
-
}
|
|
1617
|
-
function _processTelemetry(env, itemCtx) {
|
|
1618
|
-
itemCtx = itemCtx || _getTelCtx();
|
|
1619
|
-
function _callProcessTelemetry(itemCtx) {
|
|
1620
|
-
if (!plugin || !hasProcessTelemetry) {
|
|
1621
|
-
return false;
|
|
1622
1277
|
}
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1278
|
+
return (theConfig ? theConfig : defaultValue);
|
|
1279
|
+
};
|
|
1280
|
+
_self.getConfig = function (identifier, field, defaultValue) {
|
|
1281
|
+
if (defaultValue === void 0) { defaultValue = false; }
|
|
1282
|
+
var theValue;
|
|
1283
|
+
var extConfig = _self.getExtCfg(identifier, null);
|
|
1284
|
+
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1285
|
+
theValue = extConfig[field];
|
|
1626
1286
|
}
|
|
1627
|
-
if (
|
|
1628
|
-
|
|
1287
|
+
else if (config && !isNullOrUndefined(config[field])) {
|
|
1288
|
+
theValue = config[field];
|
|
1629
1289
|
}
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
function
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
pluginState[strIsInitialized] = false;
|
|
1647
|
-
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1648
|
-
hasRun = true;
|
|
1649
|
-
}
|
|
1650
|
-
}
|
|
1651
|
-
}
|
|
1652
|
-
return hasRun;
|
|
1653
|
-
}
|
|
1654
|
-
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
|
|
1655
|
-
unloadCtx.processNext(unloadState);
|
|
1656
|
-
}
|
|
1657
|
-
}
|
|
1658
|
-
function _updatePlugin(updateCtx, updateState) {
|
|
1659
|
-
function _callUpdate() {
|
|
1660
|
-
var hasRun = false;
|
|
1661
|
-
if (plugin) {
|
|
1662
|
-
var pluginState = _getPluginState(plugin);
|
|
1663
|
-
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1664
|
-
if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1665
|
-
if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
|
|
1666
|
-
hasRun = true;
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1290
|
+
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1291
|
+
};
|
|
1292
|
+
_self.hasNext = function () {
|
|
1293
|
+
return _nextProxy != null;
|
|
1294
|
+
};
|
|
1295
|
+
_self.getNext = function () {
|
|
1296
|
+
return _nextProxy;
|
|
1297
|
+
};
|
|
1298
|
+
_self.setNext = function (nextPlugin) {
|
|
1299
|
+
_nextProxy = nextPlugin;
|
|
1300
|
+
};
|
|
1301
|
+
_self.processNext = function (env) {
|
|
1302
|
+
var nextPlugin = _nextProxy;
|
|
1303
|
+
if (nextPlugin) {
|
|
1304
|
+
_nextProxy = nextPlugin.getNext();
|
|
1305
|
+
nextPlugin.processTelemetry(env, _self);
|
|
1669
1306
|
}
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
}
|
|
1307
|
+
};
|
|
1308
|
+
_self.createNew = function (plugins, startAt) {
|
|
1309
|
+
if (plugins === void 0) { plugins = null; }
|
|
1310
|
+
return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1311
|
+
};
|
|
1675
1312
|
}
|
|
1676
|
-
return
|
|
1677
|
-
}
|
|
1313
|
+
return ProcessTelemetryContext;
|
|
1314
|
+
}());
|
|
1678
1315
|
|
|
1679
1316
|
var strExtensionConfig = "extensionConfig";
|
|
1680
1317
|
|
|
1681
|
-
function createUnloadHandlerContainer() {
|
|
1682
|
-
var handlers = [];
|
|
1683
|
-
function _addHandler(handler) {
|
|
1684
|
-
if (handler) {
|
|
1685
|
-
handlers.push(handler);
|
|
1686
|
-
}
|
|
1687
|
-
}
|
|
1688
|
-
function _runHandlers(unloadCtx, unloadState) {
|
|
1689
|
-
arrForEach(handlers, function (handler) {
|
|
1690
|
-
try {
|
|
1691
|
-
handler(unloadCtx, unloadState);
|
|
1692
|
-
}
|
|
1693
|
-
catch (e) {
|
|
1694
|
-
_throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
1695
|
-
}
|
|
1696
|
-
});
|
|
1697
|
-
handlers = [];
|
|
1698
|
-
}
|
|
1699
|
-
return {
|
|
1700
|
-
add: _addHandler,
|
|
1701
|
-
run: _runHandlers
|
|
1702
|
-
};
|
|
1703
|
-
}
|
|
1704
|
-
|
|
1705
1318
|
var strGetPlugin = "getPlugin";
|
|
1706
1319
|
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
1707
1320
|
function BaseTelemetryPlugin() {
|
|
1708
1321
|
var _self = this;
|
|
1709
|
-
var _isinitialized;
|
|
1710
|
-
var _rootCtx;
|
|
1711
|
-
var _nextPlugin;
|
|
1712
|
-
|
|
1713
|
-
var _hooks;
|
|
1714
|
-
_initDefaults();
|
|
1715
|
-
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
1716
|
-
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
1717
|
-
_setDefaults(config, core, pluginChain);
|
|
1718
|
-
_isinitialized = true;
|
|
1719
|
-
};
|
|
1720
|
-
_self.teardown = function (unloadCtx, unloadState) {
|
|
1721
|
-
if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
|
|
1722
|
-
return;
|
|
1723
|
-
}
|
|
1724
|
-
var result;
|
|
1725
|
-
var unloadDone = false;
|
|
1726
|
-
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1727
|
-
var theUnloadState = unloadState || {
|
|
1728
|
-
reason: 0 ,
|
|
1729
|
-
isAsync: false
|
|
1730
|
-
};
|
|
1731
|
-
function _unloadCallback() {
|
|
1732
|
-
if (!unloadDone) {
|
|
1733
|
-
unloadDone = true;
|
|
1734
|
-
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
1735
|
-
arrForEach(_hooks, function (fn) {
|
|
1736
|
-
fn.rm();
|
|
1737
|
-
});
|
|
1738
|
-
_hooks = [];
|
|
1739
|
-
if (result === true) {
|
|
1740
|
-
theUnloadCtx.processNext(theUnloadState);
|
|
1741
|
-
}
|
|
1742
|
-
_initDefaults();
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
1746
|
-
_unloadCallback();
|
|
1747
|
-
}
|
|
1748
|
-
else {
|
|
1749
|
-
result = true;
|
|
1750
|
-
}
|
|
1751
|
-
return result;
|
|
1752
|
-
};
|
|
1753
|
-
_self.update = function (updateCtx, updateState) {
|
|
1754
|
-
if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
|
|
1755
|
-
return;
|
|
1756
|
-
}
|
|
1757
|
-
var result;
|
|
1758
|
-
var updateDone = false;
|
|
1759
|
-
var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1760
|
-
var theUpdateState = updateState || {
|
|
1761
|
-
reason: 0
|
|
1762
|
-
};
|
|
1763
|
-
function _updateCallback() {
|
|
1764
|
-
if (!updateDone) {
|
|
1765
|
-
updateDone = true;
|
|
1766
|
-
_setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
|
|
1767
|
-
}
|
|
1768
|
-
}
|
|
1769
|
-
if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
|
|
1770
|
-
_updateCallback();
|
|
1771
|
-
}
|
|
1772
|
-
else {
|
|
1773
|
-
result = true;
|
|
1774
|
-
}
|
|
1775
|
-
return result;
|
|
1776
|
-
};
|
|
1777
|
-
_self._addHook = function (hooks) {
|
|
1778
|
-
if (hooks) {
|
|
1779
|
-
if (isArray(hooks)) {
|
|
1780
|
-
_hooks = _hooks.concat(hooks);
|
|
1781
|
-
}
|
|
1782
|
-
else {
|
|
1783
|
-
_hooks.push(hooks);
|
|
1784
|
-
}
|
|
1785
|
-
}
|
|
1786
|
-
};
|
|
1787
|
-
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
1788
|
-
});
|
|
1322
|
+
var _isinitialized = false;
|
|
1323
|
+
var _rootCtx = null;
|
|
1324
|
+
var _nextPlugin = null;
|
|
1325
|
+
_self.core = null;
|
|
1789
1326
|
_self.diagLog = function (itemCtx) {
|
|
1790
|
-
return _getTelCtx(itemCtx).diagLog();
|
|
1327
|
+
return _self._getTelCtx(itemCtx).diagLog();
|
|
1791
1328
|
};
|
|
1792
|
-
_self
|
|
1329
|
+
_self.isInitialized = function () {
|
|
1793
1330
|
return _isinitialized;
|
|
1794
1331
|
};
|
|
1795
1332
|
_self.setInitialized = function (isInitialized) {
|
|
1796
1333
|
_isinitialized = isInitialized;
|
|
1797
1334
|
};
|
|
1798
|
-
_self
|
|
1335
|
+
_self.setNextPlugin = function (next) {
|
|
1799
1336
|
_nextPlugin = next;
|
|
1800
1337
|
};
|
|
1801
1338
|
_self.processNext = function (env, itemCtx) {
|
|
@@ -1806,12 +1343,11 @@
|
|
|
1806
1343
|
_nextPlugin.processTelemetry(env, null);
|
|
1807
1344
|
}
|
|
1808
1345
|
};
|
|
1809
|
-
_self._getTelCtx =
|
|
1810
|
-
function _getTelCtx(currentCtx) {
|
|
1346
|
+
_self._getTelCtx = function (currentCtx) {
|
|
1811
1347
|
if (currentCtx === void 0) { currentCtx = null; }
|
|
1812
1348
|
var itemCtx = currentCtx;
|
|
1813
1349
|
if (!itemCtx) {
|
|
1814
|
-
var rootCtx = _rootCtx ||
|
|
1350
|
+
var rootCtx = _rootCtx || new ProcessTelemetryContext(null, {}, _self.core);
|
|
1815
1351
|
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1816
1352
|
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
1817
1353
|
}
|
|
@@ -1820,8 +1356,8 @@
|
|
|
1820
1356
|
}
|
|
1821
1357
|
}
|
|
1822
1358
|
return itemCtx;
|
|
1823
|
-
}
|
|
1824
|
-
function
|
|
1359
|
+
};
|
|
1360
|
+
_self._baseTelInit = function (config, core, extensions, pluginChain) {
|
|
1825
1361
|
if (config) {
|
|
1826
1362
|
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
1827
1363
|
}
|
|
@@ -1833,280 +1369,16 @@
|
|
|
1833
1369
|
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
1834
1370
|
}
|
|
1835
1371
|
_self.core = core;
|
|
1836
|
-
_rootCtx =
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
_isinitialized = false;
|
|
1840
|
-
_self.core = null;
|
|
1841
|
-
_rootCtx = null;
|
|
1842
|
-
_nextPlugin = null;
|
|
1843
|
-
_hooks = [];
|
|
1844
|
-
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
1845
|
-
}
|
|
1372
|
+
_rootCtx = new ProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
1373
|
+
_isinitialized = true;
|
|
1374
|
+
};
|
|
1846
1375
|
}
|
|
1376
|
+
BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
|
|
1377
|
+
this._baseTelInit(config, core, extensions, pluginChain);
|
|
1378
|
+
};
|
|
1847
1379
|
return BaseTelemetryPlugin;
|
|
1848
1380
|
}());
|
|
1849
1381
|
|
|
1850
|
-
var strOnPrefix = "on";
|
|
1851
|
-
var strAttachEvent = "attachEvent";
|
|
1852
|
-
var strAddEventHelper = "addEventListener";
|
|
1853
|
-
var strDetachEvent = "detachEvent";
|
|
1854
|
-
var strRemoveEventListener = "removeEventListener";
|
|
1855
|
-
var strEvents = "events";
|
|
1856
|
-
createUniqueNamespace("aiEvtPageHide");
|
|
1857
|
-
createUniqueNamespace("aiEvtPageShow");
|
|
1858
|
-
var rRemoveEmptyNs = /\.[\.]+/g;
|
|
1859
|
-
var rRemoveTrailingEmptyNs = /[\.]+$/;
|
|
1860
|
-
var _guid = 1;
|
|
1861
|
-
var elmNodeData = createElmNodeData("events");
|
|
1862
|
-
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
1863
|
-
function _normalizeNamespace(name) {
|
|
1864
|
-
if (name && name.replace) {
|
|
1865
|
-
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
1866
|
-
}
|
|
1867
|
-
return name;
|
|
1868
|
-
}
|
|
1869
|
-
function _getEvtNamespace(eventName, evtNamespace) {
|
|
1870
|
-
if (evtNamespace) {
|
|
1871
|
-
var theNamespace_1 = "";
|
|
1872
|
-
if (isArray(evtNamespace)) {
|
|
1873
|
-
theNamespace_1 = "";
|
|
1874
|
-
arrForEach(evtNamespace, function (name) {
|
|
1875
|
-
name = _normalizeNamespace(name);
|
|
1876
|
-
if (name) {
|
|
1877
|
-
if (name[0] !== ".") {
|
|
1878
|
-
name = "." + name;
|
|
1879
|
-
}
|
|
1880
|
-
theNamespace_1 += name;
|
|
1881
|
-
}
|
|
1882
|
-
});
|
|
1883
|
-
}
|
|
1884
|
-
else {
|
|
1885
|
-
theNamespace_1 = _normalizeNamespace(evtNamespace);
|
|
1886
|
-
}
|
|
1887
|
-
if (theNamespace_1) {
|
|
1888
|
-
if (theNamespace_1[0] !== ".") {
|
|
1889
|
-
theNamespace_1 = "." + theNamespace_1;
|
|
1890
|
-
}
|
|
1891
|
-
eventName = (eventName || "") + theNamespace_1;
|
|
1892
|
-
}
|
|
1893
|
-
}
|
|
1894
|
-
var parsedEvent = (eventNamespace.exec(eventName || "") || []);
|
|
1895
|
-
return {
|
|
1896
|
-
type: parsedEvent[1],
|
|
1897
|
-
ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
|
|
1898
|
-
};
|
|
1899
|
-
}
|
|
1900
|
-
function _getRegisteredEvents(target, evtName, addDefault) {
|
|
1901
|
-
if (addDefault === void 0) { addDefault = true; }
|
|
1902
|
-
var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
|
|
1903
|
-
var registeredEvents = aiEvts[evtName];
|
|
1904
|
-
if (!registeredEvents) {
|
|
1905
|
-
registeredEvents = aiEvts[evtName] = [];
|
|
1906
|
-
}
|
|
1907
|
-
return registeredEvents;
|
|
1908
|
-
}
|
|
1909
|
-
function _doDetach(obj, evtName, handlerRef, useCapture) {
|
|
1910
|
-
if (obj && evtName && evtName.type) {
|
|
1911
|
-
if (obj[strRemoveEventListener]) {
|
|
1912
|
-
obj[strRemoveEventListener](evtName.type, handlerRef, useCapture);
|
|
1913
|
-
}
|
|
1914
|
-
else if (obj[strDetachEvent]) {
|
|
1915
|
-
obj[strDetachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
1916
|
-
}
|
|
1917
|
-
}
|
|
1918
|
-
}
|
|
1919
|
-
function _doAttach(obj, evtName, handlerRef, useCapture) {
|
|
1920
|
-
var result = false;
|
|
1921
|
-
if (obj && evtName && evtName.type && handlerRef) {
|
|
1922
|
-
if (obj[strAddEventHelper]) {
|
|
1923
|
-
obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
|
|
1924
|
-
result = true;
|
|
1925
|
-
}
|
|
1926
|
-
else if (obj[strAttachEvent]) {
|
|
1927
|
-
obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
1928
|
-
result = true;
|
|
1929
|
-
}
|
|
1930
|
-
}
|
|
1931
|
-
return result;
|
|
1932
|
-
}
|
|
1933
|
-
function _doUnregister(target, events, evtName, unRegFn) {
|
|
1934
|
-
var idx = events.length;
|
|
1935
|
-
while (idx--) {
|
|
1936
|
-
var theEvent = events[idx];
|
|
1937
|
-
if (theEvent) {
|
|
1938
|
-
if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {
|
|
1939
|
-
if (!unRegFn || unRegFn(theEvent)) {
|
|
1940
|
-
_doDetach(target, theEvent.evtName, theEvent.handler, theEvent.capture);
|
|
1941
|
-
events.splice(idx, 1);
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
}
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
1947
|
-
function _unregisterEvents(target, evtName, unRegFn) {
|
|
1948
|
-
if (evtName.type) {
|
|
1949
|
-
_doUnregister(target, _getRegisteredEvents(target, evtName.type), evtName, unRegFn);
|
|
1950
|
-
}
|
|
1951
|
-
else {
|
|
1952
|
-
var eventCache = elmNodeData.get(target, strEvents, {});
|
|
1953
|
-
objForEachKey(eventCache, function (evtType, events) {
|
|
1954
|
-
_doUnregister(target, events, evtName, unRegFn);
|
|
1955
|
-
});
|
|
1956
|
-
if (objKeys(eventCache).length === 0) {
|
|
1957
|
-
elmNodeData.kill(target, strEvents);
|
|
1958
|
-
}
|
|
1959
|
-
}
|
|
1960
|
-
}
|
|
1961
|
-
function mergeEvtNamespace(theNamespace, namespaces) {
|
|
1962
|
-
var newNamespaces;
|
|
1963
|
-
if (namespaces) {
|
|
1964
|
-
if (isArray(namespaces)) {
|
|
1965
|
-
newNamespaces = [theNamespace].concat(namespaces);
|
|
1966
|
-
}
|
|
1967
|
-
else {
|
|
1968
|
-
newNamespaces = [theNamespace, namespaces];
|
|
1969
|
-
}
|
|
1970
|
-
newNamespaces = (_getEvtNamespace("xx", newNamespaces).ns).split(".");
|
|
1971
|
-
}
|
|
1972
|
-
else {
|
|
1973
|
-
newNamespaces = theNamespace;
|
|
1974
|
-
}
|
|
1975
|
-
return newNamespaces;
|
|
1976
|
-
}
|
|
1977
|
-
function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
1978
|
-
if (useCapture === void 0) { useCapture = false; }
|
|
1979
|
-
var result = false;
|
|
1980
|
-
if (target) {
|
|
1981
|
-
try {
|
|
1982
|
-
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
1983
|
-
result = _doAttach(target, evtName, handlerRef, useCapture);
|
|
1984
|
-
if (result && elmNodeData.accept(target)) {
|
|
1985
|
-
var registeredEvent = {
|
|
1986
|
-
guid: _guid++,
|
|
1987
|
-
evtName: evtName,
|
|
1988
|
-
handler: handlerRef,
|
|
1989
|
-
capture: useCapture
|
|
1990
|
-
};
|
|
1991
|
-
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
1992
|
-
}
|
|
1993
|
-
}
|
|
1994
|
-
catch (e) {
|
|
1995
|
-
}
|
|
1996
|
-
}
|
|
1997
|
-
return result;
|
|
1998
|
-
}
|
|
1999
|
-
function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
2000
|
-
if (useCapture === void 0) { useCapture = false; }
|
|
2001
|
-
if (target) {
|
|
2002
|
-
try {
|
|
2003
|
-
var evtName_1 = _getEvtNamespace(eventName, evtNamespace);
|
|
2004
|
-
var found_1 = false;
|
|
2005
|
-
_unregisterEvents(target, evtName_1, function (regEvent) {
|
|
2006
|
-
if ((evtName_1.ns && !handlerRef) || regEvent.handler === handlerRef) {
|
|
2007
|
-
found_1 = true;
|
|
2008
|
-
return true;
|
|
2009
|
-
}
|
|
2010
|
-
return false;
|
|
2011
|
-
});
|
|
2012
|
-
if (!found_1) {
|
|
2013
|
-
_doDetach(target, evtName_1, handlerRef, useCapture);
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
catch (e) {
|
|
2017
|
-
}
|
|
2018
|
-
}
|
|
2019
|
-
}
|
|
2020
|
-
|
|
2021
|
-
var LoggingSeverity = createEnumStyle({
|
|
2022
|
-
CRITICAL: 1 ,
|
|
2023
|
-
WARNING: 2
|
|
2024
|
-
});
|
|
2025
|
-
var _InternalMessageId = createEnumStyle({
|
|
2026
|
-
BrowserDoesNotSupportLocalStorage: 0 ,
|
|
2027
|
-
BrowserCannotReadLocalStorage: 1 ,
|
|
2028
|
-
BrowserCannotReadSessionStorage: 2 ,
|
|
2029
|
-
BrowserCannotWriteLocalStorage: 3 ,
|
|
2030
|
-
BrowserCannotWriteSessionStorage: 4 ,
|
|
2031
|
-
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
2032
|
-
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
2033
|
-
CannotSendEmptyTelemetry: 7 ,
|
|
2034
|
-
ClientPerformanceMathError: 8 ,
|
|
2035
|
-
ErrorParsingAISessionCookie: 9 ,
|
|
2036
|
-
ErrorPVCalc: 10 ,
|
|
2037
|
-
ExceptionWhileLoggingError: 11 ,
|
|
2038
|
-
FailedAddingTelemetryToBuffer: 12 ,
|
|
2039
|
-
FailedMonitorAjaxAbort: 13 ,
|
|
2040
|
-
FailedMonitorAjaxDur: 14 ,
|
|
2041
|
-
FailedMonitorAjaxOpen: 15 ,
|
|
2042
|
-
FailedMonitorAjaxRSC: 16 ,
|
|
2043
|
-
FailedMonitorAjaxSend: 17 ,
|
|
2044
|
-
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
2045
|
-
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
2046
|
-
FailedToSendQueuedTelemetry: 20 ,
|
|
2047
|
-
FailedToReportDataLoss: 21 ,
|
|
2048
|
-
FlushFailed: 22 ,
|
|
2049
|
-
MessageLimitPerPVExceeded: 23 ,
|
|
2050
|
-
MissingRequiredFieldSpecification: 24 ,
|
|
2051
|
-
NavigationTimingNotSupported: 25 ,
|
|
2052
|
-
OnError: 26 ,
|
|
2053
|
-
SessionRenewalDateIsZero: 27 ,
|
|
2054
|
-
SenderNotInitialized: 28 ,
|
|
2055
|
-
StartTrackEventFailed: 29 ,
|
|
2056
|
-
StopTrackEventFailed: 30 ,
|
|
2057
|
-
StartTrackFailed: 31 ,
|
|
2058
|
-
StopTrackFailed: 32 ,
|
|
2059
|
-
TelemetrySampledAndNotSent: 33 ,
|
|
2060
|
-
TrackEventFailed: 34 ,
|
|
2061
|
-
TrackExceptionFailed: 35 ,
|
|
2062
|
-
TrackMetricFailed: 36 ,
|
|
2063
|
-
TrackPVFailed: 37 ,
|
|
2064
|
-
TrackPVFailedCalc: 38 ,
|
|
2065
|
-
TrackTraceFailed: 39 ,
|
|
2066
|
-
TransmissionFailed: 40 ,
|
|
2067
|
-
FailedToSetStorageBuffer: 41 ,
|
|
2068
|
-
FailedToRestoreStorageBuffer: 42 ,
|
|
2069
|
-
InvalidBackendResponse: 43 ,
|
|
2070
|
-
FailedToFixDepricatedValues: 44 ,
|
|
2071
|
-
InvalidDurationValue: 45 ,
|
|
2072
|
-
TelemetryEnvelopeInvalid: 46 ,
|
|
2073
|
-
CreateEnvelopeError: 47 ,
|
|
2074
|
-
CannotSerializeObject: 48 ,
|
|
2075
|
-
CannotSerializeObjectNonSerializable: 49 ,
|
|
2076
|
-
CircularReferenceDetected: 50 ,
|
|
2077
|
-
ClearAuthContextFailed: 51 ,
|
|
2078
|
-
ExceptionTruncated: 52 ,
|
|
2079
|
-
IllegalCharsInName: 53 ,
|
|
2080
|
-
ItemNotInArray: 54 ,
|
|
2081
|
-
MaxAjaxPerPVExceeded: 55 ,
|
|
2082
|
-
MessageTruncated: 56 ,
|
|
2083
|
-
NameTooLong: 57 ,
|
|
2084
|
-
SampleRateOutOfRange: 58 ,
|
|
2085
|
-
SetAuthContextFailed: 59 ,
|
|
2086
|
-
SetAuthContextFailedAccountName: 60 ,
|
|
2087
|
-
StringValueTooLong: 61 ,
|
|
2088
|
-
StartCalledMoreThanOnce: 62 ,
|
|
2089
|
-
StopCalledWithoutStart: 63 ,
|
|
2090
|
-
TelemetryInitializerFailed: 64 ,
|
|
2091
|
-
TrackArgumentsNotSpecified: 65 ,
|
|
2092
|
-
UrlTooLong: 66 ,
|
|
2093
|
-
SessionStorageBufferFull: 67 ,
|
|
2094
|
-
CannotAccessCookie: 68 ,
|
|
2095
|
-
IdTooLong: 69 ,
|
|
2096
|
-
InvalidEvent: 70 ,
|
|
2097
|
-
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
2098
|
-
SendBrowserInfoOnUserInit: 72 ,
|
|
2099
|
-
PluginException: 73 ,
|
|
2100
|
-
NotificationException: 74 ,
|
|
2101
|
-
SnippetScriptLoadFailure: 99 ,
|
|
2102
|
-
InvalidInstrumentationKey: 100 ,
|
|
2103
|
-
CannotParseAiBlobValue: 101 ,
|
|
2104
|
-
InvalidContentBlob: 102 ,
|
|
2105
|
-
TrackPageActionEventFailed: 103 ,
|
|
2106
|
-
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
2107
|
-
InMemoryStorageBufferFull: 105
|
|
2108
|
-
});
|
|
2109
|
-
|
|
2110
1382
|
var RequestHeaders = {
|
|
2111
1383
|
requestContextHeader: "Request-Context",
|
|
2112
1384
|
requestContextTargetKey: "appId",
|
|
@@ -2139,7 +1411,7 @@
|
|
|
2139
1411
|
name = strTrim(name.toString());
|
|
2140
1412
|
if (name.length > 150 ) {
|
|
2141
1413
|
nameTrunc = name.substring(0, 150 );
|
|
2142
|
-
|
|
1414
|
+
logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
|
|
2143
1415
|
}
|
|
2144
1416
|
}
|
|
2145
1417
|
return nameTrunc || name;
|
|
@@ -2152,7 +1424,7 @@
|
|
|
2152
1424
|
value = strTrim(value);
|
|
2153
1425
|
if (value.toString().length > maxLength) {
|
|
2154
1426
|
valueTrunc = value.toString().substring(0, maxLength);
|
|
2155
|
-
|
|
1427
|
+
logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
|
|
2156
1428
|
}
|
|
2157
1429
|
}
|
|
2158
1430
|
return valueTrunc || value;
|
|
@@ -2165,7 +1437,7 @@
|
|
|
2165
1437
|
if (message) {
|
|
2166
1438
|
if (message.length > 32768 ) {
|
|
2167
1439
|
messageTrunc = message.substring(0, 32768 );
|
|
2168
|
-
|
|
1440
|
+
logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
|
|
2169
1441
|
}
|
|
2170
1442
|
}
|
|
2171
1443
|
return messageTrunc || message;
|
|
@@ -2176,7 +1448,7 @@
|
|
|
2176
1448
|
var value = "" + exception;
|
|
2177
1449
|
if (value.length > 32768 ) {
|
|
2178
1450
|
exceptionTrunc = value.substring(0, 32768 );
|
|
2179
|
-
|
|
1451
|
+
logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
|
|
2180
1452
|
}
|
|
2181
1453
|
}
|
|
2182
1454
|
return exceptionTrunc || exception;
|
|
@@ -2190,7 +1462,7 @@
|
|
|
2190
1462
|
value = getJSON().stringify(value);
|
|
2191
1463
|
}
|
|
2192
1464
|
catch (e) {
|
|
2193
|
-
|
|
1465
|
+
logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
|
|
2194
1466
|
}
|
|
2195
1467
|
}
|
|
2196
1468
|
value = dataSanitizeString(logger, value, 8192 );
|
|
@@ -2221,7 +1493,7 @@
|
|
|
2221
1493
|
input = strTrim(input);
|
|
2222
1494
|
if (input.length > maxLength) {
|
|
2223
1495
|
inputTrunc = input.substring(0, maxLength);
|
|
2224
|
-
|
|
1496
|
+
logger && logger.throwInternal(LoggingSeverity.WARNING, _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
|
|
2225
1497
|
}
|
|
2226
1498
|
}
|
|
2227
1499
|
return inputTrunc || input;
|
|
@@ -2231,22 +1503,21 @@
|
|
|
2231
1503
|
return s.substr(s.length - 3);
|
|
2232
1504
|
}
|
|
2233
1505
|
|
|
2234
|
-
var strEmpty = "";
|
|
2235
1506
|
function msToTimeSpan(totalms) {
|
|
2236
1507
|
if (isNaN(totalms) || totalms < 0) {
|
|
2237
1508
|
totalms = 0;
|
|
2238
1509
|
}
|
|
2239
1510
|
totalms = Math.round(totalms);
|
|
2240
|
-
var ms =
|
|
2241
|
-
var sec =
|
|
2242
|
-
var min =
|
|
2243
|
-
var hour =
|
|
1511
|
+
var ms = "" + totalms % 1000;
|
|
1512
|
+
var sec = "" + Math.floor(totalms / 1000) % 60;
|
|
1513
|
+
var min = "" + Math.floor(totalms / (1000 * 60)) % 60;
|
|
1514
|
+
var hour = "" + Math.floor(totalms / (1000 * 60 * 60)) % 24;
|
|
2244
1515
|
var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
|
|
2245
1516
|
ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
|
|
2246
1517
|
sec = sec.length < 2 ? "0" + sec : sec;
|
|
2247
1518
|
min = min.length < 2 ? "0" + min : min;
|
|
2248
1519
|
hour = hour.length < 2 ? "0" + hour : hour;
|
|
2249
|
-
return (days > 0 ? days + "." :
|
|
1520
|
+
return (days > 0 ? days + "." : "") + hour + ":" + min + ":" + sec + "." + ms;
|
|
2250
1521
|
}
|
|
2251
1522
|
|
|
2252
1523
|
var DisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
|
|
@@ -2255,15 +1526,17 @@
|
|
|
2255
1526
|
var HttpMethod = "http.method";
|
|
2256
1527
|
var strNotSpecified = "not_specified";
|
|
2257
1528
|
|
|
2258
|
-
var StorageType
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
1529
|
+
var StorageType;
|
|
1530
|
+
(function (StorageType) {
|
|
1531
|
+
StorageType[StorageType["LocalStorage"] = 0] = "LocalStorage";
|
|
1532
|
+
StorageType[StorageType["SessionStorage"] = 1] = "SessionStorage";
|
|
1533
|
+
})(StorageType || (StorageType = {}));
|
|
1534
|
+
var DistributedTracingModes;
|
|
1535
|
+
(function (DistributedTracingModes) {
|
|
1536
|
+
DistributedTracingModes[DistributedTracingModes["AI"] = 0] = "AI";
|
|
1537
|
+
DistributedTracingModes[DistributedTracingModes["AI_AND_W3C"] = 1] = "AI_AND_W3C";
|
|
1538
|
+
DistributedTracingModes[DistributedTracingModes["W3C"] = 2] = "W3C";
|
|
1539
|
+
})(DistributedTracingModes || (DistributedTracingModes = {}));
|
|
2267
1540
|
|
|
2268
1541
|
var _canUseSessionStorage = undefined;
|
|
2269
1542
|
function _getVerifiedStorageObject(storageType) {
|
|
@@ -2290,8 +1563,8 @@
|
|
|
2290
1563
|
}
|
|
2291
1564
|
return null;
|
|
2292
1565
|
}
|
|
2293
|
-
function utlCanUseSessionStorage(
|
|
2294
|
-
if (
|
|
1566
|
+
function utlCanUseSessionStorage() {
|
|
1567
|
+
if (_canUseSessionStorage === undefined) {
|
|
2295
1568
|
_canUseSessionStorage = !!_getVerifiedStorageObject(StorageType.SessionStorage);
|
|
2296
1569
|
}
|
|
2297
1570
|
return _canUseSessionStorage;
|
|
@@ -2304,7 +1577,7 @@
|
|
|
2304
1577
|
}
|
|
2305
1578
|
catch (e) {
|
|
2306
1579
|
_canUseSessionStorage = false;
|
|
2307
|
-
|
|
1580
|
+
logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2308
1581
|
}
|
|
2309
1582
|
}
|
|
2310
1583
|
return null;
|
|
@@ -2318,7 +1591,7 @@
|
|
|
2318
1591
|
}
|
|
2319
1592
|
catch (e) {
|
|
2320
1593
|
_canUseSessionStorage = false;
|
|
2321
|
-
|
|
1594
|
+
logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2322
1595
|
}
|
|
2323
1596
|
}
|
|
2324
1597
|
return false;
|
|
@@ -2383,7 +1656,7 @@
|
|
|
2383
1656
|
"https://dc-int.services.visualstudio.com/v2/track"
|
|
2384
1657
|
];
|
|
2385
1658
|
function isInternalApplicationInsightsEndpoint(endpointUrl) {
|
|
2386
|
-
return _internalEndpoints
|
|
1659
|
+
return arrIndexOf(_internalEndpoints, endpointUrl.toLowerCase()) !== -1;
|
|
2387
1660
|
}
|
|
2388
1661
|
function AjaxHelperParseDependencyPath(logger, absoluteUrl, method, commandName) {
|
|
2389
1662
|
var target, name = commandName, data = commandName;
|
|
@@ -3595,7 +2868,7 @@
|
|
|
3595
2868
|
}
|
|
3596
2869
|
}
|
|
3597
2870
|
var EnvelopeCreator = {
|
|
3598
|
-
Version: "2.7.
|
|
2871
|
+
Version: "2.7.6"
|
|
3599
2872
|
};
|
|
3600
2873
|
function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
|
|
3601
2874
|
EnvelopeCreatorInit(logger, telemetryItem);
|
|
@@ -3890,81 +3163,65 @@
|
|
|
3890
3163
|
return Serializer;
|
|
3891
3164
|
}());
|
|
3892
3165
|
|
|
3893
|
-
function
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3166
|
+
var OfflineListener = /** @class */ (function () {
|
|
3167
|
+
function OfflineListener() {
|
|
3168
|
+
var _window = getWindow();
|
|
3169
|
+
var _document = getDocument();
|
|
3170
|
+
var isListening = false;
|
|
3171
|
+
var _onlineStatus = true;
|
|
3172
|
+
dynamicProto(OfflineListener, this, function (_self) {
|
|
3173
|
+
try {
|
|
3174
|
+
if (_window) {
|
|
3175
|
+
if (attachEvent(_window, "online", _setOnline)) {
|
|
3176
|
+
attachEvent(_window, "offline", _setOffline);
|
|
3177
|
+
isListening = true;
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
if (_document) {
|
|
3181
|
+
var target = _document.body || _document;
|
|
3182
|
+
if (!isUndefined(target.ononline)) {
|
|
3183
|
+
target.ononline = _setOnline;
|
|
3184
|
+
target.onoffline = _setOffline;
|
|
3185
|
+
isListening = true;
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
if (isListening) {
|
|
3189
|
+
var _navigator = getNavigator();
|
|
3190
|
+
if (_navigator && !isNullOrUndefined(_navigator.onLine)) {
|
|
3191
|
+
_onlineStatus = _navigator.onLine;
|
|
3192
|
+
}
|
|
3911
3193
|
}
|
|
3912
3194
|
}
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
if (_navigator && !isNullOrUndefined(_navigator.onLine)) {
|
|
3916
|
-
_onlineStatus = _navigator.onLine;
|
|
3917
|
-
}
|
|
3918
|
-
}
|
|
3919
|
-
}
|
|
3920
|
-
catch (e) {
|
|
3921
|
-
_isListening = false;
|
|
3922
|
-
}
|
|
3923
|
-
function _enableEvents(target) {
|
|
3924
|
-
var enabled = false;
|
|
3925
|
-
if (target) {
|
|
3926
|
-
enabled = eventOn(target, "online", _setOnline, _evtNamespace);
|
|
3927
|
-
if (enabled) {
|
|
3928
|
-
eventOn(target, "offline", _setOffline, _evtNamespace);
|
|
3195
|
+
catch (e) {
|
|
3196
|
+
isListening = false;
|
|
3929
3197
|
}
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
function _isOnline() {
|
|
3940
|
-
var result = true;
|
|
3941
|
-
if (_isListening) {
|
|
3942
|
-
result = _onlineStatus;
|
|
3943
|
-
}
|
|
3944
|
-
else if (_navigator && !isNullOrUndefined(_navigator.onLine)) {
|
|
3945
|
-
result = _navigator.onLine;
|
|
3946
|
-
}
|
|
3947
|
-
return result;
|
|
3948
|
-
}
|
|
3949
|
-
function _unload() {
|
|
3950
|
-
var win = getWindow();
|
|
3951
|
-
if (win && _isListening) {
|
|
3952
|
-
_disableEvents(win, _evtNamespace);
|
|
3953
|
-
if (_document) {
|
|
3954
|
-
var target = _document.body || _document;
|
|
3955
|
-
if (!isUndefined(target.ononline)) {
|
|
3956
|
-
_disableEvents(target, _evtNamespace);
|
|
3198
|
+
_self.isListening = isListening;
|
|
3199
|
+
_self.isOnline = function () {
|
|
3200
|
+
var result = true;
|
|
3201
|
+
var _navigator = getNavigator();
|
|
3202
|
+
if (isListening) {
|
|
3203
|
+
result = _onlineStatus;
|
|
3204
|
+
}
|
|
3205
|
+
else if (_navigator && !isNullOrUndefined(_navigator.onLine)) {
|
|
3206
|
+
result = _navigator.onLine;
|
|
3957
3207
|
}
|
|
3208
|
+
return result;
|
|
3209
|
+
};
|
|
3210
|
+
_self.isOffline = function () {
|
|
3211
|
+
return !_self.isOnline();
|
|
3212
|
+
};
|
|
3213
|
+
function _setOnline() {
|
|
3214
|
+
_onlineStatus = true;
|
|
3958
3215
|
}
|
|
3959
|
-
|
|
3960
|
-
|
|
3216
|
+
function _setOffline() {
|
|
3217
|
+
_onlineStatus = false;
|
|
3218
|
+
}
|
|
3219
|
+
});
|
|
3961
3220
|
}
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
};
|
|
3967
|
-
}
|
|
3221
|
+
OfflineListener.Offline = new OfflineListener;
|
|
3222
|
+
return OfflineListener;
|
|
3223
|
+
}());
|
|
3224
|
+
var Offline = OfflineListener.Offline;
|
|
3968
3225
|
|
|
3969
3226
|
var MIN_INPUT_LENGTH = 8;
|
|
3970
3227
|
var HashCodeScoreGenerator = /** @class */ (function () {
|
|
@@ -4092,22 +3349,22 @@
|
|
|
4092
3349
|
var _this = _super.call(this) || this;
|
|
4093
3350
|
_this.priority = 1001;
|
|
4094
3351
|
_this.identifier = BreezeChannelIdentifier;
|
|
4095
|
-
_this._senderConfig = _getDefaultAppInsightsChannelConfig();
|
|
4096
3352
|
var _consecutiveErrors;
|
|
4097
3353
|
var _retryAt;
|
|
4098
3354
|
var _lastSend;
|
|
4099
|
-
var _paused;
|
|
3355
|
+
var _paused = false;
|
|
4100
3356
|
var _timeoutHandle;
|
|
4101
3357
|
var _serializer;
|
|
4102
3358
|
var _stamp_specific_redirects;
|
|
4103
|
-
var _headers;
|
|
3359
|
+
var _headers = {};
|
|
4104
3360
|
var _syncFetchPayload = 0;
|
|
4105
3361
|
var _fallbackSender;
|
|
4106
3362
|
var _syncUnloadSender;
|
|
4107
|
-
|
|
4108
|
-
var _evtNamespace;
|
|
3363
|
+
_this._senderConfig = _getDefaultAppInsightsChannelConfig();
|
|
4109
3364
|
dynamicProto(Sender, _this, function (_self, _base) {
|
|
4110
|
-
|
|
3365
|
+
function _notImplemented() {
|
|
3366
|
+
throwError("Method not implemented.");
|
|
3367
|
+
}
|
|
4111
3368
|
_self.pause = function () {
|
|
4112
3369
|
_clearScheduledTimer();
|
|
4113
3370
|
_paused = true;
|
|
@@ -4122,15 +3379,14 @@
|
|
|
4122
3379
|
_setupTimer();
|
|
4123
3380
|
}
|
|
4124
3381
|
};
|
|
4125
|
-
_self.flush = function (
|
|
4126
|
-
if (isAsync === void 0) { isAsync = true; }
|
|
3382
|
+
_self.flush = function () {
|
|
4127
3383
|
if (!_paused) {
|
|
4128
3384
|
_clearScheduledTimer();
|
|
4129
3385
|
try {
|
|
4130
|
-
_self.triggerSend(
|
|
3386
|
+
_self.triggerSend(true, null, 1 );
|
|
4131
3387
|
}
|
|
4132
3388
|
catch (e) {
|
|
4133
|
-
|
|
3389
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FlushFailed, "flush failed, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
4134
3390
|
}
|
|
4135
3391
|
}
|
|
4136
3392
|
};
|
|
@@ -4141,7 +3397,7 @@
|
|
|
4141
3397
|
_self.triggerSend(true, _doUnloadSend, 2 );
|
|
4142
3398
|
}
|
|
4143
3399
|
catch (e) {
|
|
4144
|
-
|
|
3400
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToSendQueuedTelemetry, "failed to flush with beacon sender on page unload, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
4145
3401
|
}
|
|
4146
3402
|
}
|
|
4147
3403
|
else {
|
|
@@ -4149,13 +3405,11 @@
|
|
|
4149
3405
|
}
|
|
4150
3406
|
}
|
|
4151
3407
|
};
|
|
3408
|
+
_self.teardown = _notImplemented;
|
|
4152
3409
|
_self.addHeader = function (name, value) {
|
|
4153
3410
|
_headers[name] = value;
|
|
4154
3411
|
};
|
|
4155
3412
|
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
4156
|
-
if (_self.isInitialized()) {
|
|
4157
|
-
_throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.SenderNotInitialized, "Sender is already initialized");
|
|
4158
|
-
}
|
|
4159
3413
|
_base.initialize(config, core, extensions, pluginChain);
|
|
4160
3414
|
var ctx = _self._getTelCtx();
|
|
4161
3415
|
var identifier = _self.identifier;
|
|
@@ -4166,8 +3420,6 @@
|
|
|
4166
3420
|
_self._sender = null;
|
|
4167
3421
|
_stamp_specific_redirects = 0;
|
|
4168
3422
|
var diagLog = _self.diagLog();
|
|
4169
|
-
_evtNamespace = mergeEvtNamespace(createUniqueNamespace("Sender"), core.evtNamespace && core.evtNamespace());
|
|
4170
|
-
_offlineListener = createOfflineListener(_evtNamespace);
|
|
4171
3423
|
var defaultConfig = _getDefaultAppInsightsChannelConfig();
|
|
4172
3424
|
objForEachKey(defaultConfig, function (field, value) {
|
|
4173
3425
|
_self._senderConfig[field] = function () { return ctx.getConfig(identifier, field, value()); };
|
|
@@ -4176,7 +3428,7 @@
|
|
|
4176
3428
|
? new SessionStorageSendBuffer(diagLog, _self._senderConfig) : new ArraySendBuffer(diagLog, _self._senderConfig);
|
|
4177
3429
|
_self._sample = new Sample(_self._senderConfig.samplingPercentage(), diagLog);
|
|
4178
3430
|
if (!_validateInstrumentationKey(config)) {
|
|
4179
|
-
|
|
3431
|
+
diagLog.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidInstrumentationKey, "Invalid Instrumentation key " + config.instrumentationKey);
|
|
4180
3432
|
}
|
|
4181
3433
|
if (!isInternalApplicationInsightsEndpoint(_self._senderConfig.endpointUrl()) && _self._senderConfig.customHeaders() && _self._senderConfig.customHeaders().length > 0) {
|
|
4182
3434
|
arrForEach(_self._senderConfig.customHeaders(), function (customHeader) {
|
|
@@ -4222,22 +3474,22 @@
|
|
|
4222
3474
|
return;
|
|
4223
3475
|
}
|
|
4224
3476
|
if (!telemetryItem) {
|
|
4225
|
-
|
|
3477
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSendEmptyTelemetry, "Cannot send empty telemetry");
|
|
4226
3478
|
return;
|
|
4227
3479
|
}
|
|
4228
3480
|
if (telemetryItem.baseData && !telemetryItem.baseType) {
|
|
4229
|
-
|
|
3481
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidEvent, "Cannot send telemetry without baseData and baseType");
|
|
4230
3482
|
return;
|
|
4231
3483
|
}
|
|
4232
3484
|
if (!telemetryItem.baseType) {
|
|
4233
3485
|
telemetryItem.baseType = "EventData";
|
|
4234
3486
|
}
|
|
4235
3487
|
if (!_self._sender) {
|
|
4236
|
-
|
|
3488
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.SenderNotInitialized, "Sender was not initialized");
|
|
4237
3489
|
return;
|
|
4238
3490
|
}
|
|
4239
3491
|
if (!_isSampledIn(telemetryItem)) {
|
|
4240
|
-
|
|
3492
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TelemetrySampledAndNotSent, "Telemetry item was sampled out and not sent", { SampleRate: _self._sample.sampleRate });
|
|
4241
3493
|
return;
|
|
4242
3494
|
}
|
|
4243
3495
|
else {
|
|
@@ -4247,7 +3499,7 @@
|
|
|
4247
3499
|
var defaultEnvelopeIkey = telemetryItem.iKey || _self._senderConfig.instrumentationKey();
|
|
4248
3500
|
var aiEnvelope_1 = Sender.constructEnvelope(telemetryItem, defaultEnvelopeIkey, itemCtx.diagLog(), convertUndefined);
|
|
4249
3501
|
if (!aiEnvelope_1) {
|
|
4250
|
-
|
|
3502
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CreateEnvelopeError, "Unable to create an AppInsights envelope");
|
|
4251
3503
|
return;
|
|
4252
3504
|
}
|
|
4253
3505
|
var doNotSendItem_1 = false;
|
|
@@ -4260,7 +3512,7 @@
|
|
|
4260
3512
|
}
|
|
4261
3513
|
}
|
|
4262
3514
|
catch (e) {
|
|
4263
|
-
|
|
3515
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
|
|
4264
3516
|
}
|
|
4265
3517
|
});
|
|
4266
3518
|
delete telemetryItem.tags[ProcessLegacy];
|
|
@@ -4278,7 +3530,7 @@
|
|
|
4278
3530
|
_setupTimer();
|
|
4279
3531
|
}
|
|
4280
3532
|
catch (e) {
|
|
4281
|
-
|
|
3533
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedAddingTelemetryToBuffer, "Failed adding telemetry to the sender's buffer, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
4282
3534
|
}
|
|
4283
3535
|
_self.processNext(telemetryItem, itemCtx);
|
|
4284
3536
|
};
|
|
@@ -4313,18 +3565,13 @@
|
|
|
4313
3565
|
catch (e) {
|
|
4314
3566
|
var ieVer = getIEVersion();
|
|
4315
3567
|
if (!ieVer || ieVer > 9) {
|
|
4316
|
-
|
|
3568
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TransmissionFailed, "Telemetry transmission failed, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
4317
3569
|
}
|
|
4318
3570
|
}
|
|
4319
3571
|
}
|
|
4320
3572
|
};
|
|
4321
|
-
_self._doTeardown = function (unloadCtx, unloadState) {
|
|
4322
|
-
_self.onunloadFlush();
|
|
4323
|
-
_offlineListener.unload();
|
|
4324
|
-
_initDefaults();
|
|
4325
|
-
};
|
|
4326
3573
|
_self._onError = function (payload, message, event) {
|
|
4327
|
-
|
|
3574
|
+
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.OnError, "Failed to send telemetry.", { message: message });
|
|
4328
3575
|
_self._buffer.clearSent(payload);
|
|
4329
3576
|
};
|
|
4330
3577
|
_self._onPartialSuccess = function (payload, results) {
|
|
@@ -4349,7 +3596,7 @@
|
|
|
4349
3596
|
}
|
|
4350
3597
|
if (retry.length > 0) {
|
|
4351
3598
|
_resendPayload(retry);
|
|
4352
|
-
|
|
3599
|
+
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, "Partial success. " +
|
|
4353
3600
|
"Delivered: " + payload.length + ", Failed: " + failed.length +
|
|
4354
3601
|
". Will retry to send " + retry.length + " our of " + results.itemsReceived + " items");
|
|
4355
3602
|
}
|
|
@@ -4394,18 +3641,18 @@
|
|
|
4394
3641
|
}
|
|
4395
3642
|
if (!_self._senderConfig.isRetryDisabled() && _isRetriable(status)) {
|
|
4396
3643
|
_resendPayload(payload);
|
|
4397
|
-
|
|
3644
|
+
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " +
|
|
4398
3645
|
"Response code " + status + ". Will retry to send " + payload.length + " items.");
|
|
4399
3646
|
}
|
|
4400
3647
|
else {
|
|
4401
3648
|
_self._onError(payload, errorMessage);
|
|
4402
3649
|
}
|
|
4403
3650
|
}
|
|
4404
|
-
else if (
|
|
3651
|
+
else if (Offline.isOffline()) {
|
|
4405
3652
|
if (!_self._senderConfig.isRetryDisabled()) {
|
|
4406
3653
|
var offlineBackOffMultiplier = 10;
|
|
4407
3654
|
_resendPayload(payload, offlineBackOffMultiplier);
|
|
4408
|
-
|
|
3655
|
+
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". Offline - Response Code: ".concat(status, ". Offline status: ").concat(Offline.isOffline(), ". Will retry to send ").concat(payload.length, " items."));
|
|
4409
3656
|
}
|
|
4410
3657
|
}
|
|
4411
3658
|
else {
|
|
@@ -4472,8 +3719,8 @@
|
|
|
4472
3719
|
}
|
|
4473
3720
|
}
|
|
4474
3721
|
if (droppedPayload.length > 0) {
|
|
4475
|
-
_fallbackSender
|
|
4476
|
-
|
|
3722
|
+
_fallbackSender(droppedPayload, true);
|
|
3723
|
+
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " + "Failed to send telemetry with Beacon API, retried with normal sender.");
|
|
4477
3724
|
}
|
|
4478
3725
|
}
|
|
4479
3726
|
}
|
|
@@ -4514,7 +3761,7 @@
|
|
|
4514
3761
|
}
|
|
4515
3762
|
else {
|
|
4516
3763
|
_fallbackSender && _fallbackSender(payload, true);
|
|
4517
|
-
|
|
3764
|
+
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " + "Failed to send telemetry with Beacon API, retried with xhrSender.");
|
|
4518
3765
|
}
|
|
4519
3766
|
}
|
|
4520
3767
|
}
|
|
@@ -4605,7 +3852,7 @@
|
|
|
4605
3852
|
}
|
|
4606
3853
|
}
|
|
4607
3854
|
catch (e) {
|
|
4608
|
-
|
|
3855
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidBackendResponse, "Cannot parse the response. " + getExceptionName(e), {
|
|
4609
3856
|
response: response
|
|
4610
3857
|
});
|
|
4611
3858
|
}
|
|
@@ -4676,7 +3923,7 @@
|
|
|
4676
3923
|
xdr.onerror = function (event) { return _self._onError(payload, _formatErrorMessageXdr(xdr), event); };
|
|
4677
3924
|
var hostingProtocol = _window && _window.location && _window.location.protocol || "";
|
|
4678
3925
|
if (_self._senderConfig.endpointUrl().lastIndexOf(hostingProtocol, 0) !== 0) {
|
|
4679
|
-
|
|
3926
|
+
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " +
|
|
4680
3927
|
"Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol.");
|
|
4681
3928
|
buffer.clear();
|
|
4682
3929
|
return;
|
|
@@ -4707,7 +3954,7 @@
|
|
|
4707
3954
|
manager.eventsSendRequest(sendRequest, isAsync);
|
|
4708
3955
|
}
|
|
4709
3956
|
catch (e) {
|
|
4710
|
-
|
|
3957
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.NotificationException, "send request notification failed: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
4711
3958
|
}
|
|
4712
3959
|
}
|
|
4713
3960
|
}
|
|
@@ -4720,25 +3967,6 @@
|
|
|
4720
3967
|
var regexp = new RegExp(UUID_Regex);
|
|
4721
3968
|
return regexp.test(config.instrumentationKey);
|
|
4722
3969
|
}
|
|
4723
|
-
function _initDefaults() {
|
|
4724
|
-
_self._sender = null;
|
|
4725
|
-
_self._buffer = null;
|
|
4726
|
-
_self._appId = null;
|
|
4727
|
-
_self._sample = null;
|
|
4728
|
-
_headers = {};
|
|
4729
|
-
_offlineListener = null;
|
|
4730
|
-
_consecutiveErrors = 0;
|
|
4731
|
-
_retryAt = null;
|
|
4732
|
-
_lastSend = null;
|
|
4733
|
-
_paused = false;
|
|
4734
|
-
_timeoutHandle = null;
|
|
4735
|
-
_serializer = null;
|
|
4736
|
-
_stamp_specific_redirects = 0;
|
|
4737
|
-
_syncFetchPayload = 0;
|
|
4738
|
-
_fallbackSender = null;
|
|
4739
|
-
_syncUnloadSender = null;
|
|
4740
|
-
_evtNamespace = null;
|
|
4741
|
-
}
|
|
4742
3970
|
});
|
|
4743
3971
|
return _this;
|
|
4744
3972
|
}
|