@microsoft/applicationinsights-properties-js 2.8.0-nightly.2204-04 → 2.8.0-nightly.2204-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.
Files changed (33) hide show
  1. package/browser/applicationinsights-properties-js.integrity.json +9 -9
  2. package/browser/applicationinsights-properties-js.js +44 -123
  3. package/browser/applicationinsights-properties-js.js.map +1 -1
  4. package/browser/applicationinsights-properties-js.min.js +2 -2
  5. package/browser/applicationinsights-properties-js.min.js.map +1 -1
  6. package/dist/applicationinsights-properties-js.d.ts +1 -1
  7. package/dist/applicationinsights-properties-js.js +44 -123
  8. package/dist/applicationinsights-properties-js.js.map +1 -1
  9. package/dist/applicationinsights-properties-js.min.js +2 -2
  10. package/dist/applicationinsights-properties-js.min.js.map +1 -1
  11. package/dist/applicationinsights-properties-js.rollup.d.ts +1 -1
  12. package/dist-esm/Context/Application.js +1 -1
  13. package/dist-esm/Context/Device.js +1 -1
  14. package/dist-esm/Context/Internal.js +2 -2
  15. package/dist-esm/Context/Internal.js.map +1 -1
  16. package/dist-esm/Context/Location.js +1 -1
  17. package/dist-esm/Context/Session.js +6 -6
  18. package/dist-esm/Context/Session.js.map +1 -1
  19. package/dist-esm/Context/TelemetryTrace.js +1 -1
  20. package/dist-esm/Context/User.js +3 -3
  21. package/dist-esm/Context/User.js.map +1 -1
  22. package/dist-esm/Interfaces/IPropTelemetryContext.js +1 -1
  23. package/dist-esm/Interfaces/ITelemetryConfig.js +1 -1
  24. package/dist-esm/PropertiesPlugin.js +4 -4
  25. package/dist-esm/PropertiesPlugin.js.map +1 -1
  26. package/dist-esm/TelemetryContext.js +1 -1
  27. package/dist-esm/applicationinsights-properties-js.js +1 -1
  28. package/package.json +3 -3
  29. package/src/Context/Internal.ts +1 -1
  30. package/src/Context/Session.ts +14 -10
  31. package/src/Context/User.ts +4 -4
  32. package/src/PropertiesPlugin.ts +5 -5
  33. package/src/TelemetryContext.ts +2 -2
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights properties plugin, 2.8.0-nightly.2204-04
2
+ * Microsoft Application Insights properties plugin, 2.8.0-nightly.2204-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 - Properties Plugin, 2.8.0-nightly.2204-04
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.8.0-nightly.2204-05
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -566,6 +566,16 @@
566
566
  function _doNothing(value) {
567
567
  return value;
568
568
  }
569
+ function deepFreeze(obj) {
570
+ if (_objFreeze) {
571
+ objForEachKey(obj, function (name, value) {
572
+ if (isArray(value) || isObject(value)) {
573
+ _objFreeze(value);
574
+ }
575
+ });
576
+ }
577
+ return objFreeze(obj);
578
+ }
569
579
  var objFreeze = _objFreeze || _doNothing;
570
580
  function dateNow() {
571
581
  var dt = Date;
@@ -605,9 +615,6 @@
605
615
  function isTruthy(value) {
606
616
  return !!value;
607
617
  }
608
- function throwError(message) {
609
- throw new Error(message);
610
- }
611
618
  function _createProxyFunction(source, funcName) {
612
619
  var srcFunc = null;
613
620
  var src = null;
@@ -628,9 +635,8 @@
628
635
  };
629
636
  }
630
637
  function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
631
- if (overwriteTarget === void 0) { overwriteTarget = true; }
632
638
  if (target && name && source) {
633
- if (overwriteTarget || isUndefined(target[name])) {
639
+ if (overwriteTarget !== false || isUndefined(target[name])) {
634
640
  target[name] = _createProxyFunction(source, theFunc);
635
641
  }
636
642
  }
@@ -648,17 +654,6 @@
648
654
  return class_1;
649
655
  }());
650
656
  }
651
- function createEnumStyle(values) {
652
- var enumClass = {};
653
- objForEachKey(values, function (field, value) {
654
- enumClass[field] = value;
655
- if (!isUndefined(enumClass[value])) {
656
- throwError("[" + value + "] exists for " + field);
657
- }
658
- enumClass[value] = field;
659
- });
660
- return objFreeze(enumClass);
661
- }
662
657
  function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
663
658
  var theArgs = arguments;
664
659
  var extended = theArgs[0] || {};
@@ -704,6 +699,15 @@
704
699
  return extended;
705
700
  }
