@microsoft/applicationinsights-channel-js 2.8.0-nightly.2202-06 → 2.8.0-nightly.2204-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.
- package/browser/applicationinsights-channel-js.integrity.json +9 -9
- package/browser/applicationinsights-channel-js.js +1666 -1012
- package/browser/applicationinsights-channel-js.js.map +1 -1
- package/browser/applicationinsights-channel-js.min.js +2 -2
- package/browser/applicationinsights-channel-js.min.js.map +1 -1
- package/dist/applicationinsights-channel-js.api.json +56 -58
- package/dist/applicationinsights-channel-js.api.md +0 -2
- package/dist/applicationinsights-channel-js.d.ts +1 -2
- package/dist/applicationinsights-channel-js.js +1666 -1012
- package/dist/applicationinsights-channel-js.js.map +1 -1
- package/dist/applicationinsights-channel-js.min.js +2 -2
- package/dist/applicationinsights-channel-js.min.js.map +1 -1
- package/dist/applicationinsights-channel-js.rollup.d.ts +1 -2
- package/dist-esm/EnvelopeCreator.js +5 -5
- package/dist-esm/EnvelopeCreator.js.map +1 -1
- package/dist-esm/Interfaces.js +1 -1
- package/dist-esm/Offline.js +77 -65
- package/dist-esm/Offline.js.map +1 -1
- package/dist-esm/SendBuffer.js +7 -7
- package/dist-esm/SendBuffer.js.map +1 -1
- package/dist-esm/Sender.js +73 -63
- package/dist-esm/Sender.js.map +1 -1
- package/dist-esm/Serializer.js +10 -10
- package/dist-esm/Serializer.js.map +1 -1
- package/dist-esm/TelemetryProcessors/Sample.js +3 -3
- package/dist-esm/TelemetryProcessors/Sample.js.map +1 -1
- package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.js +1 -1
- package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.js +1 -1
- package/dist-esm/applicationinsights-channel-js.js +1 -1
- package/package.json +4 -4
- package/src/EnvelopeCreator.ts +8 -8
- package/src/Offline.ts +88 -76
- package/src/SendBuffer.ts +14 -14
- package/src/Sender.ts +106 -113
- package/src/Serializer.ts +17 -21
- package/src/TelemetryProcessors/Sample.ts +1 -1
- package/src/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.ts +3 -1
- package/types/Offline.d.ts +8 -11
- package/types/Sender.d.ts +0 -1
- package/types/TelemetryProcessors/Sample.d.ts +2 -2
- package/types/tsdoc-metadata.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Channel, 2.8.0-nightly.
|
|
2
|
+
* Application Insights JavaScript SDK - Channel, 2.8.0-nightly.2204-06
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -75,7 +75,9 @@
|
|
|
75
75
|
var __assignFn = ObjAssign || __objAssignFnImpl;
|
|
76
76
|
var extendStaticsFn = function (d, b) {
|
|
77
77
|
extendStaticsFn = ObjClass["setPrototypeOf"] ||
|
|
78
|
-
({ __proto__: [] } instanceof Array && function (d, b) {
|
|
78
|
+
({ __proto__: [] } instanceof Array && function (d, b) {
|
|
79
|
+
d.__proto__ = b;
|
|
80
|
+
}) ||
|
|
79
81
|
function (d, b) {
|
|
80
82
|
for (var p in b) {
|
|
81
83
|
if (b[strShimHasOwnProperty](p)) {
|
|
@@ -90,10 +92,403 @@
|
|
|
90
92
|
throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
91
93
|
}
|
|
92
94
|
extendStaticsFn(d, b);
|
|
93
|
-
function __() {
|
|
95
|
+
function __() {
|
|
96
|
+
this.constructor = d;
|
|
97
|
+
}
|
|
94
98
|
d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
|
|
95
99
|
}
|
|
96
100
|
|
|
101
|
+
var strEmpty$1 = "";
|
|
102
|
+
var strSetNextPlugin = "setNextPlugin";
|
|
103
|
+
var strIsInitialized = "isInitialized";
|
|
104
|
+
var strTeardown = "teardown";
|
|
105
|
+
var strCore = "core";
|
|
106
|
+
var strUpdate = "update";
|
|
107
|
+
var strDisabled = "disabled";
|
|
108
|
+
var strDoTeardown = "_doTeardown";
|
|
109
|
+
|
|
110
|
+
var strToISOString = "toISOString";
|
|
111
|
+
var strIndexOf = "indexOf";
|
|
112
|
+
var strMap = "map";
|
|
113
|
+
var cStrTrim = "trim";
|
|
114
|
+
var strToString = "toString";
|
|
115
|
+
var str__Proto$1 = "__proto__";
|
|
116
|
+
var strConstructor = "constructor";
|
|
117
|
+
var _objDefineProperty$1 = ObjDefineProperty;
|
|
118
|
+
var _objFreeze = ObjClass.freeze;
|
|
119
|
+
var _objKeys = ObjClass.keys;
|
|
120
|
+
var StringProto = String[strShimPrototype];
|
|
121
|
+
var _strTrim = StringProto[cStrTrim];
|
|
122
|
+
var DateProto = Date[strShimPrototype];
|
|
123
|
+
var _dataToISOString = DateProto[strToISOString];
|
|
124
|
+
var _isArray = Array.isArray;
|
|
125
|
+
var _objToString = ObjProto[strToString];
|
|
126
|
+
var _fnToString = ObjHasOwnProperty[strToString];
|
|
127
|
+
var _objFunctionString = _fnToString.call(ObjClass);
|
|
128
|
+
var rCamelCase = /-([a-z])/g;
|
|
129
|
+
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
130
|
+
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
131
|
+
var _objGetPrototypeOf$1 = Object["getPrototypeOf"];
|
|
132
|
+
function _getObjProto$1(target) {
|
|
133
|
+
if (target) {
|
|
134
|
+
if (_objGetPrototypeOf$1) {
|
|
135
|
+
return _objGetPrototypeOf$1(target);
|
|
136
|
+
}
|
|
137
|
+
var newProto = target[str__Proto$1] || target[strShimPrototype] || target[strConstructor];
|
|
138
|
+
if (newProto) {
|
|
139
|
+
return newProto;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
function isUndefined(value) {
|
|
145
|
+
return value === undefined || typeof value === strShimUndefined;
|
|
146
|
+
}
|
|
147
|
+
function isNullOrUndefined(value) {
|
|
148
|
+
return (value === null || isUndefined(value));
|
|
149
|
+
}
|
|
150
|
+
function isObject(value) {
|
|
151
|
+
return !!(value && typeof value === strShimObject);
|
|
152
|
+
}
|
|
153
|
+
function isFunction(value) {
|
|
154
|
+
return !!(value && typeof value === strShimFunction);
|
|
155
|
+
}
|
|
156
|
+
function normalizeJsName(name) {
|
|
157
|
+
var value = name;
|
|
158
|
+
if (value && isString(value)) {
|
|
159
|
+
value = value.replace(rCamelCase, function (_all, letter) {
|
|
160
|
+
return letter.toUpperCase();
|
|
161
|
+
});
|
|
162
|
+
value = value.replace(rNormalizeInvalid, "_");
|
|
163
|
+
value = value.replace(rLeadingNumeric, function (_all, match) {
|
|
164
|
+
return "_" + match;
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
return value;
|
|
168
|
+
}
|
|
169
|
+
function objForEachKey(target, callbackfn) {
|
|
170
|
+
if (target) {
|
|
171
|
+
for (var prop in target) {
|
|
172
|
+
if (ObjHasOwnProperty.call(target, prop)) {
|
|
173
|
+
callbackfn.call(target, prop, target[prop]);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function strContains(value, search) {
|
|
179
|
+
if (value && search) {
|
|
180
|
+
return value.indexOf(search) !== -1;
|
|
181
|
+
}
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
var isArray = _isArray || _isArrayPoly;
|
|
185
|
+
function _isArrayPoly(obj) {
|
|
186
|
+
return !!(obj && _objToString.call(obj) === "[object Array]");
|
|
187
|
+
}
|
|
188
|
+
function isError(obj) {
|
|
189
|
+
return !!(obj && _objToString.call(obj) === "[object Error]");
|
|
190
|
+
}
|
|
191
|
+
function isString(value) {
|
|
192
|
+
return typeof value === "string";
|
|
193
|
+
}
|
|
194
|
+
function isNumber(value) {
|
|
195
|
+
return typeof value === "number";
|
|
196
|
+
}
|
|
197
|
+
function isBoolean(value) {
|
|
198
|
+
return typeof value === "boolean";
|
|
199
|
+
}
|
|
200
|
+
function isPlainObject(value) {
|
|
201
|
+
var result = false;
|
|
202
|
+
if (value && typeof value === "object") {
|
|
203
|
+
var proto = _objGetPrototypeOf$1 ? _objGetPrototypeOf$1(value) : _getObjProto$1(value);
|
|
204
|
+
if (!proto) {
|
|
205
|
+
result = true;
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
|
|
209
|
+
proto = proto[strConstructor];
|
|
210
|
+
}
|
|
211
|
+
result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return result;
|
|
215
|
+
}
|
|
216
|
+
function toISOString(date) {
|
|
217
|
+
if (date) {
|
|
218
|
+
return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
function _toISOStringPoly(date) {
|
|
222
|
+
if (date && date.getUTCFullYear) {
|
|
223
|
+
var pad = function (num) {
|
|
224
|
+
var r = String(num);
|
|
225
|
+
if (r.length === 1) {
|
|
226
|
+
r = "0" + r;
|
|
227
|
+
}
|
|
228
|
+
return r;
|
|
229
|
+
};
|
|
230
|
+
return date.getUTCFullYear()
|
|
231
|
+
+ "-" + pad(date.getUTCMonth() + 1)
|
|
232
|
+
+ "-" + pad(date.getUTCDate())
|
|
233
|
+
+ "T" + pad(date.getUTCHours())
|
|
234
|
+
+ ":" + pad(date.getUTCMinutes())
|
|
235
|
+
+ ":" + pad(date.getUTCSeconds())
|
|
236
|
+
+ "." + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)
|
|
237
|
+
+ "Z";
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
function arrForEach(arr, callbackfn, thisArg) {
|
|
241
|
+
var len = arr.length;
|
|
242
|
+
try {
|
|
243
|
+
for (var idx = 0; idx < len; idx++) {
|
|
244
|
+
if (idx in arr) {
|
|
245
|
+
if (callbackfn.call(thisArg || arr, arr[idx], idx, arr) === -1) {
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
catch (e) {
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
function arrIndexOf(arr, searchElement, fromIndex) {
|
|
255
|
+
if (arr) {
|
|
256
|
+
if (arr[strIndexOf]) {
|
|
257
|
+
return arr[strIndexOf](searchElement, fromIndex);
|
|
258
|
+
}
|
|
259
|
+
var len = arr.length;
|
|
260
|
+
var from = fromIndex || 0;
|
|
261
|
+
try {
|
|
262
|
+
for (var lp = Math.max(from >= 0 ? from : len - Math.abs(from), 0); lp < len; lp++) {
|
|
263
|
+
if (lp in arr && arr[lp] === searchElement) {
|
|
264
|
+
return lp;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
catch (e) {
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return -1;
|
|
272
|
+
}
|
|
273
|
+
function arrMap(arr, callbackfn, thisArg) {
|
|
274
|
+
var results;
|
|
275
|
+
if (arr) {
|
|
276
|
+
if (arr[strMap]) {
|
|
277
|
+
return arr[strMap](callbackfn, thisArg);
|
|
278
|
+
}
|
|
279
|
+
var len = arr.length;
|
|
280
|
+
var _this = thisArg || arr;
|
|
281
|
+
results = new Array(len);
|
|
282
|
+
try {
|
|
283
|
+
for (var lp = 0; lp < len; lp++) {
|
|
284
|
+
if (lp in arr) {
|
|
285
|
+
results[lp] = callbackfn.call(_this, arr[lp], arr);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
catch (e) {
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return results;
|
|
293
|
+
}
|
|
294
|
+
function strTrim(str) {
|
|
295
|
+
if (str) {
|
|
296
|
+
str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str.replace ? str.replace(/^\s+|\s+$/g, "") : str);
|
|
297
|
+
}
|
|
298
|
+
return str;
|
|
299
|
+
}
|
|
300
|
+
var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable("toString");
|
|
301
|
+
var _objKeysDontEnums = [
|
|
302
|
+
"toString",
|
|
303
|
+
"toLocaleString",
|
|
304
|
+
"valueOf",
|
|
305
|
+
"hasOwnProperty",
|
|
306
|
+
"isPrototypeOf",
|
|
307
|
+
"propertyIsEnumerable",
|
|
308
|
+
"constructor"
|
|
309
|
+
];
|
|
310
|
+
function objKeys(obj) {
|
|
311
|
+
var objType = typeof obj;
|
|
312
|
+
if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {
|
|
313
|
+
throwTypeError("objKeys called on non-object");
|
|
314
|
+
}
|
|
315
|
+
if (!_objKeysHasDontEnumBug && _objKeys) {
|
|
316
|
+
return _objKeys(obj);
|
|
317
|
+
}
|
|
318
|
+
var result = [];
|
|
319
|
+
for (var prop in obj) {
|
|
320
|
+
if (obj && ObjHasOwnProperty.call(obj, prop)) {
|
|
321
|
+
result.push(prop);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
if (_objKeysHasDontEnumBug) {
|
|
325
|
+
var dontEnumsLength = _objKeysDontEnums.length;
|
|
326
|
+
for (var lp = 0; lp < dontEnumsLength; lp++) {
|
|
327
|
+
if (obj && ObjHasOwnProperty.call(obj, _objKeysDontEnums[lp])) {
|
|
328
|
+
result.push(_objKeysDontEnums[lp]);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return result;
|
|
333
|
+
}
|
|
334
|
+
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
335
|
+
if (_objDefineProperty$1) {
|
|
336
|
+
try {
|
|
337
|
+
var descriptor = {
|
|
338
|
+
enumerable: true,
|
|
339
|
+
configurable: true
|
|
340
|
+
};
|
|
341
|
+
if (getProp) {
|
|
342
|
+
descriptor.get = getProp;
|
|
343
|
+
}
|
|
344
|
+
if (setProp) {
|
|
345
|
+
descriptor.set = setProp;
|
|
346
|
+
}
|
|
347
|
+
_objDefineProperty$1(target, prop, descriptor);
|
|
348
|
+
return true;
|
|
349
|
+
}
|
|
350
|
+
catch (e) {
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
function _doNothing(value) {
|
|
356
|
+
return value;
|
|
357
|
+
}
|
|
358
|
+
function deepFreeze(obj) {
|
|
359
|
+
if (_objFreeze) {
|
|
360
|
+
objForEachKey(obj, function (name, value) {
|
|
361
|
+
if (isArray(value) || isObject(value)) {
|
|
362
|
+
_objFreeze(value);
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
return objFreeze(obj);
|
|
367
|
+
}
|
|
368
|
+
var objFreeze = _objFreeze || _doNothing;
|
|
369
|
+
function dateNow() {
|
|
370
|
+
var dt = Date;
|
|
371
|
+
return dt.now ? dt.now() : new dt().getTime();
|
|
372
|
+
}
|
|
373
|
+
function getExceptionName(object) {
|
|
374
|
+
if (isError(object)) {
|
|
375
|
+
return object.name;
|
|
376
|
+
}
|
|
377
|
+
return strEmpty$1;
|
|
378
|
+
}
|
|
379
|
+
function setValue(target, field, value, valChk, srcChk) {
|
|
380
|
+
var theValue = value;
|
|
381
|
+
if (target) {
|
|
382
|
+
theValue = target[field];
|
|
383
|
+
if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
|
|
384
|
+
theValue = value;
|
|
385
|
+
target[field] = theValue;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return theValue;
|
|
389
|
+
}
|
|
390
|
+
function isTruthy(value) {
|
|
391
|
+
return !!value;
|
|
392
|
+
}
|
|
393
|
+
function _createProxyFunction(source, funcName) {
|
|
394
|
+
var srcFunc = null;
|
|
395
|
+
var src = null;
|
|
396
|
+
if (isFunction(source)) {
|
|
397
|
+
srcFunc = source;
|
|
398
|
+
}
|
|
399
|
+
else {
|
|
400
|
+
src = source;
|
|
401
|
+
}
|
|
402
|
+
return function () {
|
|
403
|
+
var originalArguments = arguments;
|
|
404
|
+
if (srcFunc) {
|
|
405
|
+
src = srcFunc();
|
|
406
|
+
}
|
|
407
|
+
if (src) {
|
|
408
|
+
return src[funcName].apply(src, originalArguments);
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
|
|
413
|
+
if (target && name && source) {
|
|
414
|
+
if (overwriteTarget !== false || isUndefined(target[name])) {
|
|
415
|
+
target[name] = _createProxyFunction(source, theFunc);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
function createClassFromInterface(defaults) {
|
|
420
|
+
return /** @class */ (function () {
|
|
421
|
+
function class_1() {
|
|
422
|
+
var _this_1 = this;
|
|
423
|
+
if (defaults) {
|
|
424
|
+
objForEachKey(defaults, function (field, value) {
|
|
425
|
+
_this_1[field] = value;
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
return class_1;
|
|
430
|
+
}());
|
|
431
|
+
}
|
|
432
|
+
function optimizeObject(theObject) {
|
|
433
|
+
if (theObject && ObjAssign) {
|
|
434
|
+
theObject = ObjClass(ObjAssign({}, theObject));
|
|
435
|
+
}
|
|
436
|
+
return theObject;
|
|
437
|
+
}
|
|
438
|
+
function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
|
|
439
|
+
var theArgs = arguments;
|
|
440
|
+
var extended = theArgs[0] || {};
|
|
441
|
+
var argLen = theArgs.length;
|
|
442
|
+
var deep = false;
|
|
443
|
+
var idx = 1;
|
|
444
|
+
if (argLen > 0 && isBoolean(extended)) {
|
|
445
|
+
deep = extended;
|
|
446
|
+
extended = theArgs[idx] || {};
|
|
447
|
+
idx++;
|
|
448
|
+
}
|
|
449
|
+
if (!isObject(extended)) {
|
|
450
|
+
extended = {};
|
|
451
|
+
}
|
|
452
|
+
for (; idx < argLen; idx++) {
|
|
453
|
+
var arg = theArgs[idx];
|
|
454
|
+
var isArgArray = isArray(arg);
|
|
455
|
+
var isArgObj = isObject(arg);
|
|
456
|
+
for (var prop in arg) {
|
|
457
|
+
var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
|
|
458
|
+
if (!propOk) {
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
var newValue = arg[prop];
|
|
462
|
+
var isNewArray = void 0;
|
|
463
|
+
if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
|
|
464
|
+
var clone = extended[prop];
|
|
465
|
+
if (isNewArray) {
|
|
466
|
+
if (!isArray(clone)) {
|
|
467
|
+
clone = [];
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
else if (!isPlainObject(clone)) {
|
|
471
|
+
clone = {};
|
|
472
|
+
}
|
|
473
|
+
newValue = objExtend(deep, clone, newValue);
|
|
474
|
+
}
|
|
475
|
+
if (newValue !== undefined) {
|
|
476
|
+
extended[prop] = newValue;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return extended;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
function createEnumStyle(values) {
|
|
484
|
+
var enumClass = {};
|
|
485
|
+
objForEachKey(values, function (field, value) {
|
|
486
|
+
enumClass[field] = value;
|
|
487
|
+
enumClass[value] = field;
|
|
488
|
+
});
|
|
489
|
+
return deepFreeze(enumClass);
|
|
490
|
+
}
|
|
491
|
+
|
|
97
492
|
/*!
|
|
98
493
|
* Microsoft Dynamic Proto Utility, 1.1.4
|
|
99
494
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
@@ -269,424 +664,71 @@
|
|
|
269
664
|
}
|
|
270
665
|
_forEachProp(target, function (name) {
|
|
271
666
|
if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {
|
|
272
|
-
instFuncs_1[name] = target[name];
|
|
273
|
-
delete target[name];
|
|
274
|
-
if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
|
|
275
|
-
proto[name] = _createDynamicPrototype(proto, name);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
function _checkPrototype(classProto, thisTarget) {
|
|
282
|
-
if (_objGetPrototypeOf) {
|
|
283
|
-
var visited = [];
|
|
284
|
-
var thisProto = _getObjProto(thisTarget);
|
|
285
|
-
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
286
|
-
if (thisProto === classProto) {
|
|
287
|
-
return true;
|
|
288
|
-
}
|
|
289
|
-
visited.push(thisProto);
|
|
290
|
-
thisProto = _getObjProto(thisProto);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return false;
|
|
294
|
-
}
|
|
295
|
-
function _getObjName(target, unknownValue) {
|
|
296
|
-
if (_hasOwnProperty(target, Prototype)) {
|
|
297
|
-
return target.name || unknownValue || UnknownValue;
|
|
298
|
-
}
|
|
299
|
-
return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
|
|
300
|
-
}
|
|
301
|
-
function dynamicProto(theClass, target, delegateFunc, options) {
|
|
302
|
-
if (!_hasOwnProperty(theClass, Prototype)) {
|
|
303
|
-
_throwTypeError("theClass is an invalid class definition.");
|
|
304
|
-
}
|
|
305
|
-
var classProto = theClass[Prototype];
|
|
306
|
-
if (!_checkPrototype(classProto, target)) {
|
|
307
|
-
_throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
|
|
308
|
-
}
|
|
309
|
-
var className = null;
|
|
310
|
-
if (_hasOwnProperty(classProto, DynClassName)) {
|
|
311
|
-
className = classProto[DynClassName];
|
|
312
|
-
}
|
|
313
|
-
else {
|
|
314
|
-
className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
|
|
315
|
-
_dynamicNames++;
|
|
316
|
-
classProto[DynClassName] = className;
|
|
317
|
-
}
|
|
318
|
-
var perfOptions = dynamicProto[DynProtoDefaultOptions];
|
|
319
|
-
var useBaseInst = !!perfOptions[strUseBaseInst];
|
|
320
|
-
if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
|
|
321
|
-
useBaseInst = !!options[strUseBaseInst];
|
|
322
|
-
}
|
|
323
|
-
var instFuncs = _getInstanceFuncs(target);
|
|
324
|
-
var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
|
|
325
|
-
delegateFunc(target, baseFuncs);
|
|
326
|
-
var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
|
|
327
|
-
if (setInstanceFunc && options) {
|
|
328
|
-
setInstanceFunc = !!options[strSetInstFuncs];
|
|
329
|
-
}
|
|
330
|
-
_populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
|
|
331
|
-
}
|
|
332
|
-
var perfDefaults = {
|
|
333
|
-
setInstFuncs: true,
|
|
334
|
-
useBaseInst: true
|
|
335
|
-
};
|
|
336
|
-
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
337
|
-
|
|
338
|
-
var LoggingSeverity;
|
|
339
|
-
(function (LoggingSeverity) {
|
|
340
|
-
LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
|
|
341
|
-
LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
|
|
342
|
-
})(LoggingSeverity || (LoggingSeverity = {}));
|
|
343
|
-
var _InternalMessageId = {
|
|
344
|
-
BrowserDoesNotSupportLocalStorage: 0,
|
|
345
|
-
BrowserCannotReadLocalStorage: 1,
|
|
346
|
-
BrowserCannotReadSessionStorage: 2,
|
|
347
|
-
BrowserCannotWriteLocalStorage: 3,
|
|
348
|
-
BrowserCannotWriteSessionStorage: 4,
|
|
349
|
-
BrowserFailedRemovalFromLocalStorage: 5,
|
|
350
|
-
BrowserFailedRemovalFromSessionStorage: 6,
|
|
351
|
-
CannotSendEmptyTelemetry: 7,
|
|
352
|
-
ClientPerformanceMathError: 8,
|
|
353
|
-
ErrorParsingAISessionCookie: 9,
|
|
354
|
-
ErrorPVCalc: 10,
|
|
355
|
-
ExceptionWhileLoggingError: 11,
|
|
356
|
-
FailedAddingTelemetryToBuffer: 12,
|
|
357
|
-
FailedMonitorAjaxAbort: 13,
|
|
358
|
-
FailedMonitorAjaxDur: 14,
|
|
359
|
-
FailedMonitorAjaxOpen: 15,
|
|
360
|
-
FailedMonitorAjaxRSC: 16,
|
|
361
|
-
FailedMonitorAjaxSend: 17,
|
|
362
|
-
FailedMonitorAjaxGetCorrelationHeader: 18,
|
|
363
|
-
FailedToAddHandlerForOnBeforeUnload: 19,
|
|
364
|
-
FailedToSendQueuedTelemetry: 20,
|
|
365
|
-
FailedToReportDataLoss: 21,
|
|
366
|
-
FlushFailed: 22,
|
|
367
|
-
MessageLimitPerPVExceeded: 23,
|
|
368
|
-
MissingRequiredFieldSpecification: 24,
|
|
369
|
-
NavigationTimingNotSupported: 25,
|
|
370
|
-
OnError: 26,
|
|
371
|
-
SessionRenewalDateIsZero: 27,
|
|
372
|
-
SenderNotInitialized: 28,
|
|
373
|
-
StartTrackEventFailed: 29,
|
|
374
|
-
StopTrackEventFailed: 30,
|
|
375
|
-
StartTrackFailed: 31,
|
|
376
|
-
StopTrackFailed: 32,
|
|
377
|
-
TelemetrySampledAndNotSent: 33,
|
|
378
|
-
TrackEventFailed: 34,
|
|
379
|
-
TrackExceptionFailed: 35,
|
|
380
|
-
TrackMetricFailed: 36,
|
|
381
|
-
TrackPVFailed: 37,
|
|
382
|
-
TrackPVFailedCalc: 38,
|
|
383
|
-
TrackTraceFailed: 39,
|
|
384
|
-
TransmissionFailed: 40,
|
|
385
|
-
FailedToSetStorageBuffer: 41,
|
|
386
|
-
FailedToRestoreStorageBuffer: 42,
|
|
387
|
-
InvalidBackendResponse: 43,
|
|
388
|
-
FailedToFixDepricatedValues: 44,
|
|
389
|
-
InvalidDurationValue: 45,
|
|
390
|
-
TelemetryEnvelopeInvalid: 46,
|
|
391
|
-
CreateEnvelopeError: 47,
|
|
392
|
-
CannotSerializeObject: 48,
|
|
393
|
-
CannotSerializeObjectNonSerializable: 49,
|
|
394
|
-
CircularReferenceDetected: 50,
|
|
395
|
-
ClearAuthContextFailed: 51,
|
|
396
|
-
ExceptionTruncated: 52,
|
|
397
|
-
IllegalCharsInName: 53,
|
|
398
|
-
ItemNotInArray: 54,
|
|
399
|
-
MaxAjaxPerPVExceeded: 55,
|
|
400
|
-
MessageTruncated: 56,
|
|
401
|
-
NameTooLong: 57,
|
|
402
|
-
SampleRateOutOfRange: 58,
|
|
403
|
-
SetAuthContextFailed: 59,
|
|
404
|
-
SetAuthContextFailedAccountName: 60,
|
|
405
|
-
StringValueTooLong: 61,
|
|
406
|
-
StartCalledMoreThanOnce: 62,
|
|
407
|
-
StopCalledWithoutStart: 63,
|
|
408
|
-
TelemetryInitializerFailed: 64,
|
|
409
|
-
TrackArgumentsNotSpecified: 65,
|
|
410
|
-
UrlTooLong: 66,
|
|
411
|
-
SessionStorageBufferFull: 67,
|
|
412
|
-
CannotAccessCookie: 68,
|
|
413
|
-
IdTooLong: 69,
|
|
414
|
-
InvalidEvent: 70,
|
|
415
|
-
FailedMonitorAjaxSetRequestHeader: 71,
|
|
416
|
-
SendBrowserInfoOnUserInit: 72,
|
|
417
|
-
PluginException: 73,
|
|
418
|
-
NotificationException: 74,
|
|
419
|
-
SnippetScriptLoadFailure: 99,
|
|
420
|
-
InvalidInstrumentationKey: 100,
|
|
421
|
-
CannotParseAiBlobValue: 101,
|
|
422
|
-
InvalidContentBlob: 102,
|
|
423
|
-
TrackPageActionEventFailed: 103,
|
|
424
|
-
FailedAddingCustomDefinedRequestContext: 104,
|
|
425
|
-
InMemoryStorageBufferFull: 105
|
|
426
|
-
};
|
|
427
|
-
|
|
428
|
-
var strOnPrefix = "on";
|
|
429
|
-
var strAttachEvent = "attachEvent";
|
|
430
|
-
var strAddEventHelper = "addEventListener";
|
|
431
|
-
var strToISOString = "toISOString";
|
|
432
|
-
var strIndexOf = "indexOf";
|
|
433
|
-
var strMap = "map";
|
|
434
|
-
var cStrTrim = "trim";
|
|
435
|
-
var strToString = "toString";
|
|
436
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
437
|
-
var _objKeys = ObjClass.keys;
|
|
438
|
-
var StringProto = String[strShimPrototype];
|
|
439
|
-
var _strTrim = StringProto[cStrTrim];
|
|
440
|
-
var DateProto = Date[strShimPrototype];
|
|
441
|
-
var _dataToISOString = DateProto[strToISOString];
|
|
442
|
-
var _isArray = Array.isArray;
|
|
443
|
-
var _objToString = ObjProto[strToString];
|
|
444
|
-
var _fnToString = ObjHasOwnProperty[strToString];
|
|
445
|
-
_fnToString.call(ObjClass);
|
|
446
|
-
function isUndefined(value) {
|
|
447
|
-
return value === undefined || typeof value === strShimUndefined;
|
|
448
|
-
}
|
|
449
|
-
function isNullOrUndefined(value) {
|
|
450
|
-
return (value === null || isUndefined(value));
|
|
451
|
-
}
|
|
452
|
-
function isObject(value) {
|
|
453
|
-
return !!(value && typeof value === strShimObject);
|
|
454
|
-
}
|
|
455
|
-
function isFunction(value) {
|
|
456
|
-
return !!(value && typeof value === strShimFunction);
|
|
457
|
-
}
|
|
458
|
-
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
459
|
-
if (useCapture === void 0) { useCapture = false; }
|
|
460
|
-
var result = false;
|
|
461
|
-
if (!isNullOrUndefined(obj)) {
|
|
462
|
-
try {
|
|
463
|
-
if (!isNullOrUndefined(obj[strAddEventHelper])) {
|
|
464
|
-
obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);
|
|
465
|
-
result = true;
|
|
466
|
-
}
|
|
467
|
-
else if (!isNullOrUndefined(obj[strAttachEvent])) {
|
|
468
|
-
obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
469
|
-
result = true;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
catch (e) {
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
return result;
|
|
476
|
-
}
|
|
477
|
-
function objForEachKey(target, callbackfn) {
|
|
478
|
-
if (target) {
|
|
479
|
-
for (var prop in target) {
|
|
480
|
-
if (ObjHasOwnProperty.call(target, prop)) {
|
|
481
|
-
callbackfn.call(target, prop, target[prop]);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
function strContains(value, search) {
|
|
487
|
-
if (value && search) {
|
|
488
|
-
return value.indexOf(search) !== -1;
|
|
489
|
-
}
|
|
490
|
-
return false;
|
|
491
|
-
}
|
|
492
|
-
var isArray = _isArray || _isArrayPoly;
|
|
493
|
-
function _isArrayPoly(obj) {
|
|
494
|
-
return !!(obj && _objToString.call(obj) === "[object Array]");
|
|
495
|
-
}
|
|
496
|
-
function isError(obj) {
|
|
497
|
-
return !!(obj && _objToString.call(obj) === "[object Error]");
|
|
498
|
-
}
|
|
499
|
-
function isString(value) {
|
|
500
|
-
return typeof value === "string";
|
|
501
|
-
}
|
|
502
|
-
function isNumber(value) {
|
|
503
|
-
return typeof value === "number";
|
|
504
|
-
}
|
|
505
|
-
function toISOString(date) {
|
|
506
|
-
if (date) {
|
|
507
|
-
return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
function _toISOStringPoly(date) {
|
|
511
|
-
if (date && date.getUTCFullYear) {
|
|
512
|
-
var pad = function (num) {
|
|
513
|
-
var r = String(num);
|
|
514
|
-
if (r.length === 1) {
|
|
515
|
-
r = "0" + r;
|
|
516
|
-
}
|
|
517
|
-
return r;
|
|
518
|
-
};
|
|
519
|
-
return date.getUTCFullYear()
|
|
520
|
-
+ "-" + pad(date.getUTCMonth() + 1)
|
|
521
|
-
+ "-" + pad(date.getUTCDate())
|
|
522
|
-
+ "T" + pad(date.getUTCHours())
|
|
523
|
-
+ ":" + pad(date.getUTCMinutes())
|
|
524
|
-
+ ":" + pad(date.getUTCSeconds())
|
|
525
|
-
+ "." + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)
|
|
526
|
-
+ "Z";
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
function arrForEach(arr, callbackfn, thisArg) {
|
|
530
|
-
var len = arr.length;
|
|
531
|
-
try {
|
|
532
|
-
for (var idx = 0; idx < len; idx++) {
|
|
533
|
-
if (idx in arr) {
|
|
534
|
-
if (callbackfn.call(thisArg || arr, arr[idx], idx, arr) === -1) {
|
|
535
|
-
break;
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
catch (e) {
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
function arrIndexOf(arr, searchElement, fromIndex) {
|
|
544
|
-
if (arr) {
|
|
545
|
-
if (arr[strIndexOf]) {
|
|
546
|
-
return arr[strIndexOf](searchElement, fromIndex);
|
|
547
|
-
}
|
|
548
|
-
var len = arr.length;
|
|
549
|
-
var from = fromIndex || 0;
|
|
550
|
-
try {
|
|
551
|
-
for (var lp = Math.max(from >= 0 ? from : len - Math.abs(from), 0); lp < len; lp++) {
|
|
552
|
-
if (lp in arr && arr[lp] === searchElement) {
|
|
553
|
-
return lp;
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
catch (e) {
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
return -1;
|
|
561
|
-
}
|
|
562
|
-
function arrMap(arr, callbackfn, thisArg) {
|
|
563
|
-
var results;
|
|
564
|
-
if (arr) {
|
|
565
|
-
if (arr[strMap]) {
|
|
566
|
-
return arr[strMap](callbackfn, thisArg);
|
|
567
|
-
}
|
|
568
|
-
var len = arr.length;
|
|
569
|
-
var _this = thisArg || arr;
|
|
570
|
-
results = new Array(len);
|
|
571
|
-
try {
|
|
572
|
-
for (var lp = 0; lp < len; lp++) {
|
|
573
|
-
if (lp in arr) {
|
|
574
|
-
results[lp] = callbackfn.call(_this, arr[lp], arr);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
catch (e) {
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
return results;
|
|
582
|
-
}
|
|
583
|
-
function strTrim(str) {
|
|
584
|
-
if (str) {
|
|
585
|
-
str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str.replace ? str.replace(/^\s+|\s+$/g, "") : str);
|
|
586
|
-
}
|
|
587
|
-
return str;
|
|
588
|
-
}
|
|
589
|
-
var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable("toString");
|
|
590
|
-
var _objKeysDontEnums = [
|
|
591
|
-
"toString",
|
|
592
|
-
"toLocaleString",
|
|
593
|
-
"valueOf",
|
|
594
|
-
"hasOwnProperty",
|
|
595
|
-
"isPrototypeOf",
|
|
596
|
-
"propertyIsEnumerable",
|
|
597
|
-
"constructor"
|
|
598
|
-
];
|
|
599
|
-
function objKeys(obj) {
|
|
600
|
-
var objType = typeof obj;
|
|
601
|
-
if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {
|
|
602
|
-
throwTypeError("objKeys called on non-object");
|
|
603
|
-
}
|
|
604
|
-
if (!_objKeysHasDontEnumBug && _objKeys) {
|
|
605
|
-
return _objKeys(obj);
|
|
606
|
-
}
|
|
607
|
-
var result = [];
|
|
608
|
-
for (var prop in obj) {
|
|
609
|
-
if (obj && ObjHasOwnProperty.call(obj, prop)) {
|
|
610
|
-
result.push(prop);
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
if (_objKeysHasDontEnumBug) {
|
|
614
|
-
var dontEnumsLength = _objKeysDontEnums.length;
|
|
615
|
-
for (var lp = 0; lp < dontEnumsLength; lp++) {
|
|
616
|
-
if (obj && ObjHasOwnProperty.call(obj, _objKeysDontEnums[lp])) {
|
|
617
|
-
result.push(_objKeysDontEnums[lp]);
|
|
667
|
+
instFuncs_1[name] = target[name];
|
|
668
|
+
delete target[name];
|
|
669
|
+
if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
|
|
670
|
+
proto[name] = _createDynamicPrototype(proto, name);
|
|
671
|
+
}
|
|
618
672
|
}
|
|
619
|
-
}
|
|
673
|
+
});
|
|
620
674
|
}
|
|
621
|
-
return result;
|
|
622
675
|
}
|
|
623
|
-
function
|
|
624
|
-
if (
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
if (getProp) {
|
|
631
|
-
descriptor.get = getProp;
|
|
632
|
-
}
|
|
633
|
-
if (setProp) {
|
|
634
|
-
descriptor.set = setProp;
|
|
676
|
+
function _checkPrototype(classProto, thisTarget) {
|
|
677
|
+
if (_objGetPrototypeOf) {
|
|
678
|
+
var visited = [];
|
|
679
|
+
var thisProto = _getObjProto(thisTarget);
|
|
680
|
+
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
681
|
+
if (thisProto === classProto) {
|
|
682
|
+
return true;
|
|
635
683
|
}
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
}
|
|
639
|
-
catch (e) {
|
|
684
|
+
visited.push(thisProto);
|
|
685
|
+
thisProto = _getObjProto(thisProto);
|
|
640
686
|
}
|
|
641
687
|
}
|
|
642
688
|
return false;
|
|
643
689
|
}
|
|
644
|
-
function
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
}
|
|
648
|
-
function getExceptionName(object) {
|
|
649
|
-
if (isError(object)) {
|
|
650
|
-
return object.name;
|
|
690
|
+
function _getObjName(target, unknownValue) {
|
|
691
|
+
if (_hasOwnProperty(target, Prototype)) {
|
|
692
|
+
return target.name || unknownValue || UnknownValue;
|
|
651
693
|
}
|
|
652
|
-
return
|
|
694
|
+
return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
|
|
653
695
|
}
|
|
654
|
-
function
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
theValue = target[field];
|
|
658
|
-
if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
|
|
659
|
-
theValue = value;
|
|
660
|
-
target[field] = theValue;
|
|
661
|
-
}
|
|
696
|
+
function dynamicProto(theClass, target, delegateFunc, options) {
|
|
697
|
+
if (!_hasOwnProperty(theClass, Prototype)) {
|
|
698
|
+
_throwTypeError("theClass is an invalid class definition.");
|
|
662
699
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
return !!value;
|
|
667
|
-
}
|
|
668
|
-
function throwError(message) {
|
|
669
|
-
throw new Error(message);
|
|
670
|
-
}
|
|
671
|
-
function createClassFromInterface(defaults) {
|
|
672
|
-
return /** @class */ (function () {
|
|
673
|
-
function class_1() {
|
|
674
|
-
var _this_1 = this;
|
|
675
|
-
if (defaults) {
|
|
676
|
-
objForEachKey(defaults, function (field, value) {
|
|
677
|
-
_this_1[field] = value;
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
return class_1;
|
|
682
|
-
}());
|
|
683
|
-
}
|
|
684
|
-
function optimizeObject(theObject) {
|
|
685
|
-
if (theObject && ObjAssign) {
|
|
686
|
-
theObject = ObjClass(ObjAssign({}, theObject));
|
|
700
|
+
var classProto = theClass[Prototype];
|
|
701
|
+
if (!_checkPrototype(classProto, target)) {
|
|
702
|
+
_throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
|
|
687
703
|
}
|
|
688
|
-
|
|
704
|
+
var className = null;
|
|
705
|
+
if (_hasOwnProperty(classProto, DynClassName)) {
|
|
706
|
+
className = classProto[DynClassName];
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
|
|
710
|
+
_dynamicNames++;
|
|
711
|
+
classProto[DynClassName] = className;
|
|
712
|
+
}
|
|
713
|
+
var perfOptions = dynamicProto[DynProtoDefaultOptions];
|
|
714
|
+
var useBaseInst = !!perfOptions[strUseBaseInst];
|
|
715
|
+
if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
|
|
716
|
+
useBaseInst = !!options[strUseBaseInst];
|
|
717
|
+
}
|
|
718
|
+
var instFuncs = _getInstanceFuncs(target);
|
|
719
|
+
var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
|
|
720
|
+
delegateFunc(target, baseFuncs);
|
|
721
|
+
var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
|
|
722
|
+
if (setInstanceFunc && options) {
|
|
723
|
+
setInstanceFunc = !!options[strSetInstFuncs];
|
|
724
|
+
}
|
|
725
|
+
_populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
|
|
689
726
|
}
|
|
727
|
+
var perfDefaults = {
|
|
728
|
+
setInstFuncs: true,
|
|
729
|
+
useBaseInst: true
|
|
730
|
+
};
|
|
731
|
+
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
690
732
|
|
|
691
733
|
var strWindow = "window";
|
|
692
734
|
var strDocument = "document";
|
|
@@ -694,8 +736,13 @@
|
|
|
694
736
|
var strNavigator = "navigator";
|
|
695
737
|
var strConsole = "console";
|
|
696
738
|
var strJSON = "JSON";
|
|
739
|
+
var strCrypto = "crypto";
|
|
740
|
+
var strMsCrypto = "msCrypto";
|
|
697
741
|
var strMsie = "msie";
|
|
698
742
|
var strTrident = "trident/";
|
|
743
|
+
var strXMLHttpRequest = "XMLHttpRequest";
|
|
744
|
+
var _isTrident = null;
|
|
745
|
+
var _navUserAgentCheck = null;
|
|
699
746
|
var _useXDomainRequest = null;
|
|
700
747
|
var _beaconsSupported = null;
|
|
701
748
|
function _hasProperty(theClass, property) {
|
|
@@ -775,13 +822,28 @@
|
|
|
775
822
|
}
|
|
776
823
|
return null;
|
|
777
824
|
}
|
|
825
|
+
function getCrypto() {
|
|
826
|
+
return getGlobalInst(strCrypto);
|
|
827
|
+
}
|
|
828
|
+
function getMsCrypto() {
|
|
829
|
+
return getGlobalInst(strMsCrypto);
|
|
830
|
+
}
|
|
831
|
+
function isIE() {
|
|
832
|
+
var nav = getNavigator();
|
|
833
|
+
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
834
|
+
_navUserAgentCheck = nav.userAgent;
|
|
835
|
+
var userAgent = (_navUserAgentCheck || strEmpty$1).toLowerCase();
|
|
836
|
+
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
837
|
+
}
|
|
838
|
+
return _isTrident;
|
|
839
|
+
}
|
|
778
840
|
function getIEVersion(userAgentStr) {
|
|
779
841
|
if (userAgentStr === void 0) { userAgentStr = null; }
|
|
780
842
|
if (!userAgentStr) {
|
|
781
843
|
var navigator_1 = getNavigator() || {};
|
|
782
|
-
userAgentStr = navigator_1 ? (navigator_1.userAgent ||
|
|
844
|
+
userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty$1).toLowerCase() : strEmpty$1;
|
|
783
845
|
}
|
|
784
|
-
var ua = (userAgentStr ||
|
|
846
|
+
var ua = (userAgentStr || strEmpty$1).toLowerCase();
|
|
785
847
|
if (strContains(ua, strMsie)) {
|
|
786
848
|
var doc = getDocument() || {};
|
|
787
849
|
return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
|
|
@@ -796,7 +858,7 @@
|
|
|
796
858
|
}
|
|
797
859
|
function dumpObj(object) {
|
|
798
860
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
799
|
-
var propertyValueDump =
|
|
861
|
+
var propertyValueDump = strEmpty$1;
|
|
800
862
|
if (objectTypeDump === "[object Error]") {
|
|
801
863
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
802
864
|
}
|
|
@@ -814,8 +876,7 @@
|
|
|
814
876
|
function isFetchSupported(withKeepAlive) {
|
|
815
877
|
var isSupported = false;
|
|
816
878
|
try {
|
|
817
|
-
|
|
818
|
-
isSupported = !!fetchApi;
|
|
879
|
+
isSupported = !!getGlobalInst("fetch");
|
|
819
880
|
var request = getGlobalInst("Request");
|
|
820
881
|
if (isSupported && withKeepAlive && request) {
|
|
821
882
|
isSupported = _hasProperty(request, "keepalive");
|
|
@@ -827,9 +888,9 @@
|
|
|
827
888
|
}
|
|
828
889
|
function useXDomainRequest() {
|
|
829
890
|
if (_useXDomainRequest === null) {
|
|
830
|
-
_useXDomainRequest = (typeof XDomainRequest !==
|
|
891
|
+
_useXDomainRequest = (typeof XDomainRequest !== strShimUndefined);
|
|
831
892
|
if (_useXDomainRequest && isXhrSupported()) {
|
|
832
|
-
_useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst(
|
|
893
|
+
_useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst(strXMLHttpRequest), "withCredentials");
|
|
833
894
|
}
|
|
834
895
|
}
|
|
835
896
|
return _useXDomainRequest;
|
|
@@ -837,7 +898,7 @@
|
|
|
837
898
|
function isXhrSupported() {
|
|
838
899
|
var isSupported = false;
|
|
839
900
|
try {
|
|
840
|
-
var xmlHttpRequest = getGlobalInst(
|
|
901
|
+
var xmlHttpRequest = getGlobalInst(strXMLHttpRequest);
|
|
841
902
|
isSupported = !!xmlHttpRequest;
|
|
842
903
|
}
|
|
843
904
|
catch (e) {
|
|
@@ -868,9 +929,9 @@
|
|
|
868
929
|
var strWarnToConsole = "warnToConsole";
|
|
869
930
|
function _sanitizeDiagnosticText(text) {
|
|
870
931
|
if (text) {
|
|
871
|
-
return "\"" + text.replace(/\"/g,
|
|
932
|
+
return "\"" + text.replace(/\"/g, strEmpty$1) + "\"";
|
|
872
933
|
}
|
|
873
|
-
return
|
|
934
|
+
return strEmpty$1;
|
|
874
935
|
}
|
|
875
936
|
function _logToConsole(func, message) {
|
|
876
937
|
var theConsole = getConsole();
|
|
@@ -892,12 +953,12 @@
|
|
|
892
953
|
_self.message =
|
|
893
954
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
894
955
|
msgId;
|
|
895
|
-
var strProps =
|
|
956
|
+
var strProps = strEmpty$1;
|
|
896
957
|
if (hasJSON()) {
|
|
897
958
|
strProps = getJSON().stringify(properties);
|
|
898
959
|
}
|
|
899
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
900
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
960
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty$1) +
|
|
961
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty$1);
|
|
901
962
|
_self.message += diagnosticText;
|
|
902
963
|
}
|
|
903
964
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -927,7 +988,7 @@
|
|
|
927
988
|
throw message;
|
|
928
989
|
}
|
|
929
990
|
else {
|
|
930
|
-
var logFunc = severity ===
|
|
991
|
+
var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
|
|
931
992
|
if (!isUndefined(message.message)) {
|
|
932
993
|
var logLevel = _self.consoleLoggingLevel();
|
|
933
994
|
if (isUserAct) {
|
|
@@ -945,7 +1006,7 @@
|
|
|
945
1006
|
_self.logInternalMessage(severity, message);
|
|
946
1007
|
}
|
|
947
1008
|
else {
|
|
948
|
-
_debugExtMsg("throw" + (severity ===
|
|
1009
|
+
_debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
|
|
949
1010
|
}
|
|
950
1011
|
}
|
|
951
1012
|
};
|
|
@@ -977,13 +1038,13 @@
|
|
|
977
1038
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
978
1039
|
_self.queue.push(message);
|
|
979
1040
|
_messageCount++;
|
|
980
|
-
_debugExtMsg((severity ===
|
|
1041
|
+
_debugExtMsg((severity === 1 ? "error" : "warn"), message);
|
|
981
1042
|
}
|
|
982
1043
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
983
1044
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
984
|
-
var throttleMessage = new _InternalLogMessage(
|
|
1045
|
+
var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
|
|
985
1046
|
_self.queue.push(throttleMessage);
|
|
986
|
-
if (severity ===
|
|
1047
|
+
if (severity === 1 ) {
|
|
987
1048
|
_self.errorToConsole(throttleLimitMessage);
|
|
988
1049
|
}
|
|
989
1050
|
else {
|
|
@@ -1012,6 +1073,16 @@
|
|
|
1012
1073
|
}
|
|
1013
1074
|
return DiagnosticLogger;
|
|
1014
1075
|
}());
|
|
1076
|
+
function _getLogger(logger) {
|
|
1077
|
+
return (logger || new DiagnosticLogger());
|
|
1078
|
+
}
|
|
1079
|
+
function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
|
|
1080
|
+
if (isUserAct === void 0) { isUserAct = false; }
|
|
1081
|
+
(logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
|
|
1082
|
+
}
|
|
1083
|
+
function _warnToConsole(logger, message) {
|
|
1084
|
+
_getLogger(logger).warnToConsole(message);
|
|
1085
|
+
}
|
|
1015
1086
|
|
|
1016
1087
|
var strExecutionContextKey = "ctx";
|
|
1017
1088
|
var PerfEvent = /** @class */ (function () {
|
|
@@ -1125,207 +1196,616 @@
|
|
|
1125
1196
|
return func();
|
|
1126
1197
|
}
|
|
1127
1198
|
|
|
1128
|
-
var
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1199
|
+
var UInt32Mask = 0x100000000;
|
|
1200
|
+
var MaxUInt32 = 0xffffffff;
|
|
1201
|
+
var _mwcSeeded = false;
|
|
1202
|
+
var _mwcW = 123456789;
|
|
1203
|
+
var _mwcZ = 987654321;
|
|
1204
|
+
function _mwcSeed(seedValue) {
|
|
1205
|
+
if (seedValue < 0) {
|
|
1206
|
+
seedValue >>>= 0;
|
|
1207
|
+
}
|
|
1208
|
+
_mwcW = (123456789 + seedValue) & MaxUInt32;
|
|
1209
|
+
_mwcZ = (987654321 - seedValue) & MaxUInt32;
|
|
1210
|
+
_mwcSeeded = true;
|
|
1211
|
+
}
|
|
1212
|
+
function _autoSeedMwc() {
|
|
1213
|
+
try {
|
|
1214
|
+
var now = dateNow() & 0x7fffffff;
|
|
1215
|
+
_mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
|
|
1216
|
+
}
|
|
1217
|
+
catch (e) {
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
function random32(signed) {
|
|
1221
|
+
var value = 0;
|
|
1222
|
+
var c = getCrypto() || getMsCrypto();
|
|
1223
|
+
if (c && c.getRandomValues) {
|
|
1224
|
+
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1225
|
+
}
|
|
1226
|
+
if (value === 0 && isIE()) {
|
|
1227
|
+
if (!_mwcSeeded) {
|
|
1228
|
+
_autoSeedMwc();
|
|
1229
|
+
}
|
|
1230
|
+
value = mwcRandom32() & MaxUInt32;
|
|
1231
|
+
}
|
|
1232
|
+
if (value === 0) {
|
|
1233
|
+
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1234
|
+
}
|
|
1235
|
+
if (!signed) {
|
|
1236
|
+
value >>>= 0;
|
|
1237
|
+
}
|
|
1238
|
+
return value;
|
|
1239
|
+
}
|
|
1240
|
+
function mwcRandom32(signed) {
|
|
1241
|
+
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
1242
|
+
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
1243
|
+
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
1244
|
+
if (!signed) {
|
|
1245
|
+
value >>>= 0;
|
|
1246
|
+
}
|
|
1247
|
+
return value;
|
|
1248
|
+
}
|
|
1249
|
+
function newId(maxLength) {
|
|
1250
|
+
if (maxLength === void 0) { maxLength = 22; }
|
|
1251
|
+
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1252
|
+
var number = random32() >>> 0;
|
|
1253
|
+
var chars = 0;
|
|
1254
|
+
var result = strEmpty$1;
|
|
1255
|
+
while (result.length < maxLength) {
|
|
1256
|
+
chars++;
|
|
1257
|
+
result += base64chars.charAt(number & 0x3F);
|
|
1258
|
+
number >>>= 6;
|
|
1259
|
+
if (chars === 5) {
|
|
1260
|
+
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1261
|
+
chars = 0;
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
return result;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
1268
|
+
var version = "2.8.0-nightly.2204-06";
|
|
1269
|
+
var instanceName = "." + newId(6);
|
|
1270
|
+
var _dataUid = 0;
|
|
1271
|
+
function _createAccessor(target, prop, value) {
|
|
1272
|
+
if (_objDefineProperty) {
|
|
1273
|
+
try {
|
|
1274
|
+
_objDefineProperty(target, prop, {
|
|
1275
|
+
value: value,
|
|
1276
|
+
enumerable: false,
|
|
1277
|
+
configurable: true
|
|
1278
|
+
});
|
|
1279
|
+
return true;
|
|
1280
|
+
}
|
|
1281
|
+
catch (e) {
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
return false;
|
|
1285
|
+
}
|
|
1286
|
+
function _canAcceptData(target) {
|
|
1287
|
+
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1288
|
+
}
|
|
1289
|
+
function _getCache(data, target) {
|
|
1290
|
+
var theCache = target[data.id];
|
|
1291
|
+
if (!theCache) {
|
|
1292
|
+
theCache = {};
|
|
1293
|
+
try {
|
|
1294
|
+
if (_canAcceptData(target)) {
|
|
1295
|
+
if (!_createAccessor(target, data.id, theCache)) {
|
|
1296
|
+
target[data.id] = theCache;
|
|
1297
|
+
}
|
|
1147
1298
|
}
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1299
|
+
}
|
|
1300
|
+
catch (e) {
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
return theCache;
|
|
1304
|
+
}
|
|
1305
|
+
function createUniqueNamespace(name, includeVersion) {
|
|
1306
|
+
if (includeVersion === void 0) { includeVersion = false; }
|
|
1307
|
+
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1308
|
+
}
|
|
1309
|
+
function createElmNodeData(name) {
|
|
1310
|
+
var data = {
|
|
1311
|
+
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1312
|
+
accept: function (target) {
|
|
1313
|
+
return _canAcceptData(target);
|
|
1314
|
+
},
|
|
1315
|
+
get: function (target, name, defValue, addDefault) {
|
|
1316
|
+
var theCache = target[data.id];
|
|
1317
|
+
if (!theCache) {
|
|
1318
|
+
if (addDefault) {
|
|
1319
|
+
theCache = _getCache(data, target);
|
|
1320
|
+
theCache[normalizeJsName(name)] = defValue;
|
|
1169
1321
|
}
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1322
|
+
return defValue;
|
|
1323
|
+
}
|
|
1324
|
+
return theCache[normalizeJsName(name)];
|
|
1325
|
+
},
|
|
1326
|
+
kill: function (target, name) {
|
|
1327
|
+
if (target && target[name]) {
|
|
1328
|
+
try {
|
|
1329
|
+
delete target[name];
|
|
1173
1330
|
}
|
|
1174
|
-
|
|
1175
|
-
};
|
|
1176
|
-
}
|
|
1177
|
-
return TelemetryPluginChain;
|
|
1178
|
-
}());
|
|
1179
|
-
|
|
1180
|
-
function _createProxyChain(plugins, itemCtx) {
|
|
1181
|
-
var proxies = [];
|
|
1182
|
-
if (plugins && plugins.length > 0) {
|
|
1183
|
-
var lastProxy = null;
|
|
1184
|
-
for (var idx = 0; idx < plugins.length; idx++) {
|
|
1185
|
-
var thePlugin = plugins[idx];
|
|
1186
|
-
if (thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
1187
|
-
var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
|
|
1188
|
-
proxies.push(newProxy);
|
|
1189
|
-
if (lastProxy) {
|
|
1190
|
-
lastProxy.setNext(newProxy);
|
|
1331
|
+
catch (e) {
|
|
1191
1332
|
}
|
|
1192
|
-
lastProxy = newProxy;
|
|
1193
1333
|
}
|
|
1194
1334
|
}
|
|
1335
|
+
};
|
|
1336
|
+
return data;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
1340
|
+
function _getPluginState(plugin) {
|
|
1341
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1345
|
+
var strHasRunFlags = "_hasRun";
|
|
1346
|
+
var strGetTelCtx = "_getTelCtx";
|
|
1347
|
+
var _chainId = 0;
|
|
1348
|
+
function _getNextProxyStart(proxy, config, core, startAt) {
|
|
1349
|
+
while (proxy) {
|
|
1350
|
+
if (proxy.getPlugin() === startAt) {
|
|
1351
|
+
return proxy;
|
|
1352
|
+
}
|
|
1353
|
+
proxy = proxy.getNext();
|
|
1195
1354
|
}
|
|
1196
|
-
return
|
|
1355
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1197
1356
|
}
|
|
1198
|
-
function
|
|
1199
|
-
var
|
|
1200
|
-
var
|
|
1201
|
-
if (
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1357
|
+
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1358
|
+
var _nextProxy = null;
|
|
1359
|
+
var _onComplete = [];
|
|
1360
|
+
if (startAt !== null) {
|
|
1361
|
+
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1362
|
+
}
|
|
1363
|
+
var context = {
|
|
1364
|
+
_next: _moveNext,
|
|
1365
|
+
ctx: {
|
|
1366
|
+
core: function () {
|
|
1367
|
+
return core;
|
|
1368
|
+
},
|
|
1369
|
+
diagLog: function () {
|
|
1370
|
+
return safeGetLogger(core, config);
|
|
1371
|
+
},
|
|
1372
|
+
getCfg: function () {
|
|
1373
|
+
return config;
|
|
1374
|
+
},
|
|
1375
|
+
getExtCfg: _getExtCfg,
|
|
1376
|
+
getConfig: _getConfig,
|
|
1377
|
+
hasNext: function () {
|
|
1378
|
+
return !!_nextProxy;
|
|
1379
|
+
},
|
|
1380
|
+
getNext: function () {
|
|
1381
|
+
return _nextProxy;
|
|
1382
|
+
},
|
|
1383
|
+
setNext: function (nextPlugin) {
|
|
1384
|
+
_nextProxy = nextPlugin;
|
|
1385
|
+
},
|
|
1386
|
+
iterate: _iterateChain,
|
|
1387
|
+
onComplete: _addOnComplete
|
|
1388
|
+
}
|
|
1389
|
+
};
|
|
1390
|
+
function _addOnComplete(onComplete, that) {
|
|
1391
|
+
var args = [];
|
|
1392
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1393
|
+
args[_i - 2] = arguments[_i];
|
|
1394
|
+
}
|
|
1395
|
+
if (onComplete) {
|
|
1396
|
+
_onComplete.push({
|
|
1397
|
+
func: onComplete,
|
|
1398
|
+
self: !isUndefined(that) ? that : context.ctx,
|
|
1399
|
+
args: args
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
function _moveNext() {
|
|
1404
|
+
var nextProxy = _nextProxy;
|
|
1405
|
+
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1406
|
+
if (!nextProxy) {
|
|
1407
|
+
var onComplete = _onComplete;
|
|
1408
|
+
if (onComplete && onComplete.length > 0) {
|
|
1409
|
+
arrForEach(onComplete, function (completeDetails) {
|
|
1410
|
+
try {
|
|
1411
|
+
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
1412
|
+
}
|
|
1413
|
+
catch (e) {
|
|
1414
|
+
_throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
1415
|
+
}
|
|
1416
|
+
});
|
|
1417
|
+
_onComplete = [];
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
return nextProxy;
|
|
1421
|
+
}
|
|
1422
|
+
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1423
|
+
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1424
|
+
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
1425
|
+
var theConfig;
|
|
1426
|
+
if (config) {
|
|
1427
|
+
var extConfig = config.extensionConfig;
|
|
1428
|
+
if (extConfig && identifier) {
|
|
1429
|
+
theConfig = extConfig[identifier];
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
if (!theConfig) {
|
|
1433
|
+
theConfig = defaultValue;
|
|
1434
|
+
}
|
|
1435
|
+
else if (isObject(defaultValue)) {
|
|
1436
|
+
if (mergeDefault !== 0 ) {
|
|
1437
|
+
var newConfig_1 = objExtend(true, defaultValue, theConfig);
|
|
1438
|
+
if (config && mergeDefault === 2 ) {
|
|
1439
|
+
objForEachKey(defaultValue, function (field) {
|
|
1440
|
+
if (isNullOrUndefined(newConfig_1[field])) {
|
|
1441
|
+
var cfgValue = config[field];
|
|
1442
|
+
if (!isNullOrUndefined(cfgValue)) {
|
|
1443
|
+
newConfig_1[field] = cfgValue;
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
return theConfig;
|
|
1451
|
+
}
|
|
1452
|
+
function _getConfig(identifier, field, defaultValue) {
|
|
1453
|
+
if (defaultValue === void 0) { defaultValue = false; }
|
|
1454
|
+
var theValue;
|
|
1455
|
+
var extConfig = _getExtCfg(identifier, null);
|
|
1456
|
+
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1457
|
+
theValue = extConfig[field];
|
|
1458
|
+
}
|
|
1459
|
+
else if (config && !isNullOrUndefined(config[field])) {
|
|
1460
|
+
theValue = config[field];
|
|
1461
|
+
}
|
|
1462
|
+
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1463
|
+
}
|
|
1464
|
+
function _iterateChain(cb) {
|
|
1465
|
+
var nextPlugin;
|
|
1466
|
+
while (!!(nextPlugin = context._next())) {
|
|
1467
|
+
var plugin = nextPlugin.getPlugin();
|
|
1468
|
+
if (plugin) {
|
|
1469
|
+
cb(plugin);
|
|
1207
1470
|
}
|
|
1208
|
-
proxy = proxy.getNext();
|
|
1209
1471
|
}
|
|
1210
1472
|
}
|
|
1211
|
-
|
|
1212
|
-
|
|
1473
|
+
return context;
|
|
1474
|
+
}
|
|
1475
|
+
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1476
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1477
|
+
var context = internalContext.ctx;
|
|
1478
|
+
function _processNext(env) {
|
|
1479
|
+
var nextPlugin = internalContext._next();
|
|
1480
|
+
nextPlugin && nextPlugin.processTelemetry(env, context);
|
|
1481
|
+
return !nextPlugin;
|
|
1482
|
+
}
|
|
1483
|
+
function _createNew(plugins, startAt) {
|
|
1484
|
+
if (plugins === void 0) { plugins = null; }
|
|
1485
|
+
if (isArray(plugins)) {
|
|
1486
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1487
|
+
}
|
|
1488
|
+
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1213
1489
|
}
|
|
1214
|
-
|
|
1490
|
+
context.processNext = _processNext;
|
|
1491
|
+
context.createNew = _createNew;
|
|
1492
|
+
return context;
|
|
1215
1493
|
}
|
|
1216
|
-
function
|
|
1217
|
-
var
|
|
1218
|
-
var
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1494
|
+
function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
|
|
1495
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1496
|
+
var context = internalContext.ctx;
|
|
1497
|
+
function _processNext(unloadState) {
|
|
1498
|
+
var nextPlugin = internalContext._next();
|
|
1499
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1500
|
+
return !nextPlugin;
|
|
1501
|
+
}
|
|
1502
|
+
function _createNew(plugins, startAt) {
|
|
1503
|
+
if (plugins === void 0) { plugins = null; }
|
|
1504
|
+
if (isArray(plugins)) {
|
|
1505
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1506
|
+
}
|
|
1507
|
+
return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
|
|
1508
|
+
}
|
|
1509
|
+
context.processNext = _processNext;
|
|
1510
|
+
context.createNew = _createNew;
|
|
1511
|
+
return context;
|
|
1512
|
+
}
|
|
1513
|
+
function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
|
|
1514
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1515
|
+
var context = internalContext.ctx;
|
|
1516
|
+
function _processNext(updateState) {
|
|
1517
|
+
return context.iterate(function (plugin) {
|
|
1518
|
+
if (isFunction(plugin[strUpdate])) {
|
|
1519
|
+
plugin[strUpdate](context, updateState);
|
|
1225
1520
|
}
|
|
1226
1521
|
});
|
|
1227
1522
|
}
|
|
1228
|
-
|
|
1229
|
-
if (
|
|
1230
|
-
|
|
1523
|
+
function _createNew(plugins, startAt) {
|
|
1524
|
+
if (plugins === void 0) { plugins = null; }
|
|
1525
|
+
if (isArray(plugins)) {
|
|
1526
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1231
1527
|
}
|
|
1232
|
-
plugins.
|
|
1528
|
+
return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
|
|
1233
1529
|
}
|
|
1234
|
-
|
|
1530
|
+
context.processNext = _processNext;
|
|
1531
|
+
context.createNew = _createNew;
|
|
1532
|
+
return context;
|
|
1235
1533
|
}
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1534
|
+
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
1535
|
+
var firstProxy = null;
|
|
1536
|
+
var add = startAt ? false : true;
|
|
1537
|
+
if (isArray(plugins) && plugins.length > 0) {
|
|
1538
|
+
var lastProxy_1 = null;
|
|
1539
|
+
arrForEach(plugins, function (thePlugin) {
|
|
1540
|
+
if (!add && startAt === thePlugin) {
|
|
1541
|
+
add = true;
|
|
1243
1542
|
}
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1543
|
+
if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
1544
|
+
var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
|
|
1545
|
+
if (!firstProxy) {
|
|
1546
|
+
firstProxy = newProxy;
|
|
1247
1547
|
}
|
|
1248
|
-
|
|
1249
|
-
|
|
1548
|
+
if (lastProxy_1) {
|
|
1549
|
+
lastProxy_1._setNext(newProxy);
|
|
1250
1550
|
}
|
|
1551
|
+
lastProxy_1 = newProxy;
|
|
1251
1552
|
}
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
if (startAt && !firstProxy) {
|
|
1556
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1557
|
+
}
|
|
1558
|
+
return firstProxy;
|
|
1559
|
+
}
|
|
1560
|
+
function createTelemetryPluginProxy(plugin, config, core) {
|
|
1561
|
+
var nextProxy = null;
|
|
1562
|
+
var hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1563
|
+
var hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1564
|
+
var chainId;
|
|
1565
|
+
if (plugin) {
|
|
1566
|
+
chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
|
|
1567
|
+
}
|
|
1568
|
+
else {
|
|
1569
|
+
chainId = "Unknown-0-" + _chainId++;
|
|
1570
|
+
}
|
|
1571
|
+
var proxyChain = {
|
|
1572
|
+
getPlugin: function () {
|
|
1573
|
+
return plugin;
|
|
1574
|
+
},
|
|
1575
|
+
getNext: function () {
|
|
1576
|
+
return nextProxy;
|
|
1577
|
+
},
|
|
1578
|
+
processTelemetry: _processTelemetry,
|
|
1579
|
+
unload: _unloadPlugin,
|
|
1580
|
+
update: _updatePlugin,
|
|
1581
|
+
_id: chainId,
|
|
1582
|
+
_setNext: function (nextPlugin) {
|
|
1583
|
+
nextProxy = nextPlugin;
|
|
1252
1584
|
}
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1585
|
+
};
|
|
1586
|
+
function _getTelCtx() {
|
|
1587
|
+
var itemCtx;
|
|
1588
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1589
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
1590
|
+
}
|
|
1591
|
+
if (!itemCtx) {
|
|
1592
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1593
|
+
}
|
|
1594
|
+
return itemCtx;
|
|
1595
|
+
}
|
|
1596
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
1597
|
+
var hasRun = false;
|
|
1598
|
+
var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
1599
|
+
var hasRunContext = itemCtx[strHasRunFlags];
|
|
1600
|
+
if (!hasRunContext) {
|
|
1601
|
+
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1602
|
+
}
|
|
1603
|
+
itemCtx.setNext(nextProxy);
|
|
1604
|
+
if (plugin) {
|
|
1605
|
+
doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
|
|
1606
|
+
hasRunContext[chainId] = true;
|
|
1607
|
+
try {
|
|
1608
|
+
var nextId = nextProxy ? nextProxy._id : strEmpty$1;
|
|
1609
|
+
if (nextId) {
|
|
1610
|
+
hasRunContext[nextId] = false;
|
|
1611
|
+
}
|
|
1612
|
+
hasRun = processPluginFn(itemCtx);
|
|
1613
|
+
}
|
|
1614
|
+
catch (error) {
|
|
1615
|
+
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
1616
|
+
if (hasNextRun) {
|
|
1617
|
+
hasRun = true;
|
|
1618
|
+
}
|
|
1619
|
+
if (!nextProxy || !hasNextRun) {
|
|
1620
|
+
_throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1621
|
+
}
|
|
1269
1622
|
}
|
|
1623
|
+
}, details, isAsync);
|
|
1624
|
+
}
|
|
1625
|
+
return hasRun;
|
|
1626
|
+
}
|
|
1627
|
+
function _processTelemetry(env, itemCtx) {
|
|
1628
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
1629
|
+
function _callProcessTelemetry(itemCtx) {
|
|
1630
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
1631
|
+
return false;
|
|
1270
1632
|
}
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
if (defaultValue === void 0) { defaultValue = false; }
|
|
1275
|
-
var theValue;
|
|
1276
|
-
var extConfig = _self.getExtCfg(identifier, null);
|
|
1277
|
-
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1278
|
-
theValue = extConfig[field];
|
|
1633
|
+
var pluginState = _getPluginState(plugin);
|
|
1634
|
+
if (pluginState[strTeardown] || pluginState[strDisabled]) {
|
|
1635
|
+
return false;
|
|
1279
1636
|
}
|
|
1280
|
-
|
|
1281
|
-
|
|
1637
|
+
if (hasSetNext) {
|
|
1638
|
+
plugin.setNextPlugin(nextProxy);
|
|
1282
1639
|
}
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1640
|
+
plugin.processTelemetry(env, itemCtx);
|
|
1641
|
+
return true;
|
|
1642
|
+
}
|
|
1643
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
1644
|
+
itemCtx.processNext(env);
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
1648
|
+
function _callTeardown() {
|
|
1649
|
+
var hasRun = false;
|
|
1650
|
+
if (plugin) {
|
|
1651
|
+
var pluginState = _getPluginState(plugin);
|
|
1652
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1653
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1654
|
+
pluginState[strCore] = null;
|
|
1655
|
+
pluginState[strTeardown] = true;
|
|
1656
|
+
pluginState[strIsInitialized] = false;
|
|
1657
|
+
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1658
|
+
hasRun = true;
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
return hasRun;
|
|
1663
|
+
}
|
|
1664
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
|
|
1665
|
+
unloadCtx.processNext(unloadState);
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
function _updatePlugin(updateCtx, updateState) {
|
|
1669
|
+
function _callUpdate() {
|
|
1670
|
+
var hasRun = false;
|
|
1671
|
+
if (plugin) {
|
|
1672
|
+
var pluginState = _getPluginState(plugin);
|
|
1673
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1674
|
+
if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1675
|
+
if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
|
|
1676
|
+
hasRun = true;
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1299
1679
|
}
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
}
|
|
1680
|
+
return hasRun;
|
|
1681
|
+
}
|
|
1682
|
+
if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
|
|
1683
|
+
updateCtx.processNext(updateState);
|
|
1684
|
+
}
|
|
1305
1685
|
}
|
|
1306
|
-
return
|
|
1307
|
-
}
|
|
1686
|
+
return objFreeze(proxyChain);
|
|
1687
|
+
}
|
|
1308
1688
|
|
|
1309
1689
|
var strExtensionConfig = "extensionConfig";
|
|
1310
1690
|
|
|
1691
|
+
function createUnloadHandlerContainer() {
|
|
1692
|
+
var handlers = [];
|
|
1693
|
+
function _addHandler(handler) {
|
|
1694
|
+
if (handler) {
|
|
1695
|
+
handlers.push(handler);
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
function _runHandlers(unloadCtx, unloadState) {
|
|
1699
|
+
arrForEach(handlers, function (handler) {
|
|
1700
|
+
try {
|
|
1701
|
+
handler(unloadCtx, unloadState);
|
|
1702
|
+
}
|
|
1703
|
+
catch (e) {
|
|
1704
|
+
_throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
1705
|
+
}
|
|
1706
|
+
});
|
|
1707
|
+
handlers = [];
|
|
1708
|
+
}
|
|
1709
|
+
return {
|
|
1710
|
+
add: _addHandler,
|
|
1711
|
+
run: _runHandlers
|
|
1712
|
+
};
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1311
1715
|
var strGetPlugin = "getPlugin";
|
|
1312
1716
|
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
1313
1717
|
function BaseTelemetryPlugin() {
|
|
1314
1718
|
var _self = this;
|
|
1315
|
-
var _isinitialized
|
|
1316
|
-
var _rootCtx
|
|
1317
|
-
var _nextPlugin
|
|
1318
|
-
|
|
1719
|
+
var _isinitialized;
|
|
1720
|
+
var _rootCtx;
|
|
1721
|
+
var _nextPlugin;
|
|
1722
|
+
var _unloadHandlerContainer;
|
|
1723
|
+
var _hooks;
|
|
1724
|
+
_initDefaults();
|
|
1725
|
+
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
1726
|
+
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
1727
|
+
_setDefaults(config, core, pluginChain);
|
|
1728
|
+
_isinitialized = true;
|
|
1729
|
+
};
|
|
1730
|
+
_self.teardown = function (unloadCtx, unloadState) {
|
|
1731
|
+
if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
|
|
1732
|
+
return;
|
|
1733
|
+
}
|
|
1734
|
+
var result;
|
|
1735
|
+
var unloadDone = false;
|
|
1736
|
+
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1737
|
+
var theUnloadState = unloadState || {
|
|
1738
|
+
reason: 0 ,
|
|
1739
|
+
isAsync: false
|
|
1740
|
+
};
|
|
1741
|
+
function _unloadCallback() {
|
|
1742
|
+
if (!unloadDone) {
|
|
1743
|
+
unloadDone = true;
|
|
1744
|
+
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
1745
|
+
arrForEach(_hooks, function (fn) {
|
|
1746
|
+
fn.rm();
|
|
1747
|
+
});
|
|
1748
|
+
_hooks = [];
|
|
1749
|
+
if (result === true) {
|
|
1750
|
+
theUnloadCtx.processNext(theUnloadState);
|
|
1751
|
+
}
|
|
1752
|
+
_initDefaults();
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
1756
|
+
_unloadCallback();
|
|
1757
|
+
}
|
|
1758
|
+
else {
|
|
1759
|
+
result = true;
|
|
1760
|
+
}
|
|
1761
|
+
return result;
|
|
1762
|
+
};
|
|
1763
|
+
_self.update = function (updateCtx, updateState) {
|
|
1764
|
+
if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
|
|
1765
|
+
return;
|
|
1766
|
+
}
|
|
1767
|
+
var result;
|
|
1768
|
+
var updateDone = false;
|
|
1769
|
+
var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1770
|
+
var theUpdateState = updateState || {
|
|
1771
|
+
reason: 0
|
|
1772
|
+
};
|
|
1773
|
+
function _updateCallback() {
|
|
1774
|
+
if (!updateDone) {
|
|
1775
|
+
updateDone = true;
|
|
1776
|
+
_setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
|
|
1780
|
+
_updateCallback();
|
|
1781
|
+
}
|
|
1782
|
+
else {
|
|
1783
|
+
result = true;
|
|
1784
|
+
}
|
|
1785
|
+
return result;
|
|
1786
|
+
};
|
|
1787
|
+
_self._addHook = function (hooks) {
|
|
1788
|
+
if (hooks) {
|
|
1789
|
+
if (isArray(hooks)) {
|
|
1790
|
+
_hooks = _hooks.concat(hooks);
|
|
1791
|
+
}
|
|
1792
|
+
else {
|
|
1793
|
+
_hooks.push(hooks);
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
};
|
|
1797
|
+
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
1798
|
+
});
|
|
1319
1799
|
_self.diagLog = function (itemCtx) {
|
|
1320
|
-
return
|
|
1800
|
+
return _getTelCtx(itemCtx).diagLog();
|
|
1321
1801
|
};
|
|
1322
|
-
_self
|
|
1802
|
+
_self[strIsInitialized] = function () {
|
|
1323
1803
|
return _isinitialized;
|
|
1324
1804
|
};
|
|
1325
1805
|
_self.setInitialized = function (isInitialized) {
|
|
1326
1806
|
_isinitialized = isInitialized;
|
|
1327
1807
|
};
|
|
1328
|
-
_self
|
|
1808
|
+
_self[strSetNextPlugin] = function (next) {
|
|
1329
1809
|
_nextPlugin = next;
|
|
1330
1810
|
};
|
|
1331
1811
|
_self.processNext = function (env, itemCtx) {
|
|
@@ -1336,11 +1816,12 @@
|
|
|
1336
1816
|
_nextPlugin.processTelemetry(env, null);
|
|
1337
1817
|
}
|
|
1338
1818
|
};
|
|
1339
|
-
_self._getTelCtx =
|
|
1819
|
+
_self._getTelCtx = _getTelCtx;
|
|
1820
|
+
function _getTelCtx(currentCtx) {
|
|
1340
1821
|
if (currentCtx === void 0) { currentCtx = null; }
|
|
1341
1822
|
var itemCtx = currentCtx;
|
|
1342
1823
|
if (!itemCtx) {
|
|
1343
|
-
var rootCtx = _rootCtx ||
|
|
1824
|
+
var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
|
|
1344
1825
|
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1345
1826
|
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
1346
1827
|
}
|
|
@@ -1349,8 +1830,8 @@
|
|
|
1349
1830
|
}
|
|
1350
1831
|
}
|
|
1351
1832
|
return itemCtx;
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1833
|
+
}
|
|
1834
|
+
function _setDefaults(config, core, pluginChain) {
|
|
1354
1835
|
if (config) {
|
|
1355
1836
|
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
1356
1837
|
}
|
|
@@ -1362,16 +1843,280 @@
|
|
|
1362
1843
|
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
1363
1844
|
}
|
|
1364
1845
|
_self.core = core;
|
|
1365
|
-
_rootCtx =
|
|
1366
|
-
|
|
1367
|
-
|
|
1846
|
+
_rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
1847
|
+
}
|
|
1848
|
+
function _initDefaults() {
|
|
1849
|
+
_isinitialized = false;
|
|
1850
|
+
_self.core = null;
|
|
1851
|
+
_rootCtx = null;
|
|
1852
|
+
_nextPlugin = null;
|
|
1853
|
+
_hooks = [];
|
|
1854
|
+
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
1855
|
+
}
|
|
1368
1856
|
}
|
|
1369
|
-
BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
|
|
1370
|
-
this._baseTelInit(config, core, extensions, pluginChain);
|
|
1371
|
-
};
|
|
1372
1857
|
return BaseTelemetryPlugin;
|
|
1373
1858
|
}());
|
|
1374
1859
|
|
|
1860
|
+
var strOnPrefix = "on";
|
|
1861
|
+
var strAttachEvent = "attachEvent";
|
|
1862
|
+
var strAddEventHelper = "addEventListener";
|
|
1863
|
+
var strDetachEvent = "detachEvent";
|
|
1864
|
+
var strRemoveEventListener = "removeEventListener";
|
|
1865
|
+
var strEvents = "events";
|
|
1866
|
+
createUniqueNamespace("aiEvtPageHide");
|
|
1867
|
+
createUniqueNamespace("aiEvtPageShow");
|
|
1868
|
+
var rRemoveEmptyNs = /\.[\.]+/g;
|
|
1869
|
+
var rRemoveTrailingEmptyNs = /[\.]+$/;
|
|
1870
|
+
var _guid = 1;
|
|
1871
|
+
var elmNodeData = createElmNodeData("events");
|
|
1872
|
+
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
1873
|
+
function _normalizeNamespace(name) {
|
|
1874
|
+
if (name && name.replace) {
|
|
1875
|
+
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
1876
|
+
}
|
|
1877
|
+
return name;
|
|
1878
|
+
}
|
|
1879
|
+
function _getEvtNamespace(eventName, evtNamespace) {
|
|
1880
|
+
if (evtNamespace) {
|
|
1881
|
+
var theNamespace_1 = "";
|
|
1882
|
+
if (isArray(evtNamespace)) {
|
|
1883
|
+
theNamespace_1 = "";
|
|
1884
|
+
arrForEach(evtNamespace, function (name) {
|
|
1885
|
+
name = _normalizeNamespace(name);
|
|
1886
|
+
if (name) {
|
|
1887
|
+
if (name[0] !== ".") {
|
|
1888
|
+
name = "." + name;
|
|
1889
|
+
}
|
|
1890
|
+
theNamespace_1 += name;
|
|
1891
|
+
}
|
|
1892
|
+
});
|
|
1893
|
+
}
|
|
1894
|
+
else {
|
|
1895
|
+
theNamespace_1 = _normalizeNamespace(evtNamespace);
|
|
1896
|
+
}
|
|
1897
|
+
if (theNamespace_1) {
|
|
1898
|
+
if (theNamespace_1[0] !== ".") {
|
|
1899
|
+
theNamespace_1 = "." + theNamespace_1;
|
|
1900
|
+
}
|
|
1901
|
+
eventName = (eventName || "") + theNamespace_1;
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
var parsedEvent = (eventNamespace.exec(eventName || "") || []);
|
|
1905
|
+
return {
|
|
1906
|
+
type: parsedEvent[1],
|
|
1907
|
+
ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
|
|
1908
|
+
};
|
|
1909
|
+
}
|
|
1910
|
+
function _getRegisteredEvents(target, evtName, addDefault) {
|
|
1911
|
+
if (addDefault === void 0) { addDefault = true; }
|
|
1912
|
+
var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
|
|
1913
|
+
var registeredEvents = aiEvts[evtName];
|
|
1914
|
+
if (!registeredEvents) {
|
|
1915
|
+
registeredEvents = aiEvts[evtName] = [];
|
|
1916
|
+
}
|
|
1917
|
+
return registeredEvents;
|
|
1918
|
+
}
|
|
1919
|
+
function _doDetach(obj, evtName, handlerRef, useCapture) {
|
|
1920
|
+
if (obj && evtName && evtName.type) {
|
|
1921
|
+
if (obj[strRemoveEventListener]) {
|
|
1922
|
+
obj[strRemoveEventListener](evtName.type, handlerRef, useCapture);
|
|
1923
|
+
}
|
|
1924
|
+
else if (obj[strDetachEvent]) {
|
|
1925
|
+
obj[strDetachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
function _doAttach(obj, evtName, handlerRef, useCapture) {
|
|
1930
|
+
var result = false;
|
|
1931
|
+
if (obj && evtName && evtName.type && handlerRef) {
|
|
1932
|
+
if (obj[strAddEventHelper]) {
|
|
1933
|
+
obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
|
|
1934
|
+
result = true;
|
|
1935
|
+
}
|
|
1936
|
+
else if (obj[strAttachEvent]) {
|
|
1937
|
+
obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
1938
|
+
result = true;
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
return result;
|
|
1942
|
+
}
|
|
1943
|
+
function _doUnregister(target, events, evtName, unRegFn) {
|
|
1944
|
+
var idx = events.length;
|
|
1945
|
+
while (idx--) {
|
|
1946
|
+
var theEvent = events[idx];
|
|
1947
|
+
if (theEvent) {
|
|
1948
|
+
if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {
|
|
1949
|
+
if (!unRegFn || unRegFn(theEvent)) {
|
|
1950
|
+
_doDetach(target, theEvent.evtName, theEvent.handler, theEvent.capture);
|
|
1951
|
+
events.splice(idx, 1);
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
function _unregisterEvents(target, evtName, unRegFn) {
|
|
1958
|
+
if (evtName.type) {
|
|
1959
|
+
_doUnregister(target, _getRegisteredEvents(target, evtName.type), evtName, unRegFn);
|
|
1960
|
+
}
|
|
1961
|
+
else {
|
|
1962
|
+
var eventCache = elmNodeData.get(target, strEvents, {});
|
|
1963
|
+
objForEachKey(eventCache, function (evtType, events) {
|
|
1964
|
+
_doUnregister(target, events, evtName, unRegFn);
|
|
1965
|
+
});
|
|
1966
|
+
if (objKeys(eventCache).length === 0) {
|
|
1967
|
+
elmNodeData.kill(target, strEvents);
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
function mergeEvtNamespace(theNamespace, namespaces) {
|
|
1972
|
+
var newNamespaces;
|
|
1973
|
+
if (namespaces) {
|
|
1974
|
+
if (isArray(namespaces)) {
|
|
1975
|
+
newNamespaces = [theNamespace].concat(namespaces);
|
|
1976
|
+
}
|
|
1977
|
+
else {
|
|
1978
|
+
newNamespaces = [theNamespace, namespaces];
|
|
1979
|
+
}
|
|
1980
|
+
newNamespaces = (_getEvtNamespace("xx", newNamespaces).ns).split(".");
|
|
1981
|
+
}
|
|
1982
|
+
else {
|
|
1983
|
+
newNamespaces = theNamespace;
|
|
1984
|
+
}
|
|
1985
|
+
return newNamespaces;
|
|
1986
|
+
}
|
|
1987
|
+
function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
1988
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
1989
|
+
var result = false;
|
|
1990
|
+
if (target) {
|
|
1991
|
+
try {
|
|
1992
|
+
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
1993
|
+
result = _doAttach(target, evtName, handlerRef, useCapture);
|
|
1994
|
+
if (result && elmNodeData.accept(target)) {
|
|
1995
|
+
var registeredEvent = {
|
|
1996
|
+
guid: _guid++,
|
|
1997
|
+
evtName: evtName,
|
|
1998
|
+
handler: handlerRef,
|
|
1999
|
+
capture: useCapture
|
|
2000
|
+
};
|
|
2001
|
+
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
catch (e) {
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
return result;
|
|
2008
|
+
}
|
|
2009
|
+
function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
2010
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
2011
|
+
if (target) {
|
|
2012
|
+
try {
|
|
2013
|
+
var evtName_1 = _getEvtNamespace(eventName, evtNamespace);
|
|
2014
|
+
var found_1 = false;
|
|
2015
|
+
_unregisterEvents(target, evtName_1, function (regEvent) {
|
|
2016
|
+
if ((evtName_1.ns && !handlerRef) || regEvent.handler === handlerRef) {
|
|
2017
|
+
found_1 = true;
|
|
2018
|
+
return true;
|
|
2019
|
+
}
|
|
2020
|
+
return false;
|
|
2021
|
+
});
|
|
2022
|
+
if (!found_1) {
|
|
2023
|
+
_doDetach(target, evtName_1, handlerRef, useCapture);
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
catch (e) {
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2031
|
+
var LoggingSeverity = createEnumStyle({
|
|
2032
|
+
CRITICAL: 1 ,
|
|
2033
|
+
WARNING: 2
|
|
2034
|
+
});
|
|
2035
|
+
var _InternalMessageId = createEnumStyle({
|
|
2036
|
+
BrowserDoesNotSupportLocalStorage: 0 ,
|
|
2037
|
+
BrowserCannotReadLocalStorage: 1 ,
|
|
2038
|
+
BrowserCannotReadSessionStorage: 2 ,
|
|
2039
|
+
BrowserCannotWriteLocalStorage: 3 ,
|
|
2040
|
+
BrowserCannotWriteSessionStorage: 4 ,
|
|
2041
|
+
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
2042
|
+
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
2043
|
+
CannotSendEmptyTelemetry: 7 ,
|
|
2044
|
+
ClientPerformanceMathError: 8 ,
|
|
2045
|
+
ErrorParsingAISessionCookie: 9 ,
|
|
2046
|
+
ErrorPVCalc: 10 ,
|
|
2047
|
+
ExceptionWhileLoggingError: 11 ,
|
|
2048
|
+
FailedAddingTelemetryToBuffer: 12 ,
|
|
2049
|
+
FailedMonitorAjaxAbort: 13 ,
|
|
2050
|
+
FailedMonitorAjaxDur: 14 ,
|
|
2051
|
+
FailedMonitorAjaxOpen: 15 ,
|
|
2052
|
+
FailedMonitorAjaxRSC: 16 ,
|
|
2053
|
+
FailedMonitorAjaxSend: 17 ,
|
|
2054
|
+
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
2055
|
+
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
2056
|
+
FailedToSendQueuedTelemetry: 20 ,
|
|
2057
|
+
FailedToReportDataLoss: 21 ,
|
|
2058
|
+
FlushFailed: 22 ,
|
|
2059
|
+
MessageLimitPerPVExceeded: 23 ,
|
|
2060
|
+
MissingRequiredFieldSpecification: 24 ,
|
|
2061
|
+
NavigationTimingNotSupported: 25 ,
|
|
2062
|
+
OnError: 26 ,
|
|
2063
|
+
SessionRenewalDateIsZero: 27 ,
|
|
2064
|
+
SenderNotInitialized: 28 ,
|
|
2065
|
+
StartTrackEventFailed: 29 ,
|
|
2066
|
+
StopTrackEventFailed: 30 ,
|
|
2067
|
+
StartTrackFailed: 31 ,
|
|
2068
|
+
StopTrackFailed: 32 ,
|
|
2069
|
+
TelemetrySampledAndNotSent: 33 ,
|
|
2070
|
+
TrackEventFailed: 34 ,
|
|
2071
|
+
TrackExceptionFailed: 35 ,
|
|
2072
|
+
TrackMetricFailed: 36 ,
|
|
2073
|
+
TrackPVFailed: 37 ,
|
|
2074
|
+
TrackPVFailedCalc: 38 ,
|
|
2075
|
+
TrackTraceFailed: 39 ,
|
|
2076
|
+
TransmissionFailed: 40 ,
|
|
2077
|
+
FailedToSetStorageBuffer: 41 ,
|
|
2078
|
+
FailedToRestoreStorageBuffer: 42 ,
|
|
2079
|
+
InvalidBackendResponse: 43 ,
|
|
2080
|
+
FailedToFixDepricatedValues: 44 ,
|
|
2081
|
+
InvalidDurationValue: 45 ,
|
|
2082
|
+
TelemetryEnvelopeInvalid: 46 ,
|
|
2083
|
+
CreateEnvelopeError: 47 ,
|
|
2084
|
+
CannotSerializeObject: 48 ,
|
|
2085
|
+
CannotSerializeObjectNonSerializable: 49 ,
|
|
2086
|
+
CircularReferenceDetected: 50 ,
|
|
2087
|
+
ClearAuthContextFailed: 51 ,
|
|
2088
|
+
ExceptionTruncated: 52 ,
|
|
2089
|
+
IllegalCharsInName: 53 ,
|
|
2090
|
+
ItemNotInArray: 54 ,
|
|
2091
|
+
MaxAjaxPerPVExceeded: 55 ,
|
|
2092
|
+
MessageTruncated: 56 ,
|
|
2093
|
+
NameTooLong: 57 ,
|
|
2094
|
+
SampleRateOutOfRange: 58 ,
|
|
2095
|
+
SetAuthContextFailed: 59 ,
|
|
2096
|
+
SetAuthContextFailedAccountName: 60 ,
|
|
2097
|
+
StringValueTooLong: 61 ,
|
|
2098
|
+
StartCalledMoreThanOnce: 62 ,
|
|
2099
|
+
StopCalledWithoutStart: 63 ,
|
|
2100
|
+
TelemetryInitializerFailed: 64 ,
|
|
2101
|
+
TrackArgumentsNotSpecified: 65 ,
|
|
2102
|
+
UrlTooLong: 66 ,
|
|
2103
|
+
SessionStorageBufferFull: 67 ,
|
|
2104
|
+
CannotAccessCookie: 68 ,
|
|
2105
|
+
IdTooLong: 69 ,
|
|
2106
|
+
InvalidEvent: 70 ,
|
|
2107
|
+
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
2108
|
+
SendBrowserInfoOnUserInit: 72 ,
|
|
2109
|
+
PluginException: 73 ,
|
|
2110
|
+
NotificationException: 74 ,
|
|
2111
|
+
SnippetScriptLoadFailure: 99 ,
|
|
2112
|
+
InvalidInstrumentationKey: 100 ,
|
|
2113
|
+
CannotParseAiBlobValue: 101 ,
|
|
2114
|
+
InvalidContentBlob: 102 ,
|
|
2115
|
+
TrackPageActionEventFailed: 103 ,
|
|
2116
|
+
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
2117
|
+
InMemoryStorageBufferFull: 105
|
|
2118
|
+
});
|
|
2119
|
+
|
|
1375
2120
|
var RequestHeaders = {
|
|
1376
2121
|
requestContextHeader: "Request-Context",
|
|
1377
2122
|
requestContextTargetKey: "appId",
|
|
@@ -1404,7 +2149,7 @@
|
|
|
1404
2149
|
name = strTrim(name.toString());
|
|
1405
2150
|
if (name.length > 150 ) {
|
|
1406
2151
|
nameTrunc = name.substring(0, 150 );
|
|
1407
|
-
logger
|
|
2152
|
+
_throwInternal(logger, 2 , 57 , "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
|
|
1408
2153
|
}
|
|
1409
2154
|
}
|
|
1410
2155
|
return nameTrunc || name;
|
|
@@ -1417,20 +2162,20 @@
|
|
|
1417
2162
|
value = strTrim(value);
|
|
1418
2163
|
if (value.toString().length > maxLength) {
|
|
1419
2164
|
valueTrunc = value.toString().substring(0, maxLength);
|
|
1420
|
-
logger
|
|
2165
|
+
_throwInternal(logger, 2 , 61 , "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
|
|
1421
2166
|
}
|
|
1422
2167
|
}
|
|
1423
2168
|
return valueTrunc || value;
|
|
1424
2169
|
}
|
|
1425
2170
|
function dataSanitizeUrl(logger, url) {
|
|
1426
|
-
return dataSanitizeInput(logger, url, 2048 ,
|
|
2171
|
+
return dataSanitizeInput(logger, url, 2048 , 66 );
|
|
1427
2172
|
}
|
|
1428
2173
|
function dataSanitizeMessage(logger, message) {
|
|
1429
2174
|
var messageTrunc;
|
|
1430
2175
|
if (message) {
|
|
1431
2176
|
if (message.length > 32768 ) {
|
|
1432
2177
|
messageTrunc = message.substring(0, 32768 );
|
|
1433
|
-
logger
|
|
2178
|
+
_throwInternal(logger, 2 , 56 , "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
|
|
1434
2179
|
}
|
|
1435
2180
|
}
|
|
1436
2181
|
return messageTrunc || message;
|
|
@@ -1441,7 +2186,7 @@
|
|
|
1441
2186
|
var value = "" + exception;
|
|
1442
2187
|
if (value.length > 32768 ) {
|
|
1443
2188
|
exceptionTrunc = value.substring(0, 32768 );
|
|
1444
|
-
logger
|
|
2189
|
+
_throwInternal(logger, 2 , 52 , "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
|
|
1445
2190
|
}
|
|
1446
2191
|
}
|
|
1447
2192
|
return exceptionTrunc || exception;
|
|
@@ -1455,7 +2200,7 @@
|
|
|
1455
2200
|
value = getJSON().stringify(value);
|
|
1456
2201
|
}
|
|
1457
2202
|
catch (e) {
|
|
1458
|
-
logger
|
|
2203
|
+
_throwInternal(logger, 2 , 49 , "custom property is not valid", { exception: e }, true);
|
|
1459
2204
|
}
|
|
1460
2205
|
}
|
|
1461
2206
|
value = dataSanitizeString(logger, value, 8192 );
|
|
@@ -1478,7 +2223,7 @@
|
|
|
1478
2223
|
return measurements;
|
|
1479
2224
|
}
|
|
1480
2225
|
function dataSanitizeId(logger, id) {
|
|
1481
|
-
return id ? dataSanitizeInput(logger, id, 128 ,
|
|
2226
|
+
return id ? dataSanitizeInput(logger, id, 128 , 69 ).toString() : id;
|
|
1482
2227
|
}
|
|
1483
2228
|
function dataSanitizeInput(logger, input, maxLength, _msgId) {
|
|
1484
2229
|
var inputTrunc;
|
|
@@ -1486,7 +2231,7 @@
|
|
|
1486
2231
|
input = strTrim(input);
|
|
1487
2232
|
if (input.length > maxLength) {
|
|
1488
2233
|
inputTrunc = input.substring(0, maxLength);
|
|
1489
|
-
logger
|
|
2234
|
+
_throwInternal(logger, 2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
|
|
1490
2235
|
}
|
|
1491
2236
|
}
|
|
1492
2237
|
return inputTrunc || input;
|
|
@@ -1496,21 +2241,22 @@
|
|
|
1496
2241
|
return s.substr(s.length - 3);
|
|
1497
2242
|
}
|
|
1498
2243
|
|
|
2244
|
+
var strEmpty = "";
|
|
1499
2245
|
function msToTimeSpan(totalms) {
|
|
1500
2246
|
if (isNaN(totalms) || totalms < 0) {
|
|
1501
2247
|
totalms = 0;
|
|
1502
2248
|
}
|
|
1503
2249
|
totalms = Math.round(totalms);
|
|
1504
|
-
var ms =
|
|
1505
|
-
var sec =
|
|
1506
|
-
var min =
|
|
1507
|
-
var hour =
|
|
2250
|
+
var ms = strEmpty + totalms % 1000;
|
|
2251
|
+
var sec = strEmpty + Math.floor(totalms / 1000) % 60;
|
|
2252
|
+
var min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;
|
|
2253
|
+
var hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;
|
|
1508
2254
|
var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
|
|
1509
2255
|
ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
|
|
1510
2256
|
sec = sec.length < 2 ? "0" + sec : sec;
|
|
1511
2257
|
min = min.length < 2 ? "0" + min : min;
|
|
1512
2258
|
hour = hour.length < 2 ? "0" + hour : hour;
|
|
1513
|
-
return (days > 0 ? days + "." :
|
|
2259
|
+
return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
|
|
1514
2260
|
}
|
|
1515
2261
|
|
|
1516
2262
|
var DisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
|
|
@@ -1519,17 +2265,15 @@
|
|
|
1519
2265
|
var HttpMethod = "http.method";
|
|
1520
2266
|
var strNotSpecified = "not_specified";
|
|
1521
2267
|
|
|
1522
|
-
var StorageType
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
DistributedTracingModes[DistributedTracingModes["W3C"] = 2] = "W3C";
|
|
1532
|
-
})(DistributedTracingModes || (DistributedTracingModes = {}));
|
|
2268
|
+
var StorageType = createEnumStyle({
|
|
2269
|
+
LocalStorage: 0 ,
|
|
2270
|
+
SessionStorage: 1
|
|
2271
|
+
});
|
|
2272
|
+
createEnumStyle({
|
|
2273
|
+
AI: 0 ,
|
|
2274
|
+
AI_AND_W3C: 1 ,
|
|
2275
|
+
W3C: 2
|
|
2276
|
+
});
|
|
1533
2277
|
|
|
1534
2278
|
var _canUseSessionStorage = undefined;
|
|
1535
2279
|
function _getVerifiedStorageObject(storageType) {
|
|
@@ -1556,8 +2300,8 @@
|
|
|
1556
2300
|
}
|
|
1557
2301
|
return null;
|
|
1558
2302
|
}
|
|
1559
|
-
function utlCanUseSessionStorage() {
|
|
1560
|
-
if (_canUseSessionStorage === undefined) {
|
|
2303
|
+
function utlCanUseSessionStorage(reset) {
|
|
2304
|
+
if (reset || _canUseSessionStorage === undefined) {
|
|
1561
2305
|
_canUseSessionStorage = !!_getVerifiedStorageObject(StorageType.SessionStorage);
|
|
1562
2306
|
}
|
|
1563
2307
|
return _canUseSessionStorage;
|
|
@@ -1570,7 +2314,7 @@
|
|
|
1570
2314
|
}
|
|
1571
2315
|
catch (e) {
|
|
1572
2316
|
_canUseSessionStorage = false;
|
|
1573
|
-
logger
|
|
2317
|
+
_throwInternal(logger, 2 , 2 , "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1574
2318
|
}
|
|
1575
2319
|
}
|
|
1576
2320
|
return null;
|
|
@@ -1584,7 +2328,7 @@
|
|
|
1584
2328
|
}
|
|
1585
2329
|
catch (e) {
|
|
1586
2330
|
_canUseSessionStorage = false;
|
|
1587
|
-
logger
|
|
2331
|
+
_throwInternal(logger, 2 , 4 , "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1588
2332
|
}
|
|
1589
2333
|
}
|
|
1590
2334
|
return false;
|
|
@@ -1681,37 +2425,17 @@
|
|
|
1681
2425
|
};
|
|
1682
2426
|
}
|
|
1683
2427
|
|
|
1684
|
-
var
|
|
1685
|
-
function Base() {
|
|
1686
|
-
}
|
|
1687
|
-
return Base;
|
|
1688
|
-
}());
|
|
1689
|
-
|
|
1690
|
-
var Data$1 = /** @class */ (function (_super) {
|
|
1691
|
-
__extendsFn(Data, _super);
|
|
1692
|
-
function Data() {
|
|
1693
|
-
return _super.call(this) || this;
|
|
1694
|
-
}
|
|
1695
|
-
return Data;
|
|
1696
|
-
}(Base));
|
|
1697
|
-
|
|
1698
|
-
var Envelope$1 = /** @class */ (function () {
|
|
1699
|
-
function Envelope() {
|
|
1700
|
-
this.ver = 1;
|
|
1701
|
-
this.sampleRate = 100.0;
|
|
1702
|
-
this.tags = {};
|
|
1703
|
-
}
|
|
1704
|
-
return Envelope;
|
|
1705
|
-
}());
|
|
1706
|
-
|
|
1707
|
-
var Envelope = /** @class */ (function (_super) {
|
|
1708
|
-
__extendsFn(Envelope, _super);
|
|
2428
|
+
var Envelope = /** @class */ (function () {
|
|
1709
2429
|
function Envelope(logger, data, name) {
|
|
1710
|
-
var _this =
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
2430
|
+
var _this = this;
|
|
2431
|
+
var _self = this;
|
|
2432
|
+
_self.ver = 1;
|
|
2433
|
+
_self.sampleRate = 100.0;
|
|
2434
|
+
_self.tags = {};
|
|
2435
|
+
_self.name = dataSanitizeString(logger, name) || strNotSpecified;
|
|
2436
|
+
_self.data = data;
|
|
2437
|
+
_self.time = toISOString(new Date());
|
|
2438
|
+
_self.aiDataContract = {
|
|
1715
2439
|
time: 1 ,
|
|
1716
2440
|
iKey: 1 ,
|
|
1717
2441
|
name: 1 ,
|
|
@@ -1721,62 +2445,27 @@
|
|
|
1721
2445
|
tags: 1 ,
|
|
1722
2446
|
data: 1
|
|
1723
2447
|
};
|
|
1724
|
-
return _this;
|
|
1725
2448
|
}
|
|
1726
2449
|
return Envelope;
|
|
1727
|
-
}(Envelope$1));
|
|
1728
|
-
|
|
1729
|
-
var EventData = /** @class */ (function () {
|
|
1730
|
-
function EventData() {
|
|
1731
|
-
this.ver = 2;
|
|
1732
|
-
this.properties = {};
|
|
1733
|
-
this.measurements = {};
|
|
1734
|
-
}
|
|
1735
|
-
return EventData;
|
|
1736
2450
|
}());
|
|
1737
2451
|
|
|
1738
|
-
var Event = /** @class */ (function (
|
|
1739
|
-
__extendsFn(Event, _super);
|
|
2452
|
+
var Event = /** @class */ (function () {
|
|
1740
2453
|
function Event(logger, name, properties, measurements) {
|
|
1741
|
-
|
|
1742
|
-
_this.aiDataContract = {
|
|
2454
|
+
this.aiDataContract = {
|
|
1743
2455
|
ver: 1 ,
|
|
1744
2456
|
name: 1 ,
|
|
1745
2457
|
properties: 0 ,
|
|
1746
2458
|
measurements: 0
|
|
1747
2459
|
};
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
2460
|
+
var _self = this;
|
|
2461
|
+
_self.ver = 2;
|
|
2462
|
+
_self.name = dataSanitizeString(logger, name) || strNotSpecified;
|
|
2463
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
2464
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
1752
2465
|
}
|
|
1753
2466
|
Event.envelopeType = "Microsoft.ApplicationInsights.{0}.Event";
|
|
1754
2467
|
Event.dataType = "EventData";
|
|
1755
2468
|
return Event;
|
|
1756
|
-
}(EventData));
|
|
1757
|
-
|
|
1758
|
-
var StackFrame = /** @class */ (function () {
|
|
1759
|
-
function StackFrame() {
|
|
1760
|
-
}
|
|
1761
|
-
return StackFrame;
|
|
1762
|
-
}());
|
|
1763
|
-
|
|
1764
|
-
var ExceptionData = /** @class */ (function () {
|
|
1765
|
-
function ExceptionData() {
|
|
1766
|
-
this.ver = 2;
|
|
1767
|
-
this.exceptions = [];
|
|
1768
|
-
this.properties = {};
|
|
1769
|
-
this.measurements = {};
|
|
1770
|
-
}
|
|
1771
|
-
return ExceptionData;
|
|
1772
|
-
}());
|
|
1773
|
-
|
|
1774
|
-
var ExceptionDetails = /** @class */ (function () {
|
|
1775
|
-
function ExceptionDetails() {
|
|
1776
|
-
this.hasFullStack = true;
|
|
1777
|
-
this.parsedStack = [];
|
|
1778
|
-
}
|
|
1779
|
-
return ExceptionDetails;
|
|
1780
2469
|
}());
|
|
1781
2470
|
|
|
1782
2471
|
var NoMethod = "<no_method>";
|
|
@@ -2020,50 +2709,48 @@
|
|
|
2020
2709
|
}
|
|
2021
2710
|
return "" + (errorObj || "");
|
|
2022
2711
|
}
|
|
2023
|
-
var Exception = /** @class */ (function (
|
|
2024
|
-
__extendsFn(Exception, _super);
|
|
2712
|
+
var Exception = /** @class */ (function () {
|
|
2025
2713
|
function Exception(logger, exception, properties, measurements, severityLevel, id) {
|
|
2026
|
-
|
|
2027
|
-
_this.aiDataContract = {
|
|
2714
|
+
this.aiDataContract = {
|
|
2028
2715
|
ver: 1 ,
|
|
2029
2716
|
exceptions: 1 ,
|
|
2030
2717
|
severityLevel: 0 ,
|
|
2031
2718
|
properties: 0 ,
|
|
2032
2719
|
measurements: 0
|
|
2033
2720
|
};
|
|
2721
|
+
var _self = this;
|
|
2722
|
+
_self.ver = 2;
|
|
2034
2723
|
if (!_isExceptionInternal(exception)) {
|
|
2035
2724
|
if (!properties) {
|
|
2036
2725
|
properties = {};
|
|
2037
2726
|
}
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2727
|
+
_self.exceptions = [new _ExceptionDetails(logger, exception, properties)];
|
|
2728
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
2729
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
2041
2730
|
if (severityLevel) {
|
|
2042
|
-
|
|
2731
|
+
_self.severityLevel = severityLevel;
|
|
2043
2732
|
}
|
|
2044
2733
|
if (id) {
|
|
2045
|
-
|
|
2734
|
+
_self.id = id;
|
|
2046
2735
|
}
|
|
2047
2736
|
}
|
|
2048
2737
|
else {
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2738
|
+
_self.exceptions = exception.exceptions || [];
|
|
2739
|
+
_self.properties = exception.properties;
|
|
2740
|
+
_self.measurements = exception.measurements;
|
|
2052
2741
|
if (exception.severityLevel) {
|
|
2053
|
-
|
|
2742
|
+
_self.severityLevel = exception.severityLevel;
|
|
2054
2743
|
}
|
|
2055
2744
|
if (exception.id) {
|
|
2056
|
-
|
|
2745
|
+
_self.id = exception.id;
|
|
2057
2746
|
}
|
|
2058
2747
|
if (exception.problemGroup) {
|
|
2059
|
-
|
|
2748
|
+
_self.problemGroup = exception.problemGroup;
|
|
2060
2749
|
}
|
|
2061
|
-
_this.ver = 2;
|
|
2062
2750
|
if (!isNullOrUndefined(exception.isManual)) {
|
|
2063
|
-
|
|
2751
|
+
_self.isManual = exception.isManual;
|
|
2064
2752
|
}
|
|
2065
2753
|
}
|
|
2066
|
-
return _this;
|
|
2067
2754
|
}
|
|
2068
2755
|
Exception.CreateAutoException = function (message, url, lineNumber, columnNumber, error, evt, stack, errorSrc) {
|
|
2069
2756
|
var errorType = _getErrorType(error || evt || message);
|
|
@@ -2117,12 +2804,10 @@
|
|
|
2117
2804
|
Exception.dataType = "ExceptionData";
|
|
2118
2805
|
Exception.formatError = _formatErrorCode;
|
|
2119
2806
|
return Exception;
|
|
2120
|
-
}(
|
|
2121
|
-
var _ExceptionDetails = /** @class */ (function (
|
|
2122
|
-
__extendsFn(_ExceptionDetails, _super);
|
|
2807
|
+
}());
|
|
2808
|
+
var _ExceptionDetails = /** @class */ (function () {
|
|
2123
2809
|
function _ExceptionDetails(logger, exception, properties) {
|
|
2124
|
-
|
|
2125
|
-
_this.aiDataContract = {
|
|
2810
|
+
this.aiDataContract = {
|
|
2126
2811
|
id: 0 ,
|
|
2127
2812
|
outerId: 0 ,
|
|
2128
2813
|
typeName: 1 ,
|
|
@@ -2131,41 +2816,42 @@
|
|
|
2131
2816
|
stack: 0 ,
|
|
2132
2817
|
parsedStack: 2
|
|
2133
2818
|
};
|
|
2819
|
+
var _self = this;
|
|
2134
2820
|
if (!_isExceptionDetailsInternal(exception)) {
|
|
2135
2821
|
var error = exception;
|
|
2136
2822
|
var evt = error && error.evt;
|
|
2137
2823
|
if (!isError(error)) {
|
|
2138
2824
|
error = error[strError] || evt || error;
|
|
2139
2825
|
}
|
|
2140
|
-
|
|
2141
|
-
|
|
2826
|
+
_self.typeName = dataSanitizeString(logger, _getErrorType(error)) || strNotSpecified;
|
|
2827
|
+
_self.message = dataSanitizeMessage(logger, _formatMessage(exception || error, _self.typeName)) || strNotSpecified;
|
|
2142
2828
|
var stack = exception[strStackDetails] || _getStackFromErrorObj(exception);
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2829
|
+
_self.parsedStack = _parseStack(stack);
|
|
2830
|
+
_self[strStack] = dataSanitizeException(logger, _formatStackTrace(stack));
|
|
2831
|
+
_self.hasFullStack = isArray(_self.parsedStack) && _self.parsedStack.length > 0;
|
|
2146
2832
|
if (properties) {
|
|
2147
|
-
properties.typeName = properties.typeName ||
|
|
2833
|
+
properties.typeName = properties.typeName || _self.typeName;
|
|
2148
2834
|
}
|
|
2149
2835
|
}
|
|
2150
2836
|
else {
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2837
|
+
_self.typeName = exception.typeName;
|
|
2838
|
+
_self.message = exception.message;
|
|
2839
|
+
_self[strStack] = exception[strStack];
|
|
2840
|
+
_self.parsedStack = exception.parsedStack || [];
|
|
2841
|
+
_self.hasFullStack = exception.hasFullStack;
|
|
2156
2842
|
}
|
|
2157
|
-
return _this;
|
|
2158
2843
|
}
|
|
2159
2844
|
_ExceptionDetails.prototype.toInterface = function () {
|
|
2160
|
-
var
|
|
2161
|
-
|
|
2845
|
+
var _self = this;
|
|
2846
|
+
var parsedStack = _self.parsedStack instanceof Array
|
|
2847
|
+
&& arrMap(_self.parsedStack, function (frame) { return frame.toInterface(); });
|
|
2162
2848
|
var exceptionDetailsInterface = {
|
|
2163
|
-
id:
|
|
2164
|
-
outerId:
|
|
2165
|
-
typeName:
|
|
2166
|
-
message:
|
|
2167
|
-
hasFullStack:
|
|
2168
|
-
stack:
|
|
2849
|
+
id: _self.id,
|
|
2850
|
+
outerId: _self.outerId,
|
|
2851
|
+
typeName: _self.typeName,
|
|
2852
|
+
message: _self.message,
|
|
2853
|
+
hasFullStack: _self.hasFullStack,
|
|
2854
|
+
stack: _self[strStack],
|
|
2169
2855
|
parsedStack: parsedStack || undefined
|
|
2170
2856
|
};
|
|
2171
2857
|
return exceptionDetailsInterface;
|
|
@@ -2178,94 +2864,68 @@
|
|
|
2178
2864
|
return exceptionDetails;
|
|
2179
2865
|
};
|
|
2180
2866
|
return _ExceptionDetails;
|
|
2181
|
-
}(
|
|
2182
|
-
var _StackFrame = /** @class */ (function (
|
|
2183
|
-
__extendsFn(_StackFrame, _super);
|
|
2867
|
+
}());
|
|
2868
|
+
var _StackFrame = /** @class */ (function () {
|
|
2184
2869
|
function _StackFrame(sourceFrame, level) {
|
|
2185
|
-
|
|
2186
|
-
_this.sizeInBytes = 0;
|
|
2187
|
-
_this.aiDataContract = {
|
|
2870
|
+
this.aiDataContract = {
|
|
2188
2871
|
level: 1 ,
|
|
2189
2872
|
method: 1 ,
|
|
2190
2873
|
assembly: 0 ,
|
|
2191
2874
|
fileName: 0 ,
|
|
2192
2875
|
line: 0
|
|
2193
2876
|
};
|
|
2877
|
+
var _self = this;
|
|
2878
|
+
_self.sizeInBytes = 0;
|
|
2194
2879
|
if (typeof sourceFrame === "string") {
|
|
2195
2880
|
var frame = sourceFrame;
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2881
|
+
_self.level = level;
|
|
2882
|
+
_self.method = NoMethod;
|
|
2883
|
+
_self.assembly = strTrim(frame);
|
|
2884
|
+
_self.fileName = "";
|
|
2885
|
+
_self.line = 0;
|
|
2201
2886
|
var matches = frame.match(_StackFrame.regex);
|
|
2202
2887
|
if (matches && matches.length >= 5) {
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2888
|
+
_self.method = strTrim(matches[2]) || _self.method;
|
|
2889
|
+
_self.fileName = strTrim(matches[4]);
|
|
2890
|
+
_self.line = parseInt(matches[5]) || 0;
|
|
2206
2891
|
}
|
|
2207
2892
|
}
|
|
2208
2893
|
else {
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
}
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
return _this;
|
|
2894
|
+
_self.level = sourceFrame.level;
|
|
2895
|
+
_self.method = sourceFrame.method;
|
|
2896
|
+
_self.assembly = sourceFrame.assembly;
|
|
2897
|
+
_self.fileName = sourceFrame.fileName;
|
|
2898
|
+
_self.line = sourceFrame.line;
|
|
2899
|
+
_self.sizeInBytes = 0;
|
|
2900
|
+
}
|
|
2901
|
+
_self.sizeInBytes += _self.method.length;
|
|
2902
|
+
_self.sizeInBytes += _self.fileName.length;
|
|
2903
|
+
_self.sizeInBytes += _self.assembly.length;
|
|
2904
|
+
_self.sizeInBytes += _StackFrame.baseSize;
|
|
2905
|
+
_self.sizeInBytes += _self.level.toString().length;
|
|
2906
|
+
_self.sizeInBytes += _self.line.toString().length;
|
|
2223
2907
|
}
|
|
2224
2908
|
_StackFrame.CreateFromInterface = function (frame) {
|
|
2225
2909
|
return new _StackFrame(frame, null );
|
|
2226
2910
|
};
|
|
2227
2911
|
_StackFrame.prototype.toInterface = function () {
|
|
2912
|
+
var _self = this;
|
|
2228
2913
|
return {
|
|
2229
|
-
level:
|
|
2230
|
-
method:
|
|
2231
|
-
assembly:
|
|
2232
|
-
fileName:
|
|
2233
|
-
line:
|
|
2914
|
+
level: _self.level,
|
|
2915
|
+
method: _self.method,
|
|
2916
|
+
assembly: _self.assembly,
|
|
2917
|
+
fileName: _self.fileName,
|
|
2918
|
+
line: _self.line
|
|
2234
2919
|
};
|
|
2235
2920
|
};
|
|
2236
2921
|
_StackFrame.regex = /^([\s]+at)?[\s]{0,50}([^\@\()]+?)[\s]{0,50}(\@|\()([^\(\n]+):([0-9]+):([0-9]+)(\)?)$/;
|
|
2237
2922
|
_StackFrame.baseSize = 58;
|
|
2238
2923
|
return _StackFrame;
|
|
2239
|
-
}(StackFrame));
|
|
2240
|
-
|
|
2241
|
-
var MetricData = /** @class */ (function () {
|
|
2242
|
-
function MetricData() {
|
|
2243
|
-
this.ver = 2;
|
|
2244
|
-
this.metrics = [];
|
|
2245
|
-
this.properties = {};
|
|
2246
|
-
this.measurements = {};
|
|
2247
|
-
}
|
|
2248
|
-
return MetricData;
|
|
2249
|
-
}());
|
|
2250
|
-
|
|
2251
|
-
var DataPointType;
|
|
2252
|
-
(function (DataPointType) {
|
|
2253
|
-
DataPointType[DataPointType["Measurement"] = 0] = "Measurement";
|
|
2254
|
-
DataPointType[DataPointType["Aggregation"] = 1] = "Aggregation";
|
|
2255
|
-
})(DataPointType || (DataPointType = {}));
|
|
2256
|
-
|
|
2257
|
-
var DataPoint$1 = /** @class */ (function () {
|
|
2258
|
-
function DataPoint() {
|
|
2259
|
-
this.kind = DataPointType.Measurement;
|
|
2260
|
-
}
|
|
2261
|
-
return DataPoint;
|
|
2262
2924
|
}());
|
|
2263
2925
|
|
|
2264
|
-
var DataPoint = /** @class */ (function (
|
|
2265
|
-
__extendsFn(DataPoint, _super);
|
|
2926
|
+
var DataPoint = /** @class */ (function () {
|
|
2266
2927
|
function DataPoint() {
|
|
2267
|
-
|
|
2268
|
-
_this.aiDataContract = {
|
|
2928
|
+
this.aiDataContract = {
|
|
2269
2929
|
name: 1 ,
|
|
2270
2930
|
kind: 0 ,
|
|
2271
2931
|
value: 1 ,
|
|
@@ -2274,20 +2934,20 @@
|
|
|
2274
2934
|
max: 0 ,
|
|
2275
2935
|
stdDev: 0
|
|
2276
2936
|
};
|
|
2277
|
-
|
|
2937
|
+
this.kind = 0 ;
|
|
2278
2938
|
}
|
|
2279
2939
|
return DataPoint;
|
|
2280
|
-
}(
|
|
2940
|
+
}());
|
|
2281
2941
|
|
|
2282
|
-
var Metric = /** @class */ (function (
|
|
2283
|
-
__extendsFn(Metric, _super);
|
|
2942
|
+
var Metric = /** @class */ (function () {
|
|
2284
2943
|
function Metric(logger, name, value, count, min, max, stdDev, properties, measurements) {
|
|
2285
|
-
|
|
2286
|
-
_this.aiDataContract = {
|
|
2944
|
+
this.aiDataContract = {
|
|
2287
2945
|
ver: 1 ,
|
|
2288
2946
|
metrics: 1 ,
|
|
2289
2947
|
properties: 0
|
|
2290
2948
|
};
|
|
2949
|
+
var _self = this;
|
|
2950
|
+
_self.ver = 2;
|
|
2291
2951
|
var dataPoint = new DataPoint();
|
|
2292
2952
|
dataPoint.count = count > 0 ? count : undefined;
|
|
2293
2953
|
dataPoint.max = isNaN(max) || max === null ? undefined : max;
|
|
@@ -2295,33 +2955,18 @@
|
|
|
2295
2955
|
dataPoint.name = dataSanitizeString(logger, name) || strNotSpecified;
|
|
2296
2956
|
dataPoint.value = value;
|
|
2297
2957
|
dataPoint.stdDev = isNaN(stdDev) || stdDev === null ? undefined : stdDev;
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
return _this;
|
|
2958
|
+
_self.metrics = [dataPoint];
|
|
2959
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
2960
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
2302
2961
|
}
|
|
2303
2962
|
Metric.envelopeType = "Microsoft.ApplicationInsights.{0}.Metric";
|
|
2304
2963
|
Metric.dataType = "MetricData";
|
|
2305
2964
|
return Metric;
|
|
2306
|
-
}(
|
|
2307
|
-
|
|
2308
|
-
var PageViewData = /** @class */ (function (_super) {
|
|
2309
|
-
__extendsFn(PageViewData, _super);
|
|
2310
|
-
function PageViewData() {
|
|
2311
|
-
var _this = _super.call(this) || this;
|
|
2312
|
-
_this.ver = 2;
|
|
2313
|
-
_this.properties = {};
|
|
2314
|
-
_this.measurements = {};
|
|
2315
|
-
return _this;
|
|
2316
|
-
}
|
|
2317
|
-
return PageViewData;
|
|
2318
|
-
}(EventData));
|
|
2965
|
+
}());
|
|
2319
2966
|
|
|
2320
|
-
var PageView = /** @class */ (function (
|
|
2321
|
-
__extendsFn(PageView, _super);
|
|
2967
|
+
var PageView = /** @class */ (function () {
|
|
2322
2968
|
function PageView(logger, name, url, durationMs, properties, measurements, id) {
|
|
2323
|
-
|
|
2324
|
-
_this.aiDataContract = {
|
|
2969
|
+
this.aiDataContract = {
|
|
2325
2970
|
ver: 1 ,
|
|
2326
2971
|
name: 0 ,
|
|
2327
2972
|
url: 0 ,
|
|
@@ -2330,37 +2975,26 @@
|
|
|
2330
2975
|
measurements: 0 ,
|
|
2331
2976
|
id: 0
|
|
2332
2977
|
};
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2978
|
+
var _self = this;
|
|
2979
|
+
_self.ver = 2;
|
|
2980
|
+
_self.id = dataSanitizeId(logger, id);
|
|
2981
|
+
_self.url = dataSanitizeUrl(logger, url);
|
|
2982
|
+
_self.name = dataSanitizeString(logger, name) || strNotSpecified;
|
|
2336
2983
|
if (!isNaN(durationMs)) {
|
|
2337
|
-
|
|
2984
|
+
_self.duration = msToTimeSpan(durationMs);
|
|
2338
2985
|
}
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
return _this;
|
|
2986
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
2987
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
2342
2988
|
}
|
|
2343
2989
|
PageView.envelopeType = "Microsoft.ApplicationInsights.{0}.Pageview";
|
|
2344
2990
|
PageView.dataType = "PageviewData";
|
|
2345
2991
|
return PageView;
|
|
2346
|
-
}(PageViewData));
|
|
2347
|
-
|
|
2348
|
-
var RemoteDependencyData$1 = /** @class */ (function () {
|
|
2349
|
-
function RemoteDependencyData() {
|
|
2350
|
-
this.ver = 2;
|
|
2351
|
-
this.success = true;
|
|
2352
|
-
this.properties = {};
|
|
2353
|
-
this.measurements = {};
|
|
2354
|
-
}
|
|
2355
|
-
return RemoteDependencyData;
|
|
2356
2992
|
}());
|
|
2357
2993
|
|
|
2358
|
-
var RemoteDependencyData = /** @class */ (function (
|
|
2359
|
-
__extendsFn(RemoteDependencyData, _super);
|
|
2994
|
+
var RemoteDependencyData = /** @class */ (function () {
|
|
2360
2995
|
function RemoteDependencyData(logger, id, absoluteUrl, commandName, value, success, resultCode, method, requestAPI, correlationContext, properties, measurements) {
|
|
2361
2996
|
if (requestAPI === void 0) { requestAPI = "Ajax"; }
|
|
2362
|
-
|
|
2363
|
-
_this.aiDataContract = {
|
|
2997
|
+
this.aiDataContract = {
|
|
2364
2998
|
id: 1 ,
|
|
2365
2999
|
ver: 1 ,
|
|
2366
3000
|
name: 0 ,
|
|
@@ -2383,77 +3017,54 @@
|
|
|
2383
3017
|
commandName: 0 ,
|
|
2384
3018
|
dependencyTypeName: 0
|
|
2385
3019
|
};
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
3020
|
+
var _self = this;
|
|
3021
|
+
_self.ver = 2;
|
|
3022
|
+
_self.id = id;
|
|
3023
|
+
_self.duration = msToTimeSpan(value);
|
|
3024
|
+
_self.success = success;
|
|
3025
|
+
_self.resultCode = resultCode + "";
|
|
3026
|
+
_self.type = dataSanitizeString(logger, requestAPI);
|
|
2391
3027
|
var dependencyFields = AjaxHelperParseDependencyPath(logger, absoluteUrl, method, commandName);
|
|
2392
|
-
|
|
2393
|
-
|
|
3028
|
+
_self.data = dataSanitizeUrl(logger, commandName) || dependencyFields.data;
|
|
3029
|
+
_self.target = dataSanitizeString(logger, dependencyFields.target);
|
|
2394
3030
|
if (correlationContext) {
|
|
2395
|
-
|
|
3031
|
+
_self.target = "".concat(_self.target, " | ").concat(correlationContext);
|
|
2396
3032
|
}
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
return _this;
|
|
3033
|
+
_self.name = dataSanitizeString(logger, dependencyFields.name);
|
|
3034
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
3035
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
2401
3036
|
}
|
|
2402
3037
|
RemoteDependencyData.envelopeType = "Microsoft.ApplicationInsights.{0}.RemoteDependency";
|
|
2403
3038
|
RemoteDependencyData.dataType = "RemoteDependencyData";
|
|
2404
3039
|
return RemoteDependencyData;
|
|
2405
|
-
}(RemoteDependencyData$1));
|
|
2406
|
-
|
|
2407
|
-
var MessageData = /** @class */ (function () {
|
|
2408
|
-
function MessageData() {
|
|
2409
|
-
this.ver = 2;
|
|
2410
|
-
this.properties = {};
|
|
2411
|
-
this.measurements = {};
|
|
2412
|
-
}
|
|
2413
|
-
return MessageData;
|
|
2414
3040
|
}());
|
|
2415
3041
|
|
|
2416
|
-
var Trace = /** @class */ (function (
|
|
2417
|
-
__extendsFn(Trace, _super);
|
|
3042
|
+
var Trace = /** @class */ (function () {
|
|
2418
3043
|
function Trace(logger, message, severityLevel, properties, measurements) {
|
|
2419
|
-
|
|
2420
|
-
_this.aiDataContract = {
|
|
3044
|
+
this.aiDataContract = {
|
|
2421
3045
|
ver: 1 ,
|
|
2422
3046
|
message: 1 ,
|
|
2423
3047
|
severityLevel: 0 ,
|
|
2424
3048
|
properties: 0
|
|
2425
3049
|
};
|
|
3050
|
+
var _self = this;
|
|
3051
|
+
_self.ver = 2;
|
|
2426
3052
|
message = message || strNotSpecified;
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
3053
|
+
_self.message = dataSanitizeMessage(logger, message);
|
|
3054
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
3055
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
2430
3056
|
if (severityLevel) {
|
|
2431
|
-
|
|
3057
|
+
_self.severityLevel = severityLevel;
|
|
2432
3058
|
}
|
|
2433
|
-
return _this;
|
|
2434
3059
|
}
|
|
2435
3060
|
Trace.envelopeType = "Microsoft.ApplicationInsights.{0}.Message";
|
|
2436
3061
|
Trace.dataType = "MessageData";
|
|
2437
3062
|
return Trace;
|
|
2438
|
-
}(
|
|
2439
|
-
|
|
2440
|
-
var PageViewPerfData = /** @class */ (function (_super) {
|
|
2441
|
-
__extendsFn(PageViewPerfData, _super);
|
|
2442
|
-
function PageViewPerfData() {
|
|
2443
|
-
var _this = _super.call(this) || this;
|
|
2444
|
-
_this.ver = 2;
|
|
2445
|
-
_this.properties = {};
|
|
2446
|
-
_this.measurements = {};
|
|
2447
|
-
return _this;
|
|
2448
|
-
}
|
|
2449
|
-
return PageViewPerfData;
|
|
2450
|
-
}(PageViewData));
|
|
3063
|
+
}());
|
|
2451
3064
|
|
|
2452
|
-
var PageViewPerformance = /** @class */ (function (
|
|
2453
|
-
__extendsFn(PageViewPerformance, _super);
|
|
3065
|
+
var PageViewPerformance = /** @class */ (function () {
|
|
2454
3066
|
function PageViewPerformance(logger, name, url, unused, properties, measurements, cs4BaseData) {
|
|
2455
|
-
|
|
2456
|
-
_this.aiDataContract = {
|
|
3067
|
+
this.aiDataContract = {
|
|
2457
3068
|
ver: 1 ,
|
|
2458
3069
|
name: 0 ,
|
|
2459
3070
|
url: 0 ,
|
|
@@ -2466,39 +3077,37 @@
|
|
|
2466
3077
|
properties: 0 ,
|
|
2467
3078
|
measurements: 0
|
|
2468
3079
|
};
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
3080
|
+
var _self = this;
|
|
3081
|
+
_self.ver = 2;
|
|
3082
|
+
_self.url = dataSanitizeUrl(logger, url);
|
|
3083
|
+
_self.name = dataSanitizeString(logger, name) || strNotSpecified;
|
|
3084
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
3085
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
2473
3086
|
if (cs4BaseData) {
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
3087
|
+
_self.domProcessing = cs4BaseData.domProcessing;
|
|
3088
|
+
_self.duration = cs4BaseData.duration;
|
|
3089
|
+
_self.networkConnect = cs4BaseData.networkConnect;
|
|
3090
|
+
_self.perfTotal = cs4BaseData.perfTotal;
|
|
3091
|
+
_self.receivedResponse = cs4BaseData.receivedResponse;
|
|
3092
|
+
_self.sentRequest = cs4BaseData.sentRequest;
|
|
2480
3093
|
}
|
|
2481
|
-
return _this;
|
|
2482
3094
|
}
|
|
2483
3095
|
PageViewPerformance.envelopeType = "Microsoft.ApplicationInsights.{0}.PageviewPerformance";
|
|
2484
3096
|
PageViewPerformance.dataType = "PageviewPerformanceData";
|
|
2485
3097
|
return PageViewPerformance;
|
|
2486
|
-
}(
|
|
3098
|
+
}());
|
|
2487
3099
|
|
|
2488
|
-
var Data = /** @class */ (function (
|
|
2489
|
-
__extendsFn(Data, _super);
|
|
3100
|
+
var Data = /** @class */ (function () {
|
|
2490
3101
|
function Data(baseType, data) {
|
|
2491
|
-
|
|
2492
|
-
_this.aiDataContract = {
|
|
3102
|
+
this.aiDataContract = {
|
|
2493
3103
|
baseType: 1 ,
|
|
2494
3104
|
baseData: 1
|
|
2495
3105
|
};
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
return _this;
|
|
3106
|
+
this.baseType = baseType;
|
|
3107
|
+
this.baseData = data;
|
|
2499
3108
|
}
|
|
2500
3109
|
return Data;
|
|
2501
|
-
}(
|
|
3110
|
+
}());
|
|
2502
3111
|
|
|
2503
3112
|
function _aiNameFunc(baseName) {
|
|
2504
3113
|
var aiName = "ai." + baseName + ".";
|
|
@@ -2599,7 +3208,7 @@
|
|
|
2599
3208
|
_self.enqueue = function (payload) {
|
|
2600
3209
|
if (_self.count() >= config.eventsLimitInMem()) {
|
|
2601
3210
|
if (!_bufferFullMessageSent) {
|
|
2602
|
-
logger
|
|
3211
|
+
_throwInternal(logger, 2 , 105 , "Maximum in-memory buffer size reached: " + _self.count(), true);
|
|
2603
3212
|
_bufferFullMessageSent = true;
|
|
2604
3213
|
}
|
|
2605
3214
|
return;
|
|
@@ -2671,7 +3280,7 @@
|
|
|
2671
3280
|
_self.enqueue = function (payload) {
|
|
2672
3281
|
if (_self.count() >= SessionStorageSendBuffer.MAX_BUFFER_SIZE) {
|
|
2673
3282
|
if (!_bufferFullMessageSent) {
|
|
2674
|
-
logger
|
|
3283
|
+
_throwInternal(logger, 2 , 67 , "Maximum buffer size reached: " + _self.count(), true);
|
|
2675
3284
|
_bufferFullMessageSent = true;
|
|
2676
3285
|
}
|
|
2677
3286
|
return;
|
|
@@ -2691,7 +3300,7 @@
|
|
|
2691
3300
|
if (sentElements instanceof Array && payload instanceof Array) {
|
|
2692
3301
|
sentElements = sentElements.concat(payload);
|
|
2693
3302
|
if (sentElements.length > SessionStorageSendBuffer.MAX_BUFFER_SIZE) {
|
|
2694
|
-
logger
|
|
3303
|
+
_throwInternal(logger, 1 , 67 , "Sent buffer reached its maximum size: " + sentElements.length, true);
|
|
2695
3304
|
sentElements.length = SessionStorageSendBuffer.MAX_BUFFER_SIZE;
|
|
2696
3305
|
}
|
|
2697
3306
|
_setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, sentElements);
|
|
@@ -2727,7 +3336,7 @@
|
|
|
2727
3336
|
}
|
|
2728
3337
|
}
|
|
2729
3338
|
catch (e) {
|
|
2730
|
-
logger
|
|
3339
|
+
_throwInternal(logger, 1 , 42 , " storage key: " + prefixedKey + ", " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2731
3340
|
}
|
|
2732
3341
|
return [];
|
|
2733
3342
|
}
|
|
@@ -2740,7 +3349,7 @@
|
|
|
2740
3349
|
}
|
|
2741
3350
|
catch (e) {
|
|
2742
3351
|
utlSetSessionStorage(logger, prefixedKey, JSON.stringify([]));
|
|
2743
|
-
logger
|
|
3352
|
+
_throwInternal(logger, 2 , 41 , " storage key: " + prefixedKey + ", " + getExceptionName(e) + ". Buffer cleared", { exception: dumpObj(e) });
|
|
2744
3353
|
}
|
|
2745
3354
|
}
|
|
2746
3355
|
});
|
|
@@ -2857,11 +3466,11 @@
|
|
|
2857
3466
|
}
|
|
2858
3467
|
function EnvelopeCreatorInit(logger, telemetryItem) {
|
|
2859
3468
|
if (isNullOrUndefined(telemetryItem[strBaseData])) {
|
|
2860
|
-
logger
|
|
3469
|
+
_throwInternal(logger, 1 , 46 , "telemetryItem.baseData cannot be null.");
|
|
2861
3470
|
}
|
|
2862
3471
|
}
|
|
2863
3472
|
var EnvelopeCreator = {
|
|
2864
|
-
Version: "2.8.0-nightly.
|
|
3473
|
+
Version: "2.8.0-nightly.2204-06"
|
|
2865
3474
|
};
|
|
2866
3475
|
function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
|
|
2867
3476
|
EnvelopeCreatorInit(logger, telemetryItem);
|
|
@@ -2873,7 +3482,7 @@
|
|
|
2873
3482
|
}
|
|
2874
3483
|
var bd = telemetryItem[strBaseData];
|
|
2875
3484
|
if (isNullOrUndefined(bd)) {
|
|
2876
|
-
logger
|
|
3485
|
+
_warnToConsole(logger, "Invalid input for dependency data");
|
|
2877
3486
|
return null;
|
|
2878
3487
|
}
|
|
2879
3488
|
var method = bd[strProperties] && bd[strProperties][HttpMethod] ? bd[strProperties][HttpMethod] : "GET";
|
|
@@ -3020,18 +3629,18 @@
|
|
|
3020
3629
|
return getJSON().stringify(output);
|
|
3021
3630
|
}
|
|
3022
3631
|
catch (e) {
|
|
3023
|
-
logger
|
|
3632
|
+
_throwInternal(logger, 1 , 48 , (e && isFunction(e.toString)) ? e.toString() : "Error serializing object", null, true);
|
|
3024
3633
|
}
|
|
3025
3634
|
};
|
|
3026
3635
|
function _serializeObject(source, name) {
|
|
3027
3636
|
var circularReferenceCheck = "__aiCircularRefCheck";
|
|
3028
3637
|
var output = {};
|
|
3029
3638
|
if (!source) {
|
|
3030
|
-
logger
|
|
3639
|
+
_throwInternal(logger, 1 , 48 , "cannot serialize object because it is null or undefined", { name: name }, true);
|
|
3031
3640
|
return output;
|
|
3032
3641
|
}
|
|
3033
3642
|
if (source[circularReferenceCheck]) {
|
|
3034
|
-
logger
|
|
3643
|
+
_throwInternal(logger, 2 , 50 , "Circular reference detected while serializing object", { name: name }, true);
|
|
3035
3644
|
return output;
|
|
3036
3645
|
}
|
|
3037
3646
|
if (!source.aiDataContract) {
|
|
@@ -3048,13 +3657,13 @@
|
|
|
3048
3657
|
output = _serializeArray(source, name);
|
|
3049
3658
|
}
|
|
3050
3659
|
else {
|
|
3051
|
-
logger
|
|
3660
|
+
_throwInternal(logger, 2 , 49 , "Attempting to serialize an object which does not implement ISerializable", { name: name }, true);
|
|
3052
3661
|
try {
|
|
3053
3662
|
getJSON().stringify(source);
|
|
3054
3663
|
output = source;
|
|
3055
3664
|
}
|
|
3056
3665
|
catch (e) {
|
|
3057
|
-
logger
|
|
3666
|
+
_throwInternal(logger, 1 , 48 , (e && isFunction(e.toString)) ? e.toString() : "Error serializing object", null, true);
|
|
3058
3667
|
}
|
|
3059
3668
|
}
|
|
3060
3669
|
return output;
|
|
@@ -3067,7 +3676,7 @@
|
|
|
3067
3676
|
var isPresent = source[field] !== undefined;
|
|
3068
3677
|
var isObj = isObject(source[field]) && source[field] !== null;
|
|
3069
3678
|
if (isRequired && !isPresent && !isArray) {
|
|
3070
|
-
logger
|
|
3679
|
+
_throwInternal(logger, 1 , 24 , "Missing required field specification. The field is required but not present on source", { field: field, name: name });
|
|
3071
3680
|
}
|
|
3072
3681
|
else if (!isHidden) {
|
|
3073
3682
|
var value = void 0;
|
|
@@ -3094,7 +3703,7 @@
|
|
|
3094
3703
|
var output;
|
|
3095
3704
|
if (!!sources) {
|
|
3096
3705
|
if (!isArray(sources)) {
|
|
3097
|
-
logger
|
|
3706
|
+
_throwInternal(logger, 1 , 54 , "This field was specified as an array in the contract but the item is not an array.\r\n", { name: name }, true);
|
|
3098
3707
|
}
|
|
3099
3708
|
else {
|
|
3100
3709
|
output = [];
|
|
@@ -3145,7 +3754,7 @@
|
|
|
3145
3754
|
}
|
|
3146
3755
|
else {
|
|
3147
3756
|
output[field] = "invalid field: " + name + " is of unknown type.";
|
|
3148
|
-
logger
|
|
3757
|
+
_throwInternal(logger, 1 , output[field], null, true);
|
|
3149
3758
|
}
|
|
3150
3759
|
});
|
|
3151
3760
|
}
|
|
@@ -3156,65 +3765,81 @@
|
|
|
3156
3765
|
return Serializer;
|
|
3157
3766
|
}());
|
|
3158
3767
|
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
target.onoffline = _setOffline;
|
|
3178
|
-
isListening = true;
|
|
3179
|
-
}
|
|
3180
|
-
}
|
|
3181
|
-
if (isListening) {
|
|
3182
|
-
var _navigator = getNavigator();
|
|
3183
|
-
if (_navigator && !isNullOrUndefined(_navigator.onLine)) {
|
|
3184
|
-
_onlineStatus = _navigator.onLine;
|
|
3185
|
-
}
|
|
3768
|
+
function _disableEvents(target, evtNamespace) {
|
|
3769
|
+
eventOff(target, null, null, evtNamespace);
|
|
3770
|
+
}
|
|
3771
|
+
function createOfflineListener(parentEvtNamespace) {
|
|
3772
|
+
var _document = getDocument();
|
|
3773
|
+
var _navigator = getNavigator();
|
|
3774
|
+
var _isListening = false;
|
|
3775
|
+
var _onlineStatus = true;
|
|
3776
|
+
var _evtNamespace = mergeEvtNamespace(createUniqueNamespace("OfflineListener"), parentEvtNamespace);
|
|
3777
|
+
try {
|
|
3778
|
+
if (_enableEvents(getWindow())) {
|
|
3779
|
+
_isListening = true;
|
|
3780
|
+
}
|
|
3781
|
+
if (_document) {
|
|
3782
|
+
var target = _document.body || _document;
|
|
3783
|
+
if (target.ononline) {
|
|
3784
|
+
if (_enableEvents(target)) {
|
|
3785
|
+
_isListening = true;
|
|
3186
3786
|
}
|
|
3187
3787
|
}
|
|
3188
|
-
|
|
3189
|
-
|
|
3788
|
+
}
|
|
3789
|
+
if (_isListening) {
|
|
3790
|
+
if (_navigator && !isNullOrUndefined(_navigator.onLine)) {
|
|
3791
|
+
_onlineStatus = _navigator.onLine;
|
|
3190
3792
|
}
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
};
|
|
3203
|
-
_self.isOffline = function () {
|
|
3204
|
-
return !_self.isOnline();
|
|
3205
|
-
};
|
|
3206
|
-
function _setOnline() {
|
|
3207
|
-
_onlineStatus = true;
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
catch (e) {
|
|
3796
|
+
_isListening = false;
|
|
3797
|
+
}
|
|
3798
|
+
function _enableEvents(target) {
|
|
3799
|
+
var enabled = false;
|
|
3800
|
+
if (target) {
|
|
3801
|
+
enabled = eventOn(target, "online", _setOnline, _evtNamespace);
|
|
3802
|
+
if (enabled) {
|
|
3803
|
+
eventOn(target, "offline", _setOffline, _evtNamespace);
|
|
3208
3804
|
}
|
|
3209
|
-
|
|
3210
|
-
|
|
3805
|
+
}
|
|
3806
|
+
return enabled;
|
|
3807
|
+
}
|
|
3808
|
+
function _setOnline() {
|
|
3809
|
+
_onlineStatus = true;
|
|
3810
|
+
}
|
|
3811
|
+
function _setOffline() {
|
|
3812
|
+
_onlineStatus = false;
|
|
3813
|
+
}
|
|
3814
|
+
function _isOnline() {
|
|
3815
|
+
var result = true;
|
|
3816
|
+
if (_isListening) {
|
|
3817
|
+
result = _onlineStatus;
|
|
3818
|
+
}
|
|
3819
|
+
else if (_navigator && !isNullOrUndefined(_navigator.onLine)) {
|
|
3820
|
+
result = _navigator.onLine;
|
|
3821
|
+
}
|
|
3822
|
+
return result;
|
|
3823
|
+
}
|
|
3824
|
+
function _unload() {
|
|
3825
|
+
var win = getWindow();
|
|
3826
|
+
if (win && _isListening) {
|
|
3827
|
+
_disableEvents(win, _evtNamespace);
|
|
3828
|
+
if (_document) {
|
|
3829
|
+
var target = _document.body || _document;
|
|
3830
|
+
if (!isUndefined(target.ononline)) {
|
|
3831
|
+
_disableEvents(target, _evtNamespace);
|
|
3832
|
+
}
|
|
3211
3833
|
}
|
|
3212
|
-
|
|
3834
|
+
_isListening = false;
|
|
3835
|
+
}
|
|
3213
3836
|
}
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3837
|
+
return {
|
|
3838
|
+
isOnline: _isOnline,
|
|
3839
|
+
isListening: function () { return _isListening; },
|
|
3840
|
+
unload: _unload
|
|
3841
|
+
};
|
|
3842
|
+
}
|
|
3218
3843
|
|
|
3219
3844
|
var MIN_INPUT_LENGTH = 8;
|
|
3220
3845
|
var HashCodeScoreGenerator = /** @class */ (function () {
|
|
@@ -3342,22 +3967,22 @@
|
|
|
3342
3967
|
var _this = _super.call(this) || this;
|
|
3343
3968
|
_this.priority = 1001;
|
|
3344
3969
|
_this.identifier = BreezeChannelIdentifier;
|
|
3970
|
+
_this._senderConfig = _getDefaultAppInsightsChannelConfig();
|
|
3345
3971
|
var _consecutiveErrors;
|
|
3346
3972
|
var _retryAt;
|
|
3347
3973
|
var _lastSend;
|
|
3348
|
-
var _paused
|
|
3974
|
+
var _paused;
|
|
3349
3975
|
var _timeoutHandle;
|
|
3350
3976
|
var _serializer;
|
|
3351
3977
|
var _stamp_specific_redirects;
|
|
3352
|
-
var _headers
|
|
3978
|
+
var _headers;
|
|
3353
3979
|
var _syncFetchPayload = 0;
|
|
3354
3980
|
var _fallbackSender;
|
|
3355
3981
|
var _syncUnloadSender;
|
|
3356
|
-
|
|
3982
|
+
var _offlineListener;
|
|
3983
|
+
var _evtNamespace;
|
|
3357
3984
|
dynamicProto(Sender, _this, function (_self, _base) {
|
|
3358
|
-
|
|
3359
|
-
throwError("Method not implemented.");
|
|
3360
|
-
}
|
|
3985
|
+
_initDefaults();
|
|
3361
3986
|
_self.pause = function () {
|
|
3362
3987
|
_clearScheduledTimer();
|
|
3363
3988
|
_paused = true;
|
|
@@ -3372,14 +3997,15 @@
|
|
|
3372
3997
|
_setupTimer();
|
|
3373
3998
|
}
|
|
3374
3999
|
};
|
|
3375
|
-
_self.flush = function () {
|
|
4000
|
+
_self.flush = function (isAsync, callBack, sendReason) {
|
|
4001
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
3376
4002
|
if (!_paused) {
|
|
3377
4003
|
_clearScheduledTimer();
|
|
3378
4004
|
try {
|
|
3379
|
-
_self.triggerSend(
|
|
4005
|
+
_self.triggerSend(isAsync, null, sendReason || 1 );
|
|
3380
4006
|
}
|
|
3381
4007
|
catch (e) {
|
|
3382
|
-
_self.diagLog()
|
|
4008
|
+
_throwInternal(_self.diagLog(), 1 , 22 , "flush failed, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3383
4009
|
}
|
|
3384
4010
|
}
|
|
3385
4011
|
};
|
|
@@ -3390,7 +4016,7 @@
|
|
|
3390
4016
|
_self.triggerSend(true, _doUnloadSend, 2 );
|
|
3391
4017
|
}
|
|
3392
4018
|
catch (e) {
|
|
3393
|
-
_self.diagLog()
|
|
4019
|
+
_throwInternal(_self.diagLog(), 1 , 20 , "failed to flush with beacon sender on page unload, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3394
4020
|
}
|
|
3395
4021
|
}
|
|
3396
4022
|
else {
|
|
@@ -3398,11 +4024,13 @@
|
|
|
3398
4024
|
}
|
|
3399
4025
|
}
|
|
3400
4026
|
};
|
|
3401
|
-
_self.teardown = _notImplemented;
|
|
3402
4027
|
_self.addHeader = function (name, value) {
|
|
3403
4028
|
_headers[name] = value;
|
|
3404
4029
|
};
|
|
3405
4030
|
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
4031
|
+
if (_self.isInitialized()) {
|
|
4032
|
+
_throwInternal(_self.diagLog(), 1 , 28 , "Sender is already initialized");
|
|
4033
|
+
}
|
|
3406
4034
|
_base.initialize(config, core, extensions, pluginChain);
|
|
3407
4035
|
var ctx = _self._getTelCtx();
|
|
3408
4036
|
var identifier = _self.identifier;
|
|
@@ -3413,6 +4041,8 @@
|
|
|
3413
4041
|
_self._sender = null;
|
|
3414
4042
|
_stamp_specific_redirects = 0;
|
|
3415
4043
|
var diagLog = _self.diagLog();
|
|
4044
|
+
_evtNamespace = mergeEvtNamespace(createUniqueNamespace("Sender"), core.evtNamespace && core.evtNamespace());
|
|
4045
|
+
_offlineListener = createOfflineListener(_evtNamespace);
|
|
3416
4046
|
var defaultConfig = _getDefaultAppInsightsChannelConfig();
|
|
3417
4047
|
objForEachKey(defaultConfig, function (field, value) {
|
|
3418
4048
|
_self._senderConfig[field] = function () { return ctx.getConfig(identifier, field, value()); };
|
|
@@ -3421,7 +4051,7 @@
|
|
|
3421
4051
|
? new SessionStorageSendBuffer(diagLog, _self._senderConfig) : new ArraySendBuffer(diagLog, _self._senderConfig);
|
|
3422
4052
|
_self._sample = new Sample(_self._senderConfig.samplingPercentage(), diagLog);
|
|
3423
4053
|
if (!_validateInstrumentationKey(config)) {
|
|
3424
|
-
diagLog
|
|
4054
|
+
_throwInternal(diagLog, 1 , 100 , "Invalid Instrumentation key " + config.instrumentationKey);
|
|
3425
4055
|
}
|
|
3426
4056
|
if (!isInternalApplicationInsightsEndpoint(_self._senderConfig.endpointUrl()) && _self._senderConfig.customHeaders() && _self._senderConfig.customHeaders().length > 0) {
|
|
3427
4057
|
arrForEach(_self._senderConfig.customHeaders(), function (customHeader) {
|
|
@@ -3467,22 +4097,22 @@
|
|
|
3467
4097
|
return;
|
|
3468
4098
|
}
|
|
3469
4099
|
if (!telemetryItem) {
|
|
3470
|
-
itemCtx.diagLog()
|
|
4100
|
+
_throwInternal(itemCtx.diagLog(), 1 , 7 , "Cannot send empty telemetry");
|
|
3471
4101
|
return;
|
|
3472
4102
|
}
|
|
3473
4103
|
if (telemetryItem.baseData && !telemetryItem.baseType) {
|
|
3474
|
-
itemCtx.diagLog()
|
|
4104
|
+
_throwInternal(itemCtx.diagLog(), 1 , 70 , "Cannot send telemetry without baseData and baseType");
|
|
3475
4105
|
return;
|
|
3476
4106
|
}
|
|
3477
4107
|
if (!telemetryItem.baseType) {
|
|
3478
4108
|
telemetryItem.baseType = "EventData";
|
|
3479
4109
|
}
|
|
3480
4110
|
if (!_self._sender) {
|
|
3481
|
-
itemCtx.diagLog()
|
|
4111
|
+
_throwInternal(itemCtx.diagLog(), 1 , 28 , "Sender was not initialized");
|
|
3482
4112
|
return;
|
|
3483
4113
|
}
|
|
3484
4114
|
if (!_isSampledIn(telemetryItem)) {
|
|
3485
|
-
itemCtx.diagLog()
|
|
4115
|
+
_throwInternal(itemCtx.diagLog(), 2 , 33 , "Telemetry item was sampled out and not sent", { SampleRate: _self._sample.sampleRate });
|
|
3486
4116
|
return;
|
|
3487
4117
|
}
|
|
3488
4118
|
else {
|
|
@@ -3492,7 +4122,7 @@
|
|
|
3492
4122
|
var defaultEnvelopeIkey = telemetryItem.iKey || _self._senderConfig.instrumentationKey();
|
|
3493
4123
|
var aiEnvelope_1 = Sender.constructEnvelope(telemetryItem, defaultEnvelopeIkey, itemCtx.diagLog(), convertUndefined);
|
|
3494
4124
|
if (!aiEnvelope_1) {
|
|
3495
|
-
itemCtx.diagLog()
|
|
4125
|
+
_throwInternal(itemCtx.diagLog(), 1 , 47 , "Unable to create an AppInsights envelope");
|
|
3496
4126
|
return;
|
|
3497
4127
|
}
|
|
3498
4128
|
var doNotSendItem_1 = false;
|
|
@@ -3501,11 +4131,11 @@
|
|
|
3501
4131
|
try {
|
|
3502
4132
|
if (callBack && callBack(aiEnvelope_1) === false) {
|
|
3503
4133
|
doNotSendItem_1 = true;
|
|
3504
|
-
itemCtx.diagLog()
|
|
4134
|
+
_warnToConsole(itemCtx.diagLog(), "Telemetry processor check returns false");
|
|
3505
4135
|
}
|
|
3506
4136
|
}
|
|
3507
4137
|
catch (e) {
|
|
3508
|
-
itemCtx.diagLog()
|
|
4138
|
+
_throwInternal(itemCtx.diagLog(), 1 , 64 , "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
|
|
3509
4139
|
}
|
|
3510
4140
|
});
|
|
3511
4141
|
delete telemetryItem.tags[ProcessLegacy];
|
|
@@ -3523,7 +4153,7 @@
|
|
|
3523
4153
|
_setupTimer();
|
|
3524
4154
|
}
|
|
3525
4155
|
catch (e) {
|
|
3526
|
-
itemCtx.diagLog()
|
|
4156
|
+
_throwInternal(itemCtx.diagLog(), 2 , 12 , "Failed adding telemetry to the sender's buffer, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3527
4157
|
}
|
|
3528
4158
|
_self.processNext(telemetryItem, itemCtx);
|
|
3529
4159
|
};
|
|
@@ -3558,13 +4188,18 @@
|
|
|
3558
4188
|
catch (e) {
|
|
3559
4189
|
var ieVer = getIEVersion();
|
|
3560
4190
|
if (!ieVer || ieVer > 9) {
|
|
3561
|
-
_self.diagLog()
|
|
4191
|
+
_throwInternal(_self.diagLog(), 1 , 40 , "Telemetry transmission failed, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3562
4192
|
}
|
|
3563
4193
|
}
|
|
3564
4194
|
}
|
|
3565
4195
|
};
|
|
4196
|
+
_self._doTeardown = function (unloadCtx, unloadState) {
|
|
4197
|
+
_self.onunloadFlush();
|
|
4198
|
+
_offlineListener.unload();
|
|
4199
|
+
_initDefaults();
|
|
4200
|
+
};
|
|
3566
4201
|
_self._onError = function (payload, message, event) {
|
|
3567
|
-
_self.diagLog()
|
|
4202
|
+
_throwInternal(_self.diagLog(), 2 , 26 , "Failed to send telemetry.", { message: message });
|
|
3568
4203
|
_self._buffer.clearSent(payload);
|
|
3569
4204
|
};
|
|
3570
4205
|
_self._onPartialSuccess = function (payload, results) {
|
|
@@ -3589,7 +4224,7 @@
|
|
|
3589
4224
|
}
|
|
3590
4225
|
if (retry.length > 0) {
|
|
3591
4226
|
_resendPayload(retry);
|
|
3592
|
-
_self.diagLog()
|
|
4227
|
+
_throwInternal(_self.diagLog(), 2 , 40 , "Partial success. " +
|
|
3593
4228
|
"Delivered: " + payload.length + ", Failed: " + failed.length +
|
|
3594
4229
|
". Will retry to send " + retry.length + " our of " + results.itemsReceived + " items");
|
|
3595
4230
|
}
|
|
@@ -3634,18 +4269,18 @@
|
|
|
3634
4269
|
}
|
|
3635
4270
|
if (!_self._senderConfig.isRetryDisabled() && _isRetriable(status)) {
|
|
3636
4271
|
_resendPayload(payload);
|
|
3637
|
-
_self.diagLog()
|
|
4272
|
+
_throwInternal(_self.diagLog(), 2 , 40 , ". " +
|
|
3638
4273
|
"Response code " + status + ". Will retry to send " + payload.length + " items.");
|
|
3639
4274
|
}
|
|
3640
4275
|
else {
|
|
3641
4276
|
_self._onError(payload, errorMessage);
|
|
3642
4277
|
}
|
|
3643
4278
|
}
|
|
3644
|
-
else if (
|
|
4279
|
+
else if (_offlineListener && !_offlineListener.isOnline()) {
|
|
3645
4280
|
if (!_self._senderConfig.isRetryDisabled()) {
|
|
3646
4281
|
var offlineBackOffMultiplier = 10;
|
|
3647
4282
|
_resendPayload(payload, offlineBackOffMultiplier);
|
|
3648
|
-
_self.diagLog()
|
|
4283
|
+
_throwInternal(_self.diagLog(), 2 , 40 , ". Offline - Response Code: ".concat(status, ". Offline status: ").concat(!_offlineListener.isOnline(), ". Will retry to send ").concat(payload.length, " items."));
|
|
3649
4284
|
}
|
|
3650
4285
|
}
|
|
3651
4286
|
else {
|
|
@@ -3712,8 +4347,8 @@
|
|
|
3712
4347
|
}
|
|
3713
4348
|
}
|
|
3714
4349
|
if (droppedPayload.length > 0) {
|
|
3715
|
-
_fallbackSender(droppedPayload, true);
|
|
3716
|
-
_self.diagLog()
|
|
4350
|
+
_fallbackSender && _fallbackSender(droppedPayload, true);
|
|
4351
|
+
_throwInternal(_self.diagLog(), 2 , 40 , ". " + "Failed to send telemetry with Beacon API, retried with normal sender.");
|
|
3717
4352
|
}
|
|
3718
4353
|
}
|
|
3719
4354
|
}
|
|
@@ -3754,7 +4389,7 @@
|
|
|
3754
4389
|
}
|
|
3755
4390
|
else {
|
|
3756
4391
|
_fallbackSender && _fallbackSender(payload, true);
|
|
3757
|
-
_self.diagLog()
|
|
4392
|
+
_throwInternal(_self.diagLog(), 2 , 40 , ". " + "Failed to send telemetry with Beacon API, retried with xhrSender.");
|
|
3758
4393
|
}
|
|
3759
4394
|
}
|
|
3760
4395
|
}
|
|
@@ -3845,7 +4480,7 @@
|
|
|
3845
4480
|
}
|
|
3846
4481
|
}
|
|
3847
4482
|
catch (e) {
|
|
3848
|
-
_self.diagLog()
|
|
4483
|
+
_throwInternal(_self.diagLog(), 1 , 43 , "Cannot parse the response. " + getExceptionName(e), {
|
|
3849
4484
|
response: response
|
|
3850
4485
|
});
|
|
3851
4486
|
}
|
|
@@ -3916,7 +4551,7 @@
|
|
|
3916
4551
|
xdr.onerror = function (event) { return _self._onError(payload, _formatErrorMessageXdr(xdr), event); };
|
|
3917
4552
|
var hostingProtocol = _window && _window.location && _window.location.protocol || "";
|
|
3918
4553
|
if (_self._senderConfig.endpointUrl().lastIndexOf(hostingProtocol, 0) !== 0) {
|
|
3919
|
-
_self.diagLog()
|
|
4554
|
+
_throwInternal(_self.diagLog(), 2 , 40 , ". " +
|
|
3920
4555
|
"Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol.");
|
|
3921
4556
|
buffer.clear();
|
|
3922
4557
|
return;
|
|
@@ -3947,7 +4582,7 @@
|
|
|
3947
4582
|
manager.eventsSendRequest(sendRequest, isAsync);
|
|
3948
4583
|
}
|
|
3949
4584
|
catch (e) {
|
|
3950
|
-
_self.diagLog()
|
|
4585
|
+
_throwInternal(_self.diagLog(), 1 , 74 , "send request notification failed: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3951
4586
|
}
|
|
3952
4587
|
}
|
|
3953
4588
|
}
|
|
@@ -3960,6 +4595,25 @@
|
|
|
3960
4595
|
var regexp = new RegExp(UUID_Regex);
|
|
3961
4596
|
return regexp.test(config.instrumentationKey);
|
|
3962
4597
|
}
|
|
4598
|
+
function _initDefaults() {
|
|
4599
|
+
_self._sender = null;
|
|
4600
|
+
_self._buffer = null;
|
|
4601
|
+
_self._appId = null;
|
|
4602
|
+
_self._sample = null;
|
|
4603
|
+
_headers = {};
|
|
4604
|
+
_offlineListener = null;
|
|
4605
|
+
_consecutiveErrors = 0;
|
|
4606
|
+
_retryAt = null;
|
|
4607
|
+
_lastSend = null;
|
|
4608
|
+
_paused = false;
|
|
4609
|
+
_timeoutHandle = null;
|
|
4610
|
+
_serializer = null;
|
|
4611
|
+
_stamp_specific_redirects = 0;
|
|
4612
|
+
_syncFetchPayload = 0;
|
|
4613
|
+
_fallbackSender = null;
|
|
4614
|
+
_syncUnloadSender = null;
|
|
4615
|
+
_evtNamespace = null;
|
|
4616
|
+
}
|
|
3963
4617
|
});
|
|
3964
4618
|
return _this;
|
|
3965
4619
|
}
|