@microsoft/applicationinsights-core-js 3.4.0-nightlybeta3.2505-36 → 3.4.0-nightlybeta3.2507-22

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-36
2
+ * Microsoft Application Insights Core Javascript SDK, 3.4.0-nightlybeta3.2507-22
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -263,12 +263,21 @@ export declare class AppInsightsCore<CfgType extends IConfiguration = IConfigura
263
263
  * @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.
264
264
  * If the caller doesn't return true the caller should assume that it may never be called.
265
265
  * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
266
- * @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
266
+ * @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
267
267
  */
268
268
  flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): void;
269
269
  /**
270
- * Gets the current distributed trace context for this instance if available
271
- * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to true
270
+ * Gets the current distributed trace context for this instance if available, you can optional
271
+ * create a new instance if one does not currently exist or return null if one does not currently exist.
272
+ * When a server context is available it will be used as the parent context for the any new instance created
273
+ * (when createNew is true or no instance currently exists), calling this function will not
274
+ * change the current distributed trace context, it will only return the current context
275
+ * or create a new instance if one does not currently exist.
276
+ * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to
277
+ * undefined which will only create a new instance if one does not currently exist.
278
+ * If set to `false` then it will return null if no distributed trace context is available.
279
+ * If set to `true` then a new instance will be created even if one already exists.
280
+ * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to
272
281
  */
273
282
  getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
274
283
  /**
@@ -356,9 +365,12 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
356
365
  */
357
366
  processNext: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
358
367
  /**
359
- * Set next extension for telemetry processing
368
+ * Set next extension for telemetry processing, this is now optional as plugins should use the
369
+ * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
370
+ * now for backward compatibility only.
371
+ * @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead
360
372
  */
361
- setNextPlugin: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
373
+ setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
362
374
  /**
363
375
  * Returns the current diagnostic logger that can be used to log issues, if no logger is currently
364
376
  * assigned a new default one will be created and returned.
@@ -537,7 +549,7 @@ export declare function cfgDfFunc<V, T, C = IConfiguration>(defaultValue?: V): I
537
549
  * @param defaultValue - The default value to apply it not provided or it's not valid
538
550
  * @returns a new IConfigDefaultCheck structure
539
551
  */
540
- export declare function cfgDfMerge<V, T = IConfiguration, C = IConfiguration>(defaultValue: V | IConfigDefaults<V, T>): IConfigDefaultCheck<T, V, C>;
552
+ export declare function cfgDfMerge<V, T = IConfiguration, C = IConfiguration>(defaultValue: (V | undefined) | IConfigDefaults<V | undefined, T>): IConfigDefaultCheck<T, V | undefined, C>;
541
553
 
