push neon reactor
This commit is contained in:
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
* 1DS JS SDK POST plugin, 4.3.11
|
||||
* Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
* (Microsoft Internal Only)
|
||||
*/
|
||||
export {};
|
||||
//# sourceMappingURL=BatchNotificationActions.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"BatchNotificationActions.js.map","sources":["BatchNotificationActions.js"],"sourcesContent":["export {};\r\n//# sourceMappingURL=BatchNotificationActions.js.map"],"names":[],"mappings":";;;;;AAAA;AACA"}
|
||||
Generated
Vendored
+92
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 1DS JS SDK POST plugin, 4.3.11
|
||||
* Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
* (Microsoft Internal Only)
|
||||
*/
|
||||
/**
|
||||
* ClockSkewManager.ts
|
||||
* @author Abhilash Panwar (abpanwar)
|
||||
* @copyright Microsoft 2018
|
||||
*/
|
||||
import dynamicProto from "@microsoft/dynamicproto-js";
|
||||
import { _DYN_ALLOW_REQUEST_SENDIN0, _DYN_GET_CLOCK_SKEW_HEADE2, _DYN_SET_CLOCK_SKEW, _DYN_SHOULD_ADD_CLOCK_SKE1 } from "./__DynamicConstants";
|
||||
/**
|
||||
* Class to manage clock skew correction.
|
||||
*/
|
||||
var ClockSkewManager = /** @class */ (function () {
|
||||
function ClockSkewManager() {
|
||||
var _allowRequestSending = true;
|
||||
var _shouldAddClockSkewHeaders = true;
|
||||
var _isFirstRequest = true;
|
||||
var _clockSkewHeaderValue = "use-collector-delta";
|
||||
var _clockSkewSet = false;
|
||||
dynamicProto(ClockSkewManager, this, function (_self) {
|
||||
/**
|
||||
* Determine if requests can be sent.
|
||||
* @returns True if requests can be sent, false otherwise.
|
||||
*/
|
||||
_self[_DYN_ALLOW_REQUEST_SENDIN0 /* @min:%2eallowRequestSending */] = function () {
|
||||
return _allowRequestSending;
|
||||
};
|
||||
/**
|
||||
* Tells the ClockSkewManager that it should assume that the first request has now been sent,
|
||||
* If this method had not yet been called AND the clock Skew had not been set this will set
|
||||
* allowRequestSending to false until setClockSet() is called.
|
||||
*/
|
||||
_self.firstRequestSent = function () {
|
||||
if (_isFirstRequest) {
|
||||
_isFirstRequest = false;
|
||||
if (!_clockSkewSet) {
|
||||
// Block sending until we get the first clock Skew
|
||||
_allowRequestSending = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Determine if clock skew headers should be added to the request.
|
||||
* @returns True if clock skew headers should be added, false otherwise.
|
||||
*/
|
||||
_self[_DYN_SHOULD_ADD_CLOCK_SKE1 /* @min:%2eshouldAddClockSkewHeaders */] = function () {
|
||||
return _shouldAddClockSkewHeaders;
|
||||
};
|
||||
/**
|
||||
* Gets the clock skew header value.
|
||||
* @returns The clock skew header value.
|
||||
*/
|
||||
_self[_DYN_GET_CLOCK_SKEW_HEADE2 /* @min:%2egetClockSkewHeaderValue */] = function () {
|
||||
return _clockSkewHeaderValue;
|
||||
};
|
||||
/**
|
||||
* Sets the clock skew header value. Once clock skew is set this method
|
||||
* is no-op.
|
||||
* @param timeDeltaInMillis - Time delta to be saved as the clock skew header value.
|
||||
*/
|
||||
_self[_DYN_SET_CLOCK_SKEW /* @min:%2esetClockSkew */] = function (timeDeltaInMillis) {
|
||||
if (!_clockSkewSet) {
|
||||
if (timeDeltaInMillis) {
|
||||
_clockSkewHeaderValue = timeDeltaInMillis;
|
||||
_shouldAddClockSkewHeaders = true;
|
||||
_clockSkewSet = true;
|
||||
}
|
||||
else {
|
||||
_shouldAddClockSkewHeaders = false;
|
||||
}
|
||||
// Unblock sending
|
||||
_allowRequestSending = true;
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
// Removed Stub for ClockSkewManager.prototype.allowRequestSending.
|
||||
// Removed Stub for ClockSkewManager.prototype.firstRequestSent.
|
||||
// Removed Stub for ClockSkewManager.prototype.shouldAddClockSkewHeaders.
|
||||
// Removed Stub for ClockSkewManager.prototype.getClockSkewHeaderValue.
|
||||
// Removed Stub for ClockSkewManager.prototype.setClockSkew.
|
||||
// This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
|
||||
// non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
|
||||
ClockSkewManager.__ieDyn=1;
|
||||
|
||||
return ClockSkewManager;
|
||||
}());
|
||||
export { ClockSkewManager };
|
||||
//# sourceMappingURL=ClockSkewManager.js.map
|
||||
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+21
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* 1DS JS SDK POST plugin, 4.3.11
|
||||
* Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
* (Microsoft Internal Only)
|
||||
*/
|
||||
/**
|
||||
* Real Time profile (default profile). RealTime Latency events are sent every 1 sec and
|
||||
* Normal Latency events are sent every 2 sec.
|
||||
*/
|
||||
export var RT_PROFILE = "REAL_TIME";
|
||||
/**
|
||||
* Near Real Time profile. RealTime Latency events are sent every 3 sec and
|
||||
* Normal Latency events are sent every 6 sec.
|
||||
*/
|
||||
export var NRT_PROFILE = "NEAR_REAL_TIME";
|
||||
/**
|
||||
* Best Effort. RealTime Latency events are sent every 9 sec and
|
||||
* Normal Latency events are sent every 18 sec.
|
||||
*/
|
||||
export var BE_PROFILE = "BEST_EFFORT";
|
||||
//# sourceMappingURL=DataModels.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DataModels.js.map","sources":["DataModels.js"],"sourcesContent":["/**\r\n * Real Time profile (default profile). RealTime Latency events are sent every 1 sec and\r\n * Normal Latency events are sent every 2 sec.\r\n */\r\nexport var RT_PROFILE = \"REAL_TIME\";\r\n/**\r\n * Near Real Time profile. RealTime Latency events are sent every 3 sec and\r\n * Normal Latency events are sent every 6 sec.\r\n */\r\nexport var NRT_PROFILE = \"NEAR_REAL_TIME\";\r\n/**\r\n * Best Effort. RealTime Latency events are sent every 9 sec and\r\n * Normal Latency events are sent every 18 sec.\r\n */\r\nexport var BE_PROFILE = \"BEST_EFFORT\";\r\n//# sourceMappingURL=DataModels.js.map"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* 1DS JS SDK POST plugin, 4.3.11
|
||||
* Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
* (Microsoft Internal Only)
|
||||
*/
|
||||
/**
|
||||
* EventBatch.ts
|
||||
* @author Nev Wylie (newylie)
|
||||
* @copyright Microsoft 2020
|
||||
*/
|
||||
import { isNullOrUndefined, isValueAssigned } from "@microsoft/1ds-core-js";
|
||||
import { STR_EMPTY, STR_MSFPC } from "./InternalConstants";
|
||||
import { _DYN_CONCAT, _DYN_COUNT, _DYN_EVENTS, _DYN_I_KEY, _DYN_LENGTH, _DYN_PUSH, _DYN_SPLIT } from "./__DynamicConstants";
|
||||
function _getEventMsfpc(theEvent) {
|
||||
var intWeb = ((theEvent.ext || {})["intweb"]);
|
||||
if (intWeb && isValueAssigned(intWeb[STR_MSFPC])) {
|
||||
return intWeb[STR_MSFPC];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function _getMsfpc(theEvents) {
|
||||
var msfpc = null;
|
||||
for (var lp = 0; msfpc === null && lp < theEvents[_DYN_LENGTH /* @min:%2elength */]; lp++) {
|
||||
msfpc = _getEventMsfpc(theEvents[lp]);
|
||||
}
|
||||
return msfpc;
|
||||
}
|
||||
/**
|
||||
* This class defines a "batch" events related to a specific iKey, it is used by the PostChannel and HttpManager
|
||||
* to collect and transfer ownership of events without duplicating them in-memory. This reduces the previous
|
||||
* array duplication and shared ownership issues that occurred due to race conditions caused by the async nature
|
||||
* of sending requests.
|
||||
*/
|
||||
var EventBatch = /** @class */ (function () {
|
||||
/**
|
||||
* Private constructor so that caller is forced to use the static create method.
|
||||
* @param iKey - The iKey to associate with the events (not validated)
|
||||
* @param addEvents - The optional collection of events to assign to this batch - defaults to an empty array.
|
||||
*/
|
||||
function EventBatch(iKey, addEvents) {
|
||||
var events = addEvents ? [][_DYN_CONCAT /* @min:%2econcat */](addEvents) : [];
|
||||
var _self = this;
|
||||
var _msfpc = _getMsfpc(events);
|
||||
_self[_DYN_I_KEY /* @min:%2eiKey */] = function () {
|
||||
return iKey;
|
||||
};
|
||||
_self.Msfpc = function () {
|
||||
// return the cached value unless it's undefined -- used to avoid cpu
|
||||
return _msfpc || STR_EMPTY;
|
||||
};
|
||||
_self[_DYN_COUNT /* @min:%2ecount */] = function () {
|
||||
return events[_DYN_LENGTH /* @min:%2elength */];
|
||||
};
|
||||
_self[_DYN_EVENTS /* @min:%2eevents */] = function () {
|
||||
return events;
|
||||
};
|
||||
_self.addEvent = function (theEvent) {
|
||||
if (theEvent) {
|
||||
events[_DYN_PUSH /* @min:%2epush */](theEvent);
|
||||
if (!_msfpc) {
|
||||
// Not found so try and find one
|
||||
_msfpc = _getEventMsfpc(theEvent);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
_self[_DYN_SPLIT /* @min:%2esplit */] = function (fromEvent, numEvents) {
|
||||
// Create a new batch with the same iKey
|
||||
var theEvents;
|
||||
if (fromEvent < events[_DYN_LENGTH /* @min:%2elength */]) {
|
||||
var cnt = events[_DYN_LENGTH /* @min:%2elength */] - fromEvent;
|
||||
if (!isNullOrUndefined(numEvents)) {
|
||||
cnt = numEvents < cnt ? numEvents : cnt;
|
||||
}
|
||||
theEvents = events.splice(fromEvent, cnt);
|
||||
// reset the fetched msfpc value
|
||||
_msfpc = _getMsfpc(events);
|
||||
}
|
||||
return new EventBatch(iKey, theEvents);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Creates a new Event Batch object
|
||||
* @param iKey - The iKey associated with this batch of events
|
||||
*/
|
||||
EventBatch.create = function (iKey, theEvents) {
|
||||
return new EventBatch(iKey, theEvents);
|
||||
};
|
||||
return EventBatch;
|
||||
}());
|
||||
export { EventBatch };
|
||||
//# sourceMappingURL=EventBatch.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"EventBatch.js.map","sources":["EventBatch.js"],"sourcesContent":["/**\r\n* EventBatch.ts\r\n* @author Nev Wylie (newylie)\r\n* @copyright Microsoft 2020\r\n*/\r\nimport { isNullOrUndefined, isValueAssigned } from \"@microsoft/1ds-core-js\";\r\nimport { STR_EMPTY, STR_MSFPC } from \"./InternalConstants\";\r\nimport { _DYN_CONCAT, _DYN_COUNT, _DYN_EVENTS, _DYN_I_KEY, _DYN_LENGTH, _DYN_PUSH, _DYN_SPLIT } from \"./__DynamicConstants\";\r\nfunction _getEventMsfpc(theEvent) {\r\n var intWeb = ((theEvent.ext || {})[\"intweb\"]);\r\n if (intWeb && isValueAssigned(intWeb[STR_MSFPC])) {\r\n return intWeb[STR_MSFPC];\r\n }\r\n return null;\r\n}\r\nfunction _getMsfpc(theEvents) {\r\n var msfpc = null;\r\n for (var lp = 0; msfpc === null && lp < theEvents[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n msfpc = _getEventMsfpc(theEvents[lp]);\r\n }\r\n return msfpc;\r\n}\r\n/**\r\n* This class defines a \"batch\" events related to a specific iKey, it is used by the PostChannel and HttpManager\r\n* to collect and transfer ownership of events without duplicating them in-memory. This reduces the previous\r\n* array duplication and shared ownership issues that occurred due to race conditions caused by the async nature\r\n* of sending requests.\r\n*/\r\nvar EventBatch = /** @class */ (function () {\r\n /**\r\n * Private constructor so that caller is forced to use the static create method.\r\n * @param iKey - The iKey to associate with the events (not validated)\r\n * @param addEvents - The optional collection of events to assign to this batch - defaults to an empty array.\r\n */\r\n function EventBatch(iKey, addEvents) {\r\n var events = addEvents ? [][_DYN_CONCAT /* @min:%2econcat */](addEvents) : [];\r\n var _self = this;\r\n var _msfpc = _getMsfpc(events);\r\n _self[_DYN_I_KEY /* @min:%2eiKey */] = function () {\r\n return iKey;\r\n };\r\n _self.Msfpc = function () {\r\n // return the cached value unless it's undefined -- used to avoid cpu\r\n return _msfpc || STR_EMPTY;\r\n };\r\n _self[_DYN_COUNT /* @min:%2ecount */] = function () {\r\n return events[_DYN_LENGTH /* @min:%2elength */];\r\n };\r\n _self[_DYN_EVENTS /* @min:%2eevents */] = function () {\r\n return events;\r\n };\r\n _self.addEvent = function (theEvent) {\r\n if (theEvent) {\r\n events[_DYN_PUSH /* @min:%2epush */](theEvent);\r\n if (!_msfpc) {\r\n // Not found so try and find one\r\n _msfpc = _getEventMsfpc(theEvent);\r\n }\r\n return true;\r\n }\r\n return false;\r\n };\r\n _self[_DYN_SPLIT /* @min:%2esplit */] = function (fromEvent, numEvents) {\r\n // Create a new batch with the same iKey\r\n var theEvents;\r\n if (fromEvent < events[_DYN_LENGTH /* @min:%2elength */]) {\r\n var cnt = events[_DYN_LENGTH /* @min:%2elength */] - fromEvent;\r\n if (!isNullOrUndefined(numEvents)) {\r\n cnt = numEvents < cnt ? numEvents : cnt;\r\n }\r\n theEvents = events.splice(fromEvent, cnt);\r\n // reset the fetched msfpc value\r\n _msfpc = _getMsfpc(events);\r\n }\r\n return new EventBatch(iKey, theEvents);\r\n };\r\n }\r\n /**\r\n * Creates a new Event Batch object\r\n * @param iKey - The iKey associated with this batch of events\r\n */\r\n EventBatch.create = function (iKey, theEvents) {\r\n return new EventBatch(iKey, theEvents);\r\n };\r\n return EventBatch;\r\n}());\r\nexport { EventBatch };\r\n//# sourceMappingURL=EventBatch.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"}
|
||||
+1126
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+15
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* 1DS JS SDK POST plugin, 4.3.11
|
||||
* Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
* (Microsoft Internal Only)
|
||||
*/
|
||||
/**
|
||||
* @name Index.ts
|
||||
* @author Abhilash Panwar (abpanwar)
|
||||
* @copyright Microsoft 2018
|
||||
* File to export public classes.
|
||||
*/
|
||||
import { BE_PROFILE, NRT_PROFILE, RT_PROFILE } from "./DataModels";
|
||||
import { PostChannel } from "./PostChannel";
|
||||
export { PostChannel, BE_PROFILE, NRT_PROFILE, RT_PROFILE };
|
||||
//# sourceMappingURL=Index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Index.js.map","sources":["Index.js"],"sourcesContent":["/**\r\n* @name Index.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n* File to export public classes.\r\n*/\r\nimport { BE_PROFILE, NRT_PROFILE, RT_PROFILE } from \"./DataModels\";\r\nimport { PostChannel } from \"./PostChannel\";\r\nexport { PostChannel, BE_PROFILE, NRT_PROFILE, RT_PROFILE };\r\n//# sourceMappingURL=Index.js.map"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
||||
Generated
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 1DS JS SDK POST plugin, 4.3.11
|
||||
* Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
* (Microsoft Internal Only)
|
||||
*/
|
||||
|
||||
// Licensed under the MIT License.
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// 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!!!
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// Generally you should only put values that are used more than 2 times and then only if not already exposed as a constant (such as SdkCoreNames)
|
||||
// as when using "short" named values from here they will be will be minified smaller than the SdkCoreNames[eSdkCoreNames.xxxx] value.
|
||||
export var STR_EMPTY = "";
|
||||
export var STR_POST_METHOD = "POST";
|
||||
export var STR_DISABLED_PROPERTY_NAME = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
|
||||
export var STR_DROPPED = "drop";
|
||||
export var STR_SENDING = "send";
|
||||
export var STR_REQUEUE = "requeue";
|
||||
export var STR_RESPONSE_FAIL = "rspFail";
|
||||
export var STR_OTHER = "oth";
|
||||
export var DEFAULT_CACHE_CONTROL = "no-cache, no-store";
|
||||
export var DEFAULT_CONTENT_TYPE = "application/x-json-stream";
|
||||
export var STR_CACHE_CONTROL = "cache-control";
|
||||
export var STR_CONTENT_TYPE_HEADER = "content-type";
|
||||
export var STR_KILL_TOKENS_HEADER = "kill-tokens";
|
||||
export var STR_KILL_DURATION_HEADER = "kill-duration";
|
||||
export var STR_KILL_DURATION_SECONDS_HEADER = "kill-duration-seconds";
|
||||
export var STR_TIME_DELTA_HEADER = "time-delta-millis";
|
||||
export var STR_CLIENT_VERSION = "client-version";
|
||||
export var STR_CLIENT_ID = "client-id";
|
||||
export var STR_TIME_DELTA_TO_APPLY = "time-delta-to-apply-millis";
|
||||
export var STR_UPLOAD_TIME = "upload-time";
|
||||
export var STR_API_KEY = "apikey";
|
||||
export var STR_MSA_DEVICE_TICKET = "AuthMsaDeviceTicket";
|
||||
export var STR_AUTH_WEB_TOKEN = "WebAuthToken";
|
||||
export var STR_AUTH_XTOKEN = "AuthXToken";
|
||||
export var STR_SDK_VERSION = "sdk-version";
|
||||
export var STR_NO_RESPONSE_BODY = "NoResponseBody";
|
||||
export var STR_MSFPC = "msfpc";
|
||||
export var STR_TRACE = "trace";
|
||||
export var STR_USER = "user";
|
||||
//# sourceMappingURL=InternalConstants.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"InternalConstants.js.map","sources":["InternalConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\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\n// Generally you should only put values that are used more than 2 times and then only if not already exposed as a constant (such as SdkCoreNames)\r\n// as when using \"short\" named values from here they will be will be minified smaller than the SdkCoreNames[eSdkCoreNames.xxxx] value.\r\nexport var STR_EMPTY = \"\";\r\nexport var STR_POST_METHOD = \"POST\";\r\nexport var STR_DISABLED_PROPERTY_NAME = \"Microsoft_ApplicationInsights_BypassAjaxInstrumentation\";\r\nexport var STR_DROPPED = \"drop\";\r\nexport var STR_SENDING = \"send\";\r\nexport var STR_REQUEUE = \"requeue\";\r\nexport var STR_RESPONSE_FAIL = \"rspFail\";\r\nexport var STR_OTHER = \"oth\";\r\nexport var DEFAULT_CACHE_CONTROL = \"no-cache, no-store\";\r\nexport var DEFAULT_CONTENT_TYPE = \"application/x-json-stream\";\r\nexport var STR_CACHE_CONTROL = \"cache-control\";\r\nexport var STR_CONTENT_TYPE_HEADER = \"content-type\";\r\nexport var STR_KILL_TOKENS_HEADER = \"kill-tokens\";\r\nexport var STR_KILL_DURATION_HEADER = \"kill-duration\";\r\nexport var STR_KILL_DURATION_SECONDS_HEADER = \"kill-duration-seconds\";\r\nexport var STR_TIME_DELTA_HEADER = \"time-delta-millis\";\r\nexport var STR_CLIENT_VERSION = \"client-version\";\r\nexport var STR_CLIENT_ID = \"client-id\";\r\nexport var STR_TIME_DELTA_TO_APPLY = \"time-delta-to-apply-millis\";\r\nexport var STR_UPLOAD_TIME = \"upload-time\";\r\nexport var STR_API_KEY = \"apikey\";\r\nexport var STR_MSA_DEVICE_TICKET = \"AuthMsaDeviceTicket\";\r\nexport var STR_AUTH_WEB_TOKEN = \"WebAuthToken\";\r\nexport var STR_AUTH_XTOKEN = \"AuthXToken\";\r\nexport var STR_SDK_VERSION = \"sdk-version\";\r\nexport var STR_NO_RESPONSE_BODY = \"NoResponseBody\";\r\nexport var STR_MSFPC = \"msfpc\";\r\nexport var STR_TRACE = \"trace\";\r\nexport var STR_USER = \"user\";\r\n//# sourceMappingURL=InternalConstants.js.map"],"names":[],"mappings":";;;;;AAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 1DS JS SDK POST plugin, 4.3.11
|
||||
* Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
* (Microsoft Internal Only)
|
||||
*/
|
||||
/**
|
||||
* KillSwitch.ts
|
||||
* @author Abhilash Panwar (abpanwar)
|
||||
* @copyright Microsoft 2018
|
||||
*/
|
||||
import dynamicProto from "@microsoft/dynamicproto-js";
|
||||
import { arrForEach, dateNow, strTrim } from "@microsoft/1ds-core-js";
|
||||
import { _DYN_IS_TENANT_KILLED, _DYN_LENGTH, _DYN_PUSH, _DYN_SET_KILL_SWITCH_TENA11, _DYN_SPLIT } from "./__DynamicConstants";
|
||||
var SecToMsMultiplier = 1000;
|
||||
/**
|
||||
* Class to stop certain tenants sending events.
|
||||
*/
|
||||
var KillSwitch = /** @class */ (function () {
|
||||
function KillSwitch() {
|
||||
var _killedTokenDictionary = {};
|
||||
function _normalizeTenants(values) {
|
||||
var result = [];
|
||||
if (values) {
|
||||
arrForEach(values, function (value) {
|
||||
result[_DYN_PUSH /* @min:%2epush */](strTrim(value));
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
dynamicProto(KillSwitch, this, function (_self) {
|
||||
_self[_DYN_SET_KILL_SWITCH_TENA11 /* @min:%2esetKillSwitchTenants */] = function (killTokens, killDuration) {
|
||||
if (killTokens && killDuration) {
|
||||
try {
|
||||
var killedTokens = _normalizeTenants(killTokens[_DYN_SPLIT /* @min:%2esplit */](","));
|
||||
if (killDuration === "this-request-only") {
|
||||
return killedTokens;
|
||||
}
|
||||
var durationMs = parseInt(killDuration, 10) * SecToMsMultiplier;
|
||||
for (var i = 0; i < killedTokens[_DYN_LENGTH /* @min:%2elength */]; ++i) {
|
||||
_killedTokenDictionary[killedTokens[i]] = dateNow() + durationMs;
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
return [];
|
||||
};
|
||||
_self[_DYN_IS_TENANT_KILLED /* @min:%2eisTenantKilled */] = function (tenantToken) {
|
||||
var killDictionary = _killedTokenDictionary;
|
||||
var name = strTrim(tenantToken);
|
||||
if (killDictionary[name] !== undefined && killDictionary[name] > dateNow()) {
|
||||
return true;
|
||||
}
|
||||
delete killDictionary[name];
|
||||
return false;
|
||||
};
|
||||
});
|
||||
}
|
||||
// Removed Stub for KillSwitch.prototype.setKillSwitchTenants.
|
||||
// Removed Stub for KillSwitch.prototype.isTenantKilled.
|
||||
// This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
|
||||
// non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
|
||||
KillSwitch.__ieDyn=1;
|
||||
|
||||
return KillSwitch;
|
||||
}());
|
||||
export { KillSwitch };
|
||||
//# sourceMappingURL=KillSwitch.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"KillSwitch.js.map","sources":["KillSwitch.js"],"sourcesContent":["/**\r\n* KillSwitch.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { arrForEach, dateNow, strTrim } from \"@microsoft/1ds-core-js\";\r\nimport { _DYN_IS_TENANT_KILLED, _DYN_LENGTH, _DYN_PUSH, _DYN_SET_KILL_SWITCH_TENA11, _DYN_SPLIT } from \"./__DynamicConstants\";\r\nvar SecToMsMultiplier = 1000;\r\n/**\r\n* Class to stop certain tenants sending events.\r\n*/\r\nvar KillSwitch = /** @class */ (function () {\r\n function KillSwitch() {\r\n var _killedTokenDictionary = {};\r\n function _normalizeTenants(values) {\r\n var result = [];\r\n if (values) {\r\n arrForEach(values, function (value) {\r\n result[_DYN_PUSH /* @min:%2epush */](strTrim(value));\r\n });\r\n }\r\n return result;\r\n }\r\n dynamicProto(KillSwitch, this, function (_self) {\r\n _self[_DYN_SET_KILL_SWITCH_TENA11 /* @min:%2esetKillSwitchTenants */] = function (killTokens, killDuration) {\r\n if (killTokens && killDuration) {\r\n try {\r\n var killedTokens = _normalizeTenants(killTokens[_DYN_SPLIT /* @min:%2esplit */](\",\"));\r\n if (killDuration === \"this-request-only\") {\r\n return killedTokens;\r\n }\r\n var durationMs = parseInt(killDuration, 10) * SecToMsMultiplier;\r\n for (var i = 0; i < killedTokens[_DYN_LENGTH /* @min:%2elength */]; ++i) {\r\n _killedTokenDictionary[killedTokens[i]] = dateNow() + durationMs;\r\n }\r\n }\r\n catch (ex) {\r\n return [];\r\n }\r\n }\r\n return [];\r\n };\r\n _self[_DYN_IS_TENANT_KILLED /* @min:%2eisTenantKilled */] = function (tenantToken) {\r\n var killDictionary = _killedTokenDictionary;\r\n var name = strTrim(tenantToken);\r\n if (killDictionary[name] !== undefined && killDictionary[name] > dateNow()) {\r\n return true;\r\n }\r\n delete killDictionary[name];\r\n return false;\r\n };\r\n });\r\n }\r\n /**\r\n * Set the tenants that are to be killed along with the duration. If the duration is\r\n * a special value identifying that the tokens are too be killed for only this request, then\r\n * a array of tokens is returned.\r\n * @param killedTokens - Tokens that are too be marked to be killed.\r\n * @param killDuration - The duration for which the tokens are to be killed.\r\n * @returns The tokens that are killed only for this given request.\r\n */\r\n KillSwitch.prototype.setKillSwitchTenants = function (killTokens, killDuration) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return [];\r\n };\r\n /**\r\n * Determing if the given tenant token has been killed for the moment.\r\n * @param tenantToken - The token to be checked.\r\n * @returns True if token has been killed, false otherwise.\r\n */\r\n KillSwitch.prototype.isTenantKilled = function (tenantToken) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n return KillSwitch;\r\n}());\r\nexport { KillSwitch };\r\n//# sourceMappingURL=KillSwitch.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;wDAoBM,CAAC;;;;;sBACe;AACtB;AACA;AACA"}
|
||||
+1019
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+51
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 1DS JS SDK POST plugin, 4.3.11
|
||||
* Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
* (Microsoft Internal Only)
|
||||
*/
|
||||
import { mathFloor, mathMin } from "@nevware21/ts-utils";
|
||||
/**
|
||||
* RetryPolicy.ts
|
||||
* @author Abhilash Panwar (abpanwar)
|
||||
* @copyright Microsoft 2018
|
||||
*/
|
||||
var RandomizationLowerThreshold = 0.8;
|
||||
var RandomizationUpperThreshold = 1.2;
|
||||
var BaseBackoff = 3000;
|
||||
var MaxBackoff = 600000;
|
||||
/**
|
||||
* Determine if the request should be retried for the given status code.
|
||||
* The below expression reads that we should only retry for:
|
||||
* - HttpStatusCodes that are smaller than 300.
|
||||
* - HttpStatusCodes greater or equal to 500 (except for 501-NotImplement
|
||||
* and 505-HttpVersionNotSupport).
|
||||
* - HttpStatusCode 408-RequestTimeout.
|
||||
* - HttpStatusCode 429.
|
||||
* This is based on Microsoft.WindowsAzure.Storage.RetryPolicies.ExponentialRetry class
|
||||
* @param httpStatusCode - The status code returned for the request.
|
||||
* @returns True if request should be retried, false otherwise.
|
||||
*/
|
||||
export function retryPolicyShouldRetryForStatus(httpStatusCode) {
|
||||
/* tslint:disable:triple-equals */
|
||||
// Disabling triple-equals rule to avoid httpOverrides from failing because they are returning a string value
|
||||
return !((httpStatusCode >= 300 && httpStatusCode < 500 && httpStatusCode != 429)
|
||||
|| (httpStatusCode == 501)
|
||||
|| (httpStatusCode == 505));
|
||||
/* tslint:enable:triple-equals */
|
||||
}
|
||||
/**
|
||||
* Gets the number of milliseconds to back off before retrying the request. The
|
||||
* back off duration is exponentially scaled based on the number of retries already
|
||||
* done for the request.
|
||||
* @param retriesSoFar - The number of times the request has already been retried.
|
||||
* @returns The back off duration for the request before it can be retried.
|
||||
*/
|
||||
export function retryPolicyGetMillisToBackoffForRetry(retriesSoFar) {
|
||||
var waitDuration = 0;
|
||||
var minBackoff = BaseBackoff * RandomizationLowerThreshold;
|
||||
var maxBackoff = BaseBackoff * RandomizationUpperThreshold;
|
||||
var randomBackoff = mathFloor(Math.random() * (maxBackoff - minBackoff)) + minBackoff;
|
||||
waitDuration = Math.pow(2, retriesSoFar) * randomBackoff;
|
||||
return mathMin(waitDuration, MaxBackoff);
|
||||
}
|
||||
//# sourceMappingURL=RetryPolicy.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"RetryPolicy.js.map","sources":["RetryPolicy.js"],"sourcesContent":["import { mathFloor, mathMin } from \"@nevware21/ts-utils\";\r\n/**\r\n* RetryPolicy.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n*/\r\nvar RandomizationLowerThreshold = 0.8;\r\nvar RandomizationUpperThreshold = 1.2;\r\nvar BaseBackoff = 3000;\r\nvar MaxBackoff = 600000;\r\n/**\r\n * Determine if the request should be retried for the given status code.\r\n * The below expression reads that we should only retry for:\r\n * - HttpStatusCodes that are smaller than 300.\r\n * - HttpStatusCodes greater or equal to 500 (except for 501-NotImplement\r\n * and 505-HttpVersionNotSupport).\r\n * - HttpStatusCode 408-RequestTimeout.\r\n * - HttpStatusCode 429.\r\n * This is based on Microsoft.WindowsAzure.Storage.RetryPolicies.ExponentialRetry class\r\n * @param httpStatusCode - The status code returned for the request.\r\n * @returns True if request should be retried, false otherwise.\r\n */\r\nexport function retryPolicyShouldRetryForStatus(httpStatusCode) {\r\n /* tslint:disable:triple-equals */\r\n // Disabling triple-equals rule to avoid httpOverrides from failing because they are returning a string value\r\n return !((httpStatusCode >= 300 && httpStatusCode < 500 && httpStatusCode != 429)\r\n || (httpStatusCode == 501)\r\n || (httpStatusCode == 505));\r\n /* tslint:enable:triple-equals */\r\n}\r\n/**\r\n * Gets the number of milliseconds to back off before retrying the request. The\r\n * back off duration is exponentially scaled based on the number of retries already\r\n * done for the request.\r\n * @param retriesSoFar - The number of times the request has already been retried.\r\n * @returns The back off duration for the request before it can be retried.\r\n */\r\nexport function retryPolicyGetMillisToBackoffForRetry(retriesSoFar) {\r\n var waitDuration = 0;\r\n var minBackoff = BaseBackoff * RandomizationLowerThreshold;\r\n var maxBackoff = BaseBackoff * RandomizationUpperThreshold;\r\n var randomBackoff = mathFloor(Math.random() * (maxBackoff - minBackoff)) + minBackoff;\r\n waitDuration = Math.pow(2, retriesSoFar) * randomBackoff;\r\n return mathMin(waitDuration, MaxBackoff);\r\n}\r\n//# sourceMappingURL=RetryPolicy.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"}
|
||||
+360
@@ -0,0 +1,360 @@
|
||||
/*
|
||||
* 1DS JS SDK POST plugin, 4.3.11
|
||||
* Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
* (Microsoft Internal Only)
|
||||
*/
|
||||
/**
|
||||
* Serializer.ts
|
||||
* @author Abhilash Panwar (abpanwar); Hector Hernandez (hectorh); Nev Wylie (newylie)
|
||||
* @copyright Microsoft 2018-2020
|
||||
*/
|
||||
// @skip-file-minify
|
||||
import dynamicProto from "@microsoft/dynamicproto-js";
|
||||
import { arrIndexOf, doPerf, getCommonSchemaMetaData, getTenantId, isArray, isValueAssigned, objForEachKey, sanitizeProperty, strStartsWith } from "@microsoft/1ds-core-js";
|
||||
import { EventBatch } from "./EventBatch";
|
||||
import { STR_EMPTY } from "./InternalConstants";
|
||||
import { mathMin, strSubstr } from "@nevware21/ts-utils";
|
||||
/**
|
||||
* Note: This is an optimization for V8-based browsers. When V8 concatenates a string,
|
||||
* the strings are only joined logically using a "cons string" or "constructed/concatenated
|
||||
* string". These containers keep references to one another and can result in very large
|
||||
* memory usage. For example, if a 2MB string is constructed by concatenating 4 bytes
|
||||
* together at a time, the memory usage will be ~44MB; so ~22x increase. The strings are
|
||||
* only joined together when an operation requiring their joining takes place, such as
|
||||
* substr(). This function is called when adding data to this buffer to ensure these
|
||||
* types of strings are periodically joined to reduce the memory footprint.
|
||||
* Setting to every 20 events as the JSON.stringify() may have joined many strings
|
||||
* and calling this too much causes a minor delay while processing.
|
||||
*/
|
||||
var _MAX_STRING_JOINS = 20;
|
||||
// Max Size set by One Collector: https://msazure.visualstudio.com/OneDsCollector/_git/Collector?path=/Services/Azure/CollectorWorkerRoleAzure/ServiceConfiguration.Cloud.cscfg
|
||||
var RequestSizeLimitBytes = 3145728; // approx 3.15 Mb
|
||||
var BeaconRequestSizeLimitBytes = 65000; // approx 64kb (the current Edge, Firefox and Chrome max limit)
|
||||
var MaxRecordSize = 2000000; // approx 2 Mb
|
||||
var MaxBeaconRecordSize = mathMin(MaxRecordSize, BeaconRequestSizeLimitBytes);
|
||||
var metadata = "metadata";
|
||||
var f = "f";
|
||||
var rCheckDot = /\./;
|
||||
/**
|
||||
* Class to handle serialization of event and request.
|
||||
* Currently uses Bond for serialization. Please note that this may be subject to change.
|
||||
*/
|
||||
var Serializer = /** @class */ (function () {
|
||||
/**
|
||||
* Constructs a new instance of the Serializer class
|
||||
* @param perfManager - The performance manager to use for tracking performance
|
||||
* @param valueSanitizer - The value sanitizer to use for sanitizing field values
|
||||
* @param stringifyObjects - Should objects be stringified before being sent
|
||||
* @param enableCompoundKey - Should compound keys be enabled (defaults to false)
|
||||
* @param getEncodedTypeOverride - The callback to get the encoded type for a property defaults to ({@link getCommonSchemaMetaData }(...))
|
||||
* @param excludeCsMetaData - (!DANGER!) Should metadata be populated when encoding the event blob (defaults to false) - PII data will NOT be tagged as PII for backend processing
|
||||
* @param cfg channel cfg for setting request and record size limit
|
||||
*/
|
||||
function Serializer(perfManager, valueSanitizer, stringifyObjects, enableCompoundKey, getEncodedTypeOverride, excludeCsMetaData, cfg) {
|
||||
var strData = "data";
|
||||
var strBaseData = "baseData";
|
||||
var strExt = "ext";
|
||||
var _checkForCompoundkey = !!enableCompoundKey;
|
||||
var _processSubKeys = true;
|
||||
var _theSanitizer = valueSanitizer;
|
||||
var _isReservedCache = {};
|
||||
var _excludeCsMetaData = !!excludeCsMetaData;
|
||||
var _getEncodedType = getEncodedTypeOverride || getCommonSchemaMetaData;
|
||||
var _sizeCfg = _getSizeLimtCfg(cfg);
|
||||
var _requestSizeLimitBytes = _validateSizeLimit(_sizeCfg.requestLimit, RequestSizeLimitBytes, 0);
|
||||
var _beaconRequestSizeLimitBytes = _validateSizeLimit(_sizeCfg.requestLimit, BeaconRequestSizeLimitBytes, 1);
|
||||
var _maxRecordSize = _validateSizeLimit(_sizeCfg.recordLimit, MaxRecordSize, 0);
|
||||
var _maxBeaconRecordSize = Math.min(_validateSizeLimit(_sizeCfg.recordLimit, MaxBeaconRecordSize, 1), _beaconRequestSizeLimitBytes);
|
||||
dynamicProto(Serializer, this, function (_self) {
|
||||
_self.createPayload = function (retryCnt, isTeardown, isSync, isReducedPayload, sendReason, sendType) {
|
||||
return {
|
||||
apiKeys: [],
|
||||
payloadBlob: STR_EMPTY,
|
||||
overflow: null,
|
||||
sizeExceed: [],
|
||||
failedEvts: [],
|
||||
batches: [],
|
||||
numEvents: 0,
|
||||
retryCnt: retryCnt,
|
||||
isTeardown: isTeardown,
|
||||
isSync: isSync,
|
||||
isBeacon: isReducedPayload,
|
||||
sendType: sendType,
|
||||
sendReason: sendReason
|
||||
};
|
||||
};
|
||||
_self.appendPayload = function (payload, theBatch, maxEventsPerBatch) {
|
||||
var canAddEvents = payload && theBatch && !payload.overflow;
|
||||
if (canAddEvents) {
|
||||
doPerf(perfManager, function () { return "Serializer:appendPayload"; }, function () {
|
||||
var theEvents = theBatch.events();
|
||||
var payloadBlob = payload.payloadBlob;
|
||||
var payloadEvents = payload.numEvents;
|
||||
var eventsAdded = false;
|
||||
var sizeExceeded = [];
|
||||
var failedEvts = [];
|
||||
var isBeaconPayload = payload.isBeacon;
|
||||
var requestMaxSize = isBeaconPayload ? _beaconRequestSizeLimitBytes : _requestSizeLimitBytes;
|
||||
var recordMaxSize = isBeaconPayload ? _maxBeaconRecordSize : _maxRecordSize;
|
||||
var lp = 0;
|
||||
var joinCount = 0;
|
||||
while (lp < theEvents.length) {
|
||||
var theEvent = theEvents[lp];
|
||||
if (theEvent) {
|
||||
if (payloadEvents >= maxEventsPerBatch) {
|
||||
// Maximum events per payload reached, so don't add any more
|
||||
payload.overflow = theBatch.split(lp);
|
||||
break;
|
||||
}
|
||||
var eventBlob = _self.getEventBlob(theEvent);
|
||||
if (eventBlob && eventBlob.length <= recordMaxSize) {
|
||||
// This event will fit into the payload
|
||||
var blobLength = eventBlob.length;
|
||||
var currentSize = payloadBlob.length;
|
||||
if (currentSize + blobLength > requestMaxSize) {
|
||||
// Request or batch size exceeded, so don't add any more to the payload
|
||||
payload.overflow = theBatch.split(lp);
|
||||
break;
|
||||
}
|
||||
if (payloadBlob) {
|
||||
payloadBlob += "\n";
|
||||
}
|
||||
payloadBlob += eventBlob;
|
||||
joinCount++;
|
||||
// v8 memory optimization only
|
||||
if (joinCount > _MAX_STRING_JOINS) {
|
||||
// this substr() should cause the constructed string to join
|
||||
strSubstr(payloadBlob, 0, 1);
|
||||
joinCount = 0;
|
||||
}
|
||||
eventsAdded = true;
|
||||
payloadEvents++;
|
||||
}
|
||||
else {
|
||||
if (eventBlob) {
|
||||
// Single event size exceeded so remove from the batch
|
||||
sizeExceeded.push(theEvent);
|
||||
}
|
||||
else {
|
||||
failedEvts.push(theEvent);
|
||||
}
|
||||
// We also need to remove this event from the existing array, otherwise a notification will be sent
|
||||
// indicating that it was successfully sent
|
||||
theEvents.splice(lp, 1);
|
||||
lp--;
|
||||
}
|
||||
}
|
||||
lp++;
|
||||
}
|
||||
if (sizeExceeded.length > 0) {
|
||||
payload.sizeExceed.push(EventBatch.create(theBatch.iKey(), sizeExceeded));
|
||||
// Remove the exceeded events from the batch
|
||||
}
|
||||
if (failedEvts.length > 0) {
|
||||
payload.failedEvts.push(EventBatch.create(theBatch.iKey(), failedEvts));
|
||||
// Remove the failed events from the batch
|
||||
}
|
||||
if (eventsAdded) {
|
||||
payload.batches.push(theBatch);
|
||||
payload.payloadBlob = payloadBlob;
|
||||
payload.numEvents = payloadEvents;
|
||||
var apiKey = theBatch.iKey();
|
||||
if (arrIndexOf(payload.apiKeys, apiKey) === -1) {
|
||||
payload.apiKeys.push(apiKey);
|
||||
}
|
||||
}
|
||||
}, function () { return ({ payload: payload, theBatch: { iKey: theBatch.iKey(), evts: theBatch.events() }, max: maxEventsPerBatch }); });
|
||||
}
|
||||
return canAddEvents;
|
||||
};
|
||||
_self.getEventBlob = function (eventData) {
|
||||
try {
|
||||
return doPerf(perfManager, function () { return "Serializer.getEventBlob"; }, function () {
|
||||
var serializedEvent = {};
|
||||
// Adding as dynamic keys for v8 performance
|
||||
serializedEvent.name = eventData.name;
|
||||
serializedEvent.time = eventData.time;
|
||||
serializedEvent.ver = eventData.ver;
|
||||
serializedEvent.iKey = "o:" + getTenantId(eventData.iKey);
|
||||
// Assigning local var so usage in part b/c don't throw if there is no ext
|
||||
var serializedExt = {};
|
||||
var _addMetadataCallback;
|
||||
if (!_excludeCsMetaData) {
|
||||
_addMetadataCallback = function (pathKeys, key, value) {
|
||||
_addJSONPropertyMetaData(_getEncodedType, serializedExt, pathKeys, key, value);
|
||||
};
|
||||
}
|
||||
// Part A
|
||||
var eventExt = eventData[strExt];
|
||||
if (eventExt) {
|
||||
// Only assign ext if the event had one (There are tests covering this use case)
|
||||
serializedEvent[strExt] = serializedExt;
|
||||
objForEachKey(eventExt, function (key, value) {
|
||||
var data = serializedExt[key] = {};
|
||||
// Don't include a metadata callback as we don't currently set metadata Part A fields
|
||||
_processPathKeys(value, data, "ext." + key, true, null, null, true);
|
||||
});
|
||||
}
|
||||
var serializedData = serializedEvent[strData] = {};
|
||||
serializedData.baseType = eventData.baseType;
|
||||
var serializedBaseData = serializedData[strBaseData] = {};
|
||||
// Part B
|
||||
_processPathKeys(eventData.baseData, serializedBaseData, strBaseData, false, [strBaseData], _addMetadataCallback, _processSubKeys);
|
||||
// Part C
|
||||
_processPathKeys(eventData.data, serializedData, strData, false, [], _addMetadataCallback, _processSubKeys);
|
||||
return JSON.stringify(serializedEvent);
|
||||
}, function () { return ({ item: eventData }); });
|
||||
}
|
||||
catch (e) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
function _isReservedField(path, name) {
|
||||
var result = _isReservedCache[path];
|
||||
if (result === undefined) {
|
||||
if (path.length >= 7) {
|
||||
// Do not allow the changing of fields located in the ext.metadata or ext.web extension
|
||||
result = strStartsWith(path, "ext.metadata") || strStartsWith(path, "ext.web");
|
||||
}
|
||||
_isReservedCache[path] = result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function _processPathKeys(srcObj, target, thePath, checkReserved, metadataPathKeys, metadataCallback, processSubKeys) {
|
||||
objForEachKey(srcObj, function (key, srcValue) {
|
||||
var prop = null;
|
||||
if (srcValue || isValueAssigned(srcValue)) {
|
||||
var path = thePath;
|
||||
var name_1 = key;
|
||||
var theMetaPathKeys = metadataPathKeys;
|
||||
var destObj = target;
|
||||
// Handle keys with embedded '.', like "TestObject.testProperty"
|
||||
if (_checkForCompoundkey && !checkReserved && rCheckDot.test(key)) {
|
||||
var subKeys = key.split(".");
|
||||
var keyLen = subKeys.length;
|
||||
if (keyLen > 1) {
|
||||
if (theMetaPathKeys) {
|
||||
// Create a copy of the meta path keys so we can add the extra ones
|
||||
theMetaPathKeys = theMetaPathKeys.slice();
|
||||
}
|
||||
for (var lp = 0; lp < keyLen - 1; lp++) {
|
||||
var subKey = subKeys[lp];
|
||||
// Add/reuse the sub key object
|
||||
destObj = destObj[subKey] = destObj[subKey] || {};
|
||||
path += "." + subKey;
|
||||
if (theMetaPathKeys) {
|
||||
theMetaPathKeys.push(subKey);
|
||||
}
|
||||
}
|
||||
name_1 = subKeys[keyLen - 1];
|
||||
}
|
||||
}
|
||||
var isReserved = checkReserved && _isReservedField(path, name_1);
|
||||
if (!isReserved && _theSanitizer && _theSanitizer.handleField(path, name_1)) {
|
||||
prop = _theSanitizer.value(path, name_1, srcValue, stringifyObjects);
|
||||
}
|
||||
else {
|
||||
prop = sanitizeProperty(name_1, srcValue, stringifyObjects);
|
||||
}
|
||||
if (prop) {
|
||||
// Set the value
|
||||
var newValue = prop.value;
|
||||
destObj[name_1] = newValue;
|
||||
if (metadataCallback) {
|
||||
metadataCallback(theMetaPathKeys, name_1, prop);
|
||||
}
|
||||
if (processSubKeys && typeof newValue === "object" && !isArray(newValue)) {
|
||||
var newPath = theMetaPathKeys;
|
||||
if (newPath) {
|
||||
newPath = newPath.slice();
|
||||
newPath.push(name_1);
|
||||
}
|
||||
// Make sure we process sub objects as well (for value sanitization and metadata)
|
||||
_processPathKeys(srcValue, newValue, path + "." + name_1, checkReserved, newPath, metadataCallback, processSubKeys);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// Removed Stub for Serializer.prototype.createPayload.
|
||||
// Removed Stub for Serializer.prototype.appendPayload.
|
||||
// Removed Stub for Serializer.prototype.getEventBlob.
|
||||
// Removed Stub for Serializer.prototype.handleField.
|
||||
// Removed Stub for Serializer.prototype.getSanitizer.
|
||||
// This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
|
||||
// non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
|
||||
Serializer.__ieDyn=1;
|
||||
|
||||
return Serializer;
|
||||
}());
|
||||
export { Serializer };
|
||||
function _validateSizeLimit(cfgVal, defaultVal, idx) {
|
||||
if (isArray(cfgVal)) {
|
||||
var val = cfgVal[idx];
|
||||
if (val > 0 && val <= defaultVal) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return defaultVal;
|
||||
}
|
||||
function _getSizeLimtCfg(cfg) {
|
||||
var defaultCfg = {};
|
||||
if (cfg && cfg.requestLimit) {
|
||||
return cfg.requestLimit;
|
||||
}
|
||||
return defaultCfg;
|
||||
}
|
||||
/**
|
||||
* @ignore
|
||||
* @param getEncodedType - The function to get the encoded type for the property
|
||||
* @param json - The json object to add the metadata to
|
||||
* @param propKeys - The property keys to add to the metadata
|
||||
* @param name - The name of the property
|
||||
* @param propertyValue - The property value
|
||||
*/
|
||||
function _addJSONPropertyMetaData(getEncodedType, json, propKeys, name, propertyValue) {
|
||||
if (propertyValue && json) {
|
||||
var encodedTypeValue = getEncodedType(propertyValue.value, propertyValue.kind, propertyValue.propertyType);
|
||||
if (encodedTypeValue > -1) {
|
||||
// Add the root metadata
|
||||
var metaData = json[metadata];
|
||||
if (!metaData) {
|
||||
// Sets the root 'f'
|
||||
metaData = json[metadata] = { f: {} };
|
||||
}
|
||||
var metaTarget = metaData[f];
|
||||
if (!metaTarget) {
|
||||
// This can occur if someone has manually added an ext.metadata object
|
||||
// Such as ext.metadata.privLevel and ext.metadata.privTags
|
||||
metaTarget = metaData[f] = {};
|
||||
}
|
||||
// Traverse the metadata path and build each object (contains an 'f' key) -- if required
|
||||
if (propKeys) {
|
||||
for (var lp = 0; lp < propKeys.length; lp++) {
|
||||
var key = propKeys[lp];
|
||||
if (!metaTarget[key]) {
|
||||
metaTarget[key] = { f: {} };
|
||||
}
|
||||
var newTarget = metaTarget[key][f];
|
||||
if (!newTarget) {
|
||||
// Not expected, but can occur if the metadata context was pre-created as part of the event
|
||||
newTarget = metaTarget[key][f] = {};
|
||||
}
|
||||
metaTarget = newTarget;
|
||||
}
|
||||
}
|
||||
metaTarget = metaTarget[name] = {};
|
||||
if (isArray(propertyValue.value)) {
|
||||
metaTarget["a"] = {
|
||||
t: encodedTypeValue
|
||||
};
|
||||
}
|
||||
else {
|
||||
metaTarget["t"] = encodedTypeValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=Serializer.js.map
|
||||
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 1DS JS SDK POST plugin, 4.3.11
|
||||
* Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
* (Microsoft Internal Only)
|
||||
*/
|
||||
/**
|
||||
* TimeoutOverrideWrapper.ts
|
||||
* @author Nev Wylie (newylie)
|
||||
* @copyright Microsoft 2022
|
||||
* Simple internal timeout wrapper
|
||||
*/
|
||||
import { scheduleTimeoutWith } from "@nevware21/ts-utils";
|
||||
export function createTimeoutWrapper(argSetTimeout, argClearTimeout) {
|
||||
return {
|
||||
set: function (callback, ms) {
|
||||
var args = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
args[_i - 2] = arguments[_i];
|
||||
}
|
||||
return scheduleTimeoutWith([argSetTimeout, argClearTimeout], callback, ms, args);
|
||||
}
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=TimeoutOverrideWrapper.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"TimeoutOverrideWrapper.js.map","sources":["TimeoutOverrideWrapper.js"],"sourcesContent":["/**\r\n* TimeoutOverrideWrapper.ts\r\n* @author Nev Wylie (newylie)\r\n* @copyright Microsoft 2022\r\n* Simple internal timeout wrapper\r\n*/\r\nimport { scheduleTimeoutWith } from \"@nevware21/ts-utils\";\r\nexport function createTimeoutWrapper(argSetTimeout, argClearTimeout) {\r\n return {\r\n set: function (callback, ms) {\r\n var args = [];\r\n for (var _i = 2; _i < arguments.length; _i++) {\r\n args[_i - 2] = arguments[_i];\r\n }\r\n return scheduleTimeoutWith([argSetTimeout, argClearTimeout], callback, ms, args);\r\n }\r\n };\r\n}\r\n//# sourceMappingURL=TimeoutOverrideWrapper.js.map"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
||||
Generated
Vendored
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 1DS JS SDK POST plugin, 4.3.11
|
||||
* Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
* (Microsoft Internal Only)
|
||||
*/
|
||||
|
||||
// Licensed under the MIT License.
|
||||
// @skip-file-minify
|
||||
// ##############################################################
|
||||
// AUTO GENERATED FILE: This file is Auto Generated during build.
|
||||
// ##############################################################
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// Note: DON'T Export these const from the package as we are still targeting ES5 which can result in a mutable variables that someone could change!!!
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
export var _DYN_ALLOW_REQUEST_SENDIN0 = "allowRequestSending"; // Count: 3
|
||||
export var _DYN_SHOULD_ADD_CLOCK_SKE1 = "shouldAddClockSkewHeaders"; // Count: 2
|
||||
export var _DYN_GET_CLOCK_SKEW_HEADE2 = "getClockSkewHeaderValue"; // Count: 2
|
||||
export var _DYN_SET_CLOCK_SKEW = "setClockSkew"; // Count: 3
|
||||
export var _DYN_LENGTH = "length"; // Count: 38
|
||||
export var _DYN_CONCAT = "concat"; // Count: 7
|
||||
export var _DYN_I_KEY = "iKey"; // Count: 10
|
||||
export var _DYN_COUNT = "count"; // Count: 19
|
||||
export var _DYN_EVENTS = "events"; // Count: 8
|
||||
export var _DYN_PUSH = "push"; // Count: 15
|
||||
export var _DYN_SPLIT = "split"; // Count: 6
|
||||
export var _DYN_TO_LOWER_CASE = "toLowerCase"; // Count: 3
|
||||
export var _DYN_HDRS = "hdrs"; // Count: 7
|
||||
export var _DYN_USE_HDRS = "useHdrs"; // Count: 4
|
||||
export var _DYN_INITIALIZE = "initialize"; // Count: 5
|
||||
export var _DYN_SET_TIMEOUT_OVERRIDE = "setTimeoutOverride"; // Count: 3
|
||||
export var _DYN_CLEAR_TIMEOUT_OVERRI3 = "clearTimeoutOverride"; // Count: 3
|
||||
export var _DYN_PAYLOAD_PREPROCESSOR = "payloadPreprocessor"; // Count: 2
|
||||
export var _DYN_OVERRIDE_ENDPOINT_UR4 = "overrideEndpointUrl"; // Count: 3
|
||||
export var _DYN_AVOID_OPTIONS = "avoidOptions"; // Count: 3
|
||||
export var _DYN_DISABLE_EVENT_TIMING5 = "disableEventTimings"; // Count: 2
|
||||
export var _DYN_ENABLE_COMPOUND_KEY = "enableCompoundKey"; // Count: 4
|
||||
export var _DYN_DISABLE_XHR_SYNC = "disableXhrSync"; // Count: 6
|
||||
export var _DYN_DISABLE_FETCH_KEEP_A6 = "disableFetchKeepAlive"; // Count: 7
|
||||
export var _DYN_ADD_NO_RESPONSE = "addNoResponse"; // Count: 3
|
||||
export var _DYN_USE_SEND_BEACON = "useSendBeacon"; // Count: 3
|
||||
export var _DYN_FETCH_CREDENTIALS = "fetchCredentials"; // Count: 4
|
||||
export var _DYN_ALWAYS_USE_XHR_OVERR7 = "alwaysUseXhrOverride"; // Count: 3
|
||||
export var _DYN_SERIALIZE_OFFLINE_EV8 = "serializeOfflineEvt"; // Count: 2
|
||||
export var _DYN_GET_OFFLINE_REQUEST_9 = "getOfflineRequestDetails"; // Count: 2
|
||||
export var _DYN_CREATE_PAYLOAD = "createPayload"; // Count: 4
|
||||
export var _DYN_CREATE_ONE_DSPAYLOAD = "createOneDSPayload"; // Count: 4
|
||||
export var _DYN_PAYLOAD_BLOB = "payloadBlob"; // Count: 3
|
||||
export var _DYN_HEADERS = "headers"; // Count: 10
|
||||
export var _DYN__THE_PAYLOAD = "_thePayload"; // Count: 5
|
||||
export var _DYN_BATCHES = "batches"; // Count: 15
|
||||
export var _DYN_SEND_TYPE = "sendType"; // Count: 13
|
||||
export var _DYN_CAN_SEND_REQUEST = "canSendRequest"; // Count: 3
|
||||
export var _DYN_SEND_QUEUED_REQUESTS = "sendQueuedRequests"; // Count: 5
|
||||
export var _DYN_SET_UNLOADING = "setUnloading"; // Count: 3
|
||||
export var _DYN_IS_TENANT_KILLED = "isTenantKilled"; // Count: 3
|
||||
export var _DYN_SEND_SYNCHRONOUS_BAT10 = "sendSynchronousBatch"; // Count: 2
|
||||
export var _DYN__TRANSPORT = "_transport"; // Count: 3
|
||||
export var _DYN_GET_WPARAM = "getWParam"; // Count: 4
|
||||
export var _DYN_IS_BEACON = "isBeacon"; // Count: 4
|
||||
export var _DYN_TIMINGS = "timings"; // Count: 4
|
||||
export var _DYN_IS_TEARDOWN = "isTeardown"; // Count: 3
|
||||
export var _DYN__SEND_REASON = "_sendReason"; // Count: 3
|
||||
export var _DYN_SET_KILL_SWITCH_TENA11 = "setKillSwitchTenants"; // Count: 2
|
||||
export var _DYN__BACK_OFF_TRANSMISSI12 = "_backOffTransmission"; // Count: 2
|
||||
export var _DYN_IDENTIFIER = "identifier"; // Count: 4
|
||||
export var _DYN_IGNORE_MC1_MS0_COOKI13 = "ignoreMc1Ms0CookieProcessing"; // Count: 2
|
||||
export var _DYN_AUTO_FLUSH_EVENTS_LI14 = "autoFlushEventsLimit"; // Count: 2
|
||||
export var _DYN_DISABLE_AUTO_BATCH_F15 = "disableAutoBatchFlushLimit"; // Count: 2
|
||||
export var _DYN_OVERRIDE_INSTRUMENTA16 = "overrideInstrumentationKey"; // Count: 2
|
||||
export var _DYN_SEND_ATTEMPT = "sendAttempt"; // Count: 4
|
||||
export var _DYN_LATENCY = "latency"; // Count: 7
|
||||
export var _DYN_SYNC = "sync"; // Count: 7
|
||||
//# sourceMappingURL=__DynamicConstants.js.map
|
||||
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* 1DS JS SDK POST plugin, 4.3.11
|
||||
* Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
* (Microsoft Internal Only)
|
||||
*/
|
||||
export {};
|
||||
// export declare var XDomainRequest: {
|
||||
// prototype: IXDomainRequest;
|
||||
// new (): IXDomainRequest;
|
||||
// };
|
||||
//# sourceMappingURL=XDomainRequest.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"XDomainRequest.js.map","sources":["XDomainRequest.js"],"sourcesContent":["export {};\r\n// export declare var XDomainRequest: {\r\n// prototype: IXDomainRequest;\r\n// new (): IXDomainRequest;\r\n// };\r\n//# sourceMappingURL=XDomainRequest.js.map"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA"}
|
||||
Reference in New Issue
Block a user