@microsoft/applicationinsights-core-js 3.0.0-beta.2211-03 → 3.0.0-beta.2211-04
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/applicationinsights-core-js.integrity.json +9 -9
- package/browser/applicationinsights-core-js.js +1055 -1226
- package/browser/applicationinsights-core-js.js.map +1 -1
- package/browser/applicationinsights-core-js.min.js +2 -2
- package/browser/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.api.json +85 -85
- package/dist/applicationinsights-core-js.api.md +8 -8
- package/dist/applicationinsights-core-js.d.ts +7 -7
- package/dist/applicationinsights-core-js.js +1055 -1226
- package/dist/applicationinsights-core-js.js.map +1 -1
- package/dist/applicationinsights-core-js.min.js +2 -2
- package/dist/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.rollup.d.ts +7 -7
- package/dist-esm/Config/ConfigDefaults.js +1 -1
- package/dist-esm/Config/DynamicConfig.js +1 -1
- package/dist-esm/Config/DynamicProperty.js +1 -1
- package/dist-esm/Config/DynamicState.js +1 -1
- package/dist-esm/Config/DynamicSupport.js +1 -1
- package/dist-esm/Config/IConfigDefaults.js +1 -1
- package/dist-esm/Config/IDynamicConfigHandler.js +1 -1
- package/dist-esm/Config/IDynamicPropertyHandler.js +1 -1
- package/dist-esm/Config/IDynamicWatcher.js +1 -1
- package/dist-esm/Config/_IDynamicConfigHandlerState.js +1 -1
- package/dist-esm/JavaScriptSDK/AggregationError.js +1 -1
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +93 -61
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +8 -0
- package/dist-esm/JavaScriptSDK/Constants.js.map +1 -0
- package/dist-esm/JavaScriptSDK/CookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +2 -2
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +1 -1
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +1 -1
- package/dist-esm/JavaScriptSDK/NotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +5 -5
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +1 -1
- package/dist-esm/JavaScriptSDK/W3cTraceParent.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDistributedTraceContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITraceParent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadHook.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +1 -1
- package/dist-esm/__DynamicConstants.js +15 -17
- package/dist-esm/__DynamicConstants.js.map +1 -1
- package/dist-esm/applicationinsights-core-js.js +1 -1
- package/package.json +1 -1
- package/src/JavaScriptSDK/AppInsightsCore.ts +99 -64
- package/src/JavaScriptSDK/Constants.ts +4 -0
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +2 -2
- package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +4 -4
- package/types/Config/IConfigDefaults.d.ts +3 -3
- package/types/Config/IDynamicWatcher.d.ts +1 -1
- package/types/JavaScriptSDK/AppInsightsCore.d.ts +1 -1
- package/types/JavaScriptSDK/Constants.d.ts +1 -0
- package/types/JavaScriptSDK/UnloadHandlerContainer.d.ts +1 -1
- package/types/JavaScriptSDK.Enums/EventsDiscardedReason.d.ts +1 -1
- package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +2 -2
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +1 -1
- package/types/JavaScriptSDK.Interfaces/IChannelControls.d.ts +4 -4
- package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +1 -1
- package/types/__DynamicConstants.d.ts +2 -4
- package/dist-esm/JavaScriptSDK/ChannelController.js +0 -217
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +0 -1
- package/src/JavaScriptSDK/ChannelController.ts +0 -274
- package/types/JavaScriptSDK/ChannelController.d.ts +0 -19
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Microsoft Application Insights Core Javascript SDK, 3.0.0-beta.2211-
|
|
2
|
+
* Microsoft Application Insights Core Javascript SDK, 3.0.0-beta.2211-04
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* Microsoft Application Insights Team
|
|
@@ -157,7 +157,7 @@ export declare class AppInsightsCore implements IAppInsightsCore {
|
|
|
157
157
|
getWParam: () => number;
|
|
158
158
|
constructor();
|
|
159
159
|
initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
|
|
160
|
-
|
|
160
|
+
getChannels(): IChannelControls[];
|
|
161
161
|
track(telemetryItem: ITelemetryItem): void;
|
|
162
162
|
getProcessTelContext(): IProcessTelemetryContext;
|
|
163
163
|
getNotifyMgr(): INotificationManager;
|
|
@@ -860,7 +860,7 @@ export declare interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
860
860
|
*/
|
|
861
861
|
isInitialized?: () => boolean;
|
|
862
862
|
initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
|
|
863
|
-
|
|
863
|
+
getChannels(): IChannelControls[];
|
|
864
864
|
track(telemetryItem: ITelemetryItem): void;
|
|
865
865
|
/**
|
|
866
866
|
* Get the current notification manager
|
|
@@ -1046,11 +1046,11 @@ export declare interface IChannelControls extends ITelemetryPlugin {
|
|
|
1046
1046
|
/**
|
|
1047
1047
|
* Pause sending data
|
|
1048
1048
|
*/
|
|
1049
|
-
pause(): void;
|
|
1049
|
+
pause?(): void;
|
|
1050
1050
|
/**
|
|
1051
1051
|
* Resume sending data
|
|
1052
1052
|
*/
|
|
1053
|
-
resume(): void;
|
|
1053
|
+
resume?(): void;
|
|
1054
1054
|
/**
|
|
1055
1055
|
* Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
|
|
1056
1056
|
* therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
|
|
@@ -1059,7 +1059,7 @@ export declare interface IChannelControls extends ITelemetryPlugin {
|
|
|
1059
1059
|
* @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
|
|
1060
1060
|
* @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
|
|
1061
1061
|
*/
|
|
1062
|
-
teardown
|
|
1062
|
+
teardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
|
|
1063
1063
|
/**
|
|
1064
1064
|
* Flush to send data immediately; channel should default to sending data asynchronously
|
|
1065
1065
|
* @param async - send data asynchronously when true
|
|
@@ -1068,7 +1068,7 @@ export declare interface IChannelControls extends ITelemetryPlugin {
|
|
|
1068
1068
|
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
1069
1069
|
* @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
|
|
1070
1070
|
*/
|
|
1071
|
-
flush(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
|
|
1071
|
+
flush?(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
|
|
1072
1072
|
}
|
|
1073
1073
|
|
|
1074
1074
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-
|
|
2
|
+
* Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
var _a;
|
|
9
9
|
import { __spreadArrayFn as __spreadArray } from "@microsoft/applicationinsights-shims";
|
|
10
10
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
11
|
-
import { arrAppend, arrForEach, arrIndexOf, deepExtend, dumpObj, hasDocument, isFunction, isNullOrUndefined, isPlainObject, objDeepFreeze, objDefineProp, objForEachKey, objFreeze, objHasOwn, scheduleInterval, throwError } from "@nevware21/ts-utils";
|
|
11
|
+
import { arrAppend, arrForEach, arrIndexOf, deepExtend, dumpObj, hasDocument, isFunction, isNullOrUndefined, isPlainObject, objDeepFreeze, objDefineProp, objForEachKey, objFreeze, objHasOwn, scheduleInterval, scheduleTimeout, throwError } from "@nevware21/ts-utils";
|
|
12
12
|
import { createDynamicConfig, onConfigChange } from "../Config/DynamicConfig";
|
|
13
|
-
import { _DYN_ADD_NOTIFICATION_LIS1, _DYN_CALL, _DYN_CANCEL, _DYN_CONFIGURABLE,
|
|
14
|
-
import { ChannelControllerPriority
|
|
13
|
+
import { _DYN_ADD_NOTIFICATION_LIS1, _DYN_CALL, _DYN_CANCEL, _DYN_CONFIGURABLE, _DYN_CREATE_NEW, _DYN_ENUMERABLE, _DYN_GET_NOTIFY_MGR, _DYN_GET_PLUGIN, _DYN_GET_PROCESS_TEL_CONT0, _DYN_IDENTIFIER, _DYN_INITIALIZE, _DYN_IS_ASYNC, _DYN_IS_INITIALIZED, _DYN_LENGTH, _DYN_LOGGER, _DYN_LOGGING_LEVEL_CONSOL4, _DYN_MESSAGE, _DYN_MESSAGE_ID, _DYN_NAME, _DYN_NOTIFY, _DYN_ON_COMPLETE, _DYN_POLL_INTERNAL_LOGS, _DYN_PROCESS_NEXT, _DYN_PUSH, _DYN_REMOVE_NOTIFICATION_2, _DYN_SET_DF, _DYN_SPLICE, _DYN_STOP_POLLING_INTERNA3, _DYN_TEARDOWN, _DYN_TIME, _DYN_VERSION, _DYN_WATCH } from "../__DynamicConstants";
|
|
14
|
+
import { ChannelControllerPriority } from "./Constants";
|
|
15
15
|
import { createCookieMgr } from "./CookieMgr";
|
|
16
16
|
import { createUniqueNamespace } from "./DataCacheHelper";
|
|
17
17
|
import { getDebugListener } from "./DbgExtensionUtils";
|
|
@@ -56,6 +56,7 @@ function _validateExtensions(logger, channelPriority, allExtensions) {
|
|
|
56
56
|
var _a;
|
|
57
57
|
// Concat all available extensions
|
|
58
58
|
var coreExtensions = [];
|
|
59
|
+
var channels = [];
|
|
59
60
|
// Check if any two extensions have the same priority, then warn to console
|
|
60
61
|
// And extract the local extensions from the
|
|
61
62
|
var extPriorities = {};
|
|
@@ -76,16 +77,18 @@ function _validateExtensions(logger, channelPriority, allExtensions) {
|
|
|
76
77
|
extPriorities[extPriority] = identifier;
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
|
-
// Split extensions to core and
|
|
80
|
+
// Split extensions to core and channels
|
|
80
81
|
if (!extPriority || extPriority < channelPriority) {
|
|
81
82
|
// Add to core extension that will be managed by AppInsightsCore
|
|
82
83
|
coreExtensions[_DYN_PUSH /* @min:%2epush */](ext);
|
|
83
84
|
}
|
|
85
|
+
else {
|
|
86
|
+
channels[_DYN_PUSH /* @min:%2epush */](ext);
|
|
87
|
+
}
|
|
84
88
|
});
|
|
85
|
-
return _a = {
|
|
86
|
-
all: allExtensions
|
|
87
|
-
},
|
|
89
|
+
return _a = {},
|
|
88
90
|
_a[STR_CORE /* @min:core */] = coreExtensions,
|
|
91
|
+
_a[STR_CHANNELS /* @min:channels */] = channels,
|
|
89
92
|
_a;
|
|
90
93
|
}
|
|
91
94
|
function _isPluginPresent(thePlugin, plugins) {
|
|
@@ -169,10 +172,8 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
169
172
|
var _cookieManager;
|
|
170
173
|
var _pluginChain;
|
|
171
174
|
var _configExtensions;
|
|
172
|
-
var _coreExtensions;
|
|
173
|
-
var _channelControl;
|
|
174
175
|
var _channelConfig;
|
|
175
|
-
var
|
|
176
|
+
var _channels;
|
|
176
177
|
var _isUnloading;
|
|
177
178
|
var _telemetryInitializerPlugin;
|
|
178
179
|
var _internalLogsEventName;
|
|
@@ -229,20 +230,26 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
229
230
|
_configExtensions[_DYN_PUSH /* @min:%2epush */].apply(_configExtensions, __spreadArray(__spreadArray([], extensions, false), cfgExtensions, false));
|
|
230
231
|
_channelConfig = config[STR_CHANNELS /* @min:%2echannels */];
|
|
231
232
|
_initPluginChain(null);
|
|
232
|
-
if (!
|
|
233
|
+
if (!_channels || _channels[_DYN_LENGTH /* @min:%2elength */] === 0) {
|
|
233
234
|
throwError("No " + STR_CHANNELS + " available");
|
|
234
235
|
}
|
|
236
|
+
if (_channels[_DYN_LENGTH /* @min:%2elength */] > 1) {
|
|
237
|
+
var teeController = _self[_DYN_GET_PLUGIN /* @min:%2egetPlugin */]("TeeChannelController");
|
|
238
|
+
if (!teeController || !teeController.plugin) {
|
|
239
|
+
_throwInternal(_self[_DYN_LOGGER /* @min:%2elogger */], 1 /* eLoggingSeverity.CRITICAL */, 28 /* _eInternalMessageId.SenderNotInitialized */, "TeeChannel required");
|
|
240
|
+
}
|
|
241
|
+
}
|
|
235
242
|
_registerDelayedCfgListener(config, _cfgListeners, _self[_DYN_LOGGER /* @min:%2elogger */]);
|
|
236
243
|
_cfgListeners = null;
|
|
237
244
|
_isInitialized = true;
|
|
238
245
|
_self.releaseQueue();
|
|
239
246
|
_self[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */]();
|
|
240
247
|
};
|
|
241
|
-
_self.
|
|
248
|
+
_self.getChannels = function () {
|
|
242
249
|
var controls = [];
|
|
243
|
-
if (
|
|
244
|
-
arrForEach(
|
|
245
|
-
controls[_DYN_PUSH /* @min:%2epush */](
|
|
250
|
+
if (_channels) {
|
|
251
|
+
arrForEach(_channels, function (channel) {
|
|
252
|
+
controls[_DYN_PUSH /* @min:%2epush */](channel);
|
|
246
253
|
});
|
|
247
254
|
}
|
|
248
255
|
return objFreeze(controls);
|
|
@@ -523,7 +530,7 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
523
530
|
_self.evtNamespace = function () {
|
|
524
531
|
return _evtNamespace;
|
|
525
532
|
};
|
|
526
|
-
_self
|
|
533
|
+
_self.flush = _flushChannels;
|
|
527
534
|
_self.getTraceCtx = function (createNew) {
|
|
528
535
|
if (!_traceCtx) {
|
|
529
536
|
_traceCtx = createDistributedTraceContext();
|
|
@@ -624,11 +631,9 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
624
631
|
_cfgPerfManager = null;
|
|
625
632
|
_cookieManager = null;
|
|
626
633
|
_pluginChain = null;
|
|
627
|
-
_coreExtensions = null;
|
|
628
634
|
_configExtensions = [];
|
|
629
|
-
_channelControl = null;
|
|
630
635
|
_channelConfig = null;
|
|
631
|
-
|
|
636
|
+
_channels = null;
|
|
632
637
|
_isUnloading = false;
|
|
633
638
|
_internalLogsEventName = null;
|
|
634
639
|
_evtNamespace = createUniqueNamespace("AIBaseCore", true);
|
|
@@ -647,42 +652,26 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
647
652
|
function _initPluginChain(updateState) {
|
|
648
653
|
// Extension validation
|
|
649
654
|
var theExtensions = _validateExtensions(_self[_DYN_LOGGER /* @min:%2elogger */], ChannelControllerPriority, _configExtensions);
|
|
650
|
-
_coreExtensions = theExtensions[STR_CORE /* @min:%2ecore */];
|
|
651
655
|
_pluginChain = null;
|
|
652
656
|
_pluginVersionString = null;
|
|
653
657
|
_pluginVersionStringArr = null;
|
|
658
|
+
// Get the primary channel queue and include as part of the normal extensions
|
|
659
|
+
_channels = (_channelConfig || [])[0] || [];
|
|
660
|
+
// Add any channels provided in the extensions and sort them
|
|
661
|
+
_channels = sortPlugins(arrAppend(_channels, theExtensions[STR_CHANNELS /* @min:%2echannels */]));
|
|
654
662
|
// Sort the complete set of extensions by priority
|
|
655
|
-
var allExtensions = theExtensions
|
|
656
|
-
// Initialize the Channel Queues and the channel plugins first
|
|
657
|
-
_channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions, _self));
|
|
658
|
-
if (_channelControl) {
|
|
659
|
-
// During add / remove of a plugin this may get called again, so don't re-add if already present
|
|
660
|
-
// But we also want the controller as the last, so remove if already present
|
|
661
|
-
// And reusing the existing instance, just in case an installed plugin has a reference and
|
|
662
|
-
// is using it.
|
|
663
|
-
var idx = arrIndexOf(allExtensions, _channelControl);
|
|
664
|
-
if (idx !== -1) {
|
|
665
|
-
allExtensions[_DYN_SPLICE /* @min:%2esplice */](idx, 1);
|
|
666
|
-
}
|
|
667
|
-
idx = arrIndexOf(_coreExtensions, _channelControl);
|
|
668
|
-
if (idx !== -1) {
|
|
669
|
-
_coreExtensions[_DYN_SPLICE /* @min:%2esplice */](idx, 1);
|
|
670
|
-
}
|
|
671
|
-
_channelControl._setQueue(_channelQueue);
|
|
672
|
-
}
|
|
673
|
-
else {
|
|
674
|
-
_channelControl = createChannelControllerPlugin(_channelQueue, _self);
|
|
675
|
-
}
|
|
663
|
+
var allExtensions = sortPlugins(theExtensions[STR_CORE /* @min:%2ecore */]);
|
|
676
664
|
// Add on "channelController" as the last "plugin"
|
|
677
|
-
allExtensions
|
|
678
|
-
_coreExtensions[_DYN_PUSH /* @min:%2epush */](_channelControl);
|
|
665
|
+
arrAppend(allExtensions, _channels);
|
|
679
666
|
// Required to allow plugins to call core.getPlugin() during their own initialization
|
|
680
|
-
_extensions =
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
667
|
+
_extensions = objFreeze(allExtensions);
|
|
668
|
+
var rootCtx = _createTelCtx();
|
|
669
|
+
// Initializing the channels first
|
|
670
|
+
if (_channels && _channels[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
671
|
+
initializePlugins(rootCtx[_DYN_CREATE_NEW /* @min:%2ecreateNew */](_channels), allExtensions);
|
|
672
|
+
}
|
|
673
|
+
// Now initialize the normal extensions
|
|
674
|
+
initializePlugins(rootCtx, allExtensions);
|
|
686
675
|
if (updateState) {
|
|
687
676
|
_doUpdate(updateState);
|
|
688
677
|
}
|
|
@@ -691,15 +680,17 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
691
680
|
var theExt = null;
|
|
692
681
|
var thePlugin = null;
|
|
693
682
|
arrForEach(_extensions, function (ext) {
|
|
694
|
-
if (ext[_DYN_IDENTIFIER /* @min:%2eidentifier */] === pluginIdentifier && ext !==
|
|
683
|
+
if (ext[_DYN_IDENTIFIER /* @min:%2eidentifier */] === pluginIdentifier && ext !== _telemetryInitializerPlugin) {
|
|
695
684
|
thePlugin = ext;
|
|
696
685
|
return -1;
|
|
697
686
|
}
|
|
687
|
+
// TODO: Check if the extension is an extension "host" (like the TeeChannel)
|
|
688
|
+
// So that if the extension is not found we can ask the "host" plugins for the plugin
|
|
698
689
|
});
|
|
699
|
-
if (!thePlugin && _channelControl) {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
}
|
|
690
|
+
// if (!thePlugin && _channelControl) {
|
|
691
|
+
// // Check the channel Controller
|
|
692
|
+
// thePlugin = _channelControl.getChannel(pluginIdentifier);
|
|
693
|
+
// }
|
|
703
694
|
if (thePlugin) {
|
|
704
695
|
theExt = {
|
|
705
696
|
plugin: thePlugin,
|
|
@@ -737,8 +728,8 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
737
728
|
function _getPluginChain() {
|
|
738
729
|
if (!_pluginChain) {
|
|
739
730
|
// copy the collection of extensions
|
|
740
|
-
var extensions = (
|
|
741
|
-
// During add / remove this may get called again, so don't
|
|
731
|
+
var extensions = (_extensions || []).slice();
|
|
732
|
+
// During add / remove this may get called again, so don't read if already present
|
|
742
733
|
if (arrIndexOf(extensions, _telemetryInitializerPlugin) === -1) {
|
|
743
734
|
extensions[_DYN_PUSH /* @min:%2epush */](_telemetryInitializerPlugin);
|
|
744
735
|
}
|
|
@@ -808,10 +799,51 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
808
799
|
}
|
|
809
800
|
}
|
|
810
801
|
function _flushChannels(isAsync, callBack, sendReason, cbTimeout) {
|
|
811
|
-
|
|
812
|
-
|
|
802
|
+
// Setting waiting to one so that we don't call the callBack until we finish iterating
|
|
803
|
+
var waiting = 1;
|
|
804
|
+
var doneIterating = false;
|
|
805
|
+
var cbTimer = null;
|
|
806
|
+
cbTimeout = cbTimeout || 5000;
|
|
807
|
+
function doCallback() {
|
|
808
|
+
waiting--;
|
|
809
|
+
if (doneIterating && waiting === 0) {
|
|
810
|
+
cbTimer && cbTimer[_DYN_CANCEL /* @min:%2ecancel */]();
|
|
811
|
+
cbTimer = null;
|
|
812
|
+
callBack && callBack(doneIterating);
|
|
813
|
+
callBack = null;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
if (_channels && _channels[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
817
|
+
var flushCtx = _createTelCtx()[_DYN_CREATE_NEW /* @min:%2ecreateNew */](_channels);
|
|
818
|
+
flushCtx.iterate(function (plugin) {
|
|
819
|
+
if (plugin.flush) {
|
|
820
|
+
waiting++;
|
|
821
|
+
var handled_1 = false;
|
|
822
|
+
// Not all channels will call this callback for every scenario
|
|
823
|
+
if (!plugin.flush(isAsync, function () {
|
|
824
|
+
handled_1 = true;
|
|
825
|
+
doCallback();
|
|
826
|
+
}, sendReason)) {
|
|
827
|
+
if (!handled_1) {
|
|
828
|
+
// If any channel doesn't return true and it didn't call the callback, then we should assume that the callback
|
|
829
|
+
// will never be called, so use a timeout to allow the channel(s) some time to "finish" before triggering any
|
|
830
|
+
// followup function (such as unloading)
|
|
831
|
+
if (isAsync && cbTimer == null) {
|
|
832
|
+
cbTimer = scheduleTimeout(function () {
|
|
833
|
+
cbTimer = null;
|
|
834
|
+
doCallback();
|
|
835
|
+
}, cbTimeout);
|
|
836
|
+
}
|
|
837
|
+
else {
|
|
838
|
+
doCallback();
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
});
|
|
813
844
|
}
|
|
814
|
-
|
|
845
|
+
doneIterating = true;
|
|
846
|
+
doCallback();
|
|
815
847
|
return true;
|
|
816
848
|
}
|
|
817
849
|
function _initDebugListener() {
|
|
@@ -875,7 +907,7 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
875
907
|
});
|
|
876
908
|
}
|
|
877
909
|
// Removed Stub for AppInsightsCore.prototype.initialize.
|
|
878
|
-
// Removed Stub for AppInsightsCore.prototype.
|
|
910
|
+
// Removed Stub for AppInsightsCore.prototype.getChannels.
|
|
879
911
|
// Removed Stub for AppInsightsCore.prototype.track.
|
|
880
912
|
// Removed Stub for AppInsightsCore.prototype.getProcessTelContext.
|
|
881
913
|
// Removed Stub for AppInsightsCore.prototype.getNotifyMgr.
|