542
554
  /**
543
555
  * Helper which returns an IConfigDefaultCheck instance with the provided field set function
@@ -583,6 +595,37 @@ export declare function createCookieMgr(rootConfig?: IConfiguration, logger?: ID
583
595
 
584
596
  export declare function createCustomDomEvent(eventName: string, details?: any): CustomEvent;
585
597
 
598
+ /**
599
+ * Creates an IDistributedTraceContext instance that ensures a valid traceId is always available.
600
+ * The traceId will be inherited from the parent context if valid, otherwise a new random W3C trace ID is generated.
601
+ *
602
+ * @param parent - An optional parent {@link IDistributedTraceContext} or {@link IOTelSpanContext} to inherit
603
+ * trace context values from. If provided, the traceId and spanId will be copied from the parent if they are valid.
604
+ * When the parent is an {@link IDistributedTraceContext}, it will be set as the parentCtx property to maintain
605
+ * hierarchical relationships and enable parent context updates.
606
+ * When the parent is an {@link IOTelSpanContext}, the parentCtx will be null because OpenTelemetry span contexts
607
+ * are read-only data sources that don't support the same hierarchical management methods as IDistributedTraceContext.
608
+ * The core instance will create a wrapped IDistributedTraceContext instance from the IOTelSpanContext data
609
+ * to enable Application Insights distributed tracing functionality while maintaining OpenTelemetry compatibility.
610
+ *
611
+ * @returns A new IDistributedTraceContext instance with the following behavior:
612
+ * - **traceId**: Always present - either inherited from parent (if valid) or newly generated W3C trace ID
613
+ * - **spanId**: Inherited from parent if valid, otherwise empty string
614
+ * - **traceFlags**: Inherited from parent if available, otherwise undefined
615
+ * - **pageName**: Inherited from parent context or derived from current location, defaults to "_unknown_"
616
+ * - **traceState**: Lazily created W3C trace state, inheriting from parent if available
617
+ *
618
+ * @remarks
619
+ * This function ensures consistent distributed tracing by guaranteeing that every context has a valid traceId,
620
+ * which is essential for the refactored W3C trace state implementation. The spanId may be empty until a
621
+ * specific span is created, which is normal behavior for trace contexts.
622
+ *
623
+ * The distinction between IDistributedTraceContext and IOTelSpanContext parents is important:
624
+ * - IDistributedTraceContext parents enable bidirectional updates and hierarchical management
625
+ * - IOTelSpanContext parents are used only for initial data extraction and OpenTelemetry compatibility
626
+ */
627
+ export declare function createDistributedTraceContext(parent?: IDistributedTraceContext | IOTelSpanContext): IDistributedTraceContext;
628
+
586
629
  /**
587
630
  * Create or return a dynamic version of the passed config, if it is not already dynamic
588
631
  * @param config - The config to be converted into a dynamic config
@@ -644,6 +687,19 @@ export declare const createValueMap: <E, V = E>(values: {
644
687
  [key in keyof E]: [E[keyof E], V[keyof V]];
645
688
  }) => V;
646
689
 
690
+ /**
691
+ * Creates a new mutable {@link IW3cTraceState} instance, optionally inheriting from the parent trace state
692
+ * and optionally using the provided encoded string value as the initial trace state.
693
+ * Calls to {@link IW3cTraceState.set} and {@link IW3cTraceState.del} will modify the current instance
694
+ * which means that any child instance that is using this instance as a parent will also be indirectly
695
+ * modified unless the child instance has overridden the value associated with the modified key.
696
+ * @since 3.4.0
697
+ * @param value - The string value for the trace state
698
+ * @param parent - The parent trace state to inherit any existing keys from.
699
+ * @returns - A new distributed trace state instance
700
+ */
701
+ export declare function createW3cTraceState(value?: string | null, parent?: IW3cTraceState | null): IW3cTraceState;
702
+
647
703
  export { dateNow }
648
704
 
649
705
  export { deepFreeze }
