@microsoft/applicationinsights-osplugin-js 3.4.0-nightlybeta3.2505-35 → 3.4.0-nightlybeta3.2507-23

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 (45) hide show
  1. package/README.md +3 -3
  2. package/browser/es5/{ai.osplugin.3.4.0-nightlybeta3.2505-35.cjs.js → ai.osplugin.3.4.0-nightlybeta3.2507-23.cjs.js} +21 -22
  3. package/browser/es5/ai.osplugin.3.4.0-nightlybeta3.2507-23.cjs.js.map +1 -0
  4. package/browser/es5/{ai.osplugin.3.4.0-nightlybeta3.2505-35.cjs.min.js → ai.osplugin.3.4.0-nightlybeta3.2507-23.cjs.min.js} +3 -3
  5. package/browser/es5/{ai.osplugin.3.4.0-nightlybeta3.2505-35.cjs.min.js.map → ai.osplugin.3.4.0-nightlybeta3.2507-23.cjs.min.js.map} +1 -1
  6. package/browser/es5/{ai.osplugin.3.4.0-nightlybeta3.2505-35.gbl.js → ai.osplugin.3.4.0-nightlybeta3.2507-23.gbl.js} +23 -24
  7. package/browser/es5/ai.osplugin.3.4.0-nightlybeta3.2507-23.gbl.js.map +1 -0
  8. package/browser/es5/ai.osplugin.3.4.0-nightlybeta3.2507-23.gbl.min.js +6 -0
  9. package/browser/es5/{ai.osplugin.3.4.0-nightlybeta3.2505-35.gbl.min.js.map → ai.osplugin.3.4.0-nightlybeta3.2507-23.gbl.min.js.map} +1 -1
  10. package/browser/es5/ai.osplugin.3.4.0-nightlybeta3.2507-23.integrity.json +66 -0
  11. package/browser/es5/{ai.osplugin.3.4.0-nightlybeta3.2505-35.js → ai.osplugin.3.4.0-nightlybeta3.2507-23.js} +23 -24
  12. package/browser/es5/ai.osplugin.3.4.0-nightlybeta3.2507-23.js.map +1 -0
  13. package/browser/es5/ai.osplugin.3.4.0-nightlybeta3.2507-23.min.js +6 -0
  14. package/browser/es5/{ai.osplugin.3.4.0-nightlybeta3.2505-35.min.js.map → ai.osplugin.3.4.0-nightlybeta3.2507-23.min.js.map} +1 -1
  15. package/browser/es5/ai.osplugin.3.cjs.js +20 -21
  16. package/browser/es5/ai.osplugin.3.cjs.js.map +1 -1
  17. package/browser/es5/ai.osplugin.3.cjs.min.js +2 -2
  18. package/browser/es5/ai.osplugin.3.cjs.min.js.map +1 -1
  19. package/browser/es5/ai.osplugin.3.gbl.js +22 -23
  20. package/browser/es5/ai.osplugin.3.gbl.js.map +1 -1
  21. package/browser/es5/ai.osplugin.3.gbl.min.js +2 -2
  22. package/browser/es5/ai.osplugin.3.gbl.min.js.map +1 -1
  23. package/browser/es5/ai.osplugin.3.integrity.json +25 -25
  24. package/browser/es5/ai.osplugin.3.js +22 -23
  25. package/browser/es5/ai.osplugin.3.js.map +1 -1
  26. package/browser/es5/ai.osplugin.3.min.js +2 -2
  27. package/browser/es5/ai.osplugin.3.min.js.map +1 -1
  28. package/dist/es5/applicationinsights-osplugin-js.js +20 -21
  29. package/dist/es5/applicationinsights-osplugin-js.js.map +1 -1
  30. package/dist/es5/applicationinsights-osplugin-js.min.js +2 -2
  31. package/dist/es5/applicationinsights-osplugin-js.min.js.map +1 -1
  32. package/dist-es5/DataModels.js +1 -1
  33. package/dist-es5/OsPlugin.js +2 -2
  34. package/dist-es5/OsPlugin.js.map +1 -1
  35. package/dist-es5/__DynamicConstants.js +1 -1
  36. package/dist-es5/applicationinsights-osplugin-js.js +1 -1
  37. package/package.json +3 -3
  38. package/types/applicationinsights-osplugin-js.d.ts +1 -1
  39. package/types/applicationinsights-osplugin-js.namespaced.d.ts +283 -14
  40. package/browser/es5/ai.osplugin.3.4.0-nightlybeta3.2505-35.cjs.js.map +0 -1
  41. package/browser/es5/ai.osplugin.3.4.0-nightlybeta3.2505-35.gbl.js.map +0 -1
  42. package/browser/es5/ai.osplugin.3.4.0-nightlybeta3.2505-35.gbl.min.js +0 -6
  43. package/browser/es5/ai.osplugin.3.4.0-nightlybeta3.2505-35.integrity.json +0 -66
  44. package/browser/es5/ai.osplugin.3.4.0-nightlybeta3.2505-35.js.map +0 -1
  45. package/browser/es5/ai.osplugin.3.4.0-nightlybeta3.2505-35.min.js +0 -6
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - OS Plugin, 3.4.0-nightlybeta3.2505-35
2
+ * Application Insights JavaScript SDK - OS Plugin, 3.4.0-nightlybeta3.2507-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - OS Plugin, 3.4.0-nightlybeta3.2505-35
2
+ * Application Insights JavaScript SDK - OS Plugin, 3.4.0-nightlybeta3.2507-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
@@ -26,7 +26,7 @@ var OsPlugin = /** @class */ (function (_super) {
26
26
  var _this = _super.call(this) || this;
27
27
  _this.identifier = "OsPlugin";
28
28
  _this.priority = 195;
29
- _this.version = '3.4.0-nightlybeta3.2505-35';
29
+ _this.version = '3.4.0-nightlybeta3.2507-23';
30
30
  var _core;
31
31
  var _ocConfig;
32
32
  var _getOSInProgress;
@@ -1 +1 @@
1
- {"version":3,"file":"OsPlugin.js.map","sources":["OsPlugin.js"],"sourcesContent":["import { __extends } from \"tslib\";\r\n/**\r\n* OsPlugin.ts\r\n* @author Siyu Niu (siyuniu)\r\n* @copyright Microsoft 2024\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { Extensions, utlCanUseSessionStorage, utlGetSessionStorage, utlSetSessionStorage } from \"@microsoft/applicationinsights-common\";\r\nimport { BaseTelemetryPlugin, _throwInternal, addPageHideEventListener, addPageUnloadEventListener, arrForEach, createProcessTelemetryContext, createUniqueNamespace, getSetValue, mergeEvtNamespace, onConfigChange, removePageHideEventListener, removePageUnloadEventListener, setValue } from \"@microsoft/applicationinsights-core-js\";\r\nimport { doAwaitResponse } from \"@nevware21/ts-async\";\r\nimport { isString, objDeepFreeze, scheduleTimeout } from \"@nevware21/ts-utils\";\r\nimport { _DYN_MERGE_OS_NAME_VERSIO0, _DYN_PLATFORM_VERSION } from \"./__DynamicConstants\";\r\nvar defaultMaxTimeout = 200;\r\nvar strExt = \"ext\";\r\nvar defaultOSConfig = objDeepFreeze({\r\n maxTimeout: defaultMaxTimeout,\r\n mergeOsNameVersion: undefined\r\n});\r\nvar OsPlugin = /** @class */ (function (_super) {\r\n __extends(OsPlugin, _super);\r\n function OsPlugin() {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = \"OsPlugin\";\r\n _this.priority = 195;\r\n _this.version = '3.4.0-nightlybeta3.2505-35';\r\n var _core;\r\n var _ocConfig;\r\n var _getOSInProgress;\r\n var _getOSTimeout;\r\n var _maxTimeout;\r\n var _platformVersionResponse;\r\n var _retrieveFullVersion;\r\n var _mergeOsNameVersion;\r\n var _eventQueue;\r\n var _evtNamespace;\r\n var _excludePageUnloadEvents;\r\n var _os;\r\n var _osVer;\r\n var _firstAttempt;\r\n dynamicProto(OsPlugin, _this, function (_self, _base) {\r\n _initDefaults();\r\n _self.initialize = function (coreConfig, core, extensions) {\r\n var _self = _this;\r\n _core = core;\r\n _super.prototype.initialize.call(_this, coreConfig, core, extensions);\r\n var identifier = _self.identifier;\r\n _evtNamespace = mergeEvtNamespace(createUniqueNamespace(identifier), core.evtNamespace && core.evtNamespace());\r\n if (utlCanUseSessionStorage) {\r\n try {\r\n _platformVersionResponse = JSON.parse(utlGetSessionStorage(core.logger, \"ai_osplugin\"));\r\n }\r\n catch (error) {\r\n // do nothing\r\n }\r\n }\r\n if (_platformVersionResponse) {\r\n _retrieveFullVersion = true;\r\n _osVer = parseInt(_platformVersionResponse[_DYN_PLATFORM_VERSION /* @min:%2eplatformVersion */]);\r\n _os = _platformVersionResponse.platform;\r\n }\r\n _self._addHook(onConfigChange(coreConfig, function (details) {\r\n var coreConfig = details.cfg;\r\n var ctx = createProcessTelemetryContext(null, coreConfig, core);\r\n _ocConfig = ctx.getExtCfg(identifier, defaultOSConfig);\r\n _maxTimeout = _ocConfig.maxTimeout;\r\n if (_ocConfig[_DYN_MERGE_OS_NAME_VERSIO0 /* @min:%2emergeOsNameVersion */] !== undefined) {\r\n _mergeOsNameVersion = _ocConfig[_DYN_MERGE_OS_NAME_VERSIO0 /* @min:%2emergeOsNameVersion */];\r\n }\r\n else if (core.getPlugin(\"Sender\").plugin) {\r\n _mergeOsNameVersion = true;\r\n }\r\n else {\r\n _mergeOsNameVersion = false;\r\n }\r\n var excludePageUnloadEvents = coreConfig.disablePageUnloadEvents || [];\r\n if (_excludePageUnloadEvents && _excludePageUnloadEvents !== excludePageUnloadEvents) {\r\n removePageUnloadEventListener(null, _evtNamespace);\r\n removePageHideEventListener(null, _evtNamespace);\r\n _excludePageUnloadEvents = null;\r\n }\r\n if (!_excludePageUnloadEvents) {\r\n // If page is closed release queue\r\n addPageUnloadEventListener(_doUnload, excludePageUnloadEvents, _evtNamespace);\r\n addPageHideEventListener(_doUnload, excludePageUnloadEvents, _evtNamespace);\r\n }\r\n _excludePageUnloadEvents = excludePageUnloadEvents;\r\n }));\r\n function _doUnload() {\r\n _releaseEventQueue();\r\n }\r\n };\r\n _self.processTelemetry = function (event, itemCtx) {\r\n itemCtx = _self._getTelCtx(itemCtx);\r\n if (!_retrieveFullVersion && !_getOSInProgress && _firstAttempt) {\r\n // Start Requesting OS version process\r\n _getOSInProgress = true;\r\n startRetrieveOsVersion();\r\n _firstAttempt = false;\r\n }\r\n if (_getOSInProgress) {\r\n _eventQueue.push({\r\n ctx: itemCtx,\r\n item: event\r\n });\r\n }\r\n else {\r\n updateTeleItemWithOs(event);\r\n _self.processNext(event, itemCtx);\r\n }\r\n };\r\n _self._doTeardown = function (unloadCtx, unloadState) {\r\n _completeOsRetrieve();\r\n removePageUnloadEventListener(null, _evtNamespace);\r\n removePageHideEventListener(null, _evtNamespace);\r\n // Just register to remove all events associated with this namespace\r\n _initDefaults();\r\n };\r\n /**\r\n * Wait for the response from the browser for the OS version and store info in the session storage\r\n */\r\n function startRetrieveOsVersion() {\r\n // Timeout request if it takes more than 5 seconds (by default)\r\n var _a;\r\n _getOSTimeout = scheduleTimeout(function () {\r\n _completeOsRetrieve();\r\n }, _maxTimeout);\r\n if (navigator.userAgent) {\r\n var getHighEntropyValues = (_a = navigator.userAgentData) === null || _a === void 0 ? void 0 : _a.getHighEntropyValues;\r\n if (getHighEntropyValues) {\r\n doAwaitResponse(navigator.userAgentData.getHighEntropyValues([\"platformVersion\"]), function (response) {\r\n if (!response.rejected) {\r\n _platformVersionResponse = response.value;\r\n _retrieveFullVersion = true;\r\n if (_platformVersionResponse[_DYN_PLATFORM_VERSION /* @min:%2eplatformVersion */] && _platformVersionResponse.platform) {\r\n _os = _platformVersionResponse.platform;\r\n _osVer = parseInt(_platformVersionResponse[_DYN_PLATFORM_VERSION /* @min:%2eplatformVersion */]);\r\n if (_os === \"Windows\") {\r\n if (_osVer == 0) {\r\n _osVer = 8;\r\n }\r\n else if (_osVer < 13) {\r\n _osVer = 10;\r\n }\r\n else {\r\n _osVer = 11;\r\n }\r\n }\r\n utlSetSessionStorage(_core.logger, \"ai_osplugin\", JSON.stringify({ platform: _os, platformVersion: _osVer }));\r\n }\r\n }\r\n else {\r\n _throwInternal(_core.logger, 1 /* eLoggingSeverity.CRITICAL */, 73 /* _eInternalMessageId.PluginException */, \"Could not retrieve operating system: \" + response.reason);\r\n }\r\n _completeOsRetrieve();\r\n });\r\n }\r\n }\r\n }\r\n function updateTeleItemWithOs(event) {\r\n if (_retrieveFullVersion) {\r\n var extOS = getSetValue(getSetValue(event, strExt), Extensions.OSExt);\r\n if (_mergeOsNameVersion) {\r\n setValue(extOS, \"osVer\", _os + _osVer, isString);\r\n }\r\n else {\r\n setValue(extOS, \"osVer\", _osVer);\r\n setValue(extOS, \"os\", _os, isString);\r\n }\r\n }\r\n }\r\n /**\r\n * Complete retrieving operating system info process, cleanup and release the event queue\r\n */\r\n function _completeOsRetrieve() {\r\n if (_getOSTimeout) {\r\n _getOSTimeout.cancel();\r\n }\r\n _getOSInProgress = false;\r\n _releaseEventQueue();\r\n }\r\n /**\r\n * Release internal event queue\r\n */\r\n function _releaseEventQueue() {\r\n arrForEach(_eventQueue, function (evt) {\r\n updateTeleItemWithOs(evt.item);\r\n _self.processNext(evt.item, evt.ctx);\r\n });\r\n _eventQueue = [];\r\n }\r\n function _initDefaults() {\r\n _core = null;\r\n _ocConfig = null;\r\n _getOSInProgress = false;\r\n _getOSTimeout = null;\r\n _maxTimeout = null;\r\n _retrieveFullVersion = false;\r\n _eventQueue = [];\r\n _firstAttempt = true;\r\n }\r\n // Special internal method to allow the DebugPlugin to hook embedded objects\r\n _self[\"_getDbgPlgTargets\"] = function () {\r\n return [_platformVersionResponse, _eventQueue, _getOSInProgress];\r\n };\r\n });\r\n return _this;\r\n }\r\n OsPlugin.prototype.initialize = function (config, core, extensions) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Process the event and add it to an internal queue if handshake in process\r\n * @param event - The event to process\r\n * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances\r\n * can optionally use this to access the current core instance or define / pass additional information\r\n * to later plugins (vs appending items to the telemetry item)\r\n */\r\n OsPlugin.prototype.processTelemetry = function (event, itemCtx) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n return OsPlugin;\r\n}(BaseTelemetryPlugin));\r\nexport { OsPlugin };\r\n//# sourceMappingURL=OsPlugin.js.map"],"names":[],"mappings":";;;;AAAA,gFAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;wDAYM,CAAC;;;;;oBACa;AACpB;AACA;AACA"}
1
+ {"version":3,"file":"OsPlugin.js.map","sources":["OsPlugin.js"],"sourcesContent":["import { __extends } from \"tslib\";\r\n/**\r\n* OsPlugin.ts\r\n* @author Siyu Niu (siyuniu)\r\n* @copyright Microsoft 2024\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { Extensions, utlCanUseSessionStorage, utlGetSessionStorage, utlSetSessionStorage } from \"@microsoft/applicationinsights-common\";\r\nimport { BaseTelemetryPlugin, _throwInternal, addPageHideEventListener, addPageUnloadEventListener, arrForEach, createProcessTelemetryContext, createUniqueNamespace, getSetValue, mergeEvtNamespace, onConfigChange, removePageHideEventListener, removePageUnloadEventListener, setValue } from \"@microsoft/applicationinsights-core-js\";\r\nimport { doAwaitResponse } from \"@nevware21/ts-async\";\r\nimport { isString, objDeepFreeze, scheduleTimeout } from \"@nevware21/ts-utils\";\r\nimport { _DYN_MERGE_OS_NAME_VERSIO0, _DYN_PLATFORM_VERSION } from \"./__DynamicConstants\";\r\nvar defaultMaxTimeout = 200;\r\nvar strExt = \"ext\";\r\nvar defaultOSConfig = objDeepFreeze({\r\n maxTimeout: defaultMaxTimeout,\r\n mergeOsNameVersion: undefined\r\n});\r\nvar OsPlugin = /** @class */ (function (_super) {\r\n __extends(OsPlugin, _super);\r\n function OsPlugin() {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = \"OsPlugin\";\r\n _this.priority = 195;\r\n _this.version = '3.4.0-nightlybeta3.2507-23';\r\n var _core;\r\n var _ocConfig;\r\n var _getOSInProgress;\r\n var _getOSTimeout;\r\n var _maxTimeout;\r\n var _platformVersionResponse;\r\n var _retrieveFullVersion;\r\n var _mergeOsNameVersion;\r\n var _eventQueue;\r\n var _evtNamespace;\r\n var _excludePageUnloadEvents;\r\n var _os;\r\n var _osVer;\r\n var _firstAttempt;\r\n dynamicProto(OsPlugin, _this, function (_self, _base) {\r\n _initDefaults();\r\n _self.initialize = function (coreConfig, core, extensions) {\r\n var _self = _this;\r\n _core = core;\r\n _super.prototype.initialize.call(_this, coreConfig, core, extensions);\r\n var identifier = _self.identifier;\r\n _evtNamespace = mergeEvtNamespace(createUniqueNamespace(identifier), core.evtNamespace && core.evtNamespace());\r\n if (utlCanUseSessionStorage) {\r\n try {\r\n _platformVersionResponse = JSON.parse(utlGetSessionStorage(core.logger, \"ai_osplugin\"));\r\n }\r\n catch (error) {\r\n // do nothing\r\n }\r\n }\r\n if (_platformVersionResponse) {\r\n _retrieveFullVersion = true;\r\n _osVer = parseInt(_platformVersionResponse[_DYN_PLATFORM_VERSION /* @min:%2eplatformVersion */]);\r\n _os = _platformVersionResponse.platform;\r\n }\r\n _self._addHook(onConfigChange(coreConfig, function (details) {\r\n var coreConfig = details.cfg;\r\n var ctx = createProcessTelemetryContext(null, coreConfig, core);\r\n _ocConfig = ctx.getExtCfg(identifier, defaultOSConfig);\r\n _maxTimeout = _ocConfig.maxTimeout;\r\n if (_ocConfig[_DYN_MERGE_OS_NAME_VERSIO0 /* @min:%2emergeOsNameVersion */] !== undefined) {\r\n _mergeOsNameVersion = _ocConfig[_DYN_MERGE_OS_NAME_VERSIO0 /* @min:%2emergeOsNameVersion */];\r\n }\r\n else if (core.getPlugin(\"Sender\").plugin) {\r\n _mergeOsNameVersion = true;\r\n }\r\n else {\r\n _mergeOsNameVersion = false;\r\n }\r\n var excludePageUnloadEvents = coreConfig.disablePageUnloadEvents || [];\r\n if (_excludePageUnloadEvents && _excludePageUnloadEvents !== excludePageUnloadEvents) {\r\n removePageUnloadEventListener(null, _evtNamespace);\r\n removePageHideEventListener(null, _evtNamespace);\r\n _excludePageUnloadEvents = null;\r\n }\r\n if (!_excludePageUnloadEvents) {\r\n // If page is closed release queue\r\n addPageUnloadEventListener(_doUnload, excludePageUnloadEvents, _evtNamespace);\r\n addPageHideEventListener(_doUnload, excludePageUnloadEvents, _evtNamespace);\r\n }\r\n _excludePageUnloadEvents = excludePageUnloadEvents;\r\n }));\r\n function _doUnload() {\r\n _releaseEventQueue();\r\n }\r\n };\r\n _self.processTelemetry = function (event, itemCtx) {\r\n itemCtx = _self._getTelCtx(itemCtx);\r\n if (!_retrieveFullVersion && !_getOSInProgress && _firstAttempt) {\r\n // Start Requesting OS version process\r\n _getOSInProgress = true;\r\n startRetrieveOsVersion();\r\n _firstAttempt = false;\r\n }\r\n if (_getOSInProgress) {\r\n _eventQueue.push({\r\n ctx: itemCtx,\r\n item: event\r\n });\r\n }\r\n else {\r\n updateTeleItemWithOs(event);\r\n _self.processNext(event, itemCtx);\r\n }\r\n };\r\n _self._doTeardown = function (unloadCtx, unloadState) {\r\n _completeOsRetrieve();\r\n removePageUnloadEventListener(null, _evtNamespace);\r\n removePageHideEventListener(null, _evtNamespace);\r\n // Just register to remove all events associated with this namespace\r\n _initDefaults();\r\n };\r\n /**\r\n * Wait for the response from the browser for the OS version and store info in the session storage\r\n */\r\n function startRetrieveOsVersion() {\r\n // Timeout request if it takes more than 5 seconds (by default)\r\n var _a;\r\n _getOSTimeout = scheduleTimeout(function () {\r\n _completeOsRetrieve();\r\n }, _maxTimeout);\r\n if (navigator.userAgent) {\r\n var getHighEntropyValues = (_a = navigator.userAgentData) === null || _a === void 0 ? void 0 : _a.getHighEntropyValues;\r\n if (getHighEntropyValues) {\r\n doAwaitResponse(navigator.userAgentData.getHighEntropyValues([\"platformVersion\"]), function (response) {\r\n if (!response.rejected) {\r\n _platformVersionResponse = response.value;\r\n _retrieveFullVersion = true;\r\n if (_platformVersionResponse[_DYN_PLATFORM_VERSION /* @min:%2eplatformVersion */] && _platformVersionResponse.platform) {\r\n _os = _platformVersionResponse.platform;\r\n _osVer = parseInt(_platformVersionResponse[_DYN_PLATFORM_VERSION /* @min:%2eplatformVersion */]);\r\n if (_os === \"Windows\") {\r\n if (_osVer == 0) {\r\n _osVer = 8;\r\n }\r\n else if (_osVer < 13) {\r\n _osVer = 10;\r\n }\r\n else {\r\n _osVer = 11;\r\n }\r\n }\r\n utlSetSessionStorage(_core.logger, \"ai_osplugin\", JSON.stringify({ platform: _os, platformVersion: _osVer }));\r\n }\r\n }\r\n else {\r\n _throwInternal(_core.logger, 1 /* eLoggingSeverity.CRITICAL */, 73 /* _eInternalMessageId.PluginException */, \"Could not retrieve operating system: \" + response.reason);\r\n }\r\n _completeOsRetrieve();\r\n });\r\n }\r\n }\r\n }\r\n function updateTeleItemWithOs(event) {\r\n if (_retrieveFullVersion) {\r\n var extOS = getSetValue(getSetValue(event, strExt), Extensions.OSExt);\r\n if (_mergeOsNameVersion) {\r\n setValue(extOS, \"osVer\", _os + _osVer, isString);\r\n }\r\n else {\r\n setValue(extOS, \"osVer\", _osVer);\r\n setValue(extOS, \"os\", _os, isString);\r\n }\r\n }\r\n }\r\n /**\r\n * Complete retrieving operating system info process, cleanup and release the event queue\r\n */\r\n function _completeOsRetrieve() {\r\n if (_getOSTimeout) {\r\n _getOSTimeout.cancel();\r\n }\r\n _getOSInProgress = false;\r\n _releaseEventQueue();\r\n }\r\n /**\r\n * Release internal event queue\r\n */\r\n function _releaseEventQueue() {\r\n arrForEach(_eventQueue, function (evt) {\r\n updateTeleItemWithOs(evt.item);\r\n _self.processNext(evt.item, evt.ctx);\r\n });\r\n _eventQueue = [];\r\n }\r\n function _initDefaults() {\r\n _core = null;\r\n _ocConfig = null;\r\n _getOSInProgress = false;\r\n _getOSTimeout = null;\r\n _maxTimeout = null;\r\n _retrieveFullVersion = false;\r\n _eventQueue = [];\r\n _firstAttempt = true;\r\n }\r\n // Special internal method to allow the DebugPlugin to hook embedded objects\r\n _self[\"_getDbgPlgTargets\"] = function () {\r\n return [_platformVersionResponse, _eventQueue, _getOSInProgress];\r\n };\r\n });\r\n return _this;\r\n }\r\n OsPlugin.prototype.initialize = function (config, core, extensions) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Process the event and add it to an internal queue if handshake in process\r\n * @param event - The event to process\r\n * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances\r\n * can optionally use this to access the current core instance or define / pass additional information\r\n * to later plugins (vs appending items to the telemetry item)\r\n */\r\n OsPlugin.prototype.processTelemetry = function (event, itemCtx) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n };\r\n return OsPlugin;\r\n}(BaseTelemetryPlugin));\r\nexport { OsPlugin };\r\n//# sourceMappingURL=OsPlugin.js.map"],"names":[],"mappings":";;;;AAAA,gFAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;wDAYM,CAAC;;;;;oBACa;AACpB;AACA;AACA"}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - OS Plugin, 3.4.0-nightlybeta3.2505-35
2
+ * Application Insights JavaScript SDK - OS Plugin, 3.4.0-nightlybeta3.2507-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - OS Plugin, 3.4.0-nightlybeta3.2505-35
2
+ * Application Insights JavaScript SDK - OS Plugin, 3.4.0-nightlybeta3.2507-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/applicationinsights-osplugin-js",
3
- "version": "3.4.0-nightlybeta3.2505-35",
3
+ "version": "3.4.0-nightlybeta3.2507-23",
4
4
  "description": "Microsoft Application Insights OS Plugin",
5
5
  "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
6
6
  "author": "Microsoft Application Insights Team",
@@ -30,9 +30,9 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@microsoft/applicationinsights-shims": "3.0.1",
33
- "@microsoft/applicationinsights-common": "3.4.0-nightlybeta3.2505-35",
33
+ "@microsoft/applicationinsights-common": "3.4.0-nightlybeta3.2507-23",
34
34
  "@microsoft/dynamicproto-js": "^2.0.3",
35
- "@microsoft/applicationinsights-core-js": "3.4.0-nightlybeta3.2505-35",
35
+ "@microsoft/applicationinsights-core-js": "3.4.0-nightlybeta3.2507-23",
36
36
  "@nevware21/ts-utils": ">= 0.11.8 < 2.x",
37
37
  "@nevware21/ts-async": ">= 0.5.4 < 2.x"
38
38
  },
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights osplugin plugin, 3.4.0-nightlybeta3.2505-35
2
+ * Microsoft Application Insights osplugin plugin, 3.4.0-nightlybeta3.2507-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights osplugin plugin, 3.4.0-nightlybeta3.2505-35
2
+ * Microsoft Application Insights osplugin plugin, 3.4.0-nightlybeta3.2507-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -29,9 +29,12 @@ declare namespace ApplicationInsights {
29
29
  */
30
30
  processNext: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
31
31
  /**
32
- * Set next extension for telemetry processing
32
+ * Set next extension for telemetry processing, this is now optional as plugins should use the
33
+ * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
34
+ * now for backward compatibility only.
35
+ * @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead
33
36
  */
34
- setNextPlugin: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
37
+ setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
35
38
  /**
36
39
  * Returns the current diagnostic logger that can be used to log issues, if no logger is currently
37
40
  * assigned a new default one will be created and returned.
@@ -129,17 +132,78 @@ declare namespace ApplicationInsights {
129
132
 
130
133
  const enum eDistributedTracingModes {
131
134
  /**
132
- * (Default) Send Application Insights correlation headers
135
+ * Send only the legacy Application Insights correlation headers
136
+ *
137
+ * Headers Sent:
138
+ * - `Request-Id` (Legacy Application Insights header for older Server side SDKs)
139
+ *
140
+ * Config Decimal Value: `0` (Zero)
133
141
  */
134
142
  AI = 0,
135
143
  /**
136
- * Send both W3C Trace Context headers and back-compatibility Application Insights headers
144
+ * (Default) Send both W3C Trace parent header and back-compatibility Application Insights headers
145
+ * - `Request-Id`
146
+ * - [`traceparent`](https://www.w3.org/TR/trace-context/#traceparent-header)
147
+ *
148
+ * Config Decimal Value: `1` (One)
137
149
  */
138
150
  AI_AND_W3C = 1,
139
151
  /**
140
- * Send W3C Trace Context headers
152
+ * Send Only the W3C Trace parent header
153
+ *
154
+ * Headers Sent:
155
+ * - [`traceparent`](https://www.w3.org/TR/trace-context/#traceparent-header)
156
+ *
157
+ * Config Decimal Value: `2` (Two)
158
+ */
159
+ W3C = 2,
160
+ /**
161
+ * @internal
162
+ * Bitwise mask used to separate the base distributed tracing mode from the additional optional
163
+ * tracing modes.
164
+ * @since 3.4.0
165
+ */
166
+ _BaseMask = 15,
167
+ /**
168
+ * @internal
169
+ * Enabling this bit will send the W3C Trace State header, it is not intended to be used directly
170
+ * or on its own. The code may assume that if this bit is set, then the W3C Trace Context headers
171
+ * will also be included.
172
+ *
173
+ * Config Decimal Value: `16` (Sixteen in decimal)
174
+ * @since 3.4.0
141
175
  */
142
- W3C = 2
176
+ _W3CTraceState = 16,
177
+ /**
178
+ * Send all of the W3C Trace Context headers and the W3C Trace State headers and back-compatibility
179
+ * Application Insights headers.
180
+ *
181
+ * Currently sent headers:
182
+ * - `Request-Id` (Legacy Application Insights header for older Server side SDKs)
183
+ * - [`traceparent`](https://www.w3.org/TR/trace-context/#traceparent-header)
184
+ * - [`tracestate`](https://www.w3.org/TR/trace-context/#tracestate-header)
185
+ *
186
+ * NOTE!: Additional headers may be added as part of a future update should the W3C Trace Context specification be updated
187
+ * to include additional headers.
188
+ *
189
+ * Config Decimal Value: `17` (Seventeen in decimal)
190
+ * @since 3.4.0
191
+ */
192
+ AI_AND_W3C_TRACE = 17,
193
+ /**
194
+ * Send all of the W3C Trace Context headers and the W3C Trace State headers.
195
+ *
196
+ * Currently sent headers:
197
+ * - [`traceparent`](https://www.w3.org/TR/trace-context/#traceparent-header)
198
+ * - [`tracestate`](https://www.w3.org/TR/trace-context/#tracestate-header)
199
+ *
200
+ * NOTE!: Additional headers may be added as part of a future update should the W3C Trace Context specification be updated
201
+ * to include additional headers.
202
+ *
203
+ * Config Decimal Value: `18` (Eighteen in decimal)
204
+ * @since 3.4.0
205
+ */
206
+ W3C_TRACE = 18
143
207
  }
144
208
 
145
209
  const enum _eInternalMessageId {
@@ -272,6 +336,30 @@ declare namespace ApplicationInsights {
272
336
 
273
337
  type EnumValue<E = any> = EnumCls<E>;
274
338
 
339
+ /**
340
+ * Controls how the SDK should look for trace headers (traceparent/tracestate) from the initial page load
341
+ * The values are bitwise OR'd together to allow for multiple values to be set at once.
342
+ * @since 3.4.0
343
+ */
344
+ const enum eTraceHeadersMode {
345
+ /**
346
+ * Don't look for any trace headers
347
+ */
348
+ None = 0,
349
+ /**
350
+ * Look for traceparent header/meta tag
351
+ */
352
+ TraceParent = 1,
353
+ /**
354
+ * Look for tracestate header/meta tag
355
+ */
356
+ TraceState = 2,
357
+ /**
358
+ * Look for both traceparent and tracestate headers/meta tags
359
+ */
360
+ All = 3
361
+ }
362
+
275
363
  const enum FeatureOptInMode {
276
364
  /**
277
365
  * not set, completely depends on cdn cfg
@@ -414,7 +502,7 @@ declare namespace ApplicationInsights {
414
502
  */
415
503
  flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
416
504
  /**
417
- * Gets the current distributed trace context for this instance if available
505
+ * Gets the current distributed trace active context for this instance
418
506
  * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to true
419
507
  */
420
508
  getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
@@ -463,9 +551,12 @@ declare namespace ApplicationInsights {
463
551
  */
464
552
  getCfg: () => IConfiguration;
465
553
  /**
466
- * Gets the named extension config
554
+ * Gets the named extension configuration
555
+ * @param identifier - The named extension identifier
556
+ * @param defaultValue - The default value(s) to return if no defined config exists
557
+ * @param rootOnly - If true, only the look for the configuration in the top level and not in the "extensionConfig"
467
558
  */
468
- getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>) => T;
559
+ getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>, rootOnly?: boolean) => T;
469
560
  /**
470
561
  * Gets the named config from either the named identifier extension or core config if neither exist then the
471
562
  * default value is returned
@@ -1086,7 +1177,7 @@ declare namespace ApplicationInsights {
1086
1177
  * }
1087
1178
  * ```
1088
1179
  *
1089
- * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/docs/PageUnloadEvents.html).
1180
+ * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html).
1090
1181
  */
1091
1182
  disablePageUnloadEvents?: string[];
1092
1183
  /**
@@ -1101,7 +1192,7 @@ declare namespace ApplicationInsights {
1101
1192
  * }
1102
1193
  * ```
1103
1194
  *
1104
- * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/docs/PageUnloadEvents.html).
1195
+ * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html).
1105
1196
  */
1106
1197
  disablePageShowEvents?: string[];
1107
1198
  /**
@@ -1143,6 +1234,25 @@ declare namespace ApplicationInsights {
1143
1234
  * @since 3.3.2
1144
1235
  */
1145
1236
  expCfg?: IExceptionConfig;
1237
+ /**
1238
+ * [Optional] A flag to enable or disable the use of the field redaction for urls.
1239
+ * @defaultValue true
1240
+ */
1241
+ redactUrls?: boolean;
1242
+ /**
1243
+ * [Optional] Additional query parameters to redact beyond the default set.
1244
+ * Use this to specify custom parameters that contain sensitive information.
1245
+ * These will be combined with the default parameters that are redacted.
1246
+ * @defaultValue ["sig", "Signature", "AWSAccessKeyId", "X-Goog-Signature"]
1247
+ * @example ["sig", "Signature", "AWSAccessKeyId", "X-Goog-Signature","auth_token", "api_key", "private_data"]
1248
+ */
1249
+ redactQueryParams?: string[];
1250
+ /**
1251
+ * [Optional] Controls if the SDK should look for the `traceparent` and/or `tracestate` values from
1252
+ * the service timing headers or meta tags from the initial page load.
1253
+ * @defaultValue eTraceHeadersMode.All
1254
+ */
1255
+ traceHdrMode?: eTraceHeadersMode;
1146
1256
  }
1147
1257
 
1148
1258
  interface ICookieMgr {
@@ -1323,8 +1433,13 @@ declare namespace ApplicationInsights {
1323
1433
  */
1324
1434
  getName(): string;
1325
1435
  /**
1326
- * Sets the current name of the page
1436
+ * Sets the current name of the page, also updates the name for any parent context.
1437
+ * This is used to identify the page in the telemetry data.
1438
+ * @remarks This function updates the current and ALL parent contexts with the new name,
1439
+ * to just update the name of the current context, use the `pageName` property.
1327
1440
  * @param pageName - The name of the page
1441
+ * @deprecated Use the `pageName` property to avoid the side effect of changing the page name of all
1442
+ * parent contexts.
1328
1443
  */
1329
1444
  setName(pageName: string): void;
1330
1445
  /**
@@ -1337,6 +1452,12 @@ declare namespace ApplicationInsights {
1337
1452
  * Set the unique identifier for a trace. All requests / spans from the same trace share the same traceId.
1338
1453
  * Must be conform to the W3C TraceContext specification, in a hex representation of 16-byte array.
1339
1454
  * A.k.a. trace-id, TraceID or Distributed TraceID https://www.w3.org/TR/trace-context/#trace-id
1455
+ *
1456
+ * @remarks Sets the traceId for the current context AND all parent contexts, if you want to set the traceId
1457
+ * for the current context only, use the `traceId` property.
1458
+ * @param newValue - The traceId to set
1459
+ * @deprecated Use the `traceId` property to avoid the side effect of changing the traceId of all
1460
+ * parent contexts.
1340
1461
  */
1341
1462
  setTraceId(newValue: string): void;
1342
1463
  /**
@@ -1348,6 +1469,12 @@ declare namespace ApplicationInsights {
1348
1469
  * Self-generated 8-bytes identifier of the incoming request. Must be a hex representation of 8-byte array.
1349
1470
  * Also know as the parentId, used to link requests together
1350
1471
  * https://www.w3.org/TR/trace-context/#parent-id
1472
+ *
1473
+ * @remarks Sets the spanId for the current context AND all parent contexts, if you want to set the spanId for
1474
+ * the current context only, use the `spanId` property.
1475
+ * @param newValue - The spanId to set
1476
+ * @deprecated Use the `spanId` property to avoid the side effect of changing the spanId of all
1477
+ * parent contexts.
1351
1478
  */
1352
1479
  setSpanId(newValue: string): void;
1353
1480
  /**
@@ -1356,9 +1483,80 @@ declare namespace ApplicationInsights {
1356
1483
  getTraceFlags(): number | undefined;
1357
1484
  /**
1358
1485
  * https://www.w3.org/TR/trace-context/#trace-flags
1486
+ * @remarks Sets the trace flags for the current context and ALL parent contexts, if you want to set the trace
1487
+ * flags for the current context only, use the `traceFlags` property.
1359
1488
  * @param newValue - An integer representation of the W3C TraceContext trace-flags.
1489
+ * @deprecated Use the `traceFlags` property to avoid the side effect of changing the traceFlags of all
1490
+ * parent contexts.
1360
1491
  */
1361
1492
  setTraceFlags(newValue?: number): void;
1493
+ /**
1494
+ * Returns the current name of the page
1495
+ * @remarks This function updates the current context only, to update the name of the current and ALL parent contexts,
1496
+ * use the `setName` method.
1497
+ * @default undefined
1498
+ * @since 3.4.0
1499
+ */
1500
+ pageName: string;
1501
+ /**
1502
+ * The current ID of the trace that this span belongs to. It is worldwide unique
1503
+ * with practically sufficient probability by being made as 16 randomly
1504
+ * generated bytes, encoded as a 32 lowercase hex characters corresponding to
1505
+ * 128 bits.
1506
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
1507
+ * if you need to update the current and ALL parent contexts, use the `setTraceId` method.
1508
+ * @since 3.4.0
1509
+ */
1510
+ traceId: string;
1511
+ /**
1512
+ * The ID of the Span. It is globally unique with practically sufficient
1513
+ * probability by being made as 8 randomly generated bytes, encoded as a 16
1514
+ * lowercase hex characters corresponding to 64 bits.
1515
+ * If you update this value, it will only update for the current context, not the parent context.
1516
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
1517
+ * if you need to update the current and ALL parent contexts, use the `setSpanId` method.
1518
+ * @since 3.4.0
1519
+ */
1520
+ spanId: string;
1521
+ /**
1522
+ * Returns true if the current context was initialized (propagated) from a remote parent.
1523
+ * @since 3.4.0
1524
+ * @default false
1525
+ * @returns True if the context was propagated from a remote parent
1526
+ */
1527
+ readonly isRemote: boolean;
1528
+ /**
1529
+ * Trace flags to propagate.
1530
+ *
1531
+ * It is represented as 1 byte (bitmap). Bit to represent whether trace is
1532
+ * sampled or not. When set, the least significant bit documents that the
1533
+ * caller may have recorded trace data. A caller who does not record trace
1534
+ * data out-of-band leaves this flag unset.
1535
+ *
1536
+ * see {@link eW3CTraceFlags} for valid flag values.
1537
+ *
1538
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
1539
+ * if you need to update the current and ALL parent contexts, use the `setTraceFlags` method.
1540
+ * @since 3.4.0
1541
+ */
1542
+ traceFlags?: number;
1543
+ /**
1544
+ * Returns the current trace state which will be used to propgate context across different services.
1545
+ * Updating (adding / removing keys) of the trace state will modify the current context.
1546
+ * @remarks Unlike the OpenTelemetry {@link TraceState}, this value is a mutable object, so you can
1547
+ * modify it directly you do not need to reassign the new value to this property.
1548
+ * @since 3.4.0
1549
+ */
1550
+ readonly traceState: IW3cTraceState;
1551
+ /**
1552
+ * Provides access to the parent context of the current context.
1553
+ * @remarks This is a read-only property, you cannot modify the parent context directly, you can only
1554
+ * modify the current context. If you need to modify the parent context, you need to do it through the
1555
+ * current context using the `setTraceId`, `setSpanId`, `setTraceFlags` and `setName` methods.
1556
+ * @default null
1557
+ * @since 3.4.0
1558
+ */
1559
+ readonly parentCtx?: IDistributedTraceContext | null;
1362
1560
  }
1363
1561
 
1364
1562
  /**
@@ -2155,9 +2353,10 @@ declare namespace ApplicationInsights {
2155
2353
  */
2156
2354
  interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
2157
2355
  /**
2158
- * Set next extension for telemetry processing, this is not optional as plugins should use the
2356
+ * Set next extension for telemetry processing, this is now optional as plugins should use the
2159
2357
  * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
2160
2358
  * now for backward compatibility only.
2359
+ * @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead
2161
2360
  */
2162
2361
  setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
2163
2362
  /**
@@ -2439,6 +2638,76 @@ declare namespace ApplicationInsights {
2439
2638
  run: (logger?: IDiagnosticLogger) => void;
2440
2639
  }
2441
2640
 
2641
+ /**
2642
+ * Represents a mutable [W3C trace state list](https://www.w3.org/TR/trace-context/#tracestate-header), this is a
2643
+ * list of key/value pairs that are used to pass trace state information between different tracing systems. The
2644
+ * list is ordered and the order is important as it determines the processing order.
2645
+ *
2646
+ * Importantly instances of this type are mutable, change made to an instance via {@link IW3cTraceState.set} or
2647
+ * {@link IW3cTraceState.del} will be reflected on the instance and any child instances that use it as a parent.
2648
+ * However, any parent instance associated with an instance will not be modified by operations on that particular
2649
+ * instance.
2650
+ *
2651
+ * @since 3.4.0
2652
+ */
2653
+ interface IW3cTraceState {
2654
+ /**
2655
+ * Returns a readonly array of the current keys associated with the trace state, keys are returned in the
2656
+ * required processing order and if this instance has a parent the keys from the parent will be included
2657
+ * unless they have been removed (deleted) from the child instance.
2658
+ * Once created any modifications to the parent will also be reflected in the child, this is different from
2659
+ * the OpenTelemetry implementation which creates a new instance for each call.
2660
+ * @returns A readonly array of the current keys associated with the trace state
2661
+ */
2662
+ readonly keys: string[];
2663
+ /**
2664
+ * Check if the trace state list is empty, meaning it has no keys or values.
2665
+ * This exists to allow for quick checks without needing to create a new array of keys.
2666
+ * @since 3.4.0
2667
+ * @returns true if the trace state list is empty, false otherwise
2668
+ */
2669
+ readonly isEmpty: boolean;
2670
+ /**
2671
+ * Get the value for the specified key that is associated with this instance, either directly or from the parent.
2672
+ * @param key - The key to lookup
2673
+ * @returns The value for the key, or undefined if not found
2674
+ */
2675
+ get(key: string): string | undefined;
2676
+ /**
2677
+ * Set the value for the specified key for this instance, returning its new location within the list.
2678
+ * - 0 is the front of the list
2679
+ * - -1 not set because the key/value pair is invalid
2680
+ * If the key already exists it will be removed from its current location and added to the front of the list. And
2681
+ * if the key was in the parent this will override the value inherited from the parent, more importantly it will
2682
+ * not modify the parent value.
2683
+ * @param key - The key to set
2684
+ * @param value - The value to set
2685
+ * @returns 0 if successful, -1 if not
2686
+ */
2687
+ set(key: string, value: string): number;
2688
+ /**
2689
+ * Delete the specified key from this instance, if the key was in the parent it will be removed (hidden) from
2690
+ * this instance but will still be available directly from the parent.
2691
+ * @param key - The key to delete
2692
+ */
2693
+ del(key: string): void;
2694
+ /**
2695
+ * Format the trace state list into a strings where each string can be used as a header value.
2696
+ * This will return an empty array if the trace state list is empty.
2697
+ * @param maxHeaders - The maximum number of entries to include in the output, once the limit is reached no more entries will be included
2698
+ * @param maxKeys - The maximum number of keys to include in the output, once the limit is reached no more keys will be included
2699
+ * @param maxLen - The maximum length of each header value, once the limit is reached a new header value will be created
2700
+ * @returns An array of strings that can be used for the header values, if the trace state list is empty an empty array will be returned
2701
+ */
2702
+ hdrs(maxHeaders?: number, maxKeys?: number, maxLen?: number): string[];
2703
+ /**
2704
+ * Create a new instance of IW3cTraceState which is a child of this instance, meaning it will inherit the keys
2705
+ * and values from this instance but any changes made to the child will not affect this instance.
2706
+ * @returns A new instance of IW3cTraceState which is a child of this instance
2707
+ */
2708
+ child(): IW3cTraceState;
2709
+ }
2710
+
2442
2711
  interface IWatchDetails<T = IConfiguration> {
2443
2712
  /**
2444
2713
  * The current config object