@microsoft/1ds-core-js 4.3.0-nightly3.2406-07 → 4.3.0-nightly3.2406-08

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 (42) hide show
  1. package/bundle/es5/{ms.core-4.3.0-nightly3.2406-07.gbl.js → ms.core-4.3.0-nightly3.2406-08.gbl.js} +202 -24
  2. package/bundle/es5/ms.core-4.3.0-nightly3.2406-08.gbl.js.map +1 -0
  3. package/bundle/es5/ms.core-4.3.0-nightly3.2406-08.gbl.min.js +7 -0
  4. package/bundle/es5/ms.core-4.3.0-nightly3.2406-08.gbl.min.js.map +1 -0
  5. package/bundle/es5/ms.core-4.3.0-nightly3.2406-08.integrity.json +46 -0
  6. package/bundle/es5/{ms.core-4.3.0-nightly3.2406-07.js → ms.core-4.3.0-nightly3.2406-08.js} +202 -24
  7. package/bundle/es5/ms.core-4.3.0-nightly3.2406-08.js.map +1 -0
  8. package/bundle/es5/ms.core-4.3.0-nightly3.2406-08.min.js +7 -0
  9. package/bundle/es5/ms.core-4.3.0-nightly3.2406-08.min.js.map +1 -0
  10. package/bundle/es5/ms.core.gbl.js +201 -23
  11. package/bundle/es5/ms.core.gbl.js.map +1 -1
  12. package/bundle/es5/ms.core.gbl.min.js +2 -2
  13. package/bundle/es5/ms.core.gbl.min.js.map +1 -1
  14. package/bundle/es5/ms.core.integrity.json +17 -17
  15. package/bundle/es5/ms.core.js +201 -23
  16. package/bundle/es5/ms.core.js.map +1 -1
  17. package/bundle/es5/ms.core.min.js +2 -2
  18. package/bundle/es5/ms.core.min.js.map +1 -1
  19. package/dist/es5/ms.core.js +199 -21
  20. package/dist/es5/ms.core.js.map +1 -1
  21. package/dist/es5/ms.core.min.js +2 -2
  22. package/dist/es5/ms.core.min.js.map +1 -1
  23. package/dist-es5/AppInsightsCore.js +1 -1
  24. package/dist-es5/BaseCore.js +1 -1
  25. package/dist-es5/DataModels.js +1 -1
  26. package/dist-es5/Enums.js +1 -1
  27. package/dist-es5/Index.js +1 -1
  28. package/dist-es5/InternalConstants.js +1 -1
  29. package/dist-es5/Utils.js +2 -2
  30. package/dist-es5/Utils.js.map +1 -1
  31. package/dist-es5/ValueSanitizer.js +1 -1
  32. package/dist-es5/__DynamicConstants.js +1 -1
  33. package/package.json +2 -2
  34. package/types/1ds-core-js.d.ts +2 -2
  35. package/types/1ds-core-js.namespaced.d.ts +68 -6
  36. package/bundle/es5/ms.core-4.3.0-nightly3.2406-07.gbl.js.map +0 -1
  37. package/bundle/es5/ms.core-4.3.0-nightly3.2406-07.gbl.min.js +0 -7
  38. package/bundle/es5/ms.core-4.3.0-nightly3.2406-07.gbl.min.js.map +0 -1
  39. package/bundle/es5/ms.core-4.3.0-nightly3.2406-07.integrity.json +0 -46
  40. package/bundle/es5/ms.core-4.3.0-nightly3.2406-07.js.map +0 -1
  41. package/bundle/es5/ms.core-4.3.0-nightly3.2406-07.min.js +0 -7
  42. package/bundle/es5/ms.core-4.3.0-nightly3.2406-07.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * 1DS JS SDK Core, 4.3.0-nightly3.2406-07
2
+ * 1DS JS SDK Core, 4.3.0-nightly3.2406-08
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  * (Microsoft Internal Only)
5
5
  */
@@ -1283,6 +1283,13 @@
1283
1283
  QueueFull: 5
1284
1284
  });
1285
1285
 
1286
+ var ActiveStatus = createEnumStyle({
1287
+ NONE: 0 ,
1288
+ PENDING: 3 ,
1289
+ INACTIVE: 1 ,
1290
+ ACTIVE: 2
1291
+ });
1292
+
1286
1293
  var _DYN_TO_LOWER_CASE = "toLowerCase";
1287
1294
  var _DYN_BLK_VAL = "blkVal";
1288
1295
  var _DYN_LENGTH$1 = "length";
