@microsoft/applicationinsights-web-basic 3.0.0-beta.2302-03 → 3.0.0-beta.2302-04

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/aib.2.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript Web SDK - Basic, 3.0.0-beta.2302-03
2
+ * Application Insights JavaScript Web SDK - Basic, 3.0.0-beta.2302-04
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -414,7 +414,8 @@
414
414
  return typeof value === theType;
415
415
  };
416
416
  }
417
- function _createObjIs(theType) {
417
+ function _createObjIs(theName) {
418
+ var theType = "[object " + theName + "]";
418
419
  return function (value) {
419
420
  return !!(value && objToString(value) === theType);
420
421
  };
@@ -447,10 +448,10 @@
447
448
  return !!value && typeof value === OBJECT;
448
449
  }
449
450
  var isArray = ArrCls.isArray;
450
- var isDate = _createObjIs("[object Date]");
451
+ var isDate = _createObjIs("Date");
451
452
  var isNumber = _createIs(NUMBER);
452
453
  var isBoolean = _createIs(BOOLEAN);
453
- var isError = _createObjIs("[object Error]");
454
+ var isError = _createObjIs("Error");
454
455
  function isTruthy(value) {
455
456
  return !(!value || _safeGet(function () { return !(value && (0 + value)); }, !value));
456
457
  }
@@ -478,6 +479,15 @@
478
479
  }
479
480
  }
480
481
 
482
+ function _createKeyValueMap(values, keyType, valueType, completeFn) {
483
+ var theMap = {};
484
+ objForEachKey(values, function (key, value) {
485
+ theMap[key] = keyType ? value : key;
486
+ theMap[value] = valueType ? value : key;
487
+ });
488
+ return completeFn(theMap);
489
+ }
490
+
481
491
  function throwError(message) {
482
492
  throw new Error(message);
483
493
  }
@@ -486,9 +496,7 @@
486
496
  }
487
497
 
488
498
  var _objFreeze = ObjClass["freeze"];
