@microsoft/applicationinsights-react-native 2.5.0-beta.2203-02 → 2.5.0-beta.2203-05
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 +133 -6
- 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.d.ts +1 -1
- package/dist/applicationinsights-react-native.js +133 -6
- 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 +1 -1
- package/dist-esm/index.js +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - React Native Plugin, 2.5.0-beta.2203-
|
|
2
|
+
* Application Insights JavaScript SDK - React Native Plugin, 2.5.0-beta.2203-05
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -331,6 +331,7 @@
|
|
|
331
331
|
var strIsInitialized = "isInitialized";
|
|
332
332
|
var strTeardown = "teardown";
|
|
333
333
|
var strCore = "core";
|
|
334
|
+
var strUpdate = "update";
|
|
334
335
|
var strDisabled = "disabled";
|
|
335
336
|
var strDoTeardown = "_doTeardown";
|
|
336
337
|
|
|
@@ -494,18 +495,45 @@
|
|
|
494
495
|
function throwError(message) {
|
|
495
496
|
throw new Error(message);
|
|
496
497
|
}
|
|
498
|
+
function _createProxyFunction(source, funcName) {
|
|
499
|
+
var srcFunc = null;
|
|
500
|
+
var src = null;
|
|
501
|
+
if (isFunction(source)) {
|
|
502
|
+
srcFunc = source;
|
|
503
|
+
}
|
|
504
|
+
else {
|
|
505
|
+
src = source;
|
|
506
|
+
}
|
|
507
|
+
return function () {
|
|
508
|
+
var originalArguments = arguments;
|
|
509
|
+
if (srcFunc) {
|
|
510
|
+
src = srcFunc();
|
|
511
|
+
}
|
|
512
|
+
if (src) {
|
|
513
|
+
return src[funcName].apply(src, originalArguments);
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
|
|
518
|
+
if (overwriteTarget === void 0) { overwriteTarget = true; }
|
|
519
|
+
if (target && name && source) {
|
|
520
|
+
if (overwriteTarget || isUndefined(target[name])) {
|
|
521
|
+
target[name] = _createProxyFunction(source, theFunc);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
497
525
|
function createEnumStyle(values) {
|
|
498
526
|
var enumClass = {};
|
|
499
527
|
objForEachKey$1(values, function (field, value) {
|
|
500
528
|
enumClass[field] = value;
|
|
501
529
|
if (!isUndefined(enumClass[value])) {
|
|
502
|
-
throwError("
|
|
530
|
+
throwError("[" + value + "] exists for " + field);
|
|
503
531
|
}
|
|
504
532
|
enumClass[value] = field;
|
|
505
533
|
});
|
|
506
534
|
return objFreeze(enumClass);
|
|
507
535
|
}
|
|
508
|
-
function objExtend(
|
|
536
|
+
function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
|
|
509
537
|
var theArgs = arguments;
|
|
510
538
|
var extended = theArgs[0] || {};
|
|
511
539
|
var argLen = theArgs.length;
|
|
@@ -791,6 +819,10 @@
|
|
|
791
819
|
}
|
|
792
820
|
return DiagnosticLogger;
|
|
793
821
|
}());
|
|
822
|
+
function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
|
|
823
|
+
if (isUserAct === void 0) { isUserAct = false; }
|
|
824
|
+
(logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
|
|
825
|
+
}
|
|
794
826
|
|
|
795
827
|
var strExecutionContextKey = "ctx";
|
|
796
828
|
var PerfEvent = /** @class */ (function () {
|
|
@@ -1063,8 +1095,11 @@
|
|
|
1063
1095
|
return createTelemetryProxyChain([startAt], config, core);
|
|
1064
1096
|
}
|
|
1065
1097
|
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1066
|
-
var _nextProxy =
|
|
1098
|
+
var _nextProxy = null;
|
|
1067
1099
|
var _onComplete = [];
|
|
1100
|
+
if (startAt !== null) {
|
|
1101
|
+
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1102
|
+
}
|
|
1068
1103
|
var context = {
|
|
1069
1104
|
_next: _moveNext,
|
|
1070
1105
|
ctx: {
|
|
@@ -1114,7 +1149,7 @@
|
|
|
1114
1149
|
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
1115
1150
|
}
|
|
1116
1151
|
catch (e) {
|
|
1117
|
-
core.logger
|
|
1152
|
+
_throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
1118
1153
|
}
|
|
1119
1154
|
});
|
|
1120
1155
|
_onComplete = [];
|
|
@@ -1213,6 +1248,27 @@
|
|
|
1213
1248
|
context.createNew = _createNew;
|
|
1214
1249
|
return context;
|
|
1215
1250
|
}
|
|
1251
|
+
function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
|
|
1252
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1253
|
+
var context = internalContext.ctx;
|
|
1254
|
+
function _processNext(updateState) {
|
|
1255
|
+
return context.iterate(function (plugin) {
|
|
1256
|
+
if (isFunction(plugin[strUpdate])) {
|
|
1257
|
+
plugin[strUpdate](context, updateState);
|
|
1258
|
+
}
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
function _createNew(plugins, startAt) {
|
|
1262
|
+
if (plugins === void 0) { plugins = null; }
|
|
1263
|
+
if (isArray(plugins)) {
|
|
1264
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1265
|
+
}
|
|
1266
|
+
return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
|
|
1267
|
+
}
|
|
1268
|
+
context.processNext = _processNext;
|
|
1269
|
+
context.createNew = _createNew;
|
|
1270
|
+
return context;
|
|
1271
|
+
}
|
|
1216
1272
|
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
1217
1273
|
var firstProxy = null;
|
|
1218
1274
|
var add = startAt ? false : true;
|
|
@@ -1259,6 +1315,7 @@
|
|
|
1259
1315
|
},
|
|
1260
1316
|
processTelemetry: _processTelemetry,
|
|
1261
1317
|
unload: _unloadPlugin,
|
|
1318
|
+
update: _updatePlugin,
|
|
1262
1319
|
_id: chainId,
|
|
1263
1320
|
_setNext: function (nextPlugin) {
|
|
1264
1321
|
nextProxy = nextPlugin;
|
|
@@ -1298,7 +1355,7 @@
|
|
|
1298
1355
|
hasRun = true;
|
|
1299
1356
|
}
|
|
1300
1357
|
if (!nextProxy || !hasNextRun) {
|
|
1301
|
-
itemCtx.diagLog()
|
|
1358
|
+
_throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1302
1359
|
}
|
|
1303
1360
|
}
|
|
1304
1361
|
}, details, isAsync);
|
|
@@ -1346,11 +1403,53 @@
|
|
|
1346
1403
|
unloadCtx.processNext(unloadState);
|
|
1347
1404
|
}
|
|
1348
1405
|
}
|
|
1406
|
+
function _updatePlugin(updateCtx, updateState) {
|
|
1407
|
+
function _callUpdate() {
|
|
1408
|
+
var hasRun = false;
|
|
1409
|
+
if (plugin) {
|
|
1410
|
+
var pluginState = _getPluginState(plugin);
|
|
1411
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1412
|
+
if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1413
|
+
if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
|
|
1414
|
+
hasRun = true;
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
return hasRun;
|
|
1419
|
+
}
|
|
1420
|
+
if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
|
|
1421
|
+
updateCtx.processNext(updateState);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1349
1424
|
return objFreeze(proxyChain);
|
|
1350
1425
|
}
|
|
1351
1426
|
|
|
1352
1427
|
var strExtensionConfig = "extensionConfig";
|
|
1353
1428
|
|
|
1429
|
+
function createUnloadHandlerContainer() {
|
|
1430
|
+
var handlers = [];
|
|
1431
|
+
function _addHandler(handler) {
|
|
1432
|
+
if (handler) {
|
|
1433
|
+
handlers.push(handler);
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
function _runHandlers(unloadCtx, unloadState) {
|
|
1437
|
+
arrForEach(handlers, function (handler) {
|
|
1438
|
+
try {
|
|
1439
|
+
handler(unloadCtx, unloadState);
|
|
1440
|
+
}
|
|
1441
|
+
catch (e) {
|
|
1442
|
+
_throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
1443
|
+
}
|
|
1444
|
+
});
|
|
1445
|
+
handlers = [];
|
|
1446
|
+
}
|
|
1447
|
+
return {
|
|
1448
|
+
add: _addHandler,
|
|
1449
|
+
run: _runHandlers
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1354
1453
|
var strGetPlugin = "getPlugin";
|
|
1355
1454
|
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
1356
1455
|
function BaseTelemetryPlugin() {
|
|
@@ -1358,6 +1457,7 @@
|
|
|
1358
1457
|
var _isinitialized;
|
|
1359
1458
|
var _rootCtx;
|
|
1360
1459
|
var _nextPlugin;
|
|
1460
|
+
var _unloadHandlerContainer;
|
|
1361
1461
|
var _hooks;
|
|
1362
1462
|
_initDefaults();
|
|
1363
1463
|
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
@@ -1379,6 +1479,7 @@
|
|
|
1379
1479
|
function _unloadCallback() {
|
|
1380
1480
|
if (!unloadDone) {
|
|
1381
1481
|
unloadDone = true;
|
|
1482
|
+
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
1382
1483
|
arrForEach(_hooks, function (fn) {
|
|
1383
1484
|
fn.rm();
|
|
1384
1485
|
});
|
|
@@ -1397,6 +1498,30 @@
|
|
|
1397
1498
|
}
|
|
1398
1499
|
return result;
|
|
1399
1500
|
};
|
|
1501
|
+
_self.update = function (updateCtx, updateState) {
|
|
1502
|
+
if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
|
|
1503
|
+
return;
|
|
1504
|
+
}
|
|
1505
|
+
var result;
|
|
1506
|
+
var updateDone = false;
|
|
1507
|
+
var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1508
|
+
var theUpdateState = updateState || {
|
|
1509
|
+
reason: 0
|
|
1510
|
+
};
|
|
1511
|
+
function _updateCallback() {
|
|
1512
|
+
if (!updateDone) {
|
|
1513
|
+
updateDone = true;
|
|
1514
|
+
_setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
|
|
1518
|
+
_updateCallback();
|
|
1519
|
+
}
|
|
1520
|
+
else {
|
|
1521
|
+
result = true;
|
|
1522
|
+
}
|
|
1523
|
+
return result;
|
|
1524
|
+
};
|
|
1400
1525
|
_self._addHook = function (hooks) {
|
|
1401
1526
|
if (hooks) {
|
|
1402
1527
|
if (isArray(hooks)) {
|
|
@@ -1407,6 +1532,7 @@
|
|
|
1407
1532
|
}
|
|
1408
1533
|
}
|
|
1409
1534
|
};
|
|
1535
|
+
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
1410
1536
|
});
|
|
1411
1537
|
_self.diagLog = function (itemCtx) {
|
|
1412
1538
|
return _getTelCtx(itemCtx).diagLog();
|
|
@@ -1463,6 +1589,7 @@
|
|
|
1463
1589
|
_rootCtx = null;
|
|
1464
1590
|
_nextPlugin = null;
|
|
1465
1591
|
_hooks = [];
|
|
1592
|
+
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
1466
1593
|
}
|
|
1467
1594
|
}
|
|
1468
1595
|
return BaseTelemetryPlugin;
|