@microsoft/applicationinsights-react-native 2.5.0-beta.2203-04 → 2.5.0-beta.2203-07

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - React Native Plugin, 2.5.0-beta.2203-04
2
+ * Application Insights JavaScript SDK - React Native Plugin, 2.5.0-beta.2203-07
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
 
@@ -532,7 +533,7 @@
532
533
  });
533
534
  return objFreeze(enumClass);
534
535
  }
535
- function objExtend(obj, obj2, obj3, obj4, obj5, obj6) {
536
+ function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
536
537
  var theArgs = arguments;
537
538
  var extended = theArgs[0] || {};
538
539
  var argLen = theArgs.length;
@@ -818,6 +819,10 @@
818
819
  }
819
820
  return DiagnosticLogger;
820
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
+ }
821
826
 
822
827
  var strExecutionContextKey = "ctx";
823
828
  var PerfEvent = /** @class */ (function () {
@@ -1144,7 +1149,7 @@
1144
1149
  completeDetails.func.call(completeDetails.self, completeDetails.args);
1145
1150
  }
1146
1151
  catch (e) {
1147
- core.logger.throwInternal(2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1152
+ _throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1148
1153
  }
1149
1154
  });
1150
1155
  _onComplete = [];
@@ -1243,6 +1248,27 @@
1243
1248
  context.createNew = _createNew;
1244
1249
  return context;
1245
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
+ }
1246
1272
  function createTelemetryProxyChain(plugins, config, core, startAt) {
1247
1273
  var firstProxy = null;
1248
1274
  var add = startAt ? false : true;
@@ -1289,6 +1315,7 @@
1289
1315
  },
1290
1316
  processTelemetry: _processTelemetry,
1291
1317
  unload: _unloadPlugin,
1318
+ update: _updatePlugin,
1292
1319
  _id: chainId,
1293
1320
  _setNext: function (nextPlugin) {
1294
1321
  nextProxy = nextPlugin;
@@ -1328,7 +1355,7 @@
1328
1355
  hasRun = true;
1329
1356
  }
1330
1357
  if (!nextProxy || !hasNextRun) {
1331
- itemCtx.diagLog().throwInternal(1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1358
+ _throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1332
1359
  }
1333
1360
  }
1334
1361
  }, details, isAsync);
@@ -1376,6 +1403,24 @@
1376
1403
  unloadCtx.processNext(unloadState);
1377
1404
  }
1378
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
+ }
1379
1424
  return objFreeze(proxyChain);
1380
1425
  }
1381
1426
 
@@ -1394,7 +1439,7 @@
1394
1439
  handler(unloadCtx, unloadState);
1395
1440
  }
1396
1441
  catch (e) {
1397
- unloadCtx.diagLog().throwInternal(2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
1442
+ _throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
1398
1443
  }
1399
1444
  });
1400
1445
  handlers = [];
@@ -1453,6 +1498,30 @@
1453
1498
  }
1454
1499
  return result;
1455
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
+ };
1456
1525
  _self._addHook = function (hooks) {
1457
1526
  if (hooks) {
1458
1527
  if (isArray(hooks)) {