@microsoft/applicationinsights-core-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 (131) hide show
  1. package/browser/es5/applicationinsights-core-js.cjs.js +939 -248
  2. package/browser/es5/applicationinsights-core-js.cjs.js.map +1 -1
  3. package/browser/es5/applicationinsights-core-js.cjs.min.js +2 -2
  4. package/browser/es5/applicationinsights-core-js.cjs.min.js.map +1 -1
  5. package/browser/es5/applicationinsights-core-js.gbl.js +941 -250
  6. package/browser/es5/applicationinsights-core-js.gbl.js.map +1 -1
  7. package/browser/es5/applicationinsights-core-js.gbl.min.js +2 -2
  8. package/browser/es5/applicationinsights-core-js.gbl.min.js.map +1 -1
  9. package/browser/es5/applicationinsights-core-js.integrity.json +25 -25
  10. package/browser/es5/applicationinsights-core-js.js +941 -250
  11. package/browser/es5/applicationinsights-core-js.js.map +1 -1
  12. package/browser/es5/applicationinsights-core-js.min.js +2 -2
  13. package/browser/es5/applicationinsights-core-js.min.js.map +1 -1
  14. package/dist/es5/applicationinsights-core-js.js +939 -248
  15. package/dist/es5/applicationinsights-core-js.js.map +1 -1
  16. package/dist/es5/applicationinsights-core-js.min.js +2 -2
  17. package/dist/es5/applicationinsights-core-js.min.js.map +1 -1
  18. package/dist-es5/Config/ConfigDefaultHelpers.js +1 -1
  19. package/dist-es5/Config/ConfigDefaults.js +1 -1
  20. package/dist-es5/Config/DynamicConfig.js +1 -1
  21. package/dist-es5/Config/DynamicProperty.js +1 -1
  22. package/dist-es5/Config/DynamicState.js +1 -1
  23. package/dist-es5/Config/DynamicSupport.js +1 -1
  24. package/dist-es5/Config/IConfigDefaults.js +1 -1
  25. package/dist-es5/Config/IDynamicConfigHandler.js +1 -1
  26. package/dist-es5/Config/IDynamicPropertyHandler.js +1 -1
  27. package/dist-es5/Config/IDynamicWatcher.js +1 -1
  28. package/dist-es5/Config/_IDynamicConfigHandlerState.js +1 -1
  29. package/dist-es5/JavaScriptSDK/AggregationError.js +1 -1
  30. package/dist-es5/JavaScriptSDK/AppInsightsCore.js +33 -4
  31. package/dist-es5/JavaScriptSDK/AppInsightsCore.js.map +1 -1
  32. package/dist-es5/JavaScriptSDK/AsyncUtils.js +1 -1
  33. package/dist-es5/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
  34. package/dist-es5/JavaScriptSDK/Constants.js +1 -1
  35. package/dist-es5/JavaScriptSDK/CookieMgr.js +1 -1
  36. package/dist-es5/JavaScriptSDK/CoreUtils.js +1 -1
  37. package/dist-es5/JavaScriptSDK/DataCacheHelper.js +2 -2
  38. package/dist-es5/JavaScriptSDK/DataCacheHelper.js.map +1 -1
  39. package/dist-es5/JavaScriptSDK/DbgExtensionUtils.js +1 -1
  40. package/dist-es5/JavaScriptSDK/DiagnosticLogger.js +1 -1
  41. package/dist-es5/JavaScriptSDK/EnvUtils.js +174 -15
  42. package/dist-es5/JavaScriptSDK/EnvUtils.js.map +1 -1
  43. package/dist-es5/JavaScriptSDK/EventHelpers.js +1 -1
  44. package/dist-es5/JavaScriptSDK/HelperFuncs.js +3 -3
  45. package/dist-es5/JavaScriptSDK/HelperFuncs.js.map +1 -1
  46. package/dist-es5/JavaScriptSDK/InstrumentHooks.js +1 -1
  47. package/dist-es5/JavaScriptSDK/InternalConstants.js +3 -1
  48. package/dist-es5/JavaScriptSDK/InternalConstants.js.map +1 -1
  49. package/dist-es5/JavaScriptSDK/NotificationManager.js +1 -1
  50. package/dist-es5/JavaScriptSDK/PerfManager.js +1 -1
  51. package/dist-es5/JavaScriptSDK/ProcessTelemetryContext.js +17 -20
  52. package/dist-es5/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
  53. package/dist-es5/JavaScriptSDK/RandomHelper.js +1 -1
  54. package/dist-es5/JavaScriptSDK/ResponseHelpers.js +1 -1
  55. package/dist-es5/JavaScriptSDK/SenderPostManager.js +1 -1
  56. package/dist-es5/JavaScriptSDK/StatsBeat.js +1 -1
  57. package/dist-es5/JavaScriptSDK/TelemetryHelpers.js +168 -35
  58. package/dist-es5/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
  59. package/dist-es5/JavaScriptSDK/TelemetryInitializerPlugin.js +1 -1
  60. package/dist-es5/JavaScriptSDK/UnloadHandlerContainer.js +1 -1
  61. package/dist-es5/JavaScriptSDK/UnloadHookContainer.js +1 -1
  62. package/dist-es5/JavaScriptSDK/W3cTraceParent.js +11 -10
  63. package/dist-es5/JavaScriptSDK/W3cTraceParent.js.map +1 -1
  64. package/dist-es5/JavaScriptSDK/W3cTraceState.js +346 -0
  65. package/dist-es5/JavaScriptSDK/W3cTraceState.js.map +1 -0
  66. package/dist-es5/JavaScriptSDK.Enums/EnumHelperFuncs.js +1 -1
  67. package/dist-es5/JavaScriptSDK.Enums/EventsDiscardedReason.js +5 -5
  68. package/dist-es5/JavaScriptSDK.Enums/EventsDiscardedReason.js.map +1 -1
  69. package/dist-es5/JavaScriptSDK.Enums/FeatureOptInEnums.js +1 -1
  70. package/dist-es5/JavaScriptSDK.Enums/InitActiveStatusEnum.js +3 -3
  71. package/dist-es5/JavaScriptSDK.Enums/InitActiveStatusEnum.js.map +1 -1
  72. package/dist-es5/JavaScriptSDK.Enums/LoggingEnums.js +3 -3
  73. package/dist-es5/JavaScriptSDK.Enums/LoggingEnums.js.map +1 -1
  74. package/dist-es5/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
  75. package/dist-es5/JavaScriptSDK.Enums/StatsType.js +1 -1
  76. package/dist-es5/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
  77. package/dist-es5/JavaScriptSDK.Enums/TelemetryUpdateReason.js +1 -1
  78. package/dist-es5/JavaScriptSDK.Enums/TraceHeadersMode.js +8 -0
  79. package/dist-es5/JavaScriptSDK.Enums/TraceHeadersMode.js.map +1 -0
  80. package/dist-es5/JavaScriptSDK.Enums/W3CTraceFlags.js +8 -0
  81. package/dist-es5/JavaScriptSDK.Enums/W3CTraceFlags.js.map +1 -0
  82. package/dist-es5/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
  83. package/dist-es5/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
  84. package/dist-es5/JavaScriptSDK.Interfaces/IChannelControlsHost.js +1 -1
  85. package/dist-es5/JavaScriptSDK.Interfaces/IConfiguration.js +12 -3
  86. package/dist-es5/JavaScriptSDK.Interfaces/IConfiguration.js.map +1 -1
  87. package/dist-es5/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
  88. package/dist-es5/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
  89. package/dist-es5/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
  90. package/dist-es5/JavaScriptSDK.Interfaces/IDistributedTraceContext.js +1 -1
  91. package/dist-es5/JavaScriptSDK.Interfaces/IExceptionConfig.js +1 -1
  92. package/dist-es5/JavaScriptSDK.Interfaces/IFeatureOptIn.js +1 -1
  93. package/dist-es5/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
  94. package/dist-es5/JavaScriptSDK.Interfaces/INetworkStatsbeat.js +1 -1
  95. package/dist-es5/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
  96. package/dist-es5/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
  97. package/dist-es5/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
  98. package/dist-es5/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
  99. package/dist-es5/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
  100. package/dist-es5/JavaScriptSDK.Interfaces/ISenderPostManager.js +1 -1
  101. package/dist-es5/JavaScriptSDK.Interfaces/IStatsBeat.js +1 -1
  102. package/dist-es5/JavaScriptSDK.Interfaces/IStatsEventData.js +1 -1
  103. package/dist-es5/JavaScriptSDK.Interfaces/IStatsMgr.js +1 -1
  104. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
  105. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
  106. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
  107. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
  108. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
  109. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +1 -1
  110. package/dist-es5/JavaScriptSDK.Interfaces/ITraceParent.js +1 -1
  111. package/dist-es5/JavaScriptSDK.Interfaces/IUnloadHook.js +1 -1
  112. package/dist-es5/JavaScriptSDK.Interfaces/IUnloadableComponent.js +1 -1
  113. package/dist-es5/JavaScriptSDK.Interfaces/IW3cTraceState.js +8 -0
  114. package/dist-es5/JavaScriptSDK.Interfaces/IW3cTraceState.js.map +1 -0
  115. package/dist-es5/JavaScriptSDK.Interfaces/IXDomainRequest.js +1 -1
  116. package/dist-es5/JavaScriptSDK.Interfaces/IXHROverride.js +1 -1
  117. package/dist-es5/OpenTelemetry/interfaces/trace/IOTelSpanContext.js +6 -0
  118. package/dist-es5/OpenTelemetry/interfaces/trace/IOTelSpanContext.js.map +1 -0
  119. package/dist-es5/OpenTelemetry/interfaces/trace/IOTelTraceState.js +8 -0
  120. package/dist-es5/OpenTelemetry/interfaces/trace/IOTelTraceState.js.map +1 -0
  121. package/dist-es5/OpenTelemetry/trace/spanContext.js +59 -0
  122. package/dist-es5/OpenTelemetry/trace/spanContext.js.map +1 -0
  123. package/dist-es5/OpenTelemetry/trace/traceState.js +97 -0
  124. package/dist-es5/OpenTelemetry/trace/traceState.js.map +1 -0
  125. package/dist-es5/__DynamicConstants.js +15 -9
  126. package/dist-es5/__DynamicConstants.js.map +1 -1
  127. package/dist-es5/applicationinsights-core-js.js +4 -3
  128. package/dist-es5/applicationinsights-core-js.js.map +1 -1
  129. package/package.json +1 -1
  130. package/types/applicationinsights-core-js.d.ts +434 -14
  131. package/types/applicationinsights-core-js.namespaced.d.ts +434 -14
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights Core Javascript SDK, 3.4.0-nightlybeta3.2505-35
2
+ * Microsoft Application Insights Core Javascript SDK, 3.4.0-nightlybeta3.2507-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -205,12 +205,21 @@ declare namespace ApplicationInsights {
205
205
  * @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
206
206
  * If the caller doesn't return true the caller should assume that it may never be called.
207
207
  * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
208
- * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
208
+ * @returns true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
209
209
  */
210
210
  flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): void;
