@microsoft/applicationinsights-web-basic 2.8.0-beta.2203-03 → 2.8.0-beta.2203-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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft.ApplicationInsights, 2.8.0-beta.2203-03
2
+ * Microsoft.ApplicationInsights, 2.8.0-beta.2203-06
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -114,7 +114,7 @@ declare class BaseCore implements IAppInsightsCore {
114
114
  * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
115
115
  * to successfully remove any global references or they may just be completing the unload process asynchronously.
116
116
  */
117
- unload(isAsync?: boolean, unloadComplete?: () => void): void;
117
+ unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
118
118
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
119
119
  addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
120
120
  /**
@@ -127,6 +127,13 @@ declare class BaseCore implements IAppInsightsCore {
127
127
  */
128
128
  addUnloadCb(handler: UnloadHandler): void;
129
129
  protected releaseQueue(): void;
130
+ /**
131
+ * Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.
132
+ * @param updateCtx - The plugin update context
133
+ * @param updateState - The Update State
134
+ * @returns boolean - True means the extension class will call updateState otherwise the Core will
135
+ */
136
+ protected _updateHook?(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
130
137
  }
131
138
 
132
139
  /**
@@ -183,6 +190,14 @@ declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
183
190
  * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
184
191
  */
185
192
  protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
193
+ /**
194
+ * Extension hook to allow implementations to perform some additional update operations before the BaseTelemetryPlugin finishes it's removal
195
+ * @param updateCtx - This is the context that should be used during updating.
196
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
197
+ * @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async update operations.
198
+ * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
199
+ */
200
+ protected _doUpdate?: (updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: () => void) => void | boolean;
186
201
  constructor();
187
202
  initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
188
203
  /**
@@ -195,6 +210,13 @@ declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
195
210
  */
196
211
  teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
197
212
  abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
213
+ /**
214
+ * The the plugin should re-evaluate configuration and update any cached configuration settings.
215
+ * @param updateCtx - This is the context that should be used during updating.
216
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
217
+ * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
218
+ */
219
+ update(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
198
220
  /**
199
221
  * Add an unload handler that will be called when the SDK is being unloaded
200
222
  * @param handler - the handler
@@ -1473,6 +1495,11 @@ declare interface IInstrumentHook {
1473
1495
  * You must always supply the error callback
1474
1496
  */
1475
1497
  declare interface IInstrumentHooksCallbacks {
1498
+ /**
1499
+ * [Optional] Namespace details (same as the namespace used for events), useful for debugging and testing to
1500
+ * identify the source of the instrumented hooks
1501
+ */
1502
+ ns?: string | string[];
1476
1503
  /**
1477
1504
  * The hook callback to call before the original function is called
1478
1505
  */
@@ -1984,8 +2011,8 @@ declare interface IProcessTelemetryContext extends IBaseProcessingContext {
1984
2011
  }
1985
2012
 
1986
2013
  /**
1987
- * The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
1988
- * between multiple AppInsights instances
2014
+ * The current context for the current call to teardown() implementations, used to support when plugins are being removed
2015
+ * or the SDK is being unloaded.
1989
2016
  */
1990
2017
  declare interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
1991
2018
  /**
@@ -2004,6 +2031,27 @@ declare interface IProcessTelemetryUnloadContext extends IBaseProcessingContext
2004
2031
  createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
2005
2032
  }
2006
2033
 
2034
+ /**
2035
+ * The current context for the current call to the plugin update() implementations, used to support the notifications
2036
+ * for when plugins are added, removed or the configuration was changed.
2037
+ */
2038
+ declare interface IProcessTelemetryUpdateContext extends IBaseProcessingContext {
2039
+ /**
2040
+ * This Plugin has finished unloading, so unload the next one
2041
+ * @param updateState - The update State
2042
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
2043
+ */
2044
+ processNext: (updateState: ITelemetryUpdateState) => boolean | void;
2045
+ /**
2046
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
2047
+ * @param plugins - The execution order to process the plugins, if null or not supplied
2048
+ * then the current execution order will be copied.
2049
+ * @param startAt - The plugin to start processing from, if missing from the execution
2050
+ * order then the next plugin will be NOT set.
2051
+ */
2052
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUpdateContext;
2053
+ }
2054
+
2007
2055
  declare interface IRequestContext {
2008
2056
  status?: number;
2009
2057
  xhr?: XMLHttpRequest;
@@ -2239,6 +2287,15 @@ declare interface ITelemetryProcessor {
2239
2287
  * to later plugins (vs appending items to the telemetry item)
2240
2288
  */
2241
2289
  processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
2290
+ /**
2291
+ * The the plugin should re-evaluate configuration and update any cached configuration settings or
2292
+ * plugins. If implemented this method will be called whenever a plugin is added or removed and if
2293
+ * the configuration has bee updated.
2294
+ * @param updateCtx - This is the context that should be used during updating.
2295
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
2296
+ * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
2297
+ */
2298
+ update?: (updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState) => void | boolean;
2242
2299
  }
2243
2300
 
2244
2301
  declare interface ITelemetryUnloadState {
@@ -2247,6 +2304,27 @@ declare interface ITelemetryUnloadState {
2247
2304
  flushComplete?: boolean;
2248
2305
  }
2249
2306
 
2307
+ declare interface ITelemetryUpdateState {
2308
+ /**
2309
+ * Identifies the reason for the update notification, this is a bitwise numeric value
2310
+ */
2311
+ reason: TelemetryUpdateReason;
2312
+ /**
2313
+ * If this is a configuration update this was the previous configuration that was used
2314
+ */
2315
+ /**
2316
+ * If this is a configuration update is the new configuration that is being used
2317
+ */
2318
+ /**
2319
+ * This holds a collection of plugins that have been added (if the reason identifies that one or more plugins have been added)
2320
+ */
2321
+ added?: IPlugin[];
2322
+ /**
2323
+ * This holds a collection of plugins that have been removed (if the reason identifies that one or more plugins have been removed)
2324
+ */
2325
+ removed?: IPlugin[];
2326
+ }
2327
+
2250
2328
  export declare interface ITraceTelemetry extends IPartC {
2251
2329
  /**
2252
2330
  * @description A message string
@@ -2443,6 +2521,27 @@ declare const enum TelemetryUnloadReason {
2443
2521
  SdkUnload = 50
2444
2522
  }
2445
2523
 
2524
+ /**
2525
+ * The TelemetryUpdateReason enumeration contains a set of bit-wise values that specify the reason for update request.
2526
+ */
2527
+ declare const enum TelemetryUpdateReason {
2528
+ /**
2529
+ * Unknown.
2530
+ */
2531
+ Unknown = 0,
2532
+ /**
2533
+ * The configuration has ben updated or changed
2534
+ */
2535
+ /**
2536
+ * One or more plugins have been added
2537
+ */
2538
+ PluginAdded = 16,
2539
+ /**
2540
+ * One or more plugins have been removed
2541
+ */
2542
+ PluginRemoved = 32
2543
+ }
2544
+
2446
2545
  declare type UnloadHandler = (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
2447
2546
 
2448
2547
  declare interface XDomainRequest extends XMLHttpRequestEventTarget {
package/dist-esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript Web SDK - Basic, 2.8.0-beta.2203-03
2
+ * Application Insights JavaScript Web SDK - Basic, 2.8.0-beta.2203-06
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/applicationinsights-web-basic",
3
- "version": "2.8.0-beta.2203-03",
3
+ "version": "2.8.0-beta.2203-06",
4
4
  "description": "Microsoft Application Insights Javascript SDK core and channel",
5
5
  "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
6
6
  "author": "Microsoft Application Insights Team",
@@ -49,9 +49,9 @@
49
49
  "dependencies": {
50
50
  "@microsoft/dynamicproto-js": "^1.1.4",
51
51
  "@microsoft/applicationinsights-shims": "2.0.1",
52
- "@microsoft/applicationinsights-common": "2.8.0-beta.2203-03",
53
- "@microsoft/applicationinsights-channel-js": "2.8.0-beta.2203-03",
54
- "@microsoft/applicationinsights-core-js": "2.8.0-beta.2203-03"
52
+ "@microsoft/applicationinsights-common": "2.8.0-beta.2203-06",
53
+ "@microsoft/applicationinsights-channel-js": "2.8.0-beta.2203-06",
54
+ "@microsoft/applicationinsights-core-js": "2.8.0-beta.2203-06"
55
55
  },
56
56
  "license": "MIT",
57
57
  "publishConfig": {
@@ -1,26 +0,0 @@
1
- {
2
- "name": "aib",
3
- "version": "2.8.0-beta.2203-03",
4
- "ext": {
5
- "@js": {
6
- "file": "aib.2.8.0-beta.2203-03.js",
7
- "type": "text/javascript; charset=utf-8",
8
- "integrity": "sha256-5eJ6Uud7jJAJbriBe66nr6V/H3zgM9Tal1wMlFvOHCY= sha384-+LFwWG5pMgR4lBhYlqsZrDamjv0b5uZE98RKTIh7p6dOtdnAgzGh1pOSWXqSa7Fn sha512-TKlnXP3LB/fdACqXPGAiAEdqyQL2Ba0JtWgh65+IKK9OsqosH1iZKlLK32P/Z3L9VZ3R9pqZBaZH27MuzTawvw==",
9
- "hashes": {
10
- "sha256": "5eJ6Uud7jJAJbriBe66nr6V/H3zgM9Tal1wMlFvOHCY=",
11
- "sha384": "+LFwWG5pMgR4lBhYlqsZrDamjv0b5uZE98RKTIh7p6dOtdnAgzGh1pOSWXqSa7Fn",
12
- "sha512": "TKlnXP3LB/fdACqXPGAiAEdqyQL2Ba0JtWgh65+IKK9OsqosH1iZKlLK32P/Z3L9VZ3R9pqZBaZH27MuzTawvw=="
13
- }
14
- },
15
- "@min.js": {
16
- "file": "aib.2.8.0-beta.2203-03.min.js",
17
- "type": "text/javascript; charset=utf-8",
18
- "integrity": "sha256-D5djet7rZdWD6OiPzvQnv784R0AEaHxatsB9OdkT0Rg= sha384-9t4LyR6a9NIEJiPDzf2oinpycvi4R/SvFssF8r/S75LPnq1J3N8e7UTVK3YUB5Fv sha512-pFT+VYqul7QTCymGLciMwsEQT3KsEB8bNmRh63nCzNYy/B7iJoqBersLD1TEqyUqWmGaX9p4mi6/uGXslB+guQ==",
19
- "hashes": {
20
- "sha256": "D5djet7rZdWD6OiPzvQnv784R0AEaHxatsB9OdkT0Rg=",
21
- "sha384": "9t4LyR6a9NIEJiPDzf2oinpycvi4R/SvFssF8r/S75LPnq1J3N8e7UTVK3YUB5Fv",
22
- "sha512": "pFT+VYqul7QTCymGLciMwsEQT3KsEB8bNmRh63nCzNYy/B7iJoqBersLD1TEqyUqWmGaX9p4mi6/uGXslB+guQ=="
23
- }
24
- }
25
- }
26
- }