706
701
 
702
+ function createEnumStyle(values) {
703
+ var enumClass = {};
704
+ objForEachKey(values, function (field, value) {
705
+ enumClass[field] = value;
706
+ enumClass[value] = field;
707
+ });
708
+ return deepFreeze(enumClass);
709
+ }
710
+
707
711
  var strWindow = "window";
708
712
  var strDocument = "document";
709
713
  var strNavigator = "navigator";
@@ -969,10 +973,16 @@
969
973
  }
970
974
  return DiagnosticLogger;
971
975
  }());
976
+ function _getLogger(logger) {
977
+ return (logger || new DiagnosticLogger());
978
+ }
972
979
  function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
973
980
  if (isUserAct === void 0) { isUserAct = false; }
974
981
  (logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
975
982
  }
983
+ function _logInternalMessage(logger, severity, message) {
984
+ _getLogger(logger).logInternalMessage(severity, message);
985
+ }
976
986
 
977
987
  var strExecutionContextKey = "ctx";
978
988
  var PerfEvent = /** @class */ (function () {
@@ -1155,7 +1165,7 @@
1155
1165
  }
1156
1166
 
1157
1167
  var _objDefineProperty = ObjDefineProperty;
1158
- var version = "2.8.0-nightly.2204-04";
1168
+ var version = "2.8.0-nightly.2204-05";
1159
1169
  var instanceName = "." + newId(6);
1160
1170
  var _dataUid = 0;
1161
1171
  function _createAccessor(target, prop, value) {
@@ -2011,95 +2021,6 @@
2011
2021
  return oct.substr(0, 8) + oct.substr(9, 4) + "4" + oct.substr(13, 3) + clockSequenceHi + oct.substr(16, 3) + oct.substr(19, 12);
2012
2022
  }
2013
2023
 
2014
- var LoggingSeverity = createEnumStyle({
2015
- CRITICAL: 1 ,
2016
- WARNING: 2
2017
- });
2018
- var _InternalMessageId = createEnumStyle({
2019
- BrowserDoesNotSupportLocalStorage: 0 ,
2020
- BrowserCannotReadLocalStorage: 1 ,
2021
- BrowserCannotReadSessionStorage: 2 ,
2022
- BrowserCannotWriteLocalStorage: 3 ,
2023
- BrowserCannotWriteSessionStorage: 4 ,
2024
- BrowserFailedRemovalFromLocalStorage: 5 ,
2025
- BrowserFailedRemovalFromSessionStorage: 6 ,
2026
- CannotSendEmptyTelemetry: 7 ,
2027
- ClientPerformanceMathError: 8 ,
2028
- ErrorParsingAISessionCookie: 9 ,
2029
- ErrorPVCalc: 10 ,
2030
- ExceptionWhileLoggingError: 11 ,
2031
- FailedAddingTelemetryToBuffer: 12 ,
2032
- FailedMonitorAjaxAbort: 13 ,
2033
- FailedMonitorAjaxDur: 14 ,
2034
- FailedMonitorAjaxOpen: 15 ,
2035
- FailedMonitorAjaxRSC: 16 ,
2036
- FailedMonitorAjaxSend: 17 ,
2037
- FailedMonitorAjaxGetCorrelationHeader: 18 ,
2038
- FailedToAddHandlerForOnBeforeUnload: 19 ,
2039
- FailedToSendQueuedTelemetry: 20 ,
2040
- FailedToReportDataLoss: 21 ,
2041
- FlushFailed: 22 ,
2042
- MessageLimitPerPVExceeded: 23 ,
2043
- MissingRequiredFieldSpecification: 24 ,
2044
- NavigationTimingNotSupported: 25 ,
2045
- OnError: 26 ,
2046
- SessionRenewalDateIsZero: 27 ,
2047
- SenderNotInitialized: 28 ,
2048
- StartTrackEventFailed: 29 ,
2049
- StopTrackEventFailed: 30 ,
2050
- StartTrackFailed: 31 ,
2051
- StopTrackFailed: 32 ,
2052
- TelemetrySampledAndNotSent: 33 ,
2053
- TrackEventFailed: 34 ,
2054
- TrackExceptionFailed: 35 ,
2055
- TrackMetricFailed: 36 ,
2056
- TrackPVFailed: 37 ,
2057
- TrackPVFailedCalc: 38 ,
2058
- TrackTraceFailed: 39 ,
2059
- TransmissionFailed: 40 ,
2060
- FailedToSetStorageBuffer: 41 ,
2061
- FailedToRestoreStorageBuffer: 42 ,
2062
- InvalidBackendResponse: 43 ,
2063
- FailedToFixDepricatedValues: 44 ,
2064
- InvalidDurationValue: 45 ,
2065
- TelemetryEnvelopeInvalid: 46 ,
2066
- CreateEnvelopeError: 47 ,
2067
- CannotSerializeObject: 48 ,
2068
- CannotSerializeObjectNonSerializable: 49 ,
2069
- CircularReferenceDetected: 50 ,
2070
- ClearAuthContextFailed: 51 ,
2071
- ExceptionTruncated: 52 ,
2072
- IllegalCharsInName: 53 ,
2073
- ItemNotInArray: 54 ,
2074
- MaxAjaxPerPVExceeded: 55 ,
2075
- MessageTruncated: 56 ,
2076
- NameTooLong: 57 ,
2077
- SampleRateOutOfRange: 58 ,
2078
- SetAuthContextFailed: 59 ,
2079
- SetAuthContextFailedAccountName: 60 ,
2080
- StringValueTooLong: 61 ,
2081
- StartCalledMoreThanOnce: 62 ,
2082
- StopCalledWithoutStart: 63 ,
2083
- TelemetryInitializerFailed: 64 ,
2084
- TrackArgumentsNotSpecified: 65 ,
2085
- UrlTooLong: 66 ,
2086
- SessionStorageBufferFull: 67 ,
2087
- CannotAccessCookie: 68 ,
2088
- IdTooLong: 69 ,
2089
- InvalidEvent: 70 ,
2090
- FailedMonitorAjaxSetRequestHeader: 71 ,
2091
- SendBrowserInfoOnUserInit: 72 ,
2092
- PluginException: 73 ,
2093
- NotificationException: 74 ,
2094
- SnippetScriptLoadFailure: 99 ,
2095
- InvalidInstrumentationKey: 100 ,
2096
- CannotParseAiBlobValue: 101 ,
2097
- InvalidContentBlob: 102 ,
2098
- TrackPageActionEventFailed: 103 ,
2099
- FailedAddingCustomDefinedRequestContext: 104 ,
2100
- InMemoryStorageBufferFull: 105
2101
- });
2102
-
2103
2024
  function dataSanitizeKeyAndAddUniqueness(logger, key, map) {
2104
2025
  var origLength = key.length;
2105
2026
  var field = dataSanitizeKey(logger, key);
@@ -2120,7 +2041,7 @@
2120
2041
  name = strTrim(name.toString());
2121
2042
  if (name.length > 150 ) {
2122
2043
  nameTrunc = name.substring(0, 150 );
2123
- _throwInternal(logger, 2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
2044
+ _throwInternal(logger, 2 , 57 , "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
2124
2045
  }
2125
2046
  }
2126
2047
  return nameTrunc || name;
@@ -2133,13 +2054,13 @@
2133
2054
  value = strTrim(value);
2134
2055
  if (value.toString().length > maxLength) {
2135
2056
  valueTrunc = value.toString().substring(0, maxLength);
2136
- _throwInternal(logger, 2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
2057
+ _throwInternal(logger, 2 , 61 , "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
2137
2058
  }
2138
2059
  }
2139
2060
  return valueTrunc || value;
2140
2061
  }
2141
2062
  function dataSanitizeUrl(logger, url) {
2142
- return dataSanitizeInput(logger, url, 2048 , _InternalMessageId.UrlTooLong);
2063
+ return dataSanitizeInput(logger, url, 2048 , 66 );
2143
2064
  }
2144
2065
  function dataSanitizeProperties(logger, properties) {
2145
2066
  if (properties) {
@@ -2150,7 +2071,7 @@
2150
2071
  value = getJSON().stringify(value);
2151
2072
  }
2152
2073
  catch (e) {
2153
- _throwInternal(logger, 2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
2074
+ _throwInternal(logger, 2 , 49 , "custom property is not valid", { exception: e }, true);
2154
2075
  }
2155
2076
  }
2156
2077
  value = dataSanitizeString(logger, value, 8192 );
@@ -2173,7 +2094,7 @@
2173
2094
  return measurements;
2174
2095
  }
2175
2096
  function dataSanitizeId(logger, id) {
2176
- return id ? dataSanitizeInput(logger, id, 128 , _InternalMessageId.IdTooLong).toString() : id;
2097
+ return id ? dataSanitizeInput(logger, id, 128 , 69 ).toString() : id;
2177
2098
  }
2178
2099
  function dataSanitizeInput(logger, input, maxLength, _msgId) {
2179
2100
  var inputTrunc;
@@ -2270,7 +2191,7 @@
2270
2191
  }
2271
2192
  catch (e) {
2272
2193
  _canUseLocalStorage = false;
2273
- _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2194
+ _throwInternal(logger, 2 , 1 , "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2274
2195
  }
2275
2196
  }
2276
2197
  return null;
@@ -2284,7 +2205,7 @@
2284
2205
  }
2285
2206
  catch (e) {
2286
2207
  _canUseLocalStorage = false;
2287
- _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2208
+ _throwInternal(logger, 2 , 3 , "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2288
2209
  }
2289
2210
  }
2290
2211
  return false;
@@ -2298,7 +2219,7 @@
2298
2219
  }
2299
2220
  catch (e) {
2300
2221
  _canUseLocalStorage = false;
2301
- _throwInternal(logger, 2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2222
+ _throwInternal(logger, 2 , 5 , "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2302
2223
  }
2303
2224
  }
2304
2225
  return false;
@@ -2507,10 +2428,10 @@
2507
2428
  var acqMs = +tokens[1] || 0;
2508
2429
  var renewalMs = +tokens[2] || 0;
2509
2430
  if (isNaN(acqMs) || acqMs <= 0) {
2510
- _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SessionRenewalDateIsZero, "AI session acquisition date is 0" + sessionReset);
2431
+ _throwInternal(_logger, 2 , 27 , "AI session acquisition date is 0" + sessionReset);
2511
2432
  }
2512
2433
  else if (isNaN(renewalMs) || renewalMs <= 0) {
2513
- _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SessionRenewalDateIsZero, "AI session renewal date is 0" + sessionReset);
2434
+ _throwInternal(_logger, 2 , 27 , "AI session renewal date is 0" + sessionReset);
2514
2435
  }
