@microsoft/applicationinsights-analytics-js 2.7.1-nightly.202110-08 → 2.7.1-nightly.202110-17

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,7 +1,7 @@
1
1
  {
2
2
  "metadata": {
3
3
  "toolPackage": "@microsoft/api-extractor",
4
- "toolVersion": "7.18.11",
4
+ "toolVersion": "7.18.16",
5
5
  "schemaVersion": 1004,
6
6
  "oldestForwardsCompatibleVersion": 1001,
7
7
  "tsdocConfig": {
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights JavaScript SDK - Web Analytics, 2.7.1-nightly.202110-08
2
+ * Microsoft Application Insights JavaScript SDK - Web Analytics, 2.7.1-nightly.202110-17
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 - Web Analytics, 2.7.1-nightly.202110-08
2
+ * Application Insights JavaScript SDK - Web Analytics, 2.7.1-nightly.202110-17
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -714,12 +714,26 @@
714
714
  var AiNonUserActionablePrefix = "AI (Internal): ";
715
715
  var AiUserActionablePrefix = "AI: ";
716
716
  var AIInternalMessagePrefix = "AITR_";
717
+ var strErrorToConsole = "errorToConsole";
718
+ var strWarnToConsole = "warnToConsole";
717
719
  function _sanitizeDiagnosticText(text) {
718
720
  if (text) {
719
721
  return "\"" + text.replace(/\"/g, "") + "\"";
720
722
  }
721
723
  return "";
722
724
  }
725
+ function _logToConsole(func, message) {
726
+ var theConsole = getConsole();
727
+ if (!!theConsole) {
728
+ var logFunc = "log";
729
+ if (theConsole[func]) {
730
+ logFunc = func;
731
+ }
732
+ if (isFunction(theConsole[logFunc])) {
733
+ theConsole[logFunc](message);
734
+ }
735
+ }
736
+ }
723
737
  var _InternalLogMessage = /** @class */ (function () {
724
738
  function _InternalLogMessage(msgId, msg, isUserAct, properties) {
725
739
  if (isUserAct === void 0) { isUserAct = false; }
@@ -763,18 +777,19 @@
763
777
  throw message;
764
778
  }
765
779
  else {
780
+ var logFunc = severity === LoggingSeverity.CRITICAL ? strErrorToConsole : strWarnToConsole;
766
781
  if (!isUndefined(message.message)) {
767
782
  var logLevel = _self.consoleLoggingLevel();
768
783
  if (isUserAct) {
769
784
  var messageKey = +message.messageId;
770
- if (!_messageLogged[messageKey] && logLevel >= LoggingSeverity.WARNING) {
771
- _self.warnToConsole(message.message);
785
+ if (!_messageLogged[messageKey] && logLevel >= severity) {
786
+ _self[logFunc](message.message);
772
787
  _messageLogged[messageKey] = true;
773
788
  }
774
789
  }
775
790
  else {
776
- if (logLevel >= LoggingSeverity.WARNING) {
777
- _self.warnToConsole(message.message);
791
+ if (logLevel >= severity) {
792
+ _self[logFunc](message.message);
778
793
  }
779
794
  }
780
795
  _self.logInternalMessage(severity, message);
@@ -782,16 +797,10 @@
782
797
  }
783
798
  };
784
799
  _self.warnToConsole = function (message) {
785
- var theConsole = getConsole();
786
- if (!!theConsole) {
787
- var logFunc = "log";
788
- if (theConsole.warn) {
789
- logFunc = "warn";
790
- }
791
- if (isFunction(theConsole[logFunc])) {
792
- theConsole[logFunc](message);
793
- }
794
- }
800
+ _logToConsole("warn", message);
801
+ };
802
+ _self.errorToConsole = function (message) {
803
+ _logToConsole("error", message);
795
804
  };
796
805
  _self.resetInternalMessageCount = function () {
797
806
  _messageCount = 0;
@@ -1532,7 +1541,7 @@
1532
1541
  name = strTrim(name.toString());
1533
1542
  if (name.length > 150 ) {
1534
1543
  nameTrunc = name.substring(0, 150 );
1535
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
1544
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
1536
1545
  }
1537
1546
  }
1538
1547
  return nameTrunc || name;
@@ -1545,7 +1554,7 @@
1545
1554
  value = strTrim(value);
1546
1555
  if (value.toString().length > maxLength) {
1547
1556
  valueTrunc = value.toString().substring(0, maxLength);
1548
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
1557
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
1549
1558
  }
1550
1559
  }
1551
1560
  return valueTrunc || value;
@@ -1558,7 +1567,7 @@
1558
1567
  if (message) {
1559
1568
  if (message.length > 32768 ) {
1560
1569
  messageTrunc = message.substring(0, 32768 );
1561
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
1570
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
1562
1571
  }
1563
1572
  }
1564
1573
  return messageTrunc || message;
@@ -1569,7 +1578,7 @@
1569
1578
  var value = "" + exception;
1570
1579
  if (value.length > 32768 ) {
1571
1580
  exceptionTrunc = value.substring(0, 32768 );
1572
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
1581
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
1573
1582
  }
1574
1583
  }
1575
1584
  return exceptionTrunc || exception;
@@ -1583,7 +1592,7 @@
1583
1592
  value = getJSON().stringify(value);
1584
1593
  }
1585
1594
  catch (e) {
1586
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
1595
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
1587
1596
  }
1588
1597
  }
1589
1598
  value = dataSanitizeString(logger, value, 8192 );
@@ -1614,7 +1623,7 @@
1614
1623
  input = strTrim(input);
1615
1624
  if (input.length > maxLength) {
1616
1625
  inputTrunc = input.substring(0, maxLength);
1617
- logger.throwInternal(LoggingSeverity.WARNING, _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
1626
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
1618
1627
  }
1619
1628
  }
1620
1629
  return inputTrunc || input;
@@ -3319,7 +3328,7 @@
3319
3328
  if (_location && _location.pathname) {
3320
3329
  traceLocationName = _location.pathname + (_location.hash || "");
3321
3330
  }
3322
- _properties.context.telemetryTrace.name = traceLocationName;
3331
+ _properties.context.telemetryTrace.name = dataSanitizeString(_self_1.diagLog(), traceLocationName);
3323
3332
  }
3324
3333
  if (_currUri) {
3325
3334
  _prevUri = _currUri;
@@ -3397,7 +3406,7 @@
3397
3406
  config.disableFlushOnUnload = stringToBoolOrDefault(config.disableFlushOnUnload, config.disableFlushOnBeforeUnload);
3398
3407
  return config;
3399
3408
  };
3400
- ApplicationInsights.Version = "2.7.1-nightly.202110-08";
3409
+ ApplicationInsights.Version = "2.7.1-nightly.202110-17";
3401
3410
  return ApplicationInsights;
3402
3411
  }(BaseTelemetryPlugin));
3403
3412
  var Timing = /** @class */ (function () {