@microsoft/1ds-post-js 4.4.0-nightlybeta3.2505-36 → 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 (52) hide show
  1. package/README.md +28 -28
  2. package/bundle/es5/{ms.post-4.4.0-nightlybeta3.2505-36.gbl.js → ms.post-4.4.0-nightlybeta3.2507-23.gbl.js} +146 -158
  3. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2507-23.gbl.js.map +1 -0
  4. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2507-23.gbl.min.js +7 -0
  5. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2507-23.gbl.min.js.map +1 -0
  6. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2507-23.integrity.json +46 -0
  7. package/bundle/es5/{ms.post-4.4.0-nightlybeta3.2505-36.js → ms.post-4.4.0-nightlybeta3.2507-23.js} +146 -158
  8. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2507-23.js.map +1 -0
  9. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2507-23.min.js +7 -0
  10. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2507-23.min.js.map +1 -0
  11. package/bundle/es5/ms.post.gbl.js +145 -157
  12. package/bundle/es5/ms.post.gbl.js.map +1 -1
  13. package/bundle/es5/ms.post.gbl.min.js +2 -2
  14. package/bundle/es5/ms.post.gbl.min.js.map +1 -1
  15. package/bundle/es5/ms.post.integrity.json +17 -17
  16. package/bundle/es5/ms.post.js +145 -157
  17. package/bundle/es5/ms.post.js.map +1 -1
  18. package/bundle/es5/ms.post.min.js +2 -2
  19. package/bundle/es5/ms.post.min.js.map +1 -1
  20. package/dist/es5/ms.post.js +143 -155
  21. package/dist/es5/ms.post.js.map +1 -1
  22. package/dist/es5/ms.post.min.js +2 -2
  23. package/dist/es5/ms.post.min.js.map +1 -1
  24. package/dist-es5/BatchNotificationActions.js +1 -1
  25. package/dist-es5/ClockSkewManager.js +66 -79
  26. package/dist-es5/ClockSkewManager.js.map +1 -1
  27. package/dist-es5/DataModels.js +1 -1
  28. package/dist-es5/EventBatch.js +1 -1
  29. package/dist-es5/HttpManager.js +24 -24
  30. package/dist-es5/HttpManager.js.map +1 -1
  31. package/dist-es5/Index.js +1 -1
  32. package/dist-es5/InternalConstants.js +1 -1
  33. package/dist-es5/KillSwitch.js +43 -52
  34. package/dist-es5/KillSwitch.js.map +1 -1
  35. package/dist-es5/PostChannel.js +13 -13
  36. package/dist-es5/PostChannel.js.map +1 -1
  37. package/dist-es5/RetryPolicy.js +1 -1
  38. package/dist-es5/Serializer.js +1 -1
  39. package/dist-es5/TimeoutOverrideWrapper.js +1 -1
  40. package/dist-es5/__DynamicConstants.js +16 -20
  41. package/dist-es5/__DynamicConstants.js.map +1 -1
  42. package/dist-es5/typings/XDomainRequest.js +1 -1
  43. package/package.json +2 -2
  44. package/types/1ds-post-js.d.ts +1 -1
  45. package/types/1ds-post-js.namespaced.d.ts +218 -10
  46. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2505-36.gbl.js.map +0 -1
  47. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2505-36.gbl.min.js +0 -7
  48. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2505-36.gbl.min.js.map +0 -1
  49. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2505-36.integrity.json +0 -46
  50. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2505-36.js.map +0 -1
  51. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2505-36.min.js +0 -7
  52. package/bundle/es5/ms.post-4.4.0-nightlybeta3.2505-36.min.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/1ds-post-js",
3
- "version": "4.4.0-nightlybeta3.2505-36",
3
+ "version": "4.4.0-nightlybeta3.2507-23",
4
4
  "description": "Microsoft Application Insights JavaScript SDK - 1ds-post-channel-js",
5
5
  "author": "Microsoft Application Insights Team",
6
6
  "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
@@ -27,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "@microsoft/applicationinsights-shims": "3.0.1",
29
29
  "@microsoft/dynamicproto-js": "^2.0.3",
