@microsoft/1ds-post-js 4.4.0-nightlybeta3.2504-17 → 4.4.0-nightlybeta3.2505-12

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 (50) hide show
  1. package/README.md +1 -0
  2. package/bundle/es5/{ms.post-4.4.0-nightlybeta3.2504-17.gbl.js → ms.post-4.4.0-nightlybeta3.2505-12.gbl.js} +173 -44
  3. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2505-12.gbl.js.map +1 -0
  4. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2505-12.gbl.min.js +7 -0
  5. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2505-12.gbl.min.js.map +1 -0
  6. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2505-12.integrity.json +46 -0
  7. package/bundle/es5/{ms.post-4.4.0-nightlybeta3.2504-17.js → ms.post-4.4.0-nightlybeta3.2505-12.js} +173 -44
  8. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2505-12.js.map +1 -0
  9. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2505-12.min.js +7 -0
  10. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2505-12.min.js.map +1 -0
  11. package/bundle/es5/ms.post.gbl.js +172 -43
  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 +172 -43
  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 +170 -41
  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 +1 -1
  26. package/dist-es5/DataModels.js +1 -1
  27. package/dist-es5/EventBatch.js +1 -1
  28. package/dist-es5/HttpManager.js +32 -17
  29. package/dist-es5/HttpManager.js.map +1 -1
  30. package/dist-es5/Index.js +1 -1
  31. package/dist-es5/InternalConstants.js +1 -1
  32. package/dist-es5/KillSwitch.js +1 -1
  33. package/dist-es5/PostChannel.js +10 -4
  34. package/dist-es5/PostChannel.js.map +1 -1
  35. package/dist-es5/RetryPolicy.js +1 -1
  36. package/dist-es5/Serializer.js +26 -4
  37. package/dist-es5/Serializer.js.map +1 -1
  38. package/dist-es5/TimeoutOverrideWrapper.js +1 -1
  39. package/dist-es5/__DynamicConstants.js +1 -1
  40. package/dist-es5/typings/XDomainRequest.js +1 -1
  41. package/package.json +2 -2
  42. package/types/1ds-post-js.d.ts +27 -1
  43. package/types/1ds-post-js.namespaced.d.ts +28 -32
  44. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2504-17.gbl.js.map +0 -1
  45. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2504-17.gbl.min.js +0 -7
  46. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2504-17.gbl.min.js.map +0 -1
  47. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2504-17.integrity.json +0 -46
  48. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2504-17.js.map +0 -1
  49. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2504-17.min.js +0 -7
  50. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2504-17.min.js.map +0 -1
package/README.md CHANGED
@@ -66,6 +66,7 @@ appInsightsCore.initialize(coreConfig, []);
66
66
  | maxEventRetryAttempts<br /><sub><i>(Since 3.1.11+)</i></sub> | [Optional] Identifies the number of times any single event will be retried if it receives a failed (retirable) response, this causes the event to be internally "requeued" and resent in the next batch. As each normal batched send request is retried at least once before starting to increase the internal backoff send interval, normally batched events will generally be attempted the next nearest even number of times. This means that the total number of actual send attempts will almost always be even (setting to 5 will cause 6 requests), unless using manual synchronous flushing (calling flush(false)) which is not subject to request level retry attempts. | number<br/>Default: 6
67
67
  | maxUnloadEventRetryAttempts<br /><sub><i>(Since 3.1.11+)</i></sub> | [Optional] Identifies the number of times any single event will be retried if it receives a failed (retriable) response as part of processing / flushing events once a page unload state has been detected, this causes the event to be internally "requeued" and resent in the next batch, which during page unload. Unlike the normal batching process, send requests are never retried, so the value listed here is always the maximum number of attempts for any single event.<br/>Notes: The SDK by default will use the sendBeacon() API if it exists which is treated as a fire and forget successful response, so for environments that support or supply this API the events won't be retried (because they will be deeded to be successfully sent). When an environment (IE) doesn't support sendBeacon(), this will cause multiple synchronous (by default) XMLHttpRequests to be sent, which will block the UI until a response is received. You can disable ALL synchronous XHR requests by setting the 'disableXhrSync' configuration setting and/or changing this value to 0 or 1. | number<br/>Default: 2
68
68
  | addNoResponse <br /><sub><i>(Since 3.2.8+)</i></sub> | [Optional] flag to indicate whether the sendBeacon and fetch (with keep-alive flag) should add the "NoResponseBody" query string value to indicate that the server should return a 204 for successful requests. | boolean<br/>Default: true
69
+ | disableZip <br /><sub><i>(Since 4.3.7+)</i></sub> | [Optional] flag to use CompressionStream API to compress the payload. Compression will only occur if the event is asynchronous. For events like unloads, compression will not be applied. * Note: if user set payloadPreprocessor, this zip compression will not be applied. | boolean<br/>Default: true
69
70
 
