@microsoft/applicationinsights-core-js 3.0.0-beta.2302-04 → 3.0.0-beta.2302-06

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 (101) hide show
  1. package/README.md +2 -1
  2. package/browser/applicationinsights-core-js.integrity.json +9 -9
  3. package/browser/applicationinsights-core-js.js +236 -141
  4. package/browser/applicationinsights-core-js.js.map +1 -1
  5. package/browser/applicationinsights-core-js.min.js +2 -2
  6. package/browser/applicationinsights-core-js.min.js.map +1 -1
  7. package/dist/applicationinsights-core-js.api.json +813 -41
  8. package/dist/applicationinsights-core-js.api.md +27 -6
  9. package/dist/applicationinsights-core-js.d.ts +82 -7
  10. package/dist/applicationinsights-core-js.js +236 -141
  11. package/dist/applicationinsights-core-js.js.map +1 -1
  12. package/dist/applicationinsights-core-js.min.js +2 -2
  13. package/dist/applicationinsights-core-js.min.js.map +1 -1
  14. package/dist/applicationinsights-core-js.rollup.d.ts +82 -7
  15. package/dist-esm/Config/ConfigDefaultHelpers.js +103 -0
  16. package/dist-esm/Config/ConfigDefaultHelpers.js.map +1 -0
  17. package/dist-esm/Config/ConfigDefaults.js +81 -11
  18. package/dist-esm/Config/ConfigDefaults.js.map +1 -1
  19. package/dist-esm/Config/DynamicConfig.js +3 -3
  20. package/dist-esm/Config/DynamicConfig.js.map +1 -1
  21. package/dist-esm/Config/DynamicProperty.js +1 -1
  22. package/dist-esm/Config/DynamicState.js +3 -3
  23. package/dist-esm/Config/DynamicState.js.map +1 -1
  24. package/dist-esm/Config/DynamicSupport.js +1 -1
  25. package/dist-esm/Config/IConfigDefaults.js +1 -1
  26. package/dist-esm/Config/IDynamicConfigHandler.js +1 -1
  27. package/dist-esm/Config/IDynamicPropertyHandler.js +1 -1
  28. package/dist-esm/Config/IDynamicWatcher.js +1 -1
  29. package/dist-esm/Config/_IDynamicConfigHandlerState.js +1 -1
  30. package/dist-esm/JavaScriptSDK/AggregationError.js +1 -1
  31. package/dist-esm/JavaScriptSDK/AppInsightsCore.js +2 -2
  32. package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
  33. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
  34. package/dist-esm/JavaScriptSDK/Constants.js +1 -1
  35. package/dist-esm/JavaScriptSDK/CookieMgr.js +17 -15
  36. package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
  37. package/dist-esm/JavaScriptSDK/CoreUtils.js +1 -1
  38. package/dist-esm/JavaScriptSDK/DataCacheHelper.js +2 -2
  39. package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -1
  40. package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
  41. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +1 -1
  42. package/dist-esm/JavaScriptSDK/EnvUtils.js +3 -3
  43. package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
  44. package/dist-esm/JavaScriptSDK/EventHelpers.js +1 -1
  45. package/dist-esm/JavaScriptSDK/HelperFuncs.js +1 -10
  46. package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
  47. package/dist-esm/JavaScriptSDK/InstrumentHooks.js +12 -9
  48. package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
  49. package/dist-esm/JavaScriptSDK/InternalConstants.js +1 -1
  50. package/dist-esm/JavaScriptSDK/NotificationManager.js +1 -1
  51. package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
  52. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +1 -1
  53. package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
  54. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +1 -1
  55. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +1 -1
  56. package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +1 -1
  57. package/dist-esm/JavaScriptSDK/UnloadHookContainer.js +1 -1
  58. package/dist-esm/JavaScriptSDK/W3cTraceParent.js +6 -5
  59. package/dist-esm/JavaScriptSDK/W3cTraceParent.js.map +1 -1
  60. package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +1 -1
  61. package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
  62. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
  63. package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
  64. package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
  65. package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +1 -1
  66. package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
  67. package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
  68. package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
  69. package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
  70. package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
  71. package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
  72. package/dist-esm/JavaScriptSDK.Interfaces/IDistributedTraceContext.js +1 -1
  73. package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
  74. package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
  75. package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
  76. package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
  77. package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
  78. package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
  79. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
  80. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
  81. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
  82. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
  83. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
  84. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +1 -1
  85. package/dist-esm/JavaScriptSDK.Interfaces/ITraceParent.js +1 -1
  86. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadHook.js +1 -1
  87. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +1 -1
  88. package/dist-esm/__DynamicConstants.js +6 -5
  89. package/dist-esm/__DynamicConstants.js.map +1 -1
  90. package/dist-esm/applicationinsights-core-js.js +2 -1
  91. package/dist-esm/applicationinsights-core-js.js.map +1 -1
  92. package/package.json +1 -1
  93. package/src/JavaScriptSDK/CookieMgr.ts +14 -13
  94. package/src/JavaScriptSDK/HelperFuncs.ts +0 -11
  95. package/src/JavaScriptSDK/InstrumentHooks.ts +11 -8
  96. package/types/Config/ConfigDefaultHelpers.d.ts +47 -0
  97. package/types/Config/ConfigDefaults.d.ts +1 -2
  98. package/types/Config/IConfigDefaults.d.ts +24 -3
  99. package/types/JavaScriptSDK/InstrumentHooks.d.ts +6 -3
  100. package/types/__DynamicConstants.d.ts +2 -1
  101. package/types/applicationinsights-core-js.d.ts +1 -0
