@microsoft/applicationinsights-react-native 2.4.5-nightly.2204-03 → 2.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/applicationinsights-react-native.js +309 -938
- package/browser/applicationinsights-react-native.js.map +1 -1
- package/browser/applicationinsights-react-native.min.js +2 -2
- package/browser/applicationinsights-react-native.min.js.map +1 -1
- package/dist/applicationinsights-react-native.api.json +23 -13
- package/dist/applicationinsights-react-native.d.ts +1 -1
- package/dist/applicationinsights-react-native.js +309 -938
- package/dist/applicationinsights-react-native.js.map +1 -1
- package/dist/applicationinsights-react-native.min.js +2 -2
- package/dist/applicationinsights-react-native.min.js.map +1 -1
- package/dist/applicationinsights-react-native.rollup.d.ts +1 -1
- package/dist-esm/Interfaces/INativeDevice.js +1 -1
- package/dist-esm/Interfaces/IReactNativePluginConfig.js +1 -1
- package/dist-esm/Interfaces/index.js +1 -1
- package/dist-esm/ReactNativePlugin.js +4 -22
- package/dist-esm/ReactNativePlugin.js.map +1 -1
- package/dist-esm/index.js +1 -1
- package/package.json +67 -70
- package/src/ReactNativePlugin.ts +5 -29
- package/types/tsdoc-metadata.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - React Native Plugin, 2.4.
|
|
2
|
+
* Application Insights JavaScript SDK - React Native Plugin, 2.4.6
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -66,9 +66,7 @@
|
|
|
66
66
|
(getGlobal() || {})["Reflect"];
|
|
67
67
|
var extendStaticsFn = function (d, b) {
|
|
68
68
|
extendStaticsFn = ObjClass["setPrototypeOf"] ||
|
|
69
|
-
({ __proto__: [] } instanceof Array && function (d, b) {
|
|
70
|
-
d.__proto__ = b;
|
|
71
|
-
}) ||
|
|
69
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
72
70
|
function (d, b) {
|
|
73
71
|
for (var p in b) {
|
|
74
72
|
if (b[strShimHasOwnProperty](p)) {
|
|
@@ -83,14 +81,12 @@
|
|
|
83
81
|
throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
84
82
|
}
|
|
85
83
|
extendStaticsFn(d, b);
|
|
86
|
-
function __() {
|
|
87
|
-
this.constructor = d;
|
|
88
|
-
}
|
|
84
|
+
function __() { this.constructor = d; }
|
|
89
85
|
d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
|
|
90
86
|
}
|
|
91
87
|
|
|
92
88
|
/*!
|
|
93
|
-
* Microsoft Dynamic Proto Utility, 1.1.
|
|
89
|
+
* Microsoft Dynamic Proto Utility, 1.1.6
|
|
94
90
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
95
91
|
*/
|
|
96
92
|
var Constructor = 'constructor';
|
|
@@ -104,11 +100,14 @@
|
|
|
104
100
|
var DynAllowInstChkTag = DynInstChkTag;
|
|
105
101
|
var DynProtoDefaultOptions = '_dfOpts';
|
|
106
102
|
var UnknownValue = '_unknown_';
|
|
107
|
-
var str__Proto
|
|
103
|
+
var str__Proto = "__proto__";
|
|
104
|
+
var DynProtoBaseProto = "_dyn" + str__Proto;
|
|
105
|
+
var DynProtoCurrent = "_dynInstProto";
|
|
108
106
|
var strUseBaseInst = 'useBaseInst';
|
|
109
107
|
var strSetInstFuncs = 'setInstFuncs';
|
|
110
108
|
var Obj = Object;
|
|
111
|
-
var _objGetPrototypeOf
|
|
109
|
+
var _objGetPrototypeOf = Obj["getPrototypeOf"];
|
|
110
|
+
var _objGetOwnProps = Obj["getOwnPropertyNames"];
|
|
112
111
|
var _dynamicNames = 0;
|
|
113
112
|
function _hasOwnProperty(obj, prop) {
|
|
114
113
|
return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
|
|
@@ -119,23 +118,26 @@
|
|
|
119
118
|
function _isObjectArrayOrFunctionPrototype(target) {
|
|
120
119
|
return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
|
|
121
120
|
}
|
|
122
|
-
function _getObjProto
|
|
121
|
+
function _getObjProto(target) {
|
|
122
|
+
var newProto;
|
|
123
123
|
if (target) {
|
|
124
|
-
if (_objGetPrototypeOf
|
|
125
|
-
return _objGetPrototypeOf
|
|
124
|
+
if (_objGetPrototypeOf) {
|
|
125
|
+
return _objGetPrototypeOf(target);
|
|
126
126
|
}
|
|
127
|
-
var
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
var curProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
|
|
128
|
+
newProto = target[DynProtoBaseProto] || curProto;
|
|
129
|
+
if (!_hasOwnProperty(target, DynProtoBaseProto)) {
|
|
130
|
+
delete target[DynProtoCurrent];
|
|
131
|
+
newProto = target[DynProtoBaseProto] = target[DynProtoCurrent] || target[DynProtoBaseProto];
|
|
132
|
+
target[DynProtoCurrent] = curProto;
|
|
130
133
|
}
|
|
131
134
|
}
|
|
132
|
-
return
|
|
135
|
+
return newProto;
|
|
133
136
|
}
|
|
134
137
|
function _forEachProp(target, func) {
|
|
135
138
|
var props = [];
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
props = getOwnProps(target);
|
|
139
|
+
if (_objGetOwnProps) {
|
|
140
|
+
props = _objGetOwnProps(target);
|
|
139
141
|
}
|
|
140
142
|
else {
|
|
141
143
|
for (var name_1 in target) {
|
|
@@ -190,16 +192,16 @@
|
|
|
190
192
|
_forEachProp(instFuncs, function (name) {
|
|
191
193
|
baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
|
|
192
194
|
});
|
|
193
|
-
var baseProto = _getObjProto
|
|
195
|
+
var baseProto = _getObjProto(classProto);
|
|
194
196
|
var visited = [];
|
|
195
197
|
while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
|
|
196
198
|
_forEachProp(baseProto, function (name) {
|
|
197
|
-
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf
|
|
199
|
+
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
|
|
198
200
|
baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
|
|
199
201
|
}
|
|
200
202
|
});
|
|
201
203
|
visited.push(baseProto);
|
|
202
|
-
baseProto = _getObjProto
|
|
204
|
+
baseProto = _getObjProto(baseProto);
|
|
203
205
|
}
|
|
204
206
|
return baseFuncs;
|
|
205
207
|
}
|
|
@@ -213,7 +215,7 @@
|
|
|
213
215
|
}
|
|
214
216
|
if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
|
|
215
217
|
var canAddInst = !_hasOwnProperty(target, funcName);
|
|
216
|
-
var objProto = _getObjProto
|
|
218
|
+
var objProto = _getObjProto(target);
|
|
217
219
|
var visited = [];
|
|
218
220
|
while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
|
|
219
221
|
var protoFunc = objProto[funcName];
|
|
@@ -222,7 +224,7 @@
|
|
|
222
224
|
break;
|
|
223
225
|
}
|
|
224
226
|
visited.push(objProto);
|
|
225
|
-
objProto = _getObjProto
|
|
227
|
+
objProto = _getObjProto(objProto);
|
|
226
228
|
}
|
|
227
229
|
try {
|
|
228
230
|
if (canAddInst) {
|
|
@@ -240,7 +242,7 @@
|
|
|
240
242
|
function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
|
|
241
243
|
var protoFunc = proto[funcName];
|
|
242
244
|
if (protoFunc === currentDynProtoProxy) {
|
|
243
|
-
protoFunc = _getObjProto
|
|
245
|
+
protoFunc = _getObjProto(proto)[funcName];
|
|
244
246
|
}
|
|
245
247
|
if (typeof protoFunc !== strFunction) {
|
|
246
248
|
_throwTypeError("[" + funcName + "] is not a " + strFunction);
|
|
@@ -274,18 +276,19 @@
|
|
|
274
276
|
}
|
|
275
277
|
}
|
|
276
278
|
function _checkPrototype(classProto, thisTarget) {
|
|
277
|
-
if (_objGetPrototypeOf
|
|
279
|
+
if (_objGetPrototypeOf) {
|
|
278
280
|
var visited = [];
|
|
279
|
-
var thisProto = _getObjProto
|
|
281
|
+
var thisProto = _getObjProto(thisTarget);
|
|
280
282
|
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
281
283
|
if (thisProto === classProto) {
|
|
282
284
|
return true;
|
|
283
285
|
}
|
|
284
286
|
visited.push(thisProto);
|
|
285
|
-
thisProto = _getObjProto
|
|
287
|
+
thisProto = _getObjProto(thisProto);
|
|
286
288
|
}
|
|
289
|
+
return false;
|
|
287
290
|
}
|
|
288
|
-
return
|
|
291
|
+
return true;
|
|
289
292
|
}
|
|
290
293
|
function _getObjName(target, unknownValue) {
|
|
291
294
|
if (_hasOwnProperty(target, Prototype)) {
|
|
@@ -318,7 +321,7 @@
|
|
|
318
321
|
var instFuncs = _getInstanceFuncs(target);
|
|
319
322
|
var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
|
|
320
323
|
delegateFunc(target, baseFuncs);
|
|
321
|
-
var setInstanceFunc = !!_objGetPrototypeOf
|
|
324
|
+
var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
|
|
322
325
|
if (setInstanceFunc && options) {
|
|
323
326
|
setInstanceFunc = !!options[strSetInstFuncs];
|
|
324
327
|
}
|
|
@@ -330,40 +333,102 @@
|
|
|
330
333
|
};
|
|
331
334
|
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
332
335
|
|
|
333
|
-
var
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
var
|
|
339
|
-
|
|
340
|
-
|
|
336
|
+
var LoggingSeverity;
|
|
337
|
+
(function (LoggingSeverity) {
|
|
338
|
+
LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
|
|
339
|
+
LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
|
|
340
|
+
})(LoggingSeverity || (LoggingSeverity = {}));
|
|
341
|
+
var _InternalMessageId = {
|
|
342
|
+
BrowserDoesNotSupportLocalStorage: 0,
|
|
343
|
+
BrowserCannotReadLocalStorage: 1,
|
|
344
|
+
BrowserCannotReadSessionStorage: 2,
|
|
345
|
+
BrowserCannotWriteLocalStorage: 3,
|
|
346
|
+
BrowserCannotWriteSessionStorage: 4,
|
|
347
|
+
BrowserFailedRemovalFromLocalStorage: 5,
|
|
348
|
+
BrowserFailedRemovalFromSessionStorage: 6,
|
|
349
|
+
CannotSendEmptyTelemetry: 7,
|
|
350
|
+
ClientPerformanceMathError: 8,
|
|
351
|
+
ErrorParsingAISessionCookie: 9,
|
|
352
|
+
ErrorPVCalc: 10,
|
|
353
|
+
ExceptionWhileLoggingError: 11,
|
|
354
|
+
FailedAddingTelemetryToBuffer: 12,
|
|
355
|
+
FailedMonitorAjaxAbort: 13,
|
|
356
|
+
FailedMonitorAjaxDur: 14,
|
|
357
|
+
FailedMonitorAjaxOpen: 15,
|
|
358
|
+
FailedMonitorAjaxRSC: 16,
|
|
359
|
+
FailedMonitorAjaxSend: 17,
|
|
360
|
+
FailedMonitorAjaxGetCorrelationHeader: 18,
|
|
361
|
+
FailedToAddHandlerForOnBeforeUnload: 19,
|
|
362
|
+
FailedToSendQueuedTelemetry: 20,
|
|
363
|
+
FailedToReportDataLoss: 21,
|
|
364
|
+
FlushFailed: 22,
|
|
365
|
+
MessageLimitPerPVExceeded: 23,
|
|
366
|
+
MissingRequiredFieldSpecification: 24,
|
|
367
|
+
NavigationTimingNotSupported: 25,
|
|
368
|
+
OnError: 26,
|
|
369
|
+
SessionRenewalDateIsZero: 27,
|
|
370
|
+
SenderNotInitialized: 28,
|
|
371
|
+
StartTrackEventFailed: 29,
|
|
372
|
+
StopTrackEventFailed: 30,
|
|
373
|
+
StartTrackFailed: 31,
|
|
374
|
+
StopTrackFailed: 32,
|
|
375
|
+
TelemetrySampledAndNotSent: 33,
|
|
376
|
+
TrackEventFailed: 34,
|
|
377
|
+
TrackExceptionFailed: 35,
|
|
378
|
+
TrackMetricFailed: 36,
|
|
379
|
+
TrackPVFailed: 37,
|
|
380
|
+
TrackPVFailedCalc: 38,
|
|
381
|
+
TrackTraceFailed: 39,
|
|
382
|
+
TransmissionFailed: 40,
|
|
383
|
+
FailedToSetStorageBuffer: 41,
|
|
384
|
+
FailedToRestoreStorageBuffer: 42,
|
|
385
|
+
InvalidBackendResponse: 43,
|
|
386
|
+
FailedToFixDepricatedValues: 44,
|
|
387
|
+
InvalidDurationValue: 45,
|
|
388
|
+
TelemetryEnvelopeInvalid: 46,
|
|
389
|
+
CreateEnvelopeError: 47,
|
|
390
|
+
CannotSerializeObject: 48,
|
|
391
|
+
CannotSerializeObjectNonSerializable: 49,
|
|
392
|
+
CircularReferenceDetected: 50,
|
|
393
|
+
ClearAuthContextFailed: 51,
|
|
394
|
+
ExceptionTruncated: 52,
|
|
395
|
+
IllegalCharsInName: 53,
|
|
396
|
+
ItemNotInArray: 54,
|
|
397
|
+
MaxAjaxPerPVExceeded: 55,
|
|
398
|
+
MessageTruncated: 56,
|
|
399
|
+
NameTooLong: 57,
|
|
400
|
+
SampleRateOutOfRange: 58,
|
|
401
|
+
SetAuthContextFailed: 59,
|
|
402
|
+
SetAuthContextFailedAccountName: 60,
|
|
403
|
+
StringValueTooLong: 61,
|
|
404
|
+
StartCalledMoreThanOnce: 62,
|
|
405
|
+
StopCalledWithoutStart: 63,
|
|
406
|
+
TelemetryInitializerFailed: 64,
|
|
407
|
+
TrackArgumentsNotSpecified: 65,
|
|
408
|
+
UrlTooLong: 66,
|
|
409
|
+
SessionStorageBufferFull: 67,
|
|
410
|
+
CannotAccessCookie: 68,
|
|
411
|
+
IdTooLong: 69,
|
|
412
|
+
InvalidEvent: 70,
|
|
413
|
+
FailedMonitorAjaxSetRequestHeader: 71,
|
|
414
|
+
SendBrowserInfoOnUserInit: 72,
|
|
415
|
+
PluginException: 73,
|
|
416
|
+
NotificationException: 74,
|
|
417
|
+
SnippetScriptLoadFailure: 99,
|
|
418
|
+
InvalidInstrumentationKey: 100,
|
|
419
|
+
CannotParseAiBlobValue: 101,
|
|
420
|
+
InvalidContentBlob: 102,
|
|
421
|
+
TrackPageActionEventFailed: 103,
|
|
422
|
+
FailedAddingCustomDefinedRequestContext: 104,
|
|
423
|
+
InMemoryStorageBufferFull: 105
|
|
424
|
+
};
|
|
341
425
|
|
|
342
426
|
var strToString = "toString";
|
|
343
|
-
var
|
|
344
|
-
var strConstructor = "constructor";
|
|
345
|
-
var _objDefineProperty$1 = ObjDefineProperty;
|
|
346
|
-
var _objFreeze = ObjClass.freeze;
|
|
427
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
347
428
|
var _isArray = Array.isArray;
|
|
348
429
|
var _objToString = ObjProto[strToString];
|
|
349
430
|
var _fnToString = ObjHasOwnProperty[strToString];
|
|
350
|
-
|
|
351
|
-
var rCamelCase = /-([a-z])/g;
|
|
352
|
-
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
353
|
-
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
354
|
-
var _objGetPrototypeOf = Object["getPrototypeOf"];
|
|
355
|
-
function _getObjProto(target) {
|
|
356
|
-
if (target) {
|
|
357
|
-
if (_objGetPrototypeOf) {
|
|
358
|
-
return _objGetPrototypeOf(target);
|
|
359
|
-
}
|
|
360
|
-
var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];
|
|
361
|
-
if (newProto) {
|
|
362
|
-
return newProto;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
return null;
|
|
366
|
-
}
|
|
431
|
+
_fnToString.call(ObjClass);
|
|
367
432
|
function isUndefined(value) {
|
|
368
433
|
return value === undefined || typeof value === strShimUndefined;
|
|
369
434
|
}
|
|
@@ -379,34 +444,6 @@
|
|
|
379
444
|
function isFunction(value) {
|
|
380
445
|
return !!(value && typeof value === strShimFunction);
|
|
381
446
|
}
|
|
382
|
-
function normalizeJsName(name) {
|
|
383
|
-
var value = name;
|
|
384
|
-
if (value && isString(value)) {
|
|
385
|
-
value = value.replace(rCamelCase, function (_all, letter) {
|
|
386
|
-
return letter.toUpperCase();
|
|
387
|
-
});
|
|
388
|
-
value = value.replace(rNormalizeInvalid, "_");
|
|
389
|
-
value = value.replace(rLeadingNumeric, function (_all, match) {
|
|
390
|
-
return "_" + match;
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
return value;
|
|
394
|
-
}
|
|
395
|
-
function objForEachKey$1(target, callbackfn) {
|
|
396
|
-
if (target) {
|
|
397
|
-
for (var prop in target) {
|
|
398
|
-
if (ObjHasOwnProperty.call(target, prop)) {
|
|
399
|
-
callbackfn.call(target, prop, target[prop]);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
function strContains(value, search) {
|
|
405
|
-
if (value && search) {
|
|
406
|
-
return value.indexOf(search) !== -1;
|
|
407
|
-
}
|
|
408
|
-
return false;
|
|
409
|
-
}
|
|
410
447
|
var isArray = _isArray || _isArrayPoly;
|
|
411
448
|
function _isArrayPoly(obj) {
|
|
412
449
|
return !!(obj && _objToString.call(obj) === "[object Array]");
|
|
@@ -414,28 +451,6 @@
|
|
|
414
451
|
function isError(obj) {
|
|
415
452
|
return !!(obj && _objToString.call(obj) === "[object Error]");
|
|
416
453
|
}
|
|
417
|
-
function isString(value) {
|
|
418
|
-
return typeof value === "string";
|
|
419
|
-
}
|
|
420
|
-
function isBoolean(value) {
|
|
421
|
-
return typeof value === "boolean";
|
|
422
|
-
}
|
|
423
|
-
function isPlainObject(value) {
|
|
424
|
-
var result = false;
|
|
425
|
-
if (value && typeof value === "object") {
|
|
426
|
-
var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
|
|
427
|
-
if (!proto) {
|
|
428
|
-
result = true;
|
|
429
|
-
}
|
|
430
|
-
else {
|
|
431
|
-
if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
|
|
432
|
-
proto = proto[strConstructor];
|
|
433
|
-
}
|
|
434
|
-
result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
return result;
|
|
438
|
-
}
|
|
439
454
|
function arrForEach(arr, callbackfn, thisArg) {
|
|
440
455
|
var len = arr.length;
|
|
441
456
|
try {
|
|
@@ -451,7 +466,7 @@
|
|
|
451
466
|
}
|
|
452
467
|
}
|
|
453
468
|
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
454
|
-
if (_objDefineProperty
|
|
469
|
+
if (_objDefineProperty) {
|
|
455
470
|
try {
|
|
456
471
|
var descriptor = {
|
|
457
472
|
enumerable: true,
|
|
@@ -463,7 +478,7 @@
|
|
|
463
478
|
if (setProp) {
|
|
464
479
|
descriptor.set = setProp;
|
|
465
480
|
}
|
|
466
|
-
_objDefineProperty
|
|
481
|
+
_objDefineProperty(target, prop, descriptor);
|
|
467
482
|
return true;
|
|
468
483
|
}
|
|
469
484
|
catch (e) {
|
|
@@ -471,10 +486,6 @@
|
|
|
471
486
|
}
|
|
472
487
|
return false;
|
|
473
488
|
}
|
|
474
|
-
function _doNothing(value) {
|
|
475
|
-
return value;
|
|
476
|
-
}
|
|
477
|
-
var objFreeze = _objFreeze || _doNothing;
|
|
478
489
|
function dateNow() {
|
|
479
490
|
var dt = Date;
|
|
480
491
|
return dt.now ? dt.now() : new dt().getTime();
|
|
@@ -483,7 +494,7 @@
|
|
|
483
494
|
if (isError(object)) {
|
|
484
495
|
return object.name;
|
|
485
496
|
}
|
|
486
|
-
return
|
|
497
|
+
return "";
|
|
487
498
|
}
|
|
488
499
|
function setValue(target, field, value, valChk, srcChk) {
|
|
489
500
|
var theValue = value;
|
|
@@ -496,102 +507,10 @@
|
|
|
496
507
|
}
|
|
497
508
|
return theValue;
|
|
498
509
|
}
|
|
499
|
-
function throwError(message) {
|
|
500
|
-
throw new Error(message);
|
|
501
|
-
}
|
|
502
|
-
function _createProxyFunction(source, funcName) {
|
|
503
|
-
var srcFunc = null;
|
|
504
|
-
var src = null;
|
|
505
|
-
if (isFunction(source)) {
|
|
506
|
-
srcFunc = source;
|
|
507
|
-
}
|
|
508
|
-
else {
|
|
509
|
-
src = source;
|
|
510
|
-
}
|
|
511
|
-
return function () {
|
|
512
|
-
var originalArguments = arguments;
|
|
513
|
-
if (srcFunc) {
|
|
514
|
-
src = srcFunc();
|
|
515
|
-
}
|
|
516
|
-
if (src) {
|
|
517
|
-
return src[funcName].apply(src, originalArguments);
|
|
518
|
-
}
|
|
519
|
-
};
|
|
520
|
-
}
|
|
521
|
-
function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
|
|
522
|
-
if (overwriteTarget === void 0) { overwriteTarget = true; }
|
|
523
|
-
if (target && name && source) {
|
|
524
|
-
if (overwriteTarget || isUndefined(target[name])) {
|
|
525
|
-
target[name] = _createProxyFunction(source, theFunc);
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
function createEnumStyle(values) {
|
|
530
|
-
var enumClass = {};
|
|
531
|
-
objForEachKey$1(values, function (field, value) {
|
|
532
|
-
enumClass[field] = value;
|
|
533
|
-
if (!isUndefined(enumClass[value])) {
|
|
534
|
-
throwError("[" + value + "] exists for " + field);
|
|
535
|
-
}
|
|
536
|
-
enumClass[value] = field;
|
|
537
|
-
});
|
|
538
|
-
return objFreeze(enumClass);
|
|
539
|
-
}
|
|
540
|
-
function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
|
|
541
|
-
var theArgs = arguments;
|
|
542
|
-
var extended = theArgs[0] || {};
|
|
543
|
-
var argLen = theArgs.length;
|
|
544
|
-
var deep = false;
|
|
545
|
-
var idx = 1;
|
|
546
|
-
if (argLen > 0 && isBoolean(extended)) {
|
|
547
|
-
deep = extended;
|
|
548
|
-
extended = theArgs[idx] || {};
|
|
549
|
-
idx++;
|
|
550
|
-
}
|
|
551
|
-
if (!isObject(extended)) {
|
|
552
|
-
extended = {};
|
|
553
|
-
}
|
|
554
|
-
for (; idx < argLen; idx++) {
|
|
555
|
-
var arg = theArgs[idx];
|
|
556
|
-
var isArgArray = isArray(arg);
|
|
557
|
-
var isArgObj = isObject(arg);
|
|
558
|
-
for (var prop in arg) {
|
|
559
|
-
var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
|
|
560
|
-
if (!propOk) {
|
|
561
|
-
continue;
|
|
562
|
-
}
|
|
563
|
-
var newValue = arg[prop];
|
|
564
|
-
var isNewArray = void 0;
|
|
565
|
-
if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
|
|
566
|
-
var clone = extended[prop];
|
|
567
|
-
if (isNewArray) {
|
|
568
|
-
if (!isArray(clone)) {
|
|
569
|
-
clone = [];
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
else if (!isPlainObject(clone)) {
|
|
573
|
-
clone = {};
|
|
574
|
-
}
|
|
575
|
-
newValue = objExtend(deep, clone, newValue);
|
|
576
|
-
}
|
|
577
|
-
if (newValue !== undefined) {
|
|
578
|
-
extended[prop] = newValue;
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
return extended;
|
|
583
|
-
}
|
|
584
510
|
|
|
585
511
|
var strWindow = "window";
|
|
586
|
-
var strNavigator = "navigator";
|
|
587
512
|
var strConsole = "console";
|
|
588
513
|
var strJSON = "JSON";
|
|
589
|
-
var strCrypto = "crypto";
|
|
590
|
-
var strMsCrypto = "msCrypto";
|
|
591
|
-
var strMsie = "msie";
|
|
592
|
-
var strTrident = "trident/";
|
|
593
|
-
var _isTrident = null;
|
|
594
|
-
var _navUserAgentCheck = null;
|
|
595
514
|
function getGlobalInst(name) {
|
|
596
515
|
var gbl = getGlobal();
|
|
597
516
|
if (gbl && gbl[name]) {
|
|
@@ -605,15 +524,6 @@
|
|
|
605
524
|
function hasWindow() {
|
|
606
525
|
return Boolean(typeof window === strShimObject && window);
|
|
607
526
|
}
|
|
608
|
-
function hasNavigator() {
|
|
609
|
-
return Boolean(typeof navigator === strShimObject && navigator);
|
|
610
|
-
}
|
|
611
|
-
function getNavigator() {
|
|
612
|
-
if (hasNavigator()) {
|
|
613
|
-
return navigator;
|
|
614
|
-
}
|
|
615
|
-
return getGlobalInst(strNavigator);
|
|
616
|
-
}
|
|
617
527
|
function getConsole() {
|
|
618
528
|
if (typeof console !== strShimUndefined) {
|
|
619
529
|
return console;
|
|
@@ -629,24 +539,9 @@
|
|
|
629
539
|
}
|
|
630
540
|
return null;
|
|
631
541
|
}
|
|
632
|
-
function getCrypto() {
|
|
633
|
-
return getGlobalInst(strCrypto);
|
|
634
|
-
}
|
|
635
|
-
function getMsCrypto() {
|
|
636
|
-
return getGlobalInst(strMsCrypto);
|
|
637
|
-
}
|
|
638
|
-
function isIE() {
|
|
639
|
-
var nav = getNavigator();
|
|
640
|
-
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
641
|
-
_navUserAgentCheck = nav.userAgent;
|
|
642
|
-
var userAgent = (_navUserAgentCheck || strEmpty).toLowerCase();
|
|
643
|
-
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
644
|
-
}
|
|
645
|
-
return _isTrident;
|
|
646
|
-
}
|
|
647
542
|
function dumpObj(object) {
|
|
648
543
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
649
|
-
var propertyValueDump =
|
|
544
|
+
var propertyValueDump = "";
|
|
650
545
|
if (objectTypeDump === "[object Error]") {
|
|
651
546
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
652
547
|
}
|
|
@@ -679,9 +574,9 @@
|
|
|
679
574
|
var strWarnToConsole = "warnToConsole";
|
|
680
575
|
function _sanitizeDiagnosticText(text) {
|
|
681
576
|
if (text) {
|
|
682
|
-
return "\"" + text.replace(/\"/g,
|
|
577
|
+
return "\"" + text.replace(/\"/g, "") + "\"";
|
|
683
578
|
}
|
|
684
|
-
return
|
|
579
|
+
return "";
|
|
685
580
|
}
|
|
686
581
|
function _logToConsole(func, message) {
|
|
687
582
|
var theConsole = getConsole();
|
|
@@ -703,12 +598,12 @@
|
|
|
703
598
|
_self.message =
|
|
704
599
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
705
600
|
msgId;
|
|
706
|
-
var strProps =
|
|
601
|
+
var strProps = "";
|
|
707
602
|
if (hasJSON()) {
|
|
708
603
|
strProps = getJSON().stringify(properties);
|
|
709
604
|
}
|
|
710
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
711
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
605
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : "") +
|
|
606
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : "");
|
|
712
607
|
_self.message += diagnosticText;
|
|
713
608
|
}
|
|
714
609
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -735,10 +630,10 @@
|
|
|
735
630
|
if (isUserAct === void 0) { isUserAct = false; }
|
|
736
631
|
var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
|
|
737
632
|
if (_self.enableDebugExceptions()) {
|
|
738
|
-
throw message;
|
|
633
|
+
throw dumpObj(message);
|
|
739
634
|
}
|
|
740
635
|
else {
|
|
741
|
-
var logFunc = severity ===
|
|
636
|
+
var logFunc = severity === LoggingSeverity.CRITICAL ? strErrorToConsole : strWarnToConsole;
|
|
742
637
|
if (!isUndefined(message.message)) {
|
|
743
638
|
var logLevel = _self.consoleLoggingLevel();
|
|
744
639
|
if (isUserAct) {
|
|
@@ -756,7 +651,7 @@
|
|
|
756
651
|
_self.logInternalMessage(severity, message);
|
|
757
652
|
}
|
|
758
653
|
else {
|
|
759
|
-
_debugExtMsg("throw" + (severity ===
|
|
654
|
+
_debugExtMsg("throw" + (severity === LoggingSeverity.CRITICAL ? "Critical" : "Warning"), message);
|
|
760
655
|
}
|
|
761
656
|
}
|
|
762
657
|
};
|
|
@@ -788,13 +683,13 @@
|
|
|
788
683
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
789
684
|
_self.queue.push(message);
|
|
790
685
|
_messageCount++;
|
|
791
|
-
_debugExtMsg((severity ===
|
|
686
|
+
_debugExtMsg((severity === LoggingSeverity.CRITICAL ? "error" : "warn"), message);
|
|
792
687
|
}
|
|
793
688
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
794
689
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
795
|
-
var throttleMessage = new _InternalLogMessage(
|
|
690
|
+
var throttleMessage = new _InternalLogMessage(_InternalMessageId.MessageLimitPerPVExceeded, throttleLimitMessage, false);
|
|
796
691
|
_self.queue.push(throttleMessage);
|
|
797
|
-
if (severity ===
|
|
692
|
+
if (severity === LoggingSeverity.CRITICAL) {
|
|
798
693
|
_self.errorToConsole(throttleLimitMessage);
|
|
799
694
|
}
|
|
800
695
|
else {
|
|
@@ -823,10 +718,6 @@
|
|
|
823
718
|
}
|
|
824
719
|
return DiagnosticLogger;
|
|
825
720
|
}());
|
|
826
|
-
function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
|
|
827
|
-
if (isUserAct === void 0) { isUserAct = false; }
|
|
828
|
-
(logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
|
|
829
|
-
}
|
|
830
721
|
|
|
831
722
|
var strExecutionContextKey = "ctx";
|
|
832
723
|
var PerfEvent = /** @class */ (function () {
|
|
@@ -940,616 +831,207 @@
|
|
|
940
831
|
return func();
|
|
941
832
|
}
|
|
942
833
|
|
|
943
|
-
var
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
function random32(signed) {
|
|
965
|
-
var value = 0;
|
|
966
|
-
var c = getCrypto() || getMsCrypto();
|
|
967
|
-
if (c && c.getRandomValues) {
|
|
968
|
-
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
969
|
-
}
|
|
970
|
-
if (value === 0 && isIE()) {
|
|
971
|
-
if (!_mwcSeeded) {
|
|
972
|
-
_autoSeedMwc();
|
|
973
|
-
}
|
|
974
|
-
value = mwcRandom32() & MaxUInt32;
|
|
975
|
-
}
|
|
976
|
-
if (value === 0) {
|
|
977
|
-
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
978
|
-
}
|
|
979
|
-
if (!signed) {
|
|
980
|
-
value >>>= 0;
|
|
981
|
-
}
|
|
982
|
-
return value;
|
|
983
|
-
}
|
|
984
|
-
function mwcRandom32(signed) {
|
|
985
|
-
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
986
|
-
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
987
|
-
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
988
|
-
if (!signed) {
|
|
989
|
-
value >>>= 0;
|
|
990
|
-
}
|
|
991
|
-
return value;
|
|
992
|
-
}
|
|
993
|
-
function newId(maxLength) {
|
|
994
|
-
if (maxLength === void 0) { maxLength = 22; }
|
|
995
|
-
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
996
|
-
var number = random32() >>> 0;
|
|
997
|
-
var chars = 0;
|
|
998
|
-
var result = strEmpty;
|
|
999
|
-
while (result.length < maxLength) {
|
|
1000
|
-
chars++;
|
|
1001
|
-
result += base64chars.charAt(number & 0x3F);
|
|
1002
|
-
number >>>= 6;
|
|
1003
|
-
if (chars === 5) {
|
|
1004
|
-
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1005
|
-
chars = 0;
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
return result;
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
1012
|
-
var version = "2.7.5-nightly.2204-03";
|
|
1013
|
-
var instanceName = "." + newId(6);
|
|
1014
|
-
var _dataUid = 0;
|
|
1015
|
-
function _createAccessor(target, prop, value) {
|
|
1016
|
-
if (_objDefineProperty) {
|
|
1017
|
-
try {
|
|
1018
|
-
_objDefineProperty(target, prop, {
|
|
1019
|
-
value: value,
|
|
1020
|
-
enumerable: false,
|
|
1021
|
-
configurable: true
|
|
1022
|
-
});
|
|
1023
|
-
return true;
|
|
1024
|
-
}
|
|
1025
|
-
catch (e) {
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
return false;
|
|
1029
|
-
}
|
|
1030
|
-
function _canAcceptData(target) {
|
|
1031
|
-
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1032
|
-
}
|
|
1033
|
-
function _getCache(data, target) {
|
|
1034
|
-
var theCache = target[data.id];
|
|
1035
|
-
if (!theCache) {
|
|
1036
|
-
theCache = {};
|
|
1037
|
-
try {
|
|
1038
|
-
if (_canAcceptData(target)) {
|
|
1039
|
-
if (!_createAccessor(target, data.id, theCache)) {
|
|
1040
|
-
target[data.id] = theCache;
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
catch (e) {
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
return theCache;
|
|
1048
|
-
}
|
|
1049
|
-
function createUniqueNamespace(name, includeVersion) {
|
|
1050
|
-
if (includeVersion === void 0) { includeVersion = false; }
|
|
1051
|
-
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1052
|
-
}
|
|
1053
|
-
function createElmNodeData(name) {
|
|
1054
|
-
var data = {
|
|
1055
|
-
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1056
|
-
accept: function (target) {
|
|
1057
|
-
return _canAcceptData(target);
|
|
1058
|
-
},
|
|
1059
|
-
get: function (target, name, defValue, addDefault) {
|
|
1060
|
-
var theCache = target[data.id];
|
|
1061
|
-
if (!theCache) {
|
|
1062
|
-
if (addDefault) {
|
|
1063
|
-
theCache = _getCache(data, target);
|
|
1064
|
-
theCache[normalizeJsName(name)] = defValue;
|
|
1065
|
-
}
|
|
1066
|
-
return defValue;
|
|
1067
|
-
}
|
|
1068
|
-
return theCache[normalizeJsName(name)];
|
|
1069
|
-
},
|
|
1070
|
-
kill: function (target, name) {
|
|
1071
|
-
if (target && target[name]) {
|
|
1072
|
-
try {
|
|
1073
|
-
delete target[name];
|
|
1074
|
-
}
|
|
1075
|
-
catch (e) {
|
|
1076
|
-
}
|
|
834
|
+
var TelemetryPluginChain = /** @class */ (function () {
|
|
835
|
+
function TelemetryPluginChain(plugin, defItemCtx) {
|
|
836
|
+
var _self = this;
|
|
837
|
+
var _nextProxy = null;
|
|
838
|
+
var _hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
839
|
+
var _hasSetNext = isFunction(plugin.setNextPlugin);
|
|
840
|
+
_self._hasRun = false;
|
|
841
|
+
_self.getPlugin = function () {
|
|
842
|
+
return plugin;
|
|
843
|
+
};
|
|
844
|
+
_self.getNext = function () {
|
|
845
|
+
return _nextProxy;
|
|
846
|
+
};
|
|
847
|
+
_self.setNext = function (nextPlugin) {
|
|
848
|
+
_nextProxy = nextPlugin;
|
|
849
|
+
};
|
|
850
|
+
_self.processTelemetry = function (env, itemCtx) {
|
|
851
|
+
if (!itemCtx) {
|
|
852
|
+
itemCtx = defItemCtx;
|
|
1077
853
|
}
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
var pluginStateData = createElmNodeData("plugin");
|
|
1084
|
-
function _getPluginState(plugin) {
|
|
1085
|
-
return pluginStateData.get(plugin, "state", {}, true);
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1089
|
-
var strHasRunFlags = "_hasRun";
|
|
1090
|
-
var strGetTelCtx = "_getTelCtx";
|
|
1091
|
-
var _chainId = 0;
|
|
1092
|
-
function _getNextProxyStart(proxy, config, core, startAt) {
|
|
1093
|
-
while (proxy) {
|
|
1094
|
-
if (proxy.getPlugin() === startAt) {
|
|
1095
|
-
return proxy;
|
|
1096
|
-
}
|
|
1097
|
-
proxy = proxy.getNext();
|
|
1098
|
-
}
|
|
1099
|
-
return createTelemetryProxyChain([startAt], config, core);
|
|
1100
|
-
}
|
|
1101
|
-
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1102
|
-
var _nextProxy = null;
|
|
1103
|
-
var _onComplete = [];
|
|
1104
|
-
if (startAt !== null) {
|
|
1105
|
-
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1106
|
-
}
|
|
1107
|
-
var context = {
|
|
1108
|
-
_next: _moveNext,
|
|
1109
|
-
ctx: {
|
|
1110
|
-
core: function () {
|
|
1111
|
-
return core;
|
|
1112
|
-
},
|
|
1113
|
-
diagLog: function () {
|
|
1114
|
-
return safeGetLogger(core, config);
|
|
1115
|
-
},
|
|
1116
|
-
getCfg: function () {
|
|
1117
|
-
return config;
|
|
1118
|
-
},
|
|
1119
|
-
getExtCfg: _getExtCfg,
|
|
1120
|
-
getConfig: _getConfig,
|
|
1121
|
-
hasNext: function () {
|
|
1122
|
-
return !!_nextProxy;
|
|
1123
|
-
},
|
|
1124
|
-
getNext: function () {
|
|
1125
|
-
return _nextProxy;
|
|
1126
|
-
},
|
|
1127
|
-
setNext: function (nextPlugin) {
|
|
1128
|
-
_nextProxy = nextPlugin;
|
|
1129
|
-
},
|
|
1130
|
-
iterate: _iterateChain,
|
|
1131
|
-
onComplete: _addOnComplete
|
|
1132
|
-
}
|
|
1133
|
-
};
|
|
1134
|
-
function _addOnComplete(onComplete, that) {
|
|
1135
|
-
var args = [];
|
|
1136
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1137
|
-
args[_i - 2] = arguments[_i];
|
|
1138
|
-
}
|
|
1139
|
-
if (onComplete) {
|
|
1140
|
-
_onComplete.push({
|
|
1141
|
-
func: onComplete,
|
|
1142
|
-
self: !isUndefined(that) ? that : context.ctx,
|
|
1143
|
-
args: args
|
|
1144
|
-
});
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
function _moveNext() {
|
|
1148
|
-
var nextProxy = _nextProxy;
|
|
1149
|
-
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1150
|
-
if (!nextProxy) {
|
|
1151
|
-
var onComplete = _onComplete;
|
|
1152
|
-
if (onComplete && onComplete.length > 0) {
|
|
1153
|
-
arrForEach(onComplete, function (completeDetails) {
|
|
854
|
+
var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
|
|
855
|
+
doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
|
|
856
|
+
if (plugin && _hasProcessTelemetry) {
|
|
857
|
+
_self._hasRun = true;
|
|
1154
858
|
try {
|
|
1155
|
-
|
|
859
|
+
itemCtx.setNext(_nextProxy);
|
|
860
|
+
if (_hasSetNext) {
|
|
861
|
+
plugin.setNextPlugin(_nextProxy);
|
|
862
|
+
}
|
|
863
|
+
_nextProxy && (_nextProxy._hasRun = false);
|
|
864
|
+
plugin.processTelemetry(env, itemCtx);
|
|
1156
865
|
}
|
|
1157
|
-
catch (
|
|
1158
|
-
|
|
866
|
+
catch (error) {
|
|
867
|
+
var hasRun = _nextProxy && _nextProxy._hasRun;
|
|
868
|
+
if (!_nextProxy || !hasRun) {
|
|
869
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
|
|
870
|
+
}
|
|
871
|
+
if (_nextProxy && !hasRun) {
|
|
872
|
+
_nextProxy.processTelemetry(env, itemCtx);
|
|
873
|
+
}
|
|
1159
874
|
}
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
875
|
+
}
|
|
876
|
+
else if (_nextProxy) {
|
|
877
|
+
_self._hasRun = true;
|
|
878
|
+
_nextProxy.processTelemetry(env, itemCtx);
|
|
879
|
+
}
|
|
880
|
+
}, function () { return ({ item: env }); }, !(env.sync));
|
|
881
|
+
};
|
|
1165
882
|
}
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
if (mergeDefault !== 0 ) {
|
|
1181
|
-
var newConfig_1 = objExtend(true, defaultValue, theConfig);
|
|
1182
|
-
if (config && mergeDefault === 2 ) {
|
|
1183
|
-
objForEachKey$1(defaultValue, function (field) {
|
|
1184
|
-
if (isNullOrUndefined(newConfig_1[field])) {
|
|
1185
|
-
var cfgValue = config[field];
|
|
1186
|
-
if (!isNullOrUndefined(cfgValue)) {
|
|
1187
|
-
newConfig_1[field] = cfgValue;
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
});
|
|
883
|
+
return TelemetryPluginChain;
|
|
884
|
+
}());
|
|
885
|
+
|
|
886
|
+
function _createProxyChain(plugins, itemCtx) {
|
|
887
|
+
var proxies = [];
|
|
888
|
+
if (plugins && plugins.length > 0) {
|
|
889
|
+
var lastProxy = null;
|
|
890
|
+
for (var idx = 0; idx < plugins.length; idx++) {
|
|
891
|
+
var thePlugin = plugins[idx];
|
|
892
|
+
if (thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
893
|
+
var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
|
|
894
|
+
proxies.push(newProxy);
|
|
895
|
+
if (lastProxy) {
|
|
896
|
+
lastProxy.setNext(newProxy);
|
|
1191
897
|
}
|
|
898
|
+
lastProxy = newProxy;
|
|
1192
899
|
}
|
|
1193
900
|
}
|
|
1194
|
-
return theConfig;
|
|
1195
901
|
}
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
}
|
|
1208
|
-
function _iterateChain(cb) {
|
|
1209
|
-
var nextPlugin;
|
|
1210
|
-
while (!!(nextPlugin = context._next())) {
|
|
1211
|
-
var plugin = nextPlugin.getPlugin();
|
|
1212
|
-
if (plugin) {
|
|
1213
|
-
cb(plugin);
|
|
902
|
+
return proxies.length > 0 ? proxies[0] : null;
|
|
903
|
+
}
|
|
904
|
+
function _copyProxyChain(proxy, itemCtx, startAt) {
|
|
905
|
+
var plugins = [];
|
|
906
|
+
var add = startAt ? false : true;
|
|
907
|
+
if (proxy) {
|
|
908
|
+
while (proxy) {
|
|
909
|
+
var thePlugin = proxy.getPlugin();
|
|
910
|
+
if (add || thePlugin === startAt) {
|
|
911
|
+
add = true;
|
|
912
|
+
plugins.push(thePlugin);
|
|
1214
913
|
}
|
|
914
|
+
proxy = proxy.getNext();
|
|
1215
915
|
}
|
|
1216
916
|
}
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1220
|
-
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1221
|
-
var context = internalContext.ctx;
|
|
1222
|
-
function _processNext(env) {
|
|
1223
|
-
var nextPlugin = internalContext._next();
|
|
1224
|
-
nextPlugin && nextPlugin.processTelemetry(env, context);
|
|
1225
|
-
return !nextPlugin;
|
|
1226
|
-
}
|
|
1227
|
-
function _createNew(plugins, startAt) {
|
|
1228
|
-
if (plugins === void 0) { plugins = null; }
|
|
1229
|
-
if (isArray(plugins)) {
|
|
1230
|
-
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1231
|
-
}
|
|
1232
|
-
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
917
|
+
if (!add) {
|
|
918
|
+
plugins.push(startAt);
|
|
1233
919
|
}
|
|
1234
|
-
|
|
1235
|
-
context.createNew = _createNew;
|
|
1236
|
-
return context;
|
|
920
|
+
return _createProxyChain(plugins, itemCtx);
|
|
1237
921
|
}
|
|
1238
|
-
function
|
|
1239
|
-
var
|
|
1240
|
-
var
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
if (plugins === void 0) { plugins = null; }
|
|
1248
|
-
if (isArray(plugins)) {
|
|
1249
|
-
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1250
|
-
}
|
|
1251
|
-
return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
|
|
1252
|
-
}
|
|
1253
|
-
context.processNext = _processNext;
|
|
1254
|
-
context.createNew = _createNew;
|
|
1255
|
-
return context;
|
|
1256
|
-
}
|
|
1257
|
-
function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
|
|
1258
|
-
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1259
|
-
var context = internalContext.ctx;
|
|
1260
|
-
function _processNext(updateState) {
|
|
1261
|
-
return context.iterate(function (plugin) {
|
|
1262
|
-
if (isFunction(plugin[strUpdate])) {
|
|
1263
|
-
plugin[strUpdate](context, updateState);
|
|
922
|
+
function _copyPluginChain(srcPlugins, itemCtx, startAt) {
|
|
923
|
+
var plugins = srcPlugins;
|
|
924
|
+
var add = false;
|
|
925
|
+
if (startAt && srcPlugins) {
|
|
926
|
+
plugins = [];
|
|
927
|
+
arrForEach(srcPlugins, function (thePlugin) {
|
|
928
|
+
if (add || thePlugin === startAt) {
|
|
929
|
+
add = true;
|
|
930
|
+
plugins.push(thePlugin);
|
|
1264
931
|
}
|
|
1265
932
|
});
|
|
1266
933
|
}
|
|
1267
|
-
|
|
1268
|
-
if (plugins
|
|
1269
|
-
|
|
1270
|
-
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
934
|
+
if (startAt && !add) {
|
|
935
|
+
if (!plugins) {
|
|
936
|
+
plugins = [];
|
|
1271
937
|
}
|
|
1272
|
-
|
|
938
|
+
plugins.push(startAt);
|
|
1273
939
|
}
|
|
1274
|
-
|
|
1275
|
-
context.createNew = _createNew;
|
|
1276
|
-
return context;
|
|
940
|
+
return _createProxyChain(plugins, itemCtx);
|
|
1277
941
|
}
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
add = true;
|
|
942
|
+
var ProcessTelemetryContext = /** @class */ (function () {
|
|
943
|
+
function ProcessTelemetryContext(plugins, config, core, startAt) {
|
|
944
|
+
var _self = this;
|
|
945
|
+
var _nextProxy = null;
|
|
946
|
+
if (startAt !== null) {
|
|
947
|
+
if (plugins && isFunction(plugins.getPlugin)) {
|
|
948
|
+
_nextProxy = _copyProxyChain(plugins, _self, startAt || plugins.getPlugin());
|
|
1286
949
|
}
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
firstProxy = newProxy;
|
|
950
|
+
else {
|
|
951
|
+
if (startAt) {
|
|
952
|
+
_nextProxy = _copyPluginChain(plugins, _self, startAt);
|
|
1291
953
|
}
|
|
1292
|
-
if (
|
|
1293
|
-
|
|
954
|
+
else if (isUndefined(startAt)) {
|
|
955
|
+
_nextProxy = _createProxyChain(plugins, _self);
|
|
1294
956
|
}
|
|
1295
|
-
lastProxy_1 = newProxy;
|
|
1296
957
|
}
|
|
1297
|
-
});
|
|
1298
|
-
}
|
|
1299
|
-
if (startAt && !firstProxy) {
|
|
1300
|
-
return createTelemetryProxyChain([startAt], config, core);
|
|
1301
|
-
}
|
|
1302
|
-
return firstProxy;
|
|
1303
|
-
}
|
|
1304
|
-
function createTelemetryPluginProxy(plugin, config, core) {
|
|
1305
|
-
var nextProxy = null;
|
|
1306
|
-
var hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1307
|
-
var hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1308
|
-
var chainId;
|
|
1309
|
-
if (plugin) {
|
|
1310
|
-
chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
|
|
1311
|
-
}
|
|
1312
|
-
else {
|
|
1313
|
-
chainId = "Unknown-0-" + _chainId++;
|
|
1314
|
-
}
|
|
1315
|
-
var proxyChain = {
|
|
1316
|
-
getPlugin: function () {
|
|
1317
|
-
return plugin;
|
|
1318
|
-
},
|
|
1319
|
-
getNext: function () {
|
|
1320
|
-
return nextProxy;
|
|
1321
|
-
},
|
|
1322
|
-
processTelemetry: _processTelemetry,
|
|
1323
|
-
unload: _unloadPlugin,
|
|
1324
|
-
update: _updatePlugin,
|
|
1325
|
-
_id: chainId,
|
|
1326
|
-
_setNext: function (nextPlugin) {
|
|
1327
|
-
nextProxy = nextPlugin;
|
|
1328
|
-
}
|
|
1329
|
-
};
|
|
1330
|
-
function _getTelCtx() {
|
|
1331
|
-
var itemCtx;
|
|
1332
|
-
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1333
|
-
itemCtx = plugin[strGetTelCtx]();
|
|
1334
958
|
}
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
try {
|
|
1352
|
-
var nextId = nextProxy ? nextProxy._id : strEmpty;
|
|
1353
|
-
if (nextId) {
|
|
1354
|
-
hasRunContext[nextId] = false;
|
|
1355
|
-
}
|
|
1356
|
-
hasRun = processPluginFn(itemCtx);
|
|
1357
|
-
}
|
|
1358
|
-
catch (error) {
|
|
1359
|
-
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
1360
|
-
if (hasNextRun) {
|
|
1361
|
-
hasRun = true;
|
|
1362
|
-
}
|
|
1363
|
-
if (!nextProxy || !hasNextRun) {
|
|
1364
|
-
_throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1365
|
-
}
|
|
959
|
+
_self.core = function () {
|
|
960
|
+
return core;
|
|
961
|
+
};
|
|
962
|
+
_self.diagLog = function () {
|
|
963
|
+
return safeGetLogger(core, config);
|
|
964
|
+
};
|
|
965
|
+
_self.getCfg = function () {
|
|
966
|
+
return config;
|
|
967
|
+
};
|
|
968
|
+
_self.getExtCfg = function (identifier, defaultValue) {
|
|
969
|
+
if (defaultValue === void 0) { defaultValue = {}; }
|
|
970
|
+
var theConfig;
|
|
971
|
+
if (config) {
|
|
972
|
+
var extConfig = config.extensionConfig;
|
|
973
|
+
if (extConfig && identifier) {
|
|
974
|
+
theConfig = extConfig[identifier];
|
|
1366
975
|
}
|
|
1367
|
-
}, details, isAsync);
|
|
1368
|
-
}
|
|
1369
|
-
return hasRun;
|
|
1370
|
-
}
|
|
1371
|
-
function _processTelemetry(env, itemCtx) {
|
|
1372
|
-
itemCtx = itemCtx || _getTelCtx();
|
|
1373
|
-
function _callProcessTelemetry(itemCtx) {
|
|
1374
|
-
if (!plugin || !hasProcessTelemetry) {
|
|
1375
|
-
return false;
|
|
1376
|
-
}
|
|
1377
|
-
var pluginState = _getPluginState(plugin);
|
|
1378
|
-
if (pluginState[strTeardown] || pluginState[strDisabled]) {
|
|
1379
|
-
return false;
|
|
1380
976
|
}
|
|
1381
|
-
|
|
1382
|
-
|
|
977
|
+
return (theConfig ? theConfig : defaultValue);
|
|
978
|
+
};
|
|
979
|
+
_self.getConfig = function (identifier, field, defaultValue) {
|
|
980
|
+
if (defaultValue === void 0) { defaultValue = false; }
|
|
981
|
+
var theValue;
|
|
982
|
+
var extConfig = _self.getExtCfg(identifier, null);
|
|
983
|
+
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
984
|
+
theValue = extConfig[field];
|
|
1383
985
|
}
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
}
|
|
1387
|
-
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
1388
|
-
itemCtx.processNext(env);
|
|
1389
|
-
}
|
|
1390
|
-
}
|
|
1391
|
-
function _unloadPlugin(unloadCtx, unloadState) {
|
|
1392
|
-
function _callTeardown() {
|
|
1393
|
-
var hasRun = false;
|
|
1394
|
-
if (plugin) {
|
|
1395
|
-
var pluginState = _getPluginState(plugin);
|
|
1396
|
-
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1397
|
-
if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1398
|
-
pluginState[strCore] = null;
|
|
1399
|
-
pluginState[strTeardown] = true;
|
|
1400
|
-
pluginState[strIsInitialized] = false;
|
|
1401
|
-
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1402
|
-
hasRun = true;
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
986
|
+
else if (config && !isNullOrUndefined(config[field])) {
|
|
987
|
+
theValue = config[field];
|
|
1405
988
|
}
|
|
1406
|
-
return
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
}
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
}
|
|
989
|
+
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
990
|
+
};
|
|
991
|
+
_self.hasNext = function () {
|
|
992
|
+
return _nextProxy != null;
|
|
993
|
+
};
|
|
994
|
+
_self.getNext = function () {
|
|
995
|
+
return _nextProxy;
|
|
996
|
+
};
|
|
997
|
+
_self.setNext = function (nextPlugin) {
|
|
998
|
+
_nextProxy = nextPlugin;
|
|
999
|
+
};
|
|
1000
|
+
_self.processNext = function (env) {
|
|
1001
|
+
var nextPlugin = _nextProxy;
|
|
1002
|
+
if (nextPlugin) {
|
|
1003
|
+
_nextProxy = nextPlugin.getNext();
|
|
1004
|
+
nextPlugin.processTelemetry(env, _self);
|
|
1423
1005
|
}
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
}
|
|
1006
|
+
};
|
|
1007
|
+
_self.createNew = function (plugins, startAt) {
|
|
1008
|
+
if (plugins === void 0) { plugins = null; }
|
|
1009
|
+
return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1010
|
+
};
|
|
1429
1011
|
}
|
|
1430
|
-
return
|
|
1431
|
-
}
|
|
1012
|
+
return ProcessTelemetryContext;
|
|
1013
|
+
}());
|
|
1432
1014
|
|
|
1433
1015
|
var strExtensionConfig = "extensionConfig";
|
|
1434
1016
|
|
|
1435
|
-
function createUnloadHandlerContainer() {
|
|
1436
|
-
var handlers = [];
|
|
1437
|
-
function _addHandler(handler) {
|
|
1438
|
-
if (handler) {
|
|
1439
|
-
handlers.push(handler);
|
|
1440
|
-
}
|
|
1441
|
-
}
|
|
1442
|
-
function _runHandlers(unloadCtx, unloadState) {
|
|
1443
|
-
arrForEach(handlers, function (handler) {
|
|
1444
|
-
try {
|
|
1445
|
-
handler(unloadCtx, unloadState);
|
|
1446
|
-
}
|
|
1447
|
-
catch (e) {
|
|
1448
|
-
_throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
1449
|
-
}
|
|
1450
|
-
});
|
|
1451
|
-
handlers = [];
|
|
1452
|
-
}
|
|
1453
|
-
return {
|
|
1454
|
-
add: _addHandler,
|
|
1455
|
-
run: _runHandlers
|
|
1456
|
-
};
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
1017
|
var strGetPlugin = "getPlugin";
|
|
1460
1018
|
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
1461
1019
|
function BaseTelemetryPlugin() {
|
|
1462
1020
|
var _self = this;
|
|
1463
|
-
var _isinitialized;
|
|
1464
|
-
var _rootCtx;
|
|
1465
|
-
var _nextPlugin;
|
|
1466
|
-
|
|
1467
|
-
var _hooks;
|
|
1468
|
-
_initDefaults();
|
|
1469
|
-
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
1470
|
-
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
1471
|
-
_setDefaults(config, core, pluginChain);
|
|
1472
|
-
_isinitialized = true;
|
|
1473
|
-
};
|
|
1474
|
-
_self.teardown = function (unloadCtx, unloadState) {
|
|
1475
|
-
if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
|
|
1476
|
-
return;
|
|
1477
|
-
}
|
|
1478
|
-
var result;
|
|
1479
|
-
var unloadDone = false;
|
|
1480
|
-
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1481
|
-
var theUnloadState = unloadState || {
|
|
1482
|
-
reason: 0 ,
|
|
1483
|
-
isAsync: false
|
|
1484
|
-
};
|
|
1485
|
-
function _unloadCallback() {
|
|
1486
|
-
if (!unloadDone) {
|
|
1487
|
-
unloadDone = true;
|
|
1488
|
-
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
1489
|
-
arrForEach(_hooks, function (fn) {
|
|
1490
|
-
fn.rm();
|
|
1491
|
-
});
|
|
1492
|
-
_hooks = [];
|
|
1493
|
-
if (result === true) {
|
|
1494
|
-
theUnloadCtx.processNext(theUnloadState);
|
|
1495
|
-
}
|
|
1496
|
-
_initDefaults();
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
1500
|
-
_unloadCallback();
|
|
1501
|
-
}
|
|
1502
|
-
else {
|
|
1503
|
-
result = true;
|
|
1504
|
-
}
|
|
1505
|
-
return result;
|
|
1506
|
-
};
|
|
1507
|
-
_self.update = function (updateCtx, updateState) {
|
|
1508
|
-
if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
|
|
1509
|
-
return;
|
|
1510
|
-
}
|
|
1511
|
-
var result;
|
|
1512
|
-
var updateDone = false;
|
|
1513
|
-
var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1514
|
-
var theUpdateState = updateState || {
|
|
1515
|
-
reason: 0
|
|
1516
|
-
};
|
|
1517
|
-
function _updateCallback() {
|
|
1518
|
-
if (!updateDone) {
|
|
1519
|
-
updateDone = true;
|
|
1520
|
-
_setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
|
|
1524
|
-
_updateCallback();
|
|
1525
|
-
}
|
|
1526
|
-
else {
|
|
1527
|
-
result = true;
|
|
1528
|
-
}
|
|
1529
|
-
return result;
|
|
1530
|
-
};
|
|
1531
|
-
_self._addHook = function (hooks) {
|
|
1532
|
-
if (hooks) {
|
|
1533
|
-
if (isArray(hooks)) {
|
|
1534
|
-
_hooks = _hooks.concat(hooks);
|
|
1535
|
-
}
|
|
1536
|
-
else {
|
|
1537
|
-
_hooks.push(hooks);
|
|
1538
|
-
}
|
|
1539
|
-
}
|
|
1540
|
-
};
|
|
1541
|
-
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
1542
|
-
});
|
|
1021
|
+
var _isinitialized = false;
|
|
1022
|
+
var _rootCtx = null;
|
|
1023
|
+
var _nextPlugin = null;
|
|
1024
|
+
_self.core = null;
|
|
1543
1025
|
_self.diagLog = function (itemCtx) {
|
|
1544
|
-
return _getTelCtx(itemCtx).diagLog();
|
|
1026
|
+
return _self._getTelCtx(itemCtx).diagLog();
|
|
1545
1027
|
};
|
|
1546
|
-
_self
|
|
1028
|
+
_self.isInitialized = function () {
|
|
1547
1029
|
return _isinitialized;
|
|
1548
1030
|
};
|
|
1549
1031
|
_self.setInitialized = function (isInitialized) {
|
|
1550
1032
|
_isinitialized = isInitialized;
|
|
1551
1033
|
};
|
|
1552
|
-
_self
|
|
1034
|
+
_self.setNextPlugin = function (next) {
|
|
1553
1035
|
_nextPlugin = next;
|
|
1554
1036
|
};
|
|
1555
1037
|
_self.processNext = function (env, itemCtx) {
|
|
@@ -1560,12 +1042,11 @@
|
|
|
1560
1042
|
_nextPlugin.processTelemetry(env, null);
|
|
1561
1043
|
}
|
|
1562
1044
|
};
|
|
1563
|
-
_self._getTelCtx =
|
|
1564
|
-
function _getTelCtx(currentCtx) {
|
|
1045
|
+
_self._getTelCtx = function (currentCtx) {
|
|
1565
1046
|
if (currentCtx === void 0) { currentCtx = null; }
|
|
1566
1047
|
var itemCtx = currentCtx;
|
|
1567
1048
|
if (!itemCtx) {
|
|
1568
|
-
var rootCtx = _rootCtx ||
|
|
1049
|
+
var rootCtx = _rootCtx || new ProcessTelemetryContext(null, {}, _self.core);
|
|
1569
1050
|
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1570
1051
|
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
1571
1052
|
}
|
|
@@ -1574,8 +1055,8 @@
|
|
|
1574
1055
|
}
|
|
1575
1056
|
}
|
|
1576
1057
|
return itemCtx;
|
|
1577
|
-
}
|
|
1578
|
-
function
|
|
1058
|
+
};
|
|
1059
|
+
_self._baseTelInit = function (config, core, extensions, pluginChain) {
|
|
1579
1060
|
if (config) {
|
|
1580
1061
|
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
1581
1062
|
}
|
|
@@ -1587,109 +1068,16 @@
|
|
|
1587
1068
|
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
1588
1069
|
}
|
|
1589
1070
|
_self.core = core;
|
|
1590
|
-
_rootCtx =
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
_isinitialized = false;
|
|
1594
|
-
_self.core = null;
|
|
1595
|
-
_rootCtx = null;
|
|
1596
|
-
_nextPlugin = null;
|
|
1597
|
-
_hooks = [];
|
|
1598
|
-
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
1599
|
-
}
|
|
1071
|
+
_rootCtx = new ProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
1072
|
+
_isinitialized = true;
|
|
1073
|
+
};
|
|
1600
1074
|
}
|
|
1075
|
+
BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
|
|
1076
|
+
this._baseTelInit(config, core, extensions, pluginChain);
|
|
1077
|
+
};
|
|
1601
1078
|
return BaseTelemetryPlugin;
|
|
1602
1079
|
}());
|
|
1603
1080
|
|
|
1604
|
-
var LoggingSeverity = createEnumStyle({
|
|
1605
|
-
CRITICAL: 1 ,
|
|
1606
|
-
WARNING: 2
|
|
1607
|
-
});
|
|
1608
|
-
var _InternalMessageId = createEnumStyle({
|
|
1609
|
-
BrowserDoesNotSupportLocalStorage: 0 ,
|
|
1610
|
-
BrowserCannotReadLocalStorage: 1 ,
|
|
1611
|
-
BrowserCannotReadSessionStorage: 2 ,
|
|
1612
|
-
BrowserCannotWriteLocalStorage: 3 ,
|
|
1613
|
-
BrowserCannotWriteSessionStorage: 4 ,
|
|
1614
|
-
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
1615
|
-
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
1616
|
-
CannotSendEmptyTelemetry: 7 ,
|
|
1617
|
-
ClientPerformanceMathError: 8 ,
|
|
1618
|
-
ErrorParsingAISessionCookie: 9 ,
|
|
1619
|
-
ErrorPVCalc: 10 ,
|
|
1620
|
-
ExceptionWhileLoggingError: 11 ,
|
|
1621
|
-
FailedAddingTelemetryToBuffer: 12 ,
|
|
1622
|
-
FailedMonitorAjaxAbort: 13 ,
|
|
1623
|
-
FailedMonitorAjaxDur: 14 ,
|
|
1624
|
-
FailedMonitorAjaxOpen: 15 ,
|
|
1625
|
-
FailedMonitorAjaxRSC: 16 ,
|
|
1626
|
-
FailedMonitorAjaxSend: 17 ,
|
|
1627
|
-
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
1628
|
-
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
1629
|
-
FailedToSendQueuedTelemetry: 20 ,
|
|
1630
|
-
FailedToReportDataLoss: 21 ,
|
|
1631
|
-
FlushFailed: 22 ,
|
|
1632
|
-
MessageLimitPerPVExceeded: 23 ,
|
|
1633
|
-
MissingRequiredFieldSpecification: 24 ,
|
|
1634
|
-
NavigationTimingNotSupported: 25 ,
|
|
1635
|
-
OnError: 26 ,
|
|
1636
|
-
SessionRenewalDateIsZero: 27 ,
|
|
1637
|
-
SenderNotInitialized: 28 ,
|
|
1638
|
-
StartTrackEventFailed: 29 ,
|
|
1639
|
-
StopTrackEventFailed: 30 ,
|
|
1640
|
-
StartTrackFailed: 31 ,
|
|
1641
|
-
StopTrackFailed: 32 ,
|
|
1642
|
-
TelemetrySampledAndNotSent: 33 ,
|
|
1643
|
-
TrackEventFailed: 34 ,
|
|
1644
|
-
TrackExceptionFailed: 35 ,
|
|
1645
|
-
TrackMetricFailed: 36 ,
|
|
1646
|
-
TrackPVFailed: 37 ,
|
|
1647
|
-
TrackPVFailedCalc: 38 ,
|
|
1648
|
-
TrackTraceFailed: 39 ,
|
|
1649
|
-
TransmissionFailed: 40 ,
|
|
1650
|
-
FailedToSetStorageBuffer: 41 ,
|
|
1651
|
-
FailedToRestoreStorageBuffer: 42 ,
|
|
1652
|
-
InvalidBackendResponse: 43 ,
|
|
1653
|
-
FailedToFixDepricatedValues: 44 ,
|
|
1654
|
-
InvalidDurationValue: 45 ,
|
|
1655
|
-
TelemetryEnvelopeInvalid: 46 ,
|
|
1656
|
-
CreateEnvelopeError: 47 ,
|
|
1657
|
-
CannotSerializeObject: 48 ,
|
|
1658
|
-
CannotSerializeObjectNonSerializable: 49 ,
|
|
1659
|
-
CircularReferenceDetected: 50 ,
|
|
1660
|
-
ClearAuthContextFailed: 51 ,
|
|
1661
|
-
ExceptionTruncated: 52 ,
|
|
1662
|
-
IllegalCharsInName: 53 ,
|
|
1663
|
-
ItemNotInArray: 54 ,
|
|
1664
|
-
MaxAjaxPerPVExceeded: 55 ,
|
|
1665
|
-
MessageTruncated: 56 ,
|
|
1666
|
-
NameTooLong: 57 ,
|
|
1667
|
-
SampleRateOutOfRange: 58 ,
|
|
1668
|
-
SetAuthContextFailed: 59 ,
|
|
1669
|
-
SetAuthContextFailedAccountName: 60 ,
|
|
1670
|
-
StringValueTooLong: 61 ,
|
|
1671
|
-
StartCalledMoreThanOnce: 62 ,
|
|
1672
|
-
StopCalledWithoutStart: 63 ,
|
|
1673
|
-
TelemetryInitializerFailed: 64 ,
|
|
1674
|
-
TrackArgumentsNotSpecified: 65 ,
|
|
1675
|
-
UrlTooLong: 66 ,
|
|
1676
|
-
SessionStorageBufferFull: 67 ,
|
|
1677
|
-
CannotAccessCookie: 68 ,
|
|
1678
|
-
IdTooLong: 69 ,
|
|
1679
|
-
InvalidEvent: 70 ,
|
|
1680
|
-
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
1681
|
-
SendBrowserInfoOnUserInit: 72 ,
|
|
1682
|
-
PluginException: 73 ,
|
|
1683
|
-
NotificationException: 74 ,
|
|
1684
|
-
SnippetScriptLoadFailure: 99 ,
|
|
1685
|
-
InvalidInstrumentationKey: 100 ,
|
|
1686
|
-
CannotParseAiBlobValue: 101 ,
|
|
1687
|
-
InvalidContentBlob: 102 ,
|
|
1688
|
-
TrackPageActionEventFailed: 103 ,
|
|
1689
|
-
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
1690
|
-
InMemoryStorageBufferFull: 105
|
|
1691
|
-
});
|
|
1692
|
-
|
|
1693
1081
|
var SeverityLevel;
|
|
1694
1082
|
(function (SeverityLevel) {
|
|
1695
1083
|
SeverityLevel[SeverityLevel["Verbose"] = 0] = "Verbose";
|
|
@@ -1733,12 +1121,11 @@
|
|
|
1733
1121
|
var _this = _super.call(this) || this;
|
|
1734
1122
|
_this.identifier = "AppInsightsReactNativePlugin";
|
|
1735
1123
|
_this.priority = 140;
|
|
1736
|
-
var _device;
|
|
1737
|
-
var _config;
|
|
1124
|
+
var _device = {};
|
|
1125
|
+
var _config = config || _getDefaultConfig();
|
|
1738
1126
|
var _analyticsPlugin;
|
|
1739
1127
|
var _defaultHandler;
|
|
1740
1128
|
dynamicProto(ReactNativePlugin, _this, function (_self, _base) {
|
|
1741
|
-
_initDefaults();
|
|
1742
1129
|
_self.initialize = function (config,
|
|
1743
1130
|
core, extensions) {
|
|
1744
1131
|
if (!_self.isInitialized()) {
|
|
@@ -1787,16 +1174,6 @@
|
|
|
1787
1174
|
_self.diagLog().warnToConsole("Failed to get DeviceInfo: " + getExceptionName(e) + " - " + dumpObj(e));
|
|
1788
1175
|
}
|
|
1789
1176
|
};
|
|
1790
|
-
_self._doTeardown = function (unloadCtx, unloadState, asyncCallback) {
|
|
1791
|
-
_resetGlobalErrorHandler();
|
|
1792
|
-
_initDefaults();
|
|
1793
|
-
};
|
|
1794
|
-
function _initDefaults() {
|
|
1795
|
-
_device = {};
|
|
1796
|
-
_config = config || _getDefaultConfig();
|
|
1797
|
-
_analyticsPlugin = null;
|
|
1798
|
-
_defaultHandler = null;
|
|
1799
|
-
}
|
|
1800
1177
|
function _applyDeviceContext(item) {
|
|
1801
1178
|
if (_device) {
|
|
1802
1179
|
item.ext = item.ext || {};
|
|
@@ -1822,15 +1199,9 @@
|
|
|
1822
1199
|
var _global = _getGlobal();
|
|
1823
1200
|
if (_global && _global.ErrorUtils) {
|
|
1824
1201
|
_defaultHandler = (typeof _global.ErrorUtils.getGlobalHandler === "function" && _global.ErrorUtils.getGlobalHandler()) || _global.ErrorUtils._globalHandler;
|
|
1825
|
-
_global.ErrorUtils.setGlobalHandler(_trackException);
|
|
1202
|
+
_global.ErrorUtils.setGlobalHandler(_trackException.bind(_this));
|
|
1826
1203
|
}
|
|
1827
1204
|
};
|
|
1828
|
-
function _resetGlobalErrorHandler() {
|
|
1829
|
-
var _global = _getGlobal();
|
|
1830
|
-
if (_global && _global.ErrorUtils && _global.ErrorUtils.getGlobalHandler() === _trackException) {
|
|
1831
|
-
_global.ErrorUtils.setGlobalHandler(_defaultHandler || null);
|
|
1832
|
-
}
|
|
1833
|
-
}
|
|
1834
1205
|
function _trackException(e, isFatal) {
|
|
1835
1206
|
var exception = { exception: e, severityLevel: SeverityLevel.Error };
|
|
1836
1207
|
if (_analyticsPlugin) {
|