70
71
  ### [IXHROverride](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IXHROverride.html)
71
72
 
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * 1DS JS SDK POST plugin, 4.4.0-nightlybeta3.2504-17
2
+ * 1DS JS SDK POST plugin, 4.4.0-nightlybeta3.2505-12
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  * (Microsoft Internal Only)
5
5
  */
6
6
  (function (global, factory) {
7
7
  var undef = "undefined";
8
- var nsKey, key, nm, theExports = {}, modName = "es5_ms_post_4_4_0_nightlybeta3_2504_17", msMod="__ms$mod__";
9
- var mods={}, modDetail=mods[modName]={}, ver="4.4.0-nightlybeta3.2504-17";
8
+ var nsKey, key, nm, theExports = {}, modName = "es5_ms_post_4_4_0_nightlybeta3_2505_12", msMod="__ms$mod__";
9
+ var mods={}, modDetail=mods[modName]={}, ver="4.4.0-nightlybeta3.2505-12";
10
10
  // Versioned namespace "oneDS4"
11
11
  var exportNs=global, nsKey="oneDS4", exportNs=exportNs[nsKey]=(exportNs[nsKey]||{});
12
12
  // Global namespace "oneDS"
@@ -37,7 +37,7 @@ var strShimPrototype = "prototype";
37
37
  var ObjClass$1 = Object;
38
38
  var ObjProto$1 = ObjClass$1[strShimPrototype];
39
39
 
40
- /*! https://github.com/nevware21/ts-utils v0.12.2 */
40
+ /*! https://github.com/nevware21/ts-utils v0.12.3 */
41
41
  /*#__NO_SIDE_EFFECTS__*/
42
42
  function _pureAssign(func1, func2) {
43
43
  return func1 || func2;
@@ -60,6 +60,7 @@ var LENGTH = "length";
60
60
  var NAME = "name";
61
61
  var CALL = "call";
62
62
  var TO_STRING = "toString";
63
+ var GET_OWN_PROPERTY_DESCRIPTOR = "getOwnPropertyDescriptor";
63
64
  var ObjClass = ( /*#__PURE__*/_pureAssign(Object));
64
65
  var ObjProto = ( /*#__PURE__*/_pureRef(ObjClass, PROTOTYPE));
65
66
  var StrCls = ( /*#__PURE__*/_pureAssign(String));
@@ -122,6 +123,12 @@ var isBoolean = ( /*#__PURE__*/_createIs("boolean"));
122
123
  function isPromiseLike(value) {
123
124
  return !!(value && value.then && isFunction(value.then));
124
125
  }
126
+ function _returnNothing() {
127
+ return;
128
+ }
129
+ function _returnFalse() {
130
+ return false;
131
+ }
125
132
  var asString = ( /* #__PURE__ */_pureAssign(StrCls));
126
133
  var ERROR_TYPE = "[object Error]";
127
134
  /*#__NO_SIDE_EFFECTS__*/
@@ -153,20 +160,17 @@ function _throwIfNotString(value) {
153
160
  throwTypeError("'" + dumpObj(value) + "' is not a string");
154
161
  }
155
162
  }
156
- function _returnNothing() {
157
- return UNDEF_VALUE;
158
- }
159
- var objGetOwnPropertyDescriptor = ( /* #__PURE__ */_pureAssign(( /* #__PURE__ */_pureRef(ObjClass, "getOwnPropertyDescriptor")), _returnNothing));
160
163
  /*#__NO_SIDE_EFFECTS__*/
161
164
  function objHasOwnProperty(obj, prop) {
162
165
  return !!obj && ObjProto.hasOwnProperty[CALL](obj, prop);
163
166
  }
167
+ var _objGetOwnPropertyDescriptor$2 = ( /* #__PURE__ */_pureAssign(( /* #__PURE__ */_pureRef(ObjClass, GET_OWN_PROPERTY_DESCRIPTOR)), _returnNothing));
168
+ var objHasOwn = ( /*#__PURE__*/_pureAssign(( /* #__PURE__ */_pureRef(ObjClass, "hasOwn")), polyObjHasOwn));
164
169
  /*#__NO_SIDE_EFFECTS__*/
165
170
  function polyObjHasOwn(obj, prop) {
166
171
  _throwIfNullOrUndefined(obj);
167
- return objHasOwnProperty(obj, prop) || !!objGetOwnPropertyDescriptor(obj, prop);
172
+ return objHasOwnProperty(obj, prop) || !!_objGetOwnPropertyDescriptor$2(obj, prop);
168
173
  }
169
- var objHasOwn = ( /*#__PURE__*/_pureAssign(( /* #__PURE__ */_pureRef(ObjClass, "hasOwn")), polyObjHasOwn));
170
174
  function objForEachKey(theObject, callbackfn, thisArg) {
171
175
  if (theObject && (isObject(theObject) || isFunction(theObject))) {
172
176
  for (var prop in theObject) {
@@ -203,6 +207,7 @@ function _unwrapFunctionWithPoly(funcName, clsProto, polyFunc) {
203
207
  throwTypeError("\"" + asString(funcName) + "\" not defined for " + dumpObj(thisArg));
204
208
  };
205
209
  }
210
+ var _objGetOwnPropertyDescriptor$1 = ( /* #__PURE__ */_pureAssign(( /* #__PURE__ */_pureRef(ObjClass, GET_OWN_PROPERTY_DESCRIPTOR)), _returnNothing));
206
211
  var propMap = {
207
212
  e: "enumerable",
208
213
  c: "configurable",
@@ -218,7 +223,7 @@ function _createProp(value) {
218
223
  prop[propMap["e"]] = true;
219
224
  if (value.l) {
220
225
  prop.get = function () { return value.l.v; };
221
- var desc = objGetOwnPropertyDescriptor(value.l, "v");
226
+ var desc = _objGetOwnPropertyDescriptor$1(value.l, "v");
222
227
  if (desc && desc.set) {
223
228
  prop.set = function (newValue) {
224
229
  value.l.v = newValue;
@@ -251,9 +256,6 @@ function _assignMapValue(theMap, key, value, writable) {
251
256
  writable: false
252
257
  });
253
258
  }
254
- function _returnFalse() {
255
- return false;
256
- }
257
259
  var objIsFrozen = ( /* #__PURE__*/_pureAssign(( /* #__PURE__ */_pureRef(ObjClass, "isFrozen")), _returnFalse));
258
260
  var _objFreeze = ( /* #__PURE__ */_pureRef(ObjClass, "freeze"));
259
261
  function _doNothing(value) {
@@ -411,19 +413,22 @@ function utcNow() {
411
413
  function polyUtcNow() {
412
414
  return new Date().getTime();
413
415
  }
416
+ function fnApply(fn, thisArg, argArray) {
417
+ return fn.apply(thisArg, argArray);
418
+ }
414
419
  var _globalLazyTestHooks;
415
420
  function _initTestHooks() {
416
421
  _globalLazyTestHooks = _getGlobalConfig();
417
422
  }
418
423
  /*#__NO_SIDE_EFFECTS__*/
419
- function getLazy(cb) {
424
+ function getLazy(cb, argArray) {
420
425
  var lazyValue = {};
421
426
  !_globalLazyTestHooks && _initTestHooks();
422
427
  lazyValue.b = _globalLazyTestHooks.lzy;
423
428
  objDefineProp(lazyValue, "v", {
424
429
  configurable: true,
425
430
  get: function () {
426
- var result = cb();
431
+ var result = fnApply(cb, null, argArray);
427
432
  if (!_globalLazyTestHooks.lzy) {
428
433
  objDefineProp(lazyValue, "v", {
429
434
  value: result
@@ -646,9 +651,6 @@ function iterForOf(iter, callbackfn, thisArg) {
646
651
  }
647
652
  }
648
653
  }
649
- function fnApply(fn, thisArg, argArray) {
650
- return fn.apply(thisArg, argArray);
651
- }
652
654
  function arrAppend(target, elms) {
653
655
  if (!isUndefined(elms) && target) {
654
656
  if (isArray(elms)) {
@@ -767,6 +769,7 @@ function isPlainObject(value) {
767
769
  function perfNow() {
768
770
  return utcNow();
769
771
  }
772
+ var objGetOwnPropertyDescriptor = ( /* #__PURE__ */_pureAssign(( /* #__PURE__ */_pureRef(ObjClass, GET_OWN_PROPERTY_DESCRIPTOR)), _returnNothing));
770
773
  var strIndexOf = ( /*#__PURE__*/_unwrapFunction("indexOf", StrProto));
771
774
  var strStartsWith = ( /*#__PURE__*/_unwrapFunctionWithPoly("startsWith", StrProto, polyStrStartsWith));
772
775
  /*#__NO_SIDE_EFFECTS__*/
@@ -832,11 +835,33 @@ function _createTimerHandler(startTimer, refreshFn, cancelFn) {
832
835
  }
833
836
  };
834
837
  }
838
+ var _setTimeoutFn;
839
+ var _clearTimeoutFn;
840
+ function _resolveTimeoutFn(timeoutFn) {
841
+ var result = isFunction(timeoutFn) ? timeoutFn : _setTimeoutFn;
842
+ if (!result) {
843
+ var globalOverrides = _getGlobalConfig().tmOut || [];
844
+ if (isArray(globalOverrides) && globalOverrides.length > 0 && isFunction(globalOverrides[0])) {
845
+ result = globalOverrides[0];
846
+ }
847
+ }
848
+ return result || setTimeout;
849
+ }
850
+ function _resolveClearTimeoutFn(timeoutFn) {
851
+ var result = isFunction(timeoutFn) ? timeoutFn : _clearTimeoutFn;
852
+ if (!result) {
853
+ var globalOverrides = _getGlobalConfig().tmOut || [];
854
+ if (isArray(globalOverrides) && globalOverrides.length > 1 && isFunction(globalOverrides[1])) {
855
+ result = globalOverrides[1];
856
+ }
857
+ }
858
+ return result || clearTimeout;
859
+ }
835
860
  function _createTimeoutWith(startTimer, overrideFn, theArgs) {
836
861
  var isArr = isArray(overrideFn);
837
862
  var len = isArr ? overrideFn.length : 0;
838
- var setFn = (len > 0 ? overrideFn[0] : (!isArr ? overrideFn : UNDEF_VALUE)) || setTimeout;
839
- var clearFn = (len > 1 ? overrideFn[1] : UNDEF_VALUE) || clearTimeout;
863
+ var setFn = _resolveTimeoutFn(len > 0 ? overrideFn[0] : (!isArr ? overrideFn : UNDEF_VALUE));
864
+ var clearFn = _resolveClearTimeoutFn(len > 1 ? overrideFn[1] : UNDEF_VALUE);
840
865
  var timerFn = theArgs[0];
841
866
  theArgs[0] = function () {
842
867
  handler.dn();
@@ -1193,8 +1218,8 @@ var _DYN_IS_CHILD_EVT = "isChildEvt";
1193
1218
  var _DYN_DATA = "data";
1194
1219
  var _DYN_GET_CTX = "getCtx";
1195
1220
  var _DYN_SET_CTX = "setCtx";
1196
- var _DYN_URL_STRING = "urlString";
1197
1221
  var _DYN_HEADERS$1 = "headers";
1222
+ var _DYN_URL_STRING = "urlString";
1198
1223
  var _DYN_TIMEOUT = "timeout";
1199
1224
 
1200
1225
  var aggregationErrorType;
@@ -1607,6 +1632,19 @@ function optimizeObject(theObject) {
1607
1632
  }
1608
1633
  return theObject;
1609
1634
  }
1635
+ function isFeatureEnabled(feature, cfg, sdkDefaultState) {
1636
+ var ft = cfg && cfg.featureOptIn && cfg.featureOptIn[feature];
1637
+ if (feature && ft) {
1638
+ var mode = ft.mode;
1639
+ if (mode === 3 ) {
1640
+ return true;
1641
+ }
1642
+ else if (mode === 2 ) {
1643
+ return false;
1644
+ }
1645
+ }
1646
+ return sdkDefaultState;
1647
+ }
1610
1648
  function getResponseText(xhr) {
1611
1649
  try {
1612
1650
  return xhr.responseText;
@@ -1911,7 +1949,7 @@ function newId(maxLength) {
1911
1949
  return result;
1912
1950
  }
1913
1951
 
1914
- var version = '3.4.0-nightlybeta3.2504-17';
1952
+ var version = '3.4.0-nightlybeta3.2505-12';
1915
1953
  var instanceName = "." + newId(6);
1916
1954
  var _dataUid = 0;
1917
1955
  function _canAcceptData(target) {
@@ -3524,6 +3562,59 @@ var SenderPostManager = /** @class */ (function () {
3524
3562
  _self[_DYN__DO_TEARDOWN ] = function (unloadCtx, unloadState) {
3525
3563
  _initDefaults();
3526
3564
  };
3565
+ _self.preparePayload = function (callback, zipPayload, payload, isSync) {
3566
+ if (!zipPayload || isSync || !payload[_DYN_DATA ]) {
3567
+ callback(payload);
3568
+ return;
3569
+ }
3570
+ try {
3571
+ var csStream = getInst("CompressionStream");
3572
+ if (!isFunction(csStream)) {
3573
+ callback(payload);
3574
+ return;
3575
+ }
3576
+ var body = new ReadableStream({
3577
+ start: function (controller) {
3578
+ controller.enqueue(isString(payload[_DYN_DATA ]) ? new TextEncoder().encode(payload[_DYN_DATA ]) : payload[_DYN_DATA ]);
3579
+ controller.close();
3580
+ }
3581
+ });
3582
+ var compressedStream = body.pipeThrough(new csStream("gzip"));
3583
+ var reader_1 = compressedStream.getReader();
3584
+ var chunks_1 = [];
3585
+ var totalLength_1 = 0;
3586
+ var callbackCalled_1 = false;
3587
+ doAwaitResponse(reader_1.read(), function processChunk(response) {
3588
+ if (!callbackCalled_1 && !response.rejected) {
3589
+ var result = response[_DYN_VALUE$1 ];
3590
+ if (!result.done) {
3591
+ chunks_1[_DYN_PUSH$1 ](result[_DYN_VALUE$1 ]);
3592
+ totalLength_1 += result.value[_DYN_LENGTH$2 ];
3593
+ return doAwaitResponse(reader_1.read(), processChunk);
3594
+ }
3595
+ var combined = new Uint8Array(totalLength_1);
3596
+ var offset = 0;
3597
+ for (var _i = 0, chunks_2 = chunks_1; _i < chunks_2.length; _i++) {
3598
+ var chunk = chunks_2[_i];
3599
+ combined.set(chunk, offset);
3600
+ offset += chunk[_DYN_LENGTH$2 ];
3601
+ }
3602
+ payload[_DYN_DATA ] = combined;
3603
+ payload[_DYN_HEADERS$1 ]["Content-Encoding"] = "gzip";
3604
+ payload._chunkCount = chunks_1[_DYN_LENGTH$2 ];
3605
+ }
3606
+ if (!callbackCalled_1) {
3607
+ callbackCalled_1 = true;
3608
+ callback(payload);
3609
+ }
3610
+ });
3611
+ return reader_1;
3612
+ }
3613
+ catch (error) {
3614
+ callback(payload);
3615
+ return;
3616
+ }
3617
+ };
3527
3618
  function _onSuccess(res, onComplete) {
3528
3619
  _doOnComplete(onComplete, 200, {}, res);
3529
3620
  }
@@ -4185,7 +4276,7 @@ var _DYN_LENGTH$1 = "length";
4185
4276
  var _DYN_PROCESS_TELEMETRY_ST0 = "processTelemetryStart";
4186
4277
 
4187
4278
  var _a$1;
4188
- var Version = '4.4.0-nightlybeta3.2504-17';
4279
+ var Version = '4.4.0-nightlybeta3.2505-12';
4189
4280
  var FullVersionString = "1DS-Web-JS-" + Version;
4190
4281
  var ObjHasOwnProperty = ObjProto$1.hasOwnProperty;
4191
4282
  var _fieldTypeEventPropMap = (_a$1 = {},
@@ -4623,7 +4714,7 @@ var metadata = "metadata";
4623
4714
  var f = "f";
4624
4715
  var rCheckDot = /\./;
4625
4716
  var Serializer = /** @class */ (function () {
4626
- function Serializer(perfManager, valueSanitizer, stringifyObjects, enableCompoundKey, getEncodedTypeOverride, excludeCsMetaData) {
4717
+ function Serializer(perfManager, valueSanitizer, stringifyObjects, enableCompoundKey, getEncodedTypeOverride, excludeCsMetaData, cfg) {
4627
4718
  var strData = "data";
4628
4719
  var strBaseData = "baseData";
4629
4720
  var strExt = "ext";
@@ -4633,6 +4724,11 @@ var Serializer = /** @class */ (function () {
4633
4724
  var _isReservedCache = {};
4634
4725
  var _excludeCsMetaData = !!excludeCsMetaData;
4635
4726
  var _getEncodedType = getEncodedTypeOverride || getCommonSchemaMetaData;
4727
+ var _sizeCfg = _getSizeLimtCfg(cfg);
4728
+ var _requestSizeLimitBytes = _validateSizeLimit(_sizeCfg.requestLimit, RequestSizeLimitBytes, 0);
4729
+ var _beaconRequestSizeLimitBytes = _validateSizeLimit(_sizeCfg.requestLimit, BeaconRequestSizeLimitBytes, 1);
4730
+ var _maxRecordSize = _validateSizeLimit(_sizeCfg.recordLimit, MaxRecordSize, 0);
4731
+ var _maxBeaconRecordSize = Math.min(_validateSizeLimit(_sizeCfg.recordLimit, MaxBeaconRecordSize, 1), _beaconRequestSizeLimitBytes);
4636
4732
  dynamicProto(Serializer, this, function (_self) {
4637
4733
  _self.createPayload = function (retryCnt, isTeardown, isSync, isReducedPayload, sendReason, sendType) {
4638
4734
  return {
@@ -4662,8 +4758,8 @@ var Serializer = /** @class */ (function () {
4662
4758
  var sizeExceeded = [];
4663
4759
  var failedEvts = [];
4664
4760
  var isBeaconPayload = payload.isBeacon;
4665
- var requestMaxSize = isBeaconPayload ? BeaconRequestSizeLimitBytes : RequestSizeLimitBytes;
4666
- var recordMaxSize = isBeaconPayload ? MaxBeaconRecordSize : MaxRecordSize;
4761
+ var requestMaxSize = isBeaconPayload ? _beaconRequestSizeLimitBytes : _requestSizeLimitBytes;
4762
+ var recordMaxSize = isBeaconPayload ? _maxBeaconRecordSize : _maxRecordSize;
4667
4763
  var lp = 0;
4668
4764
  var joinCount = 0;
4669
4765
  while (lp < theEvents.length) {
@@ -4826,6 +4922,22 @@ var Serializer = /** @class */ (function () {
4826
4922
  Serializer.__ieDyn=1;
4827
4923
  return Serializer;
4828
4924
  }());
4925
+ function _validateSizeLimit(cfgVal, defaultVal, idx) {
4926
+ if (isArray(cfgVal)) {
4927
+ var val = cfgVal[idx];
4928
+ if (val > 0 && val <= defaultVal) {
4929
+ return val;
4930
+ }
4931
+ }
4932
+ return defaultVal;
4933
+ }
4934
+ function _getSizeLimtCfg(cfg) {
4935
+ var defaultCfg = {};
4936
+ if (cfg && cfg.requestLimit) {
4937
+ return cfg.requestLimit;
4938
+ }
4939
+ return defaultCfg;
4940
+ }
4829
4941
  function _addJSONPropertyMetaData(getEncodedType, json, propKeys, name, propertyValue) {
4830
4942
  if (propertyValue && json) {
4831
4943
  var encodedTypeValue = getEncodedType(propertyValue.value, propertyValue.kind, propertyValue.propertyType);
@@ -4970,6 +5082,7 @@ var HttpManager = /** @class */ (function () {
4970
5082
  var _isUnloading;
4971
5083
  var _useHeaders;
4972
5084
  var _xhrTimeout;
5085
+ var _zipPayload;
4973
5086
  var _disableXhrSync;
4974
5087
  var _disableFetchKeepAlive;
4975
5088
  var _canHaveReducedPayload;
@@ -4983,6 +5096,7 @@ var HttpManager = /** @class */ (function () {
4983
5096
  var _excludeCsMetaData;
4984
5097
  var _sendPostMgr;
4985
5098
  var _fetchCredentials;
5099
+ var _maxEvtPerBatch = maxEventsPerBatch;
4986
5100
  dynamicProto(HttpManager, this, function (_self) {
4987
5101
  _initDefaults();
4988
5102
  var _sendCredentials = true;
@@ -5010,6 +5124,8 @@ var HttpManager = /** @class */ (function () {
5010
5124
  _urlString = endpointUrl + UrlQueryString;
5011
5125
  _useHeaders = !isUndefined(channelConfig[_DYN_AVOID_OPTIONS ]) ? !channelConfig[_DYN_AVOID_OPTIONS ] : true;
5012
5126
  _enableEventTimings = !channelConfig[_DYN_DISABLE_EVENT_TIMING5 ];
5127
+ var maxEvtCfg = channelConfig.maxEvtPerBatch;
5128
+ _maxEvtPerBatch = maxEvtCfg && maxEvtCfg <= maxEventsPerBatch ? maxEvtCfg : maxEventsPerBatch;
5013
5129
  var valueSanitizer = channelConfig.valueSanitizer;
5014
5130
  var stringifyObjects = channelConfig.stringifyObjects;
5015
5131
  var enableCompoundKey = !!coreConfig[_DYN_ENABLE_COMPOUND_KEY ];
@@ -5017,6 +5133,11 @@ var HttpManager = /** @class */ (function () {
5017
5133
  enableCompoundKey = !!channelConfig[_DYN_ENABLE_COMPOUND_KEY ];
5018
5134
  }
5019
5135
  _xhrTimeout = channelConfig.xhrTimeout;
5136
+ var csStream = getInst("CompressionStream");
5137
+ _zipPayload = isFeatureEnabled("zipPayload", coreConfig, false);
5138
+ if (!isFunction(csStream) || _sendHook) {
5139
+ _zipPayload = false;
5140
+ }
5020
5141
  _disableXhrSync = !!channelConfig[_DYN_DISABLE_XHR_SYNC ];
5021
5142
  _disableFetchKeepAlive = !!channelConfig[_DYN_DISABLE_FETCH_KEEP_A6 ];
5022
5143
  _addNoResponse = channelConfig[_DYN_ADD_NO_RESPONSE ] !== false;
@@ -5025,7 +5146,7 @@ var HttpManager = /** @class */ (function () {
5025
5146
  _disableFetchKeepAlive = true;
5026
5147
  }
5027
5148
  _useBeacons = !isReactNative();
5028
- _serializer = new Serializer(_core, valueSanitizer, stringifyObjects, enableCompoundKey, getCommonSchemaMetaData, _excludeCsMetaData);
5149
+ _serializer = new Serializer(_core, valueSanitizer, stringifyObjects, enableCompoundKey, getCommonSchemaMetaData, _excludeCsMetaData, channelConfig);
5029
5150
  if (!isNullOrUndefined(channelConfig[_DYN_USE_SEND_BEACON ])) {
5030
5151
  _useBeacons = !!channelConfig[_DYN_USE_SEND_BEACON ];
5031
5152
  }
@@ -5121,7 +5242,7 @@ var HttpManager = /** @class */ (function () {
5121
5242
  var theBatch = theBatches_1.shift();
5122
5243
  if (theBatch && theBatch[_DYN_COUNT ]() > 0) {
5123
5244
  thePayload = thePayload || _serializer[_DYN_CREATE_PAYLOAD ](0, false, false, false, 1 , 0 );
5124
- _serializer.appendPayload(thePayload, theBatch, maxEventsPerBatch);
5245
+ _serializer.appendPayload(thePayload, theBatch, _maxEvtPerBatch);
5125
5246
  }
5126
5247
  }
5127
5248
  var requestDetails = _buildRequestDetails(thePayload, _useHeaders);
@@ -5156,7 +5277,7 @@ var HttpManager = /** @class */ (function () {
5156
5277
  return null;
5157
5278
  }
5158
5279
  _self["_getDbgPlgTargets"] = function () {
5159
- return [_sendInterfaces[0 ], _killSwitch, _serializer, _sendInterfaces, _getSendPostMgrConfig(), _urlString];
5280
+ return [_sendInterfaces[0 ], _killSwitch, _serializer, _sendInterfaces, _getSendPostMgrConfig(), _urlString, _maxEvtPerBatch];
5160
5281
  };
5161
5282
  function _getSendPostMgrConfig() {
5162
5283
  try {
@@ -5224,6 +5345,7 @@ var HttpManager = /** @class */ (function () {
5224
5345
  _timeoutWrapper = createTimeoutWrapper();
5225
5346
  _excludeCsMetaData = false;
5226
5347
  _sendPostMgr = null;
5348
+ _maxEvtPerBatch = null;
5227
5349
  }
5228
5350
  function _fetchOnComplete(response, onComplete, resValue, payload) {
5229
5351
  var handleResponse = function (status, headerMap, responseText) {
@@ -5426,7 +5548,7 @@ var HttpManager = /** @class */ (function () {
5426
5548
  if (theBatch && theBatch[_DYN_COUNT ]() > 0) {
5427
5549
  if (!_killSwitch.isTenantKilled(theBatch[_DYN_I_KEY ]())) {
5428
5550
  thePayload = thePayload || _serializer[_DYN_CREATE_PAYLOAD ](retryCount, isTeardown, isSynchronous_1, isReducedPayload, sendReason, sendType);
5429
- if (!_serializer.appendPayload(thePayload, theBatch, maxEventsPerBatch)) {
5551
+ if (!_serializer.appendPayload(thePayload, theBatch, _maxEvtPerBatch)) {
5430
5552
  _doPayloadSend(thePayload, serializationStart, getTime(), sendReason);
5431
5553
  serializationStart = getTime();
5432
5554
  theBatches = [theBatch][_DYN_CONCAT ](theBatches);
@@ -5568,16 +5690,18 @@ var HttpManager = /** @class */ (function () {
5568
5690
  _retryRequestIfNeeded(status, headers, thePayload, sendReason);
5569
5691
  };
5570
5692
  var isSync = thePayload[_DYN_IS_TEARDOWN ] || thePayload.isSync;
5571
- try {
5572
- sendInterface_1.sendPOST(payload, onComplete, isSync);
5573
- if (_sendListener) {
5574
- _sendListener(orgPayloadData, payload, isSync, thePayload[_DYN_IS_BEACON ]);
5693
+ _sendPostMgr.preparePayload(function (processedPayload) {
5694
+ try {
5695
+ sendInterface_1.sendPOST(processedPayload, onComplete, isSync);
5696
+ if (_sendListener) {
5697
+ _sendListener(orgPayloadData, processedPayload, isSync, thePayload[_DYN_IS_BEACON ]);
5698
+ }
5575
5699
  }
5576
- }
5577
- catch (ex) {
5578
- _warnToConsole(_logger, "Unexpected exception sending payload. Ex:" + dumpObj(ex));
5579
- _doOnComplete(onComplete, 0, {});
5580
- }
5700
+ catch (ex) {
5701
+ _doOnComplete(onComplete, 0, {});
5702
+ _warnToConsole(_logger, "Unexpected exception sending payload. Ex:" + dumpObj(ex));
5703
+ }
5704
+ }, _zipPayload, payload, isSync);
5581
5705
  };
5582
5706
  }
5583
5707
  doPerf(_core, function () { return "HttpManager:_doPayloadSend.sender"; }, function () {
@@ -5851,7 +5975,9 @@ var defaultPostChannelConfig = objDeepFreeze({
5851
5975
  maxEventRetryAttempts: { isVal: isNumber, v: MaxSendAttempts },
5852
5976
  maxUnloadEventRetryAttempts: { isVal: isNumber, v: MaxSyncUnloadSendAttempts },
5853
5977
  addNoResponse: undefValue,
5854
- excludeCsMetaData: undefValue
5978
+ maxEvtPerBatch: { isVal: isNumber, v: MaxNumberEventPerBatch },
5979
+ excludeCsMetaData: undefValue,
5980
+ requestLimit: {}
5855
5981
  });
5856
5982
  function isOverrideFn(httpXHROverride) {
5857
5983
  return httpXHROverride && httpXHROverride.sendPOST;
@@ -5862,7 +5988,7 @@ var PostChannel = /** @class */ (function (_super) {
5862
5988
  var _this = _super.call(this) || this;
5863
5989
  _this.identifier = "PostChannel";
5864
5990
  _this.priority = 1011;
5865
- _this.version = '4.4.0-nightlybeta3.2504-17';
5991
+ _this.version = '4.4.0-nightlybeta3.2505-12';
5866
5992
  var _postConfig;
5867
5993
  var _isTeardownCalled = false;
5868
5994
  var _flushCallbackQueue = [];
@@ -5896,6 +6022,7 @@ var PostChannel = /** @class */ (function (_super) {
5896
6022
  var _unloadHandlersAdded;
5897
6023
  var _overrideInstrumentationKey;
5898
6024
  var _disableTelemetry;
6025
+ var _maxEvtPerBatch;
5899
6026
  dynamicProto(PostChannel, _this, function (_self, _base) {
5900
6027
  _initDefaults();
5901
6028
  _self["_getDbgPlgTargets"] = function () {
@@ -5921,6 +6048,7 @@ var PostChannel = /** @class */ (function (_super) {
5921
6048
  _maxEventSendAttempts = _postConfig.maxEventRetryAttempts;
5922
6049
  _maxUnloadEventSendAttempts = _postConfig.maxUnloadEventRetryAttempts;
5923
6050
  _disableAutoBatchFlushLimit = _postConfig[_DYN_DISABLE_AUTO_BATCH_F15 ];
6051
+ _maxEvtPerBatch = _postConfig.maxEvtPerBatch;
5924
6052
  if (isPromiseLike(coreConfig.endpointUrl)) {
5925
6053
  _self.pause();
5926
6054
  }
@@ -6301,6 +6429,7 @@ var PostChannel = /** @class */ (function (_super) {
6301
6429
  _maxUnloadEventSendAttempts = MaxSyncUnloadSendAttempts;
6302
6430
  _evtNamespace = null;
6303
6431
  _overrideInstrumentationKey = null;
6432
+ _maxEvtPerBatch = null;
6304
6433
  _disableTelemetry = false;
6305
6434
  _timeoutWrapper = createTimeoutWrapper();
6306
6435
  _httpManager = new HttpManager(MaxNumberEventPerBatch, MaxConnections, MaxRequestRetriesBeforeBackoff, {
@@ -6628,7 +6757,7 @@ var PostChannel = /** @class */ (function (_super) {
6628
6757
  }
6629
6758
  function _setAutoLimits() {
6630
6759
  if (!_disableAutoBatchFlushLimit) {
6631
- _autoFlushBatchLimit = mathMax(MaxNumberEventPerBatch * (MaxConnections + 1), _queueSizeLimit / 6);
6760
+ _autoFlushBatchLimit = mathMax(_maxEvtPerBatch * (MaxConnections + 1), _queueSizeLimit / 6);
6632
6761
  }
6633
6762
  else {
6634
6763
  _autoFlushBatchLimit = 0;
@@ -6647,4 +6776,4 @@ exports.PostChannel = PostChannel;
6647
6776
  exports.RT_PROFILE = RT_PROFILE;
6648
6777
 
6649
6778
  }));
6650
- //# sourceMappingURL=ms.post-4.4.0-nightlybeta3.2504-17.gbl.js.map
6779
+ //# sourceMappingURL=ms.post-4.4.0-nightlybeta3.2505-12.gbl.js.map