489
- function _doNothing(value) {
490
- return value;
491
- }
499
+ var _doNothing = function (value) { return value; };
492
500
  function objKeys(value) {
493
501
  if (!isObject(value) || value === null) {
494
502
  throwTypeError("objKeys called on non-object");
@@ -509,17 +517,12 @@
509
517
  var objGetPrototypeOf = ObjClass["getPrototypeOf"] || _doNothing;
510
518
 
511
519
  function createEnum(values) {
512
- var theEnum = {};
513
- objForEachKey(values, function (field, value) {
514
- theEnum[field] = value;
515
- theEnum[value] = field;
516
- });
517
- return objDeepFreeze(theEnum);
520
+ return _createKeyValueMap(values, 1, 0, objDeepFreeze);
518
521
  }
519
522
  function createSimpleMap(values) {
520
523
  var mapClass = {};
521
- objForEachKey(values, function (field, value) {
522
- mapClass[field] = value[1];
524
+ objForEachKey(values, function (key, value) {
525
+ mapClass[key] = value[1];
523
526
  mapClass[value[0]] = value[1];
524
527
  });
525
528
  return objDeepFreeze(mapClass);
@@ -556,6 +559,45 @@
556
559
  return _globalCfg;
557
560
  }
558
561
 
562
+ function dumpObj(object, format) {
563
+ var propertyValueDump = "";
564
+ if (isError(object)) {
565
+ propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
566
+ }
567
+ else {
568
+ try {
569
+ propertyValueDump = JSON.stringify(object, null, format ? (isNumber(format) ? format : 4) : UNDEF_VALUE);
570
+ }
571
+ catch (e) {
572
+ propertyValueDump = " - " + dumpObj(e, format);
573
+ }
574
+ }
575
+ return objToString(object) + ": " + propertyValueDump;
576
+ }
577
+
578
+ function _extractArgs(args, startAt) {
579
+ var theArgs = [];
580
+ for (var lp = startAt; lp < args[LENGTH]; lp++) {
581
+ theArgs[lp - startAt] = args[lp];
582
+ }
583
+ return theArgs;
584
+ }
585
+
586
+ function _unwrapFunction(funcName) {
587
+ return function (thisArg) {
588
+ var args = _extractArgs(arguments, 1);
589
+ if ((thisArg || thisArg === EMPTY) && thisArg[funcName]) {
590
+ return thisArg[funcName].apply(thisArg, args);
591
+ }
592
+ throwTypeError("'" + funcName + "' not defined for " + dumpObj(thisArg));
593
+ };
594
+ }
595
+
596
+ var strSubstring = _unwrapFunction("substring");
597
+ function strLeft(value, count) {
598
+ return strSubstring(value, 0, count);
599
+ }
600
+
559
601
  var _polySymbols;
560
602
  function _globalSymbolRegistry() {
561
603
  if (!_polySymbols) {
@@ -655,6 +697,9 @@
655
697
  var _cachedWindow;
656
698
  var _cachedDocument;
657
699
  var _cachedNavigator;
700
+ function _lazySafeGetInst(name) {
701
+ return _lazySafeGet(function () { return getInst(name) || UNDEF_VALUE; }, UNDEF_VALUE);
702
+ }
658
703
  function getGlobal(useCached) {
659
704
  (!_cachedGlobal || useCached === false || (_globalLazyTestHooks.lzy && !_cachedGlobal.b)) && (_cachedGlobal = _lazySafeGet(_getGlobalValue, null));
660
705
  return _cachedGlobal.v;
@@ -673,32 +718,37 @@
673
718
  return !!getDocument();
674
719
  }
675
720
  function getDocument() {
676
- (!_cachedDocument || (_globalLazyTestHooks.lzy && !_cachedDocument.b)) && (_cachedDocument = _lazySafeGet(function () { return getInst(DOCUMENT); }, UNDEF_VALUE));
721
+ (!_cachedDocument || (_globalLazyTestHooks.lzy && !_cachedDocument.b)) && (_cachedDocument = _lazySafeGetInst(DOCUMENT));
677
722
  return _cachedDocument.v;
678
723
  }
679
724
  function hasWindow() {
680
725
  return !!getWindow();
681
726
  }
682
727
  function getWindow() {
683
- (!_cachedWindow || (_globalLazyTestHooks.lzy && !_cachedWindow.b)) && (_cachedWindow = _lazySafeGet(function () { return getInst(WINDOW); }, UNDEF_VALUE));
728
+ (!_cachedWindow || (_globalLazyTestHooks.lzy && !_cachedWindow.b)) && (_cachedWindow = _lazySafeGetInst(WINDOW));
684
729
  return _cachedWindow.v;
685
730
  }
686
731
  function hasNavigator() {
687
732
  return !!getNavigator();
688
733
  }
689
734
  function getNavigator() {
690
- (!_cachedNavigator || (_globalLazyTestHooks.lzy && !_cachedNavigator.b)) && (_cachedNavigator = _lazySafeGet(function () { return getInst(NAVIGATOR); }, UNDEF_VALUE));
735
+ (!_cachedNavigator || (_globalLazyTestHooks.lzy && !_cachedNavigator.b)) && (_cachedNavigator = _lazySafeGetInst(NAVIGATOR));
691
736
  return _cachedNavigator.v;
692
737
  }
693
738
 
694
739
  var _symbol;
695
740
  var _symbolFor;
696
741
  var _symbolKeyFor;
742
+ function _getSymbolValue(name) {
743
+ return _lazySafeGet(function () {
744
+ return (_symbol.v ? _symbol[name] : UNDEF_VALUE);
745
+ }, UNDEF_VALUE);
746
+ }
697
747
  function getSymbol() {
698
748
  var resetCache = !_symbol || (_globalLazyTestHooks && _globalLazyTestHooks.lzy && !_symbol.b);
699
- resetCache && (_symbol = _lazySafeGet(function () { return isDefined(Symbol) ? getInst(SYMBOL) : UNDEF_VALUE; }, UNDEF_VALUE));
700
- (!_symbolFor || resetCache) && (_symbolFor = _lazySafeGet(function () { return _symbol.v ? _symbol["for"] : UNDEF_VALUE; }, UNDEF_VALUE));
701
- (!_symbolKeyFor || resetCache) && (_symbolKeyFor = _lazySafeGet(function () { return _symbol.v ? _symbol["keyFor"] : UNDEF_VALUE; }, UNDEF_VALUE));
749
+ resetCache && (_symbol = _lazySafeGetInst(SYMBOL));
750
+ (!_symbolFor || resetCache) && (_symbolFor = _getSymbolValue("for"));
751
+ (!_symbolKeyFor || resetCache) && (_symbolKeyFor = _getSymbolValue("keyFor"));
702
752
  return _symbol.v;
703
753
  }
704
754
  function newSymbol(description, noPoly) {
@@ -746,46 +796,6 @@
746
796
  }
747
797
  }
748
798
 
749
- function dumpObj(object, format) {
750
- var objectTypeDump = objToString(object);
751
- var propertyValueDump = "";
752
- if (objectTypeDump === "[object Error]") {
753
- propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
754
- }
755
- else {
756
- try {
757
- if (format) {
758
- if (isNumber(format)) {
759
- propertyValueDump = JSON.stringify(object, null, format);
760
- }
761
- else {
762
- propertyValueDump = JSON.stringify(object, null, 4);
763
- }
764
- }
765
- else {
766
- propertyValueDump = JSON.stringify(object);
767
- }
768
- }
769
- catch (e) {
770
- propertyValueDump = objToString(object) + " - " + dumpObj(e, format);
771
- }
772
- }
773
- return objectTypeDump + ": " + propertyValueDump;
774
- }
775
-
776
- function _unwrapFunction(funcName) {
777
- return function (thisArg) {
778
- var args = [];
779
- for (var _i = 1; _i < arguments.length; _i++) {
780
- args[_i - 1] = arguments[_i];
781
- }
782
- if ((thisArg || thisArg === EMPTY) && thisArg[funcName]) {
783
- return thisArg[funcName].apply(thisArg, args);
784
- }
785
- throwTypeError("'" + funcName + "' not defined for " + dumpObj(thisArg));
786
- };
787
- }
788
-
789
799
  var arrIndexOf = _unwrapFunction(INDEX_OF);
790
800
 
791
801
  var arrMap = _unwrapFunction("map");
@@ -798,9 +808,7 @@
798
808
  d.__proto__ = b;
799
809
  }) ||
800
810
  function (d, b) {
801
- objForEachKey(b, function (key, value) {
802
- d[key] = value;
803
- });
811
+ objForEachKey(b, function (key, value) { return d[key] = value; });
804
812
  };
805
813
  return fn(obj, proto);
806
814
  }
@@ -1006,11 +1014,6 @@
1006
1014
  return _doExtend(objDeepCopy(target) || {}, theArgs);
1007
1015
  }
1008
1016
 
1009
- var strSubstring = _unwrapFunction("substring");
1010
- function strLeft(value, count) {
1011
- return strSubstring(value, 0, count);
1012
- }
1013
-
1014
1017
  var ENDS_WITH = "endsWith";
1015
1018
  var strEndsWith = StrProto[ENDS_WITH] ? _unwrapFunction(ENDS_WITH) : polyStrEndsWith;
1016
1019
  function polyStrEndsWith(value, searchString, length) {
@@ -1080,14 +1083,6 @@
1080
1083
  return timer;
1081
1084
  }
1082
1085
 
1083
- function _extractArgs(args, startAt) {
1084
- var theArgs = [];
1085
- for (var lp = startAt; lp < args[LENGTH]; lp++) {
1086
- theArgs[lp - startAt] = args[lp];
1087
- }
1088
- return theArgs;
1089
- }
1090
-
1091
1086
  function _createTimeoutWith(self, startTimer, overrideFn, theArgs) {
1092
1087
  var isArr = isArray(overrideFn);
1093
1088
  var len = isArr ? overrideFn.length : 0;
@@ -1587,7 +1582,7 @@
1587
1582
  }
1588
1583
 
1589
1584
  var _objDefineProperty = ObjDefineProperty;
1590
- var version = "3.0.0-beta.2302-03";
1585
+ var version = "3.0.0-beta.2302-04";
1591
1586
  var instanceName = "." + newId(6);
1592
1587
  var _dataUid = 0;
1593
1588
  function _createAccessor(target, prop, value) {
@@ -5779,7 +5774,7 @@
5779
5774
  }
5780
5775
  }
5781
5776
  var EnvelopeCreator = {
5782
- Version: "3.0.0-beta.2302-03"
5777
+ Version: "3.0.0-beta.2302-04"
5783
5778
  };
5784
5779
  function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
5785
5780
  EnvelopeCreatorInit(logger, telemetryItem);