@microsoft/applicationinsights-web 2.8.0-beta.2202-07 → 2.8.0-beta.2203-03
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/browser/{ai.2.8.0-beta.2202-07.cjs.js → ai.2.8.0-beta.2203-03.cjs.js} +1069 -522
- package/browser/ai.2.8.0-beta.2203-03.cjs.js.map +1 -0
- package/browser/ai.2.8.0-beta.2203-03.cjs.min.js +6 -0
- package/browser/ai.2.8.0-beta.2203-03.cjs.min.js.map +1 -0
- package/browser/{ai.2.8.0-beta.2202-07.gbl.js → ai.2.8.0-beta.2203-03.gbl.js} +1069 -522
- package/browser/ai.2.8.0-beta.2203-03.gbl.js.map +1 -0
- package/browser/ai.2.8.0-beta.2203-03.gbl.min.js +6 -0
- package/browser/ai.2.8.0-beta.2203-03.gbl.min.js.map +1 -0
- package/browser/ai.2.8.0-beta.2203-03.integrity.json +66 -0
- package/browser/{ai.2.8.0-beta.2202-07.js → ai.2.8.0-beta.2203-03.js} +1069 -522
- package/browser/ai.2.8.0-beta.2203-03.js.map +1 -0
- package/browser/ai.2.8.0-beta.2203-03.min.js +6 -0
- package/browser/ai.2.8.0-beta.2203-03.min.js.map +1 -0
- package/browser/ai.2.cjs.js +1068 -521
- package/browser/ai.2.cjs.js.map +1 -1
- package/browser/ai.2.cjs.min.js +2 -2
- package/browser/ai.2.cjs.min.js.map +1 -1
- package/browser/ai.2.gbl.js +1068 -521
- package/browser/ai.2.gbl.js.map +1 -1
- package/browser/ai.2.gbl.min.js +2 -2
- package/browser/ai.2.gbl.min.js.map +1 -1
- package/browser/ai.2.js +1068 -521
- package/browser/ai.2.js.map +1 -1
- package/browser/ai.2.min.js +2 -2
- package/browser/ai.2.min.js.map +1 -1
- package/dist/applicationinsights-web.api.json +925 -660
- package/dist/applicationinsights-web.api.md +53 -32
- package/dist/applicationinsights-web.d.ts +358 -93
- package/dist/applicationinsights-web.js +1134 -585
- package/dist/applicationinsights-web.js.map +1 -1
- package/dist/applicationinsights-web.min.js +2 -2
- package/dist/applicationinsights-web.min.js.map +1 -1
- package/dist/applicationinsights-web.rollup.d.ts +358 -93
- package/dist-esm/ApplicationInsightsContainer.js +1 -1
- package/dist-esm/ApplicationInsightsDeprecated.js +1 -1
- package/dist-esm/Init.js +1 -1
- package/dist-esm/Initialization.js +1 -1
- package/dist-esm/applicationinsights-web.js +1 -1
- package/package.json +7 -7
- package/types/Initialization.d.ts +6 -2
- package/browser/ai.2.8.0-beta.2202-07.cjs.js.map +0 -1
- package/browser/ai.2.8.0-beta.2202-07.cjs.min.js +0 -6
- package/browser/ai.2.8.0-beta.2202-07.cjs.min.js.map +0 -1
- package/browser/ai.2.8.0-beta.2202-07.gbl.js.map +0 -1
- package/browser/ai.2.8.0-beta.2202-07.gbl.min.js +0 -6
- package/browser/ai.2.8.0-beta.2202-07.gbl.min.js.map +0 -1
- package/browser/ai.2.8.0-beta.2202-07.integrity.json +0 -66
- package/browser/ai.2.8.0-beta.2202-07.js.map +0 -1
- package/browser/ai.2.8.0-beta.2202-07.min.js +0 -6
- package/browser/ai.2.8.0-beta.2202-07.min.js.map +0 -1
package/browser/ai.2.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Web, 2.8.0-beta.
|
|
2
|
+
* Application Insights JavaScript SDK - Web, 2.8.0-beta.2203-03
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -350,99 +350,26 @@
|
|
|
350
350
|
};
|
|
351
351
|
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
352
352
|
|
|
353
|
-
var
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
var
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
FailedMonitorAjaxAbort: 13,
|
|
373
|
-
FailedMonitorAjaxDur: 14,
|
|
374
|
-
FailedMonitorAjaxOpen: 15,
|
|
375
|
-
FailedMonitorAjaxRSC: 16,
|
|
376
|
-
FailedMonitorAjaxSend: 17,
|
|
377
|
-
FailedMonitorAjaxGetCorrelationHeader: 18,
|
|
378
|
-
FailedToAddHandlerForOnBeforeUnload: 19,
|
|
379
|
-
FailedToSendQueuedTelemetry: 20,
|
|
380
|
-
FailedToReportDataLoss: 21,
|
|
381
|
-
FlushFailed: 22,
|
|
382
|
-
MessageLimitPerPVExceeded: 23,
|
|
383
|
-
MissingRequiredFieldSpecification: 24,
|
|
384
|
-
NavigationTimingNotSupported: 25,
|
|
385
|
-
OnError: 26,
|
|
386
|
-
SessionRenewalDateIsZero: 27,
|
|
387
|
-
SenderNotInitialized: 28,
|
|
388
|
-
StartTrackEventFailed: 29,
|
|
389
|
-
StopTrackEventFailed: 30,
|
|
390
|
-
StartTrackFailed: 31,
|
|
391
|
-
StopTrackFailed: 32,
|
|
392
|
-
TelemetrySampledAndNotSent: 33,
|
|
393
|
-
TrackEventFailed: 34,
|
|
394
|
-
TrackExceptionFailed: 35,
|
|
395
|
-
TrackMetricFailed: 36,
|
|
396
|
-
TrackPVFailed: 37,
|
|
397
|
-
TrackPVFailedCalc: 38,
|
|
398
|
-
TrackTraceFailed: 39,
|
|
399
|
-
TransmissionFailed: 40,
|
|
400
|
-
FailedToSetStorageBuffer: 41,
|
|
401
|
-
FailedToRestoreStorageBuffer: 42,
|
|
402
|
-
InvalidBackendResponse: 43,
|
|
403
|
-
FailedToFixDepricatedValues: 44,
|
|
404
|
-
InvalidDurationValue: 45,
|
|
405
|
-
TelemetryEnvelopeInvalid: 46,
|
|
406
|
-
CreateEnvelopeError: 47,
|
|
407
|
-
CannotSerializeObject: 48,
|
|
408
|
-
CannotSerializeObjectNonSerializable: 49,
|
|
409
|
-
CircularReferenceDetected: 50,
|
|
410
|
-
ClearAuthContextFailed: 51,
|
|
411
|
-
ExceptionTruncated: 52,
|
|
412
|
-
IllegalCharsInName: 53,
|
|
413
|
-
ItemNotInArray: 54,
|
|
414
|
-
MaxAjaxPerPVExceeded: 55,
|
|
415
|
-
MessageTruncated: 56,
|
|
416
|
-
NameTooLong: 57,
|
|
417
|
-
SampleRateOutOfRange: 58,
|
|
418
|
-
SetAuthContextFailed: 59,
|
|
419
|
-
SetAuthContextFailedAccountName: 60,
|
|
420
|
-
StringValueTooLong: 61,
|
|
421
|
-
StartCalledMoreThanOnce: 62,
|
|
422
|
-
StopCalledWithoutStart: 63,
|
|
423
|
-
TelemetryInitializerFailed: 64,
|
|
424
|
-
TrackArgumentsNotSpecified: 65,
|
|
425
|
-
UrlTooLong: 66,
|
|
426
|
-
SessionStorageBufferFull: 67,
|
|
427
|
-
CannotAccessCookie: 68,
|
|
428
|
-
IdTooLong: 69,
|
|
429
|
-
InvalidEvent: 70,
|
|
430
|
-
FailedMonitorAjaxSetRequestHeader: 71,
|
|
431
|
-
SendBrowserInfoOnUserInit: 72,
|
|
432
|
-
PluginException: 73,
|
|
433
|
-
NotificationException: 74,
|
|
434
|
-
SnippetScriptLoadFailure: 99,
|
|
435
|
-
InvalidInstrumentationKey: 100,
|
|
436
|
-
CannotParseAiBlobValue: 101,
|
|
437
|
-
InvalidContentBlob: 102,
|
|
438
|
-
TrackPageActionEventFailed: 103,
|
|
439
|
-
FailedAddingCustomDefinedRequestContext: 104,
|
|
440
|
-
InMemoryStorageBufferFull: 105
|
|
441
|
-
};
|
|
353
|
+
var strEmpty$1 = "";
|
|
354
|
+
var strProcessTelemetry = "processTelemetry";
|
|
355
|
+
var strPriority = "priority";
|
|
356
|
+
var strSetNextPlugin = "setNextPlugin";
|
|
357
|
+
var strIsInitialized = "isInitialized";
|
|
358
|
+
var strTeardown = "teardown";
|
|
359
|
+
var strCore = "core";
|
|
360
|
+
var strDisabled = "disabled";
|
|
361
|
+
var strDoTeardown = "_doTeardown";
|
|
362
|
+
var strProcessNext = "processNext";
|
|
363
|
+
var strResume = "resume";
|
|
364
|
+
var strPause = "pause";
|
|
365
|
+
var strNotificationListener = "NotificationListener";
|
|
366
|
+
var strAddNotificationListener = "add" + strNotificationListener;
|
|
367
|
+
var strRemoveNotificationListener = "remove" + strNotificationListener;
|
|
368
|
+
var strEventsSent = "eventsSent";
|
|
369
|
+
var strEventsDiscarded = "eventsDiscarded";
|
|
370
|
+
var strEventsSendRequest = "eventsSendRequest";
|
|
371
|
+
var strPerfEvent = "perfEvent";
|
|
442
372
|
|
|
443
|
-
var strOnPrefix = "on";
|
|
444
|
-
var strAttachEvent = "attachEvent";
|
|
445
|
-
var strAddEventHelper = "addEventListener";
|
|
446
373
|
var strToISOString = "toISOString";
|
|
447
374
|
var cStrEndsWith = "endsWith";
|
|
448
375
|
var strIndexOf = "indexOf";
|
|
@@ -452,7 +379,7 @@
|
|
|
452
379
|
var strToString = "toString";
|
|
453
380
|
var str__Proto = "__proto__";
|
|
454
381
|
var strConstructor = "constructor";
|
|
455
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
382
|
+
var _objDefineProperty$1 = ObjDefineProperty;
|
|
456
383
|
var _objFreeze = ObjClass.freeze;
|
|
457
384
|
var _objKeys = ObjClass.keys;
|
|
458
385
|
var StringProto = String[strShimPrototype];
|
|
@@ -501,25 +428,6 @@
|
|
|
501
428
|
function isFunction(value) {
|
|
502
429
|
return !!(value && typeof value === strShimFunction);
|
|
503
430
|
}
|
|
504
|
-
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
505
|
-
if (useCapture === void 0) { useCapture = false; }
|
|
506
|
-
var result = false;
|
|
507
|
-
if (!isNullOrUndefined(obj)) {
|
|
508
|
-
try {
|
|
509
|
-
if (!isNullOrUndefined(obj[strAddEventHelper])) {
|
|
510
|
-
obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);
|
|
511
|
-
result = true;
|
|
512
|
-
}
|
|
513
|
-
else if (!isNullOrUndefined(obj[strAttachEvent])) {
|
|
514
|
-
obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
515
|
-
result = true;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
catch (e) {
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
return result;
|
|
522
|
-
}
|
|
523
431
|
function normalizeJsName(name) {
|
|
524
432
|
var value = name;
|
|
525
433
|
if (value && isString(value)) {
|
|
@@ -751,7 +659,7 @@
|
|
|
751
659
|
return result;
|
|
752
660
|
}
|
|
753
661
|
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
754
|
-
if (_objDefineProperty) {
|
|
662
|
+
if (_objDefineProperty$1) {
|
|
755
663
|
try {
|
|
756
664
|
var descriptor = {
|
|
757
665
|
enumerable: true,
|
|
@@ -763,7 +671,7 @@
|
|
|
763
671
|
if (setProp) {
|
|
764
672
|
descriptor.set = setProp;
|
|
765
673
|
}
|
|
766
|
-
_objDefineProperty(target, prop, descriptor);
|
|
674
|
+
_objDefineProperty$1(target, prop, descriptor);
|
|
767
675
|
return true;
|
|
768
676
|
}
|
|
769
677
|
catch (e) {
|
|
@@ -783,7 +691,7 @@
|
|
|
783
691
|
if (isError(object)) {
|
|
784
692
|
return object.name;
|
|
785
693
|
}
|
|
786
|
-
return
|
|
694
|
+
return strEmpty$1;
|
|
787
695
|
}
|
|
788
696
|
function setValue(target, field, value, valChk, srcChk) {
|
|
789
697
|
var theValue = value;
|
|
@@ -900,6 +808,17 @@
|
|
|
900
808
|
return class_1;
|
|
901
809
|
}());
|
|
902
810
|
}
|
|
811
|
+
function createEnumStyle(values) {
|
|
812
|
+
var enumClass = {};
|
|
813
|
+
objForEachKey(values, function (field, value) {
|
|
814
|
+
enumClass[field] = value;
|
|
815
|
+
if (!isUndefined(enumClass[value])) {
|
|
816
|
+
throwError("[" + value + "] exists for " + field);
|
|
817
|
+
}
|
|
818
|
+
enumClass[value] = field;
|
|
819
|
+
});
|
|
820
|
+
return objFreeze(enumClass);
|
|
821
|
+
}
|
|
903
822
|
function optimizeObject(theObject) {
|
|
904
823
|
if (theObject && ObjAssign) {
|
|
905
824
|
theObject = ObjClass(ObjAssign({}, theObject));
|
|
@@ -1089,7 +1008,7 @@
|
|
|
1089
1008
|
var nav = getNavigator();
|
|
1090
1009
|
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
1091
1010
|
_navUserAgentCheck = nav.userAgent;
|
|
1092
|
-
var userAgent = (_navUserAgentCheck ||
|
|
1011
|
+
var userAgent = (_navUserAgentCheck || strEmpty$1).toLowerCase();
|
|
1093
1012
|
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
1094
1013
|
}
|
|
1095
1014
|
return _isTrident;
|
|
@@ -1098,9 +1017,9 @@
|
|
|
1098
1017
|
if (userAgentStr === void 0) { userAgentStr = null; }
|
|
1099
1018
|
if (!userAgentStr) {
|
|
1100
1019
|
var navigator_1 = getNavigator() || {};
|
|
1101
|
-
userAgentStr = navigator_1 ? (navigator_1.userAgent ||
|
|
1020
|
+
userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty$1).toLowerCase() : strEmpty$1;
|
|
1102
1021
|
}
|
|
1103
|
-
var ua = (userAgentStr ||
|
|
1022
|
+
var ua = (userAgentStr || strEmpty$1).toLowerCase();
|
|
1104
1023
|
if (strContains(ua, strMsie)) {
|
|
1105
1024
|
var doc = getDocument() || {};
|
|
1106
1025
|
return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
|
|
@@ -1115,7 +1034,7 @@
|
|
|
1115
1034
|
}
|
|
1116
1035
|
function dumpObj(object) {
|
|
1117
1036
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
1118
|
-
var propertyValueDump =
|
|
1037
|
+
var propertyValueDump = strEmpty$1;
|
|
1119
1038
|
if (objectTypeDump === "[object Error]") {
|
|
1120
1039
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
1121
1040
|
}
|
|
@@ -1209,9 +1128,9 @@
|
|
|
1209
1128
|
var strWarnToConsole = "warnToConsole";
|
|
1210
1129
|
function _sanitizeDiagnosticText(text) {
|
|
1211
1130
|
if (text) {
|
|
1212
|
-
return "\"" + text.replace(/\"/g,
|
|
1131
|
+
return "\"" + text.replace(/\"/g, strEmpty$1) + "\"";
|
|
1213
1132
|
}
|
|
1214
|
-
return
|
|
1133
|
+
return strEmpty$1;
|
|
1215
1134
|
}
|
|
1216
1135
|
function _logToConsole(func, message) {
|
|
1217
1136
|
var theConsole = getConsole();
|
|
@@ -1233,12 +1152,12 @@
|
|
|
1233
1152
|
_self.message =
|
|
1234
1153
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
1235
1154
|
msgId;
|
|
1236
|
-
var strProps =
|
|
1155
|
+
var strProps = strEmpty$1;
|
|
1237
1156
|
if (hasJSON()) {
|
|
1238
1157
|
strProps = getJSON().stringify(properties);
|
|
1239
1158
|
}
|
|
1240
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
1241
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
1159
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty$1) +
|
|
1160
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty$1);
|
|
1242
1161
|
_self.message += diagnosticText;
|
|
1243
1162
|
}
|
|
1244
1163
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -1268,7 +1187,7 @@
|
|
|
1268
1187
|
throw message;
|
|
1269
1188
|
}
|
|
1270
1189
|
else {
|
|
1271
|
-
var logFunc = severity ===
|
|
1190
|
+
var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
|
|
1272
1191
|
if (!isUndefined(message.message)) {
|
|
1273
1192
|
var logLevel = _self.consoleLoggingLevel();
|
|
1274
1193
|
if (isUserAct) {
|
|
@@ -1286,7 +1205,7 @@
|
|
|
1286
1205
|
_self.logInternalMessage(severity, message);
|
|
1287
1206
|
}
|
|
1288
1207
|
else {
|
|
1289
|
-
_debugExtMsg("throw" + (severity ===
|
|
1208
|
+
_debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
|
|
1290
1209
|
}
|
|
1291
1210
|
}
|
|
1292
1211
|
};
|
|
@@ -1318,13 +1237,13 @@
|
|
|
1318
1237
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
1319
1238
|
_self.queue.push(message);
|
|
1320
1239
|
_messageCount++;
|
|
1321
|
-
_debugExtMsg((severity ===
|
|
1240
|
+
_debugExtMsg((severity === 1 ? "error" : "warn"), message);
|
|
1322
1241
|
}
|
|
1323
1242
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
1324
1243
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
1325
|
-
var throttleMessage = new _InternalLogMessage(
|
|
1244
|
+
var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
|
|
1326
1245
|
_self.queue.push(throttleMessage);
|
|
1327
|
-
if (severity ===
|
|
1246
|
+
if (severity === 1 ) {
|
|
1328
1247
|
_self.errorToConsole(throttleLimitMessage);
|
|
1329
1248
|
}
|
|
1330
1249
|
else {
|
|
@@ -1498,6 +1417,217 @@
|
|
|
1498
1417
|
return _defaultPerfManager;
|
|
1499
1418
|
}
|
|
1500
1419
|
|
|
1420
|
+
var UInt32Mask = 0x100000000;
|
|
1421
|
+
var MaxUInt32 = 0xffffffff;
|
|
1422
|
+
var _mwcSeeded = false;
|
|
1423
|
+
var _mwcW = 123456789;
|
|
1424
|
+
var _mwcZ = 987654321;
|
|
1425
|
+
function _mwcSeed(seedValue) {
|
|
1426
|
+
if (seedValue < 0) {
|
|
1427
|
+
seedValue >>>= 0;
|
|
1428
|
+
}
|
|
1429
|
+
_mwcW = (123456789 + seedValue) & MaxUInt32;
|
|
1430
|
+
_mwcZ = (987654321 - seedValue) & MaxUInt32;
|
|
1431
|
+
_mwcSeeded = true;
|
|
1432
|
+
}
|
|
1433
|
+
function _autoSeedMwc() {
|
|
1434
|
+
try {
|
|
1435
|
+
var now = dateNow() & 0x7fffffff;
|
|
1436
|
+
_mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
|
|
1437
|
+
}
|
|
1438
|
+
catch (e) {
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
function randomValue(maxValue) {
|
|
1442
|
+
if (maxValue > 0) {
|
|
1443
|
+
return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
|
|
1444
|
+
}
|
|
1445
|
+
return 0;
|
|
1446
|
+
}
|
|
1447
|
+
function random32(signed) {
|
|
1448
|
+
var value = 0;
|
|
1449
|
+
var c = getCrypto() || getMsCrypto();
|
|
1450
|
+
if (c && c.getRandomValues) {
|
|
1451
|
+
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1452
|
+
}
|
|
1453
|
+
if (value === 0 && isIE()) {
|
|
1454
|
+
if (!_mwcSeeded) {
|
|
1455
|
+
_autoSeedMwc();
|
|
1456
|
+
}
|
|
1457
|
+
value = mwcRandom32() & MaxUInt32;
|
|
1458
|
+
}
|
|
1459
|
+
if (value === 0) {
|
|
1460
|
+
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1461
|
+
}
|
|
1462
|
+
if (!signed) {
|
|
1463
|
+
value >>>= 0;
|
|
1464
|
+
}
|
|
1465
|
+
return value;
|
|
1466
|
+
}
|
|
1467
|
+
function mwcRandomSeed(value) {
|
|
1468
|
+
if (!value) {
|
|
1469
|
+
_autoSeedMwc();
|
|
1470
|
+
}
|
|
1471
|
+
else {
|
|
1472
|
+
_mwcSeed(value);
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
function mwcRandom32(signed) {
|
|
1476
|
+
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
1477
|
+
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
1478
|
+
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
1479
|
+
if (!signed) {
|
|
1480
|
+
value >>>= 0;
|
|
1481
|
+
}
|
|
1482
|
+
return value;
|
|
1483
|
+
}
|
|
1484
|
+
function newId(maxLength) {
|
|
1485
|
+
if (maxLength === void 0) { maxLength = 22; }
|
|
1486
|
+
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1487
|
+
var number = random32() >>> 0;
|
|
1488
|
+
var chars = 0;
|
|
1489
|
+
var result = strEmpty$1;
|
|
1490
|
+
while (result.length < maxLength) {
|
|
1491
|
+
chars++;
|
|
1492
|
+
result += base64chars.charAt(number & 0x3F);
|
|
1493
|
+
number >>>= 6;
|
|
1494
|
+
if (chars === 5) {
|
|
1495
|
+
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1496
|
+
chars = 0;
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
return result;
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
1503
|
+
var version = "2.7.3";
|
|
1504
|
+
var instanceName = "." + newId(6);
|
|
1505
|
+
var _dataUid = 0;
|
|
1506
|
+
function _createAccessor(target, prop, value) {
|
|
1507
|
+
if (_objDefineProperty) {
|
|
1508
|
+
try {
|
|
1509
|
+
_objDefineProperty(target, prop, {
|
|
1510
|
+
value: value,
|
|
1511
|
+
enumerable: false,
|
|
1512
|
+
configurable: true
|
|
1513
|
+
});
|
|
1514
|
+
return true;
|
|
1515
|
+
}
|
|
1516
|
+
catch (e) {
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
return false;
|
|
1520
|
+
}
|
|
1521
|
+
function _canAcceptData(target) {
|
|
1522
|
+
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1523
|
+
}
|
|
1524
|
+
function _getCache(data, target) {
|
|
1525
|
+
var theCache = target[data.id];
|
|
1526
|
+
if (!theCache) {
|
|
1527
|
+
theCache = {};
|
|
1528
|
+
try {
|
|
1529
|
+
if (_canAcceptData(target)) {
|
|
1530
|
+
if (!_createAccessor(target, data.id, theCache)) {
|
|
1531
|
+
target[data.id] = theCache;
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
catch (e) {
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
return theCache;
|
|
1539
|
+
}
|
|
1540
|
+
function createUniqueNamespace(name, includeVersion) {
|
|
1541
|
+
if (includeVersion === void 0) { includeVersion = false; }
|
|
1542
|
+
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1543
|
+
}
|
|
1544
|
+
function createElmNodeData(name) {
|
|
1545
|
+
var data = {
|
|
1546
|
+
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1547
|
+
accept: function (target) {
|
|
1548
|
+
return _canAcceptData(target);
|
|
1549
|
+
},
|
|
1550
|
+
get: function (target, name, defValue, addDefault) {
|
|
1551
|
+
var theCache = target[data.id];
|
|
1552
|
+
if (!theCache) {
|
|
1553
|
+
if (addDefault) {
|
|
1554
|
+
theCache = _getCache(data, target);
|
|
1555
|
+
theCache[normalizeJsName(name)] = defValue;
|
|
1556
|
+
}
|
|
1557
|
+
return defValue;
|
|
1558
|
+
}
|
|
1559
|
+
return theCache[normalizeJsName(name)];
|
|
1560
|
+
},
|
|
1561
|
+
kill: function (target, name) {
|
|
1562
|
+
if (target && target[name]) {
|
|
1563
|
+
try {
|
|
1564
|
+
delete target[name];
|
|
1565
|
+
}
|
|
1566
|
+
catch (e) {
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
};
|
|
1571
|
+
return data;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
1575
|
+
function _getPluginState(plugin) {
|
|
1576
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
1577
|
+
}
|
|
1578
|
+
function initializePlugins(processContext, extensions) {
|
|
1579
|
+
var initPlugins = [];
|
|
1580
|
+
var lastPlugin = null;
|
|
1581
|
+
var proxy = processContext.getNext();
|
|
1582
|
+
var pluginState;
|
|
1583
|
+
while (proxy) {
|
|
1584
|
+
var thePlugin = proxy.getPlugin();
|
|
1585
|
+
if (thePlugin) {
|
|
1586
|
+
if (lastPlugin &&
|
|
1587
|
+
isFunction(lastPlugin[strSetNextPlugin]) &&
|
|
1588
|
+
isFunction(thePlugin[strProcessTelemetry])) {
|
|
1589
|
+
lastPlugin[strSetNextPlugin](thePlugin);
|
|
1590
|
+
}
|
|
1591
|
+
var isInitialized = false;
|
|
1592
|
+
if (isFunction(thePlugin[strIsInitialized])) {
|
|
1593
|
+
isInitialized = thePlugin[strIsInitialized]();
|
|
1594
|
+
}
|
|
1595
|
+
else {
|
|
1596
|
+
pluginState = _getPluginState(thePlugin);
|
|
1597
|
+
isInitialized = pluginState[strIsInitialized];
|
|
1598
|
+
}
|
|
1599
|
+
if (!isInitialized) {
|
|
1600
|
+
initPlugins.push(thePlugin);
|
|
1601
|
+
}
|
|
1602
|
+
lastPlugin = thePlugin;
|
|
1603
|
+
proxy = proxy.getNext();
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
arrForEach(initPlugins, function (thePlugin) {
|
|
1607
|
+
var core = processContext.core();
|
|
1608
|
+
thePlugin.initialize(processContext.getCfg(), core, extensions, processContext.getNext());
|
|
1609
|
+
pluginState = _getPluginState(thePlugin);
|
|
1610
|
+
if (!thePlugin[strCore] && !pluginState[strCore]) {
|
|
1611
|
+
pluginState[strCore] = core;
|
|
1612
|
+
}
|
|
1613
|
+
pluginState[strIsInitialized] = true;
|
|
1614
|
+
delete pluginState[strTeardown];
|
|
1615
|
+
});
|
|
1616
|
+
}
|
|
1617
|
+
function sortPlugins(plugins) {
|
|
1618
|
+
return plugins.sort(function (extA, extB) {
|
|
1619
|
+
var result = 0;
|
|
1620
|
+
var bHasProcess = isFunction(extB[strProcessTelemetry]);
|
|
1621
|
+
if (isFunction(extA[strProcessTelemetry])) {
|
|
1622
|
+
result = bHasProcess ? extA[strPriority] - extB[strPriority] : 1;
|
|
1623
|
+
}
|
|
1624
|
+
else if (bHasProcess) {
|
|
1625
|
+
result = -1;
|
|
1626
|
+
}
|
|
1627
|
+
return result;
|
|
1628
|
+
});
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1501
1631
|
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1502
1632
|
var strHasRunFlags = "_hasRun";
|
|
1503
1633
|
var strGetTelCtx = "_getTelCtx";
|
|
@@ -1511,53 +1641,69 @@
|
|
|
1511
1641
|
}
|
|
1512
1642
|
return createTelemetryProxyChain([startAt], config, core);
|
|
1513
1643
|
}
|
|
1514
|
-
function
|
|
1644
|
+
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1515
1645
|
var _nextProxy = null;
|
|
1516
|
-
var _onComplete =
|
|
1517
|
-
if (startAt) {
|
|
1518
|
-
_nextProxy = _getNextProxyStart(telemetryChain, config, core, startAt);
|
|
1519
|
-
}
|
|
1520
|
-
else {
|
|
1521
|
-
_nextProxy = telemetryChain;
|
|
1646
|
+
var _onComplete = [];
|
|
1647
|
+
if (startAt !== null) {
|
|
1648
|
+
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1522
1649
|
}
|
|
1523
1650
|
var context = {
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1651
|
+
_next: _moveNext,
|
|
1652
|
+
ctx: {
|
|
1653
|
+
core: function () { return core; },
|
|
1654
|
+
diagLog: function () {
|
|
1655
|
+
return safeGetLogger(core, config);
|
|
1656
|
+
},
|
|
1657
|
+
getCfg: function () {
|
|
1658
|
+
return config;
|
|
1659
|
+
},
|
|
1660
|
+
getExtCfg: _getExtCfg,
|
|
1661
|
+
getConfig: _getConfig,
|
|
1662
|
+
hasNext: function () {
|
|
1663
|
+
return !!_nextProxy;
|
|
1664
|
+
},
|
|
1665
|
+
getNext: function () {
|
|
1666
|
+
return _nextProxy;
|
|
1667
|
+
},
|
|
1668
|
+
setNext: function (nextPlugin) {
|
|
1669
|
+
_nextProxy = nextPlugin;
|
|
1670
|
+
},
|
|
1671
|
+
iterate: _iterateChain,
|
|
1672
|
+
onComplete: _addOnComplete
|
|
1673
|
+
}
|
|
1674
|
+
};
|
|
1675
|
+
function _addOnComplete(onComplete, that) {
|
|
1676
|
+
var args = [];
|
|
1677
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1678
|
+
args[_i - 2] = arguments[_i];
|
|
1679
|
+
}
|
|
1680
|
+
if (onComplete) {
|
|
1681
|
+
_onComplete.push({
|
|
1682
|
+
func: onComplete,
|
|
1683
|
+
self: !isUndefined(that) ? that : context.ctx,
|
|
1684
|
+
args: args
|
|
1547
1685
|
});
|
|
1548
|
-
}
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
function _moveNext() {
|
|
1689
|
+
var nextProxy = _nextProxy;
|
|
1690
|
+
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1691
|
+
if (!nextProxy) {
|
|
1692
|
+
var onComplete = _onComplete;
|
|
1693
|
+
if (onComplete && onComplete.length > 0) {
|
|
1694
|
+
arrForEach(onComplete, function (completeDetails) {
|
|
1695
|
+
try {
|
|
1696
|
+
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
1697
|
+
}
|
|
1698
|
+
catch (e) {
|
|
1699
|
+
core.logger.throwInternal(2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
1700
|
+
}
|
|
1701
|
+
});
|
|
1702
|
+
_onComplete = [];
|
|
1554
1703
|
}
|
|
1555
|
-
return createProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1556
|
-
},
|
|
1557
|
-
onComplete: function (onComplete) {
|
|
1558
|
-
_onComplete = onComplete;
|
|
1559
1704
|
}
|
|
1560
|
-
|
|
1705
|
+
return nextProxy;
|
|
1706
|
+
}
|
|
1561
1707
|
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1562
1708
|
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1563
1709
|
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
@@ -1600,29 +1746,53 @@
|
|
|
1600
1746
|
}
|
|
1601
1747
|
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1602
1748
|
}
|
|
1603
|
-
function
|
|
1604
|
-
var nextPlugin
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
else {
|
|
1610
|
-
if (_onComplete) {
|
|
1611
|
-
_onComplete();
|
|
1612
|
-
_onComplete = null;
|
|
1749
|
+
function _iterateChain(cb) {
|
|
1750
|
+
var nextPlugin;
|
|
1751
|
+
while (!!(nextPlugin = context._next())) {
|
|
1752
|
+
var plugin = nextPlugin.getPlugin();
|
|
1753
|
+
if (plugin) {
|
|
1754
|
+
cb(plugin);
|
|
1613
1755
|
}
|
|
1614
1756
|
}
|
|
1615
1757
|
}
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1758
|
+
return context;
|
|
1759
|
+
}
|
|
1760
|
+
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1761
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1762
|
+
var context = internalContext.ctx;
|
|
1763
|
+
function _processNext(env) {
|
|
1764
|
+
var nextPlugin = internalContext._next();
|
|
1765
|
+
nextPlugin && nextPlugin.processTelemetry(env, context);
|
|
1766
|
+
return !nextPlugin;
|
|
1767
|
+
}
|
|
1768
|
+
function _createNew(plugins, startAt) {
|
|
1769
|
+
if (plugins === void 0) { plugins = null; }
|
|
1770
|
+
if (isArray(plugins)) {
|
|
1771
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1772
|
+
}
|
|
1773
|
+
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1774
|
+
}
|
|
1775
|
+
context.processNext = _processNext;
|
|
1776
|
+
context.createNew = _createNew;
|
|
1777
|
+
return context;
|
|
1778
|
+
}
|
|
1779
|
+
function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
|
|
1780
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1781
|
+
var context = internalContext.ctx;
|
|
1782
|
+
function _processNext(unloadState) {
|
|
1783
|
+
var nextPlugin = internalContext._next();
|
|
1784
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1785
|
+
return !nextPlugin;
|
|
1786
|
+
}
|
|
1787
|
+
function _createNew(plugins, startAt) {
|
|
1788
|
+
if (plugins === void 0) { plugins = null; }
|
|
1789
|
+
if (isArray(plugins)) {
|
|
1790
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1624
1791
|
}
|
|
1792
|
+
return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
|
|
1625
1793
|
}
|
|
1794
|
+
context.processNext = _processNext;
|
|
1795
|
+
context.createNew = _createNew;
|
|
1626
1796
|
return context;
|
|
1627
1797
|
}
|
|
1628
1798
|
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
@@ -1670,32 +1840,35 @@
|
|
|
1670
1840
|
return nextProxy;
|
|
1671
1841
|
},
|
|
1672
1842
|
processTelemetry: _processTelemetry,
|
|
1843
|
+
unload: _unloadPlugin,
|
|
1673
1844
|
_id: chainId,
|
|
1674
1845
|
_setNext: function (nextPlugin) {
|
|
1675
1846
|
nextProxy = nextPlugin;
|
|
1676
1847
|
}
|
|
1677
1848
|
};
|
|
1678
|
-
function
|
|
1849
|
+
function _getTelCtx() {
|
|
1850
|
+
var itemCtx;
|
|
1851
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1852
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
1853
|
+
}
|
|
1679
1854
|
if (!itemCtx) {
|
|
1680
|
-
|
|
1681
|
-
itemCtx = plugin[strGetTelCtx]();
|
|
1682
|
-
}
|
|
1683
|
-
if (!itemCtx) {
|
|
1684
|
-
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1685
|
-
}
|
|
1855
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1686
1856
|
}
|
|
1857
|
+
return itemCtx;
|
|
1858
|
+
}
|
|
1859
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
1860
|
+
var hasRun = false;
|
|
1687
1861
|
var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
1688
1862
|
var hasRunContext = itemCtx[strHasRunFlags];
|
|
1689
1863
|
if (!hasRunContext) {
|
|
1690
1864
|
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1691
1865
|
}
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
if (plugin) {
|
|
1866
|
+
itemCtx.setNext(nextProxy);
|
|
1867
|
+
if (plugin) {
|
|
1868
|
+
doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
|
|
1869
|
+
hasRunContext[chainId] = true;
|
|
1697
1870
|
try {
|
|
1698
|
-
var nextId = nextProxy ? nextProxy._id :
|
|
1871
|
+
var nextId = nextProxy ? nextProxy._id : strEmpty$1;
|
|
1699
1872
|
if (nextId) {
|
|
1700
1873
|
hasRunContext[nextId] = false;
|
|
1701
1874
|
}
|
|
@@ -1707,18 +1880,21 @@
|
|
|
1707
1880
|
hasRun = true;
|
|
1708
1881
|
}
|
|
1709
1882
|
if (!nextProxy || !hasNextRun) {
|
|
1710
|
-
itemCtx.diagLog().throwInternal(
|
|
1883
|
+
itemCtx.diagLog().throwInternal(1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1711
1884
|
}
|
|
1712
1885
|
}
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
}
|
|
1717
|
-
}, details, isAsync);
|
|
1886
|
+
}, details, isAsync);
|
|
1887
|
+
}
|
|
1888
|
+
return hasRun;
|
|
1718
1889
|
}
|
|
1719
1890
|
function _processTelemetry(env, itemCtx) {
|
|
1720
|
-
|
|
1721
|
-
|
|
1891
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
1892
|
+
function _callProcessTelemetry(itemCtx) {
|
|
1893
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
1894
|
+
return false;
|
|
1895
|
+
}
|
|
1896
|
+
var pluginState = _getPluginState(plugin);
|
|
1897
|
+
if (pluginState[strTeardown] || pluginState[strDisabled]) {
|
|
1722
1898
|
return false;
|
|
1723
1899
|
}
|
|
1724
1900
|
if (hasSetNext) {
|
|
@@ -1726,52 +1902,33 @@
|
|
|
1726
1902
|
}
|
|
1727
1903
|
plugin.processTelemetry(env, itemCtx);
|
|
1728
1904
|
return true;
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
}
|
|
1733
|
-
return objFreeze(proxyChain);
|
|
1734
|
-
}
|
|
1735
|
-
|
|
1736
|
-
var processTelemetry = "processTelemetry";
|
|
1737
|
-
var priority = "priority";
|
|
1738
|
-
var setNextPlugin = "setNextPlugin";
|
|
1739
|
-
var isInitialized = "isInitialized";
|
|
1740
|
-
function initializePlugins(processContext, extensions) {
|
|
1741
|
-
var initPlugins = [];
|
|
1742
|
-
var lastPlugin = null;
|
|
1743
|
-
var proxy = processContext.getNext();
|
|
1744
|
-
while (proxy) {
|
|
1745
|
-
var thePlugin = proxy.getPlugin();
|
|
1746
|
-
if (thePlugin) {
|
|
1747
|
-
if (lastPlugin &&
|
|
1748
|
-
isFunction(lastPlugin[setNextPlugin]) &&
|
|
1749
|
-
isFunction(thePlugin[processTelemetry])) {
|
|
1750
|
-
lastPlugin[setNextPlugin](thePlugin);
|
|
1751
|
-
}
|
|
1752
|
-
if (!isFunction(thePlugin[isInitialized]) || !thePlugin[isInitialized]()) {
|
|
1753
|
-
initPlugins.push(thePlugin);
|
|
1754
|
-
}
|
|
1755
|
-
lastPlugin = thePlugin;
|
|
1756
|
-
proxy = proxy.getNext();
|
|
1905
|
+
}
|
|
1906
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
1907
|
+
itemCtx.processNext(env);
|
|
1757
1908
|
}
|
|
1758
1909
|
}
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1910
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
1911
|
+
function _callTeardown() {
|
|
1912
|
+
var hasRun = false;
|
|
1913
|
+
if (plugin) {
|
|
1914
|
+
var pluginState = _getPluginState(plugin);
|
|
1915
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1916
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1917
|
+
pluginState[strCore] = null;
|
|
1918
|
+
pluginState[strTeardown] = true;
|
|
1919
|
+
pluginState[strIsInitialized] = false;
|
|
1920
|
+
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1921
|
+
hasRun = true;
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
return hasRun;
|
|
1769
1926
|
}
|
|
1770
|
-
|
|
1771
|
-
|
|
1927
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
|
|
1928
|
+
unloadCtx.processNext(unloadState);
|
|
1772
1929
|
}
|
|
1773
|
-
|
|
1774
|
-
|
|
1930
|
+
}
|
|
1931
|
+
return objFreeze(proxyChain);
|
|
1775
1932
|
}
|
|
1776
1933
|
|
|
1777
1934
|
var strToGMTString = "toGMTString";
|
|
@@ -1782,7 +1939,6 @@
|
|
|
1782
1939
|
var strIsCookieUseDisabled = "isCookieUseDisabled";
|
|
1783
1940
|
var strDisableCookiesUsage = "disableCookiesUsage";
|
|
1784
1941
|
var strConfigCookieMgr = "_ckMgr";
|
|
1785
|
-
var strEmpty = "";
|
|
1786
1942
|
var _supportsCookies = null;
|
|
1787
1943
|
var _allowUaSameSite = null;
|
|
1788
1944
|
var _parsedCookieValue = null;
|
|
@@ -1859,7 +2015,7 @@
|
|
|
1859
2015
|
var result = false;
|
|
1860
2016
|
if (_isMgrEnabled(cookieMgr)) {
|
|
1861
2017
|
var values = {};
|
|
1862
|
-
var theValue = strTrim(value || strEmpty);
|
|
2018
|
+
var theValue = strTrim(value || strEmpty$1);
|
|
1863
2019
|
var idx = theValue.indexOf(";");
|
|
1864
2020
|
if (idx !== -1) {
|
|
1865
2021
|
theValue = strTrim(value.substring(0, idx));
|
|
@@ -1874,11 +2030,11 @@
|
|
|
1874
2030
|
if (expireMs > 0) {
|
|
1875
2031
|
var expiry = new Date();
|
|
1876
2032
|
expiry.setTime(expireMs);
|
|
1877
|
-
setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty, isTruthy);
|
|
2033
|
+
setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty$1, isTruthy);
|
|
1878
2034
|
}
|
|
1879
2035
|
}
|
|
1880
2036
|
if (!_isIE) {
|
|
1881
|
-
setValue(values, "max-age", strEmpty + maxAgeSec, null, isUndefined);
|
|
2037
|
+
setValue(values, "max-age", strEmpty$1 + maxAgeSec, null, isUndefined);
|
|
1882
2038
|
}
|
|
1883
2039
|
}
|
|
1884
2040
|
var location_1 = getLocation();
|
|
@@ -1899,7 +2055,7 @@
|
|
|
1899
2055
|
return result;
|
|
1900
2056
|
},
|
|
1901
2057
|
get: function (name) {
|
|
1902
|
-
var value = strEmpty;
|
|
2058
|
+
var value = strEmpty$1;
|
|
1903
2059
|
if (_isMgrEnabled(cookieMgr)) {
|
|
1904
2060
|
value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
|
|
1905
2061
|
}
|
|
@@ -1924,7 +2080,7 @@
|
|
|
1924
2080
|
values["max-age"] = "0";
|
|
1925
2081
|
}
|
|
1926
2082
|
var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
|
|
1927
|
-
delCookie(name, _formatCookieValue(strEmpty, values));
|
|
2083
|
+
delCookie(name, _formatCookieValue(strEmpty$1, values));
|
|
1928
2084
|
result = true;
|
|
1929
2085
|
}
|
|
1930
2086
|
return result;
|
|
@@ -1941,7 +2097,7 @@
|
|
|
1941
2097
|
_supportsCookies = doc[strCookie] !== undefined;
|
|
1942
2098
|
}
|
|
1943
2099
|
catch (e) {
|
|
1944
|
-
logger && logger.throwInternal(
|
|
2100
|
+
logger && logger.throwInternal(2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1945
2101
|
}
|
|
1946
2102
|
}
|
|
1947
2103
|
return _supportsCookies;
|
|
@@ -1951,7 +2107,7 @@
|
|
|
1951
2107
|
if (theValue && theValue.length) {
|
|
1952
2108
|
var parts = strTrim(theValue).split(";");
|
|
1953
2109
|
arrForEach(parts, function (thePart) {
|
|
1954
|
-
thePart = strTrim(thePart || strEmpty);
|
|
2110
|
+
thePart = strTrim(thePart || strEmpty$1);
|
|
1955
2111
|
if (thePart) {
|
|
1956
2112
|
var idx = thePart.indexOf("=");
|
|
1957
2113
|
if (idx === -1) {
|
|
@@ -1972,21 +2128,21 @@
|
|
|
1972
2128
|
return null;
|
|
1973
2129
|
}
|
|
1974
2130
|
function _formatCookieValue(value, values) {
|
|
1975
|
-
var cookieValue = value || strEmpty;
|
|
2131
|
+
var cookieValue = value || strEmpty$1;
|
|
1976
2132
|
objForEachKey(values, function (name, theValue) {
|
|
1977
|
-
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
|
|
2133
|
+
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty$1);
|
|
1978
2134
|
});
|
|
1979
2135
|
return cookieValue;
|
|
1980
2136
|
}
|
|
1981
2137
|
function _getCookieValue(name) {
|
|
1982
|
-
var cookieValue = strEmpty;
|
|
2138
|
+
var cookieValue = strEmpty$1;
|
|
1983
2139
|
if (_doc) {
|
|
1984
|
-
var theCookie = _doc[strCookie] || strEmpty;
|
|
2140
|
+
var theCookie = _doc[strCookie] || strEmpty$1;
|
|
1985
2141
|
if (_parsedCookieValue !== theCookie) {
|
|
1986
2142
|
_cookieCache = _extractParts(theCookie);
|
|
1987
2143
|
_parsedCookieValue = theCookie;
|
|
1988
2144
|
}
|
|
1989
|
-
cookieValue = strTrim(_cookieCache[name] || strEmpty);
|
|
2145
|
+
cookieValue = strTrim(_cookieCache[name] || strEmpty$1);
|
|
1990
2146
|
}
|
|
1991
2147
|
return cookieValue;
|
|
1992
2148
|
}
|
|
@@ -2042,87 +2198,110 @@
|
|
|
2042
2198
|
}
|
|
2043
2199
|
}
|
|
2044
2200
|
function createChannelControllerPlugin(channelQueue, core) {
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2201
|
+
var _a;
|
|
2202
|
+
function _getTelCtx() {
|
|
2203
|
+
return createProcessTelemetryContext(null, core.config, core, null);
|
|
2204
|
+
}
|
|
2205
|
+
function _processChannelQueue(theChannels, itemCtx, processFn, onComplete) {
|
|
2206
|
+
var waiting = theChannels ? (theChannels.length + 1) : 1;
|
|
2207
|
+
function _runChainOnComplete() {
|
|
2208
|
+
waiting--;
|
|
2209
|
+
if (waiting === 0) {
|
|
2210
|
+
onComplete && onComplete();
|
|
2211
|
+
onComplete = null;
|
|
2212
|
+
}
|
|
2048
2213
|
}
|
|
2049
|
-
|
|
2214
|
+
if (waiting > 0) {
|
|
2215
|
+
arrForEach(theChannels, function (channels) {
|
|
2216
|
+
if (channels && channels.queue.length > 0) {
|
|
2217
|
+
var channelChain = channels.chain;
|
|
2218
|
+
var chainCtx = itemCtx.createNew(channelChain);
|
|
2219
|
+
chainCtx.onComplete(_runChainOnComplete);
|
|
2220
|
+
processFn(chainCtx);
|
|
2221
|
+
}
|
|
2222
|
+
else {
|
|
2223
|
+
waiting--;
|
|
2224
|
+
}
|
|
2225
|
+
});
|
|
2226
|
+
}
|
|
2227
|
+
_runChainOnComplete();
|
|
2228
|
+
}
|
|
2229
|
+
function _doTeardown(unloadCtx, unloadState) {
|
|
2230
|
+
var theUnloadState = unloadState || {
|
|
2231
|
+
reason: 0 ,
|
|
2232
|
+
isAsync: false
|
|
2233
|
+
};
|
|
2234
|
+
_processChannelQueue(channelQueue, unloadCtx, function (chainCtx) {
|
|
2235
|
+
chainCtx[strProcessNext](theUnloadState);
|
|
2236
|
+
}, function () {
|
|
2237
|
+
unloadCtx[strProcessNext](theUnloadState);
|
|
2238
|
+
isInitialized = false;
|
|
2239
|
+
});
|
|
2240
|
+
return true;
|
|
2050
2241
|
}
|
|
2051
|
-
function
|
|
2242
|
+
function _getChannel(pluginIdentifier) {
|
|
2243
|
+
var thePlugin = null;
|
|
2052
2244
|
if (channelQueue && channelQueue.length > 0) {
|
|
2053
|
-
var waiting_1 = channelQueue.length;
|
|
2054
2245
|
arrForEach(channelQueue, function (channels) {
|
|
2055
2246
|
if (channels && channels.queue.length > 0) {
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
if (waiting_1 === 0) {
|
|
2061
|
-
onComplete && onComplete();
|
|
2062
|
-
onComplete = null;
|
|
2247
|
+
arrForEach(channels.queue, function (ext) {
|
|
2248
|
+
if (ext.identifier === pluginIdentifier) {
|
|
2249
|
+
thePlugin = ext;
|
|
2250
|
+
return -1;
|
|
2063
2251
|
}
|
|
2064
2252
|
});
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
waiting_1--;
|
|
2253
|
+
if (thePlugin) {
|
|
2254
|
+
return -1;
|
|
2255
|
+
}
|
|
2069
2256
|
}
|
|
2070
2257
|
});
|
|
2071
|
-
if (waiting_1 === 0) {
|
|
2072
|
-
onComplete && onComplete();
|
|
2073
|
-
}
|
|
2074
|
-
}
|
|
2075
|
-
else {
|
|
2076
|
-
onComplete && onComplete();
|
|
2077
2258
|
}
|
|
2259
|
+
return thePlugin;
|
|
2078
2260
|
}
|
|
2079
2261
|
var isInitialized = false;
|
|
2080
|
-
var channelController = {
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
});
|
|
2090
|
-
},
|
|
2091
|
-
isInitialized: function () { return isInitialized; },
|
|
2092
|
-
processTelemetry: function (item, itemCtx) {
|
|
2093
|
-
_processChannelQueue(itemCtx, function (chainCtx) {
|
|
2094
|
-
chainCtx.processNext(item);
|
|
2095
|
-
}, function () {
|
|
2096
|
-
itemCtx.processNext(item);
|
|
2097
|
-
});
|
|
2098
|
-
},
|
|
2099
|
-
pause: function () {
|
|
2100
|
-
_processChannelQueue(null, function (chainCtx) {
|
|
2101
|
-
chainCtx.iterate(function (plugin) {
|
|
2102
|
-
plugin.pause && plugin.pause();
|
|
2262
|
+
var channelController = (_a = {
|
|
2263
|
+
identifier: "ChannelControllerPlugin",
|
|
2264
|
+
priority: ChannelControllerPriority,
|
|
2265
|
+
initialize: function (config, core, extensions, pluginChain) {
|
|
2266
|
+
isInitialized = true;
|
|
2267
|
+
arrForEach(channelQueue, function (channels) {
|
|
2268
|
+
if (channels && channels.queue.length > 0) {
|
|
2269
|
+
initializePlugins(createProcessTelemetryContext(channels.chain, config, core), extensions);
|
|
2270
|
+
}
|
|
2103
2271
|
});
|
|
2104
|
-
}
|
|
2272
|
+
},
|
|
2273
|
+
isInitialized: function () { return isInitialized; },
|
|
2274
|
+
processTelemetry: function (item, itemCtx) {
|
|
2275
|
+
_processChannelQueue(channelQueue, itemCtx || _getTelCtx(), function (chainCtx) {
|
|
2276
|
+
chainCtx[strProcessNext](item);
|
|
2277
|
+
}, function () {
|
|
2278
|
+
itemCtx[strProcessNext](item);
|
|
2279
|
+
});
|
|
2280
|
+
}
|
|
2105
2281
|
},
|
|
2106
|
-
|
|
2107
|
-
_processChannelQueue(
|
|
2282
|
+
_a[strPause] = function () {
|
|
2283
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2108
2284
|
chainCtx.iterate(function (plugin) {
|
|
2109
|
-
plugin
|
|
2285
|
+
plugin[strPause] && plugin[strPause]();
|
|
2110
2286
|
});
|
|
2111
|
-
});
|
|
2287
|
+
}, null);
|
|
2112
2288
|
},
|
|
2113
|
-
|
|
2114
|
-
_processChannelQueue(
|
|
2289
|
+
_a[strResume] = function () {
|
|
2290
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2115
2291
|
chainCtx.iterate(function (plugin) {
|
|
2116
|
-
plugin
|
|
2292
|
+
plugin[strResume] && plugin[strResume]();
|
|
2117
2293
|
});
|
|
2118
|
-
});
|
|
2294
|
+
}, null);
|
|
2119
2295
|
},
|
|
2120
|
-
|
|
2296
|
+
_a[strTeardown] = _doTeardown,
|
|
2297
|
+
_a.getChannel = _getChannel,
|
|
2298
|
+
_a.flush = function (isAsync, callBack, sendReason, cbTimeout) {
|
|
2299
|
+
var waiting = 1;
|
|
2121
2300
|
var doneIterating = false;
|
|
2122
|
-
var waiting = 0;
|
|
2123
2301
|
var cbTimer = null;
|
|
2124
2302
|
cbTimeout = cbTimeout || 5000;
|
|
2125
2303
|
function doCallback() {
|
|
2304
|
+
waiting--;
|
|
2126
2305
|
if (doneIterating && waiting === 0) {
|
|
2127
2306
|
if (cbTimer) {
|
|
2128
2307
|
clearTimeout(cbTimer);
|
|
@@ -2132,32 +2311,38 @@
|
|
|
2132
2311
|
callBack = null;
|
|
2133
2312
|
}
|
|
2134
2313
|
}
|
|
2135
|
-
|
|
2136
|
-
_processChannelQueue(null, function (chainCtx) {
|
|
2314
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2137
2315
|
chainCtx.iterate(function (plugin) {
|
|
2138
2316
|
if (plugin.flush) {
|
|
2139
2317
|
waiting++;
|
|
2318
|
+
var handled_1 = false;
|
|
2140
2319
|
if (!plugin.flush(isAsync, function () {
|
|
2141
|
-
|
|
2320
|
+
handled_1 = true;
|
|
2142
2321
|
doCallback();
|
|
2143
2322
|
}, sendReason)) {
|
|
2144
|
-
if (
|
|
2145
|
-
cbTimer
|
|
2146
|
-
cbTimer =
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2323
|
+
if (!handled_1) {
|
|
2324
|
+
if (isAsync && cbTimer == null) {
|
|
2325
|
+
cbTimer = setTimeout(function () {
|
|
2326
|
+
cbTimer = null;
|
|
2327
|
+
doCallback();
|
|
2328
|
+
}, cbTimeout);
|
|
2329
|
+
}
|
|
2330
|
+
else {
|
|
2331
|
+
doCallback();
|
|
2332
|
+
}
|
|
2150
2333
|
}
|
|
2151
2334
|
}
|
|
2152
2335
|
}
|
|
2153
2336
|
});
|
|
2154
2337
|
}, function () {
|
|
2155
|
-
waiting--;
|
|
2156
2338
|
doneIterating = true;
|
|
2157
2339
|
doCallback();
|
|
2158
2340
|
});
|
|
2159
|
-
}
|
|
2160
|
-
|
|
2341
|
+
},
|
|
2342
|
+
_a._setQueue = function (queue) {
|
|
2343
|
+
channelQueue = queue;
|
|
2344
|
+
},
|
|
2345
|
+
_a);
|
|
2161
2346
|
return channelController;
|
|
2162
2347
|
}
|
|
2163
2348
|
function createChannelQueues(channels, extensions, config, core) {
|
|
@@ -2177,6 +2362,30 @@
|
|
|
2177
2362
|
return channelQueue;
|
|
2178
2363
|
}
|
|
2179
2364
|
|
|
2365
|
+
function createUnloadHandlerContainer() {
|
|
2366
|
+
var handlers = [];
|
|
2367
|
+
function _addHandler(handler) {
|
|
2368
|
+
if (handler) {
|
|
2369
|
+
handlers.push(handler);
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
function _runHandlers(unloadCtx, unloadState) {
|
|
2373
|
+
arrForEach(handlers, function (handler) {
|
|
2374
|
+
try {
|
|
2375
|
+
handler(unloadCtx, unloadState);
|
|
2376
|
+
}
|
|
2377
|
+
catch (e) {
|
|
2378
|
+
unloadCtx.diagLog().throwInternal(2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
2379
|
+
}
|
|
2380
|
+
});
|
|
2381
|
+
handlers = [];
|
|
2382
|
+
}
|
|
2383
|
+
return {
|
|
2384
|
+
add: _addHandler,
|
|
2385
|
+
run: _runHandlers
|
|
2386
|
+
};
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2180
2389
|
var strGetPlugin = "getPlugin";
|
|
2181
2390
|
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
2182
2391
|
function BaseTelemetryPlugin() {
|
|
@@ -2184,6 +2393,7 @@
|
|
|
2184
2393
|
var _isinitialized;
|
|
2185
2394
|
var _rootCtx;
|
|
2186
2395
|
var _nextPlugin;
|
|
2396
|
+
var _unloadHandlerContainer;
|
|
2187
2397
|
var _hooks;
|
|
2188
2398
|
_initDefaults();
|
|
2189
2399
|
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
@@ -2191,6 +2401,39 @@
|
|
|
2191
2401
|
_setDefaults(config, core, pluginChain);
|
|
2192
2402
|
_isinitialized = true;
|
|
2193
2403
|
};
|
|
2404
|
+
_self.teardown = function (unloadCtx, unloadState) {
|
|
2405
|
+
if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
|
|
2406
|
+
return;
|
|
2407
|
+
}
|
|
2408
|
+
var result;
|
|
2409
|
+
var unloadDone = false;
|
|
2410
|
+
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
2411
|
+
var theUnloadState = unloadState || {
|
|
2412
|
+
reason: 0 ,
|
|
2413
|
+
isAsync: false
|
|
2414
|
+
};
|
|
2415
|
+
function _unloadCallback() {
|
|
2416
|
+
if (!unloadDone) {
|
|
2417
|
+
unloadDone = true;
|
|
2418
|
+
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
2419
|
+
arrForEach(_hooks, function (fn) {
|
|
2420
|
+
fn.rm();
|
|
2421
|
+
});
|
|
2422
|
+
_hooks = [];
|
|
2423
|
+
if (result === true) {
|
|
2424
|
+
theUnloadCtx.processNext(theUnloadState);
|
|
2425
|
+
}
|
|
2426
|
+
_initDefaults();
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2429
|
+
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
2430
|
+
_unloadCallback();
|
|
2431
|
+
}
|
|
2432
|
+
else {
|
|
2433
|
+
result = true;
|
|
2434
|
+
}
|
|
2435
|
+
return result;
|
|
2436
|
+
};
|
|
2194
2437
|
_self._addHook = function (hooks) {
|
|
2195
2438
|
if (hooks) {
|
|
2196
2439
|
if (isArray(hooks)) {
|
|
@@ -2201,17 +2444,18 @@
|
|
|
2201
2444
|
}
|
|
2202
2445
|
}
|
|
2203
2446
|
};
|
|
2447
|
+
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
2204
2448
|
});
|
|
2205
2449
|
_self.diagLog = function (itemCtx) {
|
|
2206
2450
|
return _getTelCtx(itemCtx).diagLog();
|
|
2207
2451
|
};
|
|
2208
|
-
_self
|
|
2452
|
+
_self[strIsInitialized] = function () {
|
|
2209
2453
|
return _isinitialized;
|
|
2210
2454
|
};
|
|
2211
2455
|
_self.setInitialized = function (isInitialized) {
|
|
2212
2456
|
_isinitialized = isInitialized;
|
|
2213
2457
|
};
|
|
2214
|
-
_self
|
|
2458
|
+
_self[strSetNextPlugin] = function (next) {
|
|
2215
2459
|
_nextPlugin = next;
|
|
2216
2460
|
};
|
|
2217
2461
|
_self.processNext = function (env, itemCtx) {
|
|
@@ -2257,6 +2501,7 @@
|
|
|
2257
2501
|
_rootCtx = null;
|
|
2258
2502
|
_nextPlugin = null;
|
|
2259
2503
|
_hooks = [];
|
|
2504
|
+
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
2260
2505
|
}
|
|
2261
2506
|
}
|
|
2262
2507
|
return BaseTelemetryPlugin;
|
|
@@ -2303,7 +2548,7 @@
|
|
|
2303
2548
|
}
|
|
2304
2549
|
}
|
|
2305
2550
|
catch (e) {
|
|
2306
|
-
itemCtx.diagLog().throwInternal(
|
|
2551
|
+
itemCtx.diagLog().throwInternal(1 , 64 , "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
|
|
2307
2552
|
}
|
|
2308
2553
|
}
|
|
2309
2554
|
}
|
|
@@ -2311,8 +2556,7 @@
|
|
|
2311
2556
|
_self.processNext(item, itemCtx);
|
|
2312
2557
|
}
|
|
2313
2558
|
};
|
|
2314
|
-
_self
|
|
2315
|
-
_base.unload(itemCtx, isAsync);
|
|
2559
|
+
_self[strDoTeardown] = function () {
|
|
2316
2560
|
_initDefaults();
|
|
2317
2561
|
};
|
|
2318
2562
|
});
|
|
@@ -2327,6 +2571,8 @@
|
|
|
2327
2571
|
|
|
2328
2572
|
var strValidationError = "Plugins must provide initialize method";
|
|
2329
2573
|
var strNotificationManager = "_notificationManager";
|
|
2574
|
+
var strSdkUnloadingError = "SDK is still unloading...";
|
|
2575
|
+
var strSdkNotInitialized = "SDK is not initialized";
|
|
2330
2576
|
function _createPerfManager(core, notificationMgr) {
|
|
2331
2577
|
return new PerfManager(notificationMgr);
|
|
2332
2578
|
}
|
|
@@ -2356,6 +2602,26 @@
|
|
|
2356
2602
|
core: coreExtensions
|
|
2357
2603
|
};
|
|
2358
2604
|
}
|
|
2605
|
+
function _isPluginPresent(thePlugin, plugins) {
|
|
2606
|
+
var exists = false;
|
|
2607
|
+
arrForEach(plugins, function (plugin) {
|
|
2608
|
+
if (plugin === thePlugin) {
|
|
2609
|
+
exists = true;
|
|
2610
|
+
return -1;
|
|
2611
|
+
}
|
|
2612
|
+
});
|
|
2613
|
+
return exists;
|
|
2614
|
+
}
|
|
2615
|
+
function _createDummyNotificationManager() {
|
|
2616
|
+
var _a;
|
|
2617
|
+
return objCreateFn((_a = {},
|
|
2618
|
+
_a[strAddNotificationListener] = function (listener) { },
|
|
2619
|
+
_a[strRemoveNotificationListener] = function (listener) { },
|
|
2620
|
+
_a[strEventsSent] = function (events) { },
|
|
2621
|
+
_a[strEventsDiscarded] = function (events, reason) { },
|
|
2622
|
+
_a[strEventsSendRequest] = function (sendReason, isAsync) { },
|
|
2623
|
+
_a));
|
|
2624
|
+
}
|
|
2359
2625
|
var BaseCore = /** @class */ (function () {
|
|
2360
2626
|
function BaseCore() {
|
|
2361
2627
|
var _isInitialized;
|
|
@@ -2370,14 +2636,20 @@
|
|
|
2370
2636
|
var _channelControl;
|
|
2371
2637
|
var _channelConfig;
|
|
2372
2638
|
var _channelQueue;
|
|
2639
|
+
var _isUnloading;
|
|
2373
2640
|
var _telemetryInitializerPlugin;
|
|
2374
2641
|
var _internalLogsEventName;
|
|
2642
|
+
var _evtNamespace;
|
|
2643
|
+
var _unloadHandlers;
|
|
2375
2644
|
var _debugListener;
|
|
2376
2645
|
var _internalLogPoller = 0;
|
|
2377
2646
|
dynamicProto(BaseCore, this, function (_self) {
|
|
2378
2647
|
_initDefaults();
|
|
2379
2648
|
_self.isInitialized = function () { return _isInitialized; };
|
|
2380
2649
|
_self.initialize = function (config, extensions, logger, notificationManager) {
|
|
2650
|
+
if (_isUnloading) {
|
|
2651
|
+
throwError(strSdkUnloadingError);
|
|
2652
|
+
}
|
|
2381
2653
|
if (_self.isInitialized()) {
|
|
2382
2654
|
throwError("Core should not be initialized more than once");
|
|
2383
2655
|
}
|
|
@@ -2390,8 +2662,7 @@
|
|
|
2390
2662
|
_initDebugListener(config);
|
|
2391
2663
|
_initPerfManager(config);
|
|
2392
2664
|
config.extensions = isNullOrUndefined(config.extensions) ? [] : config.extensions;
|
|
2393
|
-
|
|
2394
|
-
extConfig.NotificationManager = notificationManager;
|
|
2665
|
+
_initExtConfig(config);
|
|
2395
2666
|
if (logger) {
|
|
2396
2667
|
_self.logger = logger;
|
|
2397
2668
|
}
|
|
@@ -2416,37 +2687,29 @@
|
|
|
2416
2687
|
setValue(telemetryItem, strIKey, _self.config.instrumentationKey, null, isNotTruthy);
|
|
2417
2688
|
setValue(telemetryItem, "time", toISOString(new Date()), null, isNotTruthy);
|
|
2418
2689
|
setValue(telemetryItem, "ver", "4.0", null, isNullOrUndefined);
|
|
2419
|
-
if (_self.isInitialized()) {
|
|
2420
|
-
|
|
2690
|
+
if (!_isUnloading && _self.isInitialized()) {
|
|
2691
|
+
_createTelCtx().processNext(telemetryItem);
|
|
2421
2692
|
}
|
|
2422
2693
|
else {
|
|
2423
2694
|
_eventQueue.push(telemetryItem);
|
|
2424
2695
|
}
|
|
2425
2696
|
};
|
|
2426
|
-
_self.getProcessTelContext =
|
|
2427
|
-
return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
|
|
2428
|
-
};
|
|
2697
|
+
_self.getProcessTelContext = _createTelCtx;
|
|
2429
2698
|
_self.getNotifyMgr = function () {
|
|
2430
2699
|
if (!_notificationManager) {
|
|
2431
|
-
_notificationManager =
|
|
2432
|
-
addNotificationListener: function (listener) { },
|
|
2433
|
-
removeNotificationListener: function (listener) { },
|
|
2434
|
-
eventsSent: function (events) { },
|
|
2435
|
-
eventsDiscarded: function (events, reason) { },
|
|
2436
|
-
eventsSendRequest: function (sendReason, isAsync) { }
|
|
2437
|
-
});
|
|
2700
|
+
_notificationManager = _createDummyNotificationManager();
|
|
2438
2701
|
_self[strNotificationManager] = _notificationManager;
|
|
2439
2702
|
}
|
|
2440
2703
|
return _notificationManager;
|
|
2441
2704
|
};
|
|
2442
|
-
_self
|
|
2705
|
+
_self[strAddNotificationListener] = function (listener) {
|
|
2443
2706
|
if (_notificationManager) {
|
|
2444
|
-
_notificationManager
|
|
2707
|
+
_notificationManager[strAddNotificationListener](listener);
|
|
2445
2708
|
}
|
|
2446
2709
|
};
|
|
2447
|
-
_self
|
|
2710
|
+
_self[strRemoveNotificationListener] = function (listener) {
|
|
2448
2711
|
if (_notificationManager) {
|
|
2449
|
-
_notificationManager
|
|
2712
|
+
_notificationManager[strRemoveNotificationListener](listener);
|
|
2450
2713
|
}
|
|
2451
2714
|
};
|
|
2452
2715
|
_self.getCookieMgr = function () {
|
|
@@ -2477,7 +2740,7 @@
|
|
|
2477
2740
|
var eventQueue = _eventQueue;
|
|
2478
2741
|
_eventQueue = [];
|
|
2479
2742
|
arrForEach(eventQueue, function (event) {
|
|
2480
|
-
|
|
2743
|
+
_createTelCtx().processNext(event);
|
|
2481
2744
|
});
|
|
2482
2745
|
}
|
|
2483
2746
|
};
|
|
@@ -2503,10 +2766,83 @@
|
|
|
2503
2766
|
}
|
|
2504
2767
|
};
|
|
2505
2768
|
proxyFunctions(_self, function () { return _telemetryInitializerPlugin; }, ["addTelemetryInitializer"]);
|
|
2769
|
+
_self.unload = function (isAsync, unloadComplete, cbTimeout) {
|
|
2770
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
2771
|
+
if (!_isInitialized) {
|
|
2772
|
+
throwError(strSdkNotInitialized);
|
|
2773
|
+
}
|
|
2774
|
+
if (_isUnloading) {
|
|
2775
|
+
throwError(strSdkUnloadingError);
|
|
2776
|
+
}
|
|
2777
|
+
var unloadState = {
|
|
2778
|
+
reason: 50 ,
|
|
2779
|
+
isAsync: isAsync,
|
|
2780
|
+
flushComplete: false
|
|
2781
|
+
};
|
|
2782
|
+
var processUnloadCtx = createProcessTelemetryUnloadContext(_getPluginChain(), _self.config, _self);
|
|
2783
|
+
processUnloadCtx.onComplete(function () {
|
|
2784
|
+
_initDefaults();
|
|
2785
|
+
unloadComplete && unloadComplete(unloadState);
|
|
2786
|
+
}, _self);
|
|
2787
|
+
function _doUnload(flushComplete) {
|
|
2788
|
+
unloadState.flushComplete = flushComplete;
|
|
2789
|
+
_isUnloading = true;
|
|
2790
|
+
_unloadHandlers.run(processUnloadCtx, unloadState);
|
|
2791
|
+
_self.stopPollingInternalLogs();
|
|
2792
|
+
processUnloadCtx.processNext(unloadState);
|
|
2793
|
+
}
|
|
2794
|
+
if (_channelControl) {
|
|
2795
|
+
_channelControl.flush(isAsync, _doUnload, 6 , cbTimeout);
|
|
2796
|
+
}
|
|
2797
|
+
else {
|
|
2798
|
+
_doUnload(true);
|
|
2799
|
+
}
|
|
2800
|
+
};
|
|
2506
2801
|
_self.getPlugin = _getPlugin;
|
|
2802
|
+
_self.addPlugin = function (plugin, replaceExisting, isAsync, addCb) {
|
|
2803
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
2804
|
+
if (!plugin) {
|
|
2805
|
+
addCb && addCb(false);
|
|
2806
|
+
_logOrThrowError(strValidationError);
|
|
2807
|
+
return;
|
|
2808
|
+
}
|
|
2809
|
+
var existingPlugin = _getPlugin(plugin.identifier);
|
|
2810
|
+
if (existingPlugin && !replaceExisting) {
|
|
2811
|
+
addCb && addCb(false);
|
|
2812
|
+
_logOrThrowError("Plugin [" + plugin.identifier + "] is already loaded!");
|
|
2813
|
+
return;
|
|
2814
|
+
}
|
|
2815
|
+
function _addPlugin(removed) {
|
|
2816
|
+
_configExtensions.push(plugin);
|
|
2817
|
+
_initPluginChain(_self.config);
|
|
2818
|
+
addCb && addCb(true);
|
|
2819
|
+
}
|
|
2820
|
+
if (existingPlugin) {
|
|
2821
|
+
var removedPlugins = [existingPlugin.plugin];
|
|
2822
|
+
var unloadState = {
|
|
2823
|
+
reason: 2 ,
|
|
2824
|
+
isAsync: isAsync
|
|
2825
|
+
};
|
|
2826
|
+
_removePlugins(removedPlugins, unloadState, function (removed) {
|
|
2827
|
+
if (!removed) {
|
|
2828
|
+
addCb && addCb(false);
|
|
2829
|
+
}
|
|
2830
|
+
else {
|
|
2831
|
+
_addPlugin();
|
|
2832
|
+
}
|
|
2833
|
+
});
|
|
2834
|
+
}
|
|
2835
|
+
else {
|
|
2836
|
+
_addPlugin();
|
|
2837
|
+
}
|
|
2838
|
+
};
|
|
2839
|
+
_self.evtNamespace = function () {
|
|
2840
|
+
return _evtNamespace;
|
|
2841
|
+
};
|
|
2842
|
+
proxyFunctionAs(_self, "addUnloadCb", function () { return _unloadHandlers; }, "add");
|
|
2507
2843
|
function _initDefaults() {
|
|
2508
2844
|
_isInitialized = false;
|
|
2509
|
-
_self.logger = new DiagnosticLogger({ loggingLevelConsole:
|
|
2845
|
+
_self.logger = new DiagnosticLogger({ loggingLevelConsole: 1 });
|
|
2510
2846
|
_self.config = null;
|
|
2511
2847
|
_self._extensions = [];
|
|
2512
2848
|
_telemetryInitializerPlugin = new TelemetryInitializerPlugin();
|
|
@@ -2521,7 +2857,13 @@
|
|
|
2521
2857
|
_channelControl = null;
|
|
2522
2858
|
_channelConfig = null;
|
|
2523
2859
|
_channelQueue = null;
|
|
2860
|
+
_isUnloading = false;
|
|
2524
2861
|
_internalLogsEventName = null;
|
|
2862
|
+
_evtNamespace = createUniqueNamespace("AIBaseCore", true);
|
|
2863
|
+
_unloadHandlers = createUnloadHandlerContainer();
|
|
2864
|
+
}
|
|
2865
|
+
function _createTelCtx() {
|
|
2866
|
+
return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
|
|
2525
2867
|
}
|
|
2526
2868
|
function _initPluginChain(config) {
|
|
2527
2869
|
var theExtensions = _validateExtensions(_self.logger, ChannelControllerPriority, _configExtensions);
|
|
@@ -2529,26 +2871,63 @@
|
|
|
2529
2871
|
_pluginChain = null;
|
|
2530
2872
|
var allExtensions = theExtensions.all;
|
|
2531
2873
|
_channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions, config, _self));
|
|
2532
|
-
|
|
2874
|
+
if (_channelControl) {
|
|
2875
|
+
var idx = allExtensions.indexOf(_channelControl);
|
|
2876
|
+
if (idx !== -1) {
|
|
2877
|
+
allExtensions.splice(idx, 1);
|
|
2878
|
+
}
|
|
2879
|
+
idx = _coreExtensions.indexOf(_channelControl);
|
|
2880
|
+
if (idx !== -1) {
|
|
2881
|
+
_coreExtensions.splice(idx, 1);
|
|
2882
|
+
}
|
|
2883
|
+
_channelControl._setQueue(_channelQueue);
|
|
2884
|
+
}
|
|
2885
|
+
else {
|
|
2886
|
+
_channelControl = createChannelControllerPlugin(_channelQueue, _self);
|
|
2887
|
+
}
|
|
2533
2888
|
allExtensions.push(_channelControl);
|
|
2534
2889
|
_coreExtensions.push(_channelControl);
|
|
2535
2890
|
_self._extensions = sortPlugins(allExtensions);
|
|
2536
2891
|
_channelControl.initialize(config, _self, allExtensions);
|
|
2537
|
-
initializePlugins(
|
|
2892
|
+
initializePlugins(_createTelCtx(), allExtensions);
|
|
2538
2893
|
_self._extensions = objFreeze(sortPlugins(_coreExtensions || [])).slice();
|
|
2539
2894
|
}
|
|
2540
2895
|
function _getPlugin(pluginIdentifier) {
|
|
2541
2896
|
var theExt = null;
|
|
2542
2897
|
var thePlugin = null;
|
|
2543
2898
|
arrForEach(_self._extensions, function (ext) {
|
|
2544
|
-
if (ext.identifier === pluginIdentifier) {
|
|
2899
|
+
if (ext.identifier === pluginIdentifier && ext !== _channelControl && ext !== _telemetryInitializerPlugin) {
|
|
2545
2900
|
thePlugin = ext;
|
|
2546
2901
|
return -1;
|
|
2547
2902
|
}
|
|
2548
2903
|
});
|
|
2904
|
+
if (!thePlugin && _channelControl) {
|
|
2905
|
+
thePlugin = _channelControl.getChannel(pluginIdentifier);
|
|
2906
|
+
}
|
|
2549
2907
|
if (thePlugin) {
|
|
2550
2908
|
theExt = {
|
|
2551
|
-
plugin: thePlugin
|
|
2909
|
+
plugin: thePlugin,
|
|
2910
|
+
setEnabled: function (enabled) {
|
|
2911
|
+
_getPluginState(thePlugin)[strDisabled] = !enabled;
|
|
2912
|
+
},
|
|
2913
|
+
isEnabled: function () {
|
|
2914
|
+
var pluginState = _getPluginState(thePlugin);
|
|
2915
|
+
return !pluginState[strTeardown] && !pluginState[strDisabled];
|
|
2916
|
+
},
|
|
2917
|
+
remove: function (isAsync, removeCb) {
|
|
2918
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
2919
|
+
var pluginsToRemove = [thePlugin];
|
|
2920
|
+
var unloadState = {
|
|
2921
|
+
reason: 1 ,
|
|
2922
|
+
isAsync: isAsync
|
|
2923
|
+
};
|
|
2924
|
+
_removePlugins(pluginsToRemove, unloadState, function (removed) {
|
|
2925
|
+
if (removed) {
|
|
2926
|
+
_initPluginChain(_self.config);
|
|
2927
|
+
}
|
|
2928
|
+
removeCb && removeCb(removed);
|
|
2929
|
+
});
|
|
2930
|
+
}
|
|
2552
2931
|
};
|
|
2553
2932
|
}
|
|
2554
2933
|
return theExt;
|
|
@@ -2556,11 +2935,53 @@
|
|
|
2556
2935
|
function _getPluginChain() {
|
|
2557
2936
|
if (!_pluginChain) {
|
|
2558
2937
|
var extensions = (_coreExtensions || []).slice();
|
|
2559
|
-
extensions.
|
|
2938
|
+
if (extensions.indexOf(_telemetryInitializerPlugin) === -1) {
|
|
2939
|
+
extensions.push(_telemetryInitializerPlugin);
|
|
2940
|
+
}
|
|
2560
2941
|
_pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _self.config, _self);
|
|
2561
2942
|
}
|
|
2562
2943
|
return _pluginChain;
|
|
2563
2944
|
}
|
|
2945
|
+
function _removePlugins(thePlugins, unloadState, removeComplete) {
|
|
2946
|
+
if (thePlugins && thePlugins.length > 0) {
|
|
2947
|
+
var unloadChain = createTelemetryProxyChain(thePlugins, _self.config, _self);
|
|
2948
|
+
var unloadCtx = createProcessTelemetryUnloadContext(unloadChain, _self.config, _self);
|
|
2949
|
+
unloadCtx.onComplete(function () {
|
|
2950
|
+
var removed = false;
|
|
2951
|
+
var newConfigExtensions = [];
|
|
2952
|
+
arrForEach(_configExtensions, function (plugin, idx) {
|
|
2953
|
+
if (!_isPluginPresent(plugin, thePlugins)) {
|
|
2954
|
+
newConfigExtensions.push(plugin);
|
|
2955
|
+
}
|
|
2956
|
+
else {
|
|
2957
|
+
removed = true;
|
|
2958
|
+
}
|
|
2959
|
+
});
|
|
2960
|
+
_configExtensions = newConfigExtensions;
|
|
2961
|
+
var newChannelConfig = [];
|
|
2962
|
+
if (_channelConfig) {
|
|
2963
|
+
arrForEach(_channelConfig, function (queue, idx) {
|
|
2964
|
+
var newQueue = [];
|
|
2965
|
+
arrForEach(queue, function (channel) {
|
|
2966
|
+
if (!_isPluginPresent(channel, thePlugins)) {
|
|
2967
|
+
newQueue.push(channel);
|
|
2968
|
+
}
|
|
2969
|
+
else {
|
|
2970
|
+
removed = true;
|
|
2971
|
+
}
|
|
2972
|
+
});
|
|
2973
|
+
newChannelConfig.push(newQueue);
|
|
2974
|
+
});
|
|
2975
|
+
_channelConfig = newChannelConfig;
|
|
2976
|
+
}
|
|
2977
|
+
removeComplete && removeComplete(removed);
|
|
2978
|
+
});
|
|
2979
|
+
unloadCtx.processNext(unloadState);
|
|
2980
|
+
}
|
|
2981
|
+
else {
|
|
2982
|
+
removeComplete(false);
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2564
2985
|
function _flushInternalLogs() {
|
|
2565
2986
|
var queue = _self.logger ? _self.logger.queue : [];
|
|
2566
2987
|
if (queue) {
|
|
@@ -2579,12 +3000,12 @@
|
|
|
2579
3000
|
}
|
|
2580
3001
|
function _initDebugListener(config) {
|
|
2581
3002
|
if (config.disableDbgExt === true && _debugListener) {
|
|
2582
|
-
_notificationManager
|
|
3003
|
+
_notificationManager[strRemoveNotificationListener](_debugListener);
|
|
2583
3004
|
_debugListener = null;
|
|
2584
3005
|
}
|
|
2585
3006
|
if (_notificationManager && !_debugListener && config.disableDbgExt !== true) {
|
|
2586
3007
|
_debugListener = getDebugListener(config);
|
|
2587
|
-
_notificationManager
|
|
3008
|
+
_notificationManager[strAddNotificationListener](_debugListener);
|
|
2588
3009
|
}
|
|
2589
3010
|
}
|
|
2590
3011
|
function _initPerfManager(config) {
|
|
@@ -2595,15 +3016,24 @@
|
|
|
2595
3016
|
setValue(_self.config, "createPerfMgr", _createPerfManager);
|
|
2596
3017
|
}
|
|
2597
3018
|
}
|
|
3019
|
+
function _initExtConfig(config) {
|
|
3020
|
+
var extConfig = getSetValue(config, strExtensionConfig);
|
|
3021
|
+
extConfig.NotificationManager = _notificationManager;
|
|
3022
|
+
}
|
|
3023
|
+
function _logOrThrowError(message) {
|
|
3024
|
+
var logger = _self.logger;
|
|
3025
|
+
if (logger) {
|
|
3026
|
+
logger.throwInternal(2 , 73 , message);
|
|
3027
|
+
}
|
|
3028
|
+
else {
|
|
3029
|
+
throwError(message);
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
2598
3032
|
});
|
|
2599
3033
|
}
|
|
2600
3034
|
return BaseCore;
|
|
2601
3035
|
}());
|
|
2602
3036
|
|
|
2603
|
-
var strEventsSent = "eventsSent";
|
|
2604
|
-
var strEventsDiscarded = "eventsDiscarded";
|
|
2605
|
-
var strEventsSendRequest = "eventsSendRequest";
|
|
2606
|
-
var strPerfEvent = "perfEvent";
|
|
2607
3037
|
function _runListeners(listeners, name, isAsync, callback) {
|
|
2608
3038
|
arrForEach(listeners, function (listener) {
|
|
2609
3039
|
if (listener && listener[name]) {
|
|
@@ -2625,32 +3055,32 @@
|
|
|
2625
3055
|
this.listeners = [];
|
|
2626
3056
|
var perfEvtsSendAll = !!(config || {}).perfEvtsSendAll;
|
|
2627
3057
|
dynamicProto(NotificationManager, this, function (_self) {
|
|
2628
|
-
_self
|
|
3058
|
+
_self[strAddNotificationListener] = function (listener) {
|
|
2629
3059
|
_self.listeners.push(listener);
|
|
2630
3060
|
};
|
|
2631
|
-
_self
|
|
3061
|
+
_self[strRemoveNotificationListener] = function (listener) {
|
|
2632
3062
|
var index = arrIndexOf(_self.listeners, listener);
|
|
2633
3063
|
while (index > -1) {
|
|
2634
3064
|
_self.listeners.splice(index, 1);
|
|
2635
3065
|
index = arrIndexOf(_self.listeners, listener);
|
|
2636
3066
|
}
|
|
2637
3067
|
};
|
|
2638
|
-
_self
|
|
3068
|
+
_self[strEventsSent] = function (events) {
|
|
2639
3069
|
_runListeners(_self.listeners, strEventsSent, true, function (listener) {
|
|
2640
3070
|
listener[strEventsSent](events);
|
|
2641
3071
|
});
|
|
2642
3072
|
};
|
|
2643
|
-
_self
|
|
3073
|
+
_self[strEventsDiscarded] = function (events, reason) {
|
|
2644
3074
|
_runListeners(_self.listeners, strEventsDiscarded, true, function (listener) {
|
|
2645
3075
|
listener[strEventsDiscarded](events, reason);
|
|
2646
3076
|
});
|
|
2647
3077
|
};
|
|
2648
|
-
_self
|
|
3078
|
+
_self[strEventsSendRequest] = function (sendReason, isAsync) {
|
|
2649
3079
|
_runListeners(_self.listeners, strEventsSendRequest, isAsync, function (listener) {
|
|
2650
3080
|
listener[strEventsSendRequest](sendReason, isAsync);
|
|
2651
3081
|
});
|
|
2652
3082
|
};
|
|
2653
|
-
_self
|
|
3083
|
+
_self[strPerfEvent] = function (perfEvent) {
|
|
2654
3084
|
if (perfEvent) {
|
|
2655
3085
|
if (perfEvtsSendAll || !perfEvent.isChildEvt()) {
|
|
2656
3086
|
_runListeners(_self.listeners, strPerfEvent, false, function (listener) {
|
|
@@ -2705,147 +3135,179 @@
|
|
|
2705
3135
|
return AppInsightsCore;
|
|
2706
3136
|
}(BaseCore));
|
|
2707
3137
|
|
|
2708
|
-
var
|
|
2709
|
-
var
|
|
2710
|
-
var
|
|
2711
|
-
var
|
|
2712
|
-
var
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
function
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
3138
|
+
var strOnPrefix = "on";
|
|
3139
|
+
var strAttachEvent = "attachEvent";
|
|
3140
|
+
var strAddEventHelper = "addEventListener";
|
|
3141
|
+
var strEvents = "events";
|
|
3142
|
+
var strVisibilityChangeEvt = "visibilitychange";
|
|
3143
|
+
var strPageHide = "pagehide";
|
|
3144
|
+
var strUnload = "unload";
|
|
3145
|
+
var strBeforeUnload = "beforeunload";
|
|
3146
|
+
var strPageHideNamespace = createUniqueNamespace("aiEvtPageHide");
|
|
3147
|
+
createUniqueNamespace("aiEvtPageShow");
|
|
3148
|
+
var _guid = 1;
|
|
3149
|
+
var elmNodeData = createElmNodeData("events");
|
|
3150
|
+
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
3151
|
+
function _normalizeNamespace(name) {
|
|
3152
|
+
if (name && name.replace) {
|
|
3153
|
+
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
3154
|
+
}
|
|
3155
|
+
return name;
|
|
3156
|
+
}
|
|
3157
|
+
function _getEvtNamespace(eventName, namespaces) {
|
|
3158
|
+
if (namespaces) {
|
|
3159
|
+
var theNamespace_1 = "";
|
|
3160
|
+
if (isArray(namespaces)) {
|
|
3161
|
+
theNamespace_1 = "";
|
|
3162
|
+
arrForEach(namespaces, function (name) {
|
|
3163
|
+
name = _normalizeNamespace(name);
|
|
3164
|
+
if (name) {
|
|
3165
|
+
if (name[0] !== ".") {
|
|
3166
|
+
name = "." + name;
|
|
3167
|
+
}
|
|
3168
|
+
theNamespace_1 += name;
|
|
3169
|
+
}
|
|
3170
|
+
});
|
|
3171
|
+
}
|
|
3172
|
+
else {
|
|
3173
|
+
theNamespace_1 = _normalizeNamespace(namespaces);
|
|
3174
|
+
}
|
|
3175
|
+
if (theNamespace_1) {
|
|
3176
|
+
if (theNamespace_1[0] !== ".") {
|
|
3177
|
+
theNamespace_1 = "." + theNamespace_1;
|
|
3178
|
+
}
|
|
3179
|
+
eventName = (eventName || "") + theNamespace_1;
|
|
3180
|
+
}
|
|
2727
3181
|
}
|
|
3182
|
+
var parsedEvent = (eventNamespace.exec(eventName) || []);
|
|
3183
|
+
return {
|
|
3184
|
+
type: parsedEvent[1],
|
|
3185
|
+
ns: ((parsedEvent[2] || "").split(".").sort()).join(".")
|
|
3186
|
+
};
|
|
2728
3187
|
}
|
|
2729
|
-
function
|
|
2730
|
-
if (
|
|
2731
|
-
|
|
3188
|
+
function _getRegisteredEvents(target, evtName, addDefault) {
|
|
3189
|
+
if (addDefault === void 0) { addDefault = true; }
|
|
3190
|
+
var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
|
|
3191
|
+
var registeredEvents = aiEvts[evtName];
|
|
3192
|
+
if (!registeredEvents) {
|
|
3193
|
+
registeredEvents = aiEvts[evtName] = [];
|
|
2732
3194
|
}
|
|
2733
|
-
return
|
|
3195
|
+
return registeredEvents;
|
|
2734
3196
|
}
|
|
2735
|
-
function
|
|
2736
|
-
var
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
if (
|
|
2743
|
-
|
|
3197
|
+
function _doAttach(obj, evtName, handlerRef, useCapture) {
|
|
3198
|
+
var result = false;
|
|
3199
|
+
if (obj && evtName && evtName.type && handlerRef) {
|
|
3200
|
+
if (obj[strAddEventHelper]) {
|
|
3201
|
+
obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
|
|
3202
|
+
result = true;
|
|
3203
|
+
}
|
|
3204
|
+
else if (obj[strAttachEvent]) {
|
|
3205
|
+
obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
3206
|
+
result = true;
|
|
2744
3207
|
}
|
|
2745
|
-
value = mwcRandom32() & MaxUInt32;
|
|
2746
|
-
}
|
|
2747
|
-
if (value === 0) {
|
|
2748
|
-
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
2749
|
-
}
|
|
2750
|
-
if (!signed) {
|
|
2751
|
-
value >>>= 0;
|
|
2752
3208
|
}
|
|
2753
|
-
return
|
|
3209
|
+
return result;
|
|
2754
3210
|
}
|
|
2755
|
-
function
|
|
2756
|
-
|
|
2757
|
-
|
|
3211
|
+
function mergeEvtNamespace(theNamespace, namespaces) {
|
|
3212
|
+
var newNamespaces;
|
|
3213
|
+
if (namespaces) {
|
|
3214
|
+
if (isArray(namespaces)) {
|
|
3215
|
+
newNamespaces = [theNamespace].concat(namespaces);
|
|
3216
|
+
}
|
|
3217
|
+
else {
|
|
3218
|
+
newNamespaces = [theNamespace, namespaces];
|
|
3219
|
+
}
|
|
2758
3220
|
}
|
|
2759
3221
|
else {
|
|
2760
|
-
|
|
2761
|
-
}
|
|
2762
|
-
}
|
|
2763
|
-
function mwcRandom32(signed) {
|
|
2764
|
-
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
2765
|
-
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
2766
|
-
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
2767
|
-
if (!signed) {
|
|
2768
|
-
value >>>= 0;
|
|
3222
|
+
newNamespaces = theNamespace;
|
|
2769
3223
|
}
|
|
2770
|
-
return
|
|
3224
|
+
return newNamespaces;
|
|
2771
3225
|
}
|
|
2772
|
-
function
|
|
2773
|
-
if (
|
|
2774
|
-
var
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
3226
|
+
function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
3227
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3228
|
+
var result = false;
|
|
3229
|
+
if (target) {
|
|
3230
|
+
try {
|
|
3231
|
+
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
3232
|
+
result = _doAttach(target, evtName, handlerRef, useCapture);
|
|
3233
|
+
if (result && elmNodeData.accept(target)) {
|
|
3234
|
+
var registeredEvent = {
|
|
3235
|
+
guid: _guid++,
|
|
3236
|
+
evtName: evtName,
|
|
3237
|
+
handler: handlerRef,
|
|
3238
|
+
capture: useCapture
|
|
3239
|
+
};
|
|
3240
|
+
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
catch (e) {
|
|
2785
3244
|
}
|
|
2786
3245
|
}
|
|
2787
3246
|
return result;
|
|
2788
3247
|
}
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
function addEventHandler(eventName, callback) {
|
|
3248
|
+
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
3249
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3250
|
+
return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);
|
|
3251
|
+
}
|
|
3252
|
+
function addEventHandler(eventName, callback, evtNamespace) {
|
|
2795
3253
|
var result = false;
|
|
2796
3254
|
var w = getWindow();
|
|
2797
3255
|
if (w) {
|
|
2798
|
-
result =
|
|
2799
|
-
result =
|
|
3256
|
+
result = eventOn(w, eventName, callback, evtNamespace);
|
|
3257
|
+
result = eventOn(w["body"], eventName, callback, evtNamespace) || result;
|
|
2800
3258
|
}
|
|
2801
3259
|
var doc = getDocument();
|
|
2802
3260
|
if (doc) {
|
|
2803
|
-
result =
|
|
3261
|
+
result = eventOn(doc, eventName, callback, evtNamespace) || result;
|
|
2804
3262
|
}
|
|
2805
3263
|
return result;
|
|
2806
3264
|
}
|
|
2807
|
-
function
|
|
3265
|
+
function _addEventListeners(events, listener, excludeEvents, evtNamespace) {
|
|
2808
3266
|
var added = false;
|
|
2809
|
-
if (listener && events &&
|
|
2810
|
-
var excluded_1 = [];
|
|
3267
|
+
if (listener && events && events.length > 0) {
|
|
2811
3268
|
arrForEach(events, function (name) {
|
|
2812
|
-
if (
|
|
3269
|
+
if (name) {
|
|
2813
3270
|
if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {
|
|
2814
|
-
added = addEventHandler(name, listener) || added;
|
|
2815
|
-
}
|
|
2816
|
-
else {
|
|
2817
|
-
excluded_1.push(name);
|
|
3271
|
+
added = addEventHandler(name, listener, evtNamespace) || added;
|
|
2818
3272
|
}
|
|
2819
3273
|
}
|
|
2820
3274
|
});
|
|
2821
|
-
|
|
2822
|
-
|
|
3275
|
+
}
|
|
3276
|
+
return added;
|
|
3277
|
+
}
|
|
3278
|
+
function addEventListeners(events, listener, excludeEvents, evtNamespace) {
|
|
3279
|
+
var added = false;
|
|
3280
|
+
if (listener && events && isArray(events)) {
|
|
3281
|
+
added = _addEventListeners(events, listener, excludeEvents, evtNamespace);
|
|
3282
|
+
if (!added && excludeEvents && excludeEvents.length > 0) {
|
|
3283
|
+
added = _addEventListeners(events, listener, null, evtNamespace);
|
|
2823
3284
|
}
|
|
2824
3285
|
}
|
|
2825
3286
|
return added;
|
|
2826
3287
|
}
|
|
2827
|
-
function addPageUnloadEventListener(listener, excludeEvents) {
|
|
2828
|
-
return addEventListeners([
|
|
3288
|
+
function addPageUnloadEventListener(listener, excludeEvents, evtNamespace) {
|
|
3289
|
+
return addEventListeners([strBeforeUnload, strUnload, strPageHide], listener, excludeEvents, evtNamespace);
|
|
2829
3290
|
}
|
|
2830
|
-
function addPageHideEventListener(listener, excludeEvents) {
|
|
3291
|
+
function addPageHideEventListener(listener, excludeEvents, evtNamespace) {
|
|
2831
3292
|
function _handlePageVisibility(evt) {
|
|
2832
3293
|
var doc = getDocument();
|
|
2833
3294
|
if (listener && doc && doc.visibilityState === "hidden") {
|
|
2834
3295
|
listener(evt);
|
|
2835
3296
|
}
|
|
2836
3297
|
}
|
|
2837
|
-
var
|
|
2838
|
-
|
|
2839
|
-
pageUnloadAdded = addEventHandler(strPageHide, listener);
|
|
2840
|
-
}
|
|
3298
|
+
var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
|
|
3299
|
+
var pageUnloadAdded = _addEventListeners([strPageHide], listener, excludeEvents, newNamespaces);
|
|
2841
3300
|
if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
|
|
2842
|
-
pageUnloadAdded =
|
|
3301
|
+
pageUnloadAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageUnloadAdded;
|
|
2843
3302
|
}
|
|
2844
3303
|
if (!pageUnloadAdded && excludeEvents) {
|
|
2845
|
-
pageUnloadAdded = addPageHideEventListener(listener);
|
|
3304
|
+
pageUnloadAdded = addPageHideEventListener(listener, null, evtNamespace);
|
|
2846
3305
|
}
|
|
2847
3306
|
return pageUnloadAdded;
|
|
2848
3307
|
}
|
|
3308
|
+
|
|
3309
|
+
var _cookieMgrs = null;
|
|
3310
|
+
var _canUseCookies;
|
|
2849
3311
|
function newGuid() {
|
|
2850
3312
|
function randomHexDigit() {
|
|
2851
3313
|
return randomValue(15);
|
|
@@ -2864,7 +3326,7 @@
|
|
|
2864
3326
|
}
|
|
2865
3327
|
function generateW3CId() {
|
|
2866
3328
|
var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
2867
|
-
var oct =
|
|
3329
|
+
var oct = strEmpty$1, tmp;
|
|
2868
3330
|
for (var a = 0; a < 4; a++) {
|
|
2869
3331
|
tmp = random32();
|
|
2870
3332
|
oct +=
|
|
@@ -2959,6 +3421,95 @@
|
|
|
2959
3421
|
return _legacyCookieMgr(null, logger).del(name);
|
|
2960
3422
|
}
|
|
2961
3423
|
|
|
3424
|
+
var LoggingSeverity = createEnumStyle({
|
|
3425
|
+
CRITICAL: 1 ,
|
|
3426
|
+
WARNING: 2
|
|
3427
|
+
});
|
|
3428
|
+
var _InternalMessageId = createEnumStyle({
|
|
3429
|
+
BrowserDoesNotSupportLocalStorage: 0 ,
|
|
3430
|
+
BrowserCannotReadLocalStorage: 1 ,
|
|
3431
|
+
BrowserCannotReadSessionStorage: 2 ,
|
|
3432
|
+
BrowserCannotWriteLocalStorage: 3 ,
|
|
3433
|
+
BrowserCannotWriteSessionStorage: 4 ,
|
|
3434
|
+
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
3435
|
+
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
3436
|
+
CannotSendEmptyTelemetry: 7 ,
|
|
3437
|
+
ClientPerformanceMathError: 8 ,
|
|
3438
|
+
ErrorParsingAISessionCookie: 9 ,
|
|
3439
|
+
ErrorPVCalc: 10 ,
|
|
3440
|
+
ExceptionWhileLoggingError: 11 ,
|
|
3441
|
+
FailedAddingTelemetryToBuffer: 12 ,
|
|
3442
|
+
FailedMonitorAjaxAbort: 13 ,
|
|
3443
|
+
FailedMonitorAjaxDur: 14 ,
|
|
3444
|
+
FailedMonitorAjaxOpen: 15 ,
|
|
3445
|
+
FailedMonitorAjaxRSC: 16 ,
|
|
3446
|
+
FailedMonitorAjaxSend: 17 ,
|
|
3447
|
+
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
3448
|
+
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
3449
|
+
FailedToSendQueuedTelemetry: 20 ,
|
|
3450
|
+
FailedToReportDataLoss: 21 ,
|
|
3451
|
+
FlushFailed: 22 ,
|
|
3452
|
+
MessageLimitPerPVExceeded: 23 ,
|
|
3453
|
+
MissingRequiredFieldSpecification: 24 ,
|
|
3454
|
+
NavigationTimingNotSupported: 25 ,
|
|
3455
|
+
OnError: 26 ,
|
|
3456
|
+
SessionRenewalDateIsZero: 27 ,
|
|
3457
|
+
SenderNotInitialized: 28 ,
|
|
3458
|
+
StartTrackEventFailed: 29 ,
|
|
3459
|
+
StopTrackEventFailed: 30 ,
|
|
3460
|
+
StartTrackFailed: 31 ,
|
|
3461
|
+
StopTrackFailed: 32 ,
|
|
3462
|
+
TelemetrySampledAndNotSent: 33 ,
|
|
3463
|
+
TrackEventFailed: 34 ,
|
|
3464
|
+
TrackExceptionFailed: 35 ,
|
|
3465
|
+
TrackMetricFailed: 36 ,
|
|
3466
|
+
TrackPVFailed: 37 ,
|
|
3467
|
+
TrackPVFailedCalc: 38 ,
|
|
3468
|
+
TrackTraceFailed: 39 ,
|
|
3469
|
+
TransmissionFailed: 40 ,
|
|
3470
|
+
FailedToSetStorageBuffer: 41 ,
|
|
3471
|
+
FailedToRestoreStorageBuffer: 42 ,
|
|
3472
|
+
InvalidBackendResponse: 43 ,
|
|
3473
|
+
FailedToFixDepricatedValues: 44 ,
|
|
3474
|
+
InvalidDurationValue: 45 ,
|
|
3475
|
+
TelemetryEnvelopeInvalid: 46 ,
|
|
3476
|
+
CreateEnvelopeError: 47 ,
|
|
3477
|
+
CannotSerializeObject: 48 ,
|
|
3478
|
+
CannotSerializeObjectNonSerializable: 49 ,
|
|
3479
|
+
CircularReferenceDetected: 50 ,
|
|
3480
|
+
ClearAuthContextFailed: 51 ,
|
|
3481
|
+
ExceptionTruncated: 52 ,
|
|
3482
|
+
IllegalCharsInName: 53 ,
|
|
3483
|
+
ItemNotInArray: 54 ,
|
|
3484
|
+
MaxAjaxPerPVExceeded: 55 ,
|
|
3485
|
+
MessageTruncated: 56 ,
|
|
3486
|
+
NameTooLong: 57 ,
|
|
3487
|
+
SampleRateOutOfRange: 58 ,
|
|
3488
|
+
SetAuthContextFailed: 59 ,
|
|
3489
|
+
SetAuthContextFailedAccountName: 60 ,
|
|
3490
|
+
StringValueTooLong: 61 ,
|
|
3491
|
+
StartCalledMoreThanOnce: 62 ,
|
|
3492
|
+
StopCalledWithoutStart: 63 ,
|
|
3493
|
+
TelemetryInitializerFailed: 64 ,
|
|
3494
|
+
TrackArgumentsNotSpecified: 65 ,
|
|
3495
|
+
UrlTooLong: 66 ,
|
|
3496
|
+
SessionStorageBufferFull: 67 ,
|
|
3497
|
+
CannotAccessCookie: 68 ,
|
|
3498
|
+
IdTooLong: 69 ,
|
|
3499
|
+
InvalidEvent: 70 ,
|
|
3500
|
+
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
3501
|
+
SendBrowserInfoOnUserInit: 72 ,
|
|
3502
|
+
PluginException: 73 ,
|
|
3503
|
+
NotificationException: 74 ,
|
|
3504
|
+
SnippetScriptLoadFailure: 99 ,
|
|
3505
|
+
InvalidInstrumentationKey: 100 ,
|
|
3506
|
+
CannotParseAiBlobValue: 101 ,
|
|
3507
|
+
InvalidContentBlob: 102 ,
|
|
3508
|
+
TrackPageActionEventFailed: 103 ,
|
|
3509
|
+
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
3510
|
+
InMemoryStorageBufferFull: 105
|
|
3511
|
+
});
|
|
3512
|
+
|
|
2962
3513
|
var aiInstrumentHooks = "_aiHooks";
|
|
2963
3514
|
var cbNames = [
|
|
2964
3515
|
"req", "rsp", "hkErr", "fnErr"
|
|
@@ -3134,7 +3685,7 @@
|
|
|
3134
3685
|
name = strTrim(name.toString());
|
|
3135
3686
|
if (name.length > 150 ) {
|
|
3136
3687
|
nameTrunc = name.substring(0, 150 );
|
|
3137
|
-
logger && logger.throwInternal(
|
|
3688
|
+
logger && logger.throwInternal(2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
|
|
3138
3689
|
}
|
|
3139
3690
|
}
|
|
3140
3691
|
return nameTrunc || name;
|
|
@@ -3147,7 +3698,7 @@
|
|
|
3147
3698
|
value = strTrim(value);
|
|
3148
3699
|
if (value.toString().length > maxLength) {
|
|
3149
3700
|
valueTrunc = value.toString().substring(0, maxLength);
|
|
3150
|
-
logger && logger.throwInternal(
|
|
3701
|
+
logger && logger.throwInternal(2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
|
|
3151
3702
|
}
|
|
3152
3703
|
}
|
|
3153
3704
|
return valueTrunc || value;
|
|
@@ -3160,7 +3711,7 @@
|
|
|
3160
3711
|
if (message) {
|
|
3161
3712
|
if (message.length > 32768 ) {
|
|
3162
3713
|
messageTrunc = message.substring(0, 32768 );
|
|
3163
|
-
logger && logger.throwInternal(
|
|
3714
|
+
logger && logger.throwInternal(2 , _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
|
|
3164
3715
|
}
|
|
3165
3716
|
}
|
|
3166
3717
|
return messageTrunc || message;
|
|
@@ -3171,7 +3722,7 @@
|
|
|
3171
3722
|
var value = "" + exception;
|
|
3172
3723
|
if (value.length > 32768 ) {
|
|
3173
3724
|
exceptionTrunc = value.substring(0, 32768 );
|
|
3174
|
-
logger && logger.throwInternal(
|
|
3725
|
+
logger && logger.throwInternal(2 , _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
|
|
3175
3726
|
}
|
|
3176
3727
|
}
|
|
3177
3728
|
return exceptionTrunc || exception;
|
|
@@ -3185,7 +3736,7 @@
|
|
|
3185
3736
|
value = getJSON().stringify(value);
|
|
3186
3737
|
}
|
|
3187
3738
|
catch (e) {
|
|
3188
|
-
logger && logger.throwInternal(
|
|
3739
|
+
logger && logger.throwInternal(2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
|
|
3189
3740
|
}
|
|
3190
3741
|
}
|
|
3191
3742
|
value = dataSanitizeString(logger, value, 8192 );
|
|
@@ -3216,7 +3767,7 @@
|
|
|
3216
3767
|
input = strTrim(input);
|
|
3217
3768
|
if (input.length > maxLength) {
|
|
3218
3769
|
inputTrunc = input.substring(0, maxLength);
|
|
3219
|
-
logger && logger.throwInternal(
|
|
3770
|
+
logger && logger.throwInternal(2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
|
|
3220
3771
|
}
|
|
3221
3772
|
}
|
|
3222
3773
|
return inputTrunc || input;
|
|
@@ -3262,6 +3813,7 @@
|
|
|
3262
3813
|
return event;
|
|
3263
3814
|
}
|
|
3264
3815
|
|
|
3816
|
+
var strEmpty = "";
|
|
3265
3817
|
function stringToBoolOrDefault(str, defaultValue) {
|
|
3266
3818
|
if (defaultValue === void 0) { defaultValue = false; }
|
|
3267
3819
|
if (str === undefined || str === null) {
|
|
@@ -3274,16 +3826,16 @@
|
|
|
3274
3826
|
totalms = 0;
|
|
3275
3827
|
}
|
|
3276
3828
|
totalms = Math.round(totalms);
|
|
3277
|
-
var ms =
|
|
3278
|
-
var sec =
|
|
3279
|
-
var min =
|
|
3280
|
-
var hour =
|
|
3829
|
+
var ms = strEmpty + totalms % 1000;
|
|
3830
|
+
var sec = strEmpty + Math.floor(totalms / 1000) % 60;
|
|
3831
|
+
var min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;
|
|
3832
|
+
var hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;
|
|
3281
3833
|
var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
|
|
3282
3834
|
ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
|
|
3283
3835
|
sec = sec.length < 2 ? "0" + sec : sec;
|
|
3284
3836
|
min = min.length < 2 ? "0" + min : min;
|
|
3285
3837
|
hour = hour.length < 2 ? "0" + hour : hour;
|
|
3286
|
-
return (days > 0 ? days + "." :
|
|
3838
|
+
return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
|
|
3287
3839
|
}
|
|
3288
3840
|
function getExtensionByName(extensions, identifier) {
|
|
3289
3841
|
var extension = null;
|
|
@@ -3307,17 +3859,15 @@
|
|
|
3307
3859
|
var strNotSpecified = "not_specified";
|
|
3308
3860
|
var strIkey = "iKey";
|
|
3309
3861
|
|
|
3310
|
-
var StorageType
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
DistributedTracingModes[DistributedTracingModes["W3C"] = 2] = "W3C";
|
|
3320
|
-
})(DistributedTracingModes || (DistributedTracingModes = {}));
|
|
3862
|
+
var StorageType = createEnumStyle({
|
|
3863
|
+
LocalStorage: 0 ,
|
|
3864
|
+
SessionStorage: 1
|
|
3865
|
+
});
|
|
3866
|
+
var DistributedTracingModes = createEnumStyle({
|
|
3867
|
+
AI: 0 ,
|
|
3868
|
+
AI_AND_W3C: 1 ,
|
|
3869
|
+
W3C: 2
|
|
3870
|
+
});
|
|
3321
3871
|
|
|
3322
3872
|
var _canUseLocalStorage = undefined;
|
|
3323
3873
|
var _canUseSessionStorage = undefined;
|
|
@@ -3369,7 +3919,7 @@
|
|
|
3369
3919
|
}
|
|
3370
3920
|
catch (e) {
|
|
3371
3921
|
_canUseLocalStorage = false;
|
|
3372
|
-
logger.throwInternal(
|
|
3922
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3373
3923
|
}
|
|
3374
3924
|
}
|
|
3375
3925
|
return null;
|
|
@@ -3383,7 +3933,7 @@
|
|
|
3383
3933
|
}
|
|
3384
3934
|
catch (e) {
|
|
3385
3935
|
_canUseLocalStorage = false;
|
|
3386
|
-
logger.throwInternal(
|
|
3936
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3387
3937
|
}
|
|
3388
3938
|
}
|
|
3389
3939
|
return false;
|
|
@@ -3397,7 +3947,7 @@
|
|
|
3397
3947
|
}
|
|
3398
3948
|
catch (e) {
|
|
3399
3949
|
_canUseLocalStorage = false;
|
|
3400
|
-
logger.throwInternal(
|
|
3950
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3401
3951
|
}
|
|
3402
3952
|
}
|
|
3403
3953
|
return false;
|
|
@@ -3425,7 +3975,7 @@
|
|
|
3425
3975
|
}
|
|
3426
3976
|
catch (e) {
|
|
3427
3977
|
_canUseSessionStorage = false;
|
|
3428
|
-
logger.throwInternal(
|
|
3978
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3429
3979
|
}
|
|
3430
3980
|
}
|
|
3431
3981
|
return null;
|
|
@@ -3439,7 +3989,7 @@
|
|
|
3439
3989
|
}
|
|
3440
3990
|
catch (e) {
|
|
3441
3991
|
_canUseSessionStorage = false;
|
|
3442
|
-
logger.throwInternal(
|
|
3992
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3443
3993
|
}
|
|
3444
3994
|
}
|
|
3445
3995
|
return false;
|
|
@@ -3453,7 +4003,7 @@
|
|
|
3453
4003
|
}
|
|
3454
4004
|
catch (e) {
|
|
3455
4005
|
_canUseSessionStorage = false;
|
|
3456
|
-
logger.throwInternal(
|
|
4006
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3457
4007
|
}
|
|
3458
4008
|
}
|
|
3459
4009
|
return false;
|
|
@@ -5612,7 +6162,7 @@
|
|
|
5612
6162
|
config.disableFlushOnUnload = stringToBoolOrDefault(config.disableFlushOnUnload, config.disableFlushOnBeforeUnload);
|
|
5613
6163
|
return config;
|
|
5614
6164
|
};
|
|
5615
|
-
ApplicationInsights.Version = "2.8.0-beta.
|
|
6165
|
+
ApplicationInsights.Version = "2.8.0-beta.2203-03";
|
|
5616
6166
|
return ApplicationInsights;
|
|
5617
6167
|
}(BaseTelemetryPlugin));
|
|
5618
6168
|
var Timing = /** @class */ (function () {
|
|
@@ -5919,7 +6469,7 @@
|
|
|
5919
6469
|
}
|
|
5920
6470
|
}
|
|
5921
6471
|
var EnvelopeCreator = {
|
|
5922
|
-
Version: "2.8.0-beta.
|
|
6472
|
+
Version: "2.8.0-beta.2203-03"
|
|
5923
6473
|
};
|
|
5924
6474
|
function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
|
|
5925
6475
|
EnvelopeCreatorInit(logger, telemetryItem);
|
|
@@ -7188,7 +7738,7 @@
|
|
|
7188
7738
|
return Device;
|
|
7189
7739
|
}());
|
|
7190
7740
|
|
|
7191
|
-
var Version = "2.8.0-beta.
|
|
7741
|
+
var Version = "2.8.0-beta.2203-03";
|
|
7192
7742
|
var Internal = /** @class */ (function () {
|
|
7193
7743
|
function Internal(config) {
|
|
7194
7744
|
this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + "_" : "") + "javascript:" + Version;
|
|
@@ -7872,19 +8422,21 @@
|
|
|
7872
8422
|
var _enableAjaxPerfTracking = false;
|
|
7873
8423
|
var _maxAjaxCallsPerView = 0;
|
|
7874
8424
|
var _enableResponseHeaderTracking = false;
|
|
7875
|
-
var _hooks = [];
|
|
7876
8425
|
var _disabledUrls = {};
|
|
7877
8426
|
var _excludeRequestFromAutoTrackingPatterns;
|
|
7878
8427
|
var _addRequestContext;
|
|
7879
|
-
|
|
8428
|
+
var _evtNamespace;
|
|
8429
|
+
dynamicProto(AjaxMonitor, _this, function (_self, _base) {
|
|
8430
|
+
var _addHook = _base._addHook;
|
|
7880
8431
|
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
7881
8432
|
if (!_self.isInitialized()) {
|
|
7882
|
-
|
|
8433
|
+
_base.initialize(config, core, extensions, pluginChain);
|
|
7883
8434
|
var ctx_1 = _self._getTelCtx();
|
|
7884
8435
|
var defaultConfig = AjaxMonitor.getDefaultConfig();
|
|
7885
8436
|
objForEachKey(defaultConfig, function (field, value) {
|
|
7886
8437
|
_config[field] = ctx_1.getConfig(AjaxMonitor.identifier, field, value);
|
|
7887
8438
|
});
|
|
8439
|
+
_evtNamespace = mergeEvtNamespace(createUniqueNamespace("ajax"), core && core.evtNamespace && core.evtNamespace());
|
|
7888
8440
|
var distributedTracingMode = _config.distributedTracingMode;
|
|
7889
8441
|
_enableRequestHeaderTracking = _config.enableRequestHeaderTracking;
|
|
7890
8442
|
_enableAjaxErrorStatusText = _config.enableAjaxErrorStatusText;
|
|
@@ -7893,8 +8445,8 @@
|
|
|
7893
8445
|
_enableResponseHeaderTracking = _config.enableResponseHeaderTracking;
|
|
7894
8446
|
_excludeRequestFromAutoTrackingPatterns = _config.excludeRequestFromAutoTrackingPatterns;
|
|
7895
8447
|
_addRequestContext = _config.addRequestContext;
|
|
7896
|
-
_isUsingAIHeaders = distributedTracingMode ===
|
|
7897
|
-
_isUsingW3CHeaders = distributedTracingMode ===
|
|
8448
|
+
_isUsingAIHeaders = distributedTracingMode === 0 || distributedTracingMode === 1 ;
|
|
8449
|
+
_isUsingW3CHeaders = distributedTracingMode === 1 || distributedTracingMode === 2 ;
|
|
7898
8450
|
if (_enableAjaxPerfTracking) {
|
|
7899
8451
|
var iKey = config.instrumentationKey || "unkwn";
|
|
7900
8452
|
if (iKey.length > 5) {
|
|
@@ -7922,14 +8474,9 @@
|
|
|
7922
8474
|
}
|
|
7923
8475
|
}
|
|
7924
8476
|
};
|
|
7925
|
-
_self.
|
|
7926
|
-
arrForEach(_hooks, function (fn) {
|
|
7927
|
-
fn.rm();
|
|
7928
|
-
});
|
|
7929
|
-
_hooks = [];
|
|
8477
|
+
_self._doTeardown = function () {
|
|
7930
8478
|
_fetchInitialized = false;
|
|
7931
8479
|
_xhrInitialized = false;
|
|
7932
|
-
_self.setInitialized(false);
|
|
7933
8480
|
};
|
|
7934
8481
|
_self.trackDependencyData = function (dependency, properties) {
|
|
7935
8482
|
_self[strTrackDependencyDataInternal](dependency, properties);
|
|
@@ -7996,8 +8543,8 @@
|
|
|
7996
8543
|
};
|
|
7997
8544
|
_self[strTrackDependencyDataInternal] = function (dependency, properties, systemProperties) {
|
|
7998
8545
|
if (_maxAjaxCallsPerView === -1 || _trackAjaxAttempts < _maxAjaxCallsPerView) {
|
|
7999
|
-
if ((_config.distributedTracingMode ===
|
|
8000
|
-
|| _config.distributedTracingMode ===
|
|
8546
|
+
if ((_config.distributedTracingMode === 2
|
|
8547
|
+
|| _config.distributedTracingMode === 1 )
|
|
8001
8548
|
&& typeof dependency.id === "string" && dependency.id[dependency.id.length - 1] !== ".") {
|
|
8002
8549
|
dependency.id += ".";
|
|
8003
8550
|
}
|
|
@@ -8032,7 +8579,7 @@
|
|
|
8032
8579
|
var global = getGlobal();
|
|
8033
8580
|
var isPolyfill = fetch.polyfill;
|
|
8034
8581
|
if (_config.disableFetchTracking === false) {
|
|
8035
|
-
|
|
8582
|
+
_addHook(InstrumentFunc(global, strFetch, {
|
|
8036
8583
|
req: function (callDetails, input, init) {
|
|
8037
8584
|
var fetchData;
|
|
8038
8585
|
if (_fetchInitialized &&
|
|
@@ -8080,7 +8627,7 @@
|
|
|
8080
8627
|
_fetchInitialized = true;
|
|
8081
8628
|
}
|
|
8082
8629
|
else if (isPolyfill) {
|
|
8083
|
-
|
|
8630
|
+
_addHook(InstrumentFunc(global, strFetch, {
|
|
8084
8631
|
req: function (callDetails, input, init) {
|
|
8085
8632
|
_isDisabledRequest(null, input, init);
|
|
8086
8633
|
}
|
|
@@ -8091,7 +8638,7 @@
|
|
|
8091
8638
|
}
|
|
8092
8639
|
}
|
|
8093
8640
|
function _hookProto(target, funcName, callbacks) {
|
|
8094
|
-
|
|
8641
|
+
_addHook(InstrumentProto(target, funcName, callbacks));
|
|
8095
8642
|
}
|
|
8096
8643
|
function _instrumentXhr() {
|
|
8097
8644
|
if (_supportsAjaxMonitoring(_self) && !_xhrInitialized) {
|
|
@@ -8213,7 +8760,7 @@
|
|
|
8213
8760
|
xhr[strAjaxData] = ajaxData;
|
|
8214
8761
|
}
|
|
8215
8762
|
function _attachToOnReadyStateChange(xhr) {
|
|
8216
|
-
xhr[strAjaxData].xhrMonitoringState.stateChangeAttached =
|
|
8763
|
+
xhr[strAjaxData].xhrMonitoringState.stateChangeAttached = eventOn(xhr, "readystatechange", function () {
|
|
8217
8764
|
try {
|
|
8218
8765
|
if (xhr && xhr.readyState === 4 && _isMonitoredXhrInstance(xhr)) {
|
|
8219
8766
|
_onAjaxComplete(xhr);
|
|
@@ -8228,7 +8775,7 @@
|
|
|
8228
8775
|
});
|
|
8229
8776
|
}
|
|
8230
8777
|
}
|
|
8231
|
-
});
|
|
8778
|
+
}, _evtNamespace);
|
|
8232
8779
|
}
|
|
8233
8780
|
function _getResponseText(xhr) {
|
|
8234
8781
|
try {
|
|
@@ -8513,7 +9060,7 @@
|
|
|
8513
9060
|
disableFetchTracking: true,
|
|
8514
9061
|
excludeRequestFromAutoTrackingPatterns: undefined,
|
|
8515
9062
|
disableCorrelationHeaders: false,
|
|
8516
|
-
distributedTracingMode:
|
|
9063
|
+
distributedTracingMode: 1 ,
|
|
8517
9064
|
correlationHeaderExcludedDomains: [
|
|
8518
9065
|
"*.blob.core.windows.net",
|
|
8519
9066
|
"*.blob.core.chinacloudapi.cn",
|