@microsoft/1ds-core-js 4.4.0-nightlybeta3.2505-35 → 4.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 +33 -33
  2. package/bundle/es5/{ms.core-4.4.0-nightlybeta3.2505-35.gbl.js → ms.core-4.4.0-nightlybeta3.2507-23.gbl.js} +886 -214
  3. package/bundle/es5/ms.core-4.4.0-nightlybeta3.2507-23.gbl.js.map +1 -0
  4. package/bundle/es5/ms.core-4.4.0-nightlybeta3.2507-23.gbl.min.js +7 -0
  5. package/bundle/es5/ms.core-4.4.0-nightlybeta3.2507-23.gbl.min.js.map +1 -0
  6. package/bundle/es5/ms.core-4.4.0-nightlybeta3.2507-23.integrity.json +46 -0
  7. package/bundle/es5/{ms.core-4.4.0-nightlybeta3.2505-35.js → ms.core-4.4.0-nightlybeta3.2507-23.js} +886 -214
  8. package/bundle/es5/ms.core-4.4.0-nightlybeta3.2507-23.js.map +1 -0
  9. package/bundle/es5/ms.core-4.4.0-nightlybeta3.2507-23.min.js +7 -0
  10. package/bundle/es5/ms.core-4.4.0-nightlybeta3.2507-23.min.js.map +1 -0
  11. package/bundle/es5/ms.core.gbl.js +885 -213
  12. package/bundle/es5/ms.core.gbl.js.map +1 -1
  13. package/bundle/es5/ms.core.gbl.min.js +2 -2
  14. package/bundle/es5/ms.core.gbl.min.js.map +1 -1
  15. package/bundle/es5/ms.core.integrity.json +17 -17
  16. package/bundle/es5/ms.core.js +885 -213
  17. package/bundle/es5/ms.core.js.map +1 -1
  18. package/bundle/es5/ms.core.min.js +2 -2
  19. package/bundle/es5/ms.core.min.js.map +1 -1
  20. package/dist/es5/ms.core.js +883 -211
  21. package/dist/es5/ms.core.js.map +1 -1
  22. package/dist/es5/ms.core.min.js +2 -2
  23. package/dist/es5/ms.core.min.js.map +1 -1
  24. package/dist-es5/AppInsightsCore.js +1 -1
  25. package/dist-es5/BaseCore.js +1 -1
  26. package/dist-es5/DataModels.js +1 -1
  27. package/dist-es5/Enums.js +11 -11
  28. package/dist-es5/Enums.js.map +1 -1
  29. package/dist-es5/Index.js +2 -2
  30. package/dist-es5/Index.js.map +1 -1
  31. package/dist-es5/InternalConstants.js +1 -1
  32. package/dist-es5/Utils.js +2 -2
  33. package/dist-es5/Utils.js.map +1 -1
  34. package/dist-es5/ValueSanitizer.js +1 -1
  35. package/dist-es5/__DynamicConstants.js +1 -1
  36. package/package.json +2 -2
  37. package/types/1ds-core-js.d.ts +5 -2
  38. package/types/1ds-core-js.namespaced.d.ts +239 -14
  39. package/bundle/es5/ms.core-4.4.0-nightlybeta3.2505-35.gbl.js.map +0 -1
  40. package/bundle/es5/ms.core-4.4.0-nightlybeta3.2505-35.gbl.min.js +0 -7
  41. package/bundle/es5/ms.core-4.4.0-nightlybeta3.2505-35.gbl.min.js.map +0 -1
  42. package/bundle/es5/ms.core-4.4.0-nightlybeta3.2505-35.integrity.json +0 -46
  43. package/bundle/es5/ms.core-4.4.0-nightlybeta3.2505-35.js.map +0 -1
  44. package/bundle/es5/ms.core-4.4.0-nightlybeta3.2505-35.min.js +0 -7
  45. package/bundle/es5/ms.core-4.4.0-nightlybeta3.2505-35.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- * 1DS JS SDK Core, 4.4.0-nightlybeta3.2505-35