30
- "@microsoft/1ds-core-js": "4.4.0-nightlybeta3.2505-36",
30
+ "@microsoft/1ds-core-js": "4.4.0-nightlybeta3.2507-23",
31
31
  "@nevware21/ts-utils": ">= 0.11.8 < 2.x",
32
32
  "@nevware21/ts-async": ">= 0.5.4 < 2.x"
33
33
  },
@@ -1,5 +1,5 @@
1
1
  /*
2
- * 1DS JS SDK Post Channel, 4.4.0-nightlybeta3.2505-36
2
+ * 1DS JS SDK Post Channel, 4.4.0-nightlybeta3.2507-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -1,5 +1,5 @@
1
1
  /*
2
- * 1DS JS SDK Post Channel, 4.4.0-nightlybeta3.2505-36
2
+ * 1DS JS SDK Post Channel, 4.4.0-nightlybeta3.2507-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -29,9 +29,12 @@ declare namespace oneDS {
29
29
  */
30
30
  processNext: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
31
31
  /**
32
- * Set next extension for telemetry processing
32
+ * Set next extension for telemetry processing, this is now optional as plugins should use the
33
+ * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
34
+ * now for backward compatibility only.
35
+ * @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead
33
36
  */
34
- setNextPlugin: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
37
+ setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
35
38
  /**
36
39
  * Returns the current diagnostic logger that can be used to log issues, if no logger is currently
37
40
  * assigned a new default one will be created and returned.
@@ -259,6 +262,30 @@ declare namespace oneDS {
259
262
 
260
263
  type EnumValue<E = any> = EnumCls<E>;
261
264
 
265
+ /**
266
+ * Controls how the SDK should look for trace headers (traceparent/tracestate) from the initial page load
267
+ * The values are bitwise OR'd together to allow for multiple values to be set at once.
268
+ * @since 3.4.0
269
+ */
270
+ const enum eTraceHeadersMode {
271
+ /**
272
+ * Don't look for any trace headers
273
+ */
274
+ None = 0,
275
+ /**
276
+ * Look for traceparent header/meta tag
277
+ */
278
+ TraceParent = 1,
279
+ /**
280
+ * Look for tracestate header/meta tag
281
+ */
282
+ TraceState = 2,
283
+ /**
284
+ * Look for both traceparent and tracestate headers/meta tags
285
+ */
286
+ All = 3
287
+ }
288
+
262
289
  const enum FeatureOptInMode {
263
290
  /**
264
291
  * not set, completely depends on cdn cfg
@@ -415,7 +442,7 @@ declare namespace oneDS {
415
442
  */
416
443
  flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
417
444
  /**
418
- * Gets the current distributed trace context for this instance if available
445
+ * Gets the current distributed trace active context for this instance
419
446
  * @param createNew - Optional flag to create a new instance if one doesn't currently exist, defaults to true
420
447
  */
421
448
  getTraceCtx(createNew?: boolean): IDistributedTraceContext | null;
@@ -464,9 +491,12 @@ declare namespace oneDS {
464
491
  */
465
492
  getCfg: () => IConfiguration;
466
493
  /**
467
- * Gets the named extension config
494
+ * Gets the named extension configuration
495
+ * @param identifier - The named extension identifier
496
+ * @param defaultValue - The default value(s) to return if no defined config exists
497
+ * @param rootOnly - If true, only the look for the configuration in the top level and not in the "extensionConfig"
468
498
  */
469
- getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>) => T;
499
+ getExtCfg: <T>(identifier: string, defaultValue?: IConfigDefaults<T>, rootOnly?: boolean) => T;
470
500
  /**
471
501
  * Gets the named config from either the named identifier extension or core config if neither exist then the
472
502
  * default value is returned
@@ -976,7 +1006,7 @@ declare namespace oneDS {
976
1006
  * }
977
1007
  * ```
978
1008
  *
979
- * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/docs/PageUnloadEvents.html).
1009
+ * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html).
980
1010
  */
981
1011
  disablePageUnloadEvents?: string[];
982
1012
  /**
@@ -991,7 +1021,7 @@ declare namespace oneDS {
991
1021
  * }
992
1022
  * ```
993
1023
  *
994
- * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/docs/PageUnloadEvents.html).
1024
+ * For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html).
995
1025
  */
996
1026
  disablePageShowEvents?: string[];
997
1027
  /**
@@ -1033,6 +1063,25 @@ declare namespace oneDS {
1033
1063
  * @since 3.3.2
1034
1064
  */
1035
1065
  expCfg?: IExceptionConfig;
1066
+ /**
1067
+ * [Optional] A flag to enable or disable the use of the field redaction for urls.
1068
+ * @defaultValue true
1069
+ */
1070
+ redactUrls?: boolean;
1071
+ /**
1072
+ * [Optional] Additional query parameters to redact beyond the default set.
1073
+ * Use this to specify custom parameters that contain sensitive information.
1074
+ * These will be combined with the default parameters that are redacted.
1075
+ * @defaultValue ["sig", "Signature", "AWSAccessKeyId", "X-Goog-Signature"]
1076
+ * @example ["sig", "Signature", "AWSAccessKeyId", "X-Goog-Signature","auth_token", "api_key", "private_data"]
1077
+ */
1078
+ redactQueryParams?: string[];
1079
+ /**
1080
+ * [Optional] Controls if the SDK should look for the `traceparent` and/or `tracestate` values from
1081
+ * the service timing headers or meta tags from the initial page load.
1082
+ * @defaultValue eTraceHeadersMode.All
1083
+ */
1084
+ traceHdrMode?: eTraceHeadersMode;
1036
1085
  }