211
211
  /**
212
- * Gets the current distributed trace context for this instance if available
213
- * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to true
212
+ * Gets the current distributed trace context for this instance if available, you can optional
213
+ * create a new instance if one does not currently exist or return null if one does not currently exist.
214
+ * When a server context is available it will be used as the parent context for the any new instance created
215
+ * (when createNew is true or no instance currently exists), calling this function will not
216
+ * change the current distributed trace context, it will only return the current context
217
+ * or create a new instance if one does not currently exist.
218
+ * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to
219
+ * undefined which will only create a new instance if one does not currently exist.
220
+ * If set to `false` then it will return null if no distributed trace context is available.
221
+ * If set to `true` then a new instance will be created even if one already exists.
222
+ * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to
214
223
  */
215
224
  getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
216
225
  /**
@@ -555,9 +564,12 @@ declare namespace ApplicationInsights {
555
564
  */
556
565
  processNext: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
557
566
  /**
558
- * Set next extension for telemetry processing
567
+ * Set next extension for telemetry processing, this is now optional as plugins should use the
568
+ * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
569
+ * now for backward compatibility only.
570
+ * @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead
559
571
  */
560
- setNextPlugin: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
572
+ setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
561
573
  /**
562
574
  * Returns the current diagnostic logger that can be used to log issues, if no logger is currently
563
575
  * assigned a new default one will be created and returned.
@@ -736,7 +748,7 @@ declare namespace ApplicationInsights {
736
748
  * @param defaultValue - The default value to apply it not provided or it's not valid
737
749
  * @returns a new IConfigDefaultCheck structure
738
750
  */
