@microsoft/applicationinsights-common 3.0.0-beta.2302-06 → 3.0.0-beta.2303-03

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 (98) hide show
  1. package/browser/applicationinsights-common.integrity.json +9 -9
  2. package/browser/applicationinsights-common.js +197 -69
  3. package/browser/applicationinsights-common.js.map +1 -1
  4. package/browser/applicationinsights-common.min.js +2 -2
  5. package/browser/applicationinsights-common.min.js.map +1 -1
  6. package/dist/applicationinsights-common.api.json +57 -9
  7. package/dist/applicationinsights-common.api.md +5 -5
  8. package/dist/applicationinsights-common.d.ts +16 -3
  9. package/dist/applicationinsights-common.js +197 -69
  10. package/dist/applicationinsights-common.js.map +1 -1
  11. package/dist/applicationinsights-common.min.js +2 -2
  12. package/dist/applicationinsights-common.min.js.map +1 -1
  13. package/dist/applicationinsights-common.rollup.d.ts +16 -3
  14. package/dist-esm/ConnectionStringParser.js +1 -1
  15. package/dist-esm/Constants.js +1 -1
  16. package/dist-esm/DomHelperFuncs.js +1 -1
  17. package/dist-esm/Enums.js +1 -1
  18. package/dist-esm/HelperFuncs.js +1 -1
  19. package/dist-esm/Interfaces/ConnectionString.js +1 -1
  20. package/dist-esm/Interfaces/Context/IApplication.js +1 -1
  21. package/dist-esm/Interfaces/Context/IDevice.js +1 -1
  22. package/dist-esm/Interfaces/Context/IInternal.js +1 -1
  23. package/dist-esm/Interfaces/Context/ILocation.js +1 -1
  24. package/dist-esm/Interfaces/Context/IOperatingSystem.js +1 -1
  25. package/dist-esm/Interfaces/Context/ISample.js +1 -1
  26. package/dist-esm/Interfaces/Context/ISession.js +1 -1
  27. package/dist-esm/Interfaces/Context/ITelemetryTrace.js +1 -1
  28. package/dist-esm/Interfaces/Context/IUser.js +1 -1
  29. package/dist-esm/Interfaces/Context/IWeb.js +1 -1
  30. package/dist-esm/Interfaces/Contracts/AvailabilityData.js +1 -1
  31. package/dist-esm/Interfaces/Contracts/ContextTagKeys.js +1 -1
  32. package/dist-esm/Interfaces/Contracts/DataPointType.js +1 -1
  33. package/dist-esm/Interfaces/Contracts/DependencyKind.js +1 -1
  34. package/dist-esm/Interfaces/Contracts/DependencySourceType.js +1 -1
  35. package/dist-esm/Interfaces/Contracts/IBase.js +1 -1
  36. package/dist-esm/Interfaces/Contracts/IData.js +1 -1
  37. package/dist-esm/Interfaces/Contracts/IDataPoint.js +1 -1
  38. package/dist-esm/Interfaces/Contracts/IDomain.js +1 -1
  39. package/dist-esm/Interfaces/Contracts/IEnvelope.js +1 -1
  40. package/dist-esm/Interfaces/Contracts/IEventData.js +1 -1
  41. package/dist-esm/Interfaces/Contracts/IExceptionData.js +1 -1
  42. package/dist-esm/Interfaces/Contracts/IExceptionDetails.js +1 -1
  43. package/dist-esm/Interfaces/Contracts/IMessageData.js +1 -1
  44. package/dist-esm/Interfaces/Contracts/IMetricData.js +1 -1
  45. package/dist-esm/Interfaces/Contracts/IPageViewData.js +1 -1
  46. package/dist-esm/Interfaces/Contracts/IPageViewPerfData.js +1 -1
  47. package/dist-esm/Interfaces/Contracts/IRemoteDependencyData.js +1 -1
  48. package/dist-esm/Interfaces/Contracts/IStackFrame.js +1 -1
  49. package/dist-esm/Interfaces/Contracts/RequestData.js +1 -1
  50. package/dist-esm/Interfaces/Contracts/SeverityLevel.js +1 -1
  51. package/dist-esm/Interfaces/IAppInsights.js +1 -1
  52. package/dist-esm/Interfaces/IChannelControlsAI.js +1 -1
  53. package/dist-esm/Interfaces/IConfig.js +1 -1
  54. package/dist-esm/Interfaces/ICorrelationConfig.js +1 -1
  55. package/dist-esm/Interfaces/IDependencyTelemetry.js +1 -1
  56. package/dist-esm/Interfaces/IEventTelemetry.js +1 -1
  57. package/dist-esm/Interfaces/IExceptionTelemetry.js +1 -1
  58. package/dist-esm/Interfaces/IMetricTelemetry.js +1 -1
  59. package/dist-esm/Interfaces/IPageViewPerformanceTelemetry.js +1 -1
  60. package/dist-esm/Interfaces/IPageViewTelemetry.js +1 -1
  61. package/dist-esm/Interfaces/IPartC.js +1 -1
  62. package/dist-esm/Interfaces/IPropertiesPlugin.js +1 -1
  63. package/dist-esm/Interfaces/IRequestContext.js +1 -1
  64. package/dist-esm/Interfaces/ITelemetryContext.js +1 -1
  65. package/dist-esm/Interfaces/IThrottleMgr.js +1 -1
  66. package/dist-esm/Interfaces/ITraceTelemetry.js +1 -1
  67. package/dist-esm/Interfaces/PartAExtensions.js +1 -1
  68. package/dist-esm/Interfaces/Telemetry/IEnvelope.js +1 -1
  69. package/dist-esm/Interfaces/Telemetry/ISerializable.js +1 -1
  70. package/dist-esm/RequestResponseHeaders.js +1 -1
  71. package/dist-esm/StorageHelperFuncs.js +1 -1
  72. package/dist-esm/Telemetry/Common/Data.js +1 -1
  73. package/dist-esm/Telemetry/Common/DataPoint.js +1 -1
  74. package/dist-esm/Telemetry/Common/DataSanitizer.js +1 -1
  75. package/dist-esm/Telemetry/Common/Envelope.js +1 -1
  76. package/dist-esm/Telemetry/Event.js +1 -1
  77. package/dist-esm/Telemetry/Exception.js +1 -1
  78. package/dist-esm/Telemetry/Metric.js +1 -1
  79. package/dist-esm/Telemetry/PageView.js +1 -1
  80. package/dist-esm/Telemetry/PageViewPerformance.js +1 -1
  81. package/dist-esm/Telemetry/RemoteDependencyData.js +1 -1
  82. package/dist-esm/Telemetry/Trace.js +1 -1
  83. package/dist-esm/TelemetryItemCreator.js +1 -1
  84. package/dist-esm/ThrottleMgr.js +54 -34
  85. package/dist-esm/ThrottleMgr.js.map +1 -1
  86. package/dist-esm/UrlHelperFuncs.js +1 -1
  87. package/dist-esm/Util.js +1 -1
  88. package/dist-esm/__DynamicConstants.js +1 -1
  89. package/dist-esm/applicationinsights-common.js +1 -1
  90. package/package.json +3 -3
  91. package/src/Enums.ts +10 -0
  92. package/src/Interfaces/IThrottleMgr.ts +4 -2
  93. package/src/ThrottleMgr.ts +61 -33
  94. package/src/applicationinsights-common.ts +1 -1
  95. package/types/Enums.d.ts +9 -0
  96. package/types/Interfaces/IThrottleMgr.d.ts +3 -1
  97. package/types/ThrottleMgr.d.ts +3 -2
  98. package/types/applicationinsights-common.d.ts +1 -1