@@ -1303,13 +1310,17 @@
1303
1310
  var _DYN_REMOVE_NOTIFICATION_0 = "removeNotificationListener";
1304
1311
  var _DYN_ADD_NOTIFICATION_LIS1 = "addNotificationListener";
1305
1312
  var _DYN_IS_INITIALIZED = "isInitialized";
1313
+ var _DYN_INSTRUMENTATION_KEY = "instrumentationKey";
1314
+ var _DYN__INACTIVE = "INACTIVE";
1315
+ var _DYN_VALUE$1 = "value";
1306
1316
  var _DYN_GET_NOTIFY_MGR = "getNotifyMgr";
1307
1317
  var _DYN_GET_PLUGIN = "getPlugin";
1308
- var _DYN_POLL_INTERNAL_LOGS$1 = "pollInternalLogs";
1309
1318
  var _DYN_NAME = "name";
1319
+ var _DYN_I_KEY = "iKey";
1310
1320
  var _DYN_TIME = "time";
1311
1321
  var _DYN_PROCESS_NEXT = "processNext";
1312
1322
  var _DYN_GET_PROCESS_TEL_CONT2 = "getProcessTelContext";
1323
+ var _DYN_POLL_INTERNAL_LOGS$1 = "pollInternalLogs";
1313
1324
  var _DYN_ENABLED = "enabled";
1314
1325
  var _DYN_STOP_POLLING_INTERNA3 = "stopPollingInternalLogs";
1315
1326
  var _DYN_UNLOAD = "unload";
@@ -1659,6 +1670,54 @@
1659
1670
  }, additionalArgs);
1660
1671
  };
1661
1672
  }