2515
2436
  else if (tokens[0]) {
2516
2437
  session.id = tokens[0];
@@ -2520,7 +2441,7 @@
2520
2441
  }
2521
2442
  }
2522
2443
  catch (e) {
2523
- _logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ErrorParsingAISessionCookie, "Error parsing ai_session value [" + (sessionData || "") + "]" + sessionReset + " - " + getExceptionName(e), { exception: dumpObj(e) });
2444
+ _throwInternal(_logger, 1 , 9 , "Error parsing ai_session value [" + (sessionData || "") + "]" + sessionReset + " - " + getExceptionName(e), { exception: dumpObj(e) });
2524
2445
  }
2525
2446
  }
2526
2447
  return isValid;
@@ -2532,7 +2453,7 @@
2532
2453
  _self.automaticSession.acquisitionDate = nowMs;
2533
2454
  _setCookie(_self.automaticSession, nowMs);
2534
2455
  if (!utlCanUseLocalStorage()) {
2535
- _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserDoesNotSupportLocalStorage, "Browser does not support local storage. Session durations will be inaccurate.");
2456
+ _throwInternal(_logger, 2 , 0 , "Browser does not support local storage. Session durations will be inaccurate.");
2536
2457
  }
2537
2458
  }
2538
2459
  function _setCookie(session, nowMs) {
@@ -2578,7 +2499,7 @@
2578
2499
  return Device;
2579
2500
  }());