@@ -173,6 +173,24 @@ export abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
173
173
  version?: string;
174
174
  }
175
175
 
176
+ // @public
177
+ export function cfgDfBoolean<T, C = IConfiguration>(defaultValue?: boolean, fallBackName?: keyof T | keyof C | Array<keyof T | keyof C>): IConfigDefaultCheck<T, boolean, C>;
178
+
179
+ // @public
180
+ export function cfgDfFunc<V, T, C = IConfiguration>(defaultValue?: V): IConfigDefaultCheck<T, V, C>;
181
+
182
+ // @public
183
+ export function cfgDfMerge<V, T = IConfiguration, C = IConfiguration>(defaultValue: V | IConfigDefaults<V, T>): IConfigDefaultCheck<T, V, C>;
184
+
185
+ // @public
186
+ export function cfgDfSet<V, T, C = IConfiguration>(setter: IConfigSetFn<T, V>, defaultValue: V): IConfigDefaultCheck<T, V, C>;
187
+
188
+ // @public
189
+ export function cfgDfString<T, C = IConfiguration>(defaultValue?: string): IConfigDefaultCheck<T, string, C>;
190
+
191
+ // @public
192
+ export function cfgDfValidate<V, T, C = IConfiguration>(validator: IConfigCheckFn<V>, defaultValue: V, fallBackName?: keyof T | keyof C | Array<keyof T | keyof C>): IConfigDefaultCheck<T, V, C>;
193
+
176
194
  // @public
177
195
  export function createClassFromInterface<T>(defaults?: T): new () => T;
178
196
 
