@microsoft/applicationinsights-web 2.8.0-beta.2203-02 → 2.8.0-beta.2203-03
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.
- package/browser/{ai.2.8.0-beta.2203-02.cjs.js → ai.2.8.0-beta.2203-03.cjs.js} +200 -14
- package/browser/ai.2.8.0-beta.2203-03.cjs.js.map +1 -0
- package/browser/ai.2.8.0-beta.2203-03.cjs.min.js +6 -0
- package/browser/ai.2.8.0-beta.2203-03.cjs.min.js.map +1 -0
- package/browser/{ai.2.8.0-beta.2203-02.gbl.js → ai.2.8.0-beta.2203-03.gbl.js} +200 -14
- package/browser/ai.2.8.0-beta.2203-03.gbl.js.map +1 -0
- package/browser/ai.2.8.0-beta.2203-03.gbl.min.js +6 -0
- package/browser/ai.2.8.0-beta.2203-03.gbl.min.js.map +1 -0
- package/browser/ai.2.8.0-beta.2203-03.integrity.json +66 -0
- package/browser/{ai.2.8.0-beta.2203-02.js → ai.2.8.0-beta.2203-03.js} +200 -14
- package/browser/ai.2.8.0-beta.2203-03.js.map +1 -0
- package/browser/ai.2.8.0-beta.2203-03.min.js +6 -0
- package/browser/ai.2.8.0-beta.2203-03.min.js.map +1 -0
- package/browser/ai.2.cjs.js +199 -13
- package/browser/ai.2.cjs.js.map +1 -1
- package/browser/ai.2.cjs.min.js +2 -2
- package/browser/ai.2.cjs.min.js.map +1 -1
- package/browser/ai.2.gbl.js +199 -13
- package/browser/ai.2.gbl.js.map +1 -1
- package/browser/ai.2.gbl.min.js +2 -2
- package/browser/ai.2.gbl.min.js.map +1 -1
- package/browser/ai.2.js +199 -13
- package/browser/ai.2.js.map +1 -1
- package/browser/ai.2.min.js +2 -2
- package/browser/ai.2.min.js.map +1 -1
- package/dist/applicationinsights-web.api.json +505 -0
- package/dist/applicationinsights-web.api.md +9 -0
- package/dist/applicationinsights-web.d.ts +62 -2
- package/dist/applicationinsights-web.js +199 -13
- package/dist/applicationinsights-web.js.map +1 -1
- package/dist/applicationinsights-web.min.js +2 -2
- package/dist/applicationinsights-web.min.js.map +1 -1
- package/dist/applicationinsights-web.rollup.d.ts +62 -2
- package/dist-esm/ApplicationInsightsContainer.js +1 -1
- package/dist-esm/ApplicationInsightsDeprecated.js +1 -1
- package/dist-esm/Init.js +1 -1
- package/dist-esm/Initialization.js +1 -1
- package/dist-esm/applicationinsights-web.js +1 -1
- package/package.json +7 -7
- package/browser/ai.2.8.0-beta.2203-02.cjs.js.map +0 -1
- package/browser/ai.2.8.0-beta.2203-02.cjs.min.js +0 -6
- package/browser/ai.2.8.0-beta.2203-02.cjs.min.js.map +0 -1
- package/browser/ai.2.8.0-beta.2203-02.gbl.js.map +0 -1
- package/browser/ai.2.8.0-beta.2203-02.gbl.min.js +0 -6
- package/browser/ai.2.8.0-beta.2203-02.gbl.min.js.map +0 -1
- package/browser/ai.2.8.0-beta.2203-02.integrity.json +0 -66
- package/browser/ai.2.8.0-beta.2203-02.js.map +0 -1
- package/browser/ai.2.8.0-beta.2203-02.min.js +0 -6
- package/browser/ai.2.8.0-beta.2203-02.min.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Microsoft.ApplicationInsights, 2.8.0-beta.2203-
|
|
2
|
+
* Microsoft.ApplicationInsights, 2.8.0-beta.2203-03
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* Microsoft Application Insights Team
|
|
@@ -417,11 +417,26 @@ declare namespace ApplicationInsights {
|
|
|
417
417
|
* @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
|
|
418
418
|
*/
|
|
419
419
|
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
|
|
420
|
+
/**
|
|
421
|
+
* Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
|
|
422
|
+
* to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
|
|
423
|
+
* unload call return `true` stating that all plugins reported that they also unloaded, the recommended
|
|
424
|
+
* approach is to create a new instance and initialize that instance.
|
|
425
|
+
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
426
|
+
* to successfully remove any global references or they may just be completing the unload process asynchronously.
|
|
427
|
+
*/
|
|
428
|
+
unload(isAsync?: boolean, unloadComplete?: () => void): void;
|
|
420
429
|
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
430
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
|
|
421
431
|
/**
|
|
422
432
|
* Returns the unique event namespace that should be used
|
|
423
433
|
*/
|
|
424
434
|
evtNamespace(): string;
|
|
435
|
+
/**
|
|
436
|
+
* Add an unload handler that will be called when the SDK is being unloaded
|
|
437
|
+
* @param handler - the handler
|
|
438
|
+
*/
|
|
439
|
+
addUnloadCb(handler: UnloadHandler): void;
|
|
425
440
|
protected releaseQueue(): void;
|
|
426
441
|
}
|
|
427
442
|
|
|
@@ -491,6 +506,11 @@ declare namespace ApplicationInsights {
|
|
|
491
506
|
*/
|
|
492
507
|
teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
|
|
493
508
|
abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
509
|
+
/**
|
|
510
|
+
* Add an unload handler that will be called when the SDK is being unloaded
|
|
511
|
+
* @param handler - the handler
|
|
512
|
+
*/
|
|
513
|
+
protected _addUnloadCb(handler: UnloadHandler): void;
|
|
494
514
|
/**
|
|
495
515
|
* Add this hook so that it is automatically removed during unloading
|
|
496
516
|
* @param hooks - The single hook or an array of IInstrumentHook objects
|
|
@@ -1050,15 +1070,36 @@ declare namespace ApplicationInsights {
|
|
|
1050
1070
|
* Return a new instance of the IProcessTelemetryContext for processing events
|
|
1051
1071
|
*/
|
|
1052
1072
|
getProcessTelContext(): IProcessTelemetryContext;
|
|
1073
|
+
/**
|
|
1074
|
+
* Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
|
|
1075
|
+
* to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
|
|
1076
|
+
* unload call return `true` stating that all plugins reported that they also unloaded, the recommended
|
|
1077
|
+
* approach is to create a new instance and initialize that instance.
|
|
1078
|
+
* This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
|
|
1079
|
+
* to successfully remove any global references or they may just be completing the unload process asynchronously.
|
|
1080
|
+
*/
|
|
1081
|
+
unload(isAsync?: boolean, unloadComplete?: () => void): void;
|
|
1053
1082
|
/**
|
|
1054
1083
|
* Find and return the (first) plugin with the specified identifier if present
|
|
1055
1084
|
* @param pluginIdentifier
|
|
1056
1085
|
*/
|
|
1057
1086
|
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
1087
|
+
/**
|
|
1088
|
+
* Add a new plugin to the installation
|
|
1089
|
+
* @param plugin - The new plugin to add
|
|
1090
|
+
* @param replaceExisting - should any existing plugin be replaced
|
|
1091
|
+
* @param doAsync - Should the add be performed asynchronously
|
|
1092
|
+
*/
|
|
1093
|
+
addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
|
|
1058
1094
|
/**
|
|
1059
1095
|
* Returns the unique event namespace that should be used when registering events
|
|
1060
1096
|
*/
|
|
1061
1097
|
evtNamespace(): string;
|
|
1098
|
+
/**
|
|
1099
|
+
* Add a handler that will be called when the SDK is being unloaded
|
|
1100
|
+
* @param handler - the handler
|
|
1101
|
+
*/
|
|
1102
|
+
addUnloadCb(handler: UnloadHandler): void;
|
|
1062
1103
|
}
|
|
1063
1104
|
|
|
1064
1105
|
interface IAppInsightsDeprecated {
|
|
@@ -2736,6 +2777,7 @@ declare namespace ApplicationInsights {
|
|
|
2736
2777
|
* (unless it's also been re-initialized)
|
|
2737
2778
|
*/
|
|
2738
2779
|
setEnabled: (isEnabled: boolean) => void;
|
|
2780
|
+
remove: (isAsync?: boolean, removeCb?: (removed?: boolean) => void) => void;
|
|
2739
2781
|
}
|
|
2740
2782
|
|
|
2741
2783
|
interface ILocation {
|
|
@@ -4604,6 +4646,10 @@ declare namespace ApplicationInsights {
|
|
|
4604
4646
|
* The event(s) being sent as a retry
|
|
4605
4647
|
*/
|
|
4606
4648
|
Retry = 5,
|
|
4649
|
+
/**
|
|
4650
|
+
* The SDK is unloading
|
|
4651
|
+
*/
|
|
4652
|
+
SdkUnload = 6,
|
|
4607
4653
|
/**
|
|
4608
4654
|
* Maximum batch size would be exceeded
|
|
4609
4655
|
*/
|
|
@@ -4789,7 +4835,19 @@ declare namespace ApplicationInsights {
|
|
|
4789
4835
|
/**
|
|
4790
4836
|
* Teardown has been called without any context.
|
|
4791
4837
|
*/
|
|
4792
|
-
ManualTeardown = 0
|
|
4838
|
+
ManualTeardown = 0,
|
|
4839
|
+
/**
|
|
4840
|
+
* Just this plugin is being removed
|
|
4841
|
+
*/
|
|
4842
|
+
PluginUnload = 1,
|
|
4843
|
+
/**
|
|
4844
|
+
* This instance of the plugin is being removed and replaced
|
|
4845
|
+
*/
|
|
4846
|
+
PluginReplace = 2,
|
|
4847
|
+
/**
|
|
4848
|
+
* The entire SDK is being unloaded
|
|
4849
|
+
*/
|
|
4850
|
+
SdkUnload = 50
|
|
4793
4851
|
}
|
|
4794
4852
|
|
|
4795
4853
|
class Trace extends MessageData implements ISerializable {
|
|
@@ -4809,6 +4867,8 @@ declare namespace ApplicationInsights {
|
|
|
4809
4867
|
});
|
|
4810
4868
|
}
|
|
4811
4869
|
|
|
4870
|
+
type UnloadHandler = (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
4871
|
+
|
|
4812
4872
|
const Util: IUtil;
|
|
4813
4873
|
|
|
4814
4874
|
interface XDomainRequest extends XMLHttpRequestEventTarget {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Web, 2.8.0-beta.2203-
|
|
2
|
+
* Application Insights JavaScript SDK - Web, 2.8.0-beta.2203-03
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -813,7 +813,7 @@
|
|
|
813
813
|
objForEachKey(values, function (field, value) {
|
|
814
814
|
enumClass[field] = value;
|
|
815
815
|
if (!isUndefined(enumClass[value])) {
|
|
816
|
-
throwError("
|
|
816
|
+
throwError("[" + value + "] exists for " + field);
|
|
817
817
|
}
|
|
818
818
|
enumClass[value] = field;
|
|
819
819
|
});
|
|
@@ -1642,8 +1642,11 @@
|
|
|
1642
1642
|
return createTelemetryProxyChain([startAt], config, core);
|
|
1643
1643
|
}
|
|
1644
1644
|
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1645
|
-
var _nextProxy =
|
|
1645
|
+
var _nextProxy = null;
|
|
1646
1646
|
var _onComplete = [];
|
|
1647
|
+
if (startAt !== null) {
|
|
1648
|
+
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1649
|
+
}
|
|
1647
1650
|
var context = {
|
|
1648
1651
|
_next: _moveNext,
|
|
1649
1652
|
ctx: {
|
|
@@ -2359,6 +2362,30 @@
|
|
|
2359
2362
|
return channelQueue;
|
|
2360
2363
|
}
|
|
2361
2364
|
|
|
2365
|
+
function createUnloadHandlerContainer() {
|
|
2366
|
+
var handlers = [];
|
|
2367
|
+
function _addHandler(handler) {
|
|
2368
|
+
if (handler) {
|
|
2369
|
+
handlers.push(handler);
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
function _runHandlers(unloadCtx, unloadState) {
|
|
2373
|
+
arrForEach(handlers, function (handler) {
|
|
2374
|
+
try {
|
|
2375
|
+
handler(unloadCtx, unloadState);
|
|
2376
|
+
}
|
|
2377
|
+
catch (e) {
|
|
2378
|
+
unloadCtx.diagLog().throwInternal(2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
2379
|
+
}
|
|
2380
|
+
});
|
|
2381
|
+
handlers = [];
|
|
2382
|
+
}
|
|
2383
|
+
return {
|
|
2384
|
+
add: _addHandler,
|
|
2385
|
+
run: _runHandlers
|
|
2386
|
+
};
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2362
2389
|
var strGetPlugin = "getPlugin";
|
|
2363
2390
|
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
2364
2391
|
function BaseTelemetryPlugin() {
|
|
@@ -2366,6 +2393,7 @@
|
|
|
2366
2393
|
var _isinitialized;
|
|
2367
2394
|
var _rootCtx;
|
|
2368
2395
|
var _nextPlugin;
|
|
2396
|
+
var _unloadHandlerContainer;
|
|
2369
2397
|
var _hooks;
|
|
2370
2398
|
_initDefaults();
|
|
2371
2399
|
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
@@ -2387,6 +2415,7 @@
|
|
|
2387
2415
|
function _unloadCallback() {
|
|
2388
2416
|
if (!unloadDone) {
|
|
2389
2417
|
unloadDone = true;
|
|
2418
|
+
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
2390
2419
|
arrForEach(_hooks, function (fn) {
|
|
2391
2420
|
fn.rm();
|
|
2392
2421
|
});
|
|
@@ -2415,6 +2444,7 @@
|
|
|
2415
2444
|
}
|
|
2416
2445
|
}
|
|
2417
2446
|
};
|
|
2447
|
+
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
2418
2448
|
});
|
|
2419
2449
|
_self.diagLog = function (itemCtx) {
|
|
2420
2450
|
return _getTelCtx(itemCtx).diagLog();
|
|
@@ -2471,6 +2501,7 @@
|
|
|
2471
2501
|
_rootCtx = null;
|
|
2472
2502
|
_nextPlugin = null;
|
|
2473
2503
|
_hooks = [];
|
|
2504
|
+
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
2474
2505
|
}
|
|
2475
2506
|
}
|
|
2476
2507
|
return BaseTelemetryPlugin;
|
|
@@ -2540,6 +2571,8 @@
|
|
|
2540
2571
|
|
|
2541
2572
|
var strValidationError = "Plugins must provide initialize method";
|
|
2542
2573
|
var strNotificationManager = "_notificationManager";
|
|
2574
|
+
var strSdkUnloadingError = "SDK is still unloading...";
|
|
2575
|
+
var strSdkNotInitialized = "SDK is not initialized";
|
|
2543
2576
|
function _createPerfManager(core, notificationMgr) {
|
|
2544
2577
|
return new PerfManager(notificationMgr);
|
|
2545
2578
|
}
|
|
@@ -2569,6 +2602,16 @@
|
|
|
2569
2602
|
core: coreExtensions
|
|
2570
2603
|
};
|
|
2571
2604
|
}
|
|
2605
|
+
function _isPluginPresent(thePlugin, plugins) {
|
|
2606
|
+
var exists = false;
|
|
2607
|
+
arrForEach(plugins, function (plugin) {
|
|
2608
|
+
if (plugin === thePlugin) {
|
|
2609
|
+
exists = true;
|
|
2610
|
+
return -1;
|
|
2611
|
+
}
|
|
2612
|
+
});
|
|
2613
|
+
return exists;
|
|
2614
|
+
}
|
|
2572
2615
|
function _createDummyNotificationManager() {
|
|
2573
2616
|
var _a;
|
|
2574
2617
|
return objCreateFn((_a = {},
|
|
@@ -2593,15 +2636,20 @@
|
|
|
2593
2636
|
var _channelControl;
|
|
2594
2637
|
var _channelConfig;
|
|
2595
2638
|
var _channelQueue;
|
|
2639
|
+
var _isUnloading;
|
|
2596
2640
|
var _telemetryInitializerPlugin;
|
|
2597
2641
|
var _internalLogsEventName;
|
|
2598
2642
|
var _evtNamespace;
|
|
2643
|
+
var _unloadHandlers;
|
|
2599
2644
|
var _debugListener;
|
|
2600
2645
|
var _internalLogPoller = 0;
|
|
2601
2646
|
dynamicProto(BaseCore, this, function (_self) {
|
|
2602
2647
|
_initDefaults();
|
|
2603
2648
|
_self.isInitialized = function () { return _isInitialized; };
|
|
2604
2649
|
_self.initialize = function (config, extensions, logger, notificationManager) {
|
|
2650
|
+
if (_isUnloading) {
|
|
2651
|
+
throwError(strSdkUnloadingError);
|
|
2652
|
+
}
|
|
2605
2653
|
if (_self.isInitialized()) {
|
|
2606
2654
|
throwError("Core should not be initialized more than once");
|
|
2607
2655
|
}
|
|
@@ -2614,8 +2662,7 @@
|
|
|
2614
2662
|
_initDebugListener(config);
|
|
2615
2663
|
_initPerfManager(config);
|
|
2616
2664
|
config.extensions = isNullOrUndefined(config.extensions) ? [] : config.extensions;
|
|
2617
|
-
|
|
2618
|
-
extConfig.NotificationManager = notificationManager;
|
|
2665
|
+
_initExtConfig(config);
|
|
2619
2666
|
if (logger) {
|
|
2620
2667
|
_self.logger = logger;
|
|
2621
2668
|
}
|
|
@@ -2640,7 +2687,7 @@
|
|
|
2640
2687
|
setValue(telemetryItem, strIKey, _self.config.instrumentationKey, null, isNotTruthy);
|
|
2641
2688
|
setValue(telemetryItem, "time", toISOString(new Date()), null, isNotTruthy);
|
|
2642
2689
|
setValue(telemetryItem, "ver", "4.0", null, isNullOrUndefined);
|
|
2643
|
-
if (_self.isInitialized()) {
|
|
2690
|
+
if (!_isUnloading && _self.isInitialized()) {
|
|
2644
2691
|
_createTelCtx().processNext(telemetryItem);
|
|
2645
2692
|
}
|
|
2646
2693
|
else {
|
|
@@ -2655,14 +2702,14 @@
|
|
|
2655
2702
|
}
|
|
2656
2703
|
return _notificationManager;
|
|
2657
2704
|
};
|
|
2658
|
-
_self
|
|
2705
|
+
_self[strAddNotificationListener] = function (listener) {
|
|
2659
2706
|
if (_notificationManager) {
|
|
2660
|
-
_notificationManager
|
|
2707
|
+
_notificationManager[strAddNotificationListener](listener);
|
|
2661
2708
|
}
|
|
2662
2709
|
};
|
|
2663
|
-
_self
|
|
2710
|
+
_self[strRemoveNotificationListener] = function (listener) {
|
|
2664
2711
|
if (_notificationManager) {
|
|
2665
|
-
_notificationManager
|
|
2712
|
+
_notificationManager[strRemoveNotificationListener](listener);
|
|
2666
2713
|
}
|
|
2667
2714
|
};
|
|
2668
2715
|
_self.getCookieMgr = function () {
|
|
@@ -2719,10 +2766,80 @@
|
|
|
2719
2766
|
}
|
|
2720
2767
|
};
|
|
2721
2768
|
proxyFunctions(_self, function () { return _telemetryInitializerPlugin; }, ["addTelemetryInitializer"]);
|
|
2769
|
+
_self.unload = function (isAsync, unloadComplete, cbTimeout) {
|
|
2770
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
2771
|
+
if (!_isInitialized) {
|
|
2772
|
+
throwError(strSdkNotInitialized);
|
|
2773
|
+
}
|
|
2774
|
+
if (_isUnloading) {
|
|
2775
|
+
throwError(strSdkUnloadingError);
|
|
2776
|
+
}
|
|
2777
|
+
var unloadState = {
|
|
2778
|
+
reason: 50 ,
|
|
2779
|
+
isAsync: isAsync,
|
|
2780
|
+
flushComplete: false
|
|
2781
|
+
};
|
|
2782
|
+
var processUnloadCtx = createProcessTelemetryUnloadContext(_getPluginChain(), _self.config, _self);
|
|
2783
|
+
processUnloadCtx.onComplete(function () {
|
|
2784
|
+
_initDefaults();
|
|
2785
|
+
unloadComplete && unloadComplete(unloadState);
|
|
2786
|
+
}, _self);
|
|
2787
|
+
function _doUnload(flushComplete) {
|
|
2788
|
+
unloadState.flushComplete = flushComplete;
|
|
2789
|
+
_isUnloading = true;
|
|
2790
|
+
_unloadHandlers.run(processUnloadCtx, unloadState);
|
|
2791
|
+
_self.stopPollingInternalLogs();
|
|
2792
|
+
processUnloadCtx.processNext(unloadState);
|
|
2793
|
+
}
|
|
2794
|
+
if (_channelControl) {
|
|
2795
|
+
_channelControl.flush(isAsync, _doUnload, 6 , cbTimeout);
|
|
2796
|
+
}
|
|
2797
|
+
else {
|
|
2798
|
+
_doUnload(true);
|
|
2799
|
+
}
|
|
2800
|
+
};
|
|
2722
2801
|
_self.getPlugin = _getPlugin;
|
|
2802
|
+
_self.addPlugin = function (plugin, replaceExisting, isAsync, addCb) {
|
|
2803
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
2804
|
+
if (!plugin) {
|
|
2805
|
+
addCb && addCb(false);
|
|
2806
|
+
_logOrThrowError(strValidationError);
|
|
2807
|
+
return;
|
|
2808
|
+
}
|
|
2809
|
+
var existingPlugin = _getPlugin(plugin.identifier);
|
|
2810
|
+
if (existingPlugin && !replaceExisting) {
|
|
2811
|
+
addCb && addCb(false);
|
|
2812
|
+
_logOrThrowError("Plugin [" + plugin.identifier + "] is already loaded!");
|
|
2813
|
+
return;
|
|
2814
|
+
}
|
|
2815
|
+
function _addPlugin(removed) {
|
|
2816
|
+
_configExtensions.push(plugin);
|
|
2817
|
+
_initPluginChain(_self.config);
|
|
2818
|
+
addCb && addCb(true);
|
|
2819
|
+
}
|
|
2820
|
+
if (existingPlugin) {
|
|
2821
|
+
var removedPlugins = [existingPlugin.plugin];
|
|
2822
|
+
var unloadState = {
|
|
2823
|
+
reason: 2 ,
|
|
2824
|
+
isAsync: isAsync
|
|
2825
|
+
};
|
|
2826
|
+
_removePlugins(removedPlugins, unloadState, function (removed) {
|
|
2827
|
+
if (!removed) {
|
|
2828
|
+
addCb && addCb(false);
|
|
2829
|
+
}
|
|
2830
|
+
else {
|
|
2831
|
+
_addPlugin();
|
|
2832
|
+
}
|
|
2833
|
+
});
|
|
2834
|
+
}
|
|
2835
|
+
else {
|
|
2836
|
+
_addPlugin();
|
|
2837
|
+
}
|
|
2838
|
+
};
|
|
2723
2839
|
_self.evtNamespace = function () {
|
|
2724
2840
|
return _evtNamespace;
|
|
2725
2841
|
};
|
|
2842
|
+
proxyFunctionAs(_self, "addUnloadCb", function () { return _unloadHandlers; }, "add");
|
|
2726
2843
|
function _initDefaults() {
|
|
2727
2844
|
_isInitialized = false;
|
|
2728
2845
|
_self.logger = new DiagnosticLogger({ loggingLevelConsole: 1 });
|
|
@@ -2740,8 +2857,10 @@
|
|
|
2740
2857
|
_channelControl = null;
|
|
2741
2858
|
_channelConfig = null;
|
|
2742
2859
|
_channelQueue = null;
|
|
2860
|
+
_isUnloading = false;
|
|
2743
2861
|
_internalLogsEventName = null;
|
|
2744
2862
|
_evtNamespace = createUniqueNamespace("AIBaseCore", true);
|
|
2863
|
+
_unloadHandlers = createUnloadHandlerContainer();
|
|
2745
2864
|
}
|
|
2746
2865
|
function _createTelCtx() {
|
|
2747
2866
|
return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
|
|
@@ -2794,6 +2913,20 @@
|
|
|
2794
2913
|
isEnabled: function () {
|
|
2795
2914
|
var pluginState = _getPluginState(thePlugin);
|
|
2796
2915
|
return !pluginState[strTeardown] && !pluginState[strDisabled];
|
|
2916
|
+
},
|
|
2917
|
+
remove: function (isAsync, removeCb) {
|
|
2918
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
2919
|
+
var pluginsToRemove = [thePlugin];
|
|
2920
|
+
var unloadState = {
|
|
2921
|
+
reason: 1 ,
|
|
2922
|
+
isAsync: isAsync
|
|
2923
|
+
};
|
|
2924
|
+
_removePlugins(pluginsToRemove, unloadState, function (removed) {
|
|
2925
|
+
if (removed) {
|
|
2926
|
+
_initPluginChain(_self.config);
|
|
2927
|
+
}
|
|
2928
|
+
removeCb && removeCb(removed);
|
|
2929
|
+
});
|
|
2797
2930
|
}
|
|
2798
2931
|
};
|
|
2799
2932
|
}
|
|
@@ -2809,6 +2942,46 @@
|
|
|
2809
2942
|
}
|
|
2810
2943
|
return _pluginChain;
|
|
2811
2944
|
}
|
|
2945
|
+
function _removePlugins(thePlugins, unloadState, removeComplete) {
|
|
2946
|
+
if (thePlugins && thePlugins.length > 0) {
|
|
2947
|
+
var unloadChain = createTelemetryProxyChain(thePlugins, _self.config, _self);
|
|
2948
|
+
var unloadCtx = createProcessTelemetryUnloadContext(unloadChain, _self.config, _self);
|
|
2949
|
+
unloadCtx.onComplete(function () {
|
|
2950
|
+
var removed = false;
|
|
2951
|
+
var newConfigExtensions = [];
|
|
2952
|
+
arrForEach(_configExtensions, function (plugin, idx) {
|
|
2953
|
+
if (!_isPluginPresent(plugin, thePlugins)) {
|
|
2954
|
+
newConfigExtensions.push(plugin);
|
|
2955
|
+
}
|
|
2956
|
+
else {
|
|
2957
|
+
removed = true;
|
|
2958
|
+
}
|
|
2959
|
+
});
|
|
2960
|
+
_configExtensions = newConfigExtensions;
|
|
2961
|
+
var newChannelConfig = [];
|
|
2962
|
+
if (_channelConfig) {
|
|
2963
|
+
arrForEach(_channelConfig, function (queue, idx) {
|
|
2964
|
+
var newQueue = [];
|
|
2965
|
+
arrForEach(queue, function (channel) {
|
|
2966
|
+
if (!_isPluginPresent(channel, thePlugins)) {
|
|
2967
|
+
newQueue.push(channel);
|
|
2968
|
+
}
|
|
2969
|
+
else {
|
|
2970
|
+
removed = true;
|
|
2971
|
+
}
|
|
2972
|
+
});
|
|
2973
|
+
newChannelConfig.push(newQueue);
|
|
2974
|
+
});
|
|
2975
|
+
_channelConfig = newChannelConfig;
|
|
2976
|
+
}
|
|
2977
|
+
removeComplete && removeComplete(removed);
|
|
2978
|
+
});
|
|
2979
|
+
unloadCtx.processNext(unloadState);
|
|
2980
|
+
}
|
|
2981
|
+
else {
|
|
2982
|
+
removeComplete(false);
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2812
2985
|
function _flushInternalLogs() {
|
|
2813
2986
|
var queue = _self.logger ? _self.logger.queue : [];
|
|
2814
2987
|
if (queue) {
|
|
@@ -2843,6 +3016,19 @@
|
|
|
2843
3016
|
setValue(_self.config, "createPerfMgr", _createPerfManager);
|
|
2844
3017
|
}
|
|
2845
3018
|
}
|
|
3019
|
+
function _initExtConfig(config) {
|
|
3020
|
+
var extConfig = getSetValue(config, strExtensionConfig);
|
|
3021
|
+
extConfig.NotificationManager = _notificationManager;
|
|
3022
|
+
}
|
|
3023
|
+
function _logOrThrowError(message) {
|
|
3024
|
+
var logger = _self.logger;
|
|
3025
|
+
if (logger) {
|
|
3026
|
+
logger.throwInternal(2 , 73 , message);
|
|
3027
|
+
}
|
|
3028
|
+
else {
|
|
3029
|
+
throwError(message);
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
2846
3032
|
});
|
|
2847
3033
|
}
|
|
2848
3034
|
return BaseCore;
|
|
@@ -5818,7 +6004,7 @@
|
|
|
5818
6004
|
config.disableFlushOnUnload = stringToBoolOrDefault(config.disableFlushOnUnload, config.disableFlushOnBeforeUnload);
|
|
5819
6005
|
return config;
|
|
5820
6006
|
};
|
|
5821
|
-
ApplicationInsights.Version = "2.8.0-beta.2203-
|
|
6007
|
+
ApplicationInsights.Version = "2.8.0-beta.2203-03";
|
|
5822
6008
|
return ApplicationInsights;
|
|
5823
6009
|
}(BaseTelemetryPlugin));
|
|
5824
6010
|
var Timing = /** @class */ (function () {
|
|
@@ -6125,7 +6311,7 @@
|
|
|
6125
6311
|
}
|
|
6126
6312
|
}
|
|
6127
6313
|
var EnvelopeCreator = {
|
|
6128
|
-
Version: "2.8.0-beta.2203-
|
|
6314
|
+
Version: "2.8.0-beta.2203-03"
|
|
6129
6315
|
};
|
|
6130
6316
|
function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
|
|
6131
6317
|
EnvelopeCreatorInit(logger, telemetryItem);
|
|
@@ -7394,7 +7580,7 @@
|
|
|
7394
7580
|
return Device;
|
|
7395
7581
|
}());
|
|
7396
7582
|
|
|
7397
|
-
var Version = "2.8.0-beta.2203-
|
|
7583
|
+
var Version = "2.8.0-beta.2203-03";
|
|
7398
7584
|
var Internal = /** @class */ (function () {
|
|
7399
7585
|
function Internal(config) {
|
|
7400
7586
|
this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + "_" : "") + "javascript:" + Version;
|