Fix issues with for..in usage with prototype extension libraries like ember.js and prototype.js (#1420)
This commit is contained in:
Родитель
d6a1f68e22
Коммит
05a1f41058
|
@ -3,7 +3,7 @@ import { IConfig, PageViewPerformance, SeverityLevel, Util,
|
||||||
IAutoExceptionTelemetry, IDependencyTelemetry, IExceptionTelemetry,
|
IAutoExceptionTelemetry, IDependencyTelemetry, IExceptionTelemetry,
|
||||||
IEventTelemetry, IEnvelope, ProcessLegacy, HttpMethod } from "@microsoft/applicationinsights-common";
|
IEventTelemetry, IEnvelope, ProcessLegacy, HttpMethod } from "@microsoft/applicationinsights-common";
|
||||||
import { Snippet, Initialization as ApplicationInsights } from "./Initialization";
|
import { Snippet, Initialization as ApplicationInsights } from "./Initialization";
|
||||||
import { ITelemetryItem, IDiagnosticLogger, IConfiguration } from "@microsoft/applicationinsights-core-js";
|
import { ITelemetryItem, IDiagnosticLogger, IConfiguration, CoreUtils, objForEachKey } from "@microsoft/applicationinsights-core-js";
|
||||||
|
|
||||||
// ToDo: fix properties and measurements once updates are done to common
|
// ToDo: fix properties and measurements once updates are done to common
|
||||||
export class AppInsightsDeprecated implements IAppInsightsDeprecated {
|
export class AppInsightsDeprecated implements IAppInsightsDeprecated {
|
||||||
|
@ -170,11 +170,11 @@ export class AppInsightsDeprecated implements IAppInsightsDeprecated {
|
||||||
public updateSnippetDefinitions(snippet: Snippet) {
|
public updateSnippetDefinitions(snippet: Snippet) {
|
||||||
// apply full appInsights to the global instance
|
// apply full appInsights to the global instance
|
||||||
// Note: This must be called before loadAppInsights is called
|
// Note: This must be called before loadAppInsights is called
|
||||||
for (const field in this) {
|
objForEachKey(this, (field, value) => {
|
||||||
if (typeof field === 'string') {
|
if (CoreUtils.isString(field)) {
|
||||||
snippet[field as string] = this[field];
|
snippet[field as string] = value;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// note: these are split into methods to enable unit tests
|
// note: these are split into methods to enable unit tests
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CoreUtils, IConfiguration, AppInsightsCore, IAppInsightsCore, LoggingSeverity, _InternalMessageId, ITelemetryItem, ICustomProperties,
|
CoreUtils, IConfiguration, AppInsightsCore, IAppInsightsCore, LoggingSeverity, _InternalMessageId, ITelemetryItem, ICustomProperties,
|
||||||
IChannelControls, hasWindow, hasDocument, isReactNative, doPerf, IDiagnosticLogger, INotificationManager
|
IChannelControls, hasWindow, hasDocument, isReactNative, doPerf, IDiagnosticLogger, INotificationManager, objForEachKey
|
||||||
} from "@microsoft/applicationinsights-core-js";
|
} from "@microsoft/applicationinsights-core-js";
|
||||||
import { ApplicationInsights } from "@microsoft/applicationinsights-analytics-js";
|
import { ApplicationInsights } from "@microsoft/applicationinsights-analytics-js";
|
||||||
import { Sender } from "@microsoft/applicationinsights-channel-js";
|
import { Sender } from "@microsoft/applicationinsights-channel-js";
|
||||||
|
@ -292,13 +292,13 @@ export class Initialization implements IApplicationInsights {
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply updated properties to the global instance (snippet)
|
// apply updated properties to the global instance (snippet)
|
||||||
for (const field in _self) {
|
objForEachKey(_self, (field, value) => {
|
||||||
if (CoreUtils.isString(field) &&
|
if (CoreUtils.isString(field) &&
|
||||||
!CoreUtils.isFunction(_self[field]) &&
|
!CoreUtils.isFunction(value) &&
|
||||||
field.substring(0, 1) !== "_") { // Don't copy "internal" values
|
field.substring(0, 1) !== "_") { // Don't copy "internal" values
|
||||||
snippet[field as string] = _self[field];
|
snippet[field as string] = value;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,11 +342,11 @@ export class Initialization implements IApplicationInsights {
|
||||||
public updateSnippetDefinitions(snippet: Snippet) {
|
public updateSnippetDefinitions(snippet: Snippet) {
|
||||||
// apply full appInsights to the global instance
|
// apply full appInsights to the global instance
|
||||||
// Note: This must be called before loadAppInsights is called
|
// Note: This must be called before loadAppInsights is called
|
||||||
for (const field in this) {
|
objForEachKey(this, (field, value) => {
|
||||||
if (CoreUtils.isString(field)) {
|
if (CoreUtils.isString(field)) {
|
||||||
snippet[field as string] = this[field];
|
snippet[field as string] = value;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
import {
|
import {
|
||||||
ITelemetryItem, CoreUtils,
|
ITelemetryItem, CoreUtils,
|
||||||
IDiagnosticLogger, LoggingSeverity, _InternalMessageId,
|
IDiagnosticLogger, LoggingSeverity, _InternalMessageId,
|
||||||
hasJSON, getJSON
|
hasJSON, getJSON, objForEachKey
|
||||||
} from '@microsoft/applicationinsights-core-js';
|
} from '@microsoft/applicationinsights-core-js';
|
||||||
|
|
||||||
// these two constants are used to filter out properties not needed when trying to extract custom properties and measurements from the incoming payload
|
// these two constants are used to filter out properties not needed when trying to extract custom properties and measurements from the incoming payload
|
||||||
|
@ -19,7 +19,6 @@ const strBaseData = 'baseData';
|
||||||
const strProperties = 'properties';
|
const strProperties = 'properties';
|
||||||
const strTrue = 'true';
|
const strTrue = 'true';
|
||||||
const arrForEach = CoreUtils.arrForEach;
|
const arrForEach = CoreUtils.arrForEach;
|
||||||
const objKeys = CoreUtils.objKeys;
|
|
||||||
const isNullOrUndefined = CoreUtils.isNullOrUndefined;
|
const isNullOrUndefined = CoreUtils.isNullOrUndefined;
|
||||||
|
|
||||||
function _setValueIf<T>(target:T, field:keyof T, value:any) {
|
function _setValueIf<T>(target:T, field:keyof T, value:any) {
|
||||||
|
@ -36,8 +35,7 @@ export abstract class EnvelopeCreator {
|
||||||
|
|
||||||
protected static extractPropsAndMeasurements(data: { [key: string]: any }, properties: { [key: string]: any }, measurements: { [key: string]: any }) {
|
protected static extractPropsAndMeasurements(data: { [key: string]: any }, properties: { [key: string]: any }, measurements: { [key: string]: any }) {
|
||||||
if (!isNullOrUndefined(data)) {
|
if (!isNullOrUndefined(data)) {
|
||||||
arrForEach(objKeys(data), (key) => {
|
objForEachKey(data, (key, value) => {
|
||||||
const value = data[key];
|
|
||||||
if (CoreUtils.isNumber(value)) {
|
if (CoreUtils.isNumber(value)) {
|
||||||
measurements[key] = value;
|
measurements[key] = value;
|
||||||
} else if (CoreUtils.isString(value)) {
|
} else if (CoreUtils.isString(value)) {
|
||||||
|
@ -149,17 +147,16 @@ export abstract class EnvelopeCreator {
|
||||||
// deals with tags.push({object})
|
// deals with tags.push({object})
|
||||||
for(let i = itmTags.length - 1; i >= 0; i--){
|
for(let i = itmTags.length - 1; i >= 0; i--){
|
||||||
const tg = itmTags[i];
|
const tg = itmTags[i];
|
||||||
// CoreUtils.objKeys returns an array of keys
|
objForEachKey(tg, (key, value) => {
|
||||||
arrForEach(objKeys(tg), key => {
|
tgs[key] = value;
|
||||||
tgs[key] = tg[key];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
itmTags.splice(i, 1);
|
itmTags.splice(i, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// deals with tags[key]=value (and handles hasOwnProperty)
|
// deals with tags[key]=value (and handles hasOwnProperty)
|
||||||
arrForEach(objKeys(itmTags), (tg) => {
|
objForEachKey(itmTags, (tg, value) => {
|
||||||
tgs[tg] = itmTags[tg];
|
tgs[tg] = value;
|
||||||
});
|
});
|
||||||
|
|
||||||
env.tags = { ...envTags, ...tgs };
|
env.tags = { ...envTags, ...tgs };
|
||||||
|
@ -321,8 +318,8 @@ export class PageViewEnvelopeCreator extends EnvelopeCreator {
|
||||||
// pageTags is a field that Breeze still does not recognize as part of Part B. For now, put it in Part C until it supports it as a domain property
|
// pageTags is a field that Breeze still does not recognize as part of Part B. For now, put it in Part C until it supports it as a domain property
|
||||||
if (!isNullOrUndefined(bd[strProperties])) {
|
if (!isNullOrUndefined(bd[strProperties])) {
|
||||||
const pageTags = bd[strProperties];
|
const pageTags = bd[strProperties];
|
||||||
arrForEach(objKeys(pageTags), (key) => {
|
objForEachKey(pageTags, (key, value) => {
|
||||||
properties[key] = pageTags[key];
|
properties[key] = value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import {
|
||||||
ITelemetryItem, IProcessTelemetryContext, IConfiguration, CoreUtils,
|
ITelemetryItem, IProcessTelemetryContext, IConfiguration, CoreUtils,
|
||||||
_InternalMessageId, LoggingSeverity, IDiagnosticLogger, IAppInsightsCore, IPlugin,
|
_InternalMessageId, LoggingSeverity, IDiagnosticLogger, IAppInsightsCore, IPlugin,
|
||||||
getWindow, getNavigator, getJSON, BaseTelemetryPlugin, ITelemetryPluginChain, INotificationManager,
|
getWindow, getNavigator, getJSON, BaseTelemetryPlugin, ITelemetryPluginChain, INotificationManager,
|
||||||
SendRequestReason, getGlobalInst
|
SendRequestReason, getGlobalInst, objForEachKey
|
||||||
} from '@microsoft/applicationinsights-core-js';
|
} from '@microsoft/applicationinsights-core-js';
|
||||||
import { Offline } from './Offline';
|
import { Offline } from './Offline';
|
||||||
import { Sample } from './TelemetryProcessors/Sample'
|
import { Sample } from './TelemetryProcessors/Sample'
|
||||||
|
@ -216,9 +216,9 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
|
||||||
_self._sender = null;
|
_self._sender = null;
|
||||||
const defaultConfig = Sender._getDefaultAppInsightsChannelConfig();
|
const defaultConfig = Sender._getDefaultAppInsightsChannelConfig();
|
||||||
_self._senderConfig = Sender._getEmptyAppInsightsChannelConfig();
|
_self._senderConfig = Sender._getEmptyAppInsightsChannelConfig();
|
||||||
for (const field in defaultConfig) {
|
objForEachKey(defaultConfig, (field, value) => {
|
||||||
_self._senderConfig[field] = () => ctx.getConfig(identifier, field, defaultConfig[field]());
|
_self._senderConfig[field] = () => ctx.getConfig(identifier, field, value());
|
||||||
}
|
});
|
||||||
|
|
||||||
_self._buffer = (_self._senderConfig.enableSessionStorageBuffer() && Util.canUseSessionStorage())
|
_self._buffer = (_self._senderConfig.enableSessionStorageBuffer() && Util.canUseSessionStorage())
|
||||||
? new SessionStorageSendBuffer(_self.diagLog(), _self._senderConfig) : new ArraySendBuffer(_self._senderConfig);
|
? new SessionStorageSendBuffer(_self.diagLog(), _self._senderConfig) : new ArraySendBuffer(_self._senderConfig);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Util, ISerializable, FieldType } from '@microsoft/applicationinsights-common';
|
import { Util, ISerializable, FieldType } from '@microsoft/applicationinsights-common';
|
||||||
import { IDiagnosticLogger, LoggingSeverity, _InternalMessageId, CoreUtils, getJSON } from '@microsoft/applicationinsights-core-js';
|
import { IDiagnosticLogger, LoggingSeverity, _InternalMessageId, CoreUtils, getJSON, objForEachKey } from '@microsoft/applicationinsights-core-js';
|
||||||
import dynamicProto from '@microsoft/dynamicproto-js'
|
import dynamicProto from '@microsoft/dynamicproto-js'
|
||||||
|
|
||||||
export class Serializer {
|
export class Serializer {
|
||||||
|
@ -60,9 +60,7 @@ export class Serializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
source[circularReferenceCheck] = true;
|
source[circularReferenceCheck] = true;
|
||||||
for (const field in source.aiDataContract) {
|
objForEachKey(source.aiDataContract, (field, contract) => {
|
||||||
|
|
||||||
const contract = source.aiDataContract[field];
|
|
||||||
const isRequired = (CoreUtils.isFunction(contract)) ? (contract() & FieldType.Required) : (contract & FieldType.Required);
|
const isRequired = (CoreUtils.isFunction(contract)) ? (contract() & FieldType.Required) : (contract & FieldType.Required);
|
||||||
const isHidden = (CoreUtils.isFunction(contract)) ? (contract() & FieldType.Hidden) : (contract & FieldType.Hidden);
|
const isHidden = (CoreUtils.isFunction(contract)) ? (contract() & FieldType.Hidden) : (contract & FieldType.Hidden);
|
||||||
const isArray = contract & FieldType.Array;
|
const isArray = contract & FieldType.Array;
|
||||||
|
@ -78,33 +76,27 @@ export class Serializer {
|
||||||
{ field, name });
|
{ field, name });
|
||||||
|
|
||||||
// If not in debug mode, continue and hope the error is permissible
|
// If not in debug mode, continue and hope the error is permissible
|
||||||
continue;
|
} else if (!isHidden) { // Don't serialize hidden fields
|
||||||
}
|
let value;
|
||||||
|
if (isObject) {
|
||||||
if (isHidden) {
|
if (isArray) {
|
||||||
// Don't serialize hidden fields
|
// special case; recurse on each object in the source array
|
||||||
continue;
|
value = _serializeArray(source[field], field);
|
||||||
}
|
} else {
|
||||||
|
// recurse on the source object in this field
|
||||||
let value;
|
value = _serializeObject(source[field], field);
|
||||||
if (isObject) {
|
}
|
||||||
if (isArray) {
|
|
||||||
// special case; recurse on each object in the source array
|
|
||||||
value = _serializeArray(source[field], field);
|
|
||||||
} else {
|
} else {
|
||||||
// recurse on the source object in this field
|
// assign the source field to the output even if undefined or required
|
||||||
value = _serializeObject(source[field], field);
|
value = source[field];
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// assign the source field to the output even if undefined or required
|
|
||||||
value = source[field];
|
|
||||||
}
|
|
||||||
|
|
||||||
// only emit this field if the value is defined
|
// only emit this field if the value is defined
|
||||||
if (value !== undefined) {
|
if (value !== undefined) {
|
||||||
output[field] = value;
|
output[field] = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
delete source[circularReferenceCheck];
|
delete source[circularReferenceCheck];
|
||||||
return output;
|
return output;
|
||||||
|
@ -134,11 +126,10 @@ export class Serializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _serializeStringMap(map: any, expectedType: string, name: string) {
|
function _serializeStringMap(map: any, expectedType: string, name: string) {
|
||||||
let output;
|
let output: any;
|
||||||
if (map) {
|
if (map) {
|
||||||
output = {};
|
output = {};
|
||||||
for (const field in map) {
|
objForEachKey(map, (field, value) => {
|
||||||
const value = map[field];
|
|
||||||
if (expectedType === "string") {
|
if (expectedType === "string") {
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
output[field] = "undefined";
|
output[field] = "undefined";
|
||||||
|
@ -170,7 +161,7 @@ export class Serializer {
|
||||||
output[field] = "invalid field: " + name + " is of unknown type.";
|
output[field] = "invalid field: " + name + " is of unknown type.";
|
||||||
logger.throwInternal(LoggingSeverity.CRITICAL, output[field], null, true);
|
logger.throwInternal(LoggingSeverity.CRITICAL, output[field], null, true);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
|
|
|
@ -150,14 +150,14 @@
|
||||||
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz"
|
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz"
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "14.11.10",
|
"version": "14.14.6",
|
||||||
"from": "@types/node@*",
|
"from": "@types/node@*",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.11.10.tgz"
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.6.tgz"
|
||||||
},
|
},
|
||||||
"@types/qunit": {
|
"@types/qunit": {
|
||||||
"version": "2.9.5",
|
"version": "2.9.6",
|
||||||
"from": "@types/qunit@^2.5.3",
|
"from": "@types/qunit@^2.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/qunit/-/qunit-2.9.5.tgz"
|
"resolved": "https://registry.npmjs.org/@types/qunit/-/qunit-2.9.6.tgz"
|
||||||
},
|
},
|
||||||
"@types/sinon": {
|
"@types/sinon": {
|
||||||
"version": "4.3.3",
|
"version": "4.3.3",
|
||||||
|
@ -338,9 +338,9 @@
|
||||||
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz"
|
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz"
|
||||||
},
|
},
|
||||||
"aws4": {
|
"aws4": {
|
||||||
"version": "1.10.1",
|
"version": "1.11.0",
|
||||||
"from": "aws4@^1.8.0",
|
"from": "aws4@^1.8.0",
|
||||||
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.1.tgz"
|
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz"
|
||||||
},
|
},
|
||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
@ -885,9 +885,9 @@
|
||||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz"
|
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz"
|
||||||
},
|
},
|
||||||
"fastq": {
|
"fastq": {
|
||||||
"version": "1.8.0",
|
"version": "1.9.0",
|
||||||
"from": "fastq@^1.6.0",
|
"from": "fastq@^1.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.8.0.tgz"
|
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.9.0.tgz"
|
||||||
},
|
},
|
||||||
"fd-slicer": {
|
"fd-slicer": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
|
@ -973,6 +973,11 @@
|
||||||
"from": "fs.realpath@>=1.0.0 <2.0.0",
|
"from": "fs.realpath@>=1.0.0 <2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
|
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
|
||||||
},
|
},
|
||||||
|
"function-bind": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"from": "function-bind@>=1.1.1 <2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"
|
||||||
|
},
|
||||||
"get-stdin": {
|
"get-stdin": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"from": "get-stdin@>=4.0.1 <5.0.0",
|
"from": "get-stdin@>=4.0.1 <5.0.0",
|
||||||
|
@ -1145,6 +1150,11 @@
|
||||||
"from": "har-validator@~5.1.3",
|
"from": "har-validator@~5.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz"
|
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz"
|
||||||
},
|
},
|
||||||
|
"has": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"from": "has@>=1.0.3 <2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz"
|
||||||
|
},
|
||||||
"has-ansi": {
|
"has-ansi": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"from": "has-ansi@>=2.0.0 <3.0.0",
|
"from": "has-ansi@>=2.0.0 <3.0.0",
|
||||||
|
@ -1273,6 +1283,11 @@
|
||||||
"from": "is-buffer@>=1.1.5 <2.0.0",
|
"from": "is-buffer@>=1.1.5 <2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz"
|
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz"
|
||||||
},
|
},
|
||||||
|
"is-core-module": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"from": "is-core-module@^2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.0.0.tgz"
|
||||||
|
},
|
||||||
"is-data-descriptor": {
|
"is-data-descriptor": {
|
||||||
"version": "0.1.4",
|
"version": "0.1.4",
|
||||||
"from": "is-data-descriptor@>=0.1.4 <0.2.0",
|
"from": "is-data-descriptor@>=0.1.4 <0.2.0",
|
||||||
|
@ -1967,9 +1982,9 @@
|
||||||
"resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz"
|
"resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz"
|
||||||
},
|
},
|
||||||
"resolve": {
|
"resolve": {
|
||||||
"version": "1.17.0",
|
"version": "1.18.1",
|
||||||
"from": "resolve@^1.10.0",
|
"from": "resolve@^1.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz"
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.18.1.tgz"
|
||||||
},
|
},
|
||||||
"resolve-url": {
|
"resolve-url": {
|
||||||
"version": "0.2.1",
|
"version": "0.2.1",
|
||||||
|
@ -2056,9 +2071,9 @@
|
||||||
"resolved": "https://registry.npmjs.org/rollup-plugin-uglify/-/rollup-plugin-uglify-6.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/rollup-plugin-uglify/-/rollup-plugin-uglify-6.0.4.tgz",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"uglify-js": {
|
"uglify-js": {
|
||||||
"version": "3.11.2",
|
"version": "3.11.5",
|
||||||
"from": "uglify-js@^3.4.9",
|
"from": "uglify-js@^3.4.9",
|
||||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.11.2.tgz"
|
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.11.5.tgz"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -2068,9 +2083,9 @@
|
||||||
"resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz"
|
"resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz"
|
||||||
},
|
},
|
||||||
"run-parallel": {
|
"run-parallel": {
|
||||||
"version": "1.1.9",
|
"version": "1.1.10",
|
||||||
"from": "run-parallel@>=1.1.9 <2.0.0",
|
"from": "run-parallel@^1.1.9",
|
||||||
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz"
|
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.10.tgz"
|
||||||
},
|
},
|
||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
"version": "5.1.2",
|
"version": "5.1.2",
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
IPlugin, IConfiguration, IAppInsightsCore,
|
IPlugin, IConfiguration, IAppInsightsCore,
|
||||||
BaseTelemetryPlugin, CoreUtils, ITelemetryItem, IProcessTelemetryContext, ITelemetryPluginChain,
|
BaseTelemetryPlugin, CoreUtils, ITelemetryItem, IProcessTelemetryContext, ITelemetryPluginChain,
|
||||||
IDiagnosticLogger, LoggingSeverity, _InternalMessageId, ICustomProperties,
|
IDiagnosticLogger, LoggingSeverity, _InternalMessageId, ICustomProperties,
|
||||||
getWindow, getDocument, getHistory, getLocation, doPerf
|
getWindow, getDocument, getHistory, getLocation, doPerf, objForEachKey
|
||||||
} from "@microsoft/applicationinsights-core-js";
|
} from "@microsoft/applicationinsights-core-js";
|
||||||
import { PageViewManager, IAppInsightsInternal } from "./Telemetry/PageViewManager";
|
import { PageViewManager, IAppInsightsInternal } from "./Telemetry/PageViewManager";
|
||||||
import { PageVisitTimeManager } from "./Telemetry/PageVisitTimeManager";
|
import { PageVisitTimeManager } from "./Telemetry/PageVisitTimeManager";
|
||||||
|
@ -487,17 +487,17 @@ export class ApplicationInsights extends BaseTelemetryPlugin implements IAppInsi
|
||||||
// load default values if specified
|
// load default values if specified
|
||||||
const defaults: IConfig = ApplicationInsights.getDefaultConfig();
|
const defaults: IConfig = ApplicationInsights.getDefaultConfig();
|
||||||
if (defaults !== undefined) {
|
if (defaults !== undefined) {
|
||||||
for (const field in defaults) {
|
objForEachKey(defaults, (field, value) => {
|
||||||
// for each unspecified field, set the default value
|
// for each unspecified field, set the default value
|
||||||
this.config[field] = ctx.getConfig(identifier, field, defaults[field]);
|
this.config[field] = ctx.getConfig(identifier, field, value);
|
||||||
}
|
});
|
||||||
|
|
||||||
if (this._globalconfig) {
|
if (this._globalconfig) {
|
||||||
for (const field in defaults) {
|
objForEachKey(defaults, (field, value) => {
|
||||||
if (this._globalconfig[field] === undefined) {
|
if (this._globalconfig[field] === undefined) {
|
||||||
this._globalconfig[field] = defaults[field];
|
this._globalconfig[field] = value;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import {
|
import {
|
||||||
BaseTelemetryPlugin, IConfiguration, CoreUtils,
|
BaseTelemetryPlugin, IConfiguration, CoreUtils,
|
||||||
IAppInsightsCore, IPlugin, ITelemetryItem, IProcessTelemetryContext, _InternalLogMessage, _InternalMessageId,
|
IAppInsightsCore, IPlugin, ITelemetryItem, IProcessTelemetryContext, _InternalLogMessage, _InternalMessageId,
|
||||||
ITelemetryPluginChain, InstrumentFunc, IInstrumentCallDetails, InstrumentorHooksCallback, IPerfEvent, IChannelControls
|
ITelemetryPluginChain, InstrumentFunc, IInstrumentCallDetails, InstrumentorHooksCallback, IPerfEvent, IChannelControls, objForEachKey
|
||||||
} from '@microsoft/applicationinsights-core-js';
|
} from '@microsoft/applicationinsights-core-js';
|
||||||
import { Dashboard } from './components/Dashboard';
|
import { Dashboard } from './components/Dashboard';
|
||||||
import { getTargetName } from './components/helpers';
|
import { getTargetName } from './components/helpers';
|
||||||
|
@ -123,8 +123,8 @@ export default class DebugPlugin extends BaseTelemetryPlugin {
|
||||||
const defaultConfig = getDefaultConfig();
|
const defaultConfig = getDefaultConfig();
|
||||||
const ctx = _self._getTelCtx();
|
const ctx = _self._getTelCtx();
|
||||||
const identifier = _self.identifier;
|
const identifier = _self.identifier;
|
||||||
_arrForEach(CoreUtils.objKeys(defaultConfig), (field) => {
|
objForEachKey(defaultConfig, (field, value) => {
|
||||||
_theConfig[field] = () => ctx.getConfig(identifier, field, defaultConfig[field]());
|
_theConfig[field] = () => ctx.getConfig(identifier, field, value());
|
||||||
});
|
});
|
||||||
|
|
||||||
let foundTrackers: string[] = [];
|
let foundTrackers: string[] = [];
|
||||||
|
@ -177,7 +177,7 @@ export default class DebugPlugin extends BaseTelemetryPlugin {
|
||||||
|
|
||||||
// 2. Get all of the extensions and channels
|
// 2. Get all of the extensions and channels
|
||||||
debugBins = {};
|
debugBins = {};
|
||||||
let targetObjects: any = [core, _self.diagLog()];
|
let targetObjects: any[] = [core, _self.diagLog()];
|
||||||
|
|
||||||
// Get all of the config extensions
|
// Get all of the config extensions
|
||||||
if (config.extensions) {
|
if (config.extensions) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
CoreUtils, LoggingSeverity, _InternalMessageId,
|
CoreUtils, LoggingSeverity, _InternalMessageId,
|
||||||
IAppInsightsCore, BaseTelemetryPlugin, ITelemetryPluginChain, IConfiguration, IPlugin, ITelemetryItem, IProcessTelemetryContext,
|
IAppInsightsCore, BaseTelemetryPlugin, ITelemetryPluginChain, IConfiguration, IPlugin, ITelemetryItem, IProcessTelemetryContext,
|
||||||
getLocation, getGlobal, strUndefined, strPrototype, IInstrumentCallDetails, InstrumentFunc, InstrumentProto, getPerformance,
|
getLocation, getGlobal, strUndefined, strPrototype, IInstrumentCallDetails, InstrumentFunc, InstrumentProto, getPerformance,
|
||||||
IInstrumentHooksCallbacks, IInstrumentHook
|
IInstrumentHooksCallbacks, IInstrumentHook, objForEachKey
|
||||||
} from '@microsoft/applicationinsights-core-js';
|
} from '@microsoft/applicationinsights-core-js';
|
||||||
import { ajaxRecord, IAjaxRecordResponse } from './ajaxRecord';
|
import { ajaxRecord, IAjaxRecordResponse } from './ajaxRecord';
|
||||||
import { EventHelper } from './ajaxUtils';
|
import { EventHelper } from './ajaxUtils';
|
||||||
|
@ -25,7 +25,6 @@ const strFetch = "fetch";
|
||||||
|
|
||||||
let _isNullOrUndefined = CoreUtils.isNullOrUndefined;
|
let _isNullOrUndefined = CoreUtils.isNullOrUndefined;
|
||||||
let _arrForEach = CoreUtils.arrForEach;
|
let _arrForEach = CoreUtils.arrForEach;
|
||||||
let _objKeys = CoreUtils.objKeys;
|
|
||||||
|
|
||||||
// Using a global value so that to handle same iKey with multiple app insights instances (mostly for testing)
|
// Using a global value so that to handle same iKey with multiple app insights instances (mostly for testing)
|
||||||
let _markCount: number = 0;
|
let _markCount: number = 0;
|
||||||
|
@ -181,7 +180,7 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
|
||||||
|
|
||||||
public static getEmptyConfig(): ICorrelationConfig {
|
public static getEmptyConfig(): ICorrelationConfig {
|
||||||
let emptyConfig = this.getDefaultConfig();
|
let emptyConfig = this.getDefaultConfig();
|
||||||
_arrForEach(_objKeys(emptyConfig), (value) => {
|
objForEachKey(emptyConfig, (value) => {
|
||||||
emptyConfig[value] = undefined;
|
emptyConfig[value] = undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -218,8 +217,8 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu
|
||||||
base.initialize(config, core, extensions, pluginChain);
|
base.initialize(config, core, extensions, pluginChain);
|
||||||
let ctx = _self._getTelCtx();
|
let ctx = _self._getTelCtx();
|
||||||
const defaultConfig = AjaxMonitor.getDefaultConfig();
|
const defaultConfig = AjaxMonitor.getDefaultConfig();
|
||||||
_arrForEach(_objKeys(defaultConfig), (field) => {
|
objForEachKey(defaultConfig, (field, value) => {
|
||||||
_config[field] = ctx.getConfig(AjaxMonitor.identifier, field, defaultConfig[field]);
|
_config[field] = ctx.getConfig(AjaxMonitor.identifier, field, value);
|
||||||
});
|
});
|
||||||
|
|
||||||
let distributedTracingMode = _config.distributedTracingMode;
|
let distributedTracingMode = _config.distributedTracingMode;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
import { DataSanitizer, UrlHelper, DateTimeUtils, IDependencyTelemetry, Util } from '@microsoft/applicationinsights-common';
|
import { DataSanitizer, UrlHelper, DateTimeUtils, IDependencyTelemetry, Util } from '@microsoft/applicationinsights-common';
|
||||||
import { IDiagnosticLogger, CoreUtils, normalizeJsName } from '@microsoft/applicationinsights-core-js';
|
import { IDiagnosticLogger, CoreUtils, normalizeJsName, objForEachKey } from '@microsoft/applicationinsights-core-js';
|
||||||
import dynamicProto from "@microsoft/dynamicproto-js";
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
||||||
|
|
||||||
export interface IAjaxRecordResponse {
|
export interface IAjaxRecordResponse {
|
||||||
|
@ -144,8 +144,7 @@ function _populatePerfData(ajaxData:ajaxRecord, dependency:IDependencyTelemetry)
|
||||||
_arrForEach(serverTiming, (value, idx) => {
|
_arrForEach(serverTiming, (value, idx) => {
|
||||||
let name = normalizeJsName(value[strName] || "" + idx);
|
let name = normalizeJsName(value[strName] || "" + idx);
|
||||||
let newValue = server[name] || {};
|
let newValue = server[name] || {};
|
||||||
_arrForEach(_objKeys(value), (key) => {
|
objForEachKey(value, (key, val) => {
|
||||||
let val = value[key];
|
|
||||||
if (key !== strName && _isString(val) || CoreUtils.isNumber(val)) {
|
if (key !== strName && _isString(val) || CoreUtils.isNumber(val)) {
|
||||||
if (newValue[key]) {
|
if (newValue[key]) {
|
||||||
val = newValue[key] + ";" + val;
|
val = newValue[key] + ";" + val;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
import {
|
import {
|
||||||
BaseTelemetryPlugin, IConfiguration, CoreUtils,
|
BaseTelemetryPlugin, IConfiguration, CoreUtils,
|
||||||
IAppInsightsCore, IPlugin, ITelemetryItem, IProcessTelemetryContext, _InternalLogMessage, LoggingSeverity, _InternalMessageId, getNavigator,
|
IAppInsightsCore, IPlugin, ITelemetryItem, IProcessTelemetryContext, _InternalLogMessage, LoggingSeverity, _InternalMessageId, getNavigator,
|
||||||
ITelemetryPluginChain
|
ITelemetryPluginChain, objForEachKey
|
||||||
} from '@microsoft/applicationinsights-core-js';
|
} from '@microsoft/applicationinsights-core-js';
|
||||||
import { TelemetryContext } from './TelemetryContext';
|
import { TelemetryContext } from './TelemetryContext';
|
||||||
import { PageView, ConfigurationManager,
|
import { PageView, ConfigurationManager,
|
||||||
|
@ -45,9 +45,9 @@ export default class PropertiesPlugin extends BaseTelemetryPlugin implements IPr
|
||||||
let identifier = this.identifier;
|
let identifier = this.identifier;
|
||||||
const defaultConfig: ITelemetryConfig = PropertiesPlugin.getDefaultConfig();
|
const defaultConfig: ITelemetryConfig = PropertiesPlugin.getDefaultConfig();
|
||||||
this._extensionConfig = this._extensionConfig || PropertiesPlugin.getDefaultConfig();
|
this._extensionConfig = this._extensionConfig || PropertiesPlugin.getDefaultConfig();
|
||||||
for (const field in defaultConfig) {
|
objForEachKey(defaultConfig, (field, value) => {
|
||||||
this._extensionConfig[field] = () => ctx.getConfig(identifier, field, defaultConfig[field]());
|
this._extensionConfig[field] = () => ctx.getConfig(identifier, field, value());
|
||||||
}
|
});
|
||||||
|
|
||||||
this.context = new TelemetryContext(core.logger, this._extensionConfig);
|
this.context = new TelemetryContext(core.logger, this._extensionConfig);
|
||||||
this._breezeChannel = Util.getExtension(extensions, BreezeChannelIdentifier);
|
this._breezeChannel = Util.getExtension(extensions, BreezeChannelIdentifier);
|
||||||
|
|
|
@ -12,7 +12,8 @@ import {
|
||||||
LoggingSeverity,
|
LoggingSeverity,
|
||||||
_InternalMessageId,
|
_InternalMessageId,
|
||||||
BaseTelemetryPlugin,
|
BaseTelemetryPlugin,
|
||||||
IProcessTelemetryContext
|
IProcessTelemetryContext,
|
||||||
|
objForEachKey
|
||||||
} from '@microsoft/applicationinsights-core-js';
|
} from '@microsoft/applicationinsights-core-js';
|
||||||
import { ConfigurationManager, IDevice, IExceptionTelemetry, IAppInsights, SeverityLevel, AnalyticsPluginIdentifier } from '@microsoft/applicationinsights-common';
|
import { ConfigurationManager, IDevice, IExceptionTelemetry, IAppInsights, SeverityLevel, AnalyticsPluginIdentifier } from '@microsoft/applicationinsights-common';
|
||||||
import DeviceInfo from 'react-native-device-info';
|
import DeviceInfo from 'react-native-device-info';
|
||||||
|
@ -45,14 +46,14 @@ export class ReactNativePlugin extends BaseTelemetryPlugin {
|
||||||
|
|
||||||
const inConfig = config || {};
|
const inConfig = config || {};
|
||||||
const defaultConfig = _getDefaultConfig();
|
const defaultConfig = _getDefaultConfig();
|
||||||
for (const option in defaultConfig) {
|
objForEachKey(defaultConfig, (option, value) => {
|
||||||
_config[option] = ConfigurationManager.getConfig(
|
_config[option] = ConfigurationManager.getConfig(
|
||||||
inConfig as any,
|
inConfig as any,
|
||||||
option,
|
option,
|
||||||
_self.identifier,
|
_self.identifier,
|
||||||
_config[option]
|
value
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
|
|
||||||
if (!_config.disableDeviceCollection) {
|
if (!_config.disableDeviceCollection) {
|
||||||
_collectDeviceInfo();
|
_collectDeviceInfo();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
import { IDiagnosticLogger, LoggingSeverity, _InternalMessageId, CoreUtils, hasJSON, getJSON } from '@microsoft/applicationinsights-core-js';
|
import { IDiagnosticLogger, LoggingSeverity, _InternalMessageId, CoreUtils, hasJSON, getJSON, objForEachKey } from '@microsoft/applicationinsights-core-js';
|
||||||
|
|
||||||
export class DataSanitizer {
|
export class DataSanitizer {
|
||||||
|
|
||||||
|
@ -132,8 +132,7 @@ export class DataSanitizer {
|
||||||
public static sanitizeProperties(logger: IDiagnosticLogger, properties: any) {
|
public static sanitizeProperties(logger: IDiagnosticLogger, properties: any) {
|
||||||
if (properties) {
|
if (properties) {
|
||||||
const tempProps = {};
|
const tempProps = {};
|
||||||
for (let prop in properties) {
|
objForEachKey(properties, (prop, value) => {
|
||||||
let value = properties[prop];
|
|
||||||
if (CoreUtils.isObject(value) && hasJSON()) {
|
if (CoreUtils.isObject(value) && hasJSON()) {
|
||||||
// Stringify any part C properties
|
// Stringify any part C properties
|
||||||
try {
|
try {
|
||||||
|
@ -145,7 +144,7 @@ export class DataSanitizer {
|
||||||
value = DataSanitizer.sanitizeString(logger, value, DataSanitizer.MAX_PROPERTY_LENGTH);
|
value = DataSanitizer.sanitizeString(logger, value, DataSanitizer.MAX_PROPERTY_LENGTH);
|
||||||
prop = DataSanitizer.sanitizeKeyAndAddUniqueness(logger, prop, tempProps);
|
prop = DataSanitizer.sanitizeKeyAndAddUniqueness(logger, prop, tempProps);
|
||||||
tempProps[prop] = value;
|
tempProps[prop] = value;
|
||||||
}
|
});
|
||||||
properties = tempProps;
|
properties = tempProps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,11 +154,11 @@ export class DataSanitizer {
|
||||||
public static sanitizeMeasurements(logger: IDiagnosticLogger, measurements: any) {
|
public static sanitizeMeasurements(logger: IDiagnosticLogger, measurements: any) {
|
||||||
if (measurements) {
|
if (measurements) {
|
||||||
const tempMeasurements = {};
|
const tempMeasurements = {};
|
||||||
for (let measure in measurements) {
|
objForEachKey(measurements, (measure, value) => {
|
||||||
const value = measurements[measure];
|
|
||||||
measure = DataSanitizer.sanitizeKeyAndAddUniqueness(logger, measure, tempMeasurements);
|
measure = DataSanitizer.sanitizeKeyAndAddUniqueness(logger, measure, tempMeasurements);
|
||||||
tempMeasurements[measure] = value;
|
tempMeasurements[measure] = value;
|
||||||
}
|
});
|
||||||
|
|
||||||
measurements = tempMeasurements;
|
measurements = tempMeasurements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
import { Util } from "./Util";
|
import { Util } from "./Util";
|
||||||
import { DataSanitizer } from "./Telemetry/Common/DataSanitizer";
|
import { DataSanitizer } from "./Telemetry/Common/DataSanitizer";
|
||||||
import { ITelemetryItem, CoreUtils, IDiagnosticLogger } from "@microsoft/applicationinsights-core-js";
|
import { ITelemetryItem, CoreUtils, IDiagnosticLogger, objForEachKey } from "@microsoft/applicationinsights-core-js";
|
||||||
|
|
||||||
export class TelemetryItemCreator {
|
export class TelemetryItemCreator {
|
||||||
|
|
||||||
|
@ -46,11 +46,9 @@ export class TelemetryItemCreator {
|
||||||
|
|
||||||
// Part C
|
// Part C
|
||||||
if (!CoreUtils.isNullOrUndefined(customProperties)) {
|
if (!CoreUtils.isNullOrUndefined(customProperties)) {
|
||||||
for (const prop in customProperties) {
|
objForEachKey(customProperties, (prop, value) => {
|
||||||
if (customProperties.hasOwnProperty(prop)) {
|
telemetryItem.data[prop] = value;
|
||||||
telemetryItem.data[prop] = customProperties[prop];
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return telemetryItem;
|
return telemetryItem;
|
||||||
|
|
|
@ -5,7 +5,8 @@ import { StorageType } from "./Enums";
|
||||||
import {
|
import {
|
||||||
CoreUtils, EventHelper, _InternalMessageId, LoggingSeverity, IDiagnosticLogger, IPlugin, getCrypto, getMsCrypto,
|
CoreUtils, EventHelper, _InternalMessageId, LoggingSeverity, IDiagnosticLogger, IPlugin, getCrypto, getMsCrypto,
|
||||||
getGlobal, getGlobalInst, getWindow, getDocument, getNavigator, getPerformance, getLocation, hasJSON, getJSON,
|
getGlobal, getGlobalInst, getWindow, getDocument, getNavigator, getPerformance, getLocation, hasJSON, getJSON,
|
||||||
strPrototype
|
strPrototype,
|
||||||
|
objForEachKey
|
||||||
} from "@microsoft/applicationinsights-core-js";
|
} from "@microsoft/applicationinsights-core-js";
|
||||||
import { RequestHeaders } from "./RequestResponseHeaders";
|
import { RequestHeaders } from "./RequestResponseHeaders";
|
||||||
import { DataSanitizer } from "./Telemetry/Common/DataSanitizer";
|
import { DataSanitizer } from "./Telemetry/Common/DataSanitizer";
|
||||||
|
@ -227,13 +228,14 @@ export class Util {
|
||||||
* @returns {string[]} List of session storage keys
|
* @returns {string[]} List of session storage keys
|
||||||
*/
|
*/
|
||||||
public static getSessionStorageKeys(): string[] {
|
public static getSessionStorageKeys(): string[] {
|
||||||
const keys = [];
|
const keys: string[] = [];
|
||||||
|
|
||||||
if (Util.canUseSessionStorage()) {
|
if (Util.canUseSessionStorage()) {
|
||||||
for (const key in getGlobalInst<any>("sessionStorage")) {
|
objForEachKey(getGlobalInst<any>("sessionStorage"), (key) => {
|
||||||
keys.push(key);
|
keys.push(key);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,11 @@ var _mwcZ = 987654321;
|
||||||
|
|
||||||
// Takes any integer
|
// Takes any integer
|
||||||
function _mwcSeed(seedValue: number) {
|
function _mwcSeed(seedValue: number) {
|
||||||
|
if (seedValue < 0) {
|
||||||
|
// Make sure we end up with a positive number and not -ve one.
|
||||||
|
seedValue >>>= 0;
|
||||||
|
}
|
||||||
|
|
||||||
_mwcW = (123456789 + seedValue) & MaxUInt32;
|
_mwcW = (123456789 + seedValue) & MaxUInt32;
|
||||||
_mwcZ = (987654321 - seedValue) & MaxUInt32;
|
_mwcZ = (987654321 - seedValue) & MaxUInt32;
|
||||||
_mwcSeeded = true;
|
_mwcSeeded = true;
|
||||||
|
@ -125,6 +130,22 @@ export function normalizeJsName(name: string): string {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a helper function for the equivalent of arForEach(objKeys(target), callbackFn), this is a
|
||||||
|
* performance optimization to avoid the creation of a new array for large objects
|
||||||
|
* @param target The target object to find and process the keys
|
||||||
|
* @param callbackfn The function to call with the details
|
||||||
|
*/
|
||||||
|
export function objForEachKey(target: any, callbackfn: (name: string, value: any) => void) {
|
||||||
|
if (target && _isObject(target)) {
|
||||||
|
for (let prop in target) {
|
||||||
|
if (_hasOwnProperty(target, prop)) {
|
||||||
|
callbackfn.call(target, prop, target[prop]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class CoreUtils {
|
export class CoreUtils {
|
||||||
public static _canUseCookies: boolean;
|
public static _canUseCookies: boolean;
|
||||||
|
|
||||||
|
@ -668,4 +689,4 @@ export class EventHelper {
|
||||||
* @return {boolean} - true if the handler was successfully added
|
* @return {boolean} - true if the handler was successfully added
|
||||||
*/
|
*/
|
||||||
public static DetachEvent: (obj: any, eventNameWithoutOn: string, handlerRef: any) => void = _detachEvent;
|
public static DetachEvent: (obj: any, eventNameWithoutOn: string, handlerRef: any) => void = _detachEvent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ export { SendRequestReason } from "./JavaScriptSDK.Enums/SendRequestReason";
|
||||||
export { AppInsightsCore } from "./JavaScriptSDK/AppInsightsCore";
|
export { AppInsightsCore } from "./JavaScriptSDK/AppInsightsCore";
|
||||||
export { BaseCore } from './JavaScriptSDK/BaseCore';
|
export { BaseCore } from './JavaScriptSDK/BaseCore';
|
||||||
export { BaseTelemetryPlugin } from './JavaScriptSDK/BaseTelemetryPlugin';
|
export { BaseTelemetryPlugin } from './JavaScriptSDK/BaseTelemetryPlugin';
|
||||||
export { CoreUtils, EventHelper, Undefined, normalizeJsName } from "./JavaScriptSDK/CoreUtils";
|
export { CoreUtils, EventHelper, Undefined, normalizeJsName, objForEachKey } from "./JavaScriptSDK/CoreUtils";
|
||||||
export {
|
export {
|
||||||
getGlobal, getGlobalInst, hasWindow, getWindow, hasDocument, getDocument, getCrypto, getMsCrypto,
|
getGlobal, getGlobalInst, hasWindow, getWindow, hasDocument, getDocument, getCrypto, getMsCrypto,
|
||||||
hasNavigator, getNavigator, hasHistory, getHistory, getLocation, getPerformance, hasJSON, getJSON,
|
hasNavigator, getNavigator, hasHistory, getHistory, getLocation, getPerformance, hasJSON, getJSON,
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
"no-string-literal": false,
|
"no-string-literal": false,
|
||||||
"no-reference": false,
|
"no-reference": false,
|
||||||
"no-empty": false,
|
"no-empty": false,
|
||||||
"forin": false,
|
"forin": true,
|
||||||
"ban-types": false,
|
"ban-types": false,
|
||||||
"no-shadowed-variable": false,
|
"no-shadowed-variable": false,
|
||||||
"no-implicit-dependencies": false,
|
"no-implicit-dependencies": false,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче