@microsoft/1ds-core-js 4.3.0-nightly3.2406-06 → 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-06.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-06.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-06.gbl.js.map +0 -1
  37. package/bundle/es5/ms.core-4.3.0-nightly3.2406-06.gbl.min.js +0 -7
  38. package/bundle/es5/ms.core-4.3.0-nightly3.2406-06.gbl.min.js.map +0 -1
  39. package/bundle/es5/ms.core-4.3.0-nightly3.2406-06.integrity.json +0 -46
  40. package/bundle/es5/ms.core-4.3.0-nightly3.2406-06.js.map +0 -1
  41. package/bundle/es5/ms.core-4.3.0-nightly3.2406-06.min.js +0 -7
  42. package/bundle/es5/ms.core-4.3.0-nightly3.2406-06.min.js.map +0 -1
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * 1DS JS SDK Core, 4.3.0-nightly3.2406-06
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
  */
6
6
  (function (global, factory) {
7
7
  var undef = "undefined";
8
- var nsKey, key, nm, theExports = {}, modName = "es5_ms_core_4_3_0_nightly3_2406_06", msMod="__ms$mod__";
9
- var mods={}, modDetail=mods[modName]={}, ver="4.3.0-nightly3.2406-06";
8
+ var nsKey, key, nm, theExports = {}, modName = "es5_ms_core_4_3_0_nightly3_2406_08", msMod="__ms$mod__";
9
+ var mods={}, modDetail=mods[modName]={}, ver="4.3.0-nightly3.2406-08";
10
10
  // Versioned namespace "oneDS4"
11
11
  var exportNs=global, nsKey="oneDS4", exportNs=exportNs[nsKey]=(exportNs[nsKey]||{});
12
12
  // Global namespace "oneDS"
@@ -1300,6 +1300,13 @@ var EventsDiscardedReason = createEnumStyle({
1300
1300
  QueueFull: 5
1301
1301
  });
1302
1302
 
1303
+ var ActiveStatus = createEnumStyle({
1304
+ NONE: 0 ,
1305
+ PENDING: 3 ,
1306
+ INACTIVE: 1 ,
1307
+ ACTIVE: 2
1308
+ });
1309
+
1303
1310
  var _DYN_TO_LOWER_CASE = "toLowerCase";
1304
1311
  var _DYN_BLK_VAL = "blkVal";
1305
1312
  var _DYN_LENGTH$1 = "length";
@@ -1320,13 +1327,17 @@ var _DYN_IDENTIFIER = "identifier";
1320
1327
  var _DYN_REMOVE_NOTIFICATION_0 = "removeNotificationListener";
1321
1328
  var _DYN_ADD_NOTIFICATION_LIS1 = "addNotificationListener";
1322
1329
  var _DYN_IS_INITIALIZED = "isInitialized";
1330
+ var _DYN_INSTRUMENTATION_KEY = "instrumentationKey";
1331
+ var _DYN__INACTIVE = "INACTIVE";
1332
+ var _DYN_VALUE$1 = "value";
1323
1333
  var _DYN_GET_NOTIFY_MGR = "getNotifyMgr";
1324
1334
  var _DYN_GET_PLUGIN = "getPlugin";
1325
- var _DYN_POLL_INTERNAL_LOGS$1 = "pollInternalLogs";
1326
1335
  var _DYN_NAME = "name";
1336
+ var _DYN_I_KEY = "iKey";
1327
1337
  var _DYN_TIME = "time";
1328
1338
  var _DYN_PROCESS_NEXT = "processNext";
1329
1339
  var _DYN_GET_PROCESS_TEL_CONT2 = "getProcessTelContext";
1340
+ var _DYN_POLL_INTERNAL_LOGS$1 = "pollInternalLogs";
1330
1341
  var _DYN_ENABLED = "enabled";
1331
1342
  var _DYN_STOP_POLLING_INTERNA3 = "stopPollingInternalLogs";
1332
1343
  var _DYN_UNLOAD = "unload";
@@ -1676,6 +1687,54 @@ function _createAllPromise(newPromise) {
1676
1687
  }, additionalArgs);
1677
1688
  };
1678
1689
  }