@@ -929,6 +985,30 @@ export declare const enum eLoggingSeverity {
929
985
 
930
986
  export declare type EnumValue<E = any> = EnumCls<E>;
931
987
 
988
+ /**
989
+ * Controls how the SDK should look for trace headers (traceparent/tracestate) from the initial page load
990
+ * The values are bitwise OR'd together to allow for multiple values to be set at once.
991
+ * @since 3.4.0
992
+ */
993
+ declare const enum eTraceHeadersMode {
994
+ /**
995
+ * Don't look for any trace headers
996
+ */
997
+ None = 0,
998
+ /**
999
+ * Look for traceparent header/meta tag
1000
+ */
1001
+ TraceParent = 1,
1002
+ /**
1003
+ * Look for tracestate header/meta tag
1004
+ */
1005
+ TraceState = 2,
1006
+ /**
1007
+ * Look for both traceparent and tracestate headers/meta tags
1008
+ */
1009
+ All = 3
1010
+ }
1011
+
932
1012
  /**
933
1013
  * Removes an event handler for the specified event
934
1014
  * @param Object - to remove the event from
@@ -963,6 +1043,21 @@ export declare const EventsDiscardedReason: EnumValue<typeof eEventsDiscardedRea
963
1043
 
964
1044
  export declare type EventsDiscardedReason = number | eEventsDiscardedReason;
965
1045
 
1046
+ /**
1047
+ * The TelemetryUpdateReason enumeration contains a set of bit-wise values that specify the reason for update request.
1048
+ */
1049
+ export declare const enum eW3CTraceFlags {
1050
+ /**
1051
+ * No sampling decision has been made.
1052
+ */
1053
+ None = 0,
1054
+ /**
1055
+ * Represents that the trace has been sampled.
1056
+ * @remarks This value is used to indicate that the trace has been sampled.
1057
+ */
1058
+ Sampled = 1
1059
+ }
1060
+
966
1061
  export declare const enum FeatureOptInMode {
967
1062
  /**
968
1063
  * not set, completely depends on cdn cfg
@@ -978,6 +1073,14 @@ export declare const enum FeatureOptInMode {
978
1073
  enable = 3
979
1074
  }
980
1075
 
1076
+ /**
1077
+ * Redacts sensitive information from a URL string, including credentials and specific query parameters.
1078
+ * @param input - The URL string to be redacted.
1079
+ * @param config - Configuration object that contain redactUrls setting.
1080
+ * @returns The redacted URL string or the original string if no redaction was needed or possible.
1081
+ */
1082
+ export declare function fieldRedaction(input: string, config: IConfiguration): string;
1083
+
981
1084
  /**
982
1085
  * Find all script tags in the provided document and return the information about them.
983
1086
  * @param doc - The document to search for script tags
@@ -1004,6 +1107,14 @@ export declare function findNamedServerTiming(name: string): any;
1004
1107
  */
1005
1108
  export declare function findW3cTraceParent(selectIdx?: number): ITraceParent;
1006
1109
 
1110
+ /**
1111
+ * Helper function to fetch the passed traceparent from the page, looking for it as a meta-tag or a Server-Timing header.
1112
+ * @since 3.4.0
1113
+ * @param selectIdx - If the found value is comma separated which is the preferred entry to select, defaults to the first
1114
+ * @returns
1115
+ */
1116
+ export declare function findW3cTraceState(): IW3cTraceState;
1117
+
1007
1118
  /**
1008
1119
  * This is the reverse case of {@link blockDynamicConversion} in that this will tag an
1009
1120
  * object to indicate that it should always be converted into a dynamic trackable object
@@ -1271,7 +1382,7 @@ export declare interface IAppInsightsCore<CfgType extends IConfiguration = IConf
1271
1382
  */
1272
1383
  flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
1273
1384
  /**
1274
- * Gets the current distributed trace context for this instance if available
1385
+ * Gets the current distributed trace active context for this instance
1275
1386
  * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to true
1276
1387
  */
1277
1388
  getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
@@ -1339,9 +1450,12 @@ export declare interface IBaseProcessingContext {
1339
1450
  */
1340
1451
  getCfg: () => IConfiguration;
1341
1452
  /**
1342
- * Gets the named extension config
1453
+ * Gets the named extension configuration
1454
+ * @param identifier - The named extension identifier
1455
+ * @param defaultValue - The default value(s) to return if no defined config exists
1456
+ * @param rootOnly - If true, only the look for the configuration in the top level and not in the "extensionConfig"
1343
1457
  */
1344
- getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>) => T;
1458
+ getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>, rootOnly?: boolean) => T;
1345
1459
  /**
1346
1460
  * Gets the named config from either the named identifier extension or core config if neither exist then the
1347
1461
  * default value is returned
@@ -1645,7 +1759,7 @@ export declare interface IConfiguration {
1645
1759
  * }
1646
1760
  * ```
1647
1761
  *
1648
- * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/docs/PageUnloadEvents.html).
1762
+ * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html).
1649
1763
  */
1650
1764
  disablePageUnloadEvents?: string[];
1651
1765
  /**
@@ -1660,7 +1774,7 @@ export declare interface IConfiguration {
1660
1774
  * }
1661
1775
  * ```
1662
1776
  *
1663
- * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/docs/PageUnloadEvents.html).
1777
+ * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html).
1664
1778
  */
1665
1779
  disablePageShowEvents?: string[];
1666
1780
  /**
@@ -1702,6 +1816,25 @@ export declare interface IConfiguration {
1702
1816
  * @since 3.3.2
1703
1817
  */
1704
1818
  expCfg?: IExceptionConfig;
1819
+ /**
1820
+ * [Optional] A flag to enable or disable the use of the field redaction for urls.
1821
+ * @defaultValue true
1822
+ */
1823
+ redactUrls?: boolean;
1824
+ /**
1825
+ * [Optional] Additional query parameters to redact beyond the default set.
1826
+ * Use this to specify custom parameters that contain sensitive information.
1827
+ * These will be combined with the default parameters that are redacted.
1828
+ * @defaultValue ["sig", "Signature", "AWSAccessKeyId", "X-Goog-Signature"]
1829
+ * @example ["sig", "Signature", "AWSAccessKeyId", "X-Goog-Signature","auth_token", "api_key", "private_data"]
1830
+ */
1831
+ redactQueryParams?: string[];
1832
+ /**
1833
+ * [Optional] Controls if the SDK should look for the `traceparent` and/or `tracestate` values from
1834
+ * the service timing headers or meta tags from the initial page load.
1835
+ * @defaultValue eTraceHeadersMode.All
1836
+ */
1837
+ traceHdrMode?: eTraceHeadersMode;
1705
1838
  }
