@microsoft/applicationinsights-core-js 2.7.5-nightly.2203-03 → 2.7.5
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 +766 -1967
- 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 +9840 -16439
- package/dist/applicationinsights-core-js.api.md +48 -425
- package/dist/applicationinsights-core-js.d.ts +123 -784
- package/dist/applicationinsights-core-js.js +766 -1967
- 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 +123 -784
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +69 -3
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +99 -496
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +21 -120
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +87 -202
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +4 -4
- package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +148 -7
- package/dist-esm/JavaScriptSDK/CoreUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +14 -27
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +12 -13
- package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +86 -89
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +1 -3
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
- package/dist-esm/JavaScriptSDK/NotificationManager.js +42 -37
- package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +119 -430
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +4 -30
- package/dist-esm/JavaScriptSDK/RandomHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +14 -60
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js +76 -0
- package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +96 -90
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +2 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js.map +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/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/ITelemetryItem.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +2 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js.map +1 -1
- package/dist-esm/applicationinsights-core-js.js +7 -12
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +67 -70
- package/src/JavaScriptSDK/AppInsightsCore.ts +101 -2
- package/src/JavaScriptSDK/BaseCore.ts +120 -696
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +31 -205
- package/src/JavaScriptSDK/ChannelController.ts +103 -242
- package/src/JavaScriptSDK/CookieMgr.ts +5 -7
- package/src/JavaScriptSDK/CoreUtils.ts +172 -8
- package/src/JavaScriptSDK/DiagnosticLogger.ts +14 -29
- package/src/JavaScriptSDK/EnvUtils.ts +12 -13
- package/src/JavaScriptSDK/HelperFuncs.ts +97 -123
- package/src/JavaScriptSDK/InstrumentHooks.ts +2 -4
- package/src/JavaScriptSDK/NotificationManager.ts +37 -34
- package/src/JavaScriptSDK/PerfManager.ts +7 -4
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +134 -543
- package/src/JavaScriptSDK/RandomHelper.ts +3 -35
- package/src/JavaScriptSDK/TelemetryHelpers.ts +21 -83
- package/src/JavaScriptSDK/TelemetryPluginChain.ts +120 -0
- package/src/JavaScriptSDK.Enums/LoggingEnums.ts +87 -184
- package/src/JavaScriptSDK.Enums/SendRequestReason.ts +0 -5
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +2 -82
- package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +5 -16
- package/src/JavaScriptSDK.Interfaces/IInstrumentHooks.ts +6 -16
- package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +14 -94
- package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +10 -28
- package/src/JavaScriptSDK.Interfaces/ITelemetryPluginChain.ts +11 -9
- package/types/JavaScriptSDK/AppInsightsCore.d.ts +21 -0
- package/types/JavaScriptSDK/BaseCore.d.ts +3 -81
- package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +10 -53
- package/types/JavaScriptSDK/ChannelController.d.ts +17 -16
- package/types/JavaScriptSDK/CoreUtils.d.ts +48 -1
- package/types/JavaScriptSDK/DiagnosticLogger.d.ts +0 -10
- package/types/JavaScriptSDK/HelperFuncs.d.ts +32 -33
- package/types/JavaScriptSDK/PerfManager.d.ts +1 -1
- package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +6 -69
- package/types/JavaScriptSDK/RandomHelper.d.ts +0 -6
- package/types/JavaScriptSDK/TelemetryHelpers.d.ts +3 -23
- package/types/JavaScriptSDK/TelemetryPluginChain.d.ts +32 -0
- package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +2 -91
- package/types/JavaScriptSDK.Enums/SendRequestReason.d.ts +0 -4
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +1 -72
- package/types/JavaScriptSDK.Interfaces/IChannelControls.d.ts +5 -16
- package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +0 -9
- package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +11 -82
- package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +8 -25
- package/types/JavaScriptSDK.Interfaces/ITelemetryPluginChain.d.ts +10 -9
- package/types/applicationinsights-core-js.d.ts +9 -18
- package/types/tsdoc-metadata.json +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +0 -93
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +0 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +0 -477
- package/dist-esm/JavaScriptSDK/EventHelpers.js.map +0 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +0 -28
- package/dist-esm/JavaScriptSDK/InternalConstants.js.map +0 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +0 -81
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +0 -1
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +0 -33
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +0 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +0 -8
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js.map +0 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +0 -8
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js.map +0 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +0 -6
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js.map +0 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +0 -8
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js.map +0 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +0 -8
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js.map +0 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +0 -6
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js.map +0 -1
- package/src/JavaScriptSDK/DataCacheHelper.ts +0 -106
- package/src/JavaScriptSDK/EventHelpers.ts +0 -550
- package/src/JavaScriptSDK/InternalConstants.ts +0 -26
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +0 -111
- package/src/JavaScriptSDK/UnloadHandlerContainer.ts +0 -46
- package/src/JavaScriptSDK.Enums/TelemetryUnloadReason.ts +0 -27
- package/src/JavaScriptSDK.Enums/TelemetryUpdateReason.ts +0 -27
- package/src/JavaScriptSDK.Interfaces/ITelemetryInitializers.ts +0 -16
- package/src/JavaScriptSDK.Interfaces/ITelemetryUnloadState.ts +0 -10
- package/src/JavaScriptSDK.Interfaces/ITelemetryUpdateState.ts +0 -34
- package/src/JavaScriptSDK.Interfaces/IUnloadableComponent.ts +0 -17
- package/types/JavaScriptSDK/DataCacheHelper.d.ts +0 -13
- package/types/JavaScriptSDK/EventHelpers.d.ts +0 -154
- package/types/JavaScriptSDK/InternalConstants.d.ts +0 -20
- package/types/JavaScriptSDK/TelemetryInitializerPlugin.d.ts +0 -16
- package/types/JavaScriptSDK/UnloadHandlerContainer.d.ts +0 -11
- package/types/JavaScriptSDK.Enums/TelemetryUnloadReason.d.ts +0 -21
- package/types/JavaScriptSDK.Enums/TelemetryUpdateReason.d.ts +0 -20
- package/types/JavaScriptSDK.Interfaces/ITelemetryInitializers.d.ts +0 -13
- package/types/JavaScriptSDK.Interfaces/ITelemetryUnloadState.d.ts +0 -6
- package/types/JavaScriptSDK.Interfaces/ITelemetryUpdateState.d.ts +0 -22
- package/types/JavaScriptSDK.Interfaces/IUnloadableComponent.d.ts +0 -13
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Core, 2.7.5
|
|
2
|
+
* Application Insights JavaScript SDK - Core, 2.7.5
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -8,24 +8,18 @@
|
|
|
8
8
|
import { __spreadArrayFn as __spreadArray } from "@microsoft/applicationinsights-shims";
|
|
9
9
|
import { objCreateFn } from "@microsoft/applicationinsights-shims";
|
|
10
10
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { ChannelController } from "./ChannelController";
|
|
12
|
+
import { ProcessTelemetryContext } from "./ProcessTelemetryContext";
|
|
13
|
+
import { initializePlugins, sortPlugins } from "./TelemetryHelpers";
|
|
14
|
+
import { LoggingSeverity } from "../JavaScriptSDK.Enums/LoggingEnums";
|
|
13
15
|
import { getGblPerfMgr, PerfManager } from "./PerfManager";
|
|
14
16
|
import { createCookieMgr } from "./CookieMgr";
|
|
15
|
-
import { arrForEach, isNullOrUndefined, toISOString, getSetValue, setValue, throwError, isNotTruthy, isFunction
|
|
17
|
+
import { arrForEach, isNullOrUndefined, toISOString, getSetValue, setValue, throwError, isNotTruthy, isFunction } from "./HelperFuncs";
|
|
16
18
|
import { strExtensionConfig, strIKey } from "./Constants";
|
|
17
|
-
import { DiagnosticLogger
|
|
19
|
+
import { DiagnosticLogger } from "./DiagnosticLogger";
|
|
18
20
|
import { getDebugListener } from "./DbgExtensionUtils";
|
|
19
|
-
|
|
20
|
-
import { TelemetryInitializerPlugin } from "./TelemetryInitializerPlugin";
|
|
21
|
-
import { createUniqueNamespace } from "./DataCacheHelper";
|
|
22
|
-
import { createUnloadHandlerContainer } from "./UnloadHandlerContainer";
|
|
23
|
-
import { strAddNotificationListener, strDisabled, strEventsDiscarded, strEventsSendRequest, strEventsSent, strRemoveNotificationListener, strTeardown } from "./InternalConstants";
|
|
24
|
-
var strValidationError = "Plugins must provide initialize method";
|
|
21
|
+
var validationError = "Extensions must provide callback to initialize";
|
|
25
22
|
var strNotificationManager = "_notificationManager";
|
|
26
|
-
var strSdkUnloadingError = "SDK is still unloading...";
|
|
27
|
-
var strSdkNotInitialized = "SDK is not initialized";
|
|
28
|
-
// const strPluginUnloadFailed = "Failed to unload plugin";
|
|
29
23
|
/**
|
|
30
24
|
* Helper to create the default performance manager
|
|
31
25
|
* @param core
|
|
@@ -34,92 +28,22 @@ var strSdkNotInitialized = "SDK is not initialized";
|
|
|
34
28
|
function _createPerfManager(core, notificationMgr) {
|
|
35
29
|
return new PerfManager(notificationMgr);
|
|
36
30
|
}
|
|
37
|
-
function _validateExtensions(logger, channelPriority, allExtensions) {
|
|
38
|
-
// Concat all available extensions
|
|
39
|
-
var coreExtensions = [];
|
|
40
|
-
// Check if any two extensions have the same priority, then warn to console
|
|
41
|
-
// And extract the local extensions from the
|
|
42
|
-
var extPriorities = {};
|
|
43
|
-
// Extension validation
|
|
44
|
-
arrForEach(allExtensions, function (ext) {
|
|
45
|
-
if (isNullOrUndefined(ext) || isNullOrUndefined(ext.initialize)) {
|
|
46
|
-
throwError(strValidationError);
|
|
47
|
-
}
|
|
48
|
-
var extPriority = ext.priority;
|
|
49
|
-
var identifier = ext.identifier;
|
|
50
|
-
if (ext && extPriority) {
|
|
51
|
-
if (!isNullOrUndefined(extPriorities[extPriority])) {
|
|
52
|
-
logger.warnToConsole("Two extensions have same priority #" + extPriority + " - " + extPriorities[extPriority] + ", " + identifier);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
// set a value
|
|
56
|
-
extPriorities[extPriority] = identifier;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
// Split extensions to core and channelController
|
|
60
|
-
if (!extPriority || extPriority < channelPriority) {
|
|
61
|
-
// Add to core extension that will be managed by BaseCore
|
|
62
|
-
coreExtensions.push(ext);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
return {
|
|
66
|
-
all: allExtensions,
|
|
67
|
-
core: coreExtensions
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
function _isPluginPresent(thePlugin, plugins) {
|
|
71
|
-
var exists = false;
|
|
72
|
-
arrForEach(plugins, function (plugin) {
|
|
73
|
-
if (plugin === thePlugin) {
|
|
74
|
-
exists = true;
|
|
75
|
-
return -1;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
return exists;
|
|
79
|
-
}
|
|
80
|
-
function _createDummyNotificationManager() {
|
|
81
|
-
var _a;
|
|
82
|
-
return objCreateFn((_a = {},
|
|
83
|
-
_a[strAddNotificationListener] = function (listener) { },
|
|
84
|
-
_a[strRemoveNotificationListener] = function (listener) { },
|
|
85
|
-
_a[strEventsSent] = function (events) { },
|
|
86
|
-
_a[strEventsDiscarded] = function (events, reason) { },
|
|
87
|
-
_a[strEventsSendRequest] = function (sendReason, isAsync) { },
|
|
88
|
-
_a));
|
|
89
|
-
}
|
|
90
31
|
var BaseCore = /** @class */ (function () {
|
|
91
32
|
function BaseCore() {
|
|
92
|
-
|
|
93
|
-
var _isInitialized;
|
|
33
|
+
var _isInitialized = false;
|
|
94
34
|
var _eventQueue;
|
|
35
|
+
var _channelController;
|
|
95
36
|
var _notificationManager;
|
|
96
37
|
var _perfManager;
|
|
97
|
-
var _cfgPerfManager;
|
|
98
38
|
var _cookieManager;
|
|
99
|
-
var _pluginChain;
|
|
100
|
-
var _configExtensions;
|
|
101
|
-
var _coreExtensions;
|
|
102
|
-
var _channelControl;
|
|
103
|
-
var _channelConfig;
|
|
104
|
-
var _channelQueue;
|
|
105
|
-
var _isUnloading;
|
|
106
|
-
var _telemetryInitializerPlugin;
|
|
107
|
-
var _internalLogsEventName;
|
|
108
|
-
var _evtNamespace;
|
|
109
|
-
var _unloadHandlers;
|
|
110
|
-
var _debugListener;
|
|
111
|
-
/**
|
|
112
|
-
* Internal log poller
|
|
113
|
-
*/
|
|
114
|
-
var _internalLogPoller = 0;
|
|
115
39
|
dynamicProto(BaseCore, this, function (_self) {
|
|
116
|
-
|
|
117
|
-
|
|
40
|
+
_self._extensions = new Array();
|
|
41
|
+
_channelController = new ChannelController();
|
|
42
|
+
// Use a default logger so initialization errors are not dropped on the floor with full logging
|
|
43
|
+
_self.logger = new DiagnosticLogger({ loggingLevelConsole: LoggingSeverity.CRITICAL });
|
|
44
|
+
_eventQueue = [];
|
|
118
45
|
_self.isInitialized = function () { return _isInitialized; };
|
|
119
46
|
_self.initialize = function (config, extensions, logger, notificationManager) {
|
|
120
|
-
if (_isUnloading) {
|
|
121
|
-
throwError(strSdkUnloadingError);
|
|
122
|
-
}
|
|
123
47
|
// Make sure core is only initialized once
|
|
124
48
|
if (_self.isInitialized()) {
|
|
125
49
|
throwError("Core should not be initialized more than once");
|
|
@@ -131,33 +55,76 @@ var BaseCore = /** @class */ (function () {
|
|
|
131
55
|
// For backward compatibility only
|
|
132
56
|
_self[strNotificationManager] = notificationManager;
|
|
133
57
|
_self.config = config || {};
|
|
134
|
-
|
|
135
|
-
|
|
58
|
+
if (notificationManager && _self.config.disableDbgExt !== true) {
|
|
59
|
+
notificationManager.addNotificationListener(getDebugListener(config));
|
|
60
|
+
}
|
|
61
|
+
if (_self.config.enablePerfMgr) {
|
|
62
|
+
// Set the performance manager creation function if not defined
|
|
63
|
+
setValue(_self.config, "createPerfMgr", _createPerfManager);
|
|
64
|
+
}
|
|
136
65
|
config.extensions = isNullOrUndefined(config.extensions) ? [] : config.extensions;
|
|
137
66
|
// add notification to the extensions in the config so other plugins can access it
|
|
138
|
-
|
|
67
|
+
var extConfig = getSetValue(config, strExtensionConfig);
|
|
68
|
+
extConfig.NotificationManager = notificationManager;
|
|
139
69
|
if (logger) {
|
|
140
70
|
_self.logger = logger;
|
|
141
71
|
}
|
|
72
|
+
// Concat all available extensions
|
|
73
|
+
var allExtensions = [];
|
|
74
|
+
allExtensions.push.apply(allExtensions, __spreadArray(__spreadArray([], extensions, false), config.extensions, false));
|
|
75
|
+
allExtensions = sortPlugins(allExtensions);
|
|
76
|
+
var coreExtensions = [];
|
|
77
|
+
var channelExtensions = [];
|
|
78
|
+
// Check if any two extensions have the same priority, then warn to console
|
|
79
|
+
// And extract the local extensions from the
|
|
80
|
+
var extPriorities = {};
|
|
142
81
|
// Extension validation
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
82
|
+
arrForEach(allExtensions, function (ext) {
|
|
83
|
+
if (isNullOrUndefined(ext) || isNullOrUndefined(ext.initialize)) {
|
|
84
|
+
throwError(validationError);
|
|
85
|
+
}
|
|
86
|
+
var extPriority = ext.priority;
|
|
87
|
+
var identifier = ext.identifier;
|
|
88
|
+
if (ext && extPriority) {
|
|
89
|
+
if (!isNullOrUndefined(extPriorities[extPriority])) {
|
|
90
|
+
logger.warnToConsole("Two extensions have same priority #" + extPriority + " - " + extPriorities[extPriority] + ", " + identifier);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
// set a value
|
|
94
|
+
extPriorities[extPriority] = identifier;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Split extensions to core and channelController
|
|
98
|
+
if (!extPriority || extPriority < _channelController.priority) {
|
|
99
|
+
// Add to core extension that will be managed by BaseCore
|
|
100
|
+
coreExtensions.push(ext);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
// Add all other extensions to be managed by the channel controller
|
|
104
|
+
channelExtensions.push(ext);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
// Validation complete
|
|
108
|
+
// Add the channelController to the complete extension collection and
|
|
109
|
+
// to the end of the core extensions
|
|
110
|
+
allExtensions.push(_channelController);
|
|
111
|
+
coreExtensions.push(_channelController);
|
|
112
|
+
// Sort the complete set of extensions by priority
|
|
113
|
+
allExtensions = sortPlugins(allExtensions);
|
|
114
|
+
_self._extensions = allExtensions;
|
|
115
|
+
// initialize channel controller first, this will initialize all channel plugins
|
|
116
|
+
initializePlugins(new ProcessTelemetryContext([_channelController], config, _self), allExtensions);
|
|
117
|
+
initializePlugins(new ProcessTelemetryContext(coreExtensions, config, _self), allExtensions);
|
|
118
|
+
// Now reset the extensions to just those being managed by Basecore
|
|
119
|
+
_self._extensions = coreExtensions;
|
|
120
|
+
if (_self.getTransmissionControls().length === 0) {
|
|
148
121
|
throwError("No channels available");
|
|
149
122
|
}
|
|
150
123
|
_isInitialized = true;
|
|
151
124
|
_self.releaseQueue();
|
|
152
125
|
};
|
|
153
126
|
_self.getTransmissionControls = function () {
|
|
154
|
-
|
|
155
|
-
if (_channelQueue) {
|
|
156
|
-
arrForEach(_channelQueue, function (channels) {
|
|
157
|
-
controls.push(channels.queue);
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
return objFreeze(controls);
|
|
127
|
+
return _channelController.getChannelControls();
|
|
161
128
|
};
|
|
162
129
|
_self.track = function (telemetryItem) {
|
|
163
130
|
// setup default iKey if not passed in
|
|
@@ -166,45 +133,40 @@ var BaseCore = /** @class */ (function () {
|
|
|
166
133
|
setValue(telemetryItem, "time", toISOString(new Date()), null, isNotTruthy);
|
|
167
134
|
// Common Schema 4.0
|
|
168
135
|
setValue(telemetryItem, "ver", "4.0", null, isNullOrUndefined);
|
|
169
|
-
if (
|
|
136
|
+
if (_self.isInitialized()) {
|
|
170
137
|
// Process the telemetry plugin chain
|
|
171
|
-
|
|
138
|
+
_self.getProcessTelContext().processNext(telemetryItem);
|
|
172
139
|
}
|
|
173
140
|
else {
|
|
174
141
|
// Queue events until all extensions are initialized
|
|
175
142
|
_eventQueue.push(telemetryItem);
|
|
176
143
|
}
|
|
177
144
|
};
|
|
178
|
-
_self.getProcessTelContext =
|
|
145
|
+
_self.getProcessTelContext = function () {
|
|
146
|
+
var extensions = _self._extensions;
|
|
147
|
+
var thePlugins = extensions;
|
|
148
|
+
// invoke any common telemetry processors before sending through pipeline
|
|
149
|
+
if (!extensions || extensions.length === 0) {
|
|
150
|
+
// Pass to Channel controller so data is sent to correct channel queues
|
|
151
|
+
thePlugins = [_channelController];
|
|
152
|
+
}
|
|
153
|
+
return new ProcessTelemetryContext(thePlugins, _self.config, _self);
|
|
154
|
+
};
|
|
179
155
|
_self.getNotifyMgr = function () {
|
|
180
156
|
if (!_notificationManager) {
|
|
181
157
|
// Create Dummy notification manager
|
|
182
|
-
_notificationManager =
|
|
158
|
+
_notificationManager = objCreateFn({
|
|
159
|
+
addNotificationListener: function (listener) { },
|
|
160
|
+
removeNotificationListener: function (listener) { },
|
|
161
|
+
eventsSent: function (events) { },
|
|
162
|
+
eventsDiscarded: function (events, reason) { },
|
|
163
|
+
eventsSendRequest: function (sendReason, isAsync) { }
|
|
164
|
+
});
|
|
183
165
|
// For backward compatibility only
|
|
184
166
|
_self[strNotificationManager] = _notificationManager;
|
|
185
167
|
}
|
|
186
168
|
return _notificationManager;
|
|
187
169
|
};
|
|
188
|
-
/**
|
|
189
|
-
* Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
|
|
190
|
-
* The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
|
|
191
|
-
* called.
|
|
192
|
-
* @param {INotificationListener} listener - An INotificationListener object.
|
|
193
|
-
*/
|
|
194
|
-
_self[strAddNotificationListener] = function (listener) {
|
|
195
|
-
if (_notificationManager) {
|
|
196
|
-
_notificationManager[strAddNotificationListener](listener);
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
/**
|
|
200
|
-
* Removes all instances of the listener.
|
|
201
|
-
* @param {INotificationListener} listener - INotificationListener to remove.
|
|
202
|
-
*/
|
|
203
|
-
_self[strRemoveNotificationListener] = function (listener) {
|
|
204
|
-
if (_notificationManager) {
|
|
205
|
-
_notificationManager[strRemoveNotificationListener](listener);
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
170
|
_self.getCookieMgr = function () {
|
|
209
171
|
if (!_cookieManager) {
|
|
210
172
|
_cookieManager = createCookieMgr(_self.config, _self.logger);
|
|
@@ -215,12 +177,12 @@ var BaseCore = /** @class */ (function () {
|
|
|
215
177
|
_cookieManager = cookieMgr;
|
|
216
178
|
};
|
|
217
179
|
_self.getPerfMgr = function () {
|
|
218
|
-
if (!_perfManager
|
|
180
|
+
if (!_perfManager) {
|
|
219
181
|
if (_self.config && _self.config.enablePerfMgr && isFunction(_self.config.createPerfMgr)) {
|
|
220
|
-
|
|
182
|
+
_perfManager = _self.config.createPerfMgr(_self, _self.getNotifyMgr());
|
|
221
183
|
}
|
|
222
184
|
}
|
|
223
|
-
return _perfManager ||
|
|
185
|
+
return _perfManager || getGblPerfMgr();
|
|
224
186
|
};
|
|
225
187
|
_self.setPerfMgr = function (perfMgr) {
|
|
226
188
|
_perfManager = perfMgr;
|
|
@@ -229,360 +191,13 @@ var BaseCore = /** @class */ (function () {
|
|
|
229
191
|
return _eventQueue.length;
|
|
230
192
|
};
|
|
231
193
|
_self.releaseQueue = function () {
|
|
232
|
-
if (
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
arrForEach(eventQueue, function (event) {
|
|
236
|
-
_createTelCtx().processNext(event);
|
|
194
|
+
if (_eventQueue.length > 0) {
|
|
195
|
+
arrForEach(_eventQueue, function (event) {
|
|
196
|
+
_self.getProcessTelContext().processNext(event);
|
|
237
197
|
});
|
|
198
|
+
_eventQueue = [];
|
|
238
199
|
}
|
|
239
200
|
};
|
|
240
|
-
/**
|
|
241
|
-
* Periodically check logger.queue for log messages to be flushed
|
|
242
|
-
*/
|
|
243
|
-
_self.pollInternalLogs = function (eventName) {
|
|
244
|
-
_internalLogsEventName = eventName || null;
|
|
245
|
-
var interval = _self.config.diagnosticLogInterval;
|
|
246
|
-
if (!interval || !(interval > 0)) {
|
|
247
|
-
interval = 10000;
|
|
248
|
-
}
|
|
249
|
-
if (_internalLogPoller) {
|
|
250
|
-
clearInterval(_internalLogPoller);
|
|
251
|
-
}
|
|
252
|
-
_internalLogPoller = setInterval(function () {
|
|
253
|
-
_flushInternalLogs();
|
|
254
|
-
}, interval);
|
|
255
|
-
return _internalLogPoller;
|
|
256
|
-
};
|
|
257
|
-
/**
|
|
258
|
-
* Stop polling log messages from logger.queue
|
|
259
|
-
*/
|
|
260
|
-
_self.stopPollingInternalLogs = function () {
|
|
261
|
-
if (_internalLogPoller) {
|
|
262
|
-
clearInterval(_internalLogPoller);
|
|
263
|
-
_internalLogPoller = 0;
|
|
264
|
-
_flushInternalLogs();
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
// Add addTelemetryInitializer
|
|
268
|
-
proxyFunctions(_self, function () { return _telemetryInitializerPlugin; }, ["addTelemetryInitializer"]);
|
|
269
|
-
_self.unload = function (isAsync, unloadComplete, cbTimeout) {
|
|
270
|
-
if (isAsync === void 0) { isAsync = true; }
|
|
271
|
-
if (!_isInitialized) {
|
|
272
|
-
// The SDK is not initialized
|
|
273
|
-
throwError(strSdkNotInitialized);
|
|
274
|
-
}
|
|
275
|
-
// Check if the SDK still unloading so throw
|
|
276
|
-
if (_isUnloading) {
|
|
277
|
-
// The SDK is already unloading
|
|
278
|
-
throwError(strSdkUnloadingError);
|
|
279
|
-
}
|
|
280
|
-
var unloadState = {
|
|
281
|
-
reason: 50 /* SdkUnload */,
|
|
282
|
-
isAsync: isAsync,
|
|
283
|
-
flushComplete: false
|
|
284
|
-
};
|
|
285
|
-
var processUnloadCtx = createProcessTelemetryUnloadContext(_getPluginChain(), _self.config, _self);
|
|
286
|
-
processUnloadCtx.onComplete(function () {
|
|
287
|
-
_initDefaults();
|
|
288
|
-
unloadComplete && unloadComplete(unloadState);
|
|
289
|
-
}, _self);
|
|
290
|
-
function _doUnload(flushComplete) {
|
|
291
|
-
unloadState.flushComplete = flushComplete;
|
|
292
|
-
_isUnloading = true;
|
|
293
|
-
// Run all of the unload handlers first (before unloading the plugins)
|
|
294
|
-
_unloadHandlers.run(processUnloadCtx, unloadState);
|
|
295
|
-
// Stop polling the internal logs
|
|
296
|
-
_self.stopPollingInternalLogs();
|
|
297
|
-
// Start unloading the components, from this point onwards the SDK should be considered to be in an unstable state
|
|
298
|
-
processUnloadCtx.processNext(unloadState);
|
|
299
|
-
}
|
|
300
|
-
if (!_flushChannels(isAsync, _doUnload, 6 /* SdkUnload */, cbTimeout)) {
|
|
301
|
-
_doUnload(false);
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
|
-
_self.getPlugin = _getPlugin;
|
|
305
|
-
_self.addPlugin = function (plugin, replaceExisting, isAsync, addCb) {
|
|
306
|
-
if (!plugin) {
|
|
307
|
-
addCb && addCb(false);
|
|
308
|
-
_logOrThrowError(strValidationError);
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
var existingPlugin = _getPlugin(plugin.identifier);
|
|
312
|
-
if (existingPlugin && !replaceExisting) {
|
|
313
|
-
addCb && addCb(false);
|
|
314
|
-
_logOrThrowError("Plugin [" + plugin.identifier + "] is already loaded!");
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
var updateState = {
|
|
318
|
-
reason: 16 /* PluginAdded */
|
|
319
|
-
};
|
|
320
|
-
function _addPlugin(removed) {
|
|
321
|
-
_configExtensions.push(plugin);
|
|
322
|
-
updateState.added = [plugin];
|
|
323
|
-
// Re-Initialize the plugin chain
|
|
324
|
-
_initPluginChain(_self.config, updateState);
|
|
325
|
-
addCb && addCb(true);
|
|
326
|
-
}
|
|
327
|
-
if (existingPlugin) {
|
|
328
|
-
var removedPlugins_1 = [existingPlugin.plugin];
|
|
329
|
-
var unloadState = {
|
|
330
|
-
reason: 2 /* PluginReplace */,
|
|
331
|
-
isAsync: !!isAsync
|
|
332
|
-
};
|
|
333
|
-
_removePlugins(removedPlugins_1, unloadState, function (removed) {
|
|
334
|
-
if (!removed) {
|
|
335
|
-
// Previous plugin was successfully removed or was not installed
|
|
336
|
-
addCb && addCb(false);
|
|
337
|
-
}
|
|
338
|
-
else {
|
|
339
|
-
updateState.removed = removedPlugins_1;
|
|
340
|
-
updateState.reason |= 32 /* PluginRemoved */;
|
|
341
|
-
_addPlugin(true);
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
else {
|
|
346
|
-
_addPlugin(false);
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
_self.evtNamespace = function () {
|
|
350
|
-
return _evtNamespace;
|
|
351
|
-
};
|
|
352
|
-
_self.flush = _flushChannels;
|
|
353
|
-
// Create the addUnloadCb
|
|
354
|
-
proxyFunctionAs(_self, "addUnloadCb", function () { return _unloadHandlers; }, "add");
|
|
355
|
-
function _initDefaults() {
|
|
356
|
-
_isInitialized = false;
|
|
357
|
-
// Use a default logger so initialization errors are not dropped on the floor with full logging
|
|
358
|
-
_self.logger = new DiagnosticLogger({ loggingLevelConsole: 1 /* CRITICAL */ });
|
|
359
|
-
_self.config = {};
|
|
360
|
-
_self._extensions = [];
|
|
361
|
-
_telemetryInitializerPlugin = new TelemetryInitializerPlugin();
|
|
362
|
-
_eventQueue = [];
|
|
363
|
-
_notificationManager = null;
|
|
364
|
-
_perfManager = null;
|
|
365
|
-
_cfgPerfManager = null;
|
|
366
|
-
_cookieManager = null;
|
|
367
|
-
_pluginChain = null;
|
|
368
|
-
_coreExtensions = null;
|
|
369
|
-
_configExtensions = [];
|
|
370
|
-
_channelControl = null;
|
|
371
|
-
_channelConfig = null;
|
|
372
|
-
_channelQueue = null;
|
|
373
|
-
_isUnloading = false;
|
|
374
|
-
_internalLogsEventName = null;
|
|
375
|
-
_evtNamespace = createUniqueNamespace("AIBaseCore", true);
|
|
376
|
-
_unloadHandlers = createUnloadHandlerContainer();
|
|
377
|
-
}
|
|
378
|
-
function _createTelCtx() {
|
|
379
|
-
return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
|
|
380
|
-
}
|
|
381
|
-
// Initialize or Re-initialize the plugins
|
|
382
|
-
function _initPluginChain(config, updateState) {
|
|
383
|
-
// Extension validation
|
|
384
|
-
var theExtensions = _validateExtensions(_self.logger, ChannelControllerPriority, _configExtensions);
|
|
385
|
-
_coreExtensions = theExtensions.core;
|
|
386
|
-
_pluginChain = null;
|
|
387
|
-
// Sort the complete set of extensions by priority
|
|
388
|
-
var allExtensions = theExtensions.all;
|
|
389
|
-
// Initialize the Channel Queues and the channel plugins first
|
|
390
|
-
_channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions, config, _self));
|
|
391
|
-
if (_channelControl) {
|
|
392
|
-
// During add / remove of a plugin this may get called again, so don't re-add if already present
|
|
393
|
-
// But we also want the controller as the last, so remove if already present
|
|
394
|
-
// And reusing the existing instance, just in case an installed plugin has a reference and
|
|
395
|
-
// is using it.
|
|
396
|
-
var idx = allExtensions.indexOf(_channelControl);
|
|
397
|
-
if (idx !== -1) {
|
|
398
|
-
allExtensions.splice(idx, 1);
|
|
399
|
-
}
|
|
400
|
-
idx = _coreExtensions.indexOf(_channelControl);
|
|
401
|
-
if (idx !== -1) {
|
|
402
|
-
_coreExtensions.splice(idx, 1);
|
|
403
|
-
}
|
|
404
|
-
_channelControl._setQueue(_channelQueue);
|
|
405
|
-
}
|
|
406
|
-
else {
|
|
407
|
-
_channelControl = createChannelControllerPlugin(_channelQueue, _self);
|
|
408
|
-
}
|
|
409
|
-
// Add on "channelController" as the last "plugin"
|
|
410
|
-
allExtensions.push(_channelControl);
|
|
411
|
-
_coreExtensions.push(_channelControl);
|
|
412
|
-
// Required to allow plugins to call core.getPlugin() during their own initialization
|
|
413
|
-
_self._extensions = sortPlugins(allExtensions);
|
|
414
|
-
// Initialize the controls
|
|
415
|
-
_channelControl.initialize(config, _self, allExtensions);
|
|
416
|
-
initializePlugins(_createTelCtx(), allExtensions);
|
|
417
|
-
// Now reset the extensions to just those being managed by Basecore
|
|
418
|
-
_self._extensions = objFreeze(sortPlugins(_coreExtensions || [])).slice();
|
|
419
|
-
if (updateState) {
|
|
420
|
-
_doUpdate(updateState);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
function _getPlugin(pluginIdentifier) {
|
|
424
|
-
var theExt = null;
|
|
425
|
-
var thePlugin = null;
|
|
426
|
-
arrForEach(_self._extensions, function (ext) {
|
|
427
|
-
if (ext.identifier === pluginIdentifier && ext !== _channelControl && ext !== _telemetryInitializerPlugin) {
|
|
428
|
-
thePlugin = ext;
|
|
429
|
-
return -1;
|
|
430
|
-
}
|
|
431
|
-
});
|
|
432
|
-
if (!thePlugin && _channelControl) {
|
|
433
|
-
// Check the channel Controller
|
|
434
|
-
thePlugin = _channelControl.getChannel(pluginIdentifier);
|
|
435
|
-
}
|
|
436
|
-
if (thePlugin) {
|
|
437
|
-
theExt = {
|
|
438
|
-
plugin: thePlugin,
|
|
439
|
-
setEnabled: function (enabled) {
|
|
440
|
-
_getPluginState(thePlugin)[strDisabled] = !enabled;
|
|
441
|
-
},
|
|
442
|
-
isEnabled: function () {
|
|
443
|
-
var pluginState = _getPluginState(thePlugin);
|
|
444
|
-
return !pluginState[strTeardown] && !pluginState[strDisabled];
|
|
445
|
-
},
|
|
446
|
-
remove: function (isAsync, removeCb) {
|
|
447
|
-
if (isAsync === void 0) { isAsync = true; }
|
|
448
|
-
var pluginsToRemove = [thePlugin];
|
|
449
|
-
var unloadState = {
|
|
450
|
-
reason: 1 /* PluginUnload */,
|
|
451
|
-
isAsync: isAsync
|
|
452
|
-
};
|
|
453
|
-
_removePlugins(pluginsToRemove, unloadState, function (removed) {
|
|
454
|
-
if (removed) {
|
|
455
|
-
// Re-Initialize the plugin chain
|
|
456
|
-
_initPluginChain(_self.config, {
|
|
457
|
-
reason: 32 /* PluginRemoved */,
|
|
458
|
-
removed: pluginsToRemove
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
removeCb && removeCb(removed);
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
return theExt;
|
|
467
|
-
}
|
|
468
|
-
function _getPluginChain() {
|
|
469
|
-
if (!_pluginChain) {
|
|
470
|
-
// copy the collection of extensions
|
|
471
|
-
var extensions = (_coreExtensions || []).slice();
|
|
472
|
-
// During add / remove this may get called again, so don't readd if already present
|
|
473
|
-
if (extensions.indexOf(_telemetryInitializerPlugin) === -1) {
|
|
474
|
-
extensions.push(_telemetryInitializerPlugin);
|
|
475
|
-
}
|
|
476
|
-
_pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _self.config, _self);
|
|
477
|
-
}
|
|
478
|
-
return _pluginChain;
|
|
479
|
-
}
|
|
480
|
-
function _removePlugins(thePlugins, unloadState, removeComplete) {
|
|
481
|
-
if (thePlugins && thePlugins.length > 0) {
|
|
482
|
-
var unloadChain = createTelemetryProxyChain(thePlugins, _self.config, _self);
|
|
483
|
-
var unloadCtx = createProcessTelemetryUnloadContext(unloadChain, _self.config, _self);
|
|
484
|
-
unloadCtx.onComplete(function () {
|
|
485
|
-
var removed = false;
|
|
486
|
-
// Remove the listed config extensions
|
|
487
|
-
var newConfigExtensions = [];
|
|
488
|
-
arrForEach(_configExtensions, function (plugin, idx) {
|
|
489
|
-
if (!_isPluginPresent(plugin, thePlugins)) {
|
|
490
|
-
newConfigExtensions.push(plugin);
|
|
491
|
-
}
|
|
492
|
-
else {
|
|
493
|
-
removed = true;
|
|
494
|
-
}
|
|
495
|
-
});
|
|
496
|
-
_configExtensions = newConfigExtensions;
|
|
497
|
-
// Re-Create the channel config
|
|
498
|
-
var newChannelConfig = [];
|
|
499
|
-
if (_channelConfig) {
|
|
500
|
-
arrForEach(_channelConfig, function (queue, idx) {
|
|
501
|
-
var newQueue = [];
|
|
502
|
-
arrForEach(queue, function (channel) {
|
|
503
|
-
if (!_isPluginPresent(channel, thePlugins)) {
|
|
504
|
-
newQueue.push(channel);
|
|
505
|
-
}
|
|
506
|
-
else {
|
|
507
|
-
removed = true;
|
|
508
|
-
}
|
|
509
|
-
});
|
|
510
|
-
newChannelConfig.push(newQueue);
|
|
511
|
-
});
|
|
512
|
-
_channelConfig = newChannelConfig;
|
|
513
|
-
}
|
|
514
|
-
removeComplete && removeComplete(removed);
|
|
515
|
-
});
|
|
516
|
-
unloadCtx.processNext(unloadState);
|
|
517
|
-
}
|
|
518
|
-
else {
|
|
519
|
-
removeComplete(false);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
function _flushInternalLogs() {
|
|
523
|
-
var queue = _self.logger ? _self.logger.queue : [];
|
|
524
|
-
if (queue) {
|
|
525
|
-
arrForEach(queue, function (logMessage) {
|
|
526
|
-
var item = {
|
|
527
|
-
name: _internalLogsEventName ? _internalLogsEventName : "InternalMessageId: " + logMessage.messageId,
|
|
528
|
-
iKey: _self.config.instrumentationKey,
|
|
529
|
-
time: toISOString(new Date()),
|
|
530
|
-
baseType: _InternalLogMessage.dataType,
|
|
531
|
-
baseData: { message: logMessage.message }
|
|
532
|
-
};
|
|
533
|
-
_self.track(item);
|
|
534
|
-
});
|
|
535
|
-
queue.length = 0;
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
function _flushChannels(isAsync, callBack, sendReason, cbTimeout) {
|
|
539
|
-
if (_channelControl) {
|
|
540
|
-
return _channelControl.flush(isAsync, callBack, sendReason || 6 /* SdkUnload */, cbTimeout);
|
|
541
|
-
}
|
|
542
|
-
callBack && callBack(false);
|
|
543
|
-
return true;
|
|
544
|
-
}
|
|
545
|
-
function _initDebugListener(config) {
|
|
546
|
-
if (config.disableDbgExt === true && _debugListener) {
|
|
547
|
-
// Remove any previously loaded debug listener
|
|
548
|
-
_notificationManager[strRemoveNotificationListener](_debugListener);
|
|
549
|
-
_debugListener = null;
|
|
550
|
-
}
|
|
551
|
-
if (_notificationManager && !_debugListener && config.disableDbgExt !== true) {
|
|
552
|
-
_debugListener = getDebugListener(config);
|
|
553
|
-
_notificationManager[strAddNotificationListener](_debugListener);
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
function _initPerfManager(config) {
|
|
557
|
-
if (!config.enablePerfMgr && _cfgPerfManager) {
|
|
558
|
-
// Remove any existing config based performance manager
|
|
559
|
-
_cfgPerfManager = null;
|
|
560
|
-
}
|
|
561
|
-
if (config.enablePerfMgr) {
|
|
562
|
-
// Set the performance manager creation function if not defined
|
|
563
|
-
setValue(_self.config, "createPerfMgr", _createPerfManager);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
function _initExtConfig(config) {
|
|
567
|
-
var extConfig = getSetValue(config, strExtensionConfig);
|
|
568
|
-
extConfig.NotificationManager = _notificationManager;
|
|
569
|
-
}
|
|
570
|
-
function _doUpdate(updateState) {
|
|
571
|
-
var updateCtx = createProcessTelemetryUpdateContext(_getPluginChain(), _self.config, _self);
|
|
572
|
-
if (!_self._updateHook || _self._updateHook(updateCtx, updateState) !== true) {
|
|
573
|
-
updateCtx.processNext(updateState);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
function _logOrThrowError(message) {
|
|
577
|
-
var logger = _self.logger;
|
|
578
|
-
if (logger) {
|
|
579
|
-
// there should always be a logger
|
|
580
|
-
_throwInternal(logger, 2 /* WARNING */, 73 /* PluginException */, message);
|
|
581
|
-
}
|
|
582
|
-
else {
|
|
583
|
-
throwError(message);
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
201
|
});
|
|
587
202
|
}
|
|
588
203
|
// Removed Stub for BaseCore.prototype.initialize.
|
|
@@ -590,24 +205,12 @@ var BaseCore = /** @class */ (function () {
|
|
|
590
205
|
// Removed Stub for BaseCore.prototype.track.
|
|
591
206
|
// Removed Stub for BaseCore.prototype.getProcessTelContext.
|
|
592
207
|
// Removed Stub for BaseCore.prototype.getNotifyMgr.
|
|
593
|
-
// Removed Stub for BaseCore.prototype.addNotificationListener.
|
|
594
|
-
// Removed Stub for BaseCore.prototype.removeNotificationListener.
|
|
595
208
|
// Removed Stub for BaseCore.prototype.getCookieMgr.
|
|
596
209
|
// Removed Stub for BaseCore.prototype.setCookieMgr.
|
|
597
210
|
// Removed Stub for BaseCore.prototype.getPerfMgr.
|
|
598
211
|
// Removed Stub for BaseCore.prototype.setPerfMgr.
|
|
599
212
|
// Removed Stub for BaseCore.prototype.eventCnt.
|
|
600
|
-
// Removed Stub for BaseCore.prototype.pollInternalLogs.
|
|
601
|
-
// Removed Stub for BaseCore.prototype.stopPollingInternalLogs.
|
|
602
|
-
// Removed Stub for BaseCore.prototype.addTelemetryInitializer.
|
|
603
|
-
// Removed Stub for BaseCore.prototype.unload.
|
|
604
|
-
// Removed Stub for BaseCore.prototype.getPlugin.
|
|
605
|
-
// Removed Stub for BaseCore.prototype.addPlugin.
|
|
606
|
-
// Removed Stub for BaseCore.prototype.evtNamespace.
|
|
607
|
-
// Removed Stub for BaseCore.prototype.addUnloadCb.
|
|
608
|
-
// Removed Stub for BaseCore.prototype.flush.
|
|
609
213
|
// Removed Stub for BaseCore.prototype.releaseQueue.
|
|
610
|
-
// Removed Stub for BaseCore.prototype._updateHook.
|
|
611
214
|
return BaseCore;
|
|
612
215
|
}());
|
|
613
216
|
export { BaseCore };
|