@microsoft/applicationinsights-core-js 3.0.0-beta.2210-21 → 3.0.0-beta.2211-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/applicationinsights-core-js.integrity.json +9 -9
- package/browser/applicationinsights-core-js.js +113 -27
- 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 +203 -40
- package/dist/applicationinsights-core-js.api.md +10 -5
- package/dist/applicationinsights-core-js.d.ts +36 -4
- package/dist/applicationinsights-core-js.js +113 -27
- 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 +36 -4
- 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 +3 -3
- package/dist-esm/Config/DynamicState.js.map +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 -20
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +3 -3
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- 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 +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 +5 -6
- package/dist-esm/JavaScriptSDK/W3cTraceParent.js.map +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 +8 -7
- 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 +126 -24
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +17 -1
- package/src/JavaScriptSDK.Interfaces/IConfiguration.ts +6 -0
- package/types/JavaScriptSDK/AppInsightsCore.d.ts +17 -2
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +14 -1
- package/types/JavaScriptSDK.Interfaces/IConfiguration.d.ts +5 -0
- package/types/__DynamicConstants.d.ts +3 -2
- package/types/tsdoc-metadata.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Microsoft Application Insights Core Javascript SDK, 3.0.0-beta.
|
|
2
|
+
* Microsoft Application Insights Core Javascript SDK, 3.0.0-beta.2211-03
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* Microsoft Application Insights Team
|
|
@@ -48,6 +48,7 @@ import { isSymbol } from '@nevware21/ts-utils';
|
|
|
48
48
|
import { isTruthy } from '@nevware21/ts-utils';
|
|
49
49
|
import { isTypeof } from '@nevware21/ts-utils';
|
|
50
50
|
import { isUndefined } from '@nevware21/ts-utils';
|
|
51
|
+
import { ITimerHandler } from '@nevware21/ts-utils';
|
|
51
52
|
import { objCreateFn as objCreate } from '@microsoft/applicationinsights-shims';
|
|
52
53
|
import { objDefineAccessors } from '@nevware21/ts-utils';
|
|
53
54
|
import { objForEachKey } from '@nevware21/ts-utils';
|
|
@@ -138,8 +139,22 @@ export declare class AppInsightsCore implements IAppInsightsCore {
|
|
|
138
139
|
static defaultConfig: IConfiguration;
|
|
139
140
|
config: IConfiguration;
|
|
140
141
|
logger: IDiagnosticLogger;
|
|
141
|
-
|
|
142
|
+
/**
|
|
143
|
+
* An array of the installed plugins that provide a version
|
|
144
|
+
*/
|
|
145
|
+
readonly pluginVersionStringArr: string[];
|
|
146
|
+
/**
|
|
147
|
+
* The formatted string of the installed plugins that contain a version number
|
|
148
|
+
*/
|
|
149
|
+
readonly pluginVersionString: string;
|
|
150
|
+
/**
|
|
151
|
+
* Returns a value that indicates whether the instance has already been previously initialized.
|
|
152
|
+
*/
|
|
142
153
|
isInitialized: () => boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Function used to identify the get w parameter used to identify status bit to some channels
|
|
156
|
+
*/
|
|
157
|
+
getWParam: () => number;
|
|
143
158
|
constructor();
|
|
144
159
|
initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
|
|
145
160
|
getTransmissionControls(): IChannelControls[][];
|
|
@@ -173,7 +188,7 @@ export declare class AppInsightsCore implements IAppInsightsCore {
|
|
|
173
188
|
/**
|
|
174
189
|
* Periodically check logger.queue for
|
|
175
190
|
*/
|
|
176
|
-
pollInternalLogs(eventName?: string):
|
|
191
|
+
pollInternalLogs(eventName?: string): ITimerHandler;
|
|
177
192
|
/**
|
|
178
193
|
* Periodically check logger.queue for
|
|
179
194
|
*/
|
|
@@ -832,6 +847,14 @@ export { hasWindow }
|
|
|
832
847
|
export declare interface IAppInsightsCore extends IPerfManagerProvider {
|
|
833
848
|
config: IConfiguration;
|
|
834
849
|
logger: IDiagnosticLogger;
|
|
850
|
+
/**
|
|
851
|
+
* An array of the installed plugins that provide a version
|
|
852
|
+
*/
|
|
853
|
+
readonly pluginVersionStringArr: string[];
|
|
854
|
+
/**
|
|
855
|
+
* The formatted string of the installed plugins that contain a version number
|
|
856
|
+
*/
|
|
857
|
+
readonly pluginVersionString: string;
|
|
835
858
|
/**
|
|
836
859
|
* Returns a value that indicates whether the instance has already been previously initialized.
|
|
837
860
|
*/
|
|
@@ -870,7 +893,7 @@ export declare interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
870
893
|
* @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
|
|
871
894
|
*/
|
|
872
895
|
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler;
|
|
873
|
-
pollInternalLogs?(eventName?: string):
|
|
896
|
+
pollInternalLogs?(eventName?: string): ITimerHandler;
|
|
874
897
|
stopPollingInternalLogs?(): void;
|
|
875
898
|
/**
|
|
876
899
|
* Return a new instance of the IProcessTelemetryContext for processing events
|
|
@@ -949,6 +972,10 @@ export declare interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
949
972
|
* @returns A watcher handler instance that can be used to remove itself when being unloaded
|
|
950
973
|
*/
|
|
951
974
|
onCfgChange<T extends IConfiguration = IConfiguration>(handler: WatcherFunction<T>): IUnloadHook;
|
|
975
|
+
/**
|
|
976
|
+
* Function used to identify the get w parameter used to identify status bit to some channels
|
|
977
|
+
*/
|
|
978
|
+
getWParam: () => number;
|
|
952
979
|
}
|
|
953
980
|
|
|
954
981
|
export declare interface IBaseProcessingContext {
|
|
@@ -1227,6 +1254,11 @@ export declare interface IConfiguration {
|
|
|
1227
1254
|
* this will not send any notifications.
|
|
1228
1255
|
*/
|
|
1229
1256
|
disableDbgExt?: boolean;
|
|
1257
|
+
/**
|
|
1258
|
+
* Add "&w=0" parameter to support UA Parsing when web-workers don't have access to Document.
|
|
1259
|
+
* Default is false
|
|
1260
|
+
*/
|
|
1261
|
+
enableWParam?: boolean;
|
|
1230
1262
|
}
|
|
1231
1263
|
|
|
1232
1264
|
export declare interface ICookieMgr {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Core, 3.0.0-beta.
|
|
2
|
+
* Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-03
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
import { arrForEach, arrIndexOf, dumpObj, newSymbol, scheduleTimeout } from "@nevware21/ts-utils";
|
|
8
8
|
import { throwAggregationError } from "../JavaScriptSDK/AggregationError";
|
|
9
|
-
import { _DYN_LENGTH, _DYN_LOGGER, _DYN_PUSH, _DYN_SET_DF, _DYN_THROW_INTERNAL } from "../__DynamicConstants";
|
|
9
|
+
import { _DYN_CANCEL, _DYN_LENGTH, _DYN_LOGGER, _DYN_PUSH, _DYN_SET_DF, _DYN_THROW_INTERNAL } from "../__DynamicConstants";
|
|
10
10
|
var symPrefix = "[[ai_";
|
|
11
11
|
var symPostfix = "]]";
|
|
12
12
|
export function _createState(cfgHandler) {
|
|
@@ -51,7 +51,7 @@ export function _createState(cfgHandler) {
|
|
|
51
51
|
var notifyHandlers = _waitingHandlers;
|
|
52
52
|
_waitingHandlers = null;
|
|
53
53
|
// Stop any timer as we are running them now anyway
|
|
54
|
-
_watcherTimer && _watcherTimer
|
|
54
|
+
_watcherTimer && _watcherTimer[_DYN_CANCEL /* @min:%2ecancel */]();
|
|
55
55
|
_watcherTimer = null;
|
|
56
56
|
var watcherFailures_1 = [];
|
|
57
57
|
// Now run the handlers
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicState.js.map","sources":["DynamicState.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { arrForEach, arrIndexOf, dumpObj, newSymbol, scheduleTimeout } from \"@nevware21/ts-utils\";\r\nimport { throwAggregationError } from \"../JavaScriptSDK/AggregationError\";\r\nimport { _DYN_LENGTH, _DYN_LOGGER, _DYN_PUSH, _DYN_SET_DF, _DYN_THROW_INTERNAL } from \"../__DynamicConstants\";\r\nvar symPrefix = \"[[ai_\";\r\nvar symPostfix = \"]]\";\r\nexport function _createState(cfgHandler) {\r\n var dynamicPropertySymbol = newSymbol(symPrefix + \"get\" + cfgHandler.uid + symPostfix);\r\n var dynamicPropertyReadOnly = newSymbol(symPrefix + \"ro\" + cfgHandler.uid + symPostfix);\r\n var dynamicPropertyDetail = newSymbol(symPrefix + \"dtl\" + cfgHandler.uid + symPostfix);\r\n var _waitingHandlers = null;\r\n var _watcherTimer = null;\r\n var theState;\r\n function _useHandler(activeHandler, callback) {\r\n var prevWatcher = theState.act;\r\n try {\r\n theState.act = activeHandler;\r\n if (activeHandler && activeHandler[dynamicPropertyDetail]) {\r\n // Clear out the previously tracked details for this handler, so that access are re-evaluated\r\n arrForEach(activeHandler[dynamicPropertyDetail], function (detail) {\r\n detail.clr(activeHandler);\r\n });\r\n activeHandler[dynamicPropertyDetail] = [];\r\n }\r\n callback({\r\n cfg: cfgHandler.cfg,\r\n set: cfgHandler.set.bind(cfgHandler),\r\n setDf: cfgHandler[_DYN_SET_DF /* @min:%2esetDf */].bind(cfgHandler)\r\n });\r\n }\r\n catch (e) {\r\n var logger = cfgHandler[_DYN_LOGGER /* @min:%2elogger */];\r\n if (logger) {\r\n // Don't let one individual failure break everyone\r\n logger[_DYN_THROW_INTERNAL /* @min:%2ethrowInternal */](1 /* eLoggingSeverity.CRITICAL */, 107 /* _eInternalMessageId.ConfigWatcherException */, dumpObj(e));\r\n }\r\n // Re-throw the exception so that any true \"error\" is reported back to the called\r\n throw e;\r\n }\r\n finally {\r\n theState.act = prevWatcher || null;\r\n }\r\n }\r\n function _notifyWatchers() {\r\n if (_waitingHandlers) {\r\n var notifyHandlers = _waitingHandlers;\r\n _waitingHandlers = null;\r\n // Stop any timer as we are running them now anyway\r\n _watcherTimer && _watcherTimer
|
|
1
|
+
{"version":3,"file":"DynamicState.js.map","sources":["DynamicState.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { arrForEach, arrIndexOf, dumpObj, newSymbol, scheduleTimeout } from \"@nevware21/ts-utils\";\r\nimport { throwAggregationError } from \"../JavaScriptSDK/AggregationError\";\r\nimport { _DYN_CANCEL, _DYN_LENGTH, _DYN_LOGGER, _DYN_PUSH, _DYN_SET_DF, _DYN_THROW_INTERNAL } from \"../__DynamicConstants\";\r\nvar symPrefix = \"[[ai_\";\r\nvar symPostfix = \"]]\";\r\nexport function _createState(cfgHandler) {\r\n var dynamicPropertySymbol = newSymbol(symPrefix + \"get\" + cfgHandler.uid + symPostfix);\r\n var dynamicPropertyReadOnly = newSymbol(symPrefix + \"ro\" + cfgHandler.uid + symPostfix);\r\n var dynamicPropertyDetail = newSymbol(symPrefix + \"dtl\" + cfgHandler.uid + symPostfix);\r\n var _waitingHandlers = null;\r\n var _watcherTimer = null;\r\n var theState;\r\n function _useHandler(activeHandler, callback) {\r\n var prevWatcher = theState.act;\r\n try {\r\n theState.act = activeHandler;\r\n if (activeHandler && activeHandler[dynamicPropertyDetail]) {\r\n // Clear out the previously tracked details for this handler, so that access are re-evaluated\r\n arrForEach(activeHandler[dynamicPropertyDetail], function (detail) {\r\n detail.clr(activeHandler);\r\n });\r\n activeHandler[dynamicPropertyDetail] = [];\r\n }\r\n callback({\r\n cfg: cfgHandler.cfg,\r\n set: cfgHandler.set.bind(cfgHandler),\r\n setDf: cfgHandler[_DYN_SET_DF /* @min:%2esetDf */].bind(cfgHandler)\r\n });\r\n }\r\n catch (e) {\r\n var logger = cfgHandler[_DYN_LOGGER /* @min:%2elogger */];\r\n if (logger) {\r\n // Don't let one individual failure break everyone\r\n logger[_DYN_THROW_INTERNAL /* @min:%2ethrowInternal */](1 /* eLoggingSeverity.CRITICAL */, 107 /* _eInternalMessageId.ConfigWatcherException */, dumpObj(e));\r\n }\r\n // Re-throw the exception so that any true \"error\" is reported back to the called\r\n throw e;\r\n }\r\n finally {\r\n theState.act = prevWatcher || null;\r\n }\r\n }\r\n function _notifyWatchers() {\r\n if (_waitingHandlers) {\r\n var notifyHandlers = _waitingHandlers;\r\n _waitingHandlers = null;\r\n // Stop any timer as we are running them now anyway\r\n _watcherTimer && _watcherTimer[_DYN_CANCEL /* @min:%2ecancel */]();\r\n _watcherTimer = null;\r\n var watcherFailures_1 = [];\r\n // Now run the handlers\r\n arrForEach(notifyHandlers, function (handler) {\r\n if (handler) {\r\n if (handler[dynamicPropertyDetail]) {\r\n arrForEach(handler[dynamicPropertyDetail], function (detail) {\r\n // Clear out this handler from previously tracked details, so that access are re-evaluated\r\n detail.clr(handler);\r\n });\r\n handler[dynamicPropertyDetail] = null;\r\n }\r\n // The handler may have self removed as part of another handler so re-check\r\n if (handler.fn) {\r\n try {\r\n _useHandler(handler, handler.fn);\r\n }\r\n catch (e) {\r\n // Don't let a single failing watcher cause other watches to fail\r\n watcherFailures_1[_DYN_PUSH /* @min:%2epush */](e);\r\n }\r\n }\r\n }\r\n });\r\n // During notification we may have had additional updates -- so notify those updates as well\r\n if (_waitingHandlers) {\r\n try {\r\n _notifyWatchers();\r\n }\r\n catch (e) {\r\n watcherFailures_1[_DYN_PUSH /* @min:%2epush */](e);\r\n }\r\n }\r\n if (watcherFailures_1[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n throwAggregationError(\"Watcher error(s): \", watcherFailures_1);\r\n }\r\n }\r\n }\r\n function _addWatcher(detail) {\r\n if (detail && detail.h[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n if (!_waitingHandlers) {\r\n _waitingHandlers = [];\r\n }\r\n if (!_watcherTimer) {\r\n _watcherTimer = scheduleTimeout(function () {\r\n _watcherTimer = null;\r\n _notifyWatchers();\r\n }, 0);\r\n }\r\n // Add all of the handlers for this detail (if not already present) - using normal for-loop for performance\r\n for (var idx = 0; idx < detail.h[_DYN_LENGTH /* @min:%2elength */]; idx++) {\r\n var handler = detail.h[idx];\r\n // Add this handler to the collection of handlers to re-execute\r\n if (handler && arrIndexOf(_waitingHandlers, handler) === -1) {\r\n _waitingHandlers[_DYN_PUSH /* @min:%2epush */](handler);\r\n }\r\n }\r\n }\r\n }\r\n function _trackHandler(handler, detail) {\r\n if (handler) {\r\n var details = handler[dynamicPropertyDetail] = handler[dynamicPropertyDetail] || [];\r\n if (arrIndexOf(details, detail) === -1) {\r\n // If this detail is not already listed as tracked then add it so that we re-evaluate it's usage\r\n details[_DYN_PUSH /* @min:%2epush */](detail);\r\n }\r\n }\r\n }\r\n theState = {\r\n prop: dynamicPropertySymbol,\r\n ro: dynamicPropertyReadOnly,\r\n hdlr: cfgHandler,\r\n add: _addWatcher,\r\n notify: _notifyWatchers,\r\n use: _useHandler,\r\n trk: _trackHandler\r\n };\r\n return theState;\r\n}\r\n//# sourceMappingURL=DynamicState.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Core, 3.0.0-beta.
|
|
2
|
+
* Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-03
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -8,16 +8,16 @@
|
|
|
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, isFunction, isNullOrUndefined, isPlainObject, objDeepFreeze, objDefineProp, objForEachKey, objFreeze, objHasOwn, throwError } from "@nevware21/ts-utils";
|
|
11
|
+
import { arrAppend, arrForEach, arrIndexOf, deepExtend, dumpObj, hasDocument, isFunction, isNullOrUndefined, isPlainObject, objDeepFreeze, objDefineProp, objForEachKey, objFreeze, objHasOwn, scheduleInterval, throwError } from "@nevware21/ts-utils";
|
|
12
12
|
import { createDynamicConfig, onConfigChange } from "../Config/DynamicConfig";
|
|
13
|
-
import { _DYN_ADD_NOTIFICATION_LIS1, _DYN_CALL, _DYN_CONFIGURABLE, _DYN_ENUMERABLE, _DYN_FLUSH, _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_PROCESS_NEXT, _DYN_PUSH, _DYN_REMOVE_NOTIFICATION_2, _DYN_SET_DF, _DYN_SPLICE, _DYN_STOP_POLLING_INTERNA3, _DYN_TEARDOWN, _DYN_TIME,
|
|
13
|
+
import { _DYN_ADD_NOTIFICATION_LIS1, _DYN_CALL, _DYN_CANCEL, _DYN_CONFIGURABLE, _DYN_ENUMERABLE, _DYN_FLUSH, _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
14
|
import { ChannelControllerPriority, createChannelControllerPlugin, createChannelQueues } from "./ChannelController";
|
|
15
15
|
import { createCookieMgr } from "./CookieMgr";
|
|
16
16
|
import { createUniqueNamespace } from "./DataCacheHelper";
|
|
17
17
|
import { getDebugListener } from "./DbgExtensionUtils";
|
|
18
18
|
import { DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole } from "./DiagnosticLogger";
|
|
19
19
|
import { getSetValue, proxyFunctionAs, proxyFunctions, toISOString } from "./HelperFuncs";
|
|
20
|
-
import { STR_CHANNELS, STR_CORE, STR_CREATE_PERF_MGR, STR_DISABLED, STR_EVENTS_DISCARDED, STR_EXTENSIONS, STR_EXTENSION_CONFIG, STR_GET_PERF_MGR, STR_PRIORITY, UNDEFINED_VALUE } from "./InternalConstants";
|
|
20
|
+
import { STR_CHANNELS, STR_CORE, STR_CREATE_PERF_MGR, STR_DISABLED, STR_EMPTY, STR_EVENTS_DISCARDED, STR_EXTENSIONS, STR_EXTENSION_CONFIG, STR_GET_PERF_MGR, STR_PRIORITY, UNDEFINED_VALUE } from "./InternalConstants";
|
|
21
21
|
import { NotificationManager } from "./NotificationManager";
|
|
22
22
|
import { PerfManager, doPerf, getGblPerfMgr } from "./PerfManager";
|
|
23
23
|
import { createProcessTelemetryContext, createProcessTelemetryUnloadContext, createProcessTelemetryUpdateContext, createTelemetryProxyChain } from "./ProcessTelemetryContext";
|
|
@@ -183,13 +183,21 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
183
183
|
var _traceCtx;
|
|
184
184
|
var _instrumentationKey;
|
|
185
185
|
var _cfgListeners;
|
|
186
|
+
var _extensions;
|
|
187
|
+
var _pluginVersionStringArr;
|
|
188
|
+
var _pluginVersionString;
|
|
186
189
|
/**
|
|
187
190
|
* Internal log poller
|
|
188
191
|
*/
|
|
189
|
-
var _internalLogPoller
|
|
192
|
+
var _internalLogPoller;
|
|
193
|
+
var _internalLogPollerListening;
|
|
190
194
|
dynamicProto(AppInsightsCore, this, function (_self) {
|
|
191
195
|
// Set the default values (also called during teardown)
|
|
192
196
|
_initDefaults();
|
|
197
|
+
// Special internal method to allow the unit tests and DebugPlugin to hook embedded objects
|
|
198
|
+
_self["_getDbgPlgTargets"] = function () {
|
|
199
|
+
return [_extensions];
|
|
200
|
+
};
|
|
193
201
|
_self[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = function () { return _isInitialized; };
|
|
194
202
|
// Creating the self.initialize = ()
|
|
195
203
|
_self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, extensions, logger, notificationManager) {
|
|
@@ -228,6 +236,7 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
228
236
|
_cfgListeners = null;
|
|
229
237
|
_isInitialized = true;
|
|
230
238
|
_self.releaseQueue();
|
|
239
|
+
_self[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */]();
|
|
231
240
|
};
|
|
232
241
|
_self.getTransmissionControls = function () {
|
|
233
242
|
var controls = [];
|
|
@@ -337,20 +346,29 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
337
346
|
/**
|
|
338
347
|
* Periodically check logger.queue for log messages to be flushed
|
|
339
348
|
*/
|
|
340
|
-
_self
|
|
349
|
+
_self[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */] = function (eventName) {
|
|
341
350
|
_internalLogsEventName = eventName || null;
|
|
342
|
-
|
|
343
|
-
var interval =
|
|
351
|
+
function _startLogPoller(config) {
|
|
352
|
+
var interval = config.diagnosticLogInterval;
|
|
344
353
|
if (!interval || !(interval > 0)) {
|
|
345
354
|
interval = 10000;
|
|
346
355
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
_internalLogPoller = setInterval(function () {
|
|
356
|
+
_internalLogPoller && _internalLogPoller[_DYN_CANCEL /* @min:%2ecancel */]();
|
|
357
|
+
_internalLogPoller = scheduleInterval(function () {
|
|
351
358
|
_flushInternalLogs();
|
|
352
359
|
}, interval);
|
|
353
|
-
}
|
|
360
|
+
}
|
|
361
|
+
if (!_internalLogPollerListening) {
|
|
362
|
+
_internalLogPollerListening = true;
|
|
363
|
+
// listen to the configuration
|
|
364
|
+
_addUnloadHook(_configHandler[_DYN_WATCH /* @min:%2ewatch */](function (details) {
|
|
365
|
+
_startLogPoller(details.cfg);
|
|
366
|
+
}));
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
// We are being called again, so make sure the poller is running
|
|
370
|
+
_startLogPoller(_configHandler.cfg);
|
|
371
|
+
}
|
|
354
372
|
return _internalLogPoller;
|
|
355
373
|
};
|
|
356
374
|
/**
|
|
@@ -358,8 +376,8 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
358
376
|
*/
|
|
359
377
|
_self[_DYN_STOP_POLLING_INTERNA3 /* @min:%2estopPollingInternalLogs */] = function () {
|
|
360
378
|
if (_internalLogPoller) {
|
|
361
|
-
|
|
362
|
-
_internalLogPoller =
|
|
379
|
+
_internalLogPoller[_DYN_CANCEL /* @min:%2ecancel */]();
|
|
380
|
+
_internalLogPoller = null;
|
|
363
381
|
_flushInternalLogs();
|
|
364
382
|
}
|
|
365
383
|
};
|
|
@@ -532,8 +550,34 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
532
550
|
}
|
|
533
551
|
};
|
|
534
552
|
};
|
|
553
|
+
_self.getWParam = function () {
|
|
554
|
+
return (hasDocument() || !!_configHandler.cfg.enableWParam) ? 0 : -1;
|
|
555
|
+
};
|
|
556
|
+
function _setPluginVersions() {
|
|
557
|
+
_pluginVersionStringArr = [];
|
|
558
|
+
if (_channelConfig) {
|
|
559
|
+
arrForEach(_channelConfig, function (channels) {
|
|
560
|
+
if (channels) {
|
|
561
|
+
arrForEach(channels, function (channel) {
|
|
562
|
+
if (channel[_DYN_IDENTIFIER /* @min:%2eidentifier */] && channel[_DYN_VERSION /* @min:%2eversion */]) {
|
|
563
|
+
var ver = channel[_DYN_IDENTIFIER /* @min:%2eidentifier */] + "=" + channel[_DYN_VERSION /* @min:%2eversion */];
|
|
564
|
+
_pluginVersionStringArr[_DYN_PUSH /* @min:%2epush */](ver);
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
if (_configExtensions) {
|
|
571
|
+
arrForEach(_configExtensions, function (ext) {
|
|
572
|
+
if (ext && ext[_DYN_IDENTIFIER /* @min:%2eidentifier */] && ext[_DYN_VERSION /* @min:%2eversion */]) {
|
|
573
|
+
var ver = ext[_DYN_IDENTIFIER /* @min:%2eidentifier */] + "=" + ext[_DYN_VERSION /* @min:%2eversion */];
|
|
574
|
+
_pluginVersionStringArr[_DYN_PUSH /* @min:%2epush */](ver);
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
}
|
|
535
579
|
function _initDefaults() {
|
|
536
|
-
var _a;
|
|
580
|
+
var _a, _b, _c;
|
|
537
581
|
_isInitialized = false;
|
|
538
582
|
// Use a default logger so initialization errors are not dropped on the floor with full logging
|
|
539
583
|
_configHandler = createDynamicConfig({}, defaultConfig, _self[_DYN_LOGGER /* @min:%2elogger */]);
|
|
@@ -548,8 +592,31 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
548
592
|
_self.updateCfg(newValue, false);
|
|
549
593
|
},
|
|
550
594
|
_a));
|
|
595
|
+
objDefineProp(_self, "pluginVersionStringArr", (_b = {},
|
|
596
|
+
_b[_DYN_CONFIGURABLE /* @min:configurable */] = true,
|
|
597
|
+
_b[_DYN_ENUMERABLE /* @min:enumerable */] = true,
|
|
598
|
+
_b.get = function () {
|
|
599
|
+
if (!_pluginVersionStringArr) {
|
|
600
|
+
_setPluginVersions();
|
|
601
|
+
}
|
|
602
|
+
return _pluginVersionStringArr;
|
|
603
|
+
},
|
|
604
|
+
_b));
|
|
605
|
+
objDefineProp(_self, "pluginVersionString", (_c = {},
|
|
606
|
+
_c[_DYN_CONFIGURABLE /* @min:configurable */] = true,
|
|
607
|
+
_c[_DYN_ENUMERABLE /* @min:enumerable */] = true,
|
|
608
|
+
_c.get = function () {
|
|
609
|
+
if (!_pluginVersionString) {
|
|
610
|
+
if (!_pluginVersionStringArr) {
|
|
611
|
+
_setPluginVersions();
|
|
612
|
+
}
|
|
613
|
+
_pluginVersionString = _pluginVersionStringArr.join(";");
|
|
614
|
+
}
|
|
615
|
+
return _pluginVersionString || STR_EMPTY;
|
|
616
|
+
},
|
|
617
|
+
_c));
|
|
551
618
|
_self[_DYN_LOGGER /* @min:%2elogger */] = new DiagnosticLogger(_configHandler.cfg);
|
|
552
|
-
|
|
619
|
+
_extensions = [];
|
|
553
620
|
_telemetryInitializerPlugin = new TelemetryInitializerPlugin();
|
|
554
621
|
_eventQueue = [];
|
|
555
622
|
_notificationManager = null;
|
|
@@ -570,6 +637,8 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
570
637
|
_instrumentationKey = null;
|
|
571
638
|
_hooks = [];
|
|
572
639
|
_cfgListeners = [];
|
|
640
|
+
_pluginVersionString = null;
|
|
641
|
+
_pluginVersionStringArr = null;
|
|
573
642
|
}
|
|
574
643
|
function _createTelCtx() {
|
|
575
644
|
return createProcessTelemetryContext(_getPluginChain(), _configHandler.cfg, _self);
|
|
@@ -580,6 +649,8 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
580
649
|
var theExtensions = _validateExtensions(_self[_DYN_LOGGER /* @min:%2elogger */], ChannelControllerPriority, _configExtensions);
|
|
581
650
|
_coreExtensions = theExtensions[STR_CORE /* @min:%2ecore */];
|
|
582
651
|
_pluginChain = null;
|
|
652
|
+
_pluginVersionString = null;
|
|
653
|
+
_pluginVersionStringArr = null;
|
|
583
654
|
// Sort the complete set of extensions by priority
|
|
584
655
|
var allExtensions = theExtensions.all;
|
|
585
656
|
// Initialize the Channel Queues and the channel plugins first
|
|
@@ -606,12 +677,12 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
606
677
|
allExtensions[_DYN_PUSH /* @min:%2epush */](_channelControl);
|
|
607
678
|
_coreExtensions[_DYN_PUSH /* @min:%2epush */](_channelControl);
|
|
608
679
|
// Required to allow plugins to call core.getPlugin() during their own initialization
|
|
609
|
-
|
|
680
|
+
_extensions = sortPlugins(allExtensions);
|
|
610
681
|
// Initialize the controls
|
|
611
682
|
_channelControl[_DYN_INITIALIZE /* @min:%2einitialize */](_configHandler.cfg, _self, allExtensions);
|
|
612
683
|
initializePlugins(_createTelCtx(), allExtensions);
|
|
613
684
|
// Now reset the extensions to just those being managed by AppInsightsCore
|
|
614
|
-
|
|
685
|
+
_extensions = objFreeze(sortPlugins(_coreExtensions || [])).slice();
|
|
615
686
|
if (updateState) {
|
|
616
687
|
_doUpdate(updateState);
|
|
617
688
|
}
|
|
@@ -619,7 +690,7 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
619
690
|
function _getPlugin(pluginIdentifier) {
|
|
620
691
|
var theExt = null;
|
|
621
692
|
var thePlugin = null;
|
|
622
|
-
arrForEach(
|
|
693
|
+
arrForEach(_extensions, function (ext) {
|
|
623
694
|
if (ext[_DYN_IDENTIFIER /* @min:%2eidentifier */] === pluginIdentifier && ext !== _channelControl && ext !== _telemetryInitializerPlugin) {
|
|
624
695
|
thePlugin = ext;
|
|
625
696
|
return -1;
|
|
@@ -692,6 +763,8 @@ var AppInsightsCore = /** @class */ (function () {
|
|
|
692
763
|
}
|
|
693
764
|
});
|
|
694
765
|
_configExtensions = newConfigExtensions;
|
|
766
|
+
_pluginVersionString = null;
|
|
767
|
+
_pluginVersionStringArr = null;
|
|
695
768
|
// Re-Create the channel config
|
|
696
769
|
var newChannelConfig = [];
|
|
697
770
|
if (_channelConfig) {
|