@microsoft/1ds-post-js 4.0.0 → 4.0.2-nightly3.2307-24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +10 -26
  2. package/bundle/es5/{ms.post-4.0.0.gbl.js → ms.post-4.0.2-nightly3.2307-24.gbl.js} +707 -524
  3. package/bundle/es5/ms.post-4.0.2-nightly3.2307-24.gbl.js.map +1 -0
  4. package/bundle/es5/ms.post-4.0.2-nightly3.2307-24.gbl.min.js +7 -0
  5. package/bundle/es5/ms.post-4.0.2-nightly3.2307-24.gbl.min.js.map +1 -0
  6. package/bundle/es5/ms.post-4.0.2-nightly3.2307-24.integrity.json +46 -0
  7. package/bundle/es5/{ms.post-4.0.0.js → ms.post-4.0.2-nightly3.2307-24.js} +707 -524
  8. package/bundle/es5/ms.post-4.0.2-nightly3.2307-24.js.map +1 -0
  9. package/bundle/es5/ms.post-4.0.2-nightly3.2307-24.min.js +7 -0
  10. package/bundle/es5/ms.post-4.0.2-nightly3.2307-24.min.js.map +1 -0
  11. package/bundle/es5/ms.post.gbl.js +706 -523
  12. package/bundle/es5/ms.post.gbl.js.map +1 -1
  13. package/bundle/es5/ms.post.gbl.min.js +2 -2
  14. package/bundle/es5/ms.post.gbl.min.js.map +1 -1
  15. package/bundle/es5/ms.post.integrity.json +17 -17
  16. package/bundle/es5/ms.post.js +706 -523
  17. package/bundle/es5/ms.post.js.map +1 -1
  18. package/bundle/es5/ms.post.min.js +2 -2
  19. package/bundle/es5/ms.post.min.js.map +1 -1
  20. package/dist/es5/ms.post.js +704 -521
  21. package/dist/es5/ms.post.js.map +1 -1
  22. package/dist/es5/ms.post.min.js +2 -2
  23. package/dist/es5/ms.post.min.js.map +1 -1
  24. package/dist-es5/BatchNotificationActions.js +1 -1
  25. package/dist-es5/ClockSkewManager.js +8 -8
  26. package/dist-es5/ClockSkewManager.js.map +1 -1
  27. package/dist-es5/DataModels.js +1 -1
  28. package/dist-es5/EventBatch.js +13 -12
  29. package/dist-es5/EventBatch.js.map +1 -1
  30. package/dist-es5/HttpManager.js +173 -173
  31. package/dist-es5/HttpManager.js.map +1 -1
  32. package/dist-es5/Index.js +3 -3
  33. package/dist-es5/Index.js.map +1 -1
  34. package/dist-es5/InternalConstants.js +1 -1
  35. package/dist-es5/KillSwitch.js +8 -8
  36. package/dist-es5/KillSwitch.js.map +1 -1
  37. package/dist-es5/PostChannel.js +92 -90
  38. package/dist-es5/PostChannel.js.map +1 -1
  39. package/dist-es5/RetryPolicy.js +1 -1
  40. package/dist-es5/Serializer.js +4 -5
  41. package/dist-es5/Serializer.js.map +1 -1
  42. package/dist-es5/TimeoutOverrideWrapper.js +1 -1
  43. package/dist-es5/__DynamicConstants.js +83 -0
  44. package/dist-es5/__DynamicConstants.js.map +1 -0
  45. package/dist-es5/typings/XDomainRequest.js +1 -1
  46. package/package.json +40 -24
  47. package/types/1ds-post-js.d.ts +5 -3
  48. package/types/1ds-post-js.namespaced.d.ts +5 -3
  49. package/bundle/es5/ms.post-4.0.0.gbl.js.map +0 -1
  50. package/bundle/es5/ms.post-4.0.0.gbl.min.js +0 -7
  51. package/bundle/es5/ms.post-4.0.0.gbl.min.js.map +0 -1
  52. package/bundle/es5/ms.post-4.0.0.integrity.json +0 -46
  53. package/bundle/es5/ms.post-4.0.0.js.map +0 -1
  54. package/bundle/es5/ms.post-4.0.0.min.js +0 -7
  55. package/bundle/es5/ms.post-4.0.0.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- * 1DS JS SDK POST plugin, 4.0.0
2
+ * 1DS JS SDK POST plugin, 4.0.2-nightly3.2307-24
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  * (Microsoft Internal Only)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*
2
- * 1DS JS SDK POST plugin, 4.0.0
2
+ * 1DS JS SDK POST plugin, 4.0.2-nightly3.2307-24
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  * (Microsoft Internal Only)
5
5
  */