@@ -591,16 +609,19 @@ export interface IChannelControls extends ITelemetryPlugin {
591
609
  export type IConfigCheckFn<V> = (value: V) => boolean;
592
610
 
593
611
  // @public
594
- export interface IConfigDefaultCheck<T, V, C extends IConfiguration = IConfiguration> {
612
+ export interface IConfigDefaultCheck<T, V, C = IConfiguration> {
595
613
  dfVal?: (value: any) => boolean;
596
614
  fb?: keyof T | keyof C | Array<keyof T | keyof C>;
597
615
  isVal?: IConfigCheckFn<V>;
616
+ mrg?: boolean;
617
+ rdOnly?: boolean;
618
+ ref?: boolean;
598
619
  set?: IConfigSetFn<T, V>;
599
- v?: V;
620
+ v?: V | IConfigDefaults<V, T>;
600
621
  }
601
622
 
602
623
  // @public
603
- export type IConfigDefaults<T, C extends IConfiguration = IConfiguration> = {
624
+ export type IConfigDefaults<T, C = IConfiguration> = {
604
625
  [key in keyof T]: T[key] | IConfigDefaultCheck<T, T[key], C>;
605
626
  };
606
627
 
@@ -810,13 +831,13 @@ export interface INotificationManager {
810
831
  }
811
832
 
812
833
  // @public
813
- export function InstrumentEvent(target: any, evtName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean): IInstrumentHook;
834
+ export function InstrumentEvent(target: any, evtName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean, checkParentProto?: boolean): IInstrumentHook;
814
835
 
815
836
  // @public
816
- export function InstrumentFunc(target: any, funcName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean): IInstrumentHook;
837
+ export function InstrumentFunc(target: any, funcName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean, checkParentProto?: boolean): IInstrumentHook;
817
838
 
818
839
  // @public
819
- export function InstrumentFuncs(target: any, funcNames: string[], callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean): IInstrumentHook[];
840
+ export function InstrumentFuncs(target: any, funcNames: string[], callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean, checkParentProto?: boolean): IInstrumentHook[];
820
841
 
821
842
  // @public
822
843
  export type InstrumentorHooksCallback = (funcArgs: IInstrumentCallDetails, ...orgArgs: any[]) => void;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights Core Javascript SDK, 3.0.0-beta.2302-04
2
+ * Microsoft Application Insights Core Javascript SDK, 3.0.0-beta.2302-06
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -390,6 +390,57 @@ declare namespace ApplicationInsights {
390
390
  protected _addHook(hooks: IUnloadHook | IUnloadHook[] | Iterator<IUnloadHook> | ILegacyUnloadHook | ILegacyUnloadHook[] | Iterator<ILegacyUnloadHook>): void;
391
391
  }
392
392
 
393
+ /**
394
+ * Helper which returns an IConfigDefaultCheck instance that will validate and convert the user
395
+ * provided value to a boolean from a string or boolean value
396
+ * @param validator - The IConfigCheckFn function to validate the user provided value
397
+ * @param defaultValue - The default value to apply it not provided or it's not valid
398
+ * @param fallBackName - The fallback configuration name if the current value is not available
399
+ * @returns a new IConfigDefaultCheck structure
400
+ */
401
+ function cfgDfBoolean<T, C = IConfiguration>(defaultValue?: boolean, fallBackName?: keyof T | keyof C | Array<keyof T | keyof C>): IConfigDefaultCheck<T, boolean, C>;
402
+
403
+ /**
404
+ * Helper which returns an IConfigDefaultCheck instance that will validate that the user
405
+ * provided value is a function.
406
+ * @param defaultValue - The default value to apply it not provided or it's not valid
407
+ * @returns a new IConfigDefaultCheck structure
408
+ */
409
+ function cfgDfFunc<V, T, C = IConfiguration>(defaultValue?: V): IConfigDefaultCheck<T, V, C>;
410
+
411
+ /**
412
+ * Helper which returns an IConfigDefaultCheck instance with the provided field validator
413
+ * @param validator - The IConfigCheckFn function to validate the user provided value
414
+ * @param defaultValue - The default value to apply it not provided or it's not valid
415
+ * @returns a new IConfigDefaultCheck structure
416
+ */
417
+ function cfgDfMerge<V, T = IConfiguration, C = IConfiguration>(defaultValue: V | IConfigDefaults<V, T>): IConfigDefaultCheck<T, V, C>;
418
+
419
+ /**
420
+ * Helper which returns an IConfigDefaultCheck instance with the provided field set function
421
+ * @param setter - The IConfigCheckFn function to validate the user provided value
422
+ * @param defaultValue - The default value to apply it not provided or it's not valid
423
+ * @returns a new IConfigDefaultCheck structure
424
+ */
425
+ function cfgDfSet<V, T, C = IConfiguration>(setter: IConfigSetFn<T, V>, defaultValue: V): IConfigDefaultCheck<T, V, C>;
426
+
427
+ /**
428
+ * Helper which returns an IConfigDefaultCheck instance that will validate that the user
429
+ * provided value is a function.
430
+ * @param defaultValue - The default string value to apply it not provided or it's not valid, defaults to an empty string
431
+ * @returns a new IConfigDefaultCheck structure
432
+ */
433
+ function cfgDfString<T, C = IConfiguration>(defaultValue?: string): IConfigDefaultCheck<T, string, C>;
434
+
435
+ /**
436
+ * Helper which returns an IConfigDefaultCheck instance with the provided field validator
437
+ * @param validator - The IConfigCheckFn function to validate the user provided value
438
+ * @param defaultValue - The default value to apply it not provided or it's not valid
439
+ * @param fallBackName - The fallback configuration name if the current value is not available
440
+ * @returns a new IConfigDefaultCheck structure
441
+ */
442
+ function cfgDfValidate<V, T, C = IConfiguration>(validator: IConfigCheckFn<V>, defaultValue: V, fallBackName?: keyof T | keyof C | Array<keyof T | keyof C>): IConfigDefaultCheck<T, V, C>;
443
+
393
444
  /**
394
445
  * Simpler helper to create a dynamic class that implements the interface and populates the values with the defaults.
395
446
  * Only instance properties (hasOwnProperty) values are copied from the defaults to the new instance
@@ -1083,7 +1134,7 @@ declare namespace ApplicationInsights {
1083
1134
  /**
1084
1135
  * The default values with a check function
1085
1136
  */
1086
- interface IConfigDefaultCheck<T, V, C extends IConfiguration = IConfiguration> {
1137
+ interface IConfigDefaultCheck<T, V, C = IConfiguration> {
1087
1138
  /**
1088
1139
  * Callback function to check if the user-supplied value is valid, if not the default will be applied
1089
1140
  */
@@ -1095,7 +1146,7 @@ declare namespace ApplicationInsights {
1095
1146
  /**
1096
1147
  * The default value to apply if the user-supplied value is not valid
1097
1148
  */
1098
- v?: V;
1149
+ v?: V | IConfigDefaults<V, T>;
1099
1150
  /**
1100
1151
  * The default fallback key if the main key is not present, this is the key value from the config
1101
1152
  */
@@ -1105,13 +1156,34 @@ declare namespace ApplicationInsights {
1105
1156
  * therefore `null`; `""` are considered to be valid values.
1106
1157
  */
1107
1158
  dfVal?: (value: any) => boolean;
1159
+ /**
1160
+ * Specify that any provided value should have the default value(s) merged into the value rather than
1161
+ * just using either the default of user provided values. Mergeed objects will automatically be marked
1162
+ * as referenced.
1163
+ */
1164
+ mrg?: boolean;
1165
+ /**
1166
+ * Set this field of the target as referenced, which will cause any object or array instance
1167
+ * to be updated in-place rather than being entirely replaced. All other values will continue to be replaced.
1168
+ * This is required for nested default objects to avoid multiple repetitive updates to listeners
1169
+ * @returns The referenced properties current value
1170
+ */
1171
+ ref?: boolean;
1172
+ /**
1173
+ * Set this field of the target as read-only, which will block this single named property from
1174
+ * ever being changed for the target instance.
1175
+ * This does NOT freeze or seal the instance, it just stops the direct re-assignment of the named property,
1176
+ * if the value is a non-primitive (ie. an object or array) it's properties will still be mutable.
1177
+ * @returns The referenced properties current value
1178
+ */
1179
+ rdOnly?: boolean;
1108
1180
  }
1109
1181
 
1110
1182
  /**
1111
1183
  * The Type definition to define default values to be applied to the config
1112
1184
  * The value may be either the direct value or a ConfigDefaultCheck definition
1113
1185
  */
1114
- type IConfigDefaults<T, C extends IConfiguration = IConfiguration> = {
1186
+ type IConfigDefaults<T, C = IConfiguration> = {
1115
1187
  [key in keyof T]: T[key] | IConfigDefaultCheck<T, T[key], C>;
1116
1188
  };
1117
1189
 
@@ -1740,8 +1812,9 @@ declare namespace ApplicationInsights {
1740
1812
  * @param evtName - The name of the event
1741
1813
  * @param callbacks - The callbacks to configure and call whenever the function is called
1742
1814
  * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function
1815
+ * @param checkParentProto - If the function doesn't exist on the target or it's prototype should it attempt to hook the parent's prototype
1743
1816
  */
1744
- function InstrumentEvent(target: any, evtName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean): IInstrumentHook;
1817
+ function InstrumentEvent(target: any, evtName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean, checkParentProto?: boolean): IInstrumentHook;
1745
1818
 
1746
1819
  /**
1747
1820
  * Intercept the named prototype functions for the target class / object
@@ -1749,8 +1822,9 @@ declare namespace ApplicationInsights {
1749
1822
  * @param funcName - The function name
1750
1823
  * @param callbacks - The callbacks to configure and call whenever the function is called
1751
1824
  * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function
1825
+ * @param checkParentProto - If the function doesn't exist on the target or it's prototype should it attempt to hook the parent's prototype
1752
1826
  */
1753
- function InstrumentFunc(target: any, funcName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean): IInstrumentHook;
1827
+ function InstrumentFunc(target: any, funcName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean, checkParentProto?: boolean): IInstrumentHook;
1754
1828
 
1755
1829
  /**
1756
1830
  * Intercept the named functions for the target class / object
@@ -1758,8 +1832,9 @@ declare namespace ApplicationInsights {
1758
1832
  * @param funcNames - The function names to intercept and call
1759
1833
  * @param callbacks - The callbacks to configure and call whenever the function is called
1760
1834
  * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function
1835
+ * @param checkParentProto - If the function doesn't exist on the target or it's prototype should it attempt to hook the parent's prototype
1761
1836
  */
1762
- function InstrumentFuncs(target: any, funcNames: string[], callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean): IInstrumentHook[];
1837
+ function InstrumentFuncs(target: any, funcNames: string[], callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean, checkParentProto?: boolean): IInstrumentHook[];
1763
1838
 
1764
1839
  /**
1765
1840
  * A callback function that will be called for the wrapped instrumentation function