1706
1839
 
1707
1840
  export declare interface ICookieMgr {
@@ -1892,8 +2025,13 @@ export declare interface IDistributedTraceContext {
1892
2025
  */
1893
2026
  getName(): string;
1894
2027
  /**
1895
- * Sets the current name of the page
2028
+ * Sets the current name of the page, also updates the name for any parent context.
2029
+ * This is used to identify the page in the telemetry data.
2030
+ * @remarks This function updates the current and ALL parent contexts with the new name,
2031
+ * to just update the name of the current context, use the `pageName` property.
1896
2032
  * @param pageName - The name of the page
2033
+ * @deprecated Use the `pageName` property to avoid the side effect of changing the page name of all
2034
+ * parent contexts.
1897
2035
  */
1898
2036
  setName(pageName: string): void;
1899
2037
  /**
@@ -1906,6 +2044,12 @@ export declare interface IDistributedTraceContext {
1906
2044
  * Set the unique identifier for a trace. All requests / spans from the same trace share the same traceId.
1907
2045
  * Must be conform to the W3C TraceContext specification, in a hex representation of 16-byte array.
1908
2046
  * A.k.a. trace-id, TraceID or Distributed TraceID https://www.w3.org/TR/trace-context/#trace-id
2047
+ *
2048
+ * @remarks Sets the traceId for the current context AND all parent contexts, if you want to set the traceId
2049
+ * for the current context only, use the `traceId` property.
2050
+ * @param newValue - The traceId to set
2051
+ * @deprecated Use the `traceId` property to avoid the side effect of changing the traceId of all
2052
+ * parent contexts.
1909
2053
  */
1910
2054
  setTraceId(newValue: string): void;
1911
2055
  /**
@@ -1917,6 +2061,12 @@ export declare interface IDistributedTraceContext {
1917
2061
  * Self-generated 8-bytes identifier of the incoming request. Must be a hex representation of 8-byte array.
1918
2062
  * Also know as the parentId, used to link requests together
1919
2063
  * https://www.w3.org/TR/trace-context/#parent-id
2064
+ *
2065
+ * @remarks Sets the spanId for the current context AND all parent contexts, if you want to set the spanId for
2066
+ * the current context only, use the `spanId` property.
2067
+ * @param newValue - The spanId to set
2068
+ * @deprecated Use the `spanId` property to avoid the side effect of changing the spanId of all
2069
+ * parent contexts.
1920
2070
  */
1921
2071
  setSpanId(newValue: string): void;
1922
2072
  /**
@@ -1925,9 +2075,80 @@ export declare interface IDistributedTraceContext {
1925
2075
  getTraceFlags(): number | undefined;
1926
2076
  /**
1927
2077
  * https://www.w3.org/TR/trace-context/#trace-flags
2078
+ * @remarks Sets the trace flags for the current context and ALL parent contexts, if you want to set the trace
2079
+ * flags for the current context only, use the `traceFlags` property.
1928
2080
  * @param newValue - An integer representation of the W3C TraceContext trace-flags.
2081
+ * @deprecated Use the `traceFlags` property to avoid the side effect of changing the traceFlags of all
2082
+ * parent contexts.
1929
2083
  */
1930
2084
  setTraceFlags(newValue?: number): void;
2085
+ /**
2086
+ * Returns the current name of the page
2087
+ * @remarks This function updates the current context only, to update the name of the current and ALL parent contexts,
2088
+ * use the `setName` method.
2089
+ * @default undefined
2090
+ * @since 3.4.0
2091
+ */
2092
+ pageName: string;
2093
+ /**
2094
+ * The current ID of the trace that this span belongs to. It is worldwide unique
2095
+ * with practically sufficient probability by being made as 16 randomly
2096
+ * generated bytes, encoded as a 32 lowercase hex characters corresponding to
2097
+ * 128 bits.
2098
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
2099
+ * if you need to update the current and ALL parent contexts, use the `setTraceId` method.
2100
+ * @since 3.4.0
2101
+ */
2102
+ traceId: string;
2103
+ /**
2104
+ * The ID of the Span. It is globally unique with practically sufficient
2105
+ * probability by being made as 8 randomly generated bytes, encoded as a 16
2106
+ * lowercase hex characters corresponding to 64 bits.
2107
+ * If you update this value, it will only update for the current context, not the parent context.
2108
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
2109
+ * if you need to update the current and ALL parent contexts, use the `setSpanId` method.
2110
+ * @since 3.4.0
2111
+ */
2112
+ spanId: string;
2113
+ /**
2114
+ * Returns true if the current context was initialized (propagated) from a remote parent.
2115
+ * @since 3.4.0
2116
+ * @default false
2117
+ * @returns True if the context was propagated from a remote parent
2118
+ */
2119
+ readonly isRemote: boolean;
2120
+ /**
2121
+ * Trace flags to propagate.
2122
+ *
2123
+ * It is represented as 1 byte (bitmap). Bit to represent whether trace is
2124
+ * sampled or not. When set, the least significant bit documents that the
2125
+ * caller may have recorded trace data. A caller who does not record trace
2126
+ * data out-of-band leaves this flag unset.
2127
+ *
2128
+ * see {@link eW3CTraceFlags} for valid flag values.
2129
+ *
2130
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
2131
+ * if you need to update the current and ALL parent contexts, use the `setTraceFlags` method.
2132
+ * @since 3.4.0
2133
+ */
2134
+ traceFlags?: number;
2135
+ /**
2136
+ * Returns the current trace state which will be used to propgate context across different services.
2137
+ * Updating (adding / removing keys) of the trace state will modify the current context.
2138
+ * @remarks Unlike the OpenTelemetry {@link TraceState}, this value is a mutable object, so you can
2139
+ * modify it directly you do not need to reassign the new value to this property.
2140
+ * @since 3.4.0
2141
+ */
2142
+ readonly traceState: IW3cTraceState;
2143
+ /**
2144
+ * Provides access to the parent context of the current context.
2145
+ * @remarks This is a read-only property, you cannot modify the parent context directly, you can only
2146
+ * modify the current context. If you need to modify the parent context, you need to do it through the
2147
+ * current context using the `setTraceId`, `setSpanId`, `setTraceFlags` and `setName` methods.
2148
+ * @default null
2149
+ * @since 3.4.0
2150
+ */
2151
+ readonly parentCtx?: IDistributedTraceContext | null;
1931
2152
  }
1932
2153
 
1933
2154
  /**
@@ -2466,6 +2687,115 @@ export declare class _InternalLogMessage {
2466
2687
 
2467
2688
  export declare type _InternalMessageId = number | _eInternalMessageId;
2468
2689
 
2690
+ /**
2691
+ * A SpanContext represents the portion of a {@link IOTelSpan} which must be
2692
+ * serialized and propagated along side of a {@link IOTelBaggage}.
2693
+ */
2694
+ export declare interface IOTelSpanContext {
2695
+ /**
2696
+ * The ID of the trace that this span belongs to. It is worldwide unique
2697
+ * with practically sufficient probability by being made as 16 randomly
2698
+ * generated bytes, encoded as a 32 lowercase hex characters corresponding to
2699
+ * 128 bits.
2700
+ */
2701
+ traceId: string;
2702
+ /**
2703
+ * The ID of the Span. It is globally unique with practically sufficient
2704
+ * probability by being made as 8 randomly generated bytes, encoded as a 16
2705
+ * lowercase hex characters corresponding to 64 bits.
2706
+ */
2707
+ spanId: string;
2708
+ /**
2709
+ * Only true if the SpanContext was propagated from a remote parent.
2710
+ */
2711
+ isRemote?: boolean;
2712
+ /**
2713
+ * Trace flags to propagate.
2714
+ *
2715
+ * It is represented as 1 byte (bitmap). Bit to represent whether trace is
2716
+ * sampled or not. When set, the least significant bit documents that the
2717
+ * caller may have recorded trace data. A caller who does not record trace
2718
+ * data out-of-band leaves this flag unset.
2719
+ *
2720
+ * see {@link eW3CTraceFlags} for valid flag values.
2721
+ */
2722
+ traceFlags: number;
2723
+ /**
2724
+ * Tracing-system-specific info to propagate.
2725
+ *
2726
+ * The tracestate field value is a `list` as defined below. The `list` is a
2727
+ * series of `list-members` separated by commas `,`, and a list-member is a
2728
+ * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs
2729
+ * surrounding `list-members` are ignored. There can be a maximum of 32
2730
+ * `list-members` in a `list`.
2731
+ * More Info: https://www.w3.org/TR/trace-context/#tracestate-field
2732
+ *
2733
+ * Examples:
2734
+ * Single tracing system (generic format):
2735
+ * tracestate: rojo=00f067aa0ba902b7
2736
+ * Multiple tracing systems (with different formatting):
2737
+ * tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE
2738
+ */
2739
+ traceState?: IOTelTraceState;
2740
+ }
2741
+
2742
+ /**
2743
+ * Provides an OpenTelemetry compatible Interface for the Open Telemetry Api (1.9.0) TraceState type.
2744
+ *
2745
+ * The TraceState is a list of key/value pairs that are used to propagate
2746
+ * vendor-specific trace information across different distributed tracing systems.
2747
+ * The TraceState is used to store the state of a trace across different
2748
+ * distributed tracing systems, and it is used to ensure that the trace information
2749
+ * is consistent across different systems.
2750
+ *
2751
+ * Instances of TraceState are immutable, and the methods on this interface
2752
+ * return a new instance of TraceState with the updated values.
2753
+ */
2754
+ export declare interface IOTelTraceState {
2755
+ /**
2756
+ * Create a new TraceState which inherits from this TraceState and has the
2757
+ * given key set.
2758
+ * The new entry will always be added in the front of the list of states.
2759
+ *
2760
+ * @param key - key of the TraceState entry.
2761
+ * @param value - value of the TraceState entry.
2762
+ */
2763
+ set(key: string, value: string): IOTelTraceState;
2764
+ /**
2765
+ * Return a new TraceState which inherits from this TraceState but does not
2766
+ * contain the given key.
2767
+ *
2768
+ * @param key - the key for the TraceState entry to be removed.
2769
+ */
2770
+ unset(key: string): IOTelTraceState;
2771
+ /**
2772
+ * Returns the value to which the specified key is mapped, or `undefined` if
2773
+ * this map contains no mapping for the key.
2774
+ *
2775
+ * @param key - with which the specified value is to be associated.
2776
+ * @returns the value to which the specified key is mapped, or `undefined` if
2777
+ * this map contains no mapping for the key.
2778
+ */
2779
+ get(key: string): string | undefined;
2780
+ /**
2781
+ * Serializes the TraceState to a `list` as defined below. The `list` is a series of `list-members`
2782
+ * separated by commas `,`, and a list-member is a key/value pair separated by an equals sign `=`.
2783
+ * Spaces and horizontal tabs surrounding `list-members` are ignored. There can be a maximum of 32
2784
+ * `list-members` in a `list`.
2785
+ *
2786
+ * If the resulting serialization is limited to no longer than 512 bytes, if the combination of
2787
+ * keys and values exceeds this limit, the serialization will be truncated to the last key/value pair
2788
+ * that fits within the limit. The serialization will be returned as a string.
2789
+ *
2790
+ * This is different from the {@link IW3cTraceState} serialization which returns an array of strings where each
2791
+ * string is limited to 512 bytes and the array is limited to 32 strings. Thus the OpenTelemetry serialization
2792
+ * will only return the first single string that fits within the limie.
2793
+ *
2794
+ * @returns the serialized string.
2795
+ */
2796
+ serialize(): string;
2797
+ }
2798
+
2469
2799
  /** IPayloadData describes interface of payload sent via POST channel */
2470
2800
  export declare interface IPayloadData {
2471
2801
  urlString: string;
@@ -2921,6 +3251,13 @@ export declare function isValidTraceId(value: string): boolean;
2921
3251
  */
2922
3252
  export declare function isValidTraceParent(value: ITraceParent): boolean;
2923
3253
 
3254
+ /**
3255
+ * Identifies if the provided value looks like a distributed trace state instance
3256
+ * @param value - The value to check
3257
+ * @returns - True if the value looks like a distributed trace state instance
3258
+ */
3259
+ export declare function isW3cTraceState(value: any): value is IW3cTraceState;
3260
+
2924
3261
  /**
2925
3262
  * Checks if XMLHttpRequest is supported
2926
3263
  * @returns True if supported, otherwise false
@@ -2991,9 +3328,10 @@ export declare interface ITelemetryItem {
2991
3328
  */
2992
3329
  export declare interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
2993
3330
  /**
2994
- * Set next extension for telemetry processing, this is not optional as plugins should use the
3331
+ * Set next extension for telemetry processing, this is now optional as plugins should use the
2995
3332
  * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
2996
3333
  * now for backward compatibility only.
3334
+ * @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead
2997
3335
  */
2998
3336
  setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
2999
3337
  /**
@@ -3159,6 +3497,76 @@ export declare interface IUnloadHookContainer {
3159
3497
  run: (logger?: IDiagnosticLogger) => void;
3160
3498
  }
3161
3499
 
3500
+ /**
3501
+ * Represents a mutable [W3C trace state list](https://www.w3.org/TR/trace-context/#tracestate-header), this is a
3502
+ * list of key/value pairs that are used to pass trace state information between different tracing systems. The
3503
+ * list is ordered and the order is important as it determines the processing order.
3504
+ *
3505
+ * Importantly instances of this type are mutable, change made to an instance via {@link IW3cTraceState.set} or
3506
+ * {@link IW3cTraceState.del} will be reflected on the instance and any child instances that use it as a parent.
3507
+ * However, any parent instance associated with an instance will not be modified by operations on that particular
3508
+ * instance.
3509
+ *
3510
+ * @since 3.4.0
3511
+ */
3512
+ export declare interface IW3cTraceState {
3513
+ /**
3514
+ * Returns a readonly array of the current keys associated with the trace state, keys are returned in the
3515
+ * required processing order and if this instance has a parent the keys from the parent will be included
3516
+ * unless they have been removed (deleted) from the child instance.
3517
+ * Once created any modifications to the parent will also be reflected in the child, this is different from
3518
+ * the OpenTelemetry implementation which creates a new instance for each call.
3519
+ * @returns A readonly array of the current keys associated with the trace state
3520
+ */
3521
+ readonly keys: string[];
3522
+ /**
3523
+ * Check if the trace state list is empty, meaning it has no keys or values.
3524
+ * This exists to allow for quick checks without needing to create a new array of keys.
3525
+ * @since 3.4.0
3526
+ * @returns true if the trace state list is empty, false otherwise
3527
+ */
3528
+ readonly isEmpty: boolean;
3529
+ /**
3530
+ * Get the value for the specified key that is associated with this instance, either directly or from the parent.
3531
+ * @param key - The key to lookup
3532
+ * @returns The value for the key, or undefined if not found
3533
+ */
3534
+ get(key: string): string | undefined;
3535
+ /**
3536
+ * Set the value for the specified key for this instance, returning its new location within the list.
3537
+ * - 0 is the front of the list
3538
+ * - -1 not set because the key/value pair is invalid
3539
+ * If the key already exists it will be removed from its current location and added to the front of the list. And
3540
+ * if the key was in the parent this will override the value inherited from the parent, more importantly it will
3541
+ * not modify the parent value.
3542
+ * @param key - The key to set
3543
+ * @param value - The value to set
3544
+ * @returns 0 if successful, -1 if not
3545
+ */
3546
+ set(key: string, value: string): number;
3547
+ /**
3548
+ * Delete the specified key from this instance, if the key was in the parent it will be removed (hidden) from
3549
+ * this instance but will still be available directly from the parent.
3550
+ * @param key - The key to delete
3551
+ */
3552
+ del(key: string): void;
3553
+ /**
3554
+ * Format the trace state list into a strings where each string can be used as a header value.
3555
+ * This will return an empty array if the trace state list is empty.
3556
+ * @param maxHeaders - The maximum number of entries to include in the output, once the limit is reached no more entries will be included
3557
+ * @param maxKeys - The maximum number of keys to include in the output, once the limit is reached no more keys will be included
3558
+ * @param maxLen - The maximum length of each header value, once the limit is reached a new header value will be created
3559
+ * @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
3560
+ */
3561
+ hdrs(maxHeaders?: number, maxKeys?: number, maxLen?: number): string[];
3562
+ /**
3563
+ * Create a new instance of IW3cTraceState which is a child of this instance, meaning it will inherit the keys
3564
+ * and values from this instance but any changes made to the child will not affect this instance.
3565
+ * @returns A new instance of IW3cTraceState which is a child of this instance
3566
+ */
3567
+ child(): IW3cTraceState;
3568
+ }
3569
+
3162
3570
  export declare interface IWatchDetails<T = IConfiguration> {
3163
3571
  /**
3164
3572
  * The current config object
@@ -3790,6 +4198,18 @@ export declare function setGblPerfMgr(perfManager: IPerfManager): void;
3790
4198
  */
3791
4199
  export declare 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];
3792
4200
 
4201
+ /**
4202
+ * Create a new independent instance of IW3cTraceState that contains a snapshot of all current key/value pairs
4203
+ * from the provided instance and any parent instances. The returned instance will have no parent and will be completely
4204
+ * independent from any future changes to the original instance or its parent chain.
4205
+ * This is useful when you need to capture the current state and ensure it remains unchanged regardless of
4206
+ * future modifications to the parent instances.
4207
+ * @since 3.4.0
4208
+ * @param traceState - The trace state instance to snapshot
4209
+ * @returns A new independent instance of IW3cTraceState with all current key/value pairs captured
4210
+ */
4211
+ export declare function snapshotW3cTraceState(traceState: IW3cTraceState): IW3cTraceState;
4212
+
3793
4213
  export declare function sortPlugins<T = IPlugin>(plugins: T[]): T[];
3794
4214
 
3795
4215
  /**