2580
2501
 
2581
- var Version = "2.8.0-nightly.2204-04";
2502
+ var Version = "2.8.0-nightly.2204-05";
2582
2503
  var Internal = /** @class */ (function () {
2583
2504
  function Internal(config) {
2584
2505
  this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + "_" : "") + "javascript:" + Version;
@@ -2654,7 +2575,7 @@
2654
2575
  if (storeInCookie === void 0) { storeInCookie = false; }
2655
2576
  var isInvalidInput = !_validateUserInput(authenticatedUserId) || (accountId && !_validateUserInput(accountId));
2656
2577
  if (isInvalidInput) {
2657
- _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SetAuthContextFailedAccountName, "Setting auth user context failed. " +
2578
+ _throwInternal(_logger, 2 , 60 , "Setting auth user context failed. " +
2658
2579
  "User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.", true);
2659
2580
  return;
2660
2581
  }
@@ -2871,8 +2792,8 @@
2871
2792
  _processTelemetryInternal(event, itemCtx);
2872
2793
  if (userCtx && userCtx.isNewUser) {
2873
2794
  userCtx.isNewUser = false;
2874
- var message = new _InternalLogMessage(_InternalMessageId.SendBrowserInfoOnUserInit, ((getNavigator() || {}).userAgent || ""));
2875
- itemCtx.diagLog().logInternalMessage(LoggingSeverity.CRITICAL, message);
2795
+ var message = new _InternalLogMessage(72 , ((getNavigator() || {}).userAgent || ""));
2796
+ _logInternalMessage(itemCtx.diagLog(), 1 , message);
2876
2797
  }
2877
2798
  _self.processNext(event, itemCtx);
2878
2799
  }