1673
+ /*#__NO_SIDE_EFFECTS__*/
1674
+ function _createAllSettledPromise(newPromise) {
1675
+ return createCachedValue(function (input) {
1676
+ var additionalArgs = arrSlice(arguments, 1);
1677
+ return newPromise(function (resolve, reject) {
1678
+ var values = [];
1679
+ var pending = 1;
1680
+ function processItem(item, idx) {
1681
+ pending++;
1682
+ doAwaitResponse(item, function (value) {
1683
+ if (value.rejected) {
1684
+ values[idx] = {
1685
+ status: REJECTED,
1686
+ reason: value.reason
1687
+ };
1688
+ }
1689
+ else {
1690
+ values[idx] = {
1691
+ status: "fulfilled",
1692
+ value: value.value
1693
+ };
1694
+ }
1695
+ if (--pending === 0) {
1696
+ resolve(values);
1697
+ }
1698
+ });
1699
+ }
1700
+ try {
1701
+ if (isArray(input)) {
1702
+ arrForEach(input, processItem);
1703
+ }
1704
+ else if (isIterable(input)) {
1705
+ iterForOf(input, processItem);
1706
+ }
1707
+ else {
1708
+ throwTypeError("Input is not an iterable");
1709
+ }
1710
+ pending--;
1711
+ if (pending === 0) {
1712
+ resolve(values);
1713
+ }
1714
+ }
1715
+ catch (e) {
1716
+ reject(e);
1717
+ }
1718
+ }, additionalArgs);
1719
+ });
1720
+ }
1662
1721
  function syncItemProcessor(pending) {
1663
1722
  arrForEach(pending, function (fn) {
1664
1723
  try {
@@ -1710,11 +1769,16 @@
1710
1769
  return thePromise;
1711
1770
  }
1712
1771
  var _promiseCreator;
1772
+ var _allSettledCreator;
1713
1773
  function createPromise(executor, timeout) {
1714
1774
  !_promiseCreator && (_promiseCreator = createCachedValue(createNativePromise));
1715
1775
  return _promiseCreator.v.call(this, executor, timeout);
1716
1776
  }
1717
1777
  var createAllPromise = /*#__PURE__*/ _createAllPromise(createPromise);
1778
+ function createAllSettledPromise(input, timeout) {
1779
+ !_allSettledCreator && (_allSettledCreator = _createAllSettledPromise(createPromise));
1780
+ return _allSettledCreator.v(input, timeout);
1781
+ }
1718
1782
 
1719
1783
  var UNDEFINED_VALUE = undefined;
1720
1784
  var STR_EMPTY$2 = "";
@@ -2232,7 +2296,7 @@
2232
2296
  return result;
2233
2297
  }
2234
2298
 
2235
- var version = '3.3.0-nightly3.2406-07';
2299
+ var version = '3.3.0-nightly3.2406-08';
2236
2300
  var instanceName = "." + newId(6);
2237
2301
  var _dataUid = 0;
2238
2302
  function _canAcceptData(target) {
@@ -4629,6 +4693,8 @@
4629
4693
  var strNotificationManager = "_notificationManager";
4630
4694
  var strSdkUnloadingError = "SDK is still unloading...";
4631
4695
  var strSdkNotInitialized = "SDK is not initialized";
4696
+ var maxInitQueueSize = 100;
4697
+ var maxInitTimeout = 50000;
4632
4698
  var defaultConfig$1 = objDeepFreeze((_a$1 = {
4633
4699
  cookieCfg: {}
4634
4700
  },
@@ -4785,15 +4851,23 @@
4785
4851
  var _extensions;
4786
4852
  var _pluginVersionStringArr;
4787
4853
  var _pluginVersionString;
4854
+ var _activeStatus;
4855
+ var _endpoint;
4856
+ var _initInMemoMaxSize;
4857
+ var _isStatusSet;
4788
4858
  var _internalLogPoller;
4789
4859
  var _internalLogPollerListening;
4790
4860
  var _forceStopInternalLogPoller;
4791
4861
  dynamicProto(AppInsightsCore, this, function (_self) {
4792
4862
  _initDefaults();
4793
4863
  _self["_getDbgPlgTargets"] = function () {
4794
- return [_extensions];
4864
+ return [_extensions, _eventQueue];
4795
4865
  };
4796
4866
  _self[_DYN_IS_INITIALIZED ] = function () { return _isInitialized; };
4867
+ _self.activeStatus = function () { return _activeStatus; };
4868
+ _self._setPendingStatus = function () {
4869
+ _activeStatus = 3 ;
4870
+ };
4797
4871
  _self[_DYN_INITIALIZE$1 ] = function (config, extensions, logger, notificationManager) {
4798
4872
  if (_isUnloading) {
4799
4873
  throwError(strSdkUnloadingError);
@@ -4804,14 +4878,88 @@
4804
4878
  _configHandler = createDynamicConfig(config, defaultConfig$1, logger || _self[_DYN_LOGGER$1 ], false);
4805
4879
  config = _configHandler.cfg;
4806
4880
  _addUnloadHook(_configHandler[_DYN_WATCH ](function (details) {
4807
- _instrumentationKey = details.cfg.instrumentationKey;
4881
+ var rootCfg = details.cfg;
4882
+ var isPending = _activeStatus === 3 ;
4883
+ if (isPending) {
4884
+ return;
4885
+ }
4886
+ _initInMemoMaxSize = rootCfg.initInMemoMaxSize || maxInitQueueSize;
4887
+ var ikey = rootCfg[_DYN_INSTRUMENTATION_KEY ];
4888
+ var endpointUrl = rootCfg.endpointUrl;
4889
+ if (isNullOrUndefined(ikey)) {
4890
+ _instrumentationKey = null;
4891
+ _activeStatus = ActiveStatus[_DYN__INACTIVE ];
4892
+ var msg = "Please provide instrumentation key";
4893
+ if (!_isInitialized) {
4894
+ throwError(msg);
4895
+ }
4896
+ else {
4897
+ _throwInternal(_logger, 1 , 100 , msg);
4898
+ _releaseQueues();
4899
+ }
4900
+ return;
4901
+ }
4902
+ var promises = [];
4903
+ if (isPromiseLike(ikey)) {
4904
+ promises[_DYN_PUSH ](ikey);
4905
+ _instrumentationKey = null;
4906
+ }
4907
+ else {
4908
+ _instrumentationKey = ikey;
4909
+ }
4910
+ if (isPromiseLike(endpointUrl)) {
4911
+ promises[_DYN_PUSH ](endpointUrl);
4912
+ _endpoint = null;
4913
+ }
4914
+ else {
4915
+ _endpoint = endpointUrl;
4916
+ }
4917
+ if (promises[_DYN_LENGTH$1 ]) {
4918
+ _isStatusSet = false;
4919
+ _activeStatus = 3 ;
4920
+ var initTimeout = isNotNullOrUndefined(rootCfg.initTimeOut) ? rootCfg.initTimeOut : maxInitTimeout;
4921
+ var allPromises = createAllSettledPromise(promises);
4922
+ scheduleTimeout(function () {
4923
+ if (!_isStatusSet) {
4924
+ _setStatus();
4925
+ }
4926
+ }, initTimeout);
4927
+ doAwaitResponse(allPromises, function (response) {
4928
+ try {
4929
+ if (_isStatusSet) {
4930
+ return;
4931
+ }
4932
+ if (!response.rejected) {
4933
+ var values = response[_DYN_VALUE$1 ];
4934
+ if (values && values[_DYN_LENGTH$1 ]) {
4935
+ var ikeyRes = values[0];
4936
+ _instrumentationKey = ikeyRes && ikeyRes[_DYN_VALUE$1 ];
4937
+ if (values[_DYN_LENGTH$1 ] > 1) {
4938
+ var endpointRes = values[1];
4939
+ _endpoint = endpointRes && endpointRes[_DYN_VALUE$1 ];
4940
+ }
4941
+ }
4942
+ if (_instrumentationKey) {
4943
+ config[_DYN_INSTRUMENTATION_KEY ] = _instrumentationKey;
4944
+ config.endpointUrl = _endpoint;
4945
+ }
4946
+ }
4947
+ _setStatus();
4948
+ }
4949
+ catch (e) {
4950
+ if (!_isStatusSet) {
4951
+ _setStatus();
4952
+ }
4953
+ }
4954
+ });
4955
+ }
4956
+ else {
4957
+ _setStatus();
4958
+ }
4808
4959
  var extCfg = details.ref(details.cfg, STR_EXTENSION_CONFIG);
4809
4960
  objForEachKey(extCfg, function (key) {
4810
4961
  details.ref(extCfg, key);
4811
4962
  });
4812
- if (isNullOrUndefined(_instrumentationKey)) {
4813
- throwError("Please provide instrumentation key");
4814
- }
4815
4963
  }));
4816
4964
  _notificationManager = notificationManager;
4817
4965
  _debugListener = _initDebugListener(_configHandler, _hookContainer, _notificationManager && _self[_DYN_GET_NOTIFY_MGR ](), _debugListener);
@@ -4834,8 +4982,9 @@
4834
4982
  _registerDelayedCfgListener(config, _cfgListeners, _logger);
4835
4983
  _cfgListeners = null;
4836
4984
  _isInitialized = true;
4837
- _self.releaseQueue();
4838
- _self[_DYN_POLL_INTERNAL_LOGS$1 ]();
4985
+ if (_activeStatus === ActiveStatus.ACTIVE) {
4986
+ _releaseQueues();
4987
+ }
4839
4988
  };
4840
4989
  _self.getChannels = function () {
4841
4990
  var controls = [];
@@ -4856,14 +5005,16 @@
4856
5005
  _notifyInvalidEvent(telemetryItem);
4857
5006
  throwError("telemetry name required");
4858
5007
  }
4859
- telemetryItem.iKey = telemetryItem.iKey || _instrumentationKey;
5008
+ telemetryItem[_DYN_I_KEY ] = telemetryItem[_DYN_I_KEY ] || _instrumentationKey;
4860
5009
  telemetryItem[_DYN_TIME ] = telemetryItem[_DYN_TIME ] || toISOString(new Date());
4861
5010
  telemetryItem.ver = telemetryItem.ver || "4.0";
4862
- if (!_isUnloading && _self[_DYN_IS_INITIALIZED ]()) {
5011
+ if (!_isUnloading && _self[_DYN_IS_INITIALIZED ]() && _activeStatus === ActiveStatus.ACTIVE) {
4863
5012
  _createTelCtx()[_DYN_PROCESS_NEXT ](telemetryItem);
4864
5013
  }
4865
- else {
4866
- _eventQueue[_DYN_PUSH ](telemetryItem);
5014
+ else if (_activeStatus !== ActiveStatus[_DYN__INACTIVE ]) {
5015
+ if (_eventQueue[_DYN_LENGTH$1 ] <= _initInMemoMaxSize) {
5016
+ _eventQueue[_DYN_PUSH ](telemetryItem);
5017
+ }
4867
5018
  }
4868
5019
  }, function () { return ({ item: telemetryItem }); }, !(telemetryItem.sync));
4869
5020
  };
@@ -4908,9 +5059,15 @@
4908
5059
  if (_isInitialized && _eventQueue[_DYN_LENGTH$1 ] > 0) {
4909
5060
  var eventQueue = _eventQueue;
4910
5061
  _eventQueue = [];
4911
- arrForEach(eventQueue, function (event) {
4912
- _createTelCtx()[_DYN_PROCESS_NEXT ](event);
4913
- });
5062
+ if (_activeStatus === 2 ) {
5063
+ arrForEach(eventQueue, function (event) {
5064
+ event[_DYN_I_KEY ] = event[_DYN_I_KEY ] || _instrumentationKey;
5065
+ _createTelCtx()[_DYN_PROCESS_NEXT ](event);
5066
+ });
5067
+ }
5068
+ else {
5069
+ _throwInternal(_logger, 2 , 20 , "core init status is not active");
5070
+ }
4914
5071
  }
4915
5072
  };
4916
5073
  _self[_DYN_POLL_INTERNAL_LOGS$1 ] = function (eventName) {
@@ -4919,6 +5076,23 @@
4919
5076
  _internalLogPoller && _internalLogPoller[_DYN_CANCEL ]();
4920
5077
  return _startLogPoller(true);
4921
5078
  };
5079
+ function _setStatus() {
5080
+ _isStatusSet = true;
5081
+ if (isNullOrUndefined(_instrumentationKey)) {
5082
+ _activeStatus = ActiveStatus[_DYN__INACTIVE ];
5083
+ _throwInternal(_logger, 1 , 112 , "ikey can't be resolved from promises");
5084
+ }
5085
+ else {
5086
+ _activeStatus = ActiveStatus.ACTIVE;
5087
+ }
5088
+ _releaseQueues();
5089
+ }
5090
+ function _releaseQueues() {
5091
+ if (_isInitialized) {
5092
+ _self.releaseQueue();
5093
+ _self[_DYN_POLL_INTERNAL_LOGS$1 ]();
5094
+ }
5095
+ }
4922
5096
  function _startLogPoller(alwaysStart) {
4923
5097
  if ((!_internalLogPoller || !_internalLogPoller[_DYN_ENABLED ]) && !_forceStopInternalLogPoller) {
4924
5098
  var shouldStart = alwaysStart || (_logger && _logger.queue[_DYN_LENGTH$1 ] > 0);
@@ -5192,6 +5366,10 @@
5192
5366
  _forceStopInternalLogPoller = false;
5193
5367
  _internalLogPoller = null;
5194
5368
  _internalLogPollerListening = false;
5369
+ _activeStatus = 0 ;
5370
+ _endpoint = null;
5371
+ _initInMemoMaxSize = null;
5372
+ _isStatusSet = false;
5195
5373
  }
5196
5374
  function _createTelCtx() {
5197
5375
  var theCtx = createProcessTelemetryContext(_getPluginChain(), _configHandler.cfg, _self);
@@ -5334,7 +5512,7 @@
5334
5512
  var _a;
5335
5513
  var item = (_a = {},
5336
5514
  _a[_DYN_NAME ] = _internalLogsEventName ? _internalLogsEventName : "InternalMessageId: " + logMessage[_DYN_MESSAGE_ID ],
5337
- _a.iKey = _instrumentationKey,
5515
+ _a[_DYN_I_KEY ] = _instrumentationKey,
5338
5516
  _a[_DYN_TIME ] = toISOString(new Date()),
5339
5517
  _a.baseType = _InternalLogMessage.dataType,
5340
5518
  _a.baseData = { message: logMessage[_DYN_MESSAGE ] },
@@ -5770,7 +5948,7 @@
5770
5948
  if (!responseHandled) {
5771
5949
  responseHandled = true;
5772
5950
  if (!result.rejected) {
5773
- var response_1 = result.value;
5951
+ var response_1 = result[_DYN_VALUE$1 ];
5774
5952
  try {
5775
5953
  if (!_isOneDs && !response_1.ok) {
5776
5954
  _handleError(response_1.statusText);
@@ -5783,7 +5961,7 @@
5783
5961
  }
5784
5962
  else {
5785
5963
  doAwaitResponse(response_1.text(), function (resp) {
5786
- _onFetchComplete(response_1, payload, resp.value);
5964
+ _onFetchComplete(response_1, payload, resp[_DYN_VALUE$1 ]);
5787
5965
  resolveFunc && resolveFunc(true);
5788
5966
  });
5789
5967
  }
@@ -6230,7 +6408,7 @@
6230
6408
  var _DYN_CAN_HANDLE = "canHandle";
6231
6409
 
6232
6410
  var _a;
6233
- var Version = '4.3.0-nightly3.2406-07';
6411
+ var Version = '4.3.0-nightly3.2406-08';
6234
6412
  var FullVersionString = "1DS-Web-JS-" + Version;
6235
6413
  var ObjHasOwnProperty = ObjProto$1.hasOwnProperty;
6236
6414
  var strDisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";