739
- function cfgDfMerge<V, T = IConfiguration, C = IConfiguration>(defaultValue: V | IConfigDefaults<V, T>): IConfigDefaultCheck<T, V, C>;
751
+ function cfgDfMerge<V, T = IConfiguration, C = IConfiguration>(defaultValue: (V | undefined) | IConfigDefaults<V | undefined, T>): IConfigDefaultCheck<T, V | undefined, C>;
740
752
 
741
753
  /**
742
754
  * Helper which returns an IConfigDefaultCheck instance with the provided field set function
@@ -782,6 +794,37 @@ declare namespace ApplicationInsights {
782
794
 
783
795
  function createCustomDomEvent(eventName: string, details?: any): CustomEvent;
784
796
 
797
+ /**
798
+ * Creates an IDistributedTraceContext instance that ensures a valid traceId is always available.
799
+ * The traceId will be inherited from the parent context if valid, otherwise a new random W3C trace ID is generated.
800
+ *
801
+ * @param parent - An optional parent {@link IDistributedTraceContext} or {@link IOTelSpanContext} to inherit
802
+ * trace context values from. If provided, the traceId and spanId will be copied from the parent if they are valid.
803
+ * When the parent is an {@link IDistributedTraceContext}, it will be set as the parentCtx property to maintain
804
+ * hierarchical relationships and enable parent context updates.
805
+ * When the parent is an {@link IOTelSpanContext}, the parentCtx will be null because OpenTelemetry span contexts
806
+ * are read-only data sources that don't support the same hierarchical management methods as IDistributedTraceContext.
807
+ * The core instance will create a wrapped IDistributedTraceContext instance from the IOTelSpanContext data
808
+ * to enable Application Insights distributed tracing functionality while maintaining OpenTelemetry compatibility.
809
+ *
810
+ * @returns A new IDistributedTraceContext instance with the following behavior:
811
+ * - **traceId**: Always present - either inherited from parent (if valid) or newly generated W3C trace ID
812
+ * - **spanId**: Inherited from parent if valid, otherwise empty string
813
+ * - **traceFlags**: Inherited from parent if available, otherwise undefined
814
+ * - **pageName**: Inherited from parent context or derived from current location, defaults to "_unknown_"
815
+ * - **traceState**: Lazily created W3C trace state, inheriting from parent if available
816
+ *
817
+ * @remarks
818
+ * This function ensures consistent distributed tracing by guaranteeing that every context has a valid traceId,
819
+ * which is essential for the refactored W3C trace state implementation. The spanId may be empty until a
820
+ * specific span is created, which is normal behavior for trace contexts.
821
+ *
822
+ * The distinction between IDistributedTraceContext and IOTelSpanContext parents is important:
823
+ * - IDistributedTraceContext parents enable bidirectional updates and hierarchical management
824
+ * - IOTelSpanContext parents are used only for initial data extraction and OpenTelemetry compatibility
825
+ */
826
+ function createDistributedTraceContext(parent?: IDistributedTraceContext | IOTelSpanContext): IDistributedTraceContext;
827
+
785
828
  /**
786
829
  * Create or return a dynamic version of the passed config, if it is not already dynamic
787
830
  * @param config - The config to be converted into a dynamic config
@@ -843,6 +886,19 @@ declare namespace ApplicationInsights {
843
886
  [key in keyof E]: [E[keyof E], V[keyof V]];
844
887
  }) => V;
845
888
 
889
+ /**
890
+ * Creates a new mutable {@link IW3cTraceState} instance, optionally inheriting from the parent trace state
891
+ * and optionally using the provided encoded string value as the initial trace state.
892
+ * Calls to {@link IW3cTraceState.set} and {@link IW3cTraceState.del} will modify the current instance
893
+ * which means that any child instance that is using this instance as a parent will also be indirectly
894
+ * modified unless the child instance has overridden the value associated with the modified key.
895
+ * @since 3.4.0
896
+ * @param value - The string value for the trace state
897
+ * @param parent - The parent trace state to inherit any existing keys from.
898
+ * @returns - A new distributed trace state instance
899
+ */
900
+ function createW3cTraceState(value?: string | null, parent?: IW3cTraceState | null): IW3cTraceState;
901
+
846
902
  /**
847
903
  * Return the number of milliseconds that have elapsed since January 1, 1970 00:00:00 UTC.
848
904
  *
@@ -1219,6 +1275,30 @@ declare namespace ApplicationInsights {
1219
1275
 
1220
1276
  type EnumValue<E = any> = EnumCls<E>;
1221
1277
 
1278
+ /**
1279
+ * Controls how the SDK should look for trace headers (traceparent/tracestate) from the initial page load
1280
+ * The values are bitwise OR'd together to allow for multiple values to be set at once.
1281
+ * @since 3.4.0
1282
+ */
1283
+ const enum eTraceHeadersMode {
1284
+ /**
1285
+ * Don't look for any trace headers
1286
+ */
1287
+ None = 0,
1288
+ /**
1289
+ * Look for traceparent header/meta tag
1290
+ */
1291
+ TraceParent = 1,
1292
+ /**
1293
+ * Look for tracestate header/meta tag
1294
+ */
1295
+ TraceState = 2,
1296
+ /**
1297
+ * Look for both traceparent and tracestate headers/meta tags
1298
+ */
1299
+ All = 3
1300
+ }
1301
+
1222
1302
  /**
1223
1303
  * Removes an event handler for the specified event
1224
1304
  * @param Object - to remove the event from
@@ -1253,6 +1333,21 @@ declare namespace ApplicationInsights {
1253
1333
 
1254
1334
  type EventsDiscardedReason = number | eEventsDiscardedReason;
1255
1335
 
1336
+ /**
1337
+ * The TelemetryUpdateReason enumeration contains a set of bit-wise values that specify the reason for update request.
1338
+ */
1339
+ const enum eW3CTraceFlags {
1340
+ /**
1341
+ * No sampling decision has been made.
1342
+ */
1343
+ None = 0,
1344
+ /**
1345
+ * Represents that the trace has been sampled.
1346
+ * @remarks This value is used to indicate that the trace has been sampled.
1347
+ */
1348
+ Sampled = 1
1349
+ }
1350
+
1256
1351
  const enum FeatureOptInMode {
1257
1352
  /**
1258
1353
  * not set, completely depends on cdn cfg
@@ -1268,6 +1363,14 @@ declare namespace ApplicationInsights {
1268
1363
  enable = 3
1269
1364
  }
1270
1365
 
1366
+ /**
1367
+ * Redacts sensitive information from a URL string, including credentials and specific query parameters.
1368
+ * @param input - The URL string to be redacted.
1369
+ * @param config - Configuration object that contain redactUrls setting.
1370
+ * @returns The redacted URL string or the original string if no redaction was needed or possible.
1371
+ */
1372
+ function fieldRedaction(input: string, config: IConfiguration): string;
1373
+
1271
1374
  /**
1272
1375
  * This defines the handler function that is called via the finally when the promise is resolved or rejected
1273
1376
  */
@@ -1299,6 +1402,14 @@ declare namespace ApplicationInsights {
1299
1402
  */
1300
1403
  function findW3cTraceParent(selectIdx?: number): ITraceParent;
1301
1404
 
1405
+ /**
1406
+ * Helper function to fetch the passed traceparent from the page, looking for it as a meta-tag or a Server-Timing header.
1407
+ * @since 3.4.0
1408
+ * @param selectIdx - If the found value is comma separated which is the preferred entry to select, defaults to the first
1409
+ * @returns
1410
+ */
1411
+ function findW3cTraceState(): IW3cTraceState;
1412
+
1302
1413
  /**
1303
1414
  * This is the reverse case of {@link blockDynamicConversion} in that this will tag an
1304
1415
  * object to indicate that it should always be converted into a dynamic trackable object
@@ -1689,7 +1800,7 @@ declare namespace ApplicationInsights {
1689
1800
  */
1690
1801
  flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
1691
1802
  /**
1692
- * Gets the current distributed trace context for this instance if available
1803
+ * Gets the current distributed trace active context for this instance
1693
1804
  * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to true
1694
1805
  */
1695
1806
  getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
@@ -1757,9 +1868,12 @@ declare namespace ApplicationInsights {
1757
1868
  */
1758
1869
  getCfg: () => IConfiguration;
1759
1870
  /**
1760
- * Gets the named extension config
1871
+ * Gets the named extension configuration
1872
+ * @param identifier - The named extension identifier
1873
+ * @param defaultValue - The default value(s) to return if no defined config exists
1874
+ * @param rootOnly - If true, only the look for the configuration in the top level and not in the "extensionConfig"
1761
1875
  */
1762
- getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>) => T;
1876
+ getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>, rootOnly?: boolean) => T;
1763
1877
  /**
1764
1878
  * Gets the named config from either the named identifier extension or core config if neither exist then the
1765
1879
  * default value is returned
@@ -2063,7 +2177,7 @@ declare namespace ApplicationInsights {
2063
2177
  * }
2064
2178
  * ```
2065
2179
  *
2066
- * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/docs/PageUnloadEvents.html).
2180
+ * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html).
2067
2181
  */
2068
2182
  disablePageUnloadEvents?: string[];
2069
2183
  /**
@@ -2078,7 +2192,7 @@ declare namespace ApplicationInsights {
2078
2192
  * }
2079
2193
  * ```
2080
2194
  *
2081
- * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/docs/PageUnloadEvents.html).
2195
+ * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html).
2082
2196
  */
2083
2197
  disablePageShowEvents?: string[];
2084
2198
  /**
@@ -2120,6 +2234,25 @@ declare namespace ApplicationInsights {
2120
2234
  * @since 3.3.2
2121
2235
  */
2122
2236
  expCfg?: IExceptionConfig;
2237
+ /**
2238
+ * [Optional] A flag to enable or disable the use of the field redaction for urls.
2239
+ * @defaultValue true
2240
+ */
2241
+ redactUrls?: boolean;
2242
+ /**
2243
+ * [Optional] Additional query parameters to redact beyond the default set.
2244
+ * Use this to specify custom parameters that contain sensitive information.
2245
+ * These will be combined with the default parameters that are redacted.
2246
+ * @defaultValue ["sig", "Signature", "AWSAccessKeyId", "X-Goog-Signature"]
2247
+ * @example ["sig", "Signature", "AWSAccessKeyId", "X-Goog-Signature","auth_token", "api_key", "private_data"]
2248
+ */
2249
+ redactQueryParams?: string[];
2250
+ /**
2251
+ * [Optional] Controls if the SDK should look for the `traceparent` and/or `tracestate` values from
2252
+ * the service timing headers or meta tags from the initial page load.
2253
+ * @defaultValue eTraceHeadersMode.All
2254
+ */
2255
+ traceHdrMode?: eTraceHeadersMode;
2123
2256
  }