@@ -9,6 +9,7 @@
9
9
  * @copyright Microsoft 2018
10
10
  */
11
11
  import dynamicProto from "@microsoft/dynamicproto-js";
12
+ import { _DYN_ALLOW_REQUEST_SENDIN0, _DYN_FIRST_REQUEST_SENT, _DYN_GET_CLOCK_SKEW_HEADE2, _DYN_SET_CLOCK_SKEW, _DYN_SHOULD_ADD_CLOCK_SKE1 } from "./__DynamicConstants";
12
13
  /**
13
14
  * Class to manage clock skew correction.
14
15
  */
@@ -24,7 +25,7 @@ var ClockSkewManager = /** @class */ (function () {
24
25
  * Determine if requests can be sent.
25
26
  * @returns True if requests can be sent, false otherwise.
26
27
  */
27
- _self.allowRequestSending = function () {
28
+ _self[_DYN_ALLOW_REQUEST_SENDIN0 /* @min:%2eallowRequestSending */] = function () {
28
29
  return _allowRequestSending;
29
30
  };
30
31
  /**
@@ -32,7 +33,7 @@ var ClockSkewManager = /** @class */ (function () {
32
33
  * If this method had not yet been called AND the clock Skew had not been set this will set
33
34
  * allowRequestSending to false until setClockSet() is called.
34
35
  */
35
- _self.firstRequestSent = function () {
36
+ _self[_DYN_FIRST_REQUEST_SENT /* @min:%2efirstRequestSent */] = function () {
36
37
  if (_isFirstRequest) {
37
38
  _isFirstRequest = false;
38
39
  if (!_clockSkewSet) {
@@ -45,14 +46,14 @@ var ClockSkewManager = /** @class */ (function () {
45
46
  * Determine if clock skew headers should be added to the request.
46
47
  * @returns True if clock skew headers should be added, false otherwise.
47
48
  */
48
- _self.shouldAddClockSkewHeaders = function () {
49
+ _self[_DYN_SHOULD_ADD_CLOCK_SKE1 /* @min:%2eshouldAddClockSkewHeaders */] = function () {
49
50
  return _shouldAddClockSkewHeaders;
50
51
  };
51
52
  /**
52
53
  * Gets the clock skew header value.
53
54
  * @returns The clock skew header value.
54
55
  */
55
- _self.getClockSkewHeaderValue = function () {
56
+ _self[_DYN_GET_CLOCK_SKEW_HEADE2 /* @min:%2egetClockSkewHeaderValue */] = function () {
56
57
  return _clockSkewHeaderValue;
57
58
  };
58
59
  /**
@@ -60,7 +61,7 @@ var ClockSkewManager = /** @class */ (function () {
60
61
  * is no-op.
61
62
  * @param timeDeltaInMillis - Time delta to be saved as the clock skew header value.
62
63
  */
63
- _self.setClockSkew = function (timeDeltaInMillis) {
64
+ _self[_DYN_SET_CLOCK_SKEW /* @min:%2esetClockSkew */] = function (timeDeltaInMillis) {
64
65
  if (!_clockSkewSet) {
65
66
  if (timeDeltaInMillis) {
66
67
  _clockSkewHeaderValue = timeDeltaInMillis;
@@ -81,9 +82,8 @@ var ClockSkewManager = /** @class */ (function () {
81
82
  // Removed Stub for ClockSkewManager.prototype.shouldAddClockSkewHeaders.
82
83
  // Removed Stub for ClockSkewManager.prototype.getClockSkewHeaderValue.
83
84
  // Removed Stub for ClockSkewManager.prototype.setClockSkew.
84
- // This is a workaround for an IE8 bug when using dynamicProto() with classes that don't have any
85
+ // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
85
86
  // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
86
- // this will be removed when ES3 support is dropped.
87
87
  ClockSkewManager.__ieDyn=1;
88
88
 
89
89
  return ClockSkewManager;
@@ -1 +1 @@
1
- {"version":3,"file":"ClockSkewManager.js.map","sources":["ClockSkewManager.js"],"sourcesContent":["/**\r\n* ClockSkewManager.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\n/**\r\n* Class to manage clock skew correction.\r\n*/\r\nvar ClockSkewManager = /** @class */ (function () {\r\n function ClockSkewManager() {\r\n var _allowRequestSending = true;\r\n var _shouldAddClockSkewHeaders = true;\r\n var _isFirstRequest = true;\r\n var _clockSkewHeaderValue = \"use-collector-delta\";\r\n var _clockSkewSet = false;\r\n dynamicProto(ClockSkewManager, this, function (_self) {\r\n /**\r\n * Determine if requests can be sent.\r\n * @returns True if requests can be sent, false otherwise.\r\n */\r\n _self.allowRequestSending = function () {\r\n return _allowRequestSending;\r\n };\r\n /**\r\n * Tells the ClockSkewManager that it should assume that the first request has now been sent,\r\n * If this method had not yet been called AND the clock Skew had not been set this will set\r\n * allowRequestSending to false until setClockSet() is called.\r\n */\r\n _self.firstRequestSent = function () {\r\n if (_isFirstRequest) {\r\n _isFirstRequest = false;\r\n if (!_clockSkewSet) {\r\n // Block sending until we get the first clock Skew\r\n _allowRequestSending = false;\r\n }\r\n }\r\n };\r\n /**\r\n * Determine if clock skew headers should be added to the request.\r\n * @returns True if clock skew headers should be added, false otherwise.\r\n */\r\n _self.shouldAddClockSkewHeaders = function () {\r\n return _shouldAddClockSkewHeaders;\r\n };\r\n /**\r\n * Gets the clock skew header value.\r\n * @returns The clock skew header value.\r\n */\r\n _self.getClockSkewHeaderValue = function () {\r\n return _clockSkewHeaderValue;\r\n };\r\n /**\r\n * Sets the clock skew header value. Once clock skew is set this method\r\n * is no-op.\r\n * @param timeDeltaInMillis - Time delta to be saved as the clock skew header value.\r\n */\r\n _self.setClockSkew = function (timeDeltaInMillis) {\r\n if (!_clockSkewSet) {\r\n if (timeDeltaInMillis) {\r\n _clockSkewHeaderValue = timeDeltaInMillis;\r\n _shouldAddClockSkewHeaders = true;\r\n _clockSkewSet = true;\r\n }\r\n else {\r\n _shouldAddClockSkewHeaders = false;\r\n }\r\n // Unblock sending\r\n _allowRequestSending = true;\r\n }\r\n };\r\n });\r\n }\r\n /**\r\n * Determine if the request can be sent.\r\n * @returns True if requests can be sent, false otherwise.\r\n */\r\n ClockSkewManager.prototype.allowRequestSending = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n /**\r\n * Tells the ClockSkewManager that it should assume that the first request has now been sent,\r\n * If this method had not yet been called AND the clock Skew had not been set this will set\r\n * allowRequestSending to false until setClockSet() is called.\r\n */\r\n ClockSkewManager.prototype.firstRequestSent = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Determine if clock skew headers should be added to the request.\r\n * @returns True if clock skew headers should be added, false otherwise.\r\n */\r\n ClockSkewManager.prototype.shouldAddClockSkewHeaders = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n /**\r\n * Gets the clock skew header value.\r\n * @returns The clock skew header value.\r\n */\r\n ClockSkewManager.prototype.getClockSkewHeaderValue = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Sets the clock skew header value. Once clock skew is set this method\r\n * is no-op.\r\n * @param timeDeltaInMillis - Time delta to be saved as the clock skew header value.\r\n */\r\n ClockSkewManager.prototype.setClockSkew = function (timeDeltaInMillis) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n return ClockSkewManager;\r\n}());\r\nexport { ClockSkewManager };\r\n//# sourceMappingURL=ClockSkewManager.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;;;;4DAuCM,CAAC;;;;;;4BACqB;AAC5B;AACA;AACA"}
1
+ {"version":3,"file":"ClockSkewManager.js.map","sources":["ClockSkewManager.js"],"sourcesContent":["/**\r\n* ClockSkewManager.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { _DYN_ALLOW_REQUEST_SENDIN0, _DYN_FIRST_REQUEST_SENT, _DYN_GET_CLOCK_SKEW_HEADE2, _DYN_SET_CLOCK_SKEW, _DYN_SHOULD_ADD_CLOCK_SKE1 } from \"./__DynamicConstants\";\r\n/**\r\n* Class to manage clock skew correction.\r\n*/\r\nvar ClockSkewManager = /** @class */ (function () {\r\n function ClockSkewManager() {\r\n var _allowRequestSending = true;\r\n var _shouldAddClockSkewHeaders = true;\r\n var _isFirstRequest = true;\r\n var _clockSkewHeaderValue = \"use-collector-delta\";\r\n var _clockSkewSet = false;\r\n dynamicProto(ClockSkewManager, this, function (_self) {\r\n /**\r\n * Determine if requests can be sent.\r\n * @returns True if requests can be sent, false otherwise.\r\n */\r\n _self[_DYN_ALLOW_REQUEST_SENDIN0 /* @min:%2eallowRequestSending */] = function () {\r\n return _allowRequestSending;\r\n };\r\n /**\r\n * Tells the ClockSkewManager that it should assume that the first request has now been sent,\r\n * If this method had not yet been called AND the clock Skew had not been set this will set\r\n * allowRequestSending to false until setClockSet() is called.\r\n */\r\n _self[_DYN_FIRST_REQUEST_SENT /* @min:%2efirstRequestSent */] = function () {\r\n if (_isFirstRequest) {\r\n _isFirstRequest = false;\r\n if (!_clockSkewSet) {\r\n // Block sending until we get the first clock Skew\r\n _allowRequestSending = false;\r\n }\r\n }\r\n };\r\n /**\r\n * Determine if clock skew headers should be added to the request.\r\n * @returns True if clock skew headers should be added, false otherwise.\r\n */\r\n _self[_DYN_SHOULD_ADD_CLOCK_SKE1 /* @min:%2eshouldAddClockSkewHeaders */] = function () {\r\n return _shouldAddClockSkewHeaders;\r\n };\r\n /**\r\n * Gets the clock skew header value.\r\n * @returns The clock skew header value.\r\n */\r\n _self[_DYN_GET_CLOCK_SKEW_HEADE2 /* @min:%2egetClockSkewHeaderValue */] = function () {\r\n return _clockSkewHeaderValue;\r\n };\r\n /**\r\n * Sets the clock skew header value. Once clock skew is set this method\r\n * is no-op.\r\n * @param timeDeltaInMillis - Time delta to be saved as the clock skew header value.\r\n */\r\n _self[_DYN_SET_CLOCK_SKEW /* @min:%2esetClockSkew */] = function (timeDeltaInMillis) {\r\n if (!_clockSkewSet) {\r\n if (timeDeltaInMillis) {\r\n _clockSkewHeaderValue = timeDeltaInMillis;\r\n _shouldAddClockSkewHeaders = true;\r\n _clockSkewSet = true;\r\n }\r\n else {\r\n _shouldAddClockSkewHeaders = false;\r\n }\r\n // Unblock sending\r\n _allowRequestSending = true;\r\n }\r\n };\r\n });\r\n }\r\n /**\r\n * Determine if the request can be sent.\r\n * @returns True if requests can be sent, false otherwise.\r\n */\r\n ClockSkewManager.prototype.allowRequestSending = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n /**\r\n * Tells the ClockSkewManager that it should assume that the first request has now been sent,\r\n * If this method had not yet been called AND the clock Skew had not been set this will set\r\n * allowRequestSending to false until setClockSet() is called.\r\n */\r\n ClockSkewManager.prototype.firstRequestSent = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Determine if clock skew headers should be added to the request.\r\n * @returns True if clock skew headers should be added, false otherwise.\r\n */\r\n ClockSkewManager.prototype.shouldAddClockSkewHeaders = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n /**\r\n * Gets the clock skew header value.\r\n * @returns The clock skew header value.\r\n */\r\n ClockSkewManager.prototype.getClockSkewHeaderValue = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Sets the clock skew header value. Once clock skew is set this method\r\n * is no-op.\r\n * @param timeDeltaInMillis - Time delta to be saved as the clock skew header value.\r\n */\r\n ClockSkewManager.prototype.setClockSkew = function (timeDeltaInMillis) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n return ClockSkewManager;\r\n}());\r\nexport { ClockSkewManager };\r\n//# sourceMappingURL=ClockSkewManager.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;;;;4DAuCM,CAAC;;;;;4BACqB;AAC5B;AACA;AACA"}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * 1DS JS SDK POST plugin, 4.0.0
2
+ * 1DS JS SDK POST plugin, 4.0.2-nightly3.2307-24
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  * (Microsoft Internal Only)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*
2
- * 1DS JS SDK POST plugin, 4.0.0
2
+ * 1DS JS SDK POST plugin, 4.0.2-nightly3.2307-24
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  * (Microsoft Internal Only)
5
5
  */
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import { isNullOrUndefined, isValueAssigned } from "@microsoft/1ds-core-js";
12
12
  import { STR_EMPTY, STR_MSFPC } from "./InternalConstants";
13
+ import { _DYN_CONCAT, _DYN_COUNT, _DYN_EVENTS, _DYN_I_KEY, _DYN_LENGTH, _DYN_PUSH, _DYN_SPLICE, _DYN_SPLIT } from "./__DynamicConstants";
13
14
  function _getEventMsfpc(theEvent) {
14
15
  var intWeb = ((theEvent.ext || {})["intweb"]);
15
16
  if (intWeb && isValueAssigned(intWeb[STR_MSFPC])) {
@@ -19,7 +20,7 @@ function _getEventMsfpc(theEvent) {
19
20
  }
20
21
  function _getMsfpc(theEvents) {
21
22
  var msfpc = null;
22
- for (var lp = 0; msfpc === null && lp < theEvents.length; lp++) {
23
+ for (var lp = 0; msfpc === null && lp < theEvents[_DYN_LENGTH /* @min:%2elength */]; lp++) {
23
24
  msfpc = _getEventMsfpc(theEvents[lp]);
24
25
  }
25
26
  return msfpc;
@@ -37,25 +38,25 @@ var EventBatch = /** @class */ (function () {
37
38
  * @param addEvents - The optional collection of events to assign to this batch - defaults to an empty array.
38
39
  */
39
40
  function EventBatch(iKey, addEvents) {
40
- var events = addEvents ? [].concat(addEvents) : [];
41
+ var events = addEvents ? [][_DYN_CONCAT /* @min:%2econcat */](addEvents) : [];
41
42
  var _self = this;
42
43
  var _msfpc = _getMsfpc(events);
43
- _self.iKey = function () {
44
+ _self[_DYN_I_KEY /* @min:%2eiKey */] = function () {
44
45
  return iKey;
45
46
  };
46
47
  _self.Msfpc = function () {
47
48
  // return the cached value unless it's undefined -- used to avoid cpu
48
49
  return _msfpc || STR_EMPTY;
49
50
  };
50
- _self.count = function () {
51
- return events.length;
51
+ _self[_DYN_COUNT /* @min:%2ecount */] = function () {
52
+ return events[_DYN_LENGTH /* @min:%2elength */];
52
53
  };
53
- _self.events = function () {
54
+ _self[_DYN_EVENTS /* @min:%2eevents */] = function () {
54
55
  return events;
55
56
  };
56
57
  _self.addEvent = function (theEvent) {
57
58
  if (theEvent) {
58
- events.push(theEvent);
59
+ events[_DYN_PUSH /* @min:%2epush */](theEvent);
59
60
  if (!_msfpc) {
60
61
  // Not found so try and find one
61
62
  _msfpc = _getEventMsfpc(theEvent);
@@ -64,15 +65,15 @@ var EventBatch = /** @class */ (function () {
64
65
  }
65
66
  return false;
66
67
  };
67
- _self.split = function (fromEvent, numEvents) {
68
+ _self[_DYN_SPLIT /* @min:%2esplit */] = function (fromEvent, numEvents) {
68
69
  // Create a new batch with the same iKey
69
70
  var theEvents;
70
- if (fromEvent < events.length) {
71
- var cnt = events.length - fromEvent;
71
+ if (fromEvent < events[_DYN_LENGTH /* @min:%2elength */]) {
72
+ var cnt = events[_DYN_LENGTH /* @min:%2elength */] - fromEvent;
72
73
  if (!isNullOrUndefined(numEvents)) {
73
74
  cnt = numEvents < cnt ? numEvents : cnt;
74
75
  }
75
- theEvents = events.splice(fromEvent, cnt);
76
+ theEvents = events[_DYN_SPLICE /* @min:%2esplice */](fromEvent, cnt);
76
77
  // reset the fetched msfpc value
77
78
  _msfpc = _getMsfpc(events);
78
79
  }
@@ -1 +1 @@
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\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.length; 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 ? [].concat(addEvents) : [];\r\n var _self = this;\r\n var _msfpc = _getMsfpc(events);\r\n _self.iKey = 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.count = function () {\r\n return events.length;\r\n };\r\n _self.events = function () {\r\n return events;\r\n };\r\n _self.addEvent = function (theEvent) {\r\n if (theEvent) {\r\n events.push(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.split = function (fromEvent, numEvents) {\r\n // Create a new batch with the same iKey\r\n var theEvents;\r\n if (fromEvent < events.length) {\r\n var cnt = events.length - 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"}
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_SPLICE, _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[_DYN_SPLICE /* @min:%2esplice */](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"}