@microsoft/applicationinsights-dependencies-js 2.7.4-nightly.2202-09 → 2.8.0-beta.2202-06

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.
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "applicationinsights-dependencies-js",
3
- "version": "2.7.4-nightly.2202-09",
3
+ "version": "2.8.0-beta.2202-06",
4
4
  "ext": {
5
5
  "@js": {
6
6
  "file": "applicationinsights-dependencies-js.js",
7
7
  "type": "text/javascript; charset=utf-8",
8
- "integrity": "sha256-mVBCkPtJw9wcjYum2AgONegOFublpSIVb6UNKrJNly4= sha384-VWPDi97qr/j4WVxYGDy9YscQXAq9lXBbHfp4rNlvAc1nJjnfwUvP2PUcTEzm15wM sha512-y8Os7Lik/JVUCs1/QvKdU6d3cwgCkrFTovC88/HrFRlx6qj83BNd5JbOBpvnVF/NKyfPCm/jup61lifyPPYwrQ==",
8
+ "integrity": "sha256-D44ONjdKLoAhtiwix39APpLd+GbQobZOFntT6MioEJE= sha384-L8pKIzYacGsSn4h5S7CVckaMA14oDjoInl1JuqkO9mPqt0phYMqhcUkdoCr57yfF sha512-Y+FXD1d8g2n+2rVhEgIyri8DcKm+zDexnsRA9GEzr+KDYzN1RtZfLe8c1zIDGIHvBqOjJoh5Bzfg52/n/6ujGw==",
9
9
  "hashes": {
10
- "sha256": "mVBCkPtJw9wcjYum2AgONegOFublpSIVb6UNKrJNly4=",
11
- "sha384": "VWPDi97qr/j4WVxYGDy9YscQXAq9lXBbHfp4rNlvAc1nJjnfwUvP2PUcTEzm15wM",
12
- "sha512": "y8Os7Lik/JVUCs1/QvKdU6d3cwgCkrFTovC88/HrFRlx6qj83BNd5JbOBpvnVF/NKyfPCm/jup61lifyPPYwrQ=="
10
+ "sha256": "D44ONjdKLoAhtiwix39APpLd+GbQobZOFntT6MioEJE=",
11
+ "sha384": "L8pKIzYacGsSn4h5S7CVckaMA14oDjoInl1JuqkO9mPqt0phYMqhcUkdoCr57yfF",
12
+ "sha512": "Y+FXD1d8g2n+2rVhEgIyri8DcKm+zDexnsRA9GEzr+KDYzN1RtZfLe8c1zIDGIHvBqOjJoh5Bzfg52/n/6ujGw=="
13
13
  }
14
14
  },
15
15
  "@min.js": {
16
16
  "file": "applicationinsights-dependencies-js.min.js",
17
17
  "type": "text/javascript; charset=utf-8",
18
- "integrity": "sha256-HmLthFoMSrmeQ8Vm7Ex1PFesPCbXfCRpM7TgJIoH0EQ= sha384-ZGt0R2C+iCfPml7nWW8JmpFbygYidlCFjD4HUx5uiSrGvp/tZqsnCwCR4UIIReg3 sha512-gml+fc7kA20Yy/kf16r25b9fnfDVqWkT2qwVbTsRU7FpgVzPaJXc2ftbRw/FOG9cYymQ9XPK/kS4YJXe+3E46g==",
18
+ "integrity": "sha256-JdNA1BddvgjpH98CStImVv4e8Gp1cvc7WD6odvkMsl0= sha384-9o0kr/YOLCapidzRsVuCIlLcoGVqg3Zg01oetmpAjWJHXbSHT66fTi9quMqwl6Mg sha512-MZI6+8P6N6c3dilpE+SEa9CzY5Hv/1n8YK5FwoFszZ2cAAkIC+G7tDWyS/tuWia/uAPjEPcjW2i0peyqtM62XQ==",
19
19
  "hashes": {
20
- "sha256": "HmLthFoMSrmeQ8Vm7Ex1PFesPCbXfCRpM7TgJIoH0EQ=",
21
- "sha384": "ZGt0R2C+iCfPml7nWW8JmpFbygYidlCFjD4HUx5uiSrGvp/tZqsnCwCR4UIIReg3",
22
- "sha512": "gml+fc7kA20Yy/kf16r25b9fnfDVqWkT2qwVbTsRU7FpgVzPaJXc2ftbRw/FOG9cYymQ9XPK/kS4YJXe+3E46g=="
20
+ "sha256": "JdNA1BddvgjpH98CStImVv4e8Gp1cvc7WD6odvkMsl0=",
21
+ "sha384": "9o0kr/YOLCapidzRsVuCIlLcoGVqg3Zg01oetmpAjWJHXbSHT66fTi9quMqwl6Mg",
22
+ "sha512": "MZI6+8P6N6c3dilpE+SEa9CzY5Hv/1n8YK5FwoFszZ2cAAkIC+G7tDWyS/tuWia/uAPjEPcjW2i0peyqtM62XQ=="
23
23
  }
24
24
  }
25
25
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Dependencies Plugin, 2.7.4-nightly.2202-09
2
+ * Application Insights JavaScript SDK - Dependencies Plugin, 2.8.0-beta.2202-06
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -434,6 +434,7 @@
434
434
  var str__Proto = "__proto__";
435
435
  var strConstructor = "constructor";
436
436
  var _objDefineProperty = ObjDefineProperty;
437
+ var _objFreeze = ObjClass.freeze;
437
438
  var _objKeys = ObjClass.keys;
438
439
  var StringProto = String[strShimPrototype];
439
440
  var _strTrim = StringProto[cStrTrim];
@@ -442,7 +443,7 @@
442
443
  var _isArray = Array.isArray;
443
444
  var _objToString = ObjProto[strToString];
444
445
  var _fnToString = ObjHasOwnProperty[strToString];
445
- _fnToString.call(ObjClass);
446
+ var _objFunctionString = _fnToString.call(ObjClass);
446
447
  var rCamelCase = /-([a-z])/g;
447
448
  var rNormalizeInvalid = /([^\w\d_$])/g;
448
449
  var rLeadingNumeric = /^(\d+[\w\d_$])/;
@@ -531,6 +532,25 @@
531
532
  function isNumber(value) {
532
533
  return typeof value === "number";
533
534
  }
535
+ function isBoolean(value) {
536
+ return typeof value === "boolean";
537
+ }
538
+ function isPlainObject(value) {
539
+ var result = false;
540
+ if (value && typeof value === "object") {
541
+ var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
542
+ if (!proto) {
543
+ result = true;
544
+ }
545
+ else {
546
+ if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
547
+ proto = proto[strConstructor];
548
+ }
549
+ result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
550
+ }
551
+ }
552
+ return result;
553
+ }
534
554
  function toISOString(date) {
535
555
  if (date) {
536
556
  return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
@@ -630,6 +650,10 @@
630
650
  }
631
651
  return false;
632
652
  }