2124
2257
 
2125
2258
  interface ICookieMgr {
@@ -2310,8 +2443,13 @@ declare namespace ApplicationInsights {
2310
2443
  */
2311
2444
  getName(): string;
2312
2445
  /**
2313
- * Sets the current name of the page
2446
+ * Sets the current name of the page, also updates the name for any parent context.
2447
+ * This is used to identify the page in the telemetry data.
2448
+ * @remarks This function updates the current and ALL parent contexts with the new name,
2449
+ * to just update the name of the current context, use the `pageName` property.
2314
2450
  * @param pageName - The name of the page
2451
+ * @deprecated Use the `pageName` property to avoid the side effect of changing the page name of all
2452
+ * parent contexts.
2315
2453
  */
2316
2454
  setName(pageName: string): void;
2317
2455
  /**
@@ -2324,6 +2462,12 @@ declare namespace ApplicationInsights {
2324
2462
  * Set the unique identifier for a trace. All requests / spans from the same trace share the same traceId.
2325
2463
  * Must be conform to the W3C TraceContext specification, in a hex representation of 16-byte array.
2326
2464
  * A.k.a. trace-id, TraceID or Distributed TraceID https://www.w3.org/TR/trace-context/#trace-id
2465
+ *
2466
+ * @remarks Sets the traceId for the current context AND all parent contexts, if you want to set the traceId
2467
+ * for the current context only, use the `traceId` property.
2468
+ * @param newValue - The traceId to set
2469
+ * @deprecated Use the `traceId` property to avoid the side effect of changing the traceId of all
2470
+ * parent contexts.
2327
2471
  */
2328
2472
  setTraceId(newValue: string): void;
2329
2473
  /**
@@ -2335,6 +2479,12 @@ declare namespace ApplicationInsights {
2335
2479
  * Self-generated 8-bytes identifier of the incoming request. Must be a hex representation of 8-byte array.
2336
2480
  * Also know as the parentId, used to link requests together
2337
2481
  * https://www.w3.org/TR/trace-context/#parent-id
2482
+ *
2483
+ * @remarks Sets the spanId for the current context AND all parent contexts, if you want to set the spanId for
2484
+ * the current context only, use the `spanId` property.
2485
+ * @param newValue - The spanId to set
2486
+ * @deprecated Use the `spanId` property to avoid the side effect of changing the spanId of all
2487
+ * parent contexts.
2338
2488
  */
2339
2489
  setSpanId(newValue: string): void;
2340
2490
  /**
@@ -2343,9 +2493,80 @@ declare namespace ApplicationInsights {
2343
2493
  getTraceFlags(): number | undefined;
2344
2494
  /**
2345
2495
  * https://www.w3.org/TR/trace-context/#trace-flags
2496
+ * @remarks Sets the trace flags for the current context and ALL parent contexts, if you want to set the trace
2497
+ * flags for the current context only, use the `traceFlags` property.
2346
2498
  * @param newValue - An integer representation of the W3C TraceContext trace-flags.
2499
+ * @deprecated Use the `traceFlags` property to avoid the side effect of changing the traceFlags of all
2500
+ * parent contexts.
2347
2501
  */
2348
2502
  setTraceFlags(newValue?: number): void;
2503
+ /**
2504
+ * Returns the current name of the page
2505
+ * @remarks This function updates the current context only, to update the name of the current and ALL parent contexts,
2506
+ * use the `setName` method.
2507
+ * @default undefined
2508
+ * @since 3.4.0
2509
+ */
2510
+ pageName: string;
2511
+ /**
2512
+ * The current ID of the trace that this span belongs to. It is worldwide unique
2513
+ * with practically sufficient probability by being made as 16 randomly
2514
+ * generated bytes, encoded as a 32 lowercase hex characters corresponding to
2515
+ * 128 bits.
2516
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
2517
+ * if you need to update the current and ALL parent contexts, use the `setTraceId` method.
2518
+ * @since 3.4.0
2519
+ */
2520
+ traceId: string;
2521
+ /**
2522
+ * The ID of the Span. It is globally unique with practically sufficient
2523
+ * probability by being made as 8 randomly generated bytes, encoded as a 16
2524
+ * lowercase hex characters corresponding to 64 bits.
2525
+ * If you update this value, it will only update for the current context, not the parent context.
2526
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
2527
+ * if you need to update the current and ALL parent contexts, use the `setSpanId` method.
2528
+ * @since 3.4.0
2529
+ */
2530
+ spanId: string;
2531
+ /**
2532
+ * Returns true if the current context was initialized (propagated) from a remote parent.
2533
+ * @since 3.4.0
2534
+ * @default false
2535
+ * @returns True if the context was propagated from a remote parent
2536
+ */
2537
+ readonly isRemote: boolean;
2538
+ /**
2539
+ * Trace flags to propagate.
2540
+ *
2541
+ * It is represented as 1 byte (bitmap). Bit to represent whether trace is
2542
+ * sampled or not. When set, the least significant bit documents that the
2543
+ * caller may have recorded trace data. A caller who does not record trace
2544
+ * data out-of-band leaves this flag unset.
2545
+ *
2546
+ * see {@link eW3CTraceFlags} for valid flag values.
2547
+ *
2548
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
2549
+ * if you need to update the current and ALL parent contexts, use the `setTraceFlags` method.
2550
+ * @since 3.4.0
2551
+ */
2552
+ traceFlags?: number;
2553
+ /**
2554
+ * Returns the current trace state which will be used to propgate context across different services.
2555
+ * Updating (adding / removing keys) of the trace state will modify the current context.
2556
+ * @remarks Unlike the OpenTelemetry {@link TraceState}, this value is a mutable object, so you can
2557
+ * modify it directly you do not need to reassign the new value to this property.
2558
+ * @since 3.4.0
2559
+ */
2560
+ readonly traceState: IW3cTraceState;
2561
+ /**
2562
+ * Provides access to the parent context of the current context.
2563
+ * @remarks This is a read-only property, you cannot modify the parent context directly, you can only
2564
+ * modify the current context. If you need to modify the parent context, you need to do it through the
2565
+ * current context using the `setTraceId`, `setSpanId`, `setTraceFlags` and `setName` methods.
2566
+ * @default null
2567
+ * @since 3.4.0
2568
+ */
2569
+ readonly parentCtx?: IDistributedTraceContext | null;
2349
2570
  }
2350
2571
 
2351
2572
  /**
@@ -2884,6 +3105,115 @@ declare namespace ApplicationInsights {
2884
3105
 
2885
3106
  type _InternalMessageId = number | _eInternalMessageId;
2886
3107
 
3108
+ /**
3109
+ * A SpanContext represents the portion of a {@link IOTelSpan} which must be
3110
+ * serialized and propagated along side of a {@link IOTelBaggage}.
3111
+ */
3112
+ interface IOTelSpanContext {
3113
+ /**
3114
+ * The ID of the trace that this span belongs to. It is worldwide unique
3115
+ * with practically sufficient probability by being made as 16 randomly
3116
+ * generated bytes, encoded as a 32 lowercase hex characters corresponding to
3117
+ * 128 bits.
3118
+ */
3119
+ traceId: string;
3120
+ /**
3121
+ * The ID of the Span. It is globally unique with practically sufficient
3122
+ * probability by being made as 8 randomly generated bytes, encoded as a 16
3123
+ * lowercase hex characters corresponding to 64 bits.
3124
+ */
3125
+ spanId: string;
3126
+ /**
3127
+ * Only true if the SpanContext was propagated from a remote parent.
3128
+ */
3129
+ isRemote?: boolean;
3130
+ /**
3131
+ * Trace flags to propagate.
3132
+ *
3133
+ * It is represented as 1 byte (bitmap). Bit to represent whether trace is
3134
+ * sampled or not. When set, the least significant bit documents that the
3135
+ * caller may have recorded trace data. A caller who does not record trace
3136
+ * data out-of-band leaves this flag unset.
3137
+ *
3138
+ * see {@link eW3CTraceFlags} for valid flag values.
3139
+ */
3140
+ traceFlags: number;
3141
+ /**
3142
+ * Tracing-system-specific info to propagate.
3143
+ *
3144
+ * The tracestate field value is a `list` as defined below. The `list` is a
3145
+ * series of `list-members` separated by commas `,`, and a list-member is a
3146
+ * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs
3147
+ * surrounding `list-members` are ignored. There can be a maximum of 32
3148
+ * `list-members` in a `list`.
3149
+ * More Info: https://www.w3.org/TR/trace-context/#tracestate-field
3150
+ *
3151
+ * Examples:
3152
+ * Single tracing system (generic format):
3153
+ * tracestate: rojo=00f067aa0ba902b7
3154
+ * Multiple tracing systems (with different formatting):
3155
+ * tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE
3156
+ */
3157
+ traceState?: IOTelTraceState;
3158
+ }
3159
+
3160
+ /**
3161
+ * Provides an OpenTelemetry compatible Interface for the Open Telemetry Api (1.9.0) TraceState type.
3162
+ *
3163
+ * The TraceState is a list of key/value pairs that are used to propagate
3164
+ * vendor-specific trace information across different distributed tracing systems.
3165
+ * The TraceState is used to store the state of a trace across different
3166
+ * distributed tracing systems, and it is used to ensure that the trace information
3167
+ * is consistent across different systems.
3168
+ *
3169
+ * Instances of TraceState are immutable, and the methods on this interface
3170
+ * return a new instance of TraceState with the updated values.
3171
+ */
3172
+ interface IOTelTraceState {
3173
+ /**
3174
+ * Create a new TraceState which inherits from this TraceState and has the
3175
+ * given key set.
3176
+ * The new entry will always be added in the front of the list of states.
3177
+ *
3178
+ * @param key - key of the TraceState entry.
3179
+ * @param value - value of the TraceState entry.
3180
+ */
3181
+ set(key: string, value: string): IOTelTraceState;
3182
+ /**
3183
+ * Return a new TraceState which inherits from this TraceState but does not
3184
+ * contain the given key.
3185
+ *
3186
+ * @param key - the key for the TraceState entry to be removed.
3187
+ */
3188
+ unset(key: string): IOTelTraceState;
3189
+ /**
3190
+ * Returns the value to which the specified key is mapped, or `undefined` if
3191
+ * this map contains no mapping for the key.
3192
+ *
3193
+ * @param key - with which the specified value is to be associated.
3194
+ * @returns the value to which the specified key is mapped, or `undefined` if
3195
+ * this map contains no mapping for the key.
3196
+ */
3197
+ get(key: string): string | undefined;
3198
+ /**
3199
+ * Serializes the TraceState to a `list` as defined below. The `list` is a series of `list-members`
3200
+ * separated by commas `,`, and a list-member is a key/value pair separated by an equals sign `=`.
3201
+ * Spaces and horizontal tabs surrounding `list-members` are ignored. There can be a maximum of 32
3202
+ * `list-members` in a `list`.
3203
+ *
3204
+ * If the resulting serialization is limited to no longer than 512 bytes, if the combination of
3205
+ * keys and values exceeds this limit, the serialization will be truncated to the last key/value pair
3206
+ * that fits within the limit. The serialization will be returned as a string.
3207
+ *
3208
+ * This is different from the {@link IW3cTraceState} serialization which returns an array of strings where each
3209
+ * string is limited to 512 bytes and the array is limited to 32 strings. Thus the OpenTelemetry serialization
3210
+ * will only return the first single string that fits within the limie.
3211
+ *
3212
+ * @returns the serialized string.
3213
+ */
3214
+ serialize(): string;
3215
+ }
3216
+
2887
3217
  /** IPayloadData describes interface of payload sent via POST channel */
2888
3218
  interface IPayloadData {
2889
3219
  urlString: string;
@@ -3733,6 +4063,13 @@ declare namespace ApplicationInsights {
3733
4063
  */
3734
4064
  function isValidTraceParent(value: ITraceParent): boolean;
3735
4065
 
4066
+ /**
4067
+ * Identifies if the provided value looks like a distributed trace state instance
4068
+ * @param value - The value to check
4069
+ * @returns - True if the value looks like a distributed trace state instance
4070
+ */
4071
+ function isW3cTraceState(value: any): value is IW3cTraceState;
4072
+
3736
4073
  /**
3737
4074
  * Checks if XMLHttpRequest is supported
3738
4075
  * @returns True if supported, otherwise false
@@ -3803,9 +4140,10 @@ declare namespace ApplicationInsights {
3803
4140
  */
3804
4141
  interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
3805
4142
  /**
3806
- * Set next extension for telemetry processing, this is not optional as plugins should use the
4143
+ * Set next extension for telemetry processing, this is now optional as plugins should use the
3807
4144
  * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
3808
4145
  * now for backward compatibility only.
4146
+ * @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead
3809
4147
  */
3810
4148
  setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
3811
4149
  /**
@@ -4085,6 +4423,76 @@ declare namespace ApplicationInsights {
4085
4423
  run: (logger?: IDiagnosticLogger) => void;
4086
4424
  }
4087
4425
 
4426
+ /**
4427
+ * Represents a mutable [W3C trace state list](https://www.w3.org/TR/trace-context/#tracestate-header), this is a
4428
+ * list of key/value pairs that are used to pass trace state information between different tracing systems. The
4429
+ * list is ordered and the order is important as it determines the processing order.
4430
+ *
4431
+ * Importantly instances of this type are mutable, change made to an instance via {@link IW3cTraceState.set} or
4432
+ * {@link IW3cTraceState.del} will be reflected on the instance and any child instances that use it as a parent.
4433
+ * However, any parent instance associated with an instance will not be modified by operations on that particular
4434
+ * instance.
4435
+ *
4436
+ * @since 3.4.0
4437
+ */
4438
+ interface IW3cTraceState {
4439
+ /**
4440
+ * Returns a readonly array of the current keys associated with the trace state, keys are returned in the
4441
+ * required processing order and if this instance has a parent the keys from the parent will be included
4442
+ * unless they have been removed (deleted) from the child instance.
4443
+ * Once created any modifications to the parent will also be reflected in the child, this is different from
4444
+ * the OpenTelemetry implementation which creates a new instance for each call.
4445
+ * @returns A readonly array of the current keys associated with the trace state
4446
+ */
4447
+ readonly keys: string[];
4448
+ /**
4449
+ * Check if the trace state list is empty, meaning it has no keys or values.
4450
+ * This exists to allow for quick checks without needing to create a new array of keys.
4451
+ * @since 3.4.0
4452
+ * @returns true if the trace state list is empty, false otherwise
4453
+ */
4454
+ readonly isEmpty: boolean;
4455
+ /**
4456
+ * Get the value for the specified key that is associated with this instance, either directly or from the parent.
4457
+ * @param key - The key to lookup
4458
+ * @returns The value for the key, or undefined if not found
4459
+ */
4460
+ get(key: string): string | undefined;
4461
+ /**
4462
+ * Set the value for the specified key for this instance, returning its new location within the list.
4463
+ * - 0 is the front of the list
4464
+ * - -1 not set because the key/value pair is invalid
4465
+ * If the key already exists it will be removed from its current location and added to the front of the list. And
4466
+ * if the key was in the parent this will override the value inherited from the parent, more importantly it will
4467
+ * not modify the parent value.
4468
+ * @param key - The key to set
4469
+ * @param value - The value to set
4470
+ * @returns 0 if successful, -1 if not
4471
+ */
4472
+ set(key: string, value: string): number;
4473
+ /**
4474
+ * Delete the specified key from this instance, if the key was in the parent it will be removed (hidden) from
4475
+ * this instance but will still be available directly from the parent.
4476
+ * @param key - The key to delete
4477
+ */
4478
+ del(key: string): void;
4479
+ /**
4480
+ * Format the trace state list into a strings where each string can be used as a header value.
4481
+ * This will return an empty array if the trace state list is empty.
4482
+ * @param maxHeaders - The maximum number of entries to include in the output, once the limit is reached no more entries will be included
4483
+ * @param maxKeys - The maximum number of keys to include in the output, once the limit is reached no more keys will be included
4484
+ * @param maxLen - The maximum length of each header value, once the limit is reached a new header value will be created
4485
+ * @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
4486
+ */
4487
+ hdrs(maxHeaders?: number, maxKeys?: number, maxLen?: number): string[];
4488
+ /**
4489
+ * Create a new instance of IW3cTraceState which is a child of this instance, meaning it will inherit the keys
4490
+ * and values from this instance but any changes made to the child will not affect this instance.
4491
+ * @returns A new instance of IW3cTraceState which is a child of this instance
4492
+ */
4493
+ child(): IW3cTraceState;
4494
+ }
4495
+
4088
4496
  interface IWatchDetails<T = IConfiguration> {
4089
4497
  /**
4090
4498
  * The current config object
@@ -4873,6 +5281,18 @@ declare namespace ApplicationInsights {
4873
5281
  */
4874
5282
  function setValue<T, K extends keyof T>(target: T, field: K, value: T[K], valChk?: ((value: T[K]) => boolean) | null, srcChk?: ((value: T[K]) => boolean) | null): T[K];
4875
5283
 
5284
+ /**
5285
+ * Create a new independent instance of IW3cTraceState that contains a snapshot of all current key/value pairs
5286
+ * from the provided instance and any parent instances. The returned instance will have no parent and will be completely
5287
+ * independent from any future changes to the original instance or its parent chain.
5288
+ * This is useful when you need to capture the current state and ensure it remains unchanged regardless of
5289
+ * future modifications to the parent instances.
5290
+ * @since 3.4.0
5291
+ * @param traceState - The trace state instance to snapshot
5292
+ * @returns A new independent instance of IW3cTraceState with all current key/value pairs captured
5293
+ */
5294
+ function snapshotW3cTraceState(traceState: IW3cTraceState): IW3cTraceState;
5295
+
4876
5296
  function sortPlugins<T = IPlugin>(plugins: T[]): T[];
4877
5297
 
4878
5298
  /**