1037
1086
 
1038
1087
  interface ICookieMgr {
@@ -1213,8 +1262,13 @@ declare namespace oneDS {
1213
1262
  */
1214
1263
  getName(): string;
1215
1264
  /**
1216
- * Sets the current name of the page
1265
+ * Sets the current name of the page, also updates the name for any parent context.
1266
+ * This is used to identify the page in the telemetry data.
1267
+ * @remarks This function updates the current and ALL parent contexts with the new name,
1268
+ * to just update the name of the current context, use the `pageName` property.
1217
1269
  * @param pageName - The name of the page
1270
+ * @deprecated Use the `pageName` property to avoid the side effect of changing the page name of all
1271
+ * parent contexts.
1218
1272
  */
1219
1273
  setName(pageName: string): void;
1220
1274
  /**
@@ -1227,6 +1281,12 @@ declare namespace oneDS {
1227
1281
  * Set the unique identifier for a trace. All requests / spans from the same trace share the same traceId.
1228
1282
  * Must be conform to the W3C TraceContext specification, in a hex representation of 16-byte array.
1229
1283
  * A.k.a. trace-id, TraceID or Distributed TraceID https://www.w3.org/TR/trace-context/#trace-id
1284
+ *
1285
+ * @remarks Sets the traceId for the current context AND all parent contexts, if you want to set the traceId
1286
+ * for the current context only, use the `traceId` property.
1287
+ * @param newValue - The traceId to set
1288
+ * @deprecated Use the `traceId` property to avoid the side effect of changing the traceId of all
1289
+ * parent contexts.
1230
1290
  */
1231
1291
  setTraceId(newValue: string): void;
1232
1292
  /**
@@ -1238,6 +1298,12 @@ declare namespace oneDS {
1238
1298
  * Self-generated 8-bytes identifier of the incoming request. Must be a hex representation of 8-byte array.
1239
1299
  * Also know as the parentId, used to link requests together
1240
1300
  * https://www.w3.org/TR/trace-context/#parent-id
1301
+ *
1302
+ * @remarks Sets the spanId for the current context AND all parent contexts, if you want to set the spanId for
1303
+ * the current context only, use the `spanId` property.
1304
+ * @param newValue - The spanId to set
1305
+ * @deprecated Use the `spanId` property to avoid the side effect of changing the spanId of all
1306
+ * parent contexts.
1241
1307
  */
1242
1308
  setSpanId(newValue: string): void;
1243
1309
  /**
@@ -1246,9 +1312,80 @@ declare namespace oneDS {
1246
1312
  getTraceFlags(): number | undefined;
1247
1313
  /**
1248
1314
  * https://www.w3.org/TR/trace-context/#trace-flags
1315
+ * @remarks Sets the trace flags for the current context and ALL parent contexts, if you want to set the trace
1316
+ * flags for the current context only, use the `traceFlags` property.
1249
1317
  * @param newValue - An integer representation of the W3C TraceContext trace-flags.
1318
+ * @deprecated Use the `traceFlags` property to avoid the side effect of changing the traceFlags of all
1319
+ * parent contexts.
1250
1320
  */
1251
1321
  setTraceFlags(newValue?: number): void;
1322
+ /**
1323
+ * Returns the current name of the page
1324
+ * @remarks This function updates the current context only, to update the name of the current and ALL parent contexts,
1325
+ * use the `setName` method.
1326
+ * @default undefined
1327
+ * @since 3.4.0
1328
+ */
1329
+ pageName: string;
1330
+ /**
1331
+ * The current ID of the trace that this span belongs to. It is worldwide unique
1332
+ * with practically sufficient probability by being made as 16 randomly
1333
+ * generated bytes, encoded as a 32 lowercase hex characters corresponding to
1334
+ * 128 bits.
1335
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
1336
+ * if you need to update the current and ALL parent contexts, use the `setTraceId` method.
1337
+ * @since 3.4.0
1338
+ */
1339
+ traceId: string;
1340
+ /**
1341
+ * The ID of the Span. It is globally unique with practically sufficient
1342
+ * probability by being made as 8 randomly generated bytes, encoded as a 16
1343
+ * lowercase hex characters corresponding to 64 bits.
1344
+ * If you update this value, it will only update for the current context, not the parent context.
1345
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
1346
+ * if you need to update the current and ALL parent contexts, use the `setSpanId` method.
1347
+ * @since 3.4.0
1348
+ */
1349
+ spanId: string;
1350
+ /**
1351
+ * Returns true if the current context was initialized (propagated) from a remote parent.
1352
+ * @since 3.4.0
1353
+ * @default false
1354
+ * @returns True if the context was propagated from a remote parent
1355
+ */
1356
+ readonly isRemote: boolean;
1357
+ /**
1358
+ * Trace flags to propagate.
1359
+ *
1360
+ * It is represented as 1 byte (bitmap). Bit to represent whether trace is
1361
+ * sampled or not. When set, the least significant bit documents that the
1362
+ * caller may have recorded trace data. A caller who does not record trace
1363
+ * data out-of-band leaves this flag unset.
1364
+ *
1365
+ * see {@link eW3CTraceFlags} for valid flag values.
1366
+ *
1367
+ * @remarks If you update this value, it will only update for the current context, not the parent context,
1368
+ * if you need to update the current and ALL parent contexts, use the `setTraceFlags` method.
1369
+ * @since 3.4.0
1370
+ */
1371
+ traceFlags?: number;
1372
+ /**
1373
+ * Returns the current trace state which will be used to propgate context across different services.
1374
+ * Updating (adding / removing keys) of the trace state will modify the current context.
1375
+ * @remarks Unlike the OpenTelemetry {@link TraceState}, this value is a mutable object, so you can
1376
+ * modify it directly you do not need to reassign the new value to this property.
1377
+ * @since 3.4.0
1378
+ */
1379
+ readonly traceState: IW3cTraceState;
1380
+ /**
1381
+ * Provides access to the parent context of the current context.
1382
+ * @remarks This is a read-only property, you cannot modify the parent context directly, you can only
1383
+ * modify the current context. If you need to modify the parent context, you need to do it through the
1384
+ * current context using the `setTraceId`, `setSpanId`, `setTraceFlags` and `setName` methods.
1385
+ * @default null
1386
+ * @since 3.4.0
1387
+ */
1388
+ readonly parentCtx?: IDistributedTraceContext | null;
1252
1389
  }
1253
1390
 
1254
1391
  /**
@@ -2168,9 +2305,10 @@ declare namespace oneDS {
2168
2305
  */
2169
2306
  interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
2170
2307
  /**
2171
- * Set next extension for telemetry processing, this is not optional as plugins should use the
2308
+ * Set next extension for telemetry processing, this is now optional as plugins should use the
2172
2309
  * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
2173
2310
  * now for backward compatibility only.
2311
+ * @deprecated - Use processNext() function of the passed IProcessTelemetryContext instead
2174
2312
  */
2175
2313
  setNextPlugin?: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
2176
2314
  /**
@@ -2440,6 +2578,76 @@ declare namespace oneDS {
2440
2578
  property: (path: string, name: string, property: IEventProperty, stringifyObjects?: boolean) => IEventProperty | null;
2441
2579
  }
2442
2580
 
2581
+ /**
2582
+ * Represents a mutable [W3C trace state list](https://www.w3.org/TR/trace-context/#tracestate-header), this is a
2583
+ * list of key/value pairs that are used to pass trace state information between different tracing systems. The
2584
+ * list is ordered and the order is important as it determines the processing order.
2585
+ *
2586
+ * Importantly instances of this type are mutable, change made to an instance via {@link IW3cTraceState.set} or
2587
+ * {@link IW3cTraceState.del} will be reflected on the instance and any child instances that use it as a parent.
2588
+ * However, any parent instance associated with an instance will not be modified by operations on that particular
2589
+ * instance.
2590
+ *
2591
+ * @since 3.4.0
2592
+ */
2593
+ interface IW3cTraceState {
2594
+ /**
2595
+ * Returns a readonly array of the current keys associated with the trace state, keys are returned in the
2596
+ * required processing order and if this instance has a parent the keys from the parent will be included
2597
+ * unless they have been removed (deleted) from the child instance.
2598
+ * Once created any modifications to the parent will also be reflected in the child, this is different from
2599
+ * the OpenTelemetry implementation which creates a new instance for each call.
2600
+ * @returns A readonly array of the current keys associated with the trace state
2601
+ */
2602
+ readonly keys: string[];
2603
+ /**
2604
+ * Check if the trace state list is empty, meaning it has no keys or values.
2605
+ * This exists to allow for quick checks without needing to create a new array of keys.
2606
+ * @since 3.4.0
2607
+ * @returns true if the trace state list is empty, false otherwise
2608
+ */
2609
+ readonly isEmpty: boolean;
2610
+ /**
2611
+ * Get the value for the specified key that is associated with this instance, either directly or from the parent.
2612
+ * @param key - The key to lookup
2613
+ * @returns The value for the key, or undefined if not found
2614
+ */
2615
+ get(key: string): string | undefined;
2616
+ /**
2617
+ * Set the value for the specified key for this instance, returning its new location within the list.
2618
+ * - 0 is the front of the list
2619
+ * - -1 not set because the key/value pair is invalid
2620
+ * If the key already exists it will be removed from its current location and added to the front of the list. And
2621
+ * if the key was in the parent this will override the value inherited from the parent, more importantly it will
2622
+ * not modify the parent value.
2623
+ * @param key - The key to set
2624
+ * @param value - The value to set
2625
+ * @returns 0 if successful, -1 if not
2626
+ */
2627
+ set(key: string, value: string): number;
2628
+ /**
2629
+ * Delete the specified key from this instance, if the key was in the parent it will be removed (hidden) from
2630
+ * this instance but will still be available directly from the parent.
2631
+ * @param key - The key to delete
2632
+ */
2633
+ del(key: string): void;
2634
+ /**
2635
+ * Format the trace state list into a strings where each string can be used as a header value.
2636
+ * This will return an empty array if the trace state list is empty.
2637
+ * @param maxHeaders - The maximum number of entries to include in the output, once the limit is reached no more entries will be included
2638
+ * @param maxKeys - The maximum number of keys to include in the output, once the limit is reached no more keys will be included
2639
+ * @param maxLen - The maximum length of each header value, once the limit is reached a new header value will be created
2640
+ * @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
2641
+ */
2642
+ hdrs(maxHeaders?: number, maxKeys?: number, maxLen?: number): string[];
2643
+ /**
2644
+ * Create a new instance of IW3cTraceState which is a child of this instance, meaning it will inherit the keys
2645
+ * and values from this instance but any changes made to the child will not affect this instance.
2646
+ * @returns A new instance of IW3cTraceState which is a child of this instance
2647
+ */
2648
+ child(): IW3cTraceState;
2649
+ }
2650
+
2443
2651
  interface IWatchDetails<T = IConfiguration> {
2444
2652
  /**
2445
2653
  * The current config object