@microsoft/applicationinsights-channel-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,25 +1,25 @@
1
1
  {
2
2
  "name": "applicationinsights-channel-js",
3
- "version": "2.7.1-nightly.202110-08",
3
+ "version": "2.7.1-nightly.202110-17",
4
4
  "ext": {
5
5
  "@js": {
6
6
  "file": "applicationinsights-channel-js.js",
7
7
  "type": "text/javascript; charset=utf-8",
8
- "integrity": "sha256-fDTsjcocBsPwywxdqO12xjseElY+Sc3preqUwrdh+M0= sha384-I6OQGvoAVtsPoqiw63mUNKDhvZ+PVnNAnwa6qZLiuy/0lHkL9lyEeOBW2IJKiNON sha512-jQxqZc1/RMdxLulD4P+zQuOLaPkGE7upYTQCxilIQtjtWvJfHDrPqbP2Tr/WrMGzSCNtIsb2hWUD/Au6gzwd5Q==",
8
+ "integrity": "sha256-tJAt7yYRy2+sp2C+SD5nTuv7TpLxDEXt22o3aWRyvM0= sha384-yD1ajrrBKJaAisXaaM5X/+gPtEqWnz5l4pa3An5uJo2RqQ5N9KZ6vO5TOIsdd+G3 sha512-Pv09H+Qr4mtWXKHoZ4EtRjbwz4Lv4PUBlVukrPX1EdFPgv08X6FCN0YV4xzHEOnNqKcSiOiQiJgIIE9uzqg3uQ==",
9
9
  "hashes": {
10
- "sha256": "fDTsjcocBsPwywxdqO12xjseElY+Sc3preqUwrdh+M0=",
11
- "sha384": "I6OQGvoAVtsPoqiw63mUNKDhvZ+PVnNAnwa6qZLiuy/0lHkL9lyEeOBW2IJKiNON",
12
- "sha512": "jQxqZc1/RMdxLulD4P+zQuOLaPkGE7upYTQCxilIQtjtWvJfHDrPqbP2Tr/WrMGzSCNtIsb2hWUD/Au6gzwd5Q=="
10
+ "sha256": "tJAt7yYRy2+sp2C+SD5nTuv7TpLxDEXt22o3aWRyvM0=",
11
+ "sha384": "yD1ajrrBKJaAisXaaM5X/+gPtEqWnz5l4pa3An5uJo2RqQ5N9KZ6vO5TOIsdd+G3",
12
+ "sha512": "Pv09H+Qr4mtWXKHoZ4EtRjbwz4Lv4PUBlVukrPX1EdFPgv08X6FCN0YV4xzHEOnNqKcSiOiQiJgIIE9uzqg3uQ=="
13
13
  }
14
14
  },
15
15
  "@min.js": {
16
16
  "file": "applicationinsights-channel-js.min.js",
17
17
  "type": "text/javascript; charset=utf-8",
18
- "integrity": "sha256-gIvls6+bpkceRqLwHJyVMHTIS3+Ja6kirEw+YoMHyrI= sha384-aqRE+RR1HjvZv2vvPQl55vYUyVl2Uf2a7HNJ9teFg6YnMbfTBe7t9dLJV7+cD0su sha512-6S6//teLqYhifnsynTjfWdIgLutZTN6kL0Yjl/r4ZctvEpyZpM3MqGhNewlz8i9GxxfHL26crxvdS27V1fWW7w==",
18
+ "integrity": "sha256-0GS1Ried7uaucgSXrhaxkD1ororwWmjCoNJ7uuWZW5k= sha384-LFEvcJRscXe7BXQRcCKLjT6Bp5Z1g6x0RDPwc1e9LgtJuRnpGKO2ZmGeIEp3NsvU sha512-7Lm+HLMPF78FmvsAXzM9tCowCUZIsoTsKqjBFdfWqBsHA/N9hrQzrgVSH/ssE6xhhtf4m8Gpudi/KllfrZtd5g==",
19
19
  "hashes": {
20
- "sha256": "gIvls6+bpkceRqLwHJyVMHTIS3+Ja6kirEw+YoMHyrI=",
21
- "sha384": "aqRE+RR1HjvZv2vvPQl55vYUyVl2Uf2a7HNJ9teFg6YnMbfTBe7t9dLJV7+cD0su",
22
- "sha512": "6S6//teLqYhifnsynTjfWdIgLutZTN6kL0Yjl/r4ZctvEpyZpM3MqGhNewlz8i9GxxfHL26crxvdS27V1fWW7w=="
20
+ "sha256": "0GS1Ried7uaucgSXrhaxkD1ororwWmjCoNJ7uuWZW5k=",
21
+ "sha384": "LFEvcJRscXe7BXQRcCKLjT6Bp5Z1g6x0RDPwc1e9LgtJuRnpGKO2ZmGeIEp3NsvU",
22
+ "sha512": "7Lm+HLMPF78FmvsAXzM9tCowCUZIsoTsKqjBFdfWqBsHA/N9hrQzrgVSH/ssE6xhhtf4m8Gpudi/KllfrZtd5g=="
23
23
  }
24
24
  }
25
25
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Channel, 2.7.1-nightly.202110-08
2
+ * Application Insights JavaScript SDK - Channel, 2.7.1-nightly.202110-17
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -817,12 +817,26 @@
817
817
  var AiNonUserActionablePrefix = "AI (Internal): ";
818
818
  var AiUserActionablePrefix = "AI: ";
819
819
  var AIInternalMessagePrefix = "AITR_";
820
+ var strErrorToConsole = "errorToConsole";
821
+ var strWarnToConsole = "warnToConsole";
820
822
  function _sanitizeDiagnosticText(text) {
821
823
  if (text) {
822
824
  return "\"" + text.replace(/\"/g, "") + "\"";
823
825
  }
824
826
  return "";
825
827
  }
828
+ function _logToConsole(func, message) {
829
+ var theConsole = getConsole();
830
+ if (!!theConsole) {
831
+ var logFunc = "log";
832
+ if (theConsole[func]) {
833
+ logFunc = func;
834
+ }
835
+ if (isFunction(theConsole[logFunc])) {
836
+ theConsole[logFunc](message);
837
+ }
838
+ }
839
+ }
826
840
  var _InternalLogMessage = /** @class */ (function () {
827
841
  function _InternalLogMessage(msgId, msg, isUserAct, properties) {
828
842
  if (isUserAct === void 0) { isUserAct = false; }
@@ -866,18 +880,19 @@
866
880
  throw message;
867
881
  }
868
882
  else {
883
+ var logFunc = severity === LoggingSeverity.CRITICAL ? strErrorToConsole : strWarnToConsole;
869
884
  if (!isUndefined(message.message)) {
870
885
  var logLevel = _self.consoleLoggingLevel();
871
886
  if (isUserAct) {
872
887
  var messageKey = +message.messageId;
873
- if (!_messageLogged[messageKey] && logLevel >= LoggingSeverity.WARNING) {
874
- _self.warnToConsole(message.message);
888
+ if (!_messageLogged[messageKey] && logLevel >= severity) {
889
+ _self[logFunc](message.message);
875
890
  _messageLogged[messageKey] = true;
876
891
  }
877
892
  }
878
893
  else {
879
- if (logLevel >= LoggingSeverity.WARNING) {
880
- _self.warnToConsole(message.message);
894
+ if (logLevel >= severity) {
895
+ _self[logFunc](message.message);
881
896
  }
882
897
  }
883
898
  _self.logInternalMessage(severity, message);
@@ -885,16 +900,10 @@
885
900
  }
886
901
  };
887
902
  _self.warnToConsole = function (message) {
888
- var theConsole = getConsole();
889
- if (!!theConsole) {
890
- var logFunc = "log";
891
- if (theConsole.warn) {
892
- logFunc = "warn";
893
- }
894
- if (isFunction(theConsole[logFunc])) {
895
- theConsole[logFunc](message);
896
- }
897
- }
903
+ _logToConsole("warn", message);
904
+ };
905
+ _self.errorToConsole = function (message) {
906
+ _logToConsole("error", message);
898
907
  };
899
908
  _self.resetInternalMessageCount = function () {
900
909
  _messageCount = 0;
@@ -1331,7 +1340,7 @@
1331
1340
  name = strTrim(name.toString());
1332
1341
  if (name.length > 150 ) {
1333
1342
  nameTrunc = name.substring(0, 150 );
1334
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
1343
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
1335
1344
  }
1336
1345
  }
1337
1346
  return nameTrunc || name;
@@ -1344,7 +1353,7 @@
1344
1353
  value = strTrim(value);
1345
1354
  if (value.toString().length > maxLength) {
1346
1355
  valueTrunc = value.toString().substring(0, maxLength);
1347
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
1356
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
1348
1357
  }
1349
1358
  }
1350
1359
  return valueTrunc || value;
@@ -1357,7 +1366,7 @@
1357
1366
  if (message) {
1358
1367
  if (message.length > 32768 ) {
1359
1368
  messageTrunc = message.substring(0, 32768 );
1360
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
1369
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
1361
1370
  }
1362
1371
  }
1363
1372
  return messageTrunc || message;
@@ -1368,7 +1377,7 @@
1368
1377
  var value = "" + exception;
1369
1378
  if (value.length > 32768 ) {
1370
1379
  exceptionTrunc = value.substring(0, 32768 );
1371
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
1380
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
1372
1381
  }
1373
1382
  }
1374
1383
  return exceptionTrunc || exception;
@@ -1382,7 +1391,7 @@
1382
1391
  value = getJSON().stringify(value);
1383
1392
  }
1384
1393
  catch (e) {
1385
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
1394
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
1386
1395
  }
1387
1396
  }
1388
1397
  value = dataSanitizeString(logger, value, 8192 );
@@ -1413,7 +1422,7 @@
1413
1422
  input = strTrim(input);
1414
1423
  if (input.length > maxLength) {
1415
1424
  inputTrunc = input.substring(0, maxLength);
1416
- logger.throwInternal(LoggingSeverity.WARNING, _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
1425
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
1417
1426
  }
1418
1427
  }
1419
1428
  return inputTrunc || input;
@@ -2685,7 +2694,7 @@
2685
2694
  function _setValueIf(target, field, value) {
2686
2695
  return setValue(target, field, value, isTruthy);
2687
2696
  }
2688
- function _extractPartAExtensions(item, env) {
2697
+ function _extractPartAExtensions(logger, item, env) {
2689
2698
  var envTags = env.tags = env.tags || {};
2690
2699
  var itmExt = item.ext = item.ext || {};
2691
2700
  var itmTags = item.tags = item.tags || [];
@@ -2726,7 +2735,7 @@
2726
2735
  var extTrace = itmExt.trace;
2727
2736
  if (extTrace) {
2728
2737
  _setValueIf(envTags, CtxTagKeys.operationParentId, extTrace.parentID);
2729
- _setValueIf(envTags, CtxTagKeys.operationName, extTrace.name);
2738
+ _setValueIf(envTags, CtxTagKeys.operationName, dataSanitizeString(logger, extTrace.name));
2730
2739
  _setValueIf(envTags, CtxTagKeys.operationId, extTrace.traceID);
2731
2740
  }
2732
2741
  var tgs = {};
@@ -2777,7 +2786,7 @@
2777
2786
  envelope.iKey = telemetryItem.iKey;
2778
2787
  var iKeyNoDashes = telemetryItem.iKey.replace(/-/g, "");
2779
2788
  envelope.name = envelope.name.replace("{0}", iKeyNoDashes);
2780
- _extractPartAExtensions(telemetryItem, envelope);
2789
+ _extractPartAExtensions(logger, telemetryItem, envelope);
2781
2790
  telemetryItem.tags = telemetryItem.tags || [];
2782
2791
  return optimizeObject(envelope);
2783
2792
  }
@@ -2787,7 +2796,7 @@
2787
2796
  }
2788
2797
  }
2789
2798
  var EnvelopeCreator = {
2790
- Version: "2.7.1-nightly.202110-08"
2799
+ Version: "2.7.1-nightly.202110-17"
2791
2800
  };
2792
2801
  function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
2793
2802
  EnvelopeCreatorInit(logger, telemetryItem);