653
+ function _doNothing(value) {
654
+ return value;
655
+ }
656
+ var objFreeze = _objFreeze || _doNothing;
633
657
  function dateNow() {
634
658
  var dt = Date;
635
659
  return dt.now ? dt.now() : new dt().getTime();
@@ -645,6 +669,50 @@
645
669
  }
646
670
  return theValue;
647
671
  }
672
+ function objExtend(obj, obj2, obj3, obj4, obj5, obj6) {
673
+ var theArgs = arguments;
674
+ var extended = theArgs[0] || {};
675
+ var argLen = theArgs.length;
676
+ var deep = false;
677
+ var idx = 1;
678
+ if (argLen > 0 && isBoolean(extended)) {
679
+ deep = extended;
680
+ extended = theArgs[idx] || {};
681
+ idx++;
682
+ }
683
+ if (!isObject(extended)) {
684
+ extended = {};
685
+ }
686
+ for (; idx < argLen; idx++) {
687
+ var arg = theArgs[idx];
688
+ var isArgArray = isArray(arg);
689
+ var isArgObj = isObject(arg);
690
+ for (var prop in arg) {
691
+ var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
692
+ if (!propOk) {
693
+ continue;
694
+ }
695
+ var newValue = arg[prop];
696
+ var isNewArray = void 0;
697
+ if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
698
+ var clone = extended[prop];
699
+ if (isNewArray) {
700
+ if (!isArray(clone)) {
701
+ clone = [];
702
+ }
703
+ }
704
+ else if (!isPlainObject(clone)) {
705
+ clone = {};
706
+ }
707
+ newValue = objExtend(deep, clone, newValue);
708
+ }
709
+ if (newValue !== undefined) {
710
+ extended[prop] = newValue;
711
+ }
712
+ }
713
+ }
714
+ return extended;
715
+ }
648
716
 