1690
+ /*#__NO_SIDE_EFFECTS__*/
1691
+ function _createAllSettledPromise(newPromise) {
1692
+ return createCachedValue(function (input) {
1693
+ var additionalArgs = arrSlice(arguments, 1);
1694
+ return newPromise(function (resolve, reject) {
1695
+ var values = [];
1696
+ var pending = 1;
1697
+ function processItem(item, idx) {
1698
+ pending++;
1699
+ doAwaitResponse(item, function (value) {
1700
+ if (value.rejected) {
1701
+ values[idx] = {
1702
+ status: REJECTED,
1703
+ reason: value.reason
1704
+ };
1705
+ }
1706
+ else {
1707
+ values[idx] = {
1708
+ status: "fulfilled",
1709
+ value: value.value
1710
+ };
1711
+ }
1712
+ if (--pending === 0) {
1713
+ resolve(values);
1714
+ }
1715
+ });
1716
+ }
1717
+ try {
1718
+ if (isArray(input)) {
1719
+ arrForEach(input, processItem);
1720
+ }
1721
+ else if (isIterable(input)) {
1722
+ iterForOf(input, processItem);
1723
+ }
1724
+ else {
1725
+ throwTypeError("Input is not an iterable");
1726
+ }
1727
+ pending--;
1728
+ if (pending === 0) {
1729
+ resolve(values);
1730
+ }
1731
+ }
1732
+ catch (e) {
1733
+ reject(e);
1734
+ }
1735
+ }, additionalArgs);
1736
+ });
1737
+ }
1679
1738
  function syncItemProcessor(pending) {
1680
1739
  arrForEach(pending, function (fn) {
1681
1740
  try {
@@ -1727,11 +1786,16 @@ function createNativePromise(executor, timeout) {
1727
1786
  return thePromise;
1728
1787
  }
1729
1788
  var _promiseCreator;
1789
+ var _allSettledCreator;
1730
1790
  function createPromise(executor, timeout) {
1731
1791
  !_promiseCreator && (_promiseCreator = createCachedValue(createNativePromise));
1732
1792
  return _promiseCreator.v.call(this, executor, timeout);
1733
1793
  }
1734
1794
  var createAllPromise = /*#__PURE__*/ _createAllPromise(createPromise);
1795
+ function createAllSettledPromise(input, timeout) {
1796
+ !_allSettledCreator && (_allSettledCreator = _createAllSettledPromise(createPromise));
1797
+ return _allSettledCreator.v(input, timeout);
1798
+ }
1735
1799
 
1736
1800
  var UNDEFINED_VALUE = undefined;
1737
1801
  var STR_EMPTY$2 = "";
@@ -2249,7 +2313,7 @@ function newId(maxLength) {
2249
2313
  return result;
2250
2314
  }
2251
2315
 
2252
- var version = '3.3.0-nightly3.2406-06';
2316
+ var version = '3.3.0-nightly3.2406-08';
2253
2317
  var instanceName = "." + newId(6);
2254
2318
  var _dataUid = 0;
2255
2319
  function _canAcceptData(target) {
@@ -4646,6 +4710,8 @@ var strValidationError = "Plugins must provide initialize method";
4646
4710
  var strNotificationManager = "_notificationManager";
4647
4711
  var strSdkUnloadingError = "SDK is still unloading...";
4648
4712
  var strSdkNotInitialized = "SDK is not initialized";
4713
+ var maxInitQueueSize = 100;
4714
+ var maxInitTimeout = 50000;
4649
4715
  var defaultConfig$1 = objDeepFreeze((_a$1 = {
4650
4716
  cookieCfg: {}
4651
4717
  },
@@ -4802,15 +4868,23 @@ var AppInsightsCore$1 = /** @class */ (function () {
4802
4868
  var _extensions;
4803
4869
  var _pluginVersionStringArr;
4804
4870
  var _pluginVersionString;
4871
+ var _activeStatus;
4872
+ var _endpoint;
4873
+ var _initInMemoMaxSize;
4874
+ var _isStatusSet;
4805
4875
  var _internalLogPoller;
4806
4876
  var _internalLogPollerListening;
4807
4877
  var _forceStopInternalLogPoller;
4808
4878
  dynamicProto(AppInsightsCore, this, function (_self) {
4809
4879
  _initDefaults();
4810
4880
  _self["_getDbgPlgTargets"] = function () {
4811
- return [_extensions];
4881
+ return [_extensions, _eventQueue];
4812
4882
  };
4813
4883
  _self[_DYN_IS_INITIALIZED ] = function () { return _isInitialized; };
4884
+ _self.activeStatus = function () { return _activeStatus; };
4885
+ _self._setPendingStatus = function () {
4886
+ _activeStatus = 3 ;
4887
+ };
4814
4888
  _self[_DYN_INITIALIZE$1 ] = function (config, extensions, logger, notificationManager) {
4815
4889
  if (_isUnloading) {
4816
4890
  throwError(strSdkUnloadingError);
@@ -4821,14 +4895,88 @@ var AppInsightsCore$1 = /** @class */ (function () {
4821
4895
  _configHandler = createDynamicConfig(config, defaultConfig$1, logger || _self[_DYN_LOGGER$1 ], false);
4822
4896
  config = _configHandler.cfg;
4823
4897
  _addUnloadHook(_configHandler[_DYN_WATCH ](function (details) {
4824
- _instrumentationKey = details.cfg.instrumentationKey;
4898
+ var rootCfg = details.cfg;
4899
+ var isPending = _activeStatus === 3 ;
4900
+ if (isPending) {
4901
+ return;
4902
+ }
4903
+ _initInMemoMaxSize = rootCfg.initInMemoMaxSize || maxInitQueueSize;
4904
+ var ikey = rootCfg[_DYN_INSTRUMENTATION_KEY ];
4905
+ var endpointUrl = rootCfg.endpointUrl;
4906
+ if (isNullOrUndefined(ikey)) {
4907
+ _instrumentationKey = null;
4908
+ _activeStatus = ActiveStatus[_DYN__INACTIVE ];
4909
+ var msg = "Please provide instrumentation key";
4910
+ if (!_isInitialized) {
4911
+ throwError(msg);
4912
+ }
4913
+ else {
4914
+ _throwInternal(_logger, 1 , 100 , msg);
4915
+ _releaseQueues();
4916
+ }
4917
+ return;
4918
+ }
4919
+ var promises = [];
4920
+ if (isPromiseLike(ikey)) {
4921
+ promises[_DYN_PUSH ](ikey);
4922
+ _instrumentationKey = null;
4923
+ }
4924
+ else {
4925
+ _instrumentationKey = ikey;
4926
+ }
4927
+ if (isPromiseLike(endpointUrl)) {
4928
+ promises[_DYN_PUSH ](endpointUrl);
4929
+ _endpoint = null;
4930
+ }
4931
+ else {
4932
+ _endpoint = endpointUrl;
4933
+ }
4934
+ if (promises[_DYN_LENGTH$1 ]) {
4935
+ _isStatusSet = false;
4936
+ _activeStatus = 3 ;
4937
+ var initTimeout = isNotNullOrUndefined(rootCfg.initTimeOut) ? rootCfg.initTimeOut : maxInitTimeout;
4938
+ var allPromises = createAllSettledPromise(promises);
4939
+ scheduleTimeout(function () {
4940
+ if (!_isStatusSet) {
4941
+ _setStatus();
4942
+ }
4943
+ }, initTimeout);
4944
+ doAwaitResponse(allPromises, function (response) {
4945
+ try {
4946
+ if (_isStatusSet) {
4947
+ return;
4948
+ }
4949
+ if (!response.rejected) {
4950
+ var values = response[_DYN_VALUE$1 ];
4951
+ if (values && values[_DYN_LENGTH$1 ]) {
4952
+ var ikeyRes = values[0];
4953
+ _instrumentationKey = ikeyRes && ikeyRes[_DYN_VALUE$1 ];
4954
+ if (values[_DYN_LENGTH$1 ] > 1) {
4955
+ var endpointRes = values[1];
4956
+ _endpoint = endpointRes && endpointRes[_DYN_VALUE$1 ];
4957
+ }
4958
+ }
4959
+ if (_instrumentationKey) {
4960
+ config[_DYN_INSTRUMENTATION_KEY ] = _instrumentationKey;
4961
+ config.endpointUrl = _endpoint;
4962
+ }
4963
+ }
4964
+ _setStatus();
4965
+ }
4966
+ catch (e) {
4967
+ if (!_isStatusSet) {
4968
+ _setStatus();
4969
+ }
4970
+ }
4971
+ });
4972
+ }
4973
+ else {
4974
+ _setStatus();
4975
+ }
4825
4976
  var extCfg = details.ref(details.cfg, STR_EXTENSION_CONFIG);
4826
4977
  objForEachKey(extCfg, function (key) {
4827
4978
  details.ref(extCfg, key);
4828
4979
  });
4829
- if (isNullOrUndefined(_instrumentationKey)) {
4830
- throwError("Please provide instrumentation key");
4831
- }
4832
4980
  }));
4833
4981
  _notificationManager = notificationManager;
4834
4982
  _debugListener = _initDebugListener(_configHandler, _hookContainer, _notificationManager && _self[_DYN_GET_NOTIFY_MGR ](), _debugListener);
@@ -4851,8 +4999,9 @@ var AppInsightsCore$1 = /** @class */ (function () {
4851
4999
  _registerDelayedCfgListener(config, _cfgListeners, _logger);
4852
5000
  _cfgListeners = null;
4853
5001
  _isInitialized = true;
4854
- _self.releaseQueue();
4855
- _self[_DYN_POLL_INTERNAL_LOGS$1 ]();
5002
+ if (_activeStatus === ActiveStatus.ACTIVE) {
5003
+ _releaseQueues();
5004
+ }
4856
5005
  };
4857
5006
  _self.getChannels = function () {
4858
5007
  var controls = [];
@@ -4873,14 +5022,16 @@ var AppInsightsCore$1 = /** @class */ (function () {
4873
5022
  _notifyInvalidEvent(telemetryItem);
4874
5023
  throwError("telemetry name required");
4875
5024
  }
4876
- telemetryItem.iKey = telemetryItem.iKey || _instrumentationKey;
5025
+ telemetryItem[_DYN_I_KEY ] = telemetryItem[_DYN_I_KEY ] || _instrumentationKey;
4877
5026
  telemetryItem[_DYN_TIME ] = telemetryItem[_DYN_TIME ] || toISOString(new Date());
4878
5027
  telemetryItem.ver = telemetryItem.ver || "4.0";
4879
- if (!_isUnloading && _self[_DYN_IS_INITIALIZED ]()) {
5028
+ if (!_isUnloading && _self[_DYN_IS_INITIALIZED ]() && _activeStatus === ActiveStatus.ACTIVE) {
4880
5029
  _createTelCtx()[_DYN_PROCESS_NEXT ](telemetryItem);
4881
5030
  }
4882
- else {
4883
- _eventQueue[_DYN_PUSH ](telemetryItem);
5031
+ else if (_activeStatus !== ActiveStatus[_DYN__INACTIVE ]) {
5032
+ if (_eventQueue[_DYN_LENGTH$1 ] <= _initInMemoMaxSize) {
5033
+ _eventQueue[_DYN_PUSH ](telemetryItem);
5034
+ }
4884
5035
  }
4885
5036
  }, function () { return ({ item: telemetryItem }); }, !(telemetryItem.sync));
4886
5037
  };
@@ -4925,9 +5076,15 @@ var AppInsightsCore$1 = /** @class */ (function () {
4925
5076
  if (_isInitialized && _eventQueue[_DYN_LENGTH$1 ] > 0) {
4926
5077
  var eventQueue = _eventQueue;
4927
5078
  _eventQueue = [];
4928
- arrForEach(eventQueue, function (event) {
4929
- _createTelCtx()[_DYN_PROCESS_NEXT ](event);
4930
- });
5079
+ if (_activeStatus === 2 ) {
5080
+ arrForEach(eventQueue, function (event) {
5081
+ event[_DYN_I_KEY ] = event[_DYN_I_KEY ] || _instrumentationKey;
5082
+ _createTelCtx()[_DYN_PROCESS_NEXT ](event);
5083
+ });
5084
+ }
5085
+ else {
5086
+ _throwInternal(_logger, 2 , 20 , "core init status is not active");
5087
+ }
4931
5088
  }
4932
5089
  };
4933
5090
  _self[_DYN_POLL_INTERNAL_LOGS$1 ] = function (eventName) {
@@ -4936,6 +5093,23 @@ var AppInsightsCore$1 = /** @class */ (function () {
4936
5093
  _internalLogPoller && _internalLogPoller[_DYN_CANCEL ]();
4937
5094
  return _startLogPoller(true);
4938
5095
  };
5096
+ function _setStatus() {
5097
+ _isStatusSet = true;
5098
+ if (isNullOrUndefined(_instrumentationKey)) {
5099
+ _activeStatus = ActiveStatus[_DYN__INACTIVE ];
5100
+ _throwInternal(_logger, 1 , 112 , "ikey can't be resolved from promises");
5101
+ }
5102
+ else {
5103
+ _activeStatus = ActiveStatus.ACTIVE;
5104
+ }
5105
+ _releaseQueues();
5106
+ }
5107
+ function _releaseQueues() {
5108
+ if (_isInitialized) {
5109
+ _self.releaseQueue();
5110
+ _self[_DYN_POLL_INTERNAL_LOGS$1 ]();
5111
+ }
5112
+ }
4939
5113
  function _startLogPoller(alwaysStart) {
4940
5114
  if ((!_internalLogPoller || !_internalLogPoller[_DYN_ENABLED ]) && !_forceStopInternalLogPoller) {
4941
5115
  var shouldStart = alwaysStart || (_logger && _logger.queue[_DYN_LENGTH$1 ] > 0);
@@ -5209,6 +5383,10 @@ var AppInsightsCore$1 = /** @class */ (function () {
5209
5383
  _forceStopInternalLogPoller = false;
5210
5384
  _internalLogPoller = null;
5211
5385
  _internalLogPollerListening = false;
5386
+ _activeStatus = 0 ;
5387
+ _endpoint = null;
5388
+ _initInMemoMaxSize = null;
5389
+ _isStatusSet = false;
5212
5390
  }
5213
5391
  function _createTelCtx() {
5214
5392
  var theCtx = createProcessTelemetryContext(_getPluginChain(), _configHandler.cfg, _self);
@@ -5351,7 +5529,7 @@ var AppInsightsCore$1 = /** @class */ (function () {
5351
5529
  var _a;
5352
5530
  var item = (_a = {},
5353
5531
  _a[_DYN_NAME ] = _internalLogsEventName ? _internalLogsEventName : "InternalMessageId: " + logMessage[_DYN_MESSAGE_ID ],
5354
- _a.iKey = _instrumentationKey,
5532
+ _a[_DYN_I_KEY ] = _instrumentationKey,
5355
5533
  _a[_DYN_TIME ] = toISOString(new Date()),
5356
5534
  _a.baseType = _InternalLogMessage.dataType,
5357
5535
  _a.baseData = { message: logMessage[_DYN_MESSAGE ] },
@@ -5787,7 +5965,7 @@ var SenderPostManager = /** @class */ (function () {
5787
5965
  if (!responseHandled) {
5788
5966
  responseHandled = true;
5789
5967
  if (!result.rejected) {
5790
- var response_1 = result.value;
5968
+ var response_1 = result[_DYN_VALUE$1 ];
5791
5969
  try {
5792
5970
  if (!_isOneDs && !response_1.ok) {
5793
5971
  _handleError(response_1.statusText);
@@ -5800,7 +5978,7 @@ var SenderPostManager = /** @class */ (function () {
5800
5978
  }
5801
5979
  else {
5802
5980
  doAwaitResponse(response_1.text(), function (resp) {
5803
- _onFetchComplete(response_1, payload, resp.value);
5981
+ _onFetchComplete(response_1, payload, resp[_DYN_VALUE$1 ]);
5804
5982
  resolveFunc && resolveFunc(true);
5805
5983
  });
5806
5984
  }
@@ -6247,7 +6425,7 @@ var _DYN_RM_FIELD_SANITIZER = "rmFieldSanitizer";
6247
6425
  var _DYN_CAN_HANDLE = "canHandle";
6248
6426
 
6249
6427
  var _a;
6250
- var Version = '4.3.0-nightly3.2406-06';
6428
+ var Version = '4.3.0-nightly3.2406-08';
6251
6429
  var FullVersionString = "1DS-Web-JS-" + Version;
6252
6430
  var ObjHasOwnProperty = ObjProto$1.hasOwnProperty;
6253
6431
  var strDisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
@@ -6993,4 +7171,4 @@ exports.toISOString = toISOString;
6993
7171
  exports.useXDomainRequest = useXDomainRequest;
6994
7172
 
6995
7173
  }));
6996
- //# sourceMappingURL=ms.core-4.3.0-nightly3.2406-06.gbl.js.map
7174
+ //# sourceMappingURL=ms.core-4.3.0-nightly3.2406-08.gbl.js.map