@microsoft/applicationinsights-analytics-js 2.7.5-nightly.2203-01 → 2.8.0-beta.2203-01
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/applicationinsights-analytics-js.integrity.json +9 -9
- package/browser/applicationinsights-analytics-js.js +398 -240
- package/browser/applicationinsights-analytics-js.js.map +1 -1
- package/browser/applicationinsights-analytics-js.min.js +2 -2
- package/browser/applicationinsights-analytics-js.min.js.map +1 -1
- package/dist/applicationinsights-analytics-js.d.ts +1 -1
- package/dist/applicationinsights-analytics-js.js +398 -240
- package/dist/applicationinsights-analytics-js.js.map +1 -1
- package/dist/applicationinsights-analytics-js.min.js +2 -2
- package/dist/applicationinsights-analytics-js.min.js.map +1 -1
- package/dist/applicationinsights-analytics-js.rollup.d.ts +1 -1
- package/dist-esm/JavaScriptSDK/ApplicationInsights.js +2 -2
- package/dist-esm/JavaScriptSDK/ApplicationInsights.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js +2 -2
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js +1 -1
- package/dist-esm/JavaScriptSDK/Telemetry/PageVisitTimeManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryConfig.js +1 -1
- package/dist-esm/applicationinsights-analytics-js.js +1 -1
- package/package.json +6 -6
- package/src/JavaScriptSDK/ApplicationInsights.ts +1 -1
- package/src/JavaScriptSDK/Telemetry/PageViewManager.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Web Analytics, 2.
|
|
2
|
+
* Application Insights JavaScript SDK - Web Analytics, 2.8.0-beta.2203-01
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -109,11 +109,11 @@
|
|
|
109
109
|
var DynAllowInstChkTag = DynInstChkTag;
|
|
110
110
|
var DynProtoDefaultOptions = '_dfOpts';
|
|
111
111
|
var UnknownValue = '_unknown_';
|
|
112
|
-
var str__Proto = "__proto__";
|
|
112
|
+
var str__Proto$1 = "__proto__";
|
|
113
113
|
var strUseBaseInst = 'useBaseInst';
|
|
114
114
|
var strSetInstFuncs = 'setInstFuncs';
|
|
115
115
|
var Obj = Object;
|
|
116
|
-
var _objGetPrototypeOf = Obj["getPrototypeOf"];
|
|
116
|
+
var _objGetPrototypeOf$1 = Obj["getPrototypeOf"];
|
|
117
117
|
var _dynamicNames = 0;
|
|
118
118
|
function _hasOwnProperty(obj, prop) {
|
|
119
119
|
return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
|
|
@@ -124,12 +124,12 @@
|
|
|
124
124
|
function _isObjectArrayOrFunctionPrototype(target) {
|
|
125
125
|
return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
|
|
126
126
|
}
|
|
127
|
-
function _getObjProto(target) {
|
|
127
|
+
function _getObjProto$1(target) {
|
|
128
128
|
if (target) {
|
|
129
|
-
if (_objGetPrototypeOf) {
|
|
130
|
-
return _objGetPrototypeOf(target);
|
|
129
|
+
if (_objGetPrototypeOf$1) {
|
|
130
|
+
return _objGetPrototypeOf$1(target);
|
|
131
131
|
}
|
|
132
|
-
var newProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
|
|
132
|
+
var newProto = target[str__Proto$1] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
|
|
133
133
|
if (newProto) {
|
|
134
134
|
return newProto;
|
|
135
135
|
}
|
|
@@ -195,16 +195,16 @@
|
|
|
195
195
|
_forEachProp(instFuncs, function (name) {
|
|
196
196
|
baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
|
|
197
197
|
});
|
|
198
|
-
var baseProto = _getObjProto(classProto);
|
|
198
|
+
var baseProto = _getObjProto$1(classProto);
|
|
199
199
|
var visited = [];
|
|
200
200
|
while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
|
|
201
201
|
_forEachProp(baseProto, function (name) {
|
|
202
|
-
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
|
|
202
|
+
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf$1)) {
|
|
203
203
|
baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
|
|
204
204
|
}
|
|
205
205
|
});
|
|
206
206
|
visited.push(baseProto);
|
|
207
|
-
baseProto = _getObjProto(baseProto);
|
|
207
|
+
baseProto = _getObjProto$1(baseProto);
|
|
208
208
|
}
|
|
209
209
|
return baseFuncs;
|
|
210
210
|
}
|
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
}
|
|
219
219
|
if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
|
|
220
220
|
var canAddInst = !_hasOwnProperty(target, funcName);
|
|
221
|
-
var objProto = _getObjProto(target);
|
|
221
|
+
var objProto = _getObjProto$1(target);
|
|
222
222
|
var visited = [];
|
|
223
223
|
while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
|
|
224
224
|
var protoFunc = objProto[funcName];
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
break;
|
|
228
228
|
}
|
|
229
229
|
visited.push(objProto);
|
|
230
|
-
objProto = _getObjProto(objProto);
|
|
230
|
+
objProto = _getObjProto$1(objProto);
|
|
231
231
|
}
|
|
232
232
|
try {
|
|
233
233
|
if (canAddInst) {
|
|
@@ -245,7 +245,7 @@
|
|
|
245
245
|
function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
|
|
246
246
|
var protoFunc = proto[funcName];
|
|
247
247
|
if (protoFunc === currentDynProtoProxy) {
|
|
248
|
-
protoFunc = _getObjProto(proto)[funcName];
|
|
248
|
+
protoFunc = _getObjProto$1(proto)[funcName];
|
|
249
249
|
}
|
|
250
250
|
if (typeof protoFunc !== strFunction) {
|
|
251
251
|
_throwTypeError("[" + funcName + "] is not a " + strFunction);
|
|
@@ -279,15 +279,15 @@
|
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
function _checkPrototype(classProto, thisTarget) {
|
|
282
|
-
if (_objGetPrototypeOf) {
|
|
282
|
+
if (_objGetPrototypeOf$1) {
|
|
283
283
|
var visited = [];
|
|
284
|
-
var thisProto = _getObjProto(thisTarget);
|
|
284
|
+
var thisProto = _getObjProto$1(thisTarget);
|
|
285
285
|
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
286
286
|
if (thisProto === classProto) {
|
|
287
287
|
return true;
|
|
288
288
|
}
|
|
289
289
|
visited.push(thisProto);
|
|
290
|
-
thisProto = _getObjProto(thisProto);
|
|
290
|
+
thisProto = _getObjProto$1(thisProto);
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
return false;
|
|
@@ -323,7 +323,7 @@
|
|
|
323
323
|
var instFuncs = _getInstanceFuncs(target);
|
|
324
324
|
var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
|
|
325
325
|
delegateFunc(target, baseFuncs);
|
|
326
|
-
var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
|
|
326
|
+
var setInstanceFunc = !!_objGetPrototypeOf$1 && !!perfOptions[strSetInstFuncs];
|
|
327
327
|
if (setInstanceFunc && options) {
|
|
328
328
|
setInstanceFunc = !!options[strSetInstFuncs];
|
|
329
329
|
}
|
|
@@ -430,7 +430,10 @@
|
|
|
430
430
|
var strMap = "map";
|
|
431
431
|
var cStrTrim = "trim";
|
|
432
432
|
var strToString = "toString";
|
|
433
|
+
var str__Proto = "__proto__";
|
|
434
|
+
var strConstructor = "constructor";
|
|
433
435
|
var _objDefineProperty = ObjDefineProperty;
|
|
436
|
+
var _objFreeze = ObjClass.freeze;
|
|
434
437
|
var StringProto = String[strShimPrototype];
|
|
435
438
|
var _strTrim = StringProto[cStrTrim];
|
|
436
439
|
var _strEndsWith = StringProto[cStrEndsWith];
|
|
@@ -439,7 +442,20 @@
|
|
|
439
442
|
var _isArray = Array.isArray;
|
|
440
443
|
var _objToString = ObjProto[strToString];
|
|
441
444
|
var _fnToString = ObjHasOwnProperty[strToString];
|
|
442
|
-
_fnToString.call(ObjClass);
|
|
445
|
+
var _objFunctionString = _fnToString.call(ObjClass);
|
|
446
|
+
var _objGetPrototypeOf = Object["getPrototypeOf"];
|
|
447
|
+
function _getObjProto(target) {
|
|
448
|
+
if (target) {
|
|
449
|
+
if (_objGetPrototypeOf) {
|
|
450
|
+
return _objGetPrototypeOf(target);
|
|
451
|
+
}
|
|
452
|
+
var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];
|
|
453
|
+
if (newProto) {
|
|
454
|
+
return newProto;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
443
459
|
function isUndefined(value) {
|
|
444
460
|
return value === undefined || typeof value === strShimUndefined;
|
|
445
461
|
}
|
|
@@ -503,6 +519,25 @@
|
|
|
503
519
|
function isString(value) {
|
|
504
520
|
return typeof value === "string";
|
|
505
521
|
}
|
|
522
|
+
function isBoolean(value) {
|
|
523
|
+
return typeof value === "boolean";
|
|
524
|
+
}
|
|
525
|
+
function isPlainObject(value) {
|
|
526
|
+
var result = false;
|
|
527
|
+
if (value && typeof value === "object") {
|
|
528
|
+
var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
|
|
529
|
+
if (!proto) {
|
|
530
|
+
result = true;
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
|
|
534
|
+
proto = proto[strConstructor];
|
|
535
|
+
}
|
|
536
|
+
result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
return result;
|
|
540
|
+
}
|
|
506
541
|
function toISOString(date) {
|
|
507
542
|
if (date) {
|
|
508
543
|
return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
|
|
@@ -589,6 +624,10 @@
|
|
|
589
624
|
}
|
|
590
625
|
return false;
|
|
591
626
|
}
|
|
627
|
+
function _doNothing(value) {
|
|
628
|
+
return value;
|
|
629
|
+
}
|
|
630
|
+
var objFreeze = _objFreeze || _doNothing;
|
|
592
631
|
function dateNow() {
|
|
593
632
|
var dt = Date;
|
|
594
633
|
return dt.now ? dt.now() : new dt().getTime();
|
|
@@ -616,6 +655,50 @@
|
|
|
616
655
|
function throwError(message) {
|
|
617
656
|
throw new Error(message);
|
|
618
657
|
}
|
|
658
|
+
function objExtend(obj, obj2, obj3, obj4, obj5, obj6) {
|
|
659
|
+
var theArgs = arguments;
|
|
660
|
+
var extended = theArgs[0] || {};
|
|
661
|
+
var argLen = theArgs.length;
|
|
662
|
+
var deep = false;
|
|
663
|
+
var idx = 1;
|
|
664
|
+
if (argLen > 0 && isBoolean(extended)) {
|
|
665
|
+
deep = extended;
|
|
666
|
+
extended = theArgs[idx] || {};
|
|
667
|
+
idx++;
|
|
668
|
+
}
|
|
669
|
+
if (!isObject(extended)) {
|
|
670
|
+
extended = {};
|
|
671
|
+
}
|
|
672
|
+
for (; idx < argLen; idx++) {
|
|
673
|
+
var arg = theArgs[idx];
|
|
674
|
+
var isArgArray = isArray(arg);
|
|
675
|
+
var isArgObj = isObject(arg);
|
|
676
|
+
for (var prop in arg) {
|
|
677
|
+
var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
|
|
678
|
+
if (!propOk) {
|
|
679
|
+
continue;
|
|
680
|
+
}
|
|
681
|
+
var newValue = arg[prop];
|
|
682
|
+
var isNewArray = void 0;
|
|
683
|
+
if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
|
|
684
|
+
var clone = extended[prop];
|
|
685
|
+
if (isNewArray) {
|
|
686
|
+
if (!isArray(clone)) {
|
|
687
|
+
clone = [];
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
else if (!isPlainObject(clone)) {
|
|
691
|
+
clone = {};
|
|
692
|
+
}
|
|
693
|
+
newValue = objExtend(deep, clone, newValue);
|
|
694
|
+
}
|
|
695
|
+
if (newValue !== undefined) {
|
|
696
|
+
extended[prop] = newValue;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
return extended;
|
|
701
|
+
}
|
|
619
702
|
|
|
620
703
|
var strWindow = "window";
|
|
621
704
|
var strDocument = "document";
|
|
@@ -1015,252 +1098,240 @@
|
|
|
1015
1098
|
return func();
|
|
1016
1099
|
}
|
|
1017
1100
|
|
|
1018
|
-
var
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1101
|
+
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1102
|
+
var strHasRunFlags = "_hasRun";
|
|
1103
|
+
var strGetTelCtx = "_getTelCtx";
|
|
1104
|
+
var _chainId = 0;
|
|
1105
|
+
function _getNextProxyStart(proxy, config, core, startAt) {
|
|
1106
|
+
while (proxy) {
|
|
1107
|
+
if (proxy.getPlugin() === startAt) {
|
|
1108
|
+
return proxy;
|
|
1109
|
+
}
|
|
1110
|
+
proxy = proxy.getNext();
|
|
1111
|
+
}
|
|
1112
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1113
|
+
}
|
|
1114
|
+
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1115
|
+
var _nextProxy = null;
|
|
1116
|
+
var _onComplete = null;
|
|
1117
|
+
if (startAt) {
|
|
1118
|
+
_nextProxy = _getNextProxyStart(telemetryChain, config, core, startAt);
|
|
1119
|
+
}
|
|
1120
|
+
else {
|
|
1121
|
+
_nextProxy = telemetryChain;
|
|
1122
|
+
}
|
|
1123
|
+
var context = {
|
|
1124
|
+
core: function () {
|
|
1125
|
+
return core;
|
|
1126
|
+
},
|
|
1127
|
+
diagLog: function () {
|
|
1128
|
+
return safeGetLogger(core, config);
|
|
1129
|
+
},
|
|
1130
|
+
getCfg: function () {
|
|
1131
|
+
return config;
|
|
1132
|
+
},
|
|
1133
|
+
getExtCfg: _getExtCfg,
|
|
1134
|
+
getConfig: _getConfig,
|
|
1135
|
+
hasNext: function () {
|
|
1136
|
+
return _nextProxy != null;
|
|
1137
|
+
},
|
|
1138
|
+
getNext: function () {
|
|
1029
1139
|
return _nextProxy;
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1140
|
+
},
|
|
1141
|
+
setNext: function (nextPlugin) {
|
|
1032
1142
|
_nextProxy = nextPlugin;
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1143
|
+
},
|
|
1144
|
+
processNext: function (env) {
|
|
1145
|
+
_processChain(function (nextPlugin) {
|
|
1146
|
+
nextPlugin.processTelemetry(env, context);
|
|
1147
|
+
});
|
|
1148
|
+
},
|
|
1149
|
+
iterate: _iterateChain,
|
|
1150
|
+
createNew: function (plugins, startAt) {
|
|
1151
|
+
if (plugins === void 0) { plugins = null; }
|
|
1152
|
+
if (isArray(plugins)) {
|
|
1153
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1037
1154
|
}
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1155
|
+
return createProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1156
|
+
},
|
|
1157
|
+
onComplete: function (onComplete) {
|
|
1158
|
+
_onComplete = onComplete;
|
|
1159
|
+
}
|
|
1160
|
+
};
|
|
1161
|
+
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1162
|
+
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1163
|
+
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
1164
|
+
var theConfig;
|
|
1165
|
+
if (config) {
|
|
1166
|
+
var extConfig = config.extensionConfig;
|
|
1167
|
+
if (extConfig && identifier) {
|
|
1168
|
+
theConfig = extConfig[identifier];
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
if (!theConfig) {
|
|
1172
|
+
theConfig = defaultValue;
|
|
1173
|
+
}
|
|
1174
|
+
else if (isObject(defaultValue)) {
|
|
1175
|
+
if (mergeDefault !== 0 ) {
|
|
1176
|
+
var newConfig_1 = objExtend(true, defaultValue, theConfig);
|
|
1177
|
+
if (config && mergeDefault === 2 ) {
|
|
1178
|
+
objForEachKey(defaultValue, function (field) {
|
|
1179
|
+
if (isNullOrUndefined(newConfig_1[field])) {
|
|
1180
|
+
var cfgValue = config[field];
|
|
1181
|
+
if (!isNullOrUndefined(cfgValue)) {
|
|
1182
|
+
newConfig_1[field] = cfgValue;
|
|
1183
|
+
}
|
|
1057
1184
|
}
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
else if (_nextProxy) {
|
|
1061
|
-
_self._hasRun = true;
|
|
1062
|
-
_nextProxy.processTelemetry(env, itemCtx);
|
|
1063
|
-
}
|
|
1064
|
-
}, function () { return ({ item: env }); }, !(env.sync));
|
|
1065
|
-
};
|
|
1066
|
-
}
|
|
1067
|
-
return TelemetryPluginChain;
|
|
1068
|
-
}());
|
|
1069
|
-
|
|
1070
|
-
function _createProxyChain(plugins, itemCtx) {
|
|
1071
|
-
var proxies = [];
|
|
1072
|
-
if (plugins && plugins.length > 0) {
|
|
1073
|
-
var lastProxy = null;
|
|
1074
|
-
for (var idx = 0; idx < plugins.length; idx++) {
|
|
1075
|
-
var thePlugin = plugins[idx];
|
|
1076
|
-
if (thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
1077
|
-
var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
|
|
1078
|
-
proxies.push(newProxy);
|
|
1079
|
-
if (lastProxy) {
|
|
1080
|
-
lastProxy.setNext(newProxy);
|
|
1185
|
+
});
|
|
1081
1186
|
}
|
|
1082
|
-
lastProxy = newProxy;
|
|
1083
1187
|
}
|
|
1084
1188
|
}
|
|
1189
|
+
return theConfig;
|
|
1085
1190
|
}
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
while (proxy) {
|
|
1093
|
-
var thePlugin = proxy.getPlugin();
|
|
1094
|
-
if (add || thePlugin === startAt) {
|
|
1095
|
-
add = true;
|
|
1096
|
-
plugins.push(thePlugin);
|
|
1097
|
-
}
|
|
1098
|
-
proxy = proxy.getNext();
|
|
1191
|
+
function _getConfig(identifier, field, defaultValue) {
|
|
1192
|
+
if (defaultValue === void 0) { defaultValue = false; }
|
|
1193
|
+
var theValue;
|
|
1194
|
+
var extConfig = _getExtCfg(identifier, null);
|
|
1195
|
+
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1196
|
+
theValue = extConfig[field];
|
|
1099
1197
|
}
|
|
1198
|
+
else if (config && !isNullOrUndefined(config[field])) {
|
|
1199
|
+
theValue = config[field];
|
|
1200
|
+
}
|
|
1201
|
+
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1100
1202
|
}
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
arrForEach(srcPlugins, function (thePlugin) {
|
|
1112
|
-
if (add || thePlugin === startAt) {
|
|
1113
|
-
add = true;
|
|
1114
|
-
plugins.push(thePlugin);
|
|
1203
|
+
function _processChain(cb) {
|
|
1204
|
+
var nextPlugin = _nextProxy;
|
|
1205
|
+
if (nextPlugin) {
|
|
1206
|
+
_nextProxy = nextPlugin.getNext();
|
|
1207
|
+
cb(nextPlugin);
|
|
1208
|
+
}
|
|
1209
|
+
else {
|
|
1210
|
+
if (_onComplete) {
|
|
1211
|
+
_onComplete();
|
|
1212
|
+
_onComplete = null;
|
|
1115
1213
|
}
|
|
1116
|
-
}
|
|
1214
|
+
}
|
|
1117
1215
|
}
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1216
|
+
function _iterateChain(cb) {
|
|
1217
|
+
while (_nextProxy) {
|
|
1218
|
+
_processChain(function (nextPlugin) {
|
|
1219
|
+
var plugin = nextPlugin.getPlugin();
|
|
1220
|
+
if (plugin) {
|
|
1221
|
+
cb(plugin);
|
|
1222
|
+
}
|
|
1223
|
+
});
|
|
1121
1224
|
}
|
|
1122
|
-
plugins.push(startAt);
|
|
1123
1225
|
}
|
|
1124
|
-
return
|
|
1226
|
+
return context;
|
|
1125
1227
|
}
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1228
|
+
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
1229
|
+
var firstProxy = null;
|
|
1230
|
+
var add = startAt ? false : true;
|
|
1231
|
+
if (isArray(plugins) && plugins.length > 0) {
|
|
1232
|
+
var lastProxy_1 = null;
|
|
1233
|
+
arrForEach(plugins, function (thePlugin) {
|
|
1234
|
+
if (!add && startAt === thePlugin) {
|
|
1235
|
+
add = true;
|
|
1133
1236
|
}
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1237
|
+
if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
1238
|
+
var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
|
|
1239
|
+
if (!firstProxy) {
|
|
1240
|
+
firstProxy = newProxy;
|
|
1137
1241
|
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1242
|
+
if (lastProxy_1) {
|
|
1243
|
+
lastProxy_1._setNext(newProxy);
|
|
1140
1244
|
}
|
|
1245
|
+
lastProxy_1 = newProxy;
|
|
1141
1246
|
}
|
|
1142
|
-
}
|
|
1143
|
-
_self.core = function () {
|
|
1144
|
-
return core;
|
|
1145
|
-
};
|
|
1146
|
-
_self.diagLog = function () {
|
|
1147
|
-
return safeGetLogger(core, config);
|
|
1148
|
-
};
|
|
1149
|
-
_self.getCfg = function () {
|
|
1150
|
-
return config;
|
|
1151
|
-
};
|
|
1152
|
-
_self.getExtCfg = function (identifier, defaultValue) {
|
|
1153
|
-
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1154
|
-
var theConfig;
|
|
1155
|
-
if (config) {
|
|
1156
|
-
var extConfig = config.extensionConfig;
|
|
1157
|
-
if (extConfig && identifier) {
|
|
1158
|
-
theConfig = extConfig[identifier];
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
return (theConfig ? theConfig : defaultValue);
|
|
1162
|
-
};
|
|
1163
|
-
_self.getConfig = function (identifier, field, defaultValue) {
|
|
1164
|
-
if (defaultValue === void 0) { defaultValue = false; }
|
|
1165
|
-
var theValue;
|
|
1166
|
-
var extConfig = _self.getExtCfg(identifier, null);
|
|
1167
|
-
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1168
|
-
theValue = extConfig[field];
|
|
1169
|
-
}
|
|
1170
|
-
else if (config && !isNullOrUndefined(config[field])) {
|
|
1171
|
-
theValue = config[field];
|
|
1172
|
-
}
|
|
1173
|
-
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1174
|
-
};
|
|
1175
|
-
_self.hasNext = function () {
|
|
1176
|
-
return _nextProxy != null;
|
|
1177
|
-
};
|
|
1178
|
-
_self.getNext = function () {
|
|
1179
|
-
return _nextProxy;
|
|
1180
|
-
};
|
|
1181
|
-
_self.setNext = function (nextPlugin) {
|
|
1182
|
-
_nextProxy = nextPlugin;
|
|
1183
|
-
};
|
|
1184
|
-
_self.processNext = function (env) {
|
|
1185
|
-
var nextPlugin = _nextProxy;
|
|
1186
|
-
if (nextPlugin) {
|
|
1187
|
-
_nextProxy = nextPlugin.getNext();
|
|
1188
|
-
nextPlugin.processTelemetry(env, _self);
|
|
1189
|
-
}
|
|
1190
|
-
};
|
|
1191
|
-
_self.createNew = function (plugins, startAt) {
|
|
1192
|
-
if (plugins === void 0) { plugins = null; }
|
|
1193
|
-
return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1194
|
-
};
|
|
1247
|
+
});
|
|
1195
1248
|
}
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1249
|
+
if (startAt && !firstProxy) {
|
|
1250
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1251
|
+
}
|
|
1252
|
+
return firstProxy;
|
|
1253
|
+
}
|
|
1254
|
+
function createTelemetryPluginProxy(plugin, config, core) {
|
|
1255
|
+
var nextProxy = null;
|
|
1256
|
+
var hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1257
|
+
var hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1258
|
+
var chainId;
|
|
1259
|
+
if (plugin) {
|
|
1260
|
+
chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
|
|
1261
|
+
}
|
|
1262
|
+
else {
|
|
1263
|
+
chainId = "Unknown-0-" + _chainId++;
|
|
1264
|
+
}
|
|
1265
|
+
var proxyChain = {
|
|
1266
|
+
getPlugin: function () {
|
|
1267
|
+
return plugin;
|
|
1268
|
+
},
|
|
1269
|
+
getNext: function () {
|
|
1270
|
+
return nextProxy;
|
|
1271
|
+
},
|
|
1272
|
+
processTelemetry: _processTelemetry,
|
|
1273
|
+
_id: chainId,
|
|
1274
|
+
_setNext: function (nextPlugin) {
|
|
1275
|
+
nextProxy = nextPlugin;
|
|
1276
|
+
}
|
|
1277
|
+
};
|
|
1278
|
+
function _processChain(itemCtx, processPluginFn, processProxyFn, name, details, isAsync) {
|
|
1279
|
+
if (!itemCtx) {
|
|
1280
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1281
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
1227
1282
|
}
|
|
1228
|
-
};
|
|
1229
|
-
_self._getTelCtx = function (currentCtx) {
|
|
1230
|
-
if (currentCtx === void 0) { currentCtx = null; }
|
|
1231
|
-
var itemCtx = currentCtx;
|
|
1232
1283
|
if (!itemCtx) {
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1284
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
1288
|
+
var hasRunContext = itemCtx[strHasRunFlags];
|
|
1289
|
+
if (!hasRunContext) {
|
|
1290
|
+
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1291
|
+
}
|
|
1292
|
+
doPerf(itemCtx.core(), function () { return identifier + ":" + name; }, function () {
|
|
1293
|
+
hasRunContext[chainId] = true;
|
|
1294
|
+
var hasRun = false;
|
|
1295
|
+
itemCtx.setNext(nextProxy);
|
|
1296
|
+
if (plugin) {
|
|
1297
|
+
try {
|
|
1298
|
+
var nextId = nextProxy ? nextProxy._id : "";
|
|
1299
|
+
if (nextId) {
|
|
1300
|
+
hasRunContext[nextId] = false;
|
|
1301
|
+
}
|
|
1302
|
+
hasRun = processPluginFn(itemCtx);
|
|
1236
1303
|
}
|
|
1237
|
-
|
|
1238
|
-
|
|
1304
|
+
catch (error) {
|
|
1305
|
+
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
1306
|
+
if (hasNextRun) {
|
|
1307
|
+
hasRun = true;
|
|
1308
|
+
}
|
|
1309
|
+
if (!nextProxy || !hasNextRun) {
|
|
1310
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1311
|
+
}
|
|
1239
1312
|
}
|
|
1240
1313
|
}
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
_self._baseTelInit = function (config, core, extensions, pluginChain) {
|
|
1244
|
-
if (config) {
|
|
1245
|
-
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
1314
|
+
if (nextProxy && !hasRun) {
|
|
1315
|
+
processProxyFn(itemCtx);
|
|
1246
1316
|
}
|
|
1247
|
-
|
|
1248
|
-
|
|
1317
|
+
}, details, isAsync);
|
|
1318
|
+
}
|
|
1319
|
+
function _processTelemetry(env, itemCtx) {
|
|
1320
|
+
_processChain(itemCtx, function (itemCtx) {
|
|
1321
|
+
if (!hasProcessTelemetry) {
|
|
1322
|
+
return false;
|
|
1249
1323
|
}
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
1324
|
+
if (hasSetNext) {
|
|
1325
|
+
plugin.setNextPlugin(nextProxy);
|
|
1253
1326
|
}
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1327
|
+
plugin.processTelemetry(env, itemCtx);
|
|
1328
|
+
return true;
|
|
1329
|
+
}, function (itemCtx) {
|
|
1330
|
+
nextProxy.processTelemetry(env, itemCtx);
|
|
1331
|
+
}, "processTelemetry", function () { return ({ item: env }); }, !(env.sync));
|
|
1258
1332
|
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
};
|
|
1262
|
-
return BaseTelemetryPlugin;
|
|
1263
|
-
}());
|
|
1333
|
+
return objFreeze(proxyChain);
|
|
1334
|
+
}
|
|
1264
1335
|
|
|
1265
1336
|
var strToGMTString = "toGMTString";
|
|
1266
1337
|
var strToUTCString = "toUTCString";
|
|
@@ -1508,6 +1579,93 @@
|
|
|
1508
1579
|
return false;
|
|
1509
1580
|
}
|
|
1510
1581
|
|
|
1582
|
+
var strExtensionConfig = "extensionConfig";
|
|
1583
|
+
|
|
1584
|
+
var strGetPlugin = "getPlugin";
|
|
1585
|
+
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
1586
|
+
function BaseTelemetryPlugin() {
|
|
1587
|
+
var _self = this;
|
|
1588
|
+
var _isinitialized;
|
|
1589
|
+
var _rootCtx;
|
|
1590
|
+
var _nextPlugin;
|
|
1591
|
+
var _hooks;
|
|
1592
|
+
_initDefaults();
|
|
1593
|
+
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
1594
|
+
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
1595
|
+
_setDefaults(config, core, pluginChain);
|
|
1596
|
+
_isinitialized = true;
|
|
1597
|
+
};
|
|
1598
|
+
_self._addHook = function (hooks) {
|
|
1599
|
+
if (hooks) {
|
|
1600
|
+
if (isArray(hooks)) {
|
|
1601
|
+
_hooks = _hooks.concat(hooks);
|
|
1602
|
+
}
|
|
1603
|
+
else {
|
|
1604
|
+
_hooks.push(hooks);
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
};
|
|
1608
|
+
});
|
|
1609
|
+
_self.diagLog = function (itemCtx) {
|
|
1610
|
+
return _getTelCtx(itemCtx).diagLog();
|
|
1611
|
+
};
|
|
1612
|
+
_self.isInitialized = function () {
|
|
1613
|
+
return _isinitialized;
|
|
1614
|
+
};
|
|
1615
|
+
_self.setInitialized = function (isInitialized) {
|
|
1616
|
+
_isinitialized = isInitialized;
|
|
1617
|
+
};
|
|
1618
|
+
_self.setNextPlugin = function (next) {
|
|
1619
|
+
_nextPlugin = next;
|
|
1620
|
+
};
|
|
1621
|
+
_self.processNext = function (env, itemCtx) {
|
|
1622
|
+
if (itemCtx) {
|
|
1623
|
+
itemCtx.processNext(env);
|
|
1624
|
+
}
|
|
1625
|
+
else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
|
|
1626
|
+
_nextPlugin.processTelemetry(env, null);
|
|
1627
|
+
}
|
|
1628
|
+
};
|
|
1629
|
+
_self._getTelCtx = _getTelCtx;
|
|
1630
|
+
function _getTelCtx(currentCtx) {
|
|
1631
|
+
if (currentCtx === void 0) { currentCtx = null; }
|
|
1632
|
+
var itemCtx = currentCtx;
|
|
1633
|
+
if (!itemCtx) {
|
|
1634
|
+
var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
|
|
1635
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1636
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
1637
|
+
}
|
|
1638
|
+
else {
|
|
1639
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
return itemCtx;
|
|
1643
|
+
}
|
|
1644
|
+
function _setDefaults(config, core, pluginChain) {
|
|
1645
|
+
if (config) {
|
|
1646
|
+
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
1647
|
+
}
|
|
1648
|
+
if (!pluginChain && core) {
|
|
1649
|
+
pluginChain = core.getProcessTelContext().getNext();
|
|
1650
|
+
}
|
|
1651
|
+
var nextPlugin = _nextPlugin;
|
|
1652
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1653
|
+
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
1654
|
+
}
|
|
1655
|
+
_self.core = core;
|
|
1656
|
+
_rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
1657
|
+
}
|
|
1658
|
+
function _initDefaults() {
|
|
1659
|
+
_isinitialized = false;
|
|
1660
|
+
_self.core = null;
|
|
1661
|
+
_rootCtx = null;
|
|
1662
|
+
_nextPlugin = null;
|
|
1663
|
+
_hooks = [];
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
return BaseTelemetryPlugin;
|
|
1667
|
+
}());
|
|
1668
|
+
|
|
1511
1669
|
var UInt32Mask = 0x100000000;
|
|
1512
1670
|
var MaxUInt32 = 0xffffffff;
|
|
1513
1671
|
var _mwcSeeded = false;
|
|
@@ -1530,18 +1688,18 @@
|
|
|
1530
1688
|
}
|
|
1531
1689
|
}
|
|
1532
1690
|
function random32(signed) {
|
|
1533
|
-
var value;
|
|
1691
|
+
var value = 0;
|
|
1534
1692
|
var c = getCrypto() || getMsCrypto();
|
|
1535
1693
|
if (c && c.getRandomValues) {
|
|
1536
1694
|
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1537
1695
|
}
|
|
1538
|
-
|
|
1696
|
+
if (value === 0 && isIE()) {
|
|
1539
1697
|
if (!_mwcSeeded) {
|
|
1540
1698
|
_autoSeedMwc();
|
|
1541
1699
|
}
|
|
1542
1700
|
value = mwcRandom32() & MaxUInt32;
|
|
1543
1701
|
}
|
|
1544
|
-
|
|
1702
|
+
if (value === 0) {
|
|
1545
1703
|
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1546
1704
|
}
|
|
1547
1705
|
if (!signed) {
|
|
@@ -2732,7 +2890,7 @@
|
|
|
2732
2890
|
function _flushChannels() {
|
|
2733
2891
|
if (core) {
|
|
2734
2892
|
arrForEach(core.getTransmissionControls(), function (queues) {
|
|
2735
|
-
arrForEach(queues, function (q) {
|
|
2893
|
+
arrForEach(queues, function (q) { q.flush(true); });
|
|
2736
2894
|
});
|
|
2737
2895
|
}
|
|
2738
2896
|
}
|
|
@@ -3464,7 +3622,7 @@
|
|
|
3464
3622
|
config.disableFlushOnUnload = stringToBoolOrDefault(config.disableFlushOnUnload, config.disableFlushOnBeforeUnload);
|
|
3465
3623
|
return config;
|
|
3466
3624
|
};
|
|
3467
|
-
ApplicationInsights.Version = "2.
|
|
3625
|
+
ApplicationInsights.Version = "2.8.0-beta.2203-01";
|
|
3468
3626
|
return ApplicationInsights;
|
|
3469
3627
|
}(BaseTelemetryPlugin));
|
|
3470
3628
|
var Timing = /** @class */ (function () {
|