649
717
  var strWindow = "window";
650
718
  var strDocument = "document";
@@ -658,6 +726,7 @@
658
726
  var strMsCrypto = "msCrypto";
659
727
  var strMsie = "msie";
660
728
  var strTrident = "trident/";
729
+ var strXMLHttpRequest = "XMLHttpRequest";
661
730
  var _isTrident = null;
662
731
  var _navUserAgentCheck = null;
663
732
  var _enableMocks = false;
@@ -770,7 +839,7 @@
770
839
  function isXhrSupported() {
771
840
  var isSupported = false;
772
841
  try {
773
- var xmlHttpRequest = getGlobalInst("XMLHttpRequest");
842
+ var xmlHttpRequest = getGlobalInst(strXMLHttpRequest);
774
843
  isSupported = !!xmlHttpRequest;
775
844
  }
776
845
  catch (e) {
@@ -1058,186 +1127,240 @@
1058
1127
  return func();
1059
1128
  }
1060
1129
 
1061
- var TelemetryPluginChain = /** @class */ (function () {
1062
- function TelemetryPluginChain(plugin, defItemCtx) {
1063
- var _self = this;
1064
- var _nextProxy = null;
1065
- var _hasProcessTelemetry = isFunction(plugin.processTelemetry);
1066
- var _hasSetNext = isFunction(plugin.setNextPlugin);
1067
- _self._hasRun = false;
1068
- _self.getPlugin = function () {
1069
- return plugin;
1070
- };
1071
- _self.getNext = function () {
1130
+ var strTelemetryPluginChain = "TelemetryPluginChain";
1131
+ var strHasRunFlags = "_hasRun";
1132
+ var strGetTelCtx = "_getTelCtx";
1133
+ var _chainId = 0;
1134
+ function _getNextProxyStart(proxy, config, core, startAt) {
1135
+ while (proxy) {
1136
+ if (proxy.getPlugin() === startAt) {
1137
+ return proxy;
1138
+ }
1139
+ proxy = proxy.getNext();
1140
+ }
1141
+ return createTelemetryProxyChain([startAt], config, core);
1142
+ }
1143
+ function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
1144
+ var _nextProxy = null;
1145
+ var _onComplete = null;
1146
+ if (startAt) {
1147
+ _nextProxy = _getNextProxyStart(telemetryChain, config, core, startAt);
1148
+ }
1149
+ else {
1150
+ _nextProxy = telemetryChain;
1151
+ }
1152
+ var context = {
1153
+ core: function () {
1154
+ return core;
1155
+ },
1156
+ diagLog: function () {
1157
+ return safeGetLogger(core, config);
1158
+ },
1159
+ getCfg: function () {
1160
+ return config;
1161
+ },
1162
+ getExtCfg: _getExtCfg,
1163
+ getConfig: _getConfig,
1164
+ hasNext: function () {
1165
+ return _nextProxy != null;
1166
+ },
1167
+ getNext: function () {
1072
1168
  return _nextProxy;
1073
- };
1074
- _self.setNext = function (nextPlugin) {
1169
+ },
1170
+ setNext: function (nextPlugin) {
1075
1171
  _nextProxy = nextPlugin;
1076
- };
1077
- _self.processTelemetry = function (env, itemCtx) {
1078
- if (!itemCtx) {
1079
- itemCtx = defItemCtx;
1172
+ },
1173
+ processNext: function (env) {
1174
+ _processChain(function (nextPlugin) {
1175
+ nextPlugin.processTelemetry(env, context);
1176
+ });
1177
+ },
1178
+ iterate: _iterateChain,
1179
+ createNew: function (plugins, startAt) {
1180
+ if (plugins === void 0) { plugins = null; }
1181
+ if (isArray(plugins)) {
1182
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1080
1183
  }
1081
- var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
1082
- doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
1083
- if (plugin && _hasProcessTelemetry) {
1084
- _self._hasRun = true;
1085
- try {
1086
- itemCtx.setNext(_nextProxy);
1087
- if (_hasSetNext) {
1088
- plugin.setNextPlugin(_nextProxy);
1089
- }
1090
- _nextProxy && (_nextProxy._hasRun = false);
1091
- plugin.processTelemetry(env, itemCtx);
1092
- }
1093
- catch (error) {
1094
- var hasRun = _nextProxy && _nextProxy._hasRun;
1095
- if (!_nextProxy || !hasRun) {
1096
- itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
1097
- }
1098
- if (_nextProxy && !hasRun) {
1099
- _nextProxy.processTelemetry(env, itemCtx);
1184
+ return createProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
1185
+ },
1186
+ onComplete: function (onComplete) {
1187
+ _onComplete = onComplete;
1188
+ }
1189
+ };
1190
+ function _getExtCfg(identifier, defaultValue, mergeDefault) {
1191
+ if (defaultValue === void 0) { defaultValue = {}; }
1192
+ if (mergeDefault === void 0) { mergeDefault = 0 ; }
1193
+ var theConfig;
1194
+ if (config) {
1195
+ var extConfig = config.extensionConfig;
1196
+ if (extConfig && identifier) {
1197
+ theConfig = extConfig[identifier];
1198
+ }
1199
+ }
1200
+ if (!theConfig) {
1201
+ theConfig = defaultValue;
1202
+ }
1203
+ else if (isObject(defaultValue)) {
1204
+ if (mergeDefault !== 0 ) {
1205
+ var newConfig_1 = objExtend(true, defaultValue, theConfig);
1206
+ if (config && mergeDefault === 2 ) {
1207
+ objForEachKey(defaultValue, function (field) {
1208
+ if (isNullOrUndefined(newConfig_1[field])) {
1209
+ var cfgValue = config[field];
1210
+ if (!isNullOrUndefined(cfgValue)) {
1211
+ newConfig_1[field] = cfgValue;
1212
+ }
1100
1213
  }
1101
- }
1102
- }
1103
- else if (_nextProxy) {
1104
- _self._hasRun = true;
1105
- _nextProxy.processTelemetry(env, itemCtx);
1106
- }
1107
- }, function () { return ({ item: env }); }, !(env.sync));
1108
- };
1109
- }
1110
- return TelemetryPluginChain;
1111
- }());
1112
-
1113
- function _createProxyChain(plugins, itemCtx) {
1114
- var proxies = [];
1115
- if (plugins && plugins.length > 0) {
1116
- var lastProxy = null;
1117
- for (var idx = 0; idx < plugins.length; idx++) {
1118
- var thePlugin = plugins[idx];
1119
- if (thePlugin && isFunction(thePlugin.processTelemetry)) {
1120
- var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
1121
- proxies.push(newProxy);
1122
- if (lastProxy) {
1123
- lastProxy.setNext(newProxy);
1214
+ });
1124
1215
  }
1125
- lastProxy = newProxy;
1126
1216
  }
1127
1217
  }
1218
+ return theConfig;
1128
1219
  }
1129
- return proxies.length > 0 ? proxies[0] : null;
1130
- }
1131
- function _copyProxyChain(proxy, itemCtx, startAt) {
1132
- var plugins = [];
1133
- var add = startAt ? false : true;
1134
- if (proxy) {
1135
- while (proxy) {
1136
- var thePlugin = proxy.getPlugin();
1137
- if (add || thePlugin === startAt) {
1138
- add = true;
1139
- plugins.push(thePlugin);
1220
+ function _getConfig(identifier, field, defaultValue) {
1221
+ if (defaultValue === void 0) { defaultValue = false; }
1222
+ var theValue;
1223
+ var extConfig = _getExtCfg(identifier, null);
1224
+ if (extConfig && !isNullOrUndefined(extConfig[field])) {
1225
+ theValue = extConfig[field];
1226
+ }
1227
+ else if (config && !isNullOrUndefined(config[field])) {
1228
+ theValue = config[field];
1229
+ }
1230
+ return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1231
+ }
1232
+ function _processChain(cb) {
1233
+ var nextPlugin = _nextProxy;
1234
+ if (nextPlugin) {
1235
+ _nextProxy = nextPlugin.getNext();
1236
+ cb(nextPlugin);
1237
+ }
1238
+ else {
1239
+ if (_onComplete) {
1240
+ _onComplete();
1241
+ _onComplete = null;
1140
1242
  }
1141
- proxy = proxy.getNext();
1142
1243
  }
1143
1244
  }
1144
- if (!add) {
1145
- plugins.push(startAt);
1245
+ function _iterateChain(cb) {
1246
+ while (_nextProxy) {
1247
+ _processChain(function (nextPlugin) {
1248
+ var plugin = nextPlugin.getPlugin();
1249
+ if (plugin) {
1250
+ cb(plugin);
1251
+ }
1252
+ });
1253
+ }
1146
1254
  }
1147
- return _createProxyChain(plugins, itemCtx);
1255
+ return context;
1148
1256
  }
1149
- function _copyPluginChain(srcPlugins, itemCtx, startAt) {
1150
- var plugins = srcPlugins;
1151
- var add = false;
1152
- if (startAt && srcPlugins) {
1153
- plugins = [];
1154
- arrForEach(srcPlugins, function (thePlugin) {
1155
- if (add || thePlugin === startAt) {
1257
+ function createTelemetryProxyChain(plugins, config, core, startAt) {
1258
+ var firstProxy = null;
1259
+ var add = startAt ? false : true;
1260
+ if (isArray(plugins) && plugins.length > 0) {
1261
+ var lastProxy_1 = null;
1262
+ arrForEach(plugins, function (thePlugin) {
1263
+ if (!add && startAt === thePlugin) {
1156
1264
  add = true;
1157
- plugins.push(thePlugin);
1265
+ }
1266
+ if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
1267
+ var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
1268
+ if (!firstProxy) {
1269
+ firstProxy = newProxy;
1270
+ }
1271
+ if (lastProxy_1) {
1272
+ lastProxy_1._setNext(newProxy);
1273
+ }
1274
+ lastProxy_1 = newProxy;
1158
1275
  }
1159
1276
  });
1160
1277
  }
1161
- if (startAt && !add) {
1162
- if (!plugins) {
1163
- plugins = [];
1164
- }
1165
- plugins.push(startAt);
1278
+ if (startAt && !firstProxy) {
1279
+ return createTelemetryProxyChain([startAt], config, core);
1166
1280
  }
1167
- return _createProxyChain(plugins, itemCtx);
1281
+ return firstProxy;
1168
1282
  }
1169
- var ProcessTelemetryContext = /** @class */ (function () {
1170
- function ProcessTelemetryContext(plugins, config, core, startAt) {
1171
- var _self = this;
1172
- var _nextProxy = null;
1173
- if (startAt !== null) {
1174
- if (plugins && isFunction(plugins.getPlugin)) {
1175
- _nextProxy = _copyProxyChain(plugins, _self, startAt || plugins.getPlugin());
1283
+ function createTelemetryPluginProxy(plugin, config, core) {
1284
+ var nextProxy = null;
1285
+ var hasProcessTelemetry = isFunction(plugin.processTelemetry);
1286
+ var hasSetNext = isFunction(plugin.setNextPlugin);
1287
+ var chainId;
1288
+ if (plugin) {
1289
+ chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
1290
+ }
1291
+ else {
1292
+ chainId = "Unknown-0-" + _chainId++;
1293
+ }
1294
+ var proxyChain = {
1295
+ getPlugin: function () {
1296
+ return plugin;
1297
+ },
1298
+ getNext: function () {
1299
+ return nextProxy;
1300
+ },
1301
+ processTelemetry: _processTelemetry,
1302
+ _id: chainId,
1303
+ _setNext: function (nextPlugin) {
1304
+ nextProxy = nextPlugin;
1305
+ }
1306
+ };
1307
+ function _processChain(itemCtx, processPluginFn, processProxyFn, name, details, isAsync) {
1308
+ if (!itemCtx) {
1309
+ if (plugin && isFunction(plugin[strGetTelCtx])) {
1310
+ itemCtx = plugin[strGetTelCtx]();
1176
1311
  }
1177
- else {
1178
- if (startAt) {
1179
- _nextProxy = _copyPluginChain(plugins, _self, startAt);
1180
- }
1181
- else if (isUndefined(startAt)) {
1182
- _nextProxy = _createProxyChain(plugins, _self);
1183
- }
1312
+ if (!itemCtx) {
1313
+ itemCtx = createProcessTelemetryContext(proxyChain, config, core);
1184
1314
  }
1185
1315
  }
1186
- _self.core = function () {
1187
- return core;
1188
- };
1189
- _self.diagLog = function () {
1190
- return safeGetLogger(core, config);
1191
- };
1192
- _self.getCfg = function () {
1193
- return config;
1194
- };
1195
- _self.getExtCfg = function (identifier, defaultValue) {
1196
- if (defaultValue === void 0) { defaultValue = {}; }
1197
- var theConfig;
1198
- if (config) {
1199
- var extConfig = config.extensionConfig;
1200
- if (extConfig && identifier) {
1201
- theConfig = extConfig[identifier];
1316
+ var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
1317
+ var hasRunContext = itemCtx[strHasRunFlags];
1318
+ if (!hasRunContext) {
1319
+ hasRunContext = itemCtx[strHasRunFlags] = {};
1320
+ }
1321
+ doPerf(itemCtx.core(), function () { return identifier + ":" + name; }, function () {
1322
+ hasRunContext[chainId] = true;
1323
+ var hasRun = false;
1324
+ itemCtx.setNext(nextProxy);
1325
+ if (plugin) {
1326
+ try {
1327
+ var nextId = nextProxy ? nextProxy._id : "";
1328
+ if (nextId) {
1329
+ hasRunContext[nextId] = false;
1330
+ }
1331
+ hasRun = processPluginFn(itemCtx);
1332
+ }
1333
+ catch (error) {
1334
+ var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
1335
+ if (hasNextRun) {
1336
+ hasRun = true;
1337
+ }
1338
+ if (!nextProxy || !hasNextRun) {
1339
+ itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1340
+ }
1202
1341
  }
1203
1342
  }
1204
- return (theConfig ? theConfig : defaultValue);
1205
- };
1206
- _self.getConfig = function (identifier, field, defaultValue) {
1207
- if (defaultValue === void 0) { defaultValue = false; }
1208
- var theValue;
1209
- var extConfig = _self.getExtCfg(identifier, null);
1210
- if (extConfig && !isNullOrUndefined(extConfig[field])) {
1211
- theValue = extConfig[field];
1343
+ if (nextProxy && !hasRun) {
1344
+ processProxyFn(itemCtx);
1212
1345
  }
1213
- else if (config && !isNullOrUndefined(config[field])) {
1214
- theValue = config[field];
1346
+ }, details, isAsync);
1347
+ }
1348
+ function _processTelemetry(env, itemCtx) {
1349
+ _processChain(itemCtx, function (itemCtx) {
1350
+ if (!hasProcessTelemetry) {
1351
+ return false;
1215
1352
  }
1216
- return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1217
- };
1218
- _self.hasNext = function () {
1219
- return _nextProxy != null;
1220
- };
1221
- _self.getNext = function () {
1222
- return _nextProxy;
1223
- };
1224
- _self.setNext = function (nextPlugin) {
1225
- _nextProxy = nextPlugin;
1226
- };
1227
- _self.processNext = function (env) {
1228
- var nextPlugin = _nextProxy;
1229
- if (nextPlugin) {
1230
- _nextProxy = nextPlugin.getNext();
1231
- nextPlugin.processTelemetry(env, _self);
1353
+ if (hasSetNext) {
1354
+ plugin.setNextPlugin(nextProxy);
1232
1355
  }
1233
- };
1234
- _self.createNew = function (plugins, startAt) {
1235
- if (plugins === void 0) { plugins = null; }
1236
- return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
1237
- };
1356
+ plugin.processTelemetry(env, itemCtx);
1357
+ return true;
1358
+ }, function (itemCtx) {
1359
+ nextProxy.processTelemetry(env, itemCtx);
1360
+ }, "processTelemetry", function () { return ({ item: env }); }, !(env.sync));
1238
1361
  }
1239
- return ProcessTelemetryContext;
1240
- }());
1362
+ return objFreeze(proxyChain);
1363
+ }
1241
1364
 
1242
1365
  var strExtensionConfig = "extensionConfig";
1243
1366
 
@@ -1245,12 +1368,29 @@
1245
1368
  var BaseTelemetryPlugin = /** @class */ (function () {
1246
1369
  function BaseTelemetryPlugin() {
1247
1370
  var _self = this;
1248
- var _isinitialized = false;
1249
- var _rootCtx = null;
1250
- var _nextPlugin = null;
1251
- _self.core = null;
1371
+ var _isinitialized;
1372
+ var _rootCtx;
1373
+ var _nextPlugin;
1374
+ var _hooks;
1375
+ _initDefaults();
1376
+ dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
1377
+ _self.initialize = function (config, core, extensions, pluginChain) {
1378
+ _setDefaults(config, core, pluginChain);
1379
+ _isinitialized = true;
1380
+ };
1381
+ _self._addHook = function (hooks) {
1382
+ if (hooks) {
1383
+ if (isArray(hooks)) {
1384
+ _hooks = _hooks.concat(hooks);
1385
+ }
1386
+ else {
1387
+ _hooks.push(hooks);
1388
+ }
1389
+ }
1390
+ };
1391
+ });
1252
1392
  _self.diagLog = function (itemCtx) {
1253
- return _self._getTelCtx(itemCtx).diagLog();
1393
+ return _getTelCtx(itemCtx).diagLog();
1254
1394
  };
1255
1395
  _self.isInitialized = function () {
1256
1396
  return _isinitialized;
@@ -1269,11 +1409,12 @@
1269
1409
  _nextPlugin.processTelemetry(env, null);
1270
1410
  }
1271
1411
  };
1272
- _self._getTelCtx = function (currentCtx) {
1412
+ _self._getTelCtx = _getTelCtx;
1413
+ function _getTelCtx(currentCtx) {
1273
1414
  if (currentCtx === void 0) { currentCtx = null; }
1274
1415
  var itemCtx = currentCtx;
1275
1416
  if (!itemCtx) {
1276
- var rootCtx = _rootCtx || new ProcessTelemetryContext(null, {}, _self.core);
1417
+ var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
1277
1418
  if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1278
1419
  itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
1279
1420
  }
@@ -1282,8 +1423,8 @@
1282
1423
  }
1283
1424
  }
1284
1425
  return itemCtx;
1285
- };
1286
- _self._baseTelInit = function (config, core, extensions, pluginChain) {
1426
+ }
1427
+ function _setDefaults(config, core, pluginChain) {
1287
1428
  if (config) {
1288
1429
  setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
1289
1430
  }
@@ -1295,13 +1436,16 @@
1295
1436
  nextPlugin = _nextPlugin[strGetPlugin]();
1296
1437
  }
1297
1438
  _self.core = core;
1298
- _rootCtx = new ProcessTelemetryContext(pluginChain, config, core, nextPlugin);
1299
- _isinitialized = true;
1300
- };
1439
+ _rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
1440
+ }
1441
+ function _initDefaults() {
1442
+ _isinitialized = false;
1443
+ _self.core = null;
1444
+ _rootCtx = null;
1445
+ _nextPlugin = null;
1446
+ _hooks = [];
1447
+ }
1301
1448
  }
1302
- BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
1303
- this._baseTelInit(config, core, extensions, pluginChain);
1304
- };
1305
1449
  return BaseTelemetryPlugin;
1306
1450
  }());
1307
1451
 
@@ -1327,18 +1471,18 @@
1327
1471
  }
1328
1472
  }
1329
1473
  function random32(signed) {
1330
- var value;
1474
+ var value = 0;
1331
1475
  var c = getCrypto() || getMsCrypto();
1332
1476
  if (c && c.getRandomValues) {
1333
1477
  value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1334
1478
  }
1335
- else if (isIE()) {
1479
+ if (value === 0 && isIE()) {
1336
1480
  if (!_mwcSeeded) {
1337
1481
  _autoSeedMwc();
1338
1482
  }
1339
1483
  value = mwcRandom32() & MaxUInt32;
1340
1484
  }
1341
- else {
1485
+ if (value === 0) {
1342
1486
  value = Math.floor((UInt32Mask * Math.random()) | 0);
1343
1487
  }
1344
1488
  if (!signed) {
@@ -1433,6 +1577,7 @@
1433
1577
  };
1434
1578
  var hookCtx = [];
1435
1579
  var cbArgs = _createArgs([funcArgs], orgArgs);
1580
+ funcArgs.evt = getGlobalInst("event");
1436
1581
  function _createArgs(target, theArgs) {
1437
1582
  _arrLoop(theArgs, function (arg) {
1438
1583
  target.push(arg);