@@ -13918,7 +13918,7 @@
13918
13918
  {
13919
13919
  "kind": "PropertySignature",
13920
13920
  "canonicalReference": "@microsoft/applicationinsights-common!IThrottleMgrConfig#limit:member",
13921
- "docComment": "/**\n * Identifies limit number/percentage of items sent per time\n */\n",
13921
+ "docComment": "/**\n * Identifies limit number/percentage of items sent per time Default: sampling percentage 0.01% with one item sent per time\n */\n",
13922
13922
  "excerptTokens": [
13923
13923
  {
13924
13924
  "kind": "Content",
@@ -13946,11 +13946,11 @@
13946
13946
  {
13947
13947
  "kind": "PropertySignature",
13948
13948
  "canonicalReference": "@microsoft/applicationinsights-common!IThrottleMgrConfig#msgKey:member",
13949
- "docComment": "/**\n * Identifies message key to be used for local storage key\n */\n",
13949
+ "docComment": "/**\n * Identifies message key to be used for local storage key Default: IThrottleMsgKey.default\n */\n",
13950
13950
  "excerptTokens": [
13951
13951
  {
13952
13952
  "kind": "Content",
13953
- "text": "msgKey: "
13953
+ "text": "msgKey?: "
13954
13954
  },
13955
13955
  {
13956
13956
  "kind": "Reference",
@@ -13963,7 +13963,7 @@
13963
13963
  }
13964
13964
  ],
13965
13965
  "isReadonly": false,
13966
- "isOptional": false,
13966
+ "isOptional": true,
13967
13967
  "releaseTag": "Public",
13968
13968
  "name": "msgKey",
13969
13969
  "propertyTypeTokenRange": {
@@ -13992,7 +13992,7 @@
13992
13992
  {
13993
13993
  "kind": "EnumMember",
13994
13994
  "canonicalReference": "@microsoft/applicationinsights-common!IThrottleMsgKey.cdnDeprecate:member",
13995
- "docComment": "",
13995
+ "docComment": "/**\n * Message key for cdn Deprecation\n */\n",
13996
13996
  "excerptTokens": [
13997
13997
  {
13998
13998
  "kind": "Content",
@@ -14013,7 +14013,7 @@
14013
14013
  {
14014
14014
  "kind": "EnumMember",
14015
14015
  "canonicalReference": "@microsoft/applicationinsights-common!IThrottleMsgKey.default:member",
14016
- "docComment": "",
14016
+ "docComment": "/**\n * Default Message key for non pre-defined message\n */\n",
14017
14017
  "excerptTokens": [
14018
14018
  {
14019
14019
  "kind": "Content",
@@ -14034,7 +14034,7 @@
14034
14034
  {
14035
14035
  "kind": "EnumMember",
14036
14036
  "canonicalReference": "@microsoft/applicationinsights-common!IThrottleMsgKey.ikeyDeprecate:member",
14037
- "docComment": "",
14037
+ "docComment": "/**\n * Message key for ikey Deprecation\n */\n",
14038
14038
  "excerptTokens": [
14039
14039
  {
14040
14040
  "kind": "Content",
@@ -17895,7 +17895,7 @@
17895
17895
  "excerptTokens": [
17896
17896
  {
17897
17897
  "kind": "Content",
17898
- "text": "constructor(throttleMgr?: "
17898
+ "text": "constructor(config?: "
17899
17899
  },
17900
17900
  {
17901
17901
  "kind": "Reference",
@@ -17919,6 +17919,15 @@
17919
17919
  "kind": "Content",
17920
17920
  "text": "string"
17921
17921
  },
17922
+ {
17923
+ "kind": "Content",
17924
+ "text": ", unloadHookContainer?: "
17925
+ },
17926
+ {
17927
+ "kind": "Reference",
17928
+ "text": "IUnloadHookContainer",
17929
+ "canonicalReference": "@microsoft/applicationinsights-core-js!IUnloadHookContainer:interface"
17930
+ },
17922
17931
  {
17923
17932
  "kind": "Content",
17924
17933
  "text": ");"
@@ -17929,7 +17938,7 @@
17929
17938
  "overloadIndex": 1,
17930
17939
  "parameters": [
17931
17940
  {
17932
- "parameterName": "throttleMgr",
17941
+ "parameterName": "config",
17933
17942
  "parameterTypeTokenRange": {
17934
17943
  "startIndex": 1,
17935
17944
  "endIndex": 2
@@ -17951,6 +17960,14 @@
17951
17960
  "endIndex": 6
17952
17961
  },
17953
17962
  "isOptional": true
17963
+ },
17964
+ {
17965
+ "parameterName": "unloadHookContainer",
17966
+ "parameterTypeTokenRange": {
17967
+ "startIndex": 7,
17968
+ "endIndex": 8
17969
+ },
17970
+ "isOptional": true
17954
17971
  }
17955
17972
  ]
17956
17973
  },
@@ -17984,6 +18001,37 @@
17984
18001
  "isProtected": false,
17985
18002
  "isAbstract": false
17986
18003
  },
18004
+ {
18005
+ "kind": "Property",
18006
+ "canonicalReference": "@microsoft/applicationinsights-common!ThrottleMgr#config:member",
18007
+ "docComment": "",
18008
+ "excerptTokens": [
18009
+ {
18010
+ "kind": "Content",
18011
+ "text": "config: "
18012
+ },
18013
+ {
18014
+ "kind": "Reference",
18015
+ "text": "IThrottleMgrConfig",
18016
+ "canonicalReference": "@microsoft/applicationinsights-common!IThrottleMgrConfig:interface"
18017
+ },
18018
+ {
18019
+ "kind": "Content",
18020
+ "text": ";"
18021
+ }
18022
+ ],
18023
+ "isReadonly": false,
18024
+ "isOptional": false,
18025
+ "releaseTag": "Public",
18026
+ "name": "config",
18027
+ "propertyTypeTokenRange": {
18028
+ "startIndex": 1,
18029
+ "endIndex": 2
18030
+ },
18031
+ "isStatic": false,
18032
+ "isProtected": false,
18033
+ "isAbstract": false
18034
+ },
17987
18035
  {
17988
18036
  "kind": "Property",
17989
18037
  "canonicalReference": "@microsoft/applicationinsights-common!ThrottleMgr#flush:member",
@@ -25,6 +25,7 @@ import { isValidTraceId } from '@microsoft/applicationinsights-core-js';
25
25
  import { isValidTraceParent } from '@microsoft/applicationinsights-core-js';
26
26
  import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
27
27
  import { ITraceParent } from '@microsoft/applicationinsights-core-js';
28
+ import { IUnloadHookContainer } from '@microsoft/applicationinsights-core-js';
28
29
  import { parseTraceParent } from '@microsoft/applicationinsights-core-js';
29
30
 
30
31
  // @public
@@ -865,16 +866,13 @@ export interface IThrottleMgrConfig {
865
866
  disabled?: boolean;
866
867
  interval?: IThrottleInterval;
867
868
  limit?: IThrottleLimit;
868
- msgKey: IThrottleMsgKey;
869
+ msgKey?: IThrottleMsgKey;
869
870
  }
870
871
 
871
872
  // @public (undocumented)
872
873
  export const enum IThrottleMsgKey {
873
- // (undocumented)
874
874
  cdnDeprecate = 2,
875
- // (undocumented)
876
875
  default = 0,
877
- // (undocumented)
878
876
  ikeyDeprecate = 1
879
877
  }
880
878
 
@@ -1131,10 +1129,12 @@ export class TelemetryItemCreator {
1131
1129
 
1132
1130
  // @public (undocumented)
1133
1131
  export class ThrottleMgr {
1134
- constructor(throttleMgr?: IThrottleMgrConfig, core?: IAppInsightsCore, namePrefix?: string);
1132
+ constructor(config?: IThrottleMgrConfig, core?: IAppInsightsCore, namePrefix?: string, unloadHookContainer?: IUnloadHookContainer);
1135
1133
  // (undocumented)
1136
1134
  canThrottle: () => boolean;
1137
1135
  // (undocumented)
1136
+ config: IThrottleMgrConfig;
1137
+ // (undocumented)
1138
1138
  flush: () => boolean;
1139
1139
  // (undocumented)
1140
1140
  getConfig: () => IThrottleMgrConfig;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights Common JavaScript Library, 3.0.0-beta.2302-06
2
+ * Microsoft Application Insights Common JavaScript Library, 3.0.0-beta.2303-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -28,6 +28,7 @@ declare namespace ApplicationInsights {
28
28
  import { isValidTraceParent } from '@microsoft/applicationinsights-core-js';
29
29
  import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
30
30
  import { ITraceParent } from '@microsoft/applicationinsights-core-js';
31
+ import { IUnloadHookContainer } from '@microsoft/applicationinsights-core-js';
31
32
  import { parseTraceParent } from '@microsoft/applicationinsights-core-js';
32
33
 
33
34
  /**
@@ -2022,8 +2023,9 @@ declare namespace ApplicationInsights {
2022
2023
  interface IThrottleMgrConfig {
2023
2024
  /**
2024
2025
  * Identifies message key to be used for local storage key
2026
+ * Default: IThrottleMsgKey.default
2025
2027
  */
2026
- msgKey: IThrottleMsgKey;
2028
+ msgKey?: IThrottleMsgKey;
2027
2029
  /**
2028
2030
  * Identifies if throttle is disabled
2029
2031
  * Default: false
@@ -2031,6 +2033,7 @@ declare namespace ApplicationInsights {
2031
2033
  disabled?: boolean;
2032
2034
  /**
2033
2035
  * Identifies limit number/percentage of items sent per time
2036
+ * Default: sampling percentage 0.01% with one item sent per time
2034
2037
  */
2035
2038
  limit?: IThrottleLimit;
2036
2039
  /**
@@ -2041,8 +2044,17 @@ declare namespace ApplicationInsights {
2041
2044
  }
2042
2045
 
2043
2046
  const enum IThrottleMsgKey {
2047
+ /**
2048
+ * Default Message key for non pre-defined message
2049
+ */
2044
2050
  default = 0,
2051
+ /**
2052
+ * Message key for ikey Deprecation
2053
+ */
2045
2054
  ikeyDeprecate = 1,
2055
+ /**
2056
+ * Message key for cdn Deprecation
2057
+ */
2046
2058
  cdnDeprecate = 2
2047
2059
  }
2048
2060
 
@@ -2459,7 +2471,8 @@ declare namespace ApplicationInsights {
2459
2471
  isReady: () => boolean;
2460
2472
  onReadyState: (isReady?: boolean) => boolean;
2461
2473
  flush: () => boolean;
2462
- constructor(throttleMgr?: IThrottleMgrConfig, core?: IAppInsightsCore, namePrefix?: string);
2474
+ config: IThrottleMgrConfig;
2475
+ constructor(config?: IThrottleMgrConfig, core?: IAppInsightsCore, namePrefix?: string, unloadHookContainer?: IUnloadHookContainer);
2463
2476
  }
2464
2477
 
2465
2478
  class Trace implements IMessageData, ISerializable {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Common, 3.0.0-beta.2302-06
2
+ * Application Insights JavaScript SDK - Common, 3.0.0-beta.2303-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -9,7 +9,7 @@
9
9
  })(this, (function (exports) { 'use strict';
10
10
 
11
11
  /*!
12
- * NevWare21 - ts-utils, 0.8.0
12
+ * NevWare21 - ts-utils, 0.8.1
13
13
  * https://github.com/nevware21/ts-utils
14
14
  * Copyright (c) NevWare21 and contributors. All rights reserved.
15
15
  * Licensed under the MIT license.
@@ -28,7 +28,9 @@
28
28
  var POLYFILL_TAG = "_polyfill";
29
29
  var INDEX_OF = "indexOf";
30
30
  var LENGTH = "length";
31
+ var DONE = "done";
31
32
  var VALUE = "value";
33
+ var NAME = "name";
32
34
  var ObjClass$1 = Object;
33
35
  var ObjProto$1 = ObjClass$1[PROTOTYPE];
34
36
  var StrCls = String;
@@ -402,6 +404,27 @@
402
404
  (!_symbolFor || (_globalLazyTestHooks.lzy && !_symbol.b)) && getSymbol();
403
405
  return (_symbolFor.v || polySymbolFor)(key);
404
406
  }
407
+ function isIterator(value) {
408
+ return !!value && isFunction(value.next);
409
+ }
410
+ function arrAppend(target, elms) {
411
+ if (!isUndefined(elms) && target) {
412
+ if (isArray(elms)) {
413
+ target.push.apply(target, elms);
414
+ }
415
+ else if (isIterator(elms)) {
416
+ var value = elms.next();
417
+ while (!value[DONE]) {
418
+ target.push(value[VALUE]);
419
+ value = elms.next();
420
+ }
421
+ }
422
+ else {
423
+ target.push(elms);
424
+ }
425
+ }
426
+ return target;
427
+ }
405
428
  function arrForEach(theArray, callbackfn, thisArg) {
406
429
  if (theArray) {
407
430
  var len = theArray[LENGTH] >>> 0;
@@ -427,22 +450,37 @@
427
450
  };
428
451
  return fn(obj, proto);
429
452
  }
430
- function _createCustomError(name, d, b) {
431
- objSetPrototypeOf(d, b);
453
+ function _createCustomError(name, d, baseClass) {
454
+ objSetPrototypeOf(d, baseClass);
432
455
  function __() {
433
456
  this.constructor = d;
457
+ this[NAME] = name;
434
458
  }
435
- __[PROTOTYPE] = b[PROTOTYPE];
436
- __[PROTOTYPE].name = name;
459
+ __[PROTOTYPE] = baseClass[PROTOTYPE];
437
460
  d[PROTOTYPE] = new __();
438
461
  return d;
439
462
  }
463
+ var _safeSetName = function (baseClass, name) {
464
+ try {
465
+ baseClass[PROTOTYPE][NAME] = name;
466
+ }
467
+ catch (e) {
468
+ }
469
+ };
440
470
  function createCustomError(name, constructCb) {
441
471
  var baseClass = Error;
472
+ var orgName = baseClass[PROTOTYPE][NAME];
442
473
  var customError = _createCustomError(name, function () {
443
474
  var _this = this;
444
- _this = baseClass.apply(_this, arguments) || _this;
445
- constructCb && constructCb(_this, arguments);
475
+ try {
476
+ _safeSetName(baseClass, name);
477
+ _this = baseClass.apply(_this, arguments) || _this;
478
+ _this[NAME] = name;
479
+ constructCb && constructCb(_this, arguments);
480
+ }
481
+ finally {
482
+ _safeSetName(baseClass, orgName);
483
+ }
446
484
  return _this;
447
485
  }, baseClass);
448
486
  return customError;
@@ -504,49 +542,77 @@
504
542
  var polyStrTrim = _createTrimFn(/^\s+|(?=\s)\s+$/g);
505
543
  var TRIM = "trim";
506
544
  var strTrim = _unwrapFunction(TRIM, UNDEF_VALUE, polyStrTrim);
545
+ var REF = "ref";
546
+ var UNREF = "un" + REF;
547
+ var HAS_REF = "hasRef";
548
+ var ENABLED = "enabled";
507
549
  function _createTimerHandler(startTimer, refreshFn, cancelFn) {
550
+ var _a;
508
551
  var ref = true;
509
552
  var timerId = startTimer ? refreshFn(null) : null;
510
- function _unref() {
553
+ var theTimerHandler;
554
+ var _unref = function () {
511
555
  ref = false;
512
- timerId && timerId["unref"] && timerId["unref"]();
513
- return timer;
514
- }
515
- function _ref() {
556
+ timerId && timerId[UNREF] && timerId[UNREF]();
557
+ return theTimerHandler;
558
+ };
559
+ var _ref = function () {
516
560
  ref = true;
517
- timerId && timerId["ref"] && timerId["ref"]();
518
- return timer;
519
- }
520
- function _hasRef() {
521
- if (timerId && timerId["hasRef"]) {
522
- return timerId["hasRef"]();
561
+ timerId && timerId[REF] && timerId[REF]();
562
+ return theTimerHandler;
563
+ };
564
+ var _hasRef = function () {
565
+ if (timerId && timerId[HAS_REF]) {
566
+ return timerId[HAS_REF]();
523
567
  }
524
568
  return ref;
525
- }
526
- var timer = {
527
- cancel: function () {
528
- timerId && cancelFn(timerId);
529
- timerId = null;
530
- },
531
- refresh: function () {
532
- timerId = refreshFn(timerId);
533
- if (!ref) {
534
- _unref();
535
- }
536
- return timer;
569
+ };
570
+ var _refresh = function () {
571
+ timerId = refreshFn(timerId);
572
+ if (!ref) {
573
+ _unref();
574
+ }
575
+ return theTimerHandler;
576
+ };
577
+ var _cancel = function () {
578
+ timerId && cancelFn(timerId);
579
+ timerId = null;
580
+ };
581
+ var _setEnabled = function (value) {
582
+ !value && timerId && _cancel();
583
+ value && !timerId && _refresh();
584
+ };
585
+ theTimerHandler = (_a = {
586
+ cancel: _cancel,
587
+ refresh: _refresh
537
588
  },
538
- hasRef: _hasRef,
539
- ref: _ref,
540
- unref: _unref
589
+ _a[HAS_REF] = _hasRef,
590
+ _a[REF] = _ref,
591
+ _a[UNREF] = _unref,
592
+ _a[ENABLED] = false,
593
+ _a);
594
+ objDefineProp(theTimerHandler, ENABLED, {
595
+ get: function () { return !!timerId; },
596
+ set: _setEnabled
597
+ });
598
+ return {
599
+ h: theTimerHandler,
600
+ dn: function () {
601
+ timerId = null;
602
+ }
541
603
  };
542
- return timer;
543
604
  }
544
605
  function _createTimeoutWith(self, startTimer, overrideFn, theArgs) {
545
606
  var isArr = isArray(overrideFn);
546
607
  var len = isArr ? overrideFn.length : 0;
547
608
  var setFn = (len > 0 ? overrideFn[0] : (!isArr ? overrideFn : UNDEF_VALUE)) || setTimeout;
548
609
  var clearFn = (len > 1 ? overrideFn[1] : UNDEF_VALUE) || clearTimeout;
549
- return _createTimerHandler(startTimer, function (timerId) {
610
+ var timerFn = theArgs[0];
611
+ theArgs[0] = function () {
612
+ handler.dn();
613
+ timerFn.apply(self, arguments);
614
+ };
615
+ var handler = _createTimerHandler(startTimer, function (timerId) {
550
616
  if (timerId) {
551
617
  if (timerId.refresh) {
552
618
  timerId.refresh();
@@ -558,6 +624,7 @@
558
624
  }, function (timerId) {
559
625
  clearFn.call(self, timerId);
560
626
  });
627
+ return handler.h;
561
628
  }
562
629
  function scheduleTimeout(callback, timeout) {
563
630
  return _createTimeoutWith(this, true, UNDEF_VALUE, _extractArgs(arguments, 0));
@@ -701,7 +768,7 @@
701
768
  }
702
769
 
703
770
  /*!
704
- * Microsoft Dynamic Proto Utility, 1.1.7
771
+ * Microsoft Dynamic Proto Utility, 1.1.8
705
772
  * Copyright (c) Microsoft and contributors. All rights reserved.
706
773
  */
707
774
  var _a$1;
@@ -974,6 +1041,7 @@
974
1041
  var STR_EMPTY = "";
975
1042
  var STR_ERROR_TO_CONSOLE = "errorToConsole";
976
1043
  var STR_WARN_TO_CONSOLE = "warnToConsole";
1044
+ var STR_NOT_DYNAMIC_ERROR = "Not dynamic - ";
977
1045
 
978
1046
  var rCamelCase = /-([a-z])/g;
979
1047
  var rNormalizeInvalid = /([^\w\d_$])/g;
@@ -1172,7 +1240,7 @@
1172
1240
  return result;
1173
1241
  }
1174
1242
 
1175
- var version = "3.0.0-beta.2302-06";
1243
+ var version = "3.0.0-beta.2303-03";
1176
1244
  var instanceName = "." + newId(6);
1177
1245
  var _dataUid = 0;
1178
1246
  function createUniqueNamespace(name, includeVersion) {
@@ -1677,6 +1745,15 @@
1677
1745
  _makeDynamicObject(theState, newTarget);
1678
1746
  return cfgHandler;
1679
1747
  }
1748
+ function _logInvalidAccess(logger, message) {
1749
+ if (logger) {
1750
+ logger[STR_WARN_TO_CONSOLE ](message);
1751
+ logger[_DYN_THROW_INTERNAL ](2 , 108 , message);
1752
+ }
1753
+ else {
1754
+ throwInvalidAccess(message);
1755
+ }
1756
+ }
1680
1757
  function createDynamicConfig(config, defaultConfig, logger, inPlace) {
1681
1758
  var dynamicHandler = _createDynamicHandler(logger, config || {}, inPlace);
1682
1759
  if (defaultConfig) {
@@ -1684,6 +1761,14 @@
1684
1761
  }
1685
1762
  return dynamicHandler;
1686
1763
  }
1764
+ function onConfigChange(config, configHandler, logger) {
1765
+ var handler = config[CFG_HANDLER_LINK] || config;
1766
+ if (handler.cfg && (handler.cfg === config || handler.cfg[CFG_HANDLER_LINK] === handler)) {
1767
+ return handler[_DYN_WATCH ](configHandler);
1768
+ }
1769
+ _logInvalidAccess(logger, STR_NOT_DYNAMIC_ERROR + dumpObj(config));
1770
+ createDynamicConfig(config, null, logger)[_DYN_WATCH ](configHandler);
1771
+ }
1687
1772
 
1688
1773
  var _aiNamespace = null;
1689
1774
  function _getExtensionNamespace() {
@@ -1999,6 +2084,31 @@
1999
2084
  return traceParent;
2000
2085
  }
2001
2086
 
2087
+ function createUnloadHookContainer() {
2088
+ var _hooks = [];
2089
+ function _doUnload(logger) {
2090
+ var oldHooks = _hooks;
2091
+ _hooks = [];
2092
+ arrForEach(oldHooks, function (fn) {
2093
+ try {
2094
+ (fn.rm || fn.remove).call(fn);
2095
+ }
2096
+ catch (e) {
2097
+ _throwInternal(logger, 2 , 73 , "Unloading:" + dumpObj(e));
2098
+ }
2099
+ });
2100
+ }
2101
+ function _addHook(hooks) {
2102
+ if (hooks) {
2103
+ arrAppend(_hooks, hooks);
2104
+ }
2105
+ }
2106
+ return {
2107
+ run: _doUnload,
2108
+ add: _addHook
2109
+ };
2110
+ }
2111
+
2002
2112
  var DisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
2003
2113
  var SampleRate = "sampleRate";
2004
2114
  var ProcessLegacy = "ProcessLegacy";
@@ -2561,7 +2671,7 @@
2561
2671
 
2562
2672
  var THROTTLE_STORAGE_PREFIX = "appInsightsThrottle";
2563
2673
  var ThrottleMgr = /** @class */ (function () {
2564
- function ThrottleMgr(throttleMgr, core, namePrefix) {
2674
+ function ThrottleMgr(config, core, namePrefix, unloadHookContainer) {
2565
2675
  var _self = this;
2566
2676
  var _canUseLocalStorage;
2567
2677
  var _logger;
@@ -2574,6 +2684,9 @@
2574
2684
  var _isReady = false;
2575
2685
  var _isSpecificDaysGiven = false;
2576
2686
  _initConfig();
2687
+ _self["_getDbgPlgTargets"] = function () {
2688
+ return [_queue];
2689
+ };
2577
2690
  _self.getConfig = function () {
2578
2691
  return _config;
2579
2692
  };
@@ -2589,8 +2702,10 @@
2589
2702
  _self.flush = function () {
2590
2703
  try {
2591
2704
  if (_isReady && _queue[_DYN_LENGTH ] > 0) {
2592
- arrForEach(_queue, function (item) {
2593
- _self.sendMessage(item.msgID, item[_DYN_MESSAGE ], item.severity);
2705
+ var items = _queue.slice(0);
2706
+ _queue = [];
2707
+ arrForEach(items, function (item) {
2708
+ _flushMessage(item.msgID, item[_DYN_MESSAGE ], item.severity, false);
2594
2709
  });
2595
2710
  return true;
2596
2711
  }
@@ -2604,6 +2719,9 @@
2604
2719
  return _self.flush();
2605
2720
  };
2606
2721
  _self.sendMessage = function (msgID, message, severity) {
2722
+ return _flushMessage(msgID, message, severity, true);
2723
+ };
2724
+ function _flushMessage(msgID, message, severity, saveUnsentMsg) {
2607
2725
  if (_isReady) {
2608
2726
  var isSampledIn = _canSampledIn();
2609
2727
  if (!isSampledIn) {
@@ -2637,40 +2755,47 @@
2637
2755
  };
2638
2756
  }
2639
2757
  else {
2640
- _queue.push({
2641
- msgID: msgID,
2642
- message: message,
2643
- severity: severity
2644
- });
2758
+ if (!!saveUnsentMsg) {
2759
+ _queue.push({
2760
+ msgID: msgID,
2761
+ message: message,
2762
+ severity: severity
2763
+ });
2764
+ }
2645
2765
  }
2646
2766
  return null;
2647
- };
2767
+ }
2648
2768
  function _initConfig() {
2649
- var _a, _b;
2650
- _canUseLocalStorage = utlCanUseLocalStorage();
2651
2769
  _logger = safeGetLogger(core);
2652
2770
  _isTriggered = false;
2653
- _namePrefix = isNotNullOrUndefined(namePrefix) ? namePrefix : "";
2654
2771
  _queue = [];
2655
- var configMgr = throttleMgr;
2656
- _config = {};
2657
- _config[_DYN_DISABLED ] = !!configMgr[_DYN_DISABLED ];
2658
- _config.msgKey = configMgr.msgKey;
2659
- var configInterval = configMgr[_DYN_INTERVAL ] || {};
2660
- _isSpecificDaysGiven = (configInterval === null || configInterval === void 0 ? void 0 : configInterval.daysOfMonth) && (configInterval === null || configInterval === void 0 ? void 0 : configInterval.daysOfMonth[_DYN_LENGTH ]) > 0;
2661
- _config[_DYN_INTERVAL ] = _getIntervalConfig(configInterval);
2662
- var limit = {
2663
- samplingRate: ((_a = configMgr.limit) === null || _a === void 0 ? void 0 : _a.samplingRate) || 100,
2664
- maxSendNumber: ((_b = configMgr.limit) === null || _b === void 0 ? void 0 : _b.maxSendNumber) || 1
2665
- };
2666
- _config.limit = limit;
2667
- _localStorageName = _getLocalStorageName(_config.msgKey, _namePrefix);
2668
- if (_canUseLocalStorage && _localStorageName) {
2669
- _localStorageObj = _getLocalStorageObj(utlGetLocalStorage(_logger, _localStorageName), _logger, _localStorageName);
2670
- }
2671
- if (_localStorageObj) {
2672
- _isTriggered = _isTriggeredOnCurDate(_localStorageObj[_DYN_PRE_TRIGGER_DATE ]);
2673
- }
2772
+ _namePrefix = isNotNullOrUndefined(namePrefix) ? namePrefix : "";
2773
+ unloadHookContainer = unloadHookContainer || createUnloadHookContainer();
2774
+ config = createDynamicConfig(config || {}, null, _logger).cfg;
2775
+ var unloadHook = onConfigChange((config), function () {
2776
+ var _a, _b;
2777
+ _canUseLocalStorage = utlCanUseLocalStorage();
2778
+ var configMgr = config || {};
2779
+ _config = {};
2780
+ _config[_DYN_DISABLED ] = !!configMgr[_DYN_DISABLED ];
2781
+ _config.msgKey = configMgr.msgKey || 0 ;
2782
+ var configInterval = configMgr[_DYN_INTERVAL ] || {};
2783
+ _isSpecificDaysGiven = (configInterval === null || configInterval === void 0 ? void 0 : configInterval.daysOfMonth) && (configInterval === null || configInterval === void 0 ? void 0 : configInterval.daysOfMonth[_DYN_LENGTH ]) > 0;
2784
+ _config[_DYN_INTERVAL ] = _getIntervalConfig(configInterval);
2785
+ var limit = {
2786
+ samplingRate: ((_a = configMgr.limit) === null || _a === void 0 ? void 0 : _a.samplingRate) || 100,
2787
+ maxSendNumber: ((_b = configMgr.limit) === null || _b === void 0 ? void 0 : _b.maxSendNumber) || 1
2788
+ };
2789
+ _config.limit = limit;
2790
+ _localStorageName = _getLocalStorageName(_config.msgKey, _namePrefix);
2791
+ if (_canUseLocalStorage && _localStorageName) {
2792
+ _localStorageObj = _getLocalStorageObj(utlGetLocalStorage(_logger, _localStorageName), _logger, _localStorageName);
2793
+ }
2794
+ if (_localStorageObj) {
2795
+ _isTriggered = _isTriggeredOnCurDate(_localStorageObj[_DYN_PRE_TRIGGER_DATE ]);
2796
+ }
2797
+ });
2798
+ unloadHookContainer && unloadHookContainer.add(unloadHook);
2674
2799
  }
2675
2800
  function _getIntervalConfig(interval) {
2676
2801
  interval = interval || {};
@@ -2780,6 +2905,9 @@
2780
2905
  return false;
2781
2906
  }
2782
2907
  function _checkInterval(interval, start, current) {
2908
+ if (interval <= 0) {
2909
+ return 1;
2910
+ }
2783
2911
  return (current >= start) && (current - start) % interval == 0 ? Math.floor((current - start) / interval) + 1 : -1;
2784
2912
  }
2785
2913
  function _sendMessage(msgID, logger, message, severity) {