@microsoft/applicationinsights-dependencies-js 2.8.0-beta.2203-02 → 2.8.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-dependencies-js.integrity.json +9 -9
- package/browser/applicationinsights-dependencies-js.js +142 -15
- package/browser/applicationinsights-dependencies-js.js.map +1 -1
- package/browser/applicationinsights-dependencies-js.min.js +2 -2
- package/browser/applicationinsights-dependencies-js.min.js.map +1 -1
- package/dist/applicationinsights-dependencies-js.d.ts +1 -1
- package/dist/applicationinsights-dependencies-js.js +142 -15
- package/dist/applicationinsights-dependencies-js.js.map +1 -1
- package/dist/applicationinsights-dependencies-js.min.js +2 -2
- package/dist/applicationinsights-dependencies-js.min.js.map +1 -1
- package/dist/applicationinsights-dependencies-js.rollup.d.ts +1 -1
- package/dist-esm/TraceParent.js +1 -1
- package/dist-esm/ajax.js +1 -1
- package/dist-esm/ajaxRecord.js +1 -1
- package/dist-esm/ajaxUtils.js +1 -1
- package/dist-esm/applicationinsights-dependencies-js.js +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Microsoft Application Insights XHR dependencies plugin, 2.8.0-beta.2203-
|
|
2
|
+
* Microsoft Application Insights XHR dependencies plugin, 2.8.0-beta.2203-05
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* Microsoft Application Insights Team
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Dependencies Plugin, 2.8.0-beta.2203-
|
|
2
|
+
* Application Insights JavaScript SDK - Dependencies Plugin, 2.8.0-beta.2203-05
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -340,6 +340,7 @@
|
|
|
340
340
|
var strIsInitialized = "isInitialized";
|
|
341
341
|
var strTeardown = "teardown";
|
|
342
342
|
var strCore = "core";
|
|
343
|
+
var strUpdate = "update";
|
|
343
344
|
var strDisabled = "disabled";
|
|
344
345
|
var strDoTeardown = "_doTeardown";
|
|
345
346
|
|
|
@@ -568,18 +569,45 @@
|
|
|
568
569
|
function throwError(message) {
|
|
569
570
|
throw new Error(message);
|
|
570
571
|
}
|
|
572
|
+
function _createProxyFunction(source, funcName) {
|
|
573
|
+
var srcFunc = null;
|
|
574
|
+
var src = null;
|
|
575
|
+
if (isFunction(source)) {
|
|
576
|
+
srcFunc = source;
|
|
577
|
+
}
|
|
578
|
+
else {
|
|
579
|
+
src = source;
|
|
580
|
+
}
|
|
581
|
+
return function () {
|
|
582
|
+
var originalArguments = arguments;
|
|
583
|
+
if (srcFunc) {
|
|
584
|
+
src = srcFunc();
|
|
585
|
+
}
|
|
586
|
+
if (src) {
|
|
587
|
+
return src[funcName].apply(src, originalArguments);
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
|
|
592
|
+
if (overwriteTarget === void 0) { overwriteTarget = true; }
|
|
593
|
+
if (target && name && source) {
|
|
594
|
+
if (overwriteTarget || isUndefined(target[name])) {
|
|
595
|
+
target[name] = _createProxyFunction(source, theFunc);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
571
599
|
function createEnumStyle(values) {
|
|
572
600
|
var enumClass = {};
|
|
573
601
|
objForEachKey(values, function (field, value) {
|
|
574
602
|
enumClass[field] = value;
|
|
575
603
|
if (!isUndefined(enumClass[value])) {
|
|
576
|
-
throwError("
|
|
604
|
+
throwError("[" + value + "] exists for " + field);
|
|
577
605
|
}
|
|
578
606
|
enumClass[value] = field;
|
|
579
607
|
});
|
|
580
608
|
return objFreeze(enumClass);
|
|
581
609
|
}
|
|
582
|
-
function objExtend(
|
|
610
|
+
function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
|
|
583
611
|
var theArgs = arguments;
|
|
584
612
|
var extended = theArgs[0] || {};
|
|
585
613
|
var argLen = theArgs.length;
|
|
@@ -924,6 +952,10 @@
|
|
|
924
952
|
}
|
|
925
953
|
return DiagnosticLogger;
|
|
926
954
|
}());
|
|
955
|
+
function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
|
|
956
|
+
if (isUserAct === void 0) { isUserAct = false; }
|
|
957
|
+
(logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
|
|
958
|
+
}
|
|
927
959
|
|
|
928
960
|
var strExecutionContextKey = "ctx";
|
|
929
961
|
var PerfEvent = /** @class */ (function () {
|
|
@@ -1196,8 +1228,11 @@
|
|
|
1196
1228
|
return createTelemetryProxyChain([startAt], config, core);
|
|
1197
1229
|
}
|
|
1198
1230
|
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1199
|
-
var _nextProxy =
|
|
1231
|
+
var _nextProxy = null;
|
|
1200
1232
|
var _onComplete = [];
|
|
1233
|
+
if (startAt !== null) {
|
|
1234
|
+
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1235
|
+
}
|
|
1201
1236
|
var context = {
|
|
1202
1237
|
_next: _moveNext,
|
|
1203
1238
|
ctx: {
|
|
@@ -1247,7 +1282,7 @@
|
|
|
1247
1282
|
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
1248
1283
|
}
|
|
1249
1284
|
catch (e) {
|
|
1250
|
-
core.logger
|
|
1285
|
+
_throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
1251
1286
|
}
|
|
1252
1287
|
});
|
|
1253
1288
|
_onComplete = [];
|
|
@@ -1346,6 +1381,27 @@
|
|
|
1346
1381
|
context.createNew = _createNew;
|
|
1347
1382
|
return context;
|
|
1348
1383
|
}
|
|
1384
|
+
function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
|
|
1385
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1386
|
+
var context = internalContext.ctx;
|
|
1387
|
+
function _processNext(updateState) {
|
|
1388
|
+
return context.iterate(function (plugin) {
|
|
1389
|
+
if (isFunction(plugin[strUpdate])) {
|
|
1390
|
+
plugin[strUpdate](context, updateState);
|
|
1391
|
+
}
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
function _createNew(plugins, startAt) {
|
|
1395
|
+
if (plugins === void 0) { plugins = null; }
|
|
1396
|
+
if (isArray(plugins)) {
|
|
1397
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1398
|
+
}
|
|
1399
|
+
return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
|
|
1400
|
+
}
|
|
1401
|
+
context.processNext = _processNext;
|
|
1402
|
+
context.createNew = _createNew;
|
|
1403
|
+
return context;
|
|
1404
|
+
}
|
|
1349
1405
|
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
1350
1406
|
var firstProxy = null;
|
|
1351
1407
|
var add = startAt ? false : true;
|
|
@@ -1392,6 +1448,7 @@
|
|
|
1392
1448
|
},
|
|
1393
1449
|
processTelemetry: _processTelemetry,
|
|
1394
1450
|
unload: _unloadPlugin,
|
|
1451
|
+
update: _updatePlugin,
|
|
1395
1452
|
_id: chainId,
|
|
1396
1453
|
_setNext: function (nextPlugin) {
|
|
1397
1454
|
nextProxy = nextPlugin;
|
|
@@ -1431,7 +1488,7 @@
|
|
|
1431
1488
|
hasRun = true;
|
|
1432
1489
|
}
|
|
1433
1490
|
if (!nextProxy || !hasNextRun) {
|
|
1434
|
-
itemCtx.diagLog()
|
|
1491
|
+
_throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1435
1492
|
}
|
|
1436
1493
|
}
|
|
1437
1494
|
}, details, isAsync);
|
|
@@ -1479,11 +1536,53 @@
|
|
|
1479
1536
|
unloadCtx.processNext(unloadState);
|
|
1480
1537
|
}
|
|
1481
1538
|
}
|
|
1539
|
+
function _updatePlugin(updateCtx, updateState) {
|
|
1540
|
+
function _callUpdate() {
|
|
1541
|
+
var hasRun = false;
|
|
1542
|
+
if (plugin) {
|
|
1543
|
+
var pluginState = _getPluginState(plugin);
|
|
1544
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1545
|
+
if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1546
|
+
if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
|
|
1547
|
+
hasRun = true;
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
return hasRun;
|
|
1552
|
+
}
|
|
1553
|
+
if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
|
|
1554
|
+
updateCtx.processNext(updateState);
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1482
1557
|
return objFreeze(proxyChain);
|
|
1483
1558
|
}
|
|
1484
1559
|
|
|
1485
1560
|
var strExtensionConfig = "extensionConfig";
|
|
1486
1561
|
|
|
1562
|
+
function createUnloadHandlerContainer() {
|
|
1563
|
+
var handlers = [];
|
|
1564
|
+
function _addHandler(handler) {
|
|
1565
|
+
if (handler) {
|
|
1566
|
+
handlers.push(handler);
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
function _runHandlers(unloadCtx, unloadState) {
|
|
1570
|
+
arrForEach(handlers, function (handler) {
|
|
1571
|
+
try {
|
|
1572
|
+
handler(unloadCtx, unloadState);
|
|
1573
|
+
}
|
|
1574
|
+
catch (e) {
|
|
1575
|
+
_throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
1576
|
+
}
|
|
1577
|
+
});
|
|
1578
|
+
handlers = [];
|
|
1579
|
+
}
|
|
1580
|
+
return {
|
|
1581
|
+
add: _addHandler,
|
|
1582
|
+
run: _runHandlers
|
|
1583
|
+
};
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1487
1586
|
var strGetPlugin = "getPlugin";
|
|
1488
1587
|
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
1489
1588
|
function BaseTelemetryPlugin() {
|
|
@@ -1491,6 +1590,7 @@
|
|
|
1491
1590
|
var _isinitialized;
|
|
1492
1591
|
var _rootCtx;
|
|
1493
1592
|
var _nextPlugin;
|
|
1593
|
+
var _unloadHandlerContainer;
|
|
1494
1594
|
var _hooks;
|
|
1495
1595
|
_initDefaults();
|
|
1496
1596
|
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
@@ -1512,6 +1612,7 @@
|
|
|
1512
1612
|
function _unloadCallback() {
|
|
1513
1613
|
if (!unloadDone) {
|
|
1514
1614
|
unloadDone = true;
|
|
1615
|
+
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
1515
1616
|
arrForEach(_hooks, function (fn) {
|
|
1516
1617
|
fn.rm();
|
|
1517
1618
|
});
|
|
@@ -1530,6 +1631,30 @@
|
|
|
1530
1631
|
}
|
|
1531
1632
|
return result;
|
|
1532
1633
|
};
|
|
1634
|
+
_self.update = function (updateCtx, updateState) {
|
|
1635
|
+
if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
|
|
1636
|
+
return;
|
|
1637
|
+
}
|
|
1638
|
+
var result;
|
|
1639
|
+
var updateDone = false;
|
|
1640
|
+
var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1641
|
+
var theUpdateState = updateState || {
|
|
1642
|
+
reason: 0
|
|
1643
|
+
};
|
|
1644
|
+
function _updateCallback() {
|
|
1645
|
+
if (!updateDone) {
|
|
1646
|
+
updateDone = true;
|
|
1647
|
+
_setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
|
|
1651
|
+
_updateCallback();
|
|
1652
|
+
}
|
|
1653
|
+
else {
|
|
1654
|
+
result = true;
|
|
1655
|
+
}
|
|
1656
|
+
return result;
|
|
1657
|
+
};
|
|
1533
1658
|
_self._addHook = function (hooks) {
|
|
1534
1659
|
if (hooks) {
|
|
1535
1660
|
if (isArray(hooks)) {
|
|
@@ -1540,6 +1665,7 @@
|
|
|
1540
1665
|
}
|
|
1541
1666
|
}
|
|
1542
1667
|
};
|
|
1668
|
+
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
1543
1669
|
});
|
|
1544
1670
|
_self.diagLog = function (itemCtx) {
|
|
1545
1671
|
return _getTelCtx(itemCtx).diagLog();
|
|
@@ -1596,6 +1722,7 @@
|
|
|
1596
1722
|
_rootCtx = null;
|
|
1597
1723
|
_nextPlugin = null;
|
|
1598
1724
|
_hooks = [];
|
|
1725
|
+
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
1599
1726
|
}
|
|
1600
1727
|
}
|
|
1601
1728
|
return BaseTelemetryPlugin;
|
|
@@ -1616,12 +1743,12 @@
|
|
|
1616
1743
|
}
|
|
1617
1744
|
return name;
|
|
1618
1745
|
}
|
|
1619
|
-
function _getEvtNamespace(eventName,
|
|
1620
|
-
if (
|
|
1746
|
+
function _getEvtNamespace(eventName, evtNamespace) {
|
|
1747
|
+
if (evtNamespace) {
|
|
1621
1748
|
var theNamespace_1 = "";
|
|
1622
|
-
if (isArray(
|
|
1749
|
+
if (isArray(evtNamespace)) {
|
|
1623
1750
|
theNamespace_1 = "";
|
|
1624
|
-
arrForEach(
|
|
1751
|
+
arrForEach(evtNamespace, function (name) {
|
|
1625
1752
|
name = _normalizeNamespace(name);
|
|
1626
1753
|
if (name) {
|
|
1627
1754
|
if (name[0] !== ".") {
|
|
@@ -1632,7 +1759,7 @@
|
|
|
1632
1759
|
});
|
|
1633
1760
|
}
|
|
1634
1761
|
else {
|
|
1635
|
-
theNamespace_1 = _normalizeNamespace(
|
|
1762
|
+
theNamespace_1 = _normalizeNamespace(evtNamespace);
|
|
1636
1763
|
}
|
|
1637
1764
|
if (theNamespace_1) {
|
|
1638
1765
|
if (theNamespace_1[0] !== ".") {
|
|
@@ -1991,7 +2118,7 @@
|
|
|
1991
2118
|
name = strTrim(name.toString());
|
|
1992
2119
|
if (name.length > 150 ) {
|
|
1993
2120
|
nameTrunc = name.substring(0, 150 );
|
|
1994
|
-
logger
|
|
2121
|
+
_throwInternal(logger, 2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
|
|
1995
2122
|
}
|
|
1996
2123
|
}
|
|
1997
2124
|
return nameTrunc || name;
|
|
@@ -2004,7 +2131,7 @@
|
|
|
2004
2131
|
value = strTrim(value);
|
|
2005
2132
|
if (value.toString().length > maxLength) {
|
|
2006
2133
|
valueTrunc = value.toString().substring(0, maxLength);
|
|
2007
|
-
logger
|
|
2134
|
+
_throwInternal(logger, 2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
|
|
2008
2135
|
}
|
|
2009
2136
|
}
|
|
2010
2137
|
return valueTrunc || value;
|
|
@@ -2021,7 +2148,7 @@
|
|
|
2021
2148
|
value = getJSON().stringify(value);
|
|
2022
2149
|
}
|
|
2023
2150
|
catch (e) {
|
|
2024
|
-
logger
|
|
2151
|
+
_throwInternal(logger, 2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
|
|
2025
2152
|
}
|
|
2026
2153
|
}
|
|
2027
2154
|
value = dataSanitizeString(logger, value, 8192 );
|
|
@@ -2049,7 +2176,7 @@
|
|
|
2049
2176
|
input = strTrim(input);
|
|
2050
2177
|
if (input.length > maxLength) {
|
|
2051
2178
|
inputTrunc = input.substring(0, maxLength);
|
|
2052
|
-
logger
|
|
2179
|
+
_throwInternal(logger, 2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
|
|
2053
2180
|
}
|
|
2054
2181
|
}
|
|
2055
2182
|
return inputTrunc || input;
|