2
+ * 1DS JS SDK Core, 4.4.0-nightlybeta3.2507-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -385,9 +385,12 @@ declare namespace oneDS {
385
385
  */
386
386
  processNext: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
387
387
  /**
388
- * Set next extension for telemetry processing
388
+ * Set next extension for telemetry processing, this is now optional as plugins should use the
389
+ * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
390
+ * now for backward compatibility only.
391
+ * @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead
389
392
  */
390
- setNextPlugin: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
393
+ setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
391
394
  /**
392
395
  * Returns the current diagnostic logger that can be used to log issues, if no logger is currently
393
396
  * assigned a new default one will be created and returned.
@@ -935,6 +938,30 @@ declare namespace oneDS {
935
938
 
936
939
  type EnumValue<E = any> = EnumCls<E>;
937
940
 
941
+ /**
942
+ * Controls how the SDK should look for trace headers (traceparent/tracestate) from the initial page load
943
+ * The values are bitwise OR'd together to allow for multiple values to be set at once.
944
+ * @since 3.4.0
945
+ */
946
+ const enum eTraceHeadersMode {
947
+ /**
948
+ * Don't look for any trace headers
949
+ */
950
+ None = 0,
951
+ /**
952
+ * Look for traceparent header/meta tag
953
+ */
954
+ TraceParent = 1,
955
+ /**
956
+ * Look for tracestate header/meta tag
957
+ */
958
+ TraceState = 2,
959
+ /**
960
+ * Look for both traceparent and tracestate headers/meta tags
961
+ */
962
+ All = 3
963
+ }
964
+
938
965
  /**
939
966
  * The TraceLevel contains a set of values that specify the trace level for the trace messages.
940
967
  */
@@ -1181,6 +1208,14 @@ declare namespace oneDS {
1181
1208
  enable = 3
1182
1209
  }
1183
1210
 
1211
+ /**
1212
+ * Redacts sensitive information from a URL string, including credentials and specific query parameters.
1213
+ * @param input - The URL string to be redacted.
1214
+ * @param config - Configuration object that contain redactUrls setting.
1215
+ * @returns The redacted URL string or the original string if no redaction was needed or possible.
1216
+ */
1217
+ function fieldRedaction(input: string, config: IConfiguration): string;
1218
+
1184
1219
  type FieldValueSanitizerFunc = (details: IFieldSanitizerDetails) => IEventProperty | null;
1185
1220
 
1186
1221
  const enum FieldValueSanitizerType {
@@ -1623,7 +1658,7 @@ declare namespace oneDS {
1623
1658
  */
1624
1659
  flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
1625
1660
  /**
1626
- * Gets the current distributed trace context for this instance if available
1661
+ * Gets the current distributed trace active context for this instance
1627
1662
  * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to true
1628
1663
  */
1629
1664
  getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
@@ -1691,9 +1726,12 @@ declare namespace oneDS {
1691
1726
  */
1692
1727
  getCfg: () => IConfiguration;
1693
1728
  /**
1694
- * Gets the named extension config
1729
+ * Gets the named extension configuration
1730
+ * @param identifier - The named extension identifier
1731
+ * @param defaultValue - The default value(s) to return if no defined config exists
1732
+ * @param rootOnly - If true, only the look for the configuration in the top level and not in the "extensionConfig"
1695
1733
  */
1696
- getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>) => T;
1734
+ getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>, rootOnly?: boolean) => T;
1697
1735
  /**
1698
1736
  * Gets the named config from either the named identifier extension or core config if neither exist then the
1699
1737
  * default value is returned
@@ -1989,7 +2027,7 @@ declare namespace oneDS {
1989
2027
  * }
1990
2028
  * ```
1991
2029
  *
1992
- * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/docs/PageUnloadEvents.html).
2030
+ * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html).
1993
2031
  */
1994
2032
  disablePageUnloadEvents?: string[];
1995
2033
  /**
@@ -2004,7 +2042,7 @@ declare namespace oneDS {
2004
2042
  * }
2005
2043
  * ```
2006
2044
  *
2007
- * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/docs/PageUnloadEvents.html).
2045
+ * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html).
2008
2046
  */
2009
2047
  disablePageShowEvents?: string[];
2010
2048
  /**
@@ -2046,6 +2084,25 @@ declare namespace oneDS {
2046
2084
  * @since 3.3.2
2047
2085
  */
2048
2086
  expCfg?: IExceptionConfig;
2087
+ /**
2088
+ * [Optional] A flag to enable or disable the use of the field redaction for urls.
2089
+ * @defaultValue true
2090
+ */
2091
+ redactUrls?: boolean;
2092
+ /**
2093
+ * [Optional] Additional query parameters to redact beyond the default set.
2094
+ * Use this to specify custom parameters that contain sensitive information.
2095
+ * These will be combined with the default parameters that are redacted.
2096
+ * @defaultValue ["sig", "Signature", "AWSAccessKeyId", "X-Goog-Signature"]
2097
+ * @example ["sig", "Signature", "AWSAccessKeyId", "X-Goog-Signature","auth_token", "api_key", "private_data"]
2098
+ */
2099
+ redactQueryParams?: string[];
2100
+ /**
2101
+ * [Optional] Controls if the SDK should look for the `traceparent` and/or `tracestate` values from
2102
+ * the service timing headers or meta tags from the initial page load.
2103
+ * @defaultValue eTraceHeadersMode.All
2104
+ */
2105
+ traceHdrMode?: eTraceHeadersMode;
2049
2106
  }
2050
2107
 
2051
2108
  interface ICookieMgr {
@@ -2226,8 +2283,13 @@ declare namespace oneDS {
2226
2283
  */
2227
2284
  getName(): string;
2228
2285
  /**
2229
- * Sets the current name of the page
2286
+ * Sets the current name of the page, also updates the name for any parent context.
2287
+ * This is used to identify the page in the telemetry data.
2288
+ * @remarks This function updates the current and ALL parent contexts with the new name,
2289
+ * to just update the name of the current context, use the `pageName` property.
2230
2290
  * @param pageName - The name of the page
2291
+ * @deprecated Use the `pageName` property to avoid the side effect of changing the page name of all
2292
+ * parent contexts.
2231
2293
  */
2232
2294
  setName(pageName: string): void;
2233
2295
  /**
@@ -2240,6 +2302,12 @@ declare namespace oneDS {
2240
2302
  * Set the unique identifier for a trace. All requests / spans from the same trace share the same traceId.
2241
2303
  * Must be conform to the W3C TraceContext specification, in a hex representation of 16-byte array.
2242
2304
  * A.k.a. trace-id, TraceID or Distributed TraceID https://www.w3.org/TR/trace-context/#trace-id
2305
+ *
2306
+ * @remarks Sets the traceId for the current context AND all parent contexts, if you want to set the traceId
2307
+ * for the current context only, use the `traceId` property.
2308
+ * @param newValue - The traceId to set
2309
+ * @deprecated Use the `traceId` property to avoid the side effect of changing the traceId of all
2310
+ * parent contexts.
2243
2311
  */
2244
2312
  setTraceId(newValue: string): void;
2245
2313
  /**
@@ -2251,6 +2319,12 @@ declare namespace oneDS {
2251
2319
  * Self-generated 8-bytes identifier of the incoming request. Must be a hex representation of 8-byte array.
2252
2320
  * Also know as the parentId, used to link requests together
2253
2321
  * https://www.w3.org/TR/trace-context/#parent-id
2322
+ *
2323
+ * @remarks Sets the spanId for the current context AND all parent contexts, if you want to set the spanId for
2324
+ * the current context only, use the `spanId` property.
2325
+ * @param newValue - The spanId to set
2326
+ * @deprecated Use the `spanId` property to avoid the side effect of changing the spanId of all
2327
+ * parent contexts.
2254
2328
  */
2255
2329
  setSpanId(newValue: string): void;
2256
2330
  /**
@@ -2259,9 +2333,80 @@ declare namespace oneDS {
2259
2333
  getTraceFlags(): number | undefined;
2260
2334
  /**
2261
2335
  * https://www.w3.org/TR/trace-context/#trace-flags
2336
+ * @remarks Sets the trace flags for the current context and ALL parent contexts, if you want to set the trace
2337
+ * flags for the current context only, use the `traceFlags` property.
2262
2338
  * @param newValue - An integer representation of the W3C TraceContext trace-flags.
2339
+ * @deprecated Use the `traceFlags` property to avoid the side effect of changing the traceFlags of all
2340
+ * parent contexts.
2263
2341
  */
2264
2342
  setTraceFlags(newValue?: number): void;
2343
+ /**
2344
+ * Returns the current name of the page
2345
+ * @remarks This function updates the current context only, to update the name of the current and ALL parent contexts,
2346
+ * use the `setName` method.
2347
+ * @default undefined
2348
+ * @since 3.4.0
2349
+ */
2350
+ pageName: string;
2351
+ /**
2352
+ * The current ID of the trace that this span belongs to. It is worldwide unique
2353
+ * with practically sufficient probability by being made as 16 randomly
2354
+ * generated bytes, encoded as a 32 lowercase hex characters corresponding to
2355
+ * 128 bits.
2356
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
2357
+ * if you need to update the current and ALL parent contexts, use the `setTraceId` method.
2358
+ * @since 3.4.0
2359
+ */
2360
+ traceId: string;
2361
+ /**
2362
+ * The ID of the Span. It is globally unique with practically sufficient
2363
+ * probability by being made as 8 randomly generated bytes, encoded as a 16
2364
+ * lowercase hex characters corresponding to 64 bits.
2365
+ * If you update this value, it will only update for the current context, not the parent context.
2366
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
2367
+ * if you need to update the current and ALL parent contexts, use the `setSpanId` method.
2368
+ * @since 3.4.0
2369
+ */
2370
+ spanId: string;
2371
+ /**
2372
+ * Returns true if the current context was initialized (propagated) from a remote parent.
2373
+ * @since 3.4.0
2374
+ * @default false
2375
+ * @returns True if the context was propagated from a remote parent
2376
+ */
2377
+ readonly isRemote: boolean;
2378
+ /**
2379
+ * Trace flags to propagate.
2380
+ *
2381
+ * It is represented as 1 byte (bitmap). Bit to represent whether trace is
2382
+ * sampled or not. When set, the least significant bit documents that the
2383
+ * caller may have recorded trace data. A caller who does not record trace
2384
+ * data out-of-band leaves this flag unset.
2385
+ *
2386
+ * see {@link eW3CTraceFlags} for valid flag values.
2387
+ *
2388
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
2389
+ * if you need to update the current and ALL parent contexts, use the `setTraceFlags` method.
2390
+ * @since 3.4.0
2391
+ */
2392
+ traceFlags?: number;
2393
+ /**
2394
+ * Returns the current trace state which will be used to propgate context across different services.
2395
+ * Updating (adding / removing keys) of the trace state will modify the current context.
2396
+ * @remarks Unlike the OpenTelemetry {@link TraceState}, this value is a mutable object, so you can
2397
+ * modify it directly you do not need to reassign the new value to this property.
2398
+ * @since 3.4.0
2399
+ */
2400
+ readonly traceState: IW3cTraceState;
2401
+ /**
2402
+ * Provides access to the parent context of the current context.
2403
+ * @remarks This is a read-only property, you cannot modify the parent context directly, you can only
2404
+ * modify the current context. If you need to modify the parent context, you need to do it through the
2405
+ * current context using the `setTraceId`, `setSpanId`, `setTraceFlags` and `setName` methods.
2406
+ * @default null
2407
+ * @since 3.4.0
2408
+ */
2409
+ readonly parentCtx?: IDistributedTraceContext | null;
2265
2410
  }
2266
2411
 
2267
2412
  /**
@@ -2960,12 +3105,21 @@ declare namespace oneDS {
2960
3105
  * @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.
2961
3106
  * If the caller doesn't return true the caller should assume that it may never be called.
2962
3107
  * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
2963
- * @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
3108
+ * @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
2964
3109
  */
2965
3110
  flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): void;
2966
3111
  /**
2967
- * Gets the current distributed trace context for this instance if available
2968
- * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to true
3112
+ * Gets the current distributed trace context for this instance if available, you can optional
3113
+ * create a new instance if one does not currently exist or return null if one does not currently exist.
3114
+ * When a server context is available it will be used as the parent context for the any new instance created
3115
+ * (when createNew is true or no instance currently exists), calling this function will not
3116
+ * change the current distributed trace context, it will only return the current context
3117
+ * or create a new instance if one does not currently exist.
3118
+ * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to
3119
+ * undefined which will only create a new instance if one does not currently exist.
3120
+ * If set to `false` then it will return null if no distributed trace context is available.
3121
+ * If set to `true` then a new instance will be created even if one already exists.
3122
+ * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to
2969
3123
  */
2970
3124
  getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
2971
3125
  /**
@@ -3988,9 +4142,10 @@ declare namespace oneDS {
3988
4142
  */
3989
4143
  interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
3990
4144
  /**
3991
- * Set next extension for telemetry processing, this is not optional as plugins should use the
4145
+ * Set next extension for telemetry processing, this is now optional as plugins should use the
3992
4146
  * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
3993
4147
  * now for backward compatibility only.
4148
+ * @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead
3994
4149
  */
3995
4150
  setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
3996
4151
  /**
@@ -4320,6 +4475,76 @@ declare namespace oneDS {
4320
4475
  property: (path: string, name: string, property: IEventProperty, stringifyObjects?: boolean) => IEventProperty | null;
4321
4476
  }
4322
4477
 
4478
+ /**
4479
+ * Represents a mutable [W3C trace state list](https://www.w3.org/TR/trace-context/#tracestate-header), this is a
4480
+ * list of key/value pairs that are used to pass trace state information between different tracing systems. The
4481
+ * list is ordered and the order is important as it determines the processing order.
4482
+ *
4483
+ * Importantly instances of this type are mutable, change made to an instance via {@link IW3cTraceState.set} or
4484
+ * {@link IW3cTraceState.del} will be reflected on the instance and any child instances that use it as a parent.
4485
+ * However, any parent instance associated with an instance will not be modified by operations on that particular
4486
+ * instance.
4487
+ *
4488
+ * @since 3.4.0
4489
+ */
4490
+ interface IW3cTraceState {
4491
+ /**
4492
+ * Returns a readonly array of the current keys associated with the trace state, keys are returned in the
4493
+ * required processing order and if this instance has a parent the keys from the parent will be included
4494
+ * unless they have been removed (deleted) from the child instance.
4495
+ * Once created any modifications to the parent will also be reflected in the child, this is different from
4496
+ * the OpenTelemetry implementation which creates a new instance for each call.
4497
+ * @returns A readonly array of the current keys associated with the trace state
4498
+ */
4499
+ readonly keys: string[];
4500
+ /**
4501
+ * Check if the trace state list is empty, meaning it has no keys or values.
4502
+ * This exists to allow for quick checks without needing to create a new array of keys.
4503
+ * @since 3.4.0
4504
+ * @returns true if the trace state list is empty, false otherwise
4505
+ */
4506
+ readonly isEmpty: boolean;
4507
+ /**
4508
+ * Get the value for the specified key that is associated with this instance, either directly or from the parent.
4509
+ * @param key - The key to lookup
4510
+ * @returns The value for the key, or undefined if not found
4511
+ */
4512
+ get(key: string): string | undefined;
4513
+ /**
4514
+ * Set the value for the specified key for this instance, returning its new location within the list.
4515
+ * - 0 is the front of the list
4516
+ * - -1 not set because the key/value pair is invalid
4517
+ * If the key already exists it will be removed from its current location and added to the front of the list. And
4518
+ * if the key was in the parent this will override the value inherited from the parent, more importantly it will
4519
+ * not modify the parent value.
4520
+ * @param key - The key to set
4521
+ * @param value - The value to set
4522
+ * @returns 0 if successful, -1 if not
4523
+ */
4524
+ set(key: string, value: string): number;
4525
+ /**
4526
+ * Delete the specified key from this instance, if the key was in the parent it will be removed (hidden) from
4527
+ * this instance but will still be available directly from the parent.
4528
+ * @param key - The key to delete
4529
+ */
4530
+ del(key: string): void;
4531
+ /**
4532
+ * Format the trace state list into a strings where each string can be used as a header value.
4533
+ * This will return an empty array if the trace state list is empty.
4534
+ * @param maxHeaders - The maximum number of entries to include in the output, once the limit is reached no more entries will be included
4535
+ * @param maxKeys - The maximum number of keys to include in the output, once the limit is reached no more keys will be included
4536
+ * @param maxLen - The maximum length of each header value, once the limit is reached a new header value will be created
4537
+ * @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
4538
+ */
4539
+ hdrs(maxHeaders?: number, maxKeys?: number, maxLen?: number): string[];
4540
+ /**
4541
+ * Create a new instance of IW3cTraceState which is a child of this instance, meaning it will inherit the keys
4542
+ * and values from this instance but any changes made to the child will not affect this instance.
4543
+ * @returns A new instance of IW3cTraceState which is a child of this instance
4544
+ */
4545
+ child(): IW3cTraceState;
4546
+ }
4547
+
4323
4548
  interface IWatchDetails<T = IConfiguration> {
4324
4549
  /**
4325
4550
  * The current config object
@@ -5266,7 +5491,7 @@ declare namespace oneDS {
5266
5491
  constructor(fieldSanitizerProvider?: IFieldValueSanitizerProvider);
5267
5492
  }
5268
5493
 
5269
- const Version = "4.4.0-nightlybeta3.2505-35";
5494
+ const Version = "4.4.0-nightlybeta3.2507-23";
5270
5495
 
5271
5496
  /**
5272
5497
  * This is a helper method which will call warnToConsole on the passed logger with the provided message.