@microsoft/applicationinsights-common 3.4.0-nightlybeta3.2602-27 → 3.4.1

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,11 +1,11 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Common, 3.4.0-nightlybeta3.2602-27
2
+ * Application Insights JavaScript SDK - Common, 3.4.1
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  'use strict';
6
6
 
7
7
 
8
- /*! https://github.com/nevware21/ts-utils v0.12.6 */
8
+ /*! https://github.com/nevware21/ts-utils v0.13.0 */
9
9
  /*#__NO_SIDE_EFFECTS__*/
10
10
  function _pureAssign(func1, func2) {
11
11
  return func1 || func2;
@@ -634,7 +634,7 @@ function _setName(baseClass, name) {
634
634
  name && (baseClass[NAME] = name);
635
635
  }
636
636
  /*#__NO_SIDE_EFFECTS__*/
637
- function createCustomError(name, constructCb, errorBase) {
637
+ function createCustomError(name, constructCb, errorBase, superArgsFn) {
638
638
  var theBaseClass = errorBase || Error;
639
639
  var orgName = theBaseClass[PROTOTYPE][NAME];
640
640
  var captureFn = Error.captureStackTrace;
@@ -643,7 +643,7 @@ function createCustomError(name, constructCb, errorBase) {
643
643
  var theArgs = arguments;
644
644
  try {
645
645
  safe(_setName, [theBaseClass, name]);
646
- var _self = fnApply(theBaseClass, _this, ArrSlice[CALL](theArgs)) || _this;
646
+ var _self = fnApply(theBaseClass, _this, superArgsFn ? superArgsFn(theArgs) : ArrSlice[CALL](theArgs)) || _this;
647
647
  if (_self !== _this) {
648
648
  var orgProto = objGetPrototypeOf(_this);
649
649
  if (orgProto !== objGetPrototypeOf(_self)) {
@@ -672,6 +672,13 @@ function _createTrimFn(exp) {
672
672
  var polyStrTrim = ( /*#__PURE__*/_createTrimFn(/^\s+|(?=\s)\s+$/g));
673
673
  var strTrim = ( /*#__PURE__*/_unwrapFunctionWithPoly("trim", StrProto, polyStrTrim));
674
674
  var mathFloor = ( /*#__PURE__*/_pureRef(MathCls, "floor"));
675
+ /*#__NO_SIDE_EFFECTS__*/
676
+ function safeGetDeferred(cb, defValue, argArray) {
677
+ return getDeferred(function () {
678
+ var result = safe(cb, argArray);
679
+ return result.e ? defValue : result.v;
680
+ });
681
+ }
675
682
  var _fnToString;
676
683
  var _objCtrFnString;
677
684
  var _gblWindow;
@@ -714,13 +721,6 @@ function getPerformance() {
714
721
  }
715
722
  return _perf.v;
716
723
  }
717
- /*#__NO_SIDE_EFFECTS__*/
718
- function safeGetDeferred(cb, defValue, argArray) {
719
- return getDeferred(function () {
720
- var result = safe(cb, argArray);
721
- return result.e ? defValue : result.v;
722
- });
723
- }
724
724
  var mathRound = ( /*#__PURE__*/_pureRef(MathCls, "round"));
725
725
  var objGetOwnPropertyDescriptor = ( /*#__PURE__*/_pureAssign(( /*#__PURE__*/_pureRef(ObjClass$1, GET_OWN_PROPERTY_DESCRIPTOR)), _returnNothing));
726
726
  var strEndsWith = ( /*#__PURE__*/_unwrapFunctionWithPoly("endsWith", StrProto, polyStrEndsWith));
@@ -862,7 +862,6 @@ var _DYN_VALUE = "value";
862
862
  var _DYN_UNLOAD = "unload";
863
863
  var _DYN_REASON = "reason";
864
864
  var _DYN_FLUSH = "flush";
865
- var _DYN_VERSION = "version";
866
865
  var _DYN_LOGGING_LEVEL_CONSOL4 = "loggingLevelConsole";
867
866
  var _DYN_JOIN = "join";
868
867
  var _DYN_MESSAGE_ID = "messageId";
@@ -882,7 +881,12 @@ var _DYN_TRACE_STATE = "traceState";
882
881
  var _DYN_COUNT = "count";
883
882
  var _DYN_PRE_TRIGGER_DATE = "preTriggerDate";
884
883
  var _DYN_GET_UTCDATE = "getUTCDate";
884
+ var _DYN_BASE_DATA = "baseData";
885
+ var _DYN_PROPERTIES = "properties";
886
+ var _DYN_USER_AGENT = "userAgent";
887
+ var _DYN_DURATION = "duration";
885
888
  var _DYN_TO_STRING = "toString";
889
+ var _DYN_HANDLER = "handler";
886
890
  var _DYN_EVT_NAME = "evtName";
887
891
  var _DYN_CONCAT = "concat";
888
892
  var _DYN_INGESTIONENDPOINT = "ingestionendpoint";
@@ -890,8 +894,7 @@ var _DYN_CREATE_EVENT = "createEvent";
890
894
  var _DYN_SUBSTRING = "substring";
891
895
  var _DYN_REMOVE_ITEM = "removeItem";
892
896
  var _DYN_GET_ATTRIBUTE = "getAttribute";
893
- var _DYN_CORRELATION_HEADER_E7 = "correlationHeaderExcludePatterns";
894
- var _DYN_PROPERTIES = "properties";
897
+ var _DYN_CORRELATION_HEADER_E8 = "correlationHeaderExcludePatterns";
895
898
  var _DYN_MEASUREMENTS = "measurements";
896
899
  var _DYN_SIZE_IN_BYTES = "sizeInBytes";
897
900
  var _DYN_TYPE_NAME = "typeName";
@@ -904,7 +907,6 @@ var _DYN_ASSEMBLY = "assembly";
904
907
  var _DYN_FILE_NAME = "fileName";
905
908
  var _DYN_LINE = "line";
906
909
  var _DYN_AI_DATA_CONTRACT = "aiDataContract";
907
- var _DYN_DURATION = "duration";
908
910
 
909
911
  var aggregationErrorType;
910
912
  function throwAggregationError(message, sourceErrors) {
@@ -1226,6 +1228,7 @@ var STR_EXTENSION_CONFIG = "extensionConfig";
1226
1228
  var STR_NOT_DYNAMIC_ERROR = "Not dynamic - ";
1227
1229
  var STR_REDACTED = "REDACTED";
1228
1230
  var DEFAULT_SENSITIVE_PARAMS = ["sig", "Signature", "AWSAccessKeyId", "X-Goog-Signature"];
1231
+ var STR_VERSION = "version";
1229
1232
 
1230
1233
  var strGetPrototypeOf = "getPrototypeOf";
1231
1234
  var rCamelCase = /-([a-z])/g;
@@ -1394,7 +1397,7 @@ function getUserAgentString() {
1394
1397
  if (!_userAgent) {
1395
1398
  _userAgent = getLazy(function () {
1396
1399
  var nav = getNavigator() || {};
1397
- return nav.userAgent || STR_EMPTY;
1400
+ return nav[_DYN_USER_AGENT ] || STR_EMPTY;
1398
1401
  });
1399
1402
  }
1400
1403
  return _userAgent.v;
@@ -1523,9 +1526,13 @@ function redactQueryParameters(url, config) {
1523
1526
  if (questionMarkIndex === -1) {
1524
1527
  return url;
1525
1528
  }
1526
- if (config && config.redactQueryParams) {
1529
+ var option = config ? config.redactUrls : undefined;
1530
+ if (option === 3 ) {
1527
1531
  sensitiveParams = DEFAULT_SENSITIVE_PARAMS[_DYN_CONCAT ](config.redactQueryParams);
1528
1532
  }
1533
+ else if (option === 4 ) {
1534
+ sensitiveParams = config.redactQueryParams;
1535
+ }
1529
1536
  else {
1530
1537
  sensitiveParams = DEFAULT_SENSITIVE_PARAMS;
1531
1538
  }
@@ -1596,7 +1603,8 @@ function fieldRedaction(input, config) {
1596
1603
  if (!input || !isString(input) || strIndexOf(input, " ") !== -1) {
1597
1604
  return input;
1598
1605
  }
1599
- var isRedactionDisabled = config && config.redactUrls === false;
1606
+ var option = config ? config.redactUrls : undefined;
1607
+ var isRedactionDisabled = option === false || option === 2 ;
1600
1608
  if (isRedactionDisabled) {
1601
1609
  return input;
1602
1610
  }
@@ -1605,6 +1613,12 @@ function fieldRedaction(input, config) {
1605
1613
  if (!hasCredentials && !hasQueryParams) {
1606
1614
  return input;
1607
1615
  }
1616
+ if (option === 5 ) {
1617
+ hasQueryParams = false;
1618
+ }
1619
+ if (option === 6 ) {
1620
+ hasCredentials = false;
1621
+ }
1608
1622
  try {
1609
1623
  var result = input;
1610
1624
  if (hasCredentials) {
@@ -1696,7 +1710,7 @@ function newId(maxLength) {
1696
1710
  return result;
1697
1711
  }
1698
1712
 
1699
- var version = '3.4.0-nightlybeta3.2602-27';
1713
+ var version = '3.4.1';
1700
1714
  var instanceName = "." + newId(6);
1701
1715
  var _dataUid = 0;
1702
1716
  function _canAcceptData(target) {
@@ -2443,7 +2457,7 @@ var _InternalLogMessage = /** @class */ (function () {
2443
2457
  }());
2444
2458
  /*#__NO_SIDE_EFFECTS__*/
2445
2459
  function safeGetLogger(core, config) {
2446
- return (core || {})[_DYN_LOGGER ] || new DiagnosticLogger(config);
2460
+ return (core || {})[_DYN_LOGGER ] || new DiagnosticLogger(config || (core || {})[_DYN_CONFIG ]);
2447
2461
  }
2448
2462
  var DiagnosticLogger = /** @class */ (function () {
2449
2463
  function DiagnosticLogger(config) {
@@ -2903,7 +2917,7 @@ function isValidSpanId(value) {
2903
2917
  /*#__NO_SIDE_EFFECTS__*/
2904
2918
  function isValidTraceParent(value) {
2905
2919
  if (!value ||
2906
- !_isValid(value[_DYN_VERSION ], 2, INVALID_VERSION) ||
2920
+ !_isValid(value[STR_VERSION ], 2, INVALID_VERSION) ||
2907
2921
  !_isValid(value[_DYN_TRACE_ID ], 32, INVALID_TRACE_ID) ||
2908
2922
  !_isValid(value[_DYN_SPAN_ID ], 16, INVALID_SPAN_ID) ||
2909
2923
  !_isValid(_formatFlags(value[_DYN_TRACE_FLAGS ]), 2)) {
@@ -2925,7 +2939,7 @@ function formatTraceParent(value) {
2925
2939
  if (!_isValid(flags, 2)) {
2926
2940
  flags = "01";
2927
2941
  }
2928
- var version = value[_DYN_VERSION ] || DEFAULT_VERSION;
2942
+ var version = value[STR_VERSION ] || DEFAULT_VERSION;
2929
2943
  if (version !== "00" && version !== "ff") {
2930
2944
  version = DEFAULT_VERSION;
2931
2945
  }
@@ -3356,7 +3370,7 @@ function _doUnregister(target, events, evtName, unRegFn) {
3356
3370
  if (theEvent) {
3357
3371
  if (!evtName.ns || evtName.ns === theEvent[_DYN_EVT_NAME ].ns) {
3358
3372
  if (!unRegFn || unRegFn(theEvent)) {
3359
- _doDetach(target, theEvent[_DYN_EVT_NAME ], theEvent.handler, theEvent.capture);
3373
+ _doDetach(target, theEvent.evtName, theEvent[_DYN_HANDLER ], theEvent.capture);
3360
3374
  events[_DYN_SPLICE ](idx, 1);
3361
3375
  }
3362
3376
  }
@@ -3423,7 +3437,7 @@ function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {
3423
3437
  var evtName_1 = _getEvtNamespace(eventName, evtNamespace);
3424
3438
  var found_1 = false;
3425
3439
  _unregisterEvents(target, evtName_1, function (regEvent) {
3426
- if ((evtName_1.ns && !handlerRef) || regEvent.handler === handlerRef) {
3440
+ if ((evtName_1.ns && !handlerRef) || regEvent[_DYN_HANDLER ] === handlerRef) {
3427
3441
  found_1 = true;
3428
3442
  return true;
3429
3443
  }
@@ -3670,9 +3684,9 @@ function correlationIdCanIncludeCorrelationHeader(config, requestUrl, currentHos
3670
3684
  if (!requestUrl || (config && config.disableCorrelationHeaders)) {
3671
3685
  return false;
3672
3686
  }
3673
- if (config && config[_DYN_CORRELATION_HEADER_E7 ]) {
3687
+ if (config && config[_DYN_CORRELATION_HEADER_E8 ]) {
3674
3688
  for (var i = 0; i < config.correlationHeaderExcludePatterns[_DYN_LENGTH ]; i++) {
3675
- if (config[_DYN_CORRELATION_HEADER_E7 ][i].test(requestUrl)) {
3689
+ if (config[_DYN_CORRELATION_HEADER_E8 ][i].test(requestUrl)) {
3676
3690
  return false;
3677
3691
  }
3678
3692
  }
@@ -5131,7 +5145,7 @@ var Data = /** @class */ (function () {
5131
5145
  baseData: 1
5132
5146
  };
5133
5147
  this.baseType = baseType;
5134
- this.baseData = data;
5148
+ this[_DYN_BASE_DATA ] = data;
5135
5149
  }
5136
5150
  return Data;
5137
5151
  }());