@microsoft/1ds-post-js 4.0.1 → 4.0.2-nightly3.2307-25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -26
- package/bundle/es5/{ms.post-4.0.1.gbl.js → ms.post-4.0.2-nightly3.2307-25.gbl.js} +507 -426
- package/bundle/es5/ms.post-4.0.2-nightly3.2307-25.gbl.js.map +1 -0
- package/bundle/es5/ms.post-4.0.2-nightly3.2307-25.gbl.min.js +7 -0
- package/bundle/es5/ms.post-4.0.2-nightly3.2307-25.gbl.min.js.map +1 -0
- package/bundle/es5/ms.post-4.0.2-nightly3.2307-25.integrity.json +46 -0
- package/bundle/es5/{ms.post-4.0.1.js → ms.post-4.0.2-nightly3.2307-25.js} +507 -426
- package/bundle/es5/ms.post-4.0.2-nightly3.2307-25.js.map +1 -0
- package/bundle/es5/ms.post-4.0.2-nightly3.2307-25.min.js +7 -0
- package/bundle/es5/ms.post-4.0.2-nightly3.2307-25.min.js.map +1 -0
- package/bundle/es5/ms.post.gbl.js +506 -425
- package/bundle/es5/ms.post.gbl.js.map +1 -1
- package/bundle/es5/ms.post.gbl.min.js +2 -2
- package/bundle/es5/ms.post.gbl.min.js.map +1 -1
- package/bundle/es5/ms.post.integrity.json +17 -17
- package/bundle/es5/ms.post.js +506 -425
- package/bundle/es5/ms.post.js.map +1 -1
- package/bundle/es5/ms.post.min.js +2 -2
- package/bundle/es5/ms.post.min.js.map +1 -1
- package/dist/es5/ms.post.js +504 -423
- package/dist/es5/ms.post.js.map +1 -1
- package/dist/es5/ms.post.min.js +2 -2
- package/dist/es5/ms.post.min.js.map +1 -1
- package/dist-es5/BatchNotificationActions.js +1 -1
- package/dist-es5/ClockSkewManager.js +8 -8
- package/dist-es5/ClockSkewManager.js.map +1 -1
- package/dist-es5/DataModels.js +1 -1
- package/dist-es5/EventBatch.js +13 -12
- package/dist-es5/EventBatch.js.map +1 -1
- package/dist-es5/HttpManager.js +173 -173
- package/dist-es5/HttpManager.js.map +1 -1
- package/dist-es5/Index.js +3 -3
- package/dist-es5/Index.js.map +1 -1
- package/dist-es5/InternalConstants.js +1 -1
- package/dist-es5/KillSwitch.js +8 -8
- package/dist-es5/KillSwitch.js.map +1 -1
- package/dist-es5/PostChannel.js +92 -90
- package/dist-es5/PostChannel.js.map +1 -1
- package/dist-es5/RetryPolicy.js +1 -1
- package/dist-es5/Serializer.js +4 -5
- package/dist-es5/Serializer.js.map +1 -1
- package/dist-es5/TimeoutOverrideWrapper.js +1 -1
- package/dist-es5/__DynamicConstants.js +83 -0
- package/dist-es5/__DynamicConstants.js.map +1 -0
- package/dist-es5/typings/XDomainRequest.js +1 -1
- package/package.json +39 -23
- package/types/1ds-post-js.d.ts +5 -3
- package/types/1ds-post-js.namespaced.d.ts +5 -3
- package/bundle/es5/ms.post-4.0.1.gbl.js.map +0 -1
- package/bundle/es5/ms.post-4.0.1.gbl.min.js +0 -7
- package/bundle/es5/ms.post-4.0.1.gbl.min.js.map +0 -1
- package/bundle/es5/ms.post-4.0.1.integrity.json +0 -46
- package/bundle/es5/ms.post-4.0.1.js.map +0 -1
- package/bundle/es5/ms.post-4.0.1.min.js +0 -7
- package/bundle/es5/ms.post-4.0.1.min.js.map +0 -1
package/dist-es5/PostChannel.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* 1DS JS SDK POST plugin, 4.0.
|
|
2
|
+
* 1DS JS SDK POST plugin, 4.0.2-nightly3.2307-25
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
* (Microsoft Internal Only)
|
|
5
5
|
*/
|
|
@@ -19,6 +19,7 @@ import { HttpManager } from "./HttpManager";
|
|
|
19
19
|
import { STR_MSA_DEVICE_TICKET, STR_TRACE, STR_USER } from "./InternalConstants";
|
|
20
20
|
import { retryPolicyGetMillisToBackoffForRetry } from "./RetryPolicy";
|
|
21
21
|
import { createTimeoutWrapper } from "./TimeoutOverrideWrapper";
|
|
22
|
+
import { _DYN_AUTO_FLUSH_EVENTS_LI13, _DYN_BASE_DATA, _DYN_BATCHES, _DYN_CAN_SEND_REQUEST, _DYN_CLEAR_TIMEOUT_OVERRI3, _DYN_CONCAT, _DYN_COUNT, _DYN_DATA, _DYN_DISABLE_AUTO_BATCH_F14, _DYN_DISABLE_OPTIMIZE_OBJ, _DYN_DISABLE_TELEMETRY, _DYN_EVENTS, _DYN_EVENTS_LIMIT_IN_MEM, _DYN_GET_WPARAM, _DYN_IDENTIFIER, _DYN_IGNORE_MC1_MS0_COOKI12, _DYN_INITIALIZE, _DYN_IS_COMPLETELY_IDLE, _DYN_I_KEY, _DYN_LATENCY, _DYN_LENGTH, _DYN_OVERRIDE_INSTRUMENTA15, _DYN_PUSH, _DYN_SEND_ATTEMPT, _DYN_SEND_POST, _DYN_SEND_QUEUED_REQUESTS, _DYN_SEND_SYNCHRONOUS_BAT9, _DYN_SET_TIMEOUT_OVERRIDE, _DYN_SET_UNLOADING, _DYN_SPLICE, _DYN_SPLIT, _DYN_SYNC, _DYN__BACK_OFF_TRANSMISSI11 } from "./__DynamicConstants";
|
|
22
23
|
var FlushCheckTimer = 0.250; // This needs to be in seconds, so this is 250ms
|
|
23
24
|
var MaxNumberEventPerBatch = 500;
|
|
24
25
|
var EventsDroppedAtOneTime = 20;
|
|
@@ -68,11 +69,13 @@ var defaultPostChannelConfig = objDeepFreeze({
|
|
|
68
69
|
addNoResponse: undefValue
|
|
69
70
|
});
|
|
70
71
|
function isOverrideFn(httpXHROverride) {
|
|
71
|
-
return httpXHROverride && httpXHROverride
|
|
72
|
+
return httpXHROverride && httpXHROverride[_DYN_SEND_POST /* @min:%2esendPOST */];
|
|
72
73
|
}
|
|
73
74
|
/**
|
|
74
75
|
* Class that manages adding events to inbound queues and batching of events
|
|
75
76
|
* into requests.
|
|
77
|
+
* @group Classes
|
|
78
|
+
* @group Entrypoint
|
|
76
79
|
*/
|
|
77
80
|
var PostChannel = /** @class */ (function (_super) {
|
|
78
81
|
__extends(PostChannel, _super);
|
|
@@ -80,7 +83,7 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
80
83
|
var _this = _super.call(this) || this;
|
|
81
84
|
_this.identifier = "PostChannel";
|
|
82
85
|
_this.priority = 1011;
|
|
83
|
-
_this.version = '4.0.
|
|
86
|
+
_this.version = '4.0.2-nightly3.2307-25';
|
|
84
87
|
var _postConfig;
|
|
85
88
|
var _isTeardownCalled = false;
|
|
86
89
|
var _flushCallbackQueue = [];
|
|
@@ -121,32 +124,32 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
121
124
|
_self["_getDbgPlgTargets"] = function () {
|
|
122
125
|
return [_httpManager, _postConfig];
|
|
123
126
|
};
|
|
124
|
-
_self
|
|
127
|
+
_self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (theConfig, core, extensions) {
|
|
125
128
|
doPerf(core, function () { return "PostChannel:initialize"; }, function () {
|
|
126
|
-
_base
|
|
129
|
+
_base[_DYN_INITIALIZE /* @min:%2einitialize */](theConfig, core, extensions);
|
|
127
130
|
_notificationManager = core.getNotifyMgr();
|
|
128
131
|
try {
|
|
129
|
-
_evtNamespace = mergeEvtNamespace(createUniqueNamespace(_self
|
|
132
|
+
_evtNamespace = mergeEvtNamespace(createUniqueNamespace(_self[_DYN_IDENTIFIER /* @min:%2eidentifier */]), core.evtNamespace && core.evtNamespace());
|
|
130
133
|
_self._addHook(onConfigChange(theConfig, function (details) {
|
|
131
134
|
var coreConfig = details.cfg;
|
|
132
135
|
var ctx = createProcessTelemetryContext(null, coreConfig, core);
|
|
133
|
-
_postConfig = ctx.getExtCfg(_self
|
|
134
|
-
_timeoutWrapper = createTimeoutWrapper(_postConfig
|
|
136
|
+
_postConfig = ctx.getExtCfg(_self[_DYN_IDENTIFIER /* @min:%2eidentifier */], defaultPostChannelConfig);
|
|
137
|
+
_timeoutWrapper = createTimeoutWrapper(_postConfig[_DYN_SET_TIMEOUT_OVERRIDE /* @min:%2esetTimeoutOverride */], _postConfig[_DYN_CLEAR_TIMEOUT_OVERRI3 /* @min:%2eclearTimeoutOverride */]);
|
|
135
138
|
// Only try and use the optimizeObject() if this appears to be a chromium based browser and it has not been explicitly disabled
|
|
136
|
-
_optimizeObject = !_postConfig
|
|
137
|
-
_ignoreMc1Ms0CookieProcessing = _postConfig
|
|
138
|
-
_hookWParam(core); // _hookWParam uses _ignoreMc1Ms0CookieProcessing
|
|
139
|
-
_queueSizeLimit = _postConfig
|
|
139
|
+
_optimizeObject = !_postConfig[_DYN_DISABLE_OPTIMIZE_OBJ /* @min:%2edisableOptimizeObj */] && isChromium();
|
|
140
|
+
_ignoreMc1Ms0CookieProcessing = _postConfig[_DYN_IGNORE_MC1_MS0_COOKI12 /* @min:%2eignoreMc1Ms0CookieProcessing */];
|
|
141
|
+
_hookWParam(core); // _hookWParam uses _ignoreMc1Ms0CookieProcessing
|
|
142
|
+
_queueSizeLimit = _postConfig[_DYN_EVENTS_LIMIT_IN_MEM /* @min:%2eeventsLimitInMem */];
|
|
140
143
|
_immediateQueueSizeLimit = _postConfig.immediateEventLimit;
|
|
141
|
-
_autoFlushEventsLimit = _postConfig
|
|
144
|
+
_autoFlushEventsLimit = _postConfig[_DYN_AUTO_FLUSH_EVENTS_LI13 /* @min:%2eautoFlushEventsLimit */];
|
|
142
145
|
_maxEventSendAttempts = _postConfig.maxEventRetryAttempts;
|
|
143
146
|
_maxUnloadEventSendAttempts = _postConfig.maxUnloadEventRetryAttempts;
|
|
144
|
-
_disableAutoBatchFlushLimit = _postConfig
|
|
147
|
+
_disableAutoBatchFlushLimit = _postConfig[_DYN_DISABLE_AUTO_BATCH_F14 /* @min:%2edisableAutoBatchFlushLimit */];
|
|
145
148
|
_setAutoLimits();
|
|
146
149
|
// Override iKey if provided in Post config if provided for during initialization
|
|
147
|
-
_overrideInstrumentationKey = _postConfig
|
|
150
|
+
_overrideInstrumentationKey = _postConfig[_DYN_OVERRIDE_INSTRUMENTA15 /* @min:%2eoverrideInstrumentationKey */];
|
|
148
151
|
// DisableTelemetry was defined in the config provided during initialization
|
|
149
|
-
_disableTelemetry = !!_postConfig
|
|
152
|
+
_disableTelemetry = !!_postConfig[_DYN_DISABLE_TELEMETRY /* @min:%2edisableTelemetry */];
|
|
150
153
|
if (_unloadHandlersAdded) {
|
|
151
154
|
_removeUnloadHandlers();
|
|
152
155
|
}
|
|
@@ -157,7 +160,7 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
157
160
|
_unloadHandlersAdded = addPageShowEventListener(_handleShowEvents, coreConfig.disablePageShowEvents, _evtNamespace) || _unloadHandlersAdded;
|
|
158
161
|
}));
|
|
159
162
|
// only initialize the manager once
|
|
160
|
-
_httpManager
|
|
163
|
+
_httpManager[_DYN_INITIALIZE /* @min:%2einitialize */](theConfig, _self.core, _self);
|
|
161
164
|
}
|
|
162
165
|
catch (e) {
|
|
163
166
|
// resetting the initialized state because of failure
|
|
@@ -167,13 +170,13 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
167
170
|
}, function () { return ({ theConfig: theConfig, core: core, extensions: extensions }); });
|
|
168
171
|
};
|
|
169
172
|
_self.processTelemetry = function (ev, itemCtx) {
|
|
170
|
-
setProcessTelemetryTimings(ev, _self
|
|
173
|
+
setProcessTelemetryTimings(ev, _self[_DYN_IDENTIFIER /* @min:%2eidentifier */]);
|
|
171
174
|
itemCtx = itemCtx || _self._getTelCtx(itemCtx);
|
|
172
175
|
var event = ev;
|
|
173
176
|
if (!_disableTelemetry && !_isTeardownCalled) {
|
|
174
177
|
// Override iKey if provided in Post config if provided for during initialization
|
|
175
178
|
if (_overrideInstrumentationKey) {
|
|
176
|
-
event
|
|
179
|
+
event[_DYN_I_KEY /* @min:%2eiKey */] = _overrideInstrumentationKey;
|
|
177
180
|
}
|
|
178
181
|
_addEventToQueues(event, true);
|
|
179
182
|
if (_isPageUnloadTriggered) {
|
|
@@ -200,8 +203,8 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
200
203
|
removePageShowEventListener(null, _evtNamespace);
|
|
201
204
|
}
|
|
202
205
|
function _hookWParam(core) {
|
|
203
|
-
var existingGetWParamMethod = core
|
|
204
|
-
core
|
|
206
|
+
var existingGetWParamMethod = core[_DYN_GET_WPARAM /* @min:%2egetWParam */];
|
|
207
|
+
core[_DYN_GET_WPARAM /* @min:%2egetWParam */] = function () {
|
|
205
208
|
var wparam = 0;
|
|
206
209
|
if (_ignoreMc1Ms0CookieProcessing) {
|
|
207
210
|
wparam = wparam | 2;
|
|
@@ -215,23 +218,23 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
215
218
|
if (theEvt.type !== "beforeunload") {
|
|
216
219
|
// Only set the unload trigger if not beforeunload event as beforeunload can be cancelled while the other events can't
|
|
217
220
|
_isPageUnloadTriggered = true;
|
|
218
|
-
_httpManager
|
|
221
|
+
_httpManager[_DYN_SET_UNLOADING /* @min:%2esetUnloading */](_isPageUnloadTriggered);
|
|
219
222
|
}
|
|
220
223
|
_releaseAllQueues(2 /* EventSendType.SendBeacon */, 2 /* SendRequestReason.Unload */);
|
|
221
224
|
}
|
|
222
225
|
function _handleShowEvents(evt) {
|
|
223
226
|
// Handle the page becoming visible again
|
|
224
227
|
_isPageUnloadTriggered = false;
|
|
225
|
-
_httpManager
|
|
228
|
+
_httpManager[_DYN_SET_UNLOADING /* @min:%2esetUnloading */](_isPageUnloadTriggered);
|
|
226
229
|
}
|
|
227
230
|
function _addEventToQueues(event, append) {
|
|
228
231
|
// If send attempt field is undefined we should set it to 0.
|
|
229
|
-
if (!event
|
|
230
|
-
event
|
|
232
|
+
if (!event[_DYN_SEND_ATTEMPT /* @min:%2esendAttempt */]) {
|
|
233
|
+
event[_DYN_SEND_ATTEMPT /* @min:%2esendAttempt */] = 0;
|
|
231
234
|
}
|
|
232
235
|
// Add default latency
|
|
233
|
-
if (!event
|
|
234
|
-
event
|
|
236
|
+
if (!event[_DYN_LATENCY /* @min:%2elatency */]) {
|
|
237
|
+
event[_DYN_LATENCY /* @min:%2elatency */] = 1 /* EventLatencyValue.Normal */;
|
|
235
238
|
}
|
|
236
239
|
// Remove extra AI properties if present
|
|
237
240
|
if (event.ext && event.ext[STR_TRACE]) {
|
|
@@ -243,19 +246,19 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
243
246
|
// v8 performance optimization for iterating over the keys
|
|
244
247
|
if (_optimizeObject) {
|
|
245
248
|
event.ext = optimizeObject(event.ext);
|
|
246
|
-
if (event
|
|
247
|
-
event
|
|
249
|
+
if (event[_DYN_BASE_DATA /* @min:%2ebaseData */]) {
|
|
250
|
+
event[_DYN_BASE_DATA /* @min:%2ebaseData */] = optimizeObject(event[_DYN_BASE_DATA /* @min:%2ebaseData */]);
|
|
248
251
|
}
|
|
249
|
-
if (event
|
|
250
|
-
event
|
|
252
|
+
if (event[_DYN_DATA /* @min:%2edata */]) {
|
|
253
|
+
event[_DYN_DATA /* @min:%2edata */] = optimizeObject(event[_DYN_DATA /* @min:%2edata */]);
|
|
251
254
|
}
|
|
252
255
|
}
|
|
253
|
-
if (event
|
|
256
|
+
if (event[_DYN_SYNC /* @min:%2esync */]) {
|
|
254
257
|
// If the transmission is backed off then do not send synchronous events.
|
|
255
258
|
// We will convert these events to Real time latency instead.
|
|
256
259
|
if (_currentBackoffCount || _paused) {
|
|
257
|
-
event
|
|
258
|
-
event
|
|
260
|
+
event[_DYN_LATENCY /* @min:%2elatency */] = 3 /* EventLatencyValue.RealTime */;
|
|
261
|
+
event[_DYN_SYNC /* @min:%2esync */] = false;
|
|
259
262
|
}
|
|
260
263
|
else {
|
|
261
264
|
// Log the event synchronously
|
|
@@ -264,12 +267,12 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
264
267
|
if (_optimizeObject) {
|
|
265
268
|
event = optimizeObject(event);
|
|
266
269
|
}
|
|
267
|
-
_httpManager
|
|
270
|
+
_httpManager[_DYN_SEND_SYNCHRONOUS_BAT9 /* @min:%2esendSynchronousBatch */](EventBatch.create(event[_DYN_I_KEY /* @min:%2eiKey */], [event]), event[_DYN_SYNC /* @min:%2esync */] === true ? 1 /* EventSendType.Synchronous */ : event[_DYN_SYNC /* @min:%2esync */], 3 /* SendRequestReason.SyncEvent */);
|
|
268
271
|
return;
|
|
269
272
|
}
|
|
270
273
|
}
|
|
271
274
|
}
|
|
272
|
-
var evtLatency = event
|
|
275
|
+
var evtLatency = event[_DYN_LATENCY /* @min:%2elatency */];
|
|
273
276
|
var queueSize = _queueSize;
|
|
274
277
|
var queueLimit = _queueSizeLimit;
|
|
275
278
|
if (evtLatency === 4 /* EventLatencyValue.Immediate */) {
|
|
@@ -291,7 +294,7 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
291
294
|
}
|
|
292
295
|
// Drop old event from lower or equal latency
|
|
293
296
|
eventDropped = true;
|
|
294
|
-
if (_dropEventWithLatencyOrLess(event
|
|
297
|
+
if (_dropEventWithLatencyOrLess(event[_DYN_I_KEY /* @min:%2eiKey */], event[_DYN_LATENCY /* @min:%2elatency */], dropLatency, dropNumber)) {
|
|
295
298
|
eventDropped = !_addEventToProperQueue(event, append);
|
|
296
299
|
}
|
|
297
300
|
}
|
|
@@ -301,8 +304,8 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
301
304
|
}
|
|
302
305
|
}
|
|
303
306
|
_self.setEventQueueLimits = function (eventLimit, autoFlushLimit) {
|
|
304
|
-
_postConfig
|
|
305
|
-
_postConfig
|
|
307
|
+
_postConfig[_DYN_EVENTS_LIMIT_IN_MEM /* @min:%2eeventsLimitInMem */] = _queueSizeLimit = isGreaterThanZero(eventLimit) ? eventLimit : MaxEventsLimitInMem;
|
|
308
|
+
_postConfig[_DYN_AUTO_FLUSH_EVENTS_LI13 /* @min:%2eautoFlushEventsLimit */] = _autoFlushEventsLimit = isGreaterThanZero(autoFlushLimit) ? autoFlushLimit : 0;
|
|
306
309
|
_setAutoLimits();
|
|
307
310
|
// We only do this check here as during normal event addition if the queue is > then events start getting dropped
|
|
308
311
|
var doFlush = _queueSize > eventLimit;
|
|
@@ -310,9 +313,9 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
310
313
|
// Check the auto flush max batch size
|
|
311
314
|
for (var latency = 1 /* EventLatencyValue.Normal */; !doFlush && latency <= 3 /* EventLatencyValue.RealTime */; latency++) {
|
|
312
315
|
var batchQueue = _batchQueues[latency];
|
|
313
|
-
if (batchQueue && batchQueue
|
|
314
|
-
arrForEach(batchQueue
|
|
315
|
-
if (theBatch && theBatch
|
|
316
|
+
if (batchQueue && batchQueue[_DYN_BATCHES /* @min:%2ebatches */]) {
|
|
317
|
+
arrForEach(batchQueue[_DYN_BATCHES /* @min:%2ebatches */], function (theBatch) {
|
|
318
|
+
if (theBatch && theBatch[_DYN_COUNT /* @min:%2ecount */]() >= _autoFlushBatchLimit) {
|
|
316
319
|
// If any 1 batch is > than the limit then trigger an auto flush
|
|
317
320
|
doFlush = true;
|
|
318
321
|
}
|
|
@@ -335,10 +338,10 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
335
338
|
_self._loadTransmitProfiles = function (profiles) {
|
|
336
339
|
_resetTransmitProfiles();
|
|
337
340
|
objForEachKey(profiles, function (profileName, profileValue) {
|
|
338
|
-
var profLen = profileValue
|
|
341
|
+
var profLen = profileValue[_DYN_LENGTH /* @min:%2elength */];
|
|
339
342
|
if (profLen >= 2) {
|
|
340
343
|
var directValue = (profLen > 2 ? profileValue[2] : 0);
|
|
341
|
-
profileValue
|
|
344
|
+
profileValue[_DYN_SPLICE /* @min:%2esplice */](0, profLen - 2);
|
|
342
345
|
// Make sure if a higher latency is set to not send then don't send lower latency
|
|
343
346
|
if (profileValue[1] < 0) {
|
|
344
347
|
profileValue[0] = -1;
|
|
@@ -354,7 +357,7 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
354
357
|
// Make sure if it's not disabled (< 0) then make sure it's not larger than RealTime
|
|
355
358
|
directValue = profileValue[1];
|
|
356
359
|
}
|
|
357
|
-
profileValue
|
|
360
|
+
profileValue[_DYN_PUSH /* @min:%2epush */](directValue);
|
|
358
361
|
_profiles[profileName] = profileValue;
|
|
359
362
|
}
|
|
360
363
|
});
|
|
@@ -384,7 +387,7 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
384
387
|
else {
|
|
385
388
|
// Even if null (no callback) this will ensure after the flushImpl finishes waiting
|
|
386
389
|
// for a completely idle connection it will attempt to re-flush any queued events on the next cycle
|
|
387
|
-
_flushCallbackQueue
|
|
390
|
+
_flushCallbackQueue[_DYN_PUSH /* @min:%2epush */](callback);
|
|
388
391
|
}
|
|
389
392
|
}
|
|
390
393
|
else {
|
|
@@ -420,7 +423,7 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
420
423
|
function _sendEventsForLatencyAndAbove(latency, sendType, sendReason) {
|
|
421
424
|
var queued = _queueBatches(latency, sendType, sendReason);
|
|
422
425
|
// Always trigger the request as while the post channel may not have queued additional events, the httpManager may already have waiting events
|
|
423
|
-
_httpManager
|
|
426
|
+
_httpManager[_DYN_SEND_QUEUED_REQUESTS /* @min:%2esendQueuedRequests */](sendType, sendReason);
|
|
424
427
|
return queued;
|
|
425
428
|
}
|
|
426
429
|
function _hasEvents() {
|
|
@@ -435,7 +438,7 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
435
438
|
// If we had previously attempted to send requests, but the http manager didn't have any idle connections then the requests where delayed
|
|
436
439
|
// so try and requeue then again now
|
|
437
440
|
if (_delayedBatchSendLatency >= 0 && _queueBatches(_delayedBatchSendLatency, 0 /* EventSendType.Batched */, _delayedBatchReason)) {
|
|
438
|
-
_httpManager
|
|
441
|
+
_httpManager[_DYN_SEND_QUEUED_REQUESTS /* @min:%2esendQueuedRequests */](0 /* EventSendType.Batched */, _delayedBatchReason);
|
|
439
442
|
}
|
|
440
443
|
if (_immediateQueueSize > 0 && !_immediateTimer && !_paused) {
|
|
441
444
|
// During initialization _profiles enforce that the direct [2] is less than real time [1] timer value
|
|
@@ -468,7 +471,7 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
468
471
|
}
|
|
469
472
|
}
|
|
470
473
|
}
|
|
471
|
-
_self
|
|
474
|
+
_self[_DYN__BACK_OFF_TRANSMISSI11 /* @min:%2e_backOffTransmission */] = function () {
|
|
472
475
|
if (_currentBackoffCount < MaxBackoffCount) {
|
|
473
476
|
_currentBackoffCount++;
|
|
474
477
|
_clearScheduledTimer();
|
|
@@ -590,14 +593,14 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
590
593
|
var eventBatch = batchQueue.iKeyMap[iKey];
|
|
591
594
|
if (!eventBatch && create) {
|
|
592
595
|
eventBatch = EventBatch.create(iKey);
|
|
593
|
-
batchQueue.batches
|
|
596
|
+
batchQueue.batches[_DYN_PUSH /* @min:%2epush */](eventBatch);
|
|
594
597
|
batchQueue.iKeyMap[iKey] = eventBatch;
|
|
595
598
|
}
|
|
596
599
|
return eventBatch;
|
|
597
600
|
}
|
|
598
601
|
function _performAutoFlush(isAsync, doFlush) {
|
|
599
602
|
// Only perform the auto flush check if the httpManager has an idle connection and we are not in a backoff situation
|
|
600
|
-
if (_httpManager
|
|
603
|
+
if (_httpManager[_DYN_CAN_SEND_REQUEST /* @min:%2ecanSendRequest */]() && !_currentBackoffCount) {
|
|
601
604
|
if (_autoFlushEventsLimit > 0 && _queueSize > _autoFlushEventsLimit) {
|
|
602
605
|
// Force flushing
|
|
603
606
|
doFlush = true;
|
|
@@ -613,15 +616,15 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
613
616
|
if (_optimizeObject) {
|
|
614
617
|
event = optimizeObject(event);
|
|
615
618
|
}
|
|
616
|
-
var latency = event
|
|
617
|
-
var eventBatch = _getEventBatch(event
|
|
619
|
+
var latency = event[_DYN_LATENCY /* @min:%2elatency */];
|
|
620
|
+
var eventBatch = _getEventBatch(event[_DYN_I_KEY /* @min:%2eiKey */], latency, true);
|
|
618
621
|
if (eventBatch.addEvent(event)) {
|
|
619
622
|
if (latency !== 4 /* EventLatencyValue.Immediate */) {
|
|
620
623
|
_queueSize++;
|
|
621
624
|
// Check for auto flushing based on total events in the queue, but not for requeued or retry events
|
|
622
|
-
if (append && event
|
|
625
|
+
if (append && event[_DYN_SEND_ATTEMPT /* @min:%2esendAttempt */] === 0) {
|
|
623
626
|
// Force the flushing of the batch if the batch (specific iKey / latency combination) reaches it's auto flush limit
|
|
624
|
-
_performAutoFlush(!event.sync, _autoFlushBatchLimit > 0 && eventBatch
|
|
627
|
+
_performAutoFlush(!event.sync, _autoFlushBatchLimit > 0 && eventBatch[_DYN_COUNT /* @min:%2ecount */]() >= _autoFlushBatchLimit);
|
|
625
628
|
}
|
|
626
629
|
}
|
|
627
630
|
else {
|
|
@@ -635,10 +638,10 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
635
638
|
function _dropEventWithLatencyOrLess(iKey, latency, currentLatency, dropNumber) {
|
|
636
639
|
while (currentLatency <= latency) {
|
|
637
640
|
var eventBatch = _getEventBatch(iKey, latency, true);
|
|
638
|
-
if (eventBatch && eventBatch
|
|
641
|
+
if (eventBatch && eventBatch[_DYN_COUNT /* @min:%2ecount */]() > 0) {
|
|
639
642
|
// Dropped oldest events from lowest possible latency
|
|
640
|
-
var droppedEvents = eventBatch
|
|
641
|
-
var droppedCount = droppedEvents
|
|
643
|
+
var droppedEvents = eventBatch[_DYN_SPLIT /* @min:%2esplit */](0, dropNumber);
|
|
644
|
+
var droppedCount = droppedEvents[_DYN_COUNT /* @min:%2ecount */]();
|
|
642
645
|
if (droppedCount > 0) {
|
|
643
646
|
if (currentLatency === 4 /* EventLatencyValue.Immediate */) {
|
|
644
647
|
_immediateQueueSize -= droppedCount;
|
|
@@ -665,13 +668,13 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
665
668
|
var normalQueue = 0;
|
|
666
669
|
var _loop_1 = function (latency) {
|
|
667
670
|
var batchQueue = _batchQueues[latency];
|
|
668
|
-
if (batchQueue && batchQueue
|
|
669
|
-
arrForEach(batchQueue
|
|
671
|
+
if (batchQueue && batchQueue[_DYN_BATCHES /* @min:%2ebatches */]) {
|
|
672
|
+
arrForEach(batchQueue[_DYN_BATCHES /* @min:%2ebatches */], function (theBatch) {
|
|
670
673
|
if (latency === 4 /* EventLatencyValue.Immediate */) {
|
|
671
|
-
immediateQueue += theBatch
|
|
674
|
+
immediateQueue += theBatch[_DYN_COUNT /* @min:%2ecount */]();
|
|
672
675
|
}
|
|
673
676
|
else {
|
|
674
|
-
normalQueue += theBatch
|
|
677
|
+
normalQueue += theBatch[_DYN_COUNT /* @min:%2ecount */]();
|
|
675
678
|
}
|
|
676
679
|
});
|
|
677
680
|
}
|
|
@@ -688,36 +691,36 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
688
691
|
// Only queue batches (to the HttpManager) if this is a sync request or the httpManager has an idle connection
|
|
689
692
|
// Thus keeping the events within the PostChannel until the HttpManager has a connection available
|
|
690
693
|
// This is so we can drop "old" events if the queue is getting full because we can't successfully send events
|
|
691
|
-
if (!isAsync || _httpManager
|
|
694
|
+
if (!isAsync || _httpManager[_DYN_CAN_SEND_REQUEST /* @min:%2ecanSendRequest */]()) {
|
|
692
695
|
doPerf(_self.core, function () { return "PostChannel._queueBatches"; }, function () {
|
|
693
696
|
var droppedEvents = [];
|
|
694
697
|
var latencyToProcess = 4 /* EventLatencyValue.Immediate */;
|
|
695
698
|
while (latencyToProcess >= latency) {
|
|
696
699
|
var batchQueue = _batchQueues[latencyToProcess];
|
|
697
|
-
if (batchQueue && batchQueue.batches && batchQueue.batches
|
|
698
|
-
arrForEach(batchQueue
|
|
700
|
+
if (batchQueue && batchQueue.batches && batchQueue.batches[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
701
|
+
arrForEach(batchQueue[_DYN_BATCHES /* @min:%2ebatches */], function (theBatch) {
|
|
699
702
|
// Add the batch to the http manager to send the requests
|
|
700
703
|
if (!_httpManager.addBatch(theBatch)) {
|
|
701
704
|
// The events from this iKey are being dropped (killed)
|
|
702
|
-
droppedEvents = droppedEvents
|
|
705
|
+
droppedEvents = droppedEvents[_DYN_CONCAT /* @min:%2econcat */](theBatch[_DYN_EVENTS /* @min:%2eevents */]());
|
|
703
706
|
}
|
|
704
707
|
else {
|
|
705
|
-
eventsQueued = eventsQueued || (theBatch && theBatch
|
|
708
|
+
eventsQueued = eventsQueued || (theBatch && theBatch[_DYN_COUNT /* @min:%2ecount */]() > 0);
|
|
706
709
|
}
|
|
707
710
|
if (latencyToProcess === 4 /* EventLatencyValue.Immediate */) {
|
|
708
|
-
_immediateQueueSize -= theBatch
|
|
711
|
+
_immediateQueueSize -= theBatch[_DYN_COUNT /* @min:%2ecount */]();
|
|
709
712
|
}
|
|
710
713
|
else {
|
|
711
|
-
_queueSize -= theBatch
|
|
714
|
+
_queueSize -= theBatch[_DYN_COUNT /* @min:%2ecount */]();
|
|
712
715
|
}
|
|
713
716
|
});
|
|
714
717
|
// Remove all batches from this Queue
|
|
715
|
-
batchQueue
|
|
718
|
+
batchQueue[_DYN_BATCHES /* @min:%2ebatches */] = [];
|
|
716
719
|
batchQueue.iKeyMap = {};
|
|
717
720
|
}
|
|
718
721
|
latencyToProcess--;
|
|
719
722
|
}
|
|
720
|
-
if (droppedEvents
|
|
723
|
+
if (droppedEvents[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
721
724
|
_notifyEvents(strEventsDiscarded, droppedEvents, EventsDiscardedReason.KillSwitch);
|
|
722
725
|
}
|
|
723
726
|
if (eventsQueued && _delayedBatchSendLatency >= latency) {
|
|
@@ -749,7 +752,7 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
749
752
|
if (callback) {
|
|
750
753
|
callback();
|
|
751
754
|
}
|
|
752
|
-
if (_flushCallbackQueue
|
|
755
|
+
if (_flushCallbackQueue[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
753
756
|
_flushCallbackTimer = _createTimer(function () {
|
|
754
757
|
_flushCallbackTimer = null;
|
|
755
758
|
_flushImpl(_flushCallbackQueue.shift(), sendReason);
|
|
@@ -764,7 +767,7 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
764
767
|
});
|
|
765
768
|
}
|
|
766
769
|
function _waitForIdleManager(callback) {
|
|
767
|
-
if (_httpManager
|
|
770
|
+
if (_httpManager[_DYN_IS_COMPLETELY_IDLE /* @min:%2eisCompletelyIdle */]()) {
|
|
768
771
|
callback();
|
|
769
772
|
}
|
|
770
773
|
else {
|
|
@@ -802,27 +805,27 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
802
805
|
maxSendAttempts = _maxUnloadEventSendAttempts;
|
|
803
806
|
}
|
|
804
807
|
arrForEach(batches, function (theBatch) {
|
|
805
|
-
if (theBatch && theBatch
|
|
806
|
-
arrForEach(theBatch
|
|
808
|
+
if (theBatch && theBatch[_DYN_COUNT /* @min:%2ecount */]() > 0) {
|
|
809
|
+
arrForEach(theBatch[_DYN_EVENTS /* @min:%2eevents */](), function (theEvent) {
|
|
807
810
|
if (theEvent) {
|
|
808
811
|
// Check if the request being added back is for a sync event in which case mark it no longer a sync event
|
|
809
|
-
if (theEvent
|
|
810
|
-
theEvent
|
|
811
|
-
theEvent
|
|
812
|
+
if (theEvent[_DYN_SYNC /* @min:%2esync */]) {
|
|
813
|
+
theEvent[_DYN_LATENCY /* @min:%2elatency */] = 4 /* EventLatencyValue.Immediate */;
|
|
814
|
+
theEvent[_DYN_SYNC /* @min:%2esync */] = false;
|
|
812
815
|
}
|
|
813
|
-
if (theEvent
|
|
816
|
+
if (theEvent[_DYN_SEND_ATTEMPT /* @min:%2esendAttempt */] < maxSendAttempts) {
|
|
814
817
|
// Reset the event timings
|
|
815
|
-
setProcessTelemetryTimings(theEvent, _self
|
|
818
|
+
setProcessTelemetryTimings(theEvent, _self[_DYN_IDENTIFIER /* @min:%2eidentifier */]);
|
|
816
819
|
_addEventToQueues(theEvent, false);
|
|
817
820
|
}
|
|
818
821
|
else {
|
|
819
|
-
droppedEvents
|
|
822
|
+
droppedEvents[_DYN_PUSH /* @min:%2epush */](theEvent);
|
|
820
823
|
}
|
|
821
824
|
}
|
|
822
825
|
});
|
|
823
826
|
}
|
|
824
827
|
});
|
|
825
|
-
if (droppedEvents
|
|
828
|
+
if (droppedEvents[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
826
829
|
_notifyEvents(strEventsDiscarded, droppedEvents, EventsDiscardedReason.NonRetryableStatus);
|
|
827
830
|
}
|
|
828
831
|
if (_isPageUnloadTriggered) {
|
|
@@ -847,8 +850,8 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
847
850
|
for (var _i = 2; _i < arguments.length; _i++) {
|
|
848
851
|
extraArgs[_i - 2] = arguments[_i];
|
|
849
852
|
}
|
|
850
|
-
if (theEvents && theEvents
|
|
851
|
-
_callNotification(evtName, [theEvents]
|
|
853
|
+
if (theEvents && theEvents[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
854
|
+
_callNotification(evtName, [theEvents][_DYN_CONCAT /* @min:%2econcat */](extraArgs));
|
|
852
855
|
}
|
|
853
856
|
}
|
|
854
857
|
function _notifyBatchEvents(evtName, batches) {
|
|
@@ -856,10 +859,10 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
856
859
|
for (var _i = 2; _i < arguments.length; _i++) {
|
|
857
860
|
extraArgs[_i - 2] = arguments[_i];
|
|
858
861
|
}
|
|
859
|
-
if (batches && batches
|
|
862
|
+
if (batches && batches[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
860
863
|
arrForEach(batches, function (theBatch) {
|
|
861
|
-
if (theBatch && theBatch
|
|
862
|
-
_callNotification(evtName, [theBatch.events()]
|
|
864
|
+
if (theBatch && theBatch[_DYN_COUNT /* @min:%2ecount */]() > 0) {
|
|
865
|
+
_callNotification(evtName, [theBatch.events()][_DYN_CONCAT /* @min:%2econcat */](extraArgs));
|
|
863
866
|
}
|
|
864
867
|
});
|
|
865
868
|
}
|
|
@@ -869,7 +872,7 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
869
872
|
* @ignore
|
|
870
873
|
*/
|
|
871
874
|
function _sendingEvent(batches, reason, isSyncRequest) {
|
|
872
|
-
if (batches && batches
|
|
875
|
+
if (batches && batches[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
873
876
|
_callNotification("eventsSendRequest", [(reason >= 1000 /* EventBatchNotificationReason.SendingUndefined */ && reason <= 1999 /* EventBatchNotificationReason.SendingEventMax */ ?
|
|
874
877
|
reason - 1000 /* EventBatchNotificationReason.SendingUndefined */ :
|
|
875
878
|
0 /* SendRequestReason.Undefined */), isSyncRequest !== true]);
|
|
@@ -924,9 +927,8 @@ var PostChannel = /** @class */ (function (_super) {
|
|
|
924
927
|
// Removed Stub for PostChannel.prototype._setTransmitProfile.
|
|
925
928
|
// Removed Stub for PostChannel.prototype._backOffTransmission.
|
|
926
929
|
// Removed Stub for PostChannel.prototype._clearBackOff.
|
|
927
|
-
// This is a workaround for an
|
|
930
|
+
// This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
|
|
928
931
|
// non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
|
|
929
|
-
// this will be removed when ES3 support is dropped.
|
|
930
932
|
PostChannel.__ieDyn=1;
|
|
931
933
|
|
|
932
934
|
return PostChannel;
|