@microsoft/applicationinsights-common 3.0.0-beta.2301-20 → 3.0.0-beta.2302-02
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/applicationinsights-common.integrity.json +9 -9
- package/browser/applicationinsights-common.js +99 -30
- package/browser/applicationinsights-common.js.map +1 -1
- package/browser/applicationinsights-common.min.js +2 -2
- package/browser/applicationinsights-common.min.js.map +1 -1
- package/dist/applicationinsights-common.api.json +10 -10
- package/dist/applicationinsights-common.api.md +1 -1
- package/dist/applicationinsights-common.d.ts +7 -7
- package/dist/applicationinsights-common.js +99 -30
- package/dist/applicationinsights-common.js.map +1 -1
- package/dist/applicationinsights-common.min.js +2 -2
- package/dist/applicationinsights-common.min.js.map +1 -1
- package/dist/applicationinsights-common.rollup.d.ts +7 -7
- package/dist-esm/ConnectionStringParser.js +1 -1
- package/dist-esm/Constants.js +1 -1
- package/dist-esm/DomHelperFuncs.js +1 -1
- package/dist-esm/Enums.js +1 -1
- package/dist-esm/HelperFuncs.js +1 -1
- package/dist-esm/Interfaces/ConnectionString.js +1 -1
- package/dist-esm/Interfaces/Context/IApplication.js +1 -1
- package/dist-esm/Interfaces/Context/IDevice.js +1 -1
- package/dist-esm/Interfaces/Context/IInternal.js +1 -1
- package/dist-esm/Interfaces/Context/ILocation.js +1 -1
- package/dist-esm/Interfaces/Context/IOperatingSystem.js +1 -1
- package/dist-esm/Interfaces/Context/ISample.js +1 -1
- package/dist-esm/Interfaces/Context/ISession.js +1 -1
- package/dist-esm/Interfaces/Context/ITelemetryTrace.js +1 -1
- package/dist-esm/Interfaces/Context/IUser.js +1 -1
- package/dist-esm/Interfaces/Context/IWeb.js +1 -1
- package/dist-esm/Interfaces/Contracts/AvailabilityData.js +1 -1
- package/dist-esm/Interfaces/Contracts/ContextTagKeys.js +1 -1
- package/dist-esm/Interfaces/Contracts/DataPointType.js +1 -1
- package/dist-esm/Interfaces/Contracts/DependencyKind.js +1 -1
- package/dist-esm/Interfaces/Contracts/DependencySourceType.js +1 -1
- package/dist-esm/Interfaces/Contracts/IBase.js +1 -1
- package/dist-esm/Interfaces/Contracts/IData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IDataPoint.js +1 -1
- package/dist-esm/Interfaces/Contracts/IDomain.js +1 -1
- package/dist-esm/Interfaces/Contracts/IEnvelope.js +1 -1
- package/dist-esm/Interfaces/Contracts/IEventData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IExceptionData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IExceptionDetails.js +1 -1
- package/dist-esm/Interfaces/Contracts/IMessageData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IMetricData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IPageViewData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IPageViewPerfData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IRemoteDependencyData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IStackFrame.js +1 -1
- package/dist-esm/Interfaces/Contracts/RequestData.js +1 -1
- package/dist-esm/Interfaces/Contracts/SeverityLevel.js +1 -1
- package/dist-esm/Interfaces/IAppInsights.js +1 -1
- package/dist-esm/Interfaces/IChannelControlsAI.js +1 -1
- package/dist-esm/Interfaces/IConfig.js +1 -1
- package/dist-esm/Interfaces/ICorrelationConfig.js +1 -1
- package/dist-esm/Interfaces/IDependencyTelemetry.js +1 -1
- package/dist-esm/Interfaces/IEventTelemetry.js +1 -1
- package/dist-esm/Interfaces/IExceptionTelemetry.js +1 -1
- package/dist-esm/Interfaces/IMetricTelemetry.js +1 -1
- package/dist-esm/Interfaces/IPageViewPerformanceTelemetry.js +1 -1
- package/dist-esm/Interfaces/IPageViewTelemetry.js +1 -1
- package/dist-esm/Interfaces/IPartC.js +1 -1
- package/dist-esm/Interfaces/IPropertiesPlugin.js +1 -1
- package/dist-esm/Interfaces/IRequestContext.js +1 -1
- package/dist-esm/Interfaces/ITelemetryContext.js +1 -1
- package/dist-esm/Interfaces/IThrottleMgr.js +1 -1
- package/dist-esm/Interfaces/ITraceTelemetry.js +1 -1
- package/dist-esm/Interfaces/PartAExtensions.js +1 -1
- package/dist-esm/Interfaces/Telemetry/IEnvelope.js +1 -1
- package/dist-esm/Interfaces/Telemetry/ISerializable.js +1 -1
- package/dist-esm/RequestResponseHeaders.js +1 -1
- package/dist-esm/StorageHelperFuncs.js +1 -1
- package/dist-esm/Telemetry/Common/Data.js +1 -1
- package/dist-esm/Telemetry/Common/DataPoint.js +1 -1
- package/dist-esm/Telemetry/Common/DataSanitizer.js +1 -1
- package/dist-esm/Telemetry/Common/Envelope.js +1 -1
- package/dist-esm/Telemetry/Event.js +1 -1
- package/dist-esm/Telemetry/Exception.js +1 -1
- package/dist-esm/Telemetry/Metric.js +1 -1
- package/dist-esm/Telemetry/PageView.js +1 -1
- package/dist-esm/Telemetry/PageViewPerformance.js +1 -1
- package/dist-esm/Telemetry/RemoteDependencyData.js +1 -1
- package/dist-esm/Telemetry/Trace.js +1 -1
- package/dist-esm/TelemetryItemCreator.js +1 -1
- package/dist-esm/ThrottleMgr.js +46 -19
- package/dist-esm/ThrottleMgr.js.map +1 -1
- package/dist-esm/UrlHelperFuncs.js +1 -1
- package/dist-esm/Util.js +1 -1
- package/dist-esm/__DynamicConstants.js +6 -5
- package/dist-esm/__DynamicConstants.js.map +1 -1
- package/dist-esm/applicationinsights-common.js +1 -1
- package/package.json +5 -5
- package/src/ConnectionStringParser.ts +8 -8
- package/src/HelperFuncs.ts +6 -6
- package/src/Interfaces/IConfig.ts +7 -7
- package/src/Interfaces/IThrottleMgr.ts +6 -6
- package/src/StorageHelperFuncs.ts +10 -10
- package/src/Telemetry/Common/DataSanitizer.ts +8 -8
- package/src/Telemetry/Common/Envelope.ts +11 -11
- package/src/Telemetry/Event.ts +11 -11
- package/src/Telemetry/Exception.ts +22 -22
- package/src/Telemetry/Metric.ts +12 -12
- package/src/Telemetry/PageView.ts +14 -14
- package/src/Telemetry/PageViewPerformance.ts +12 -12
- package/src/Telemetry/RemoteDependencyData.ts +12 -12
- package/src/Telemetry/Trace.ts +12 -12
- package/src/TelemetryItemCreator.ts +10 -10
- package/src/ThrottleMgr.ts +53 -21
- package/src/UrlHelperFuncs.ts +6 -6
- package/src/Util.ts +16 -16
- package/src/__DynamicConstants.ts +50 -49
- package/types/Enums.d.ts +2 -2
- package/types/Interfaces/ConnectionString.d.ts +2 -2
- package/types/Interfaces/Contracts/SeverityLevel.d.ts +1 -1
- package/types/Interfaces/IThrottleMgr.d.ts +6 -6
- package/types/__DynamicConstants.d.ts +2 -1
- package/types/tsdoc-metadata.json +1 -1
package/dist-esm/ThrottleMgr.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Common, 3.0.0-beta.
|
|
2
|
+
* Application Insights JavaScript SDK - Common, 3.0.0-beta.2302-02
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
|
-
import { _throwInternal, arrForEach, isNotNullOrUndefined, isNullOrUndefined, randomValue, safeGetLogger, strTrim } from "@microsoft/applicationinsights-core-js";
|
|
5
|
+
import { _throwInternal, arrForEach, arrIndexOf, isNotNullOrUndefined, isNullOrUndefined, randomValue, safeGetLogger, strTrim } from "@microsoft/applicationinsights-core-js";
|
|
6
6
|
import { utlCanUseLocalStorage, utlGetLocalStorage, utlSetLocalStorage } from "./StorageHelperFuncs";
|
|
7
|
-
import { _DYN_COUNT, _DYN_DATE, _DYN_DISABLED, _DYN_GET_UTCDATE,
|
|
7
|
+
import { _DYN_COUNT, _DYN_DATE, _DYN_DAYS_OF_MONTH, _DYN_DISABLED, _DYN_GET_UTCDATE, _DYN_INTERVAL, _DYN_LENGTH, _DYN_MESSAGE, _DYN_PRE_TRIGGER_DATE, _DYN_STRINGIFY } from "./__DynamicConstants";
|
|
8
8
|
var THROTTLE_STORAGE_PREFIX = "appInsightsThrottle";
|
|
9
9
|
var ThrottleMgr = /** @class */ (function () {
|
|
10
10
|
function ThrottleMgr(throttleMgr, core, namePrefix) {
|
|
@@ -18,6 +18,7 @@ var ThrottleMgr = /** @class */ (function () {
|
|
|
18
18
|
var _namePrefix;
|
|
19
19
|
var _queue;
|
|
20
20
|
var _isReady = false;
|
|
21
|
+
var _isSpecificDaysGiven = false;
|
|
21
22
|
_initConfig();
|
|
22
23
|
_self.getConfig = function () {
|
|
23
24
|
return _config;
|
|
@@ -120,7 +121,7 @@ var ThrottleMgr = /** @class */ (function () {
|
|
|
120
121
|
return null;
|
|
121
122
|
};
|
|
122
123
|
function _initConfig() {
|
|
123
|
-
var _a, _b
|
|
124
|
+
var _a, _b;
|
|
124
125
|
_canUseLocalStorage = utlCanUseLocalStorage();
|
|
125
126
|
_logger = safeGetLogger(core);
|
|
126
127
|
_isTriggered = false;
|
|
@@ -130,18 +131,13 @@ var ThrottleMgr = /** @class */ (function () {
|
|
|
130
131
|
_config = {};
|
|
131
132
|
_config[_DYN_DISABLED /* @min:%2edisabled */] = !!configMgr[_DYN_DISABLED /* @min:%2edisabled */];
|
|
132
133
|
_config.msgKey = configMgr.msgKey;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
monthInterval: ((_a = configMgr.interval) === null || _a === void 0 ? void 0 : _a.monthInterval) || 3,
|
|
137
|
-
dayInterval: ((_b = configMgr.interval) === null || _b === void 0 ? void 0 : _b.dayInterval) || 28,
|
|
138
|
-
maxTimesPerMonth: ((_c = configMgr.interval) === null || _c === void 0 ? void 0 : _c.maxTimesPerMonth) || 1
|
|
139
|
-
};
|
|
140
|
-
_config.interval = interval;
|
|
134
|
+
var configInterval = configMgr[_DYN_INTERVAL /* @min:%2einterval */] || {};
|
|
135
|
+
_isSpecificDaysGiven = (configInterval === null || configInterval === void 0 ? void 0 : configInterval.daysOfMonth) && (configInterval === null || configInterval === void 0 ? void 0 : configInterval.daysOfMonth[_DYN_LENGTH /* @min:%2elength */]) > 0;
|
|
136
|
+
_config[_DYN_INTERVAL /* @min:%2einterval */] = _getIntervalConfig(configInterval);
|
|
141
137
|
var limit = {
|
|
142
|
-
samplingRate: ((
|
|
138
|
+
samplingRate: ((_a = configMgr.limit) === null || _a === void 0 ? void 0 : _a.samplingRate) || 100,
|
|
143
139
|
// dafault: every time sent only 1 event
|
|
144
|
-
maxSendNumber: ((
|
|
140
|
+
maxSendNumber: ((_b = configMgr.limit) === null || _b === void 0 ? void 0 : _b.maxSendNumber) || 1
|
|
145
141
|
};
|
|
146
142
|
_config.limit = limit;
|
|
147
143
|
_localStorageName = _getLocalStorageName(_config.msgKey, _namePrefix);
|
|
@@ -152,15 +148,46 @@ var ThrottleMgr = /** @class */ (function () {
|
|
|
152
148
|
_isTriggered = _isTriggeredOnCurDate(_localStorageObj[_DYN_PRE_TRIGGER_DATE /* @min:%2epreTriggerDate */]);
|
|
153
149
|
}
|
|
154
150
|
}
|
|
151
|
+
function _getIntervalConfig(interval) {
|
|
152
|
+
interval = interval || {};
|
|
153
|
+
var monthInterval = interval === null || interval === void 0 ? void 0 : interval.monthInterval;
|
|
154
|
+
var dayInterval = interval === null || interval === void 0 ? void 0 : interval.dayInterval;
|
|
155
|
+
// default: send data every 3 month each year
|
|
156
|
+
if (isNullOrUndefined(monthInterval) && isNullOrUndefined(dayInterval)) {
|
|
157
|
+
interval.monthInterval = 3;
|
|
158
|
+
if (!_isSpecificDaysGiven) {
|
|
159
|
+
// default: send data on 28th
|
|
160
|
+
interval[_DYN_DAYS_OF_MONTH /* @min:%2edaysOfMonth */] = [28];
|
|
161
|
+
_isSpecificDaysGiven = true;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
interval = {
|
|
165
|
+
// dafault: sent every three months
|
|
166
|
+
monthInterval: interval === null || interval === void 0 ? void 0 : interval.monthInterval,
|
|
167
|
+
dayInterval: interval === null || interval === void 0 ? void 0 : interval.dayInterval,
|
|
168
|
+
daysOfMonth: interval === null || interval === void 0 ? void 0 : interval.daysOfMonth
|
|
169
|
+
};
|
|
170
|
+
return interval;
|
|
171
|
+
}
|
|
155
172
|
function _canThrottle(config, canUseLocalStorage, localStorageObj) {
|
|
156
173
|
if (!config[_DYN_DISABLED /* @min:%2edisabled */] && canUseLocalStorage && isNotNullOrUndefined(localStorageObj)) {
|
|
157
174
|
var curDate = _getThrottleDate();
|
|
158
175
|
var date = localStorageObj[_DYN_DATE /* @min:%2edate */];
|
|
159
|
-
var interval = config
|
|
160
|
-
var
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
176
|
+
var interval = config[_DYN_INTERVAL /* @min:%2einterval */];
|
|
177
|
+
var monthCheck = 1;
|
|
178
|
+
if (interval === null || interval === void 0 ? void 0 : interval.monthInterval) {
|
|
179
|
+
var monthExpand = (curDate.getUTCFullYear() - date.getUTCFullYear()) * 12 + curDate.getUTCMonth() - date.getUTCMonth();
|
|
180
|
+
monthCheck = _checkInterval(interval.monthInterval, 0, monthExpand);
|
|
181
|
+
}
|
|
182
|
+
var dayCheck = 1;
|
|
183
|
+
if (_isSpecificDaysGiven) {
|
|
184
|
+
dayCheck = arrIndexOf(interval[_DYN_DAYS_OF_MONTH /* @min:%2edaysOfMonth */], curDate[_DYN_GET_UTCDATE /* @min:%2egetUTCDate */]());
|
|
185
|
+
}
|
|
186
|
+
else if (interval === null || interval === void 0 ? void 0 : interval.dayInterval) {
|
|
187
|
+
var daySpan = Math.floor((curDate.getTime() - date.getTime()) / 86400000);
|
|
188
|
+
dayCheck = _checkInterval(interval.dayInterval, 0, daySpan);
|
|
189
|
+
}
|
|
190
|
+
return monthCheck >= 0 && dayCheck >= 0;
|
|
164
191
|
}
|
|
165
192
|
return false;
|
|
166
193
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThrottleMgr.js.map","sources":["ThrottleMgr.js"],"sourcesContent":["import { _throwInternal, arrForEach, isNotNullOrUndefined, isNullOrUndefined, randomValue, safeGetLogger, strTrim } from \"@microsoft/applicationinsights-core-js\";\r\nimport { utlCanUseLocalStorage, utlGetLocalStorage, utlSetLocalStorage } from \"./StorageHelperFuncs\";\r\nimport { _DYN_COUNT, _DYN_DATE, _DYN_DISABLED, _DYN_GET_UTCDATE, _DYN_LENGTH, _DYN_MAX_TIMES_PER_MONTH, _DYN_MESSAGE, _DYN_PRE_TRIGGER_DATE, _DYN_STRINGIFY } from \"./__DynamicConstants\";\r\nvar THROTTLE_STORAGE_PREFIX = \"appInsightsThrottle\";\r\nvar ThrottleMgr = /** @class */ (function () {\r\n function ThrottleMgr(throttleMgr, core, namePrefix) {\r\n var _self = this;\r\n var _canUseLocalStorage;\r\n var _logger;\r\n var _config;\r\n var _localStorageName;\r\n var _localStorageObj;\r\n var _isTriggered; //_isTriggered is to make sure that we only trigger throttle once a day\r\n var _namePrefix;\r\n var _queue;\r\n var _isReady = false;\r\n _initConfig();\r\n _self.getConfig = function () {\r\n return _config;\r\n };\r\n /**\r\n * Check if it is the correct day to send message.\r\n * If _isTriggered is true, even if canThrottle returns true, message will not be sent,\r\n * because we only allow triggering sendMessage() once a day.\r\n * @returns if the current date is the valid date to send message\r\n */\r\n _self.canThrottle = function () {\r\n return _canThrottle(_config, _canUseLocalStorage, _localStorageObj);\r\n };\r\n /**\r\n * Check if throttle is triggered on current day(UTC)\r\n * if canThrottle returns false, isTriggered will return false\r\n * @returns if throttle is triggered on current day(UTC)\r\n */\r\n _self.isTriggered = function () {\r\n return _isTriggered;\r\n };\r\n /**\r\n * Before isReady set to true, all message will be stored in queue.\r\n * Message will only be sent out after isReady set to true.\r\n * Initial and default value: false\r\n * @returns isReady state\r\n */\r\n _self.isReady = function () {\r\n return _isReady;\r\n };\r\n /**\r\n * Flush all message in queue with isReady state set to true.\r\n * @returns if message queue is flushed\r\n */\r\n _self.flush = function () {\r\n try {\r\n if (_isReady && _queue[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n arrForEach(_queue, function (item) {\r\n _self.sendMessage(item.msgID, item[_DYN_MESSAGE /* @min:%2emessage */], item.severity);\r\n });\r\n return true;\r\n }\r\n }\r\n catch (err) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n return false;\r\n };\r\n /**\r\n * Set isReady State\r\n * if isReady set to true, message queue will be flushed automatically.\r\n * @param isReady isReady State\r\n * @returns if message queue is flushed\r\n */\r\n _self.onReadyState = function (isReady) {\r\n _isReady = isNullOrUndefined(isReady) ? true : isReady;\r\n return _self.flush();\r\n };\r\n _self.sendMessage = function (msgID, message, severity) {\r\n if (_isReady) {\r\n var isSampledIn = _canSampledIn();\r\n if (!isSampledIn) {\r\n return;\r\n }\r\n var canThrottle = _canThrottle(_config, _canUseLocalStorage, _localStorageObj);\r\n var throttled = false;\r\n var number = 0;\r\n try {\r\n if (canThrottle && !_isTriggered) {\r\n number = Math.min(_config.limit.maxSendNumber, _localStorageObj[_DYN_COUNT /* @min:%2ecount */] + 1);\r\n _localStorageObj[_DYN_COUNT /* @min:%2ecount */] = 0;\r\n throttled = true;\r\n _isTriggered = true;\r\n _localStorageObj[_DYN_PRE_TRIGGER_DATE /* @min:%2epreTriggerDate */] = new Date();\r\n }\r\n else {\r\n _isTriggered = canThrottle;\r\n _localStorageObj[_DYN_COUNT /* @min:%2ecount */] += 1;\r\n }\r\n _resetLocalStorage(_logger, _localStorageName, _localStorageObj);\r\n for (var i = 0; i < number; i++) {\r\n _sendMessage(msgID, _logger, message, severity);\r\n }\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n return {\r\n isThrottled: throttled,\r\n throttleNum: number\r\n };\r\n }\r\n else {\r\n _queue.push({\r\n msgID: msgID,\r\n message: message,\r\n severity: severity\r\n });\r\n }\r\n return null;\r\n };\r\n function _initConfig() {\r\n var _a, _b, _c, _d, _e;\r\n _canUseLocalStorage = utlCanUseLocalStorage();\r\n _logger = safeGetLogger(core);\r\n _isTriggered = false;\r\n _namePrefix = isNotNullOrUndefined(namePrefix) ? namePrefix : \"\";\r\n _queue = [];\r\n var configMgr = throttleMgr;\r\n _config = {};\r\n _config[_DYN_DISABLED /* @min:%2edisabled */] = !!configMgr[_DYN_DISABLED /* @min:%2edisabled */];\r\n _config.msgKey = configMgr.msgKey;\r\n // default: send data on 28th every 3 month each year\r\n var interval = {\r\n // dafault: sent every three months\r\n monthInterval: ((_a = configMgr.interval) === null || _a === void 0 ? void 0 : _a.monthInterval) || 3,\r\n dayInterval: ((_b = configMgr.interval) === null || _b === void 0 ? void 0 : _b.dayInterval) || 28,\r\n maxTimesPerMonth: ((_c = configMgr.interval) === null || _c === void 0 ? void 0 : _c.maxTimesPerMonth) || 1\r\n };\r\n _config.interval = interval;\r\n var limit = {\r\n samplingRate: ((_d = configMgr.limit) === null || _d === void 0 ? void 0 : _d.samplingRate) || 100,\r\n // dafault: every time sent only 1 event\r\n maxSendNumber: ((_e = configMgr.limit) === null || _e === void 0 ? void 0 : _e.maxSendNumber) || 1\r\n };\r\n _config.limit = limit;\r\n _localStorageName = _getLocalStorageName(_config.msgKey, _namePrefix);\r\n if (_canUseLocalStorage && _localStorageName) {\r\n _localStorageObj = _getLocalStorageObj(utlGetLocalStorage(_logger, _localStorageName), _logger, _localStorageName);\r\n }\r\n if (_localStorageObj) {\r\n _isTriggered = _isTriggeredOnCurDate(_localStorageObj[_DYN_PRE_TRIGGER_DATE /* @min:%2epreTriggerDate */]);\r\n }\r\n }\r\n function _canThrottle(config, canUseLocalStorage, localStorageObj) {\r\n if (!config[_DYN_DISABLED /* @min:%2edisabled */] && canUseLocalStorage && isNotNullOrUndefined(localStorageObj)) {\r\n var curDate = _getThrottleDate();\r\n var date = localStorageObj[_DYN_DATE /* @min:%2edate */];\r\n var interval = config.interval;\r\n var monthExpand = (curDate.getUTCFullYear() - date.getUTCFullYear()) * 12 + curDate.getUTCMonth() - date.getUTCMonth();\r\n var monthCheck = _checkInterval(interval.monthInterval, 0, monthExpand);\r\n var dayCheck = _checkInterval(interval.dayInterval, 0, curDate[_DYN_GET_UTCDATE /* @min:%2egetUTCDate */]()) - 1;\r\n return monthCheck >= 0 && dayCheck >= 0 && dayCheck <= config.interval[_DYN_MAX_TIMES_PER_MONTH /* @min:%2emaxTimesPerMonth */];\r\n }\r\n return false;\r\n }\r\n function _getLocalStorageName(msgKey, prefix) {\r\n var fix = isNotNullOrUndefined(prefix) ? prefix : \"\";\r\n if (msgKey) {\r\n return THROTTLE_STORAGE_PREFIX + fix + \"-\" + msgKey;\r\n }\r\n return null;\r\n }\r\n // returns if throttle is triggered on current Date\r\n function _isTriggeredOnCurDate(preTriggerDate) {\r\n try {\r\n if (preTriggerDate) {\r\n var curDate = new Date();\r\n return preTriggerDate.getUTCFullYear() === curDate.getUTCFullYear() &&\r\n preTriggerDate.getUTCMonth() === curDate.getUTCMonth() &&\r\n preTriggerDate[_DYN_GET_UTCDATE /* @min:%2egetUTCDate */]() === curDate[_DYN_GET_UTCDATE /* @min:%2egetUTCDate */]();\r\n }\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n return false;\r\n }\r\n // transfer local storage string value to object that identifies start date, current count and preTriggerDate\r\n function _getLocalStorageObj(value, logger, storageName) {\r\n try {\r\n var storageObj = {\r\n date: _getThrottleDate(),\r\n count: 0\r\n };\r\n if (value) {\r\n var obj = JSON.parse(value);\r\n return {\r\n date: _getThrottleDate(obj[_DYN_DATE /* @min:%2edate */]) || storageObj[_DYN_DATE /* @min:%2edate */],\r\n count: obj[_DYN_COUNT /* @min:%2ecount */] || storageObj[_DYN_COUNT /* @min:%2ecount */],\r\n preTriggerDate: obj.preTriggerDate ? _getThrottleDate(obj[_DYN_PRE_TRIGGER_DATE /* @min:%2epreTriggerDate */]) : undefined\r\n };\r\n }\r\n else {\r\n _resetLocalStorage(logger, storageName, storageObj);\r\n return storageObj;\r\n }\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n return null;\r\n }\r\n // if datestr is not defined, current date will be returned\r\n function _getThrottleDate(dateStr) {\r\n // if new Date() can't be created through the provided dateStr, null will be returned.\r\n try {\r\n if (dateStr) {\r\n var date = new Date(dateStr);\r\n //make sure it is a valid Date Object\r\n if (!isNaN(date.getDate())) {\r\n return date;\r\n }\r\n }\r\n else {\r\n return new Date();\r\n }\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n return null;\r\n }\r\n function _resetLocalStorage(logger, storageName, obj) {\r\n try {\r\n return utlSetLocalStorage(logger, storageName, strTrim(JSON[_DYN_STRINGIFY /* @min:%2estringify */](obj)));\r\n }\r\n catch (e) {\r\n // // eslint-disable-next-line no-empty\r\n }\r\n return false;\r\n }\r\n function _checkInterval(interval, start, current) {\r\n // count from start year\r\n return (current >= start) && (current - start) % interval == 0 ? Math.floor((current - start) / interval) + 1 : -1;\r\n }\r\n function _sendMessage(msgID, logger, message, severity) {\r\n _throwInternal(logger, severity || 1 /* eLoggingSeverity.CRITICAL */, msgID, message);\r\n }\r\n // NOTE: config.limit.samplingRate is set to 4 decimal places,\r\n // so config.limit.samplingRate = 1 means 0.0001%\r\n function _canSampledIn() {\r\n return randomValue(1000000) <= _config.limit.samplingRate;\r\n }\r\n }\r\n return ThrottleMgr;\r\n}());\r\nexport { ThrottleMgr };\r\n//# sourceMappingURL=ThrottleMgr.js.map"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
1
|
+
{"version":3,"file":"ThrottleMgr.js.map","sources":["ThrottleMgr.js"],"sourcesContent":["import { _throwInternal, arrForEach, arrIndexOf, isNotNullOrUndefined, isNullOrUndefined, randomValue, safeGetLogger, strTrim } from \"@microsoft/applicationinsights-core-js\";\r\nimport { utlCanUseLocalStorage, utlGetLocalStorage, utlSetLocalStorage } from \"./StorageHelperFuncs\";\r\nimport { _DYN_COUNT, _DYN_DATE, _DYN_DAYS_OF_MONTH, _DYN_DISABLED, _DYN_GET_UTCDATE, _DYN_INTERVAL, _DYN_LENGTH, _DYN_MESSAGE, _DYN_PRE_TRIGGER_DATE, _DYN_STRINGIFY } from \"./__DynamicConstants\";\r\nvar THROTTLE_STORAGE_PREFIX = \"appInsightsThrottle\";\r\nvar ThrottleMgr = /** @class */ (function () {\r\n function ThrottleMgr(throttleMgr, core, namePrefix) {\r\n var _self = this;\r\n var _canUseLocalStorage;\r\n var _logger;\r\n var _config;\r\n var _localStorageName;\r\n var _localStorageObj;\r\n var _isTriggered; //_isTriggered is to make sure that we only trigger throttle once a day\r\n var _namePrefix;\r\n var _queue;\r\n var _isReady = false;\r\n var _isSpecificDaysGiven = false;\r\n _initConfig();\r\n _self.getConfig = function () {\r\n return _config;\r\n };\r\n /**\r\n * Check if it is the correct day to send message.\r\n * If _isTriggered is true, even if canThrottle returns true, message will not be sent,\r\n * because we only allow triggering sendMessage() once a day.\r\n * @returns if the current date is the valid date to send message\r\n */\r\n _self.canThrottle = function () {\r\n return _canThrottle(_config, _canUseLocalStorage, _localStorageObj);\r\n };\r\n /**\r\n * Check if throttle is triggered on current day(UTC)\r\n * if canThrottle returns false, isTriggered will return false\r\n * @returns if throttle is triggered on current day(UTC)\r\n */\r\n _self.isTriggered = function () {\r\n return _isTriggered;\r\n };\r\n /**\r\n * Before isReady set to true, all message will be stored in queue.\r\n * Message will only be sent out after isReady set to true.\r\n * Initial and default value: false\r\n * @returns isReady state\r\n */\r\n _self.isReady = function () {\r\n return _isReady;\r\n };\r\n /**\r\n * Flush all message in queue with isReady state set to true.\r\n * @returns if message queue is flushed\r\n */\r\n _self.flush = function () {\r\n try {\r\n if (_isReady && _queue[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n arrForEach(_queue, function (item) {\r\n _self.sendMessage(item.msgID, item[_DYN_MESSAGE /* @min:%2emessage */], item.severity);\r\n });\r\n return true;\r\n }\r\n }\r\n catch (err) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n return false;\r\n };\r\n /**\r\n * Set isReady State\r\n * if isReady set to true, message queue will be flushed automatically.\r\n * @param isReady isReady State\r\n * @returns if message queue is flushed\r\n */\r\n _self.onReadyState = function (isReady) {\r\n _isReady = isNullOrUndefined(isReady) ? true : isReady;\r\n return _self.flush();\r\n };\r\n _self.sendMessage = function (msgID, message, severity) {\r\n if (_isReady) {\r\n var isSampledIn = _canSampledIn();\r\n if (!isSampledIn) {\r\n return;\r\n }\r\n var canThrottle = _canThrottle(_config, _canUseLocalStorage, _localStorageObj);\r\n var throttled = false;\r\n var number = 0;\r\n try {\r\n if (canThrottle && !_isTriggered) {\r\n number = Math.min(_config.limit.maxSendNumber, _localStorageObj[_DYN_COUNT /* @min:%2ecount */] + 1);\r\n _localStorageObj[_DYN_COUNT /* @min:%2ecount */] = 0;\r\n throttled = true;\r\n _isTriggered = true;\r\n _localStorageObj[_DYN_PRE_TRIGGER_DATE /* @min:%2epreTriggerDate */] = new Date();\r\n }\r\n else {\r\n _isTriggered = canThrottle;\r\n _localStorageObj[_DYN_COUNT /* @min:%2ecount */] += 1;\r\n }\r\n _resetLocalStorage(_logger, _localStorageName, _localStorageObj);\r\n for (var i = 0; i < number; i++) {\r\n _sendMessage(msgID, _logger, message, severity);\r\n }\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n return {\r\n isThrottled: throttled,\r\n throttleNum: number\r\n };\r\n }\r\n else {\r\n _queue.push({\r\n msgID: msgID,\r\n message: message,\r\n severity: severity\r\n });\r\n }\r\n return null;\r\n };\r\n function _initConfig() {\r\n var _a, _b;\r\n _canUseLocalStorage = utlCanUseLocalStorage();\r\n _logger = safeGetLogger(core);\r\n _isTriggered = false;\r\n _namePrefix = isNotNullOrUndefined(namePrefix) ? namePrefix : \"\";\r\n _queue = [];\r\n var configMgr = throttleMgr;\r\n _config = {};\r\n _config[_DYN_DISABLED /* @min:%2edisabled */] = !!configMgr[_DYN_DISABLED /* @min:%2edisabled */];\r\n _config.msgKey = configMgr.msgKey;\r\n var configInterval = configMgr[_DYN_INTERVAL /* @min:%2einterval */] || {};\r\n _isSpecificDaysGiven = (configInterval === null || configInterval === void 0 ? void 0 : configInterval.daysOfMonth) && (configInterval === null || configInterval === void 0 ? void 0 : configInterval.daysOfMonth[_DYN_LENGTH /* @min:%2elength */]) > 0;\r\n _config[_DYN_INTERVAL /* @min:%2einterval */] = _getIntervalConfig(configInterval);\r\n var limit = {\r\n samplingRate: ((_a = configMgr.limit) === null || _a === void 0 ? void 0 : _a.samplingRate) || 100,\r\n // dafault: every time sent only 1 event\r\n maxSendNumber: ((_b = configMgr.limit) === null || _b === void 0 ? void 0 : _b.maxSendNumber) || 1\r\n };\r\n _config.limit = limit;\r\n _localStorageName = _getLocalStorageName(_config.msgKey, _namePrefix);\r\n if (_canUseLocalStorage && _localStorageName) {\r\n _localStorageObj = _getLocalStorageObj(utlGetLocalStorage(_logger, _localStorageName), _logger, _localStorageName);\r\n }\r\n if (_localStorageObj) {\r\n _isTriggered = _isTriggeredOnCurDate(_localStorageObj[_DYN_PRE_TRIGGER_DATE /* @min:%2epreTriggerDate */]);\r\n }\r\n }\r\n function _getIntervalConfig(interval) {\r\n interval = interval || {};\r\n var monthInterval = interval === null || interval === void 0 ? void 0 : interval.monthInterval;\r\n var dayInterval = interval === null || interval === void 0 ? void 0 : interval.dayInterval;\r\n // default: send data every 3 month each year\r\n if (isNullOrUndefined(monthInterval) && isNullOrUndefined(dayInterval)) {\r\n interval.monthInterval = 3;\r\n if (!_isSpecificDaysGiven) {\r\n // default: send data on 28th\r\n interval[_DYN_DAYS_OF_MONTH /* @min:%2edaysOfMonth */] = [28];\r\n _isSpecificDaysGiven = true;\r\n }\r\n }\r\n interval = {\r\n // dafault: sent every three months\r\n monthInterval: interval === null || interval === void 0 ? void 0 : interval.monthInterval,\r\n dayInterval: interval === null || interval === void 0 ? void 0 : interval.dayInterval,\r\n daysOfMonth: interval === null || interval === void 0 ? void 0 : interval.daysOfMonth\r\n };\r\n return interval;\r\n }\r\n function _canThrottle(config, canUseLocalStorage, localStorageObj) {\r\n if (!config[_DYN_DISABLED /* @min:%2edisabled */] && canUseLocalStorage && isNotNullOrUndefined(localStorageObj)) {\r\n var curDate = _getThrottleDate();\r\n var date = localStorageObj[_DYN_DATE /* @min:%2edate */];\r\n var interval = config[_DYN_INTERVAL /* @min:%2einterval */];\r\n var monthCheck = 1;\r\n if (interval === null || interval === void 0 ? void 0 : interval.monthInterval) {\r\n var monthExpand = (curDate.getUTCFullYear() - date.getUTCFullYear()) * 12 + curDate.getUTCMonth() - date.getUTCMonth();\r\n monthCheck = _checkInterval(interval.monthInterval, 0, monthExpand);\r\n }\r\n var dayCheck = 1;\r\n if (_isSpecificDaysGiven) {\r\n dayCheck = arrIndexOf(interval[_DYN_DAYS_OF_MONTH /* @min:%2edaysOfMonth */], curDate[_DYN_GET_UTCDATE /* @min:%2egetUTCDate */]());\r\n }\r\n else if (interval === null || interval === void 0 ? void 0 : interval.dayInterval) {\r\n var daySpan = Math.floor((curDate.getTime() - date.getTime()) / 86400000);\r\n dayCheck = _checkInterval(interval.dayInterval, 0, daySpan);\r\n }\r\n return monthCheck >= 0 && dayCheck >= 0;\r\n }\r\n return false;\r\n }\r\n function _getLocalStorageName(msgKey, prefix) {\r\n var fix = isNotNullOrUndefined(prefix) ? prefix : \"\";\r\n if (msgKey) {\r\n return THROTTLE_STORAGE_PREFIX + fix + \"-\" + msgKey;\r\n }\r\n return null;\r\n }\r\n // returns if throttle is triggered on current Date\r\n function _isTriggeredOnCurDate(preTriggerDate) {\r\n try {\r\n if (preTriggerDate) {\r\n var curDate = new Date();\r\n return preTriggerDate.getUTCFullYear() === curDate.getUTCFullYear() &&\r\n preTriggerDate.getUTCMonth() === curDate.getUTCMonth() &&\r\n preTriggerDate[_DYN_GET_UTCDATE /* @min:%2egetUTCDate */]() === curDate[_DYN_GET_UTCDATE /* @min:%2egetUTCDate */]();\r\n }\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n return false;\r\n }\r\n // transfer local storage string value to object that identifies start date, current count and preTriggerDate\r\n function _getLocalStorageObj(value, logger, storageName) {\r\n try {\r\n var storageObj = {\r\n date: _getThrottleDate(),\r\n count: 0\r\n };\r\n if (value) {\r\n var obj = JSON.parse(value);\r\n return {\r\n date: _getThrottleDate(obj[_DYN_DATE /* @min:%2edate */]) || storageObj[_DYN_DATE /* @min:%2edate */],\r\n count: obj[_DYN_COUNT /* @min:%2ecount */] || storageObj[_DYN_COUNT /* @min:%2ecount */],\r\n preTriggerDate: obj.preTriggerDate ? _getThrottleDate(obj[_DYN_PRE_TRIGGER_DATE /* @min:%2epreTriggerDate */]) : undefined\r\n };\r\n }\r\n else {\r\n _resetLocalStorage(logger, storageName, storageObj);\r\n return storageObj;\r\n }\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n return null;\r\n }\r\n // if datestr is not defined, current date will be returned\r\n function _getThrottleDate(dateStr) {\r\n // if new Date() can't be created through the provided dateStr, null will be returned.\r\n try {\r\n if (dateStr) {\r\n var date = new Date(dateStr);\r\n //make sure it is a valid Date Object\r\n if (!isNaN(date.getDate())) {\r\n return date;\r\n }\r\n }\r\n else {\r\n return new Date();\r\n }\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n return null;\r\n }\r\n function _resetLocalStorage(logger, storageName, obj) {\r\n try {\r\n return utlSetLocalStorage(logger, storageName, strTrim(JSON[_DYN_STRINGIFY /* @min:%2estringify */](obj)));\r\n }\r\n catch (e) {\r\n // // eslint-disable-next-line no-empty\r\n }\r\n return false;\r\n }\r\n function _checkInterval(interval, start, current) {\r\n // count from start year\r\n return (current >= start) && (current - start) % interval == 0 ? Math.floor((current - start) / interval) + 1 : -1;\r\n }\r\n function _sendMessage(msgID, logger, message, severity) {\r\n _throwInternal(logger, severity || 1 /* eLoggingSeverity.CRITICAL */, msgID, message);\r\n }\r\n // NOTE: config.limit.samplingRate is set to 4 decimal places,\r\n // so config.limit.samplingRate = 1 means 0.0001%\r\n function _canSampledIn() {\r\n return randomValue(1000000) <= _config.limit.samplingRate;\r\n }\r\n }\r\n return ThrottleMgr;\r\n}());\r\nexport { ThrottleMgr };\r\n//# sourceMappingURL=ThrottleMgr.js.map"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
package/dist-esm/Util.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Common, 3.0.0-beta.
|
|
2
|
+
* Application Insights JavaScript SDK - Common, 3.0.0-beta.2302-02
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
// ##############################################################
|
|
9
9
|
// AUTO GENERATED FILE: This file is Auto Generated during build.
|
|
10
10
|
// ##############################################################
|
|
11
|
-
//
|
|
12
|
-
// Note: DON'T Export these const from the package as we are still targeting
|
|
13
|
-
//
|
|
11
|
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
12
|
+
// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!
|
|
13
|
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
14
14
|
export var _DYN_SPLIT = "split"; // Count: 6
|
|
15
15
|
export var _DYN_LENGTH = "length"; // Count: 41
|
|
16
16
|
export var _DYN_TO_LOWER_CASE = "toLowerCase"; // Count: 6
|
|
@@ -22,9 +22,10 @@ export var _DYN_MESSAGE = "message"; // Count: 10
|
|
|
22
22
|
export var _DYN_COUNT = "count"; // Count: 8
|
|
23
23
|
export var _DYN_PRE_TRIGGER_DATE = "preTriggerDate"; // Count: 4
|
|
24
24
|
export var _DYN_DISABLED = "disabled"; // Count: 3
|
|
25
|
+
export var _DYN_INTERVAL = "interval"; // Count: 3
|
|
26
|
+
export var _DYN_DAYS_OF_MONTH = "daysOfMonth"; // Count: 3
|
|
25
27
|
export var _DYN_DATE = "date"; // Count: 5
|
|
26
28
|
export var _DYN_GET_UTCDATE = "getUTCDate"; // Count: 3
|
|
27
|
-
export var _DYN_MAX_TIMES_PER_MONTH = "maxTimesPerMonth"; // Count: 2
|
|
28
29
|
export var _DYN_STRINGIFY = "stringify"; // Count: 4
|
|
29
30
|
export var _DYN_PATHNAME = "pathname"; // Count: 4
|
|
30
31
|
export var _DYN_CORRELATION_HEADER_E0 = "correlationHeaderExcludePatterns"; // Count: 2
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"__DynamicConstants.js.map","sources":["__DynamicConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n//
|
|
1
|
+
{"version":3,"file":"__DynamicConstants.js.map","sources":["__DynamicConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\nexport var _DYN_SPLIT = \"split\"; // Count: 6\r\nexport var _DYN_LENGTH = \"length\"; // Count: 41\r\nexport var _DYN_TO_LOWER_CASE = \"toLowerCase\"; // Count: 6\r\nexport var _DYN_INGESTIONENDPOINT = \"ingestionendpoint\"; // Count: 4\r\nexport var _DYN_TO_STRING = \"toString\"; // Count: 12\r\nexport var _DYN_REMOVE_ITEM = \"removeItem\"; // Count: 3\r\nexport var _DYN_NAME = \"name\"; // Count: 11\r\nexport var _DYN_MESSAGE = \"message\"; // Count: 10\r\nexport var _DYN_COUNT = \"count\"; // Count: 8\r\nexport var _DYN_PRE_TRIGGER_DATE = \"preTriggerDate\"; // Count: 4\r\nexport var _DYN_DISABLED = \"disabled\"; // Count: 3\r\nexport var _DYN_INTERVAL = \"interval\"; // Count: 3\r\nexport var _DYN_DAYS_OF_MONTH = \"daysOfMonth\"; // Count: 3\r\nexport var _DYN_DATE = \"date\"; // Count: 5\r\nexport var _DYN_GET_UTCDATE = \"getUTCDate\"; // Count: 3\r\nexport var _DYN_STRINGIFY = \"stringify\"; // Count: 4\r\nexport var _DYN_PATHNAME = \"pathname\"; // Count: 4\r\nexport var _DYN_CORRELATION_HEADER_E0 = \"correlationHeaderExcludePatterns\"; // Count: 2\r\nexport var _DYN_EXTENSION_CONFIG = \"extensionConfig\"; // Count: 4\r\nexport var _DYN_EXCEPTIONS = \"exceptions\"; // Count: 6\r\nexport var _DYN_PARSED_STACK = \"parsedStack\"; // Count: 11\r\nexport var _DYN_PROPERTIES = \"properties\"; // Count: 9\r\nexport var _DYN_MEASUREMENTS = \"measurements\"; // Count: 9\r\nexport var _DYN_SIZE_IN_BYTES = \"sizeInBytes\"; // Count: 11\r\nexport var _DYN_TYPE_NAME = \"typeName\"; // Count: 11\r\nexport var _DYN_SEVERITY_LEVEL = \"severityLevel\"; // Count: 5\r\nexport var _DYN_PROBLEM_GROUP = \"problemGroup\"; // Count: 3\r\nexport var _DYN_IS_MANUAL = \"isManual\"; // Count: 3\r\nexport var _DYN__CREATE_FROM_INTERFA1 = \"CreateFromInterface\"; // Count: 2\r\nexport var _DYN_HAS_FULL_STACK = \"hasFullStack\"; // Count: 6\r\nexport var _DYN_LEVEL = \"level\"; // Count: 5\r\nexport var _DYN_METHOD = \"method\"; // Count: 7\r\nexport var _DYN_ASSEMBLY = \"assembly\"; // Count: 5\r\nexport var _DYN_FILE_NAME = \"fileName\"; // Count: 6\r\nexport var _DYN_LINE = \"line\"; // Count: 6\r\nexport var _DYN_DURATION = \"duration\"; // Count: 4\r\nexport var _DYN_RECEIVED_RESPONSE = \"receivedResponse\"; // Count: 2\r\nexport var _DYN_SUBSTRING = \"substring\"; // Count: 6\r\n//# sourceMappingURL=__DynamicConstants.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/applicationinsights-common",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.2302-02",
|
|
4
4
|
"description": "Microsoft Application Insights Common JavaScript Library",
|
|
5
5
|
"homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
|
|
6
6
|
"author": "Microsoft Application Insights Team",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@microsoft/api-extractor": "^7.18.1",
|
|
33
33
|
"grunt": "^1.5.3",
|
|
34
34
|
"grunt-cli": "^1.4.3",
|
|
35
|
-
"grunt-contrib-qunit": "^
|
|
35
|
+
"grunt-contrib-qunit": "^6.2.1",
|
|
36
36
|
"@nevware21/grunt-ts-plugin": "^0.4.3",
|
|
37
37
|
"@nevware21/grunt-eslint-ts": "^0.2.2",
|
|
38
38
|
"@rollup/plugin-commonjs": "^18.0.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@rollup/plugin-replace": "^2.3.3",
|
|
41
41
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
42
42
|
"rollup": "^2.32.0",
|
|
43
|
-
"typescript": "^4.3
|
|
43
|
+
"typescript": "^4.9.3",
|
|
44
44
|
"tslib": "^2.0.0",
|
|
45
45
|
"globby": "^11.0.0",
|
|
46
46
|
"magic-string": "^0.25.7",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@microsoft/applicationinsights-shims": "2.0.2",
|
|
54
|
-
"@microsoft/applicationinsights-core-js": "3.0.0-beta.
|
|
54
|
+
"@microsoft/applicationinsights-core-js": "3.0.0-beta.2302-02",
|
|
55
55
|
"@microsoft/dynamicproto-js": "^1.1.7",
|
|
56
|
-
"@nevware21/ts-utils": "^0.
|
|
56
|
+
"@nevware21/ts-utils": "^0.7.0"
|
|
57
57
|
},
|
|
58
58
|
"license": "MIT",
|
|
59
59
|
"publishConfig": {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import { arrReduce, objKeys } from "@microsoft/applicationinsights-core-js";
|
|
5
|
-
import { DEFAULT_BREEZE_ENDPOINT } from "./Constants";
|
|
6
|
-
import { ConnectionString, ConnectionStringKey } from "./Interfaces/ConnectionString";
|
|
7
|
-
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import { arrReduce, objKeys } from "@microsoft/applicationinsights-core-js";
|
|
5
|
+
import { DEFAULT_BREEZE_ENDPOINT } from "./Constants";
|
|
6
|
+
import { ConnectionString, ConnectionStringKey } from "./Interfaces/ConnectionString";
|
|
7
|
+
|
|
8
8
|
const _FIELDS_SEPARATOR = ";";
|
|
9
9
|
const _FIELD_KEY_VALUE_SEPARATOR = "=";
|
|
10
10
|
|
|
@@ -44,4 +44,4 @@ export function parseConnectionString(connectionString?: string): ConnectionStri
|
|
|
44
44
|
|
|
45
45
|
export const ConnectionStringParser = {
|
|
46
46
|
parse: parseConnectionString
|
|
47
|
-
};
|
|
47
|
+
};
|
package/src/HelperFuncs.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import { IPlugin, arrForEach, isString } from "@microsoft/applicationinsights-core-js";
|
|
5
|
-
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import { IPlugin, arrForEach, isString } from "@microsoft/applicationinsights-core-js";
|
|
5
|
+
|
|
6
6
|
const strEmpty = "";
|
|
7
7
|
|
|
8
8
|
export function stringToBoolOrDefault(str: any, defaultValue = false): boolean {
|
|
@@ -51,4 +51,4 @@ export function getExtensionByName(extensions: IPlugin[], identifier: string): I
|
|
|
51
51
|
|
|
52
52
|
export function isCrossOriginError(message: string|Event, url: string, lineNumber: number, columnNumber: number, error: Error | Event): boolean {
|
|
53
53
|
return !error && isString(message) && (message === "Script error." || message === "Script error");
|
|
54
|
-
}
|
|
54
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import { IConfiguration, ICustomProperties, isNullOrUndefined } from "@microsoft/applicationinsights-core-js";
|
|
4
|
-
import { DistributedTracingModes } from "../Enums";
|
|
5
|
-
import { IRequestContext } from "./IRequestContext";
|
|
6
|
-
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { IConfiguration, ICustomProperties, isNullOrUndefined } from "@microsoft/applicationinsights-core-js";
|
|
4
|
+
import { DistributedTracingModes } from "../Enums";
|
|
5
|
+
import { IRequestContext } from "./IRequestContext";
|
|
6
|
+
|
|
7
7
|
/**
|
|
8
8
|
* Configuration settings for how telemetry is sent
|
|
9
9
|
* @export
|
|
@@ -393,4 +393,4 @@ export class ConfigurationManager {
|
|
|
393
393
|
|
|
394
394
|
return !isNullOrUndefined(configValue) ? configValue : defaultValue;
|
|
395
395
|
}
|
|
396
|
-
}
|
|
396
|
+
}
|
|
@@ -27,21 +27,21 @@ export interface IThrottleInterval {
|
|
|
27
27
|
/**
|
|
28
28
|
* Identifies month interval that items can be sent
|
|
29
29
|
* For example, if it is set to 2 and start date is in Jan, items will be sent out every two months (Jan, March, May etc.)
|
|
30
|
-
*
|
|
30
|
+
* If both monthInterval and dayInterval are undefined, it will be set to 3
|
|
31
31
|
*/
|
|
32
32
|
monthInterval?: number;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* Identifies days that items can be sent
|
|
36
|
-
* Default:
|
|
35
|
+
* Identifies days Interval from start date that items can be sent
|
|
36
|
+
* Default: undefined
|
|
37
37
|
*/
|
|
38
38
|
dayInterval?: number;
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
* Identifies
|
|
42
|
-
*
|
|
41
|
+
* Identifies days within each month that items can be sent
|
|
42
|
+
* If both monthInterval and dayInterval are undefined, it will be default to [28]
|
|
43
43
|
*/
|
|
44
|
-
|
|
44
|
+
daysOfMonth?: number[];
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
IDiagnosticLogger, _eInternalMessageId, _throwInternal, dumpObj, eLoggingSeverity, getExceptionName, getGlobal, getGlobalInst,
|
|
6
|
-
isNullOrUndefined, objForEachKey
|
|
7
|
-
} from "@microsoft/applicationinsights-core-js";
|
|
8
|
-
import { StorageType } from "./Enums";
|
|
9
|
-
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
IDiagnosticLogger, _eInternalMessageId, _throwInternal, dumpObj, eLoggingSeverity, getExceptionName, getGlobal, getGlobalInst,
|
|
6
|
+
isNullOrUndefined, objForEachKey
|
|
7
|
+
} from "@microsoft/applicationinsights-core-js";
|
|
8
|
+
import { StorageType } from "./Enums";
|
|
9
|
+
|
|
10
10
|
let _canUseLocalStorage: boolean = undefined;
|
|
11
11
|
let _canUseSessionStorage: boolean = undefined;
|
|
12
12
|
|
|
@@ -220,4 +220,4 @@ export function utlRemoveSessionStorage(logger: IDiagnosticLogger, name: string)
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
return false;
|
|
223
|
-
}
|
|
223
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
IDiagnosticLogger, _eInternalMessageId, _throwInternal, eLoggingSeverity, getJSON, hasJSON, isObject, objForEachKey, strTrim
|
|
6
|
-
} from "@microsoft/applicationinsights-core-js";
|
|
7
|
-
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
IDiagnosticLogger, _eInternalMessageId, _throwInternal, eLoggingSeverity, getJSON, hasJSON, isObject, objForEachKey, strTrim
|
|
6
|
+
} from "@microsoft/applicationinsights-core-js";
|
|
7
|
+
|
|
8
8
|
export const enum DataSanitizerValues {
|
|
9
9
|
/**
|
|
10
10
|
* Max length allowed for custom names.
|
|
@@ -194,4 +194,4 @@ export function dataSanitizeInput(logger: IDiagnosticLogger, input: any, maxLeng
|
|
|
194
194
|
export function dsPadNumber(num: number) {
|
|
195
195
|
const s = "00" + num;
|
|
196
196
|
return s.substr(s.length - 3);
|
|
197
|
-
}
|
|
197
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import { IDiagnosticLogger, toISOString } from "@microsoft/applicationinsights-core-js";
|
|
5
|
-
import { strNotSpecified } from "../../Constants";
|
|
6
|
-
import { FieldType } from "../../Enums";
|
|
7
|
-
import { IBase } from "../../Interfaces/Contracts/IBase";
|
|
8
|
-
import { IEnvelope } from "../../Interfaces/Telemetry/IEnvelope";
|
|
9
|
-
import { dataSanitizeString } from "./DataSanitizer";
|
|
10
|
-
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import { IDiagnosticLogger, toISOString } from "@microsoft/applicationinsights-core-js";
|
|
5
|
+
import { strNotSpecified } from "../../Constants";
|
|
6
|
+
import { FieldType } from "../../Enums";
|
|
7
|
+
import { IBase } from "../../Interfaces/Contracts/IBase";
|
|
8
|
+
import { IEnvelope } from "../../Interfaces/Telemetry/IEnvelope";
|
|
9
|
+
import { dataSanitizeString } from "./DataSanitizer";
|
|
10
|
+
|
|
11
11
|
export class Envelope implements IEnvelope {
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -78,4 +78,4 @@ export class Envelope implements IEnvelope {
|
|
|
78
78
|
data: FieldType.Required
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
}
|
|
81
|
+
}
|
package/src/Telemetry/Event.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import { IDiagnosticLogger } from "@microsoft/applicationinsights-core-js";
|
|
5
|
-
import { strNotSpecified } from "../Constants";
|
|
6
|
-
import { FieldType } from "../Enums";
|
|
7
|
-
import { IEventData } from "../Interfaces/Contracts/IEventData";
|
|
8
|
-
import { ISerializable } from "../Interfaces/Telemetry/ISerializable";
|
|
9
|
-
import { dataSanitizeMeasurements, dataSanitizeProperties, dataSanitizeString } from "./Common/DataSanitizer";
|
|
10
|
-
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import { IDiagnosticLogger } from "@microsoft/applicationinsights-core-js";
|
|
5
|
+
import { strNotSpecified } from "../Constants";
|
|
6
|
+
import { FieldType } from "../Enums";
|
|
7
|
+
import { IEventData } from "../Interfaces/Contracts/IEventData";
|
|
8
|
+
import { ISerializable } from "../Interfaces/Telemetry/ISerializable";
|
|
9
|
+
import { dataSanitizeMeasurements, dataSanitizeProperties, dataSanitizeString } from "./Common/DataSanitizer";
|
|
10
|
+
|
|
11
11
|
export class Event implements IEventData, ISerializable {
|
|
12
12
|
public static envelopeType = "Microsoft.ApplicationInsights.{0}.Event";
|
|
13
13
|
public static dataType = "EventData";
|
|
@@ -49,4 +49,4 @@ export class Event implements IEventData, ISerializable {
|
|
|
49
49
|
_self.properties = dataSanitizeProperties(logger, properties);
|
|
50
50
|
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
51
51
|
}
|
|
52
|
-
}
|
|
52
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
IDiagnosticLogger, arrForEach, arrMap, isArray, isError, isFunction, isNullOrUndefined, isObject, isString, strTrim
|
|
6
|
-
} from "@microsoft/applicationinsights-core-js";
|
|
7
|
-
import { strIndexOf } from "@nevware21/ts-utils";
|
|
8
|
-
import { strNotSpecified } from "../Constants";
|
|
9
|
-
import { FieldType } from "../Enums";
|
|
10
|
-
import { IExceptionData } from "../Interfaces/Contracts/IExceptionData";
|
|
11
|
-
import { IExceptionDetails } from "../Interfaces/Contracts/IExceptionDetails";
|
|
12
|
-
import { IStackFrame } from "../Interfaces/Contracts/IStackFrame";
|
|
13
|
-
import { SeverityLevel } from "../Interfaces/Contracts/SeverityLevel";
|
|
14
|
-
import {
|
|
15
|
-
IAutoExceptionTelemetry, IExceptionDetailsInternal, IExceptionInternal, IExceptionStackFrameInternal, IStackDetails
|
|
16
|
-
} from "../Interfaces/IExceptionTelemetry";
|
|
17
|
-
import { ISerializable } from "../Interfaces/Telemetry/ISerializable";
|
|
18
|
-
import {
|
|
19
|
-
dataSanitizeException, dataSanitizeMeasurements, dataSanitizeMessage, dataSanitizeProperties, dataSanitizeString
|
|
20
|
-
} from "./Common/DataSanitizer";
|
|
21
|
-
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
IDiagnosticLogger, arrForEach, arrMap, isArray, isError, isFunction, isNullOrUndefined, isObject, isString, strTrim
|
|
6
|
+
} from "@microsoft/applicationinsights-core-js";
|
|
7
|
+
import { strIndexOf } from "@nevware21/ts-utils";
|
|
8
|
+
import { strNotSpecified } from "../Constants";
|
|
9
|
+
import { FieldType } from "../Enums";
|
|
10
|
+
import { IExceptionData } from "../Interfaces/Contracts/IExceptionData";
|
|
11
|
+
import { IExceptionDetails } from "../Interfaces/Contracts/IExceptionDetails";
|
|
12
|
+
import { IStackFrame } from "../Interfaces/Contracts/IStackFrame";
|
|
13
|
+
import { SeverityLevel } from "../Interfaces/Contracts/SeverityLevel";
|
|
14
|
+
import {
|
|
15
|
+
IAutoExceptionTelemetry, IExceptionDetailsInternal, IExceptionInternal, IExceptionStackFrameInternal, IStackDetails
|
|
16
|
+
} from "../Interfaces/IExceptionTelemetry";
|
|
17
|
+
import { ISerializable } from "../Interfaces/Telemetry/ISerializable";
|
|
18
|
+
import {
|
|
19
|
+
dataSanitizeException, dataSanitizeMeasurements, dataSanitizeMessage, dataSanitizeProperties, dataSanitizeString
|
|
20
|
+
} from "./Common/DataSanitizer";
|
|
21
|
+
|
|
22
22
|
const NoMethod = "<no_method>";
|
|
23
23
|
const strError = "error";
|
|
24
24
|
const strStack = "stack";
|
|
@@ -672,4 +672,4 @@ export class _StackFrame implements IStackFrame, ISerializable {
|
|
|
672
672
|
line: _self.line
|
|
673
673
|
};
|
|
674
674
|
}
|
|
675
|
-
}
|
|
675
|
+
}
|
package/src/Telemetry/Metric.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import { IDiagnosticLogger } from "@microsoft/applicationinsights-core-js";
|
|
5
|
-
import { strNotSpecified } from "../Constants";
|
|
6
|
-
import { FieldType } from "../Enums";
|
|
7
|
-
import { IMetricData } from "../Interfaces/Contracts/IMetricData";
|
|
8
|
-
import { ISerializable } from "../Interfaces/Telemetry/ISerializable";
|
|
9
|
-
import { DataPoint } from "./Common/DataPoint";
|
|
10
|
-
import { dataSanitizeMeasurements, dataSanitizeProperties, dataSanitizeString } from "./Common/DataSanitizer";
|
|
11
|
-
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import { IDiagnosticLogger } from "@microsoft/applicationinsights-core-js";
|
|
5
|
+
import { strNotSpecified } from "../Constants";
|
|
6
|
+
import { FieldType } from "../Enums";
|
|
7
|
+
import { IMetricData } from "../Interfaces/Contracts/IMetricData";
|
|
8
|
+
import { ISerializable } from "../Interfaces/Telemetry/ISerializable";
|
|
9
|
+
import { DataPoint } from "./Common/DataPoint";
|
|
10
|
+
import { dataSanitizeMeasurements, dataSanitizeProperties, dataSanitizeString } from "./Common/DataSanitizer";
|
|
11
|
+
|
|
12
12
|
export class Metric implements IMetricData, ISerializable {
|
|
13
13
|
|
|
14
14
|
public static envelopeType = "Microsoft.ApplicationInsights.{0}.Metric";
|
|
@@ -58,4 +58,4 @@ export class Metric implements IMetricData, ISerializable {
|
|
|
58
58
|
_self.properties = dataSanitizeProperties(logger, properties);
|
|
59
59
|
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
60
60
|
}
|
|
61
|
-
}
|
|
61
|
+
}
|