@microsoft/applicationinsights-offlinechannel-js 0.2.2-nightly3.2405-29 → 0.3.0-nightly3.2406-04
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/dist/es5/applicationinsights-offlinechannel-js.js +59 -40
- package/dist/es5/applicationinsights-offlinechannel-js.js.map +1 -1
- package/dist/es5/applicationinsights-offlinechannel-js.min.js +2 -2
- package/dist/es5/applicationinsights-offlinechannel-js.min.js.map +1 -1
- package/dist-es5/Helpers/Utils.js +1 -1
- package/dist-es5/InMemoryBatch.js +1 -1
- package/dist-es5/Interfaces/IInMemoryBatch.js +1 -1
- package/dist-es5/Interfaces/IOfflineBatch.js +1 -1
- package/dist-es5/Interfaces/IOfflineIndexDb.js +1 -1
- package/dist-es5/Interfaces/IOfflineProvider.js +1 -1
- package/dist-es5/Interfaces/ISender.js +1 -1
- package/dist-es5/OfflineBatchHandler.js +1 -1
- package/dist-es5/OfflineChannel.js +64 -41
- package/dist-es5/OfflineChannel.js.map +1 -1
- package/dist-es5/PayloadHelper.js +1 -1
- package/dist-es5/Providers/IndexDbHelper.js +1 -1
- package/dist-es5/Providers/IndexDbProvider.js +1 -1
- package/dist-es5/Providers/WebStorageProvider.js +1 -1
- package/dist-es5/Sender.js +1 -1
- package/dist-es5/__DynamicConstants.js +1 -1
- package/dist-es5/applicationinsights-offlinechannel-js.js +1 -1
- package/package.json +3 -3
- package/types/applicationinsights-offlinechannel-js.d.ts +1 -1
- package/types/applicationinsights-offlinechannel-js.namespaced.d.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Offline Channel, 0.
|
|
2
|
+
* Application Insights JavaScript SDK - Offline Channel, 0.3.0-nightly3.2406-04
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -1972,7 +1972,7 @@
|
|
|
1972
1972
|
return result;
|
|
1973
1973
|
}
|
|
1974
1974
|
|
|
1975
|
-
var version$1 = '3.
|
|
1975
|
+
var version$1 = '3.3.0-nightly3.2406-04';
|
|
1976
1976
|
var instanceName = "." + newId(6);
|
|
1977
1977
|
var _dataUid = 0;
|
|
1978
1978
|
function _canAcceptData(target) {
|
|
@@ -6322,7 +6322,7 @@
|
|
|
6322
6322
|
return Sender;
|
|
6323
6323
|
}());
|
|
6324
6324
|
|
|
6325
|
-
var version = '0.
|
|
6325
|
+
var version = '0.3.0-nightly3.2406-04';
|
|
6326
6326
|
var DefaultOfflineIdentifier = "OfflineChannel";
|
|
6327
6327
|
var DefaultBatchInterval = 15000;
|
|
6328
6328
|
var DefaultInMemoMaxTime = 15000;
|
|
@@ -6375,6 +6375,8 @@
|
|
|
6375
6375
|
var _overrideIkey;
|
|
6376
6376
|
var _evtsLimitInMemo;
|
|
6377
6377
|
var _notificationManager;
|
|
6378
|
+
var _isLazyInit;
|
|
6379
|
+
var _dependencyPlugin;
|
|
6378
6380
|
_initDefaults();
|
|
6379
6381
|
_self[_DYN_INITIALIZE ] = function (coreConfig, core, extensions, pluginChain) {
|
|
6380
6382
|
if (!_hasInitialized) {
|
|
@@ -6386,25 +6388,29 @@
|
|
|
6386
6388
|
_taskScheduler = createTaskScheduler(createAsyncPromise, "offline channel");
|
|
6387
6389
|
_notificationManager = core.getNotifyMgr();
|
|
6388
6390
|
}
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6391
|
+
scheduleTimeout(function () {
|
|
6392
|
+
try {
|
|
6393
|
+
var _dependencyPlugin_1 = _getDependencyPlugin(coreConfig, core);
|
|
6394
|
+
if (!_isLazyInit && _dependencyPlugin_1 && _dependencyPlugin_1.isInitialized()) {
|
|
6395
|
+
_isLazyInit = true;
|
|
6396
|
+
_createUrlConfig(coreConfig, core, extensions, pluginChain);
|
|
6397
|
+
var ctx = _getCoreItemCtx(coreConfig, core, extensions, pluginChain);
|
|
6398
|
+
_sender[_DYN_INITIALIZE ](coreConfig, core, ctx, _diagLogger, _primaryChannelId, _self._unloadHooks);
|
|
6399
|
+
_senderInst = _sender.getXhrInst();
|
|
6400
|
+
_offlineListener.addListener(function (val) {
|
|
6401
|
+
if (!val[_DYN_IS_ONLINE ]) {
|
|
6402
|
+
_sendNextBatchTimer && _sendNextBatchTimer[_DYN_CANCEL ]();
|
|
6403
|
+
}
|
|
6404
|
+
else {
|
|
6405
|
+
_setSendNextTimer();
|
|
6406
|
+
}
|
|
6407
|
+
});
|
|
6408
|
+
_setSendNextTimer();
|
|
6409
|
+
}
|
|
6404
6410
|
}
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
}
|
|
6411
|
+
catch (e) {
|
|
6412
|
+
}
|
|
6413
|
+
}, 0);
|
|
6408
6414
|
};
|
|
6409
6415
|
_self.processTelemetry = function (evt, itemCtx) {
|
|
6410
6416
|
try {
|
|
@@ -6464,7 +6470,7 @@
|
|
|
6464
6470
|
};
|
|
6465
6471
|
_self[_DYN_ONUNLOAD_FLUSH ] = function () {
|
|
6466
6472
|
if (!_paused) {
|
|
6467
|
-
while (_inMemoBatch[_DYN_COUNT ]()) {
|
|
6473
|
+
while (_inMemoBatch && _inMemoBatch[_DYN_COUNT ]()) {
|
|
6468
6474
|
_flushInMemoItems(true);
|
|
6469
6475
|
}
|
|
6470
6476
|
}
|
|
@@ -6476,12 +6482,12 @@
|
|
|
6476
6482
|
return _offlineListener;
|
|
6477
6483
|
};
|
|
6478
6484
|
_self[_DYN_SEND_NEXT_BATCH ] = function () {
|
|
6479
|
-
return _setSendNextTimer();
|
|
6485
|
+
return _offineSupport && _setSendNextTimer();
|
|
6480
6486
|
};
|
|
6481
6487
|
_self._doTeardown = function (unloadCtx, unloadState) {
|
|
6482
6488
|
_self[_DYN_ONUNLOAD_FLUSH ]();
|
|
6483
6489
|
_offlineListener && runTargetUnload(_offlineListener, false);
|
|
6484
|
-
var handler = _urlCfg[_DYN_BATCH_HANDLER ];
|
|
6490
|
+
var handler = _urlCfg && _urlCfg[_DYN_BATCH_HANDLER ];
|
|
6485
6491
|
handler && handler[_DYN_TEARDOWN ]();
|
|
6486
6492
|
_clearScheduledTimer();
|
|
6487
6493
|
_initDefaults();
|
|
@@ -6509,6 +6515,8 @@
|
|
|
6509
6515
|
_primaryChannelId = null;
|
|
6510
6516
|
_overrideIkey = null;
|
|
6511
6517
|
_evtsLimitInMemo = null;
|
|
6518
|
+
_isLazyInit = false;
|
|
6519
|
+
_dependencyPlugin = null;
|
|
6512
6520
|
}
|
|
6513
6521
|
function _shouldCacheEvent(urlConfig, item) {
|
|
6514
6522
|
if ((item[_DYN_PERSISTENCE ]) < urlConfig[_DYN_MIN_PERSISTENCE_CACH0 ]) {
|
|
@@ -6534,7 +6542,7 @@
|
|
|
6534
6542
|
function _flushInMemoItems(unload) {
|
|
6535
6543
|
try {
|
|
6536
6544
|
var inMemo = _inMemoBatch;
|
|
6537
|
-
var evts = inMemo[_DYN_GET_ITEMS ]();
|
|
6545
|
+
var evts = inMemo && inMemo[_DYN_GET_ITEMS ]();
|
|
6538
6546
|
if (!evts || !evts[_DYN_LENGTH ]) {
|
|
6539
6547
|
return;
|
|
6540
6548
|
}
|
|
@@ -6692,7 +6700,7 @@
|
|
|
6692
6700
|
function _getPayload(evt) {
|
|
6693
6701
|
try {
|
|
6694
6702
|
if (evt) {
|
|
6695
|
-
return _offineSupport.serialize(evt, _convertUndefined);
|
|
6703
|
+
return _offineSupport && _offineSupport.serialize(evt, _convertUndefined);
|
|
6696
6704
|
}
|
|
6697
6705
|
}
|
|
6698
6706
|
catch (e) {
|
|
@@ -6722,21 +6730,14 @@
|
|
|
6722
6730
|
var theConfig = details.cfg;
|
|
6723
6731
|
var ctx = createProcessTelemetryContext(null, theConfig, core);
|
|
6724
6732
|
storageConfig = ctx.getExtCfg(_self.identifier, defaultOfflineChannelConfig);
|
|
6725
|
-
var channelIds = storageConfig.primaryOnlineChannelId;
|
|
6726
6733
|
var onlineUrl = null;
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
_offineSupport = channel[_DYN_GET_OFFLINE_SUPPORT ]();
|
|
6735
|
-
onlineUrl = isFunction(_offineSupport && _offineSupport.getUrl) && _offineSupport.getUrl();
|
|
6736
|
-
}
|
|
6737
|
-
return;
|
|
6738
|
-
}
|
|
6739
|
-
});
|
|
6734
|
+
var channel = _getDependencyPlugin(coreConfig, core);
|
|
6735
|
+
if (!!channel.isInitialized() && isFunction(channel[_DYN_GET_OFFLINE_SUPPORT ])) {
|
|
6736
|
+
_offineSupport = channel[_DYN_GET_OFFLINE_SUPPORT ]();
|
|
6737
|
+
onlineUrl = isFunction(_offineSupport && _offineSupport.getUrl) && _offineSupport.getUrl();
|
|
6738
|
+
}
|
|
6739
|
+
else {
|
|
6740
|
+
return;
|
|
6740
6741
|
}
|
|
6741
6742
|
_overrideIkey = storageConfig[_DYN_OVERRIDE_INSTRUMENTA1 ];
|
|
6742
6743
|
var urlConfig = _urlCfg;
|
|
@@ -6786,6 +6787,24 @@
|
|
|
6786
6787
|
_endpoint = curUrl;
|
|
6787
6788
|
}));
|
|
6788
6789
|
}
|
|
6790
|
+
function _getDependencyPlugin(coreConfig, core) {
|
|
6791
|
+
if (!_dependencyPlugin) {
|
|
6792
|
+
var ctx = createProcessTelemetryContext(null, coreConfig, core);
|
|
6793
|
+
var storageConfig = ctx.getExtCfg(_self.identifier, defaultOfflineChannelConfig);
|
|
6794
|
+
var channelIds = storageConfig.primaryOnlineChannelId;
|
|
6795
|
+
if (channelIds && channelIds[_DYN_LENGTH ]) {
|
|
6796
|
+
arrForEach(channelIds, function (id) {
|
|
6797
|
+
var plugin = core.getPlugin(id);
|
|
6798
|
+
var channel = plugin && plugin.plugin;
|
|
6799
|
+
if (channel) {
|
|
6800
|
+
_dependencyPlugin = channel;
|
|
6801
|
+
return;
|
|
6802
|
+
}
|
|
6803
|
+
});
|
|
6804
|
+
}
|
|
6805
|
+
}
|
|
6806
|
+
return _dependencyPlugin;
|
|
6807
|
+
}
|
|
6789
6808
|
function _callNotification(evtName, theArgs) {
|
|
6790
6809
|
callNotification(_notificationManager, evtName, theArgs);
|
|
6791
6810
|
}
|