@microsoft/applicationinsights-core-js 3.0.0-beta.2301-14 → 3.0.0-beta.2301-17
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 +109 -68
- 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 +358 -27
- package/dist/applicationinsights-core-js.api.md +18 -5
- package/dist/applicationinsights-core-js.d.ts +53 -6
- package/dist/applicationinsights-core-js.js +109 -68
- 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 +53 -6
- package/dist-esm/Config/ConfigDefaults.js +1 -1
- package/dist-esm/Config/DynamicConfig.js +11 -1
- package/dist-esm/Config/DynamicConfig.js.map +1 -1
- package/dist-esm/Config/DynamicProperty.js +48 -21
- package/dist-esm/Config/DynamicProperty.js.map +1 -1
- package/dist-esm/Config/DynamicState.js +18 -12
- 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 +15 -20
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +10 -24
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +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 +3 -3
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +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 +11 -9
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +3 -3
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +1 -1
- package/dist-esm/JavaScriptSDK/UnloadHookContainer.js +40 -0
- package/dist-esm/JavaScriptSDK/UnloadHookContainer.js.map +1 -0
- 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 +1 -2
- package/dist-esm/__DynamicConstants.js.map +1 -1
- package/dist-esm/applicationinsights-core-js.js +2 -1
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +1 -1
- package/src/JavaScriptSDK/AppInsightsCore.ts +16 -20
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +16 -26
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +10 -7
- package/src/JavaScriptSDK/UnloadHandlerContainer.ts +1 -1
- package/src/JavaScriptSDK/UnloadHookContainer.ts +52 -0
- package/types/Config/DynamicProperty.d.ts +1 -1
- package/types/Config/IDynamicConfigHandler.d.ts +14 -0
- package/types/Config/IDynamicWatcher.d.ts +14 -0
- package/types/Config/_IDynamicConfigHandlerState.d.ts +1 -0
- package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +8 -1
- package/types/JavaScriptSDK/UnloadHandlerContainer.d.ts +1 -4
- package/types/JavaScriptSDK/UnloadHookContainer.d.ts +16 -0
- package/types/__DynamicConstants.d.ts +0 -1
- package/types/applicationinsights-core-js.d.ts +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Core, 3.0.0-beta.2301-
|
|
2
|
+
* Application Insights JavaScript SDK - Core, 3.0.0-beta.2301-17
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -37,7 +37,6 @@ export var _DYN_ADD_NOTIFICATION_LIS1 = "addNotificationListener"; // Count: 4
|
|
|
37
37
|
export var _DYN_REMOVE_NOTIFICATION_2 = "removeNotificationListener"; // Count: 4
|
|
38
38
|
export var _DYN_STOP_POLLING_INTERNA3 = "stopPollingInternalLogs"; // Count: 2
|
|
39
39
|
export var _DYN_ON_COMPLETE = "onComplete"; // Count: 3
|
|
40
|
-
export var _DYN_CALL = "call"; // Count: 5
|
|
41
40
|
export var _DYN_VERSION = "version"; // Count: 8
|
|
42
41
|
export var _DYN_LOGGING_LEVEL_CONSOL4 = "loggingLevelConsole"; // Count: 2
|
|
43
42
|
export var _DYN_CREATE_NEW = "createNew"; // Count: 7
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"__DynamicConstants.js.map","sources":["__DynamicConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n// ###########################################################################################################################################\r\n// Note: DON'T Export these const from the package as we are still targeting IE this will export a mutable variables that someone could change\r\n// ###########################################################################################################################################\r\nexport var _DYN_LENGTH = \"length\"; // Count: 36\r\nexport var _DYN_NOTIFY = \"notify\"; // Count: 4\r\nexport var _DYN_THROW_INTERNAL = \"throwInternal\"; // Count: 4\r\nexport var _DYN_SET_DF = \"setDf\"; // Count: 7\r\nexport var _DYN_WATCH = \"watch\"; // Count: 12\r\nexport var _DYN_LOGGER = \"logger\"; // Count: 21\r\nexport var _DYN_CONFIGURABLE = \"configurable\"; // Count: 6\r\nexport var _DYN_ENUMERABLE = \"enumerable\"; // Count: 6\r\nexport var _DYN_APPLY = \"apply\"; // Count: 7\r\nexport var _DYN_PUSH = \"push\"; // Count: 31\r\nexport var _DYN_SPLICE = \"splice\"; // Count: 6\r\nexport var _DYN_CANCEL = \"cancel\"; // Count: 4\r\nexport var _DYN_INITIALIZE = \"initialize\"; // Count: 4\r\nexport var _DYN_IDENTIFIER = \"identifier\"; // Count: 10\r\nexport var _DYN_IS_INITIALIZED = \"isInitialized\"; // Count: 10\r\nexport var _DYN_GET_PLUGIN = \"getPlugin\"; // Count: 6\r\nexport var _DYN_POLL_INTERNAL_LOGS = \"pollInternalLogs\"; // Count: 2\r\nexport var _DYN_NAME = \"name\"; // Count: 11\r\nexport var _DYN_TIME = \"time\"; // Count: 5\r\nexport var _DYN_PROCESS_NEXT = \"processNext\"; // Count: 15\r\nexport var _DYN_GET_PROCESS_TEL_CONT0 = \"getProcessTelContext\"; // Count: 2\r\nexport var _DYN_GET_NOTIFY_MGR = \"getNotifyMgr\"; // Count: 5\r\nexport var _DYN_ADD_NOTIFICATION_LIS1 = \"addNotificationListener\"; // Count: 4\r\nexport var _DYN_REMOVE_NOTIFICATION_2 = \"removeNotificationListener\"; // Count: 4\r\nexport var _DYN_STOP_POLLING_INTERNA3 = \"stopPollingInternalLogs\"; // Count: 2\r\nexport var _DYN_ON_COMPLETE = \"onComplete\"; // Count: 3\r\nexport var
|
|
1
|
+
{"version":3,"file":"__DynamicConstants.js.map","sources":["__DynamicConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n// ###########################################################################################################################################\r\n// Note: DON'T Export these const from the package as we are still targeting IE this will export a mutable variables that someone could change\r\n// ###########################################################################################################################################\r\nexport var _DYN_LENGTH = \"length\"; // Count: 36\r\nexport var _DYN_NOTIFY = \"notify\"; // Count: 4\r\nexport var _DYN_THROW_INTERNAL = \"throwInternal\"; // Count: 4\r\nexport var _DYN_SET_DF = \"setDf\"; // Count: 7\r\nexport var _DYN_WATCH = \"watch\"; // Count: 12\r\nexport var _DYN_LOGGER = \"logger\"; // Count: 21\r\nexport var _DYN_CONFIGURABLE = \"configurable\"; // Count: 6\r\nexport var _DYN_ENUMERABLE = \"enumerable\"; // Count: 6\r\nexport var _DYN_APPLY = \"apply\"; // Count: 7\r\nexport var _DYN_PUSH = \"push\"; // Count: 31\r\nexport var _DYN_SPLICE = \"splice\"; // Count: 6\r\nexport var _DYN_CANCEL = \"cancel\"; // Count: 4\r\nexport var _DYN_INITIALIZE = \"initialize\"; // Count: 4\r\nexport var _DYN_IDENTIFIER = \"identifier\"; // Count: 10\r\nexport var _DYN_IS_INITIALIZED = \"isInitialized\"; // Count: 10\r\nexport var _DYN_GET_PLUGIN = \"getPlugin\"; // Count: 6\r\nexport var _DYN_POLL_INTERNAL_LOGS = \"pollInternalLogs\"; // Count: 2\r\nexport var _DYN_NAME = \"name\"; // Count: 11\r\nexport var _DYN_TIME = \"time\"; // Count: 5\r\nexport var _DYN_PROCESS_NEXT = \"processNext\"; // Count: 15\r\nexport var _DYN_GET_PROCESS_TEL_CONT0 = \"getProcessTelContext\"; // Count: 2\r\nexport var _DYN_GET_NOTIFY_MGR = \"getNotifyMgr\"; // Count: 5\r\nexport var _DYN_ADD_NOTIFICATION_LIS1 = \"addNotificationListener\"; // Count: 4\r\nexport var _DYN_REMOVE_NOTIFICATION_2 = \"removeNotificationListener\"; // Count: 4\r\nexport var _DYN_STOP_POLLING_INTERNA3 = \"stopPollingInternalLogs\"; // Count: 2\r\nexport var _DYN_ON_COMPLETE = \"onComplete\"; // Count: 3\r\nexport var _DYN_VERSION = \"version\"; // Count: 8\r\nexport var _DYN_LOGGING_LEVEL_CONSOL4 = \"loggingLevelConsole\"; // Count: 2\r\nexport var _DYN_CREATE_NEW = \"createNew\"; // Count: 7\r\nexport var _DYN_TEARDOWN = \"teardown\"; // Count: 9\r\nexport var _DYN_MESSAGE_ID = \"messageId\"; // Count: 4\r\nexport var _DYN_MESSAGE = \"message\"; // Count: 6\r\nexport var _DYN_IS_ASYNC = \"isAsync\"; // Count: 6\r\nexport var _DYN_DIAG_LOG = \"diagLog\"; // Count: 9\r\nexport var _DYN__DO_TEARDOWN = \"_doTeardown\"; // Count: 4\r\nexport var _DYN_UPDATE = \"update\"; // Count: 6\r\nexport var _DYN_GET_NEXT = \"getNext\"; // Count: 12\r\nexport var _DYN_SET_NEXT_PLUGIN = \"setNextPlugin\"; // Count: 5\r\nexport var _DYN_USER_AGENT = \"userAgent\"; // Count: 5\r\nexport var _DYN_SPLIT = \"split\"; // Count: 5\r\nexport var _DYN_NODE_TYPE = \"nodeType\"; // Count: 3\r\nexport var _DYN_REPLACE = \"replace\"; // Count: 8\r\nexport var _DYN_ENABLE_DEBUG_EXCEPTI5 = \"enableDebugExceptions\"; // Count: 3\r\nexport var _DYN_LOG_INTERNAL_MESSAGE = \"logInternalMessage\"; // Count: 2\r\nexport var _DYN_TO_LOWER_CASE = \"toLowerCase\"; // Count: 8\r\nexport var _DYN_TYPE = \"type\"; // Count: 14\r\nexport var _DYN_HANDLER = \"handler\"; // Count: 5\r\nexport var _DYN_LISTENERS = \"listeners\"; // Count: 6\r\nexport var _DYN_IS_CHILD_EVT = \"isChildEvt\"; // Count: 3\r\nexport var _DYN_GET_CTX = \"getCtx\"; // Count: 6\r\nexport var _DYN_SET_CTX = \"setCtx\"; // Count: 10\r\nexport var _DYN_COMPLETE = \"complete\"; // Count: 3\r\nexport var _DYN_TRACE_ID = \"traceId\"; // Count: 5\r\nexport var _DYN_SPAN_ID = \"spanId\"; // Count: 5\r\nexport var _DYN_TRACE_FLAGS = \"traceFlags\"; // Count: 6\r\n//# sourceMappingURL=__DynamicConstants.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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Core, 3.0.0-beta.2301-
|
|
2
|
+
* Application Insights JavaScript SDK - Core, 3.0.0-beta.2301-17
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
export { MinChannelPriorty } from "./JavaScriptSDK.Interfaces/IChannelControls";
|
|
@@ -28,6 +28,7 @@ export { createCookieMgr, safeGetCookieMgr, uaDisallowsSameSiteNone, areCookiesS
|
|
|
28
28
|
export { getDebugListener, getDebugExt } from "./JavaScriptSDK/DbgExtensionUtils";
|
|
29
29
|
export { createUniqueNamespace } from "./JavaScriptSDK/DataCacheHelper";
|
|
30
30
|
export { createUnloadHandlerContainer } from "./JavaScriptSDK/UnloadHandlerContainer";
|
|
31
|
+
export { createUnloadHookContainer } from "./JavaScriptSDK/UnloadHookContainer";
|
|
31
32
|
export { createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent } from "./JavaScriptSDK/W3cTraceParent";
|
|
32
33
|
export { createDynamicConfig, onConfigChange } from "./Config/DynamicConfig";
|
|
33
34
|
export { getDynamicConfigHandler } from "./Config/DynamicSupport";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicationinsights-core-js.js.map","sources":["applicationinsights-core-js.js"],"sourcesContent":["export { MinChannelPriorty } from \"./JavaScriptSDK.Interfaces/IChannelControls\";\r\nexport { EventsDiscardedReason } from \"./JavaScriptSDK.Enums/EventsDiscardedReason\";\r\nexport { throwAggregationError } from \"./JavaScriptSDK/AggregationError\";\r\nexport { AppInsightsCore } from \"./JavaScriptSDK/AppInsightsCore\";\r\nexport { BaseTelemetryPlugin } from \"./JavaScriptSDK/BaseTelemetryPlugin\";\r\nexport { randomValue, random32, mwcRandomSeed, mwcRandom32, newId } from \"./JavaScriptSDK/RandomHelper\";\r\nexport { Undefined, newGuid, generateW3CId } from \"./JavaScriptSDK/CoreUtils\";\r\nexport { normalizeJsName, toISOString, getExceptionName, strContains, setValue, getSetValue, proxyAssign, proxyFunctions, proxyFunctionAs, createClassFromInterface, optimizeObject, isNotUndefined, isNotNullOrUndefined, objExtend } from \"./JavaScriptSDK/HelperFuncs\";\r\nexport { isArray, isTypeof, isUndefined, isNullOrUndefined, objHasOwnProperty as hasOwnProperty, isObject, isFunction, strEndsWith, strStartsWith, isDate, isError, isString, isNumber, isBoolean, arrForEach, arrIndexOf, arrReduce, arrMap, strTrim, objKeys, objDefineAccessors, throwError, isSymbol, isNotTruthy, isTruthy, objFreeze, objSeal, objToString, objDeepFreeze as deepFreeze, getInst as getGlobalInst, hasWindow, getWindow, hasDocument, getDocument, hasNavigator, getNavigator, hasHistory, getHistory, dumpObj, asString, objForEachKey, getPerformance, utcNow as dateNow, perfNow } from \"@nevware21/ts-utils\";\r\nexport { createEnumStyle, createValueMap } from \"./JavaScriptSDK.Enums/EnumHelperFuncs\";\r\nexport { attachEvent, detachEvent, addEventHandler, addEventListeners, addPageUnloadEventListener, addPageHideEventListener, addPageShowEventListener, removeEventHandler, removeEventListeners, removePageUnloadEventListener, removePageHideEventListener, removePageShowEventListener, eventOn, eventOff, mergeEvtNamespace, __getRegisteredEvents } from \"./JavaScriptSDK/EventHelpers\";\r\nexport { getCrypto, getMsCrypto, getLocation, hasJSON, getJSON, isReactNative, getConsole, isIE, getIEVersion, isSafari, setEnableEnvMocks, isBeaconsSupported, isFetchSupported, useXDomainRequest, isXhrSupported, findMetaTag, findNamedServerTiming } from \"./JavaScriptSDK/EnvUtils\";\r\nexport { getGlobal, objCreateFn as objCreate, strShimPrototype as strPrototype, strShimFunction as strFunction, strShimUndefined as strUndefined, strShimObject as strObject } from \"@microsoft/applicationinsights-shims\";\r\nexport { NotificationManager } from \"./JavaScriptSDK/NotificationManager\";\r\nexport { PerfEvent, PerfManager, doPerf, getGblPerfMgr, setGblPerfMgr } from \"./JavaScriptSDK/PerfManager\";\r\nexport { safeGetLogger, DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole, _logInternalMessage } from \"./JavaScriptSDK/DiagnosticLogger\";\r\nexport { ProcessTelemetryContext, createProcessTelemetryContext\r\n// Explicitly NOT exporting createProcessTelemetryUnloadContext() and createProcessTelemetryUpdateContext() as these should only be created internally\r\n } from \"./JavaScriptSDK/ProcessTelemetryContext\";\r\nexport { initializePlugins, sortPlugins, unloadComponents } from \"./JavaScriptSDK/TelemetryHelpers\";\r\nexport { LoggingSeverity } from \"./JavaScriptSDK.Enums/LoggingEnums\";\r\nexport { InstrumentProto, InstrumentProtos, InstrumentFunc, InstrumentFuncs, InstrumentEvent } from \"./JavaScriptSDK/InstrumentHooks\";\r\nexport { createCookieMgr, safeGetCookieMgr, uaDisallowsSameSiteNone, areCookiesSupported } from \"./JavaScriptSDK/CookieMgr\";\r\nexport { getDebugListener, getDebugExt } from \"./JavaScriptSDK/DbgExtensionUtils\";\r\nexport { createUniqueNamespace } from \"./JavaScriptSDK/DataCacheHelper\";\r\nexport { createUnloadHandlerContainer } from \"./JavaScriptSDK/UnloadHandlerContainer\";\r\nexport { createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent } from \"./JavaScriptSDK/W3cTraceParent\";\r\nexport { createDynamicConfig, onConfigChange } from \"./Config/DynamicConfig\";\r\nexport { getDynamicConfigHandler } from \"./Config/DynamicSupport\";\r\n//# sourceMappingURL=applicationinsights-core-js.js.map"],"names":[],"mappings":";;;;AAAA;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
|
+
{"version":3,"file":"applicationinsights-core-js.js.map","sources":["applicationinsights-core-js.js"],"sourcesContent":["export { MinChannelPriorty } from \"./JavaScriptSDK.Interfaces/IChannelControls\";\r\nexport { EventsDiscardedReason } from \"./JavaScriptSDK.Enums/EventsDiscardedReason\";\r\nexport { throwAggregationError } from \"./JavaScriptSDK/AggregationError\";\r\nexport { AppInsightsCore } from \"./JavaScriptSDK/AppInsightsCore\";\r\nexport { BaseTelemetryPlugin } from \"./JavaScriptSDK/BaseTelemetryPlugin\";\r\nexport { randomValue, random32, mwcRandomSeed, mwcRandom32, newId } from \"./JavaScriptSDK/RandomHelper\";\r\nexport { Undefined, newGuid, generateW3CId } from \"./JavaScriptSDK/CoreUtils\";\r\nexport { normalizeJsName, toISOString, getExceptionName, strContains, setValue, getSetValue, proxyAssign, proxyFunctions, proxyFunctionAs, createClassFromInterface, optimizeObject, isNotUndefined, isNotNullOrUndefined, objExtend } from \"./JavaScriptSDK/HelperFuncs\";\r\nexport { isArray, isTypeof, isUndefined, isNullOrUndefined, objHasOwnProperty as hasOwnProperty, isObject, isFunction, strEndsWith, strStartsWith, isDate, isError, isString, isNumber, isBoolean, arrForEach, arrIndexOf, arrReduce, arrMap, strTrim, objKeys, objDefineAccessors, throwError, isSymbol, isNotTruthy, isTruthy, objFreeze, objSeal, objToString, objDeepFreeze as deepFreeze, getInst as getGlobalInst, hasWindow, getWindow, hasDocument, getDocument, hasNavigator, getNavigator, hasHistory, getHistory, dumpObj, asString, objForEachKey, getPerformance, utcNow as dateNow, perfNow } from \"@nevware21/ts-utils\";\r\nexport { createEnumStyle, createValueMap } from \"./JavaScriptSDK.Enums/EnumHelperFuncs\";\r\nexport { attachEvent, detachEvent, addEventHandler, addEventListeners, addPageUnloadEventListener, addPageHideEventListener, addPageShowEventListener, removeEventHandler, removeEventListeners, removePageUnloadEventListener, removePageHideEventListener, removePageShowEventListener, eventOn, eventOff, mergeEvtNamespace, __getRegisteredEvents } from \"./JavaScriptSDK/EventHelpers\";\r\nexport { getCrypto, getMsCrypto, getLocation, hasJSON, getJSON, isReactNative, getConsole, isIE, getIEVersion, isSafari, setEnableEnvMocks, isBeaconsSupported, isFetchSupported, useXDomainRequest, isXhrSupported, findMetaTag, findNamedServerTiming } from \"./JavaScriptSDK/EnvUtils\";\r\nexport { getGlobal, objCreateFn as objCreate, strShimPrototype as strPrototype, strShimFunction as strFunction, strShimUndefined as strUndefined, strShimObject as strObject } from \"@microsoft/applicationinsights-shims\";\r\nexport { NotificationManager } from \"./JavaScriptSDK/NotificationManager\";\r\nexport { PerfEvent, PerfManager, doPerf, getGblPerfMgr, setGblPerfMgr } from \"./JavaScriptSDK/PerfManager\";\r\nexport { safeGetLogger, DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole, _logInternalMessage } from \"./JavaScriptSDK/DiagnosticLogger\";\r\nexport { ProcessTelemetryContext, createProcessTelemetryContext\r\n// Explicitly NOT exporting createProcessTelemetryUnloadContext() and createProcessTelemetryUpdateContext() as these should only be created internally\r\n } from \"./JavaScriptSDK/ProcessTelemetryContext\";\r\nexport { initializePlugins, sortPlugins, unloadComponents } from \"./JavaScriptSDK/TelemetryHelpers\";\r\nexport { LoggingSeverity } from \"./JavaScriptSDK.Enums/LoggingEnums\";\r\nexport { InstrumentProto, InstrumentProtos, InstrumentFunc, InstrumentFuncs, InstrumentEvent } from \"./JavaScriptSDK/InstrumentHooks\";\r\nexport { createCookieMgr, safeGetCookieMgr, uaDisallowsSameSiteNone, areCookiesSupported } from \"./JavaScriptSDK/CookieMgr\";\r\nexport { getDebugListener, getDebugExt } from \"./JavaScriptSDK/DbgExtensionUtils\";\r\nexport { createUniqueNamespace } from \"./JavaScriptSDK/DataCacheHelper\";\r\nexport { createUnloadHandlerContainer } from \"./JavaScriptSDK/UnloadHandlerContainer\";\r\nexport { createUnloadHookContainer } from \"./JavaScriptSDK/UnloadHookContainer\";\r\nexport { createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent } from \"./JavaScriptSDK/W3cTraceParent\";\r\nexport { createDynamicConfig, onConfigChange } from \"./Config/DynamicConfig\";\r\nexport { getDynamicConfigHandler } from \"./Config/DynamicSupport\";\r\n//# sourceMappingURL=applicationinsights-core-js.js.map"],"names":[],"mappings":";;;;AAAA;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"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/applicationinsights-core-js",
|
|
3
3
|
"author": "Microsoft Application Insights Team",
|
|
4
|
-
"version": "3.0.0-beta.2301-
|
|
4
|
+
"version": "3.0.0-beta.2301-17",
|
|
5
5
|
"description": "Microsoft Application Insights Core Javascript SDK",
|
|
6
6
|
"homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
|
|
7
7
|
"keywords": [
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
6
6
|
import {
|
|
7
|
-
ITimerHandler, arrAppend, arrForEach, arrIndexOf, deepExtend,
|
|
8
|
-
|
|
7
|
+
ITimerHandler, arrAppend, arrForEach, arrIndexOf, deepExtend, hasDocument, isFunction, isNullOrUndefined, isPlainObject, objDeepFreeze,
|
|
8
|
+
objDefineProp, objForEachKey, objFreeze, objHasOwn, scheduleInterval, scheduleTimeout, throwError
|
|
9
9
|
} from "@nevware21/ts-utils";
|
|
10
10
|
import { createDynamicConfig, onConfigChange } from "../Config/DynamicConfig";
|
|
11
11
|
import { IConfigDefaults } from "../Config/IConfigDefaults";
|
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
import { _getPluginState, createDistributedTraceContext, initializePlugins, sortPlugins } from "./TelemetryHelpers";
|
|
51
51
|
import { TelemetryInitializerPlugin } from "./TelemetryInitializerPlugin";
|
|
52
52
|
import { IUnloadHandlerContainer, UnloadHandler, createUnloadHandlerContainer } from "./UnloadHandlerContainer";
|
|
53
|
+
import { IUnloadHookContainer, createUnloadHookContainer } from "./UnloadHookContainer";
|
|
53
54
|
|
|
54
55
|
const strValidationError = "Plugins must provide initialize method";
|
|
55
56
|
const strNotificationManager = "_notificationManager";
|
|
@@ -246,7 +247,7 @@ export class AppInsightsCore implements IAppInsightsCore {
|
|
|
246
247
|
let _internalLogsEventName: string | null;
|
|
247
248
|
let _evtNamespace: string;
|
|
248
249
|
let _unloadHandlers: IUnloadHandlerContainer;
|
|
249
|
-
let
|
|
250
|
+
let _hookContainer: IUnloadHookContainer;
|
|
250
251
|
let _debugListener: INotificationListener | null;
|
|
251
252
|
let _traceCtx: IDistributedTraceContext | null;
|
|
252
253
|
let _instrumentationKey: string | null;
|
|
@@ -293,6 +294,14 @@ export class AppInsightsCore implements IAppInsightsCore {
|
|
|
293
294
|
_addUnloadHook(_configHandler.watch((details) => {
|
|
294
295
|
_instrumentationKey = details.cfg.instrumentationKey;
|
|
295
296
|
|
|
297
|
+
// Mark the extensionConfig and all first level keys as referenced
|
|
298
|
+
// This is so that calls to getExtCfg() will always return the same object
|
|
299
|
+
// Even when a user may "re-assign" the plugin properties (or it's unloaded/reloaded)
|
|
300
|
+
let extCfg = details.ref(details.cfg, STR_EXTENSION_CONFIG);
|
|
301
|
+
objForEachKey(extCfg, (key) => {
|
|
302
|
+
details.ref(extCfg, key);
|
|
303
|
+
});
|
|
304
|
+
|
|
296
305
|
if (isNullOrUndefined(_instrumentationKey)) {
|
|
297
306
|
throwError("Please provide instrumentation key");
|
|
298
307
|
}
|
|
@@ -527,18 +536,7 @@ export class AppInsightsCore implements IAppInsightsCore {
|
|
|
527
536
|
|
|
528
537
|
let processUnloadCtx = createProcessTelemetryUnloadContext(_getPluginChain(), _self);
|
|
529
538
|
processUnloadCtx.onComplete(() => {
|
|
530
|
-
|
|
531
|
-
_hooks = [];
|
|
532
|
-
|
|
533
|
-
// Remove all registered unload hooks
|
|
534
|
-
arrForEach(oldHooks, (fn) => {
|
|
535
|
-
// allow either rm or remove callback function
|
|
536
|
-
try{
|
|
537
|
-
((fn as IUnloadHook).rm || (fn as ILegacyUnloadHook).remove).call(fn);
|
|
538
|
-
} catch (e) {
|
|
539
|
-
_throwInternal(_self.logger, eLoggingSeverity.WARNING, _eInternalMessageId.PluginException, "Unloading:" + dumpObj(e));
|
|
540
|
-
}
|
|
541
|
-
});
|
|
539
|
+
_hookContainer.run(_self.logger);
|
|
542
540
|
|
|
543
541
|
_initDefaults();
|
|
544
542
|
unloadComplete && unloadComplete(unloadState);
|
|
@@ -739,7 +737,7 @@ export class AppInsightsCore implements IAppInsightsCore {
|
|
|
739
737
|
|
|
740
738
|
// Use a default logger so initialization errors are not dropped on the floor with full logging
|
|
741
739
|
_configHandler = createDynamicConfig({}, defaultConfig, _self.logger);
|
|
742
|
-
|
|
740
|
+
|
|
743
741
|
// Set the logging level to critical so that any critical initialization failures are displayed on the console
|
|
744
742
|
_configHandler.cfg.loggingLevelConsole = eLoggingSeverity.CRITICAL;
|
|
745
743
|
|
|
@@ -800,7 +798,7 @@ export class AppInsightsCore implements IAppInsightsCore {
|
|
|
800
798
|
_unloadHandlers = createUnloadHandlerContainer();
|
|
801
799
|
_traceCtx = null;
|
|
802
800
|
_instrumentationKey = null;
|
|
803
|
-
|
|
801
|
+
_hookContainer = createUnloadHookContainer();
|
|
804
802
|
_cfgListeners = [];
|
|
805
803
|
_pluginVersionString = null;
|
|
806
804
|
_pluginVersionStringArr = null;
|
|
@@ -1103,9 +1101,7 @@ export class AppInsightsCore implements IAppInsightsCore {
|
|
|
1103
1101
|
}
|
|
1104
1102
|
|
|
1105
1103
|
function _addUnloadHook(hooks: IUnloadHook | IUnloadHook[] | Iterator<IUnloadHook> | ILegacyUnloadHook | ILegacyUnloadHook[] | Iterator<ILegacyUnloadHook>) {
|
|
1106
|
-
|
|
1107
|
-
arrAppend(_hooks, hooks);
|
|
1108
|
-
}
|
|
1104
|
+
_hookContainer.add(hooks);
|
|
1109
1105
|
}
|
|
1110
1106
|
});
|
|
1111
1107
|
}
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
5
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
6
|
-
import {
|
|
6
|
+
import { isFunction, objDefine } from "@nevware21/ts-utils";
|
|
7
7
|
import { createDynamicConfig } from "../Config/DynamicConfig";
|
|
8
8
|
import { IConfigDefaults } from "../Config/IConfigDefaults";
|
|
9
|
-
import { _eInternalMessageId, eLoggingSeverity } from "../JavaScriptSDK.Enums/LoggingEnums";
|
|
10
9
|
import { TelemetryUnloadReason } from "../JavaScriptSDK.Enums/TelemetryUnloadReason";
|
|
11
10
|
import { TelemetryUpdateReason } from "../JavaScriptSDK.Enums/TelemetryUpdateReason";
|
|
12
11
|
import { IAppInsightsCore } from "../JavaScriptSDK.Interfaces/IAppInsightsCore";
|
|
@@ -21,18 +20,18 @@ import { ITelemetryPluginChain } from "../JavaScriptSDK.Interfaces/ITelemetryPlu
|
|
|
21
20
|
import { ITelemetryUnloadState } from "../JavaScriptSDK.Interfaces/ITelemetryUnloadState";
|
|
22
21
|
import { ITelemetryUpdateState } from "../JavaScriptSDK.Interfaces/ITelemetryUpdateState";
|
|
23
22
|
import { ILegacyUnloadHook, IUnloadHook } from "../JavaScriptSDK.Interfaces/IUnloadHook";
|
|
24
|
-
import { _throwInternal } from "./DiagnosticLogger";
|
|
25
23
|
import { isNotNullOrUndefined, proxyFunctionAs } from "./HelperFuncs";
|
|
26
24
|
import { STR_EXTENSION_CONFIG } from "./InternalConstants";
|
|
27
25
|
import {
|
|
28
26
|
createProcessTelemetryContext, createProcessTelemetryUnloadContext, createProcessTelemetryUpdateContext
|
|
29
27
|
} from "./ProcessTelemetryContext";
|
|
30
28
|
import { IUnloadHandlerContainer, UnloadHandler, createUnloadHandlerContainer } from "./UnloadHandlerContainer";
|
|
29
|
+
import { IUnloadHookContainer, createUnloadHookContainer } from "./UnloadHookContainer";
|
|
31
30
|
|
|
32
31
|
let strGetPlugin = "getPlugin";
|
|
33
32
|
|
|
34
33
|
const defaultValues: IConfigDefaults<IConfiguration> = {
|
|
35
|
-
[STR_EXTENSION_CONFIG]: { isVal: isNotNullOrUndefined, v:
|
|
34
|
+
[STR_EXTENSION_CONFIG]: { isVal: isNotNullOrUndefined, v: {} }
|
|
36
35
|
};
|
|
37
36
|
|
|
38
37
|
|
|
@@ -110,6 +109,13 @@ export abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
|
110
109
|
*/
|
|
111
110
|
protected _doUpdate?: (updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: () => void) => void | boolean;
|
|
112
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Exposes the underlying unload hook container instance for this extension to allow it to be passed down to any sub components of the class.
|
|
114
|
+
* This should NEVER be exposed or called publically as it's scope is for internal use by BaseTelemetryPlugin and any derived class (which is why
|
|
115
|
+
* it's scoped as protected)
|
|
116
|
+
*/
|
|
117
|
+
protected readonly _unloadHooks: IUnloadHookContainer;
|
|
118
|
+
|
|
113
119
|
constructor() {
|
|
114
120
|
let _self = this; // Setting _self here as it's used outside of the dynamicProto as well
|
|
115
121
|
|
|
@@ -118,7 +124,7 @@ export abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
|
118
124
|
let _rootCtx: IProcessTelemetryContext; // Used as the root context, holding the current config and initialized core
|
|
119
125
|
let _nextPlugin: ITelemetryPlugin | ITelemetryPluginChain; // Used for backward compatibility where plugins don't call the main pipeline
|
|
120
126
|
let _unloadHandlerContainer: IUnloadHandlerContainer;
|
|
121
|
-
let
|
|
127
|
+
let _hookContainer: IUnloadHookContainer;
|
|
122
128
|
|
|
123
129
|
_initDefaults();
|
|
124
130
|
|
|
@@ -151,19 +157,7 @@ export abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
|
151
157
|
unloadDone = true;
|
|
152
158
|
|
|
153
159
|
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
154
|
-
|
|
155
|
-
let oldHooks = _hooks;
|
|
156
|
-
_hooks = [];
|
|
157
|
-
|
|
158
|
-
// Remove all registered unload hooks
|
|
159
|
-
arrForEach(oldHooks, (fn) => {
|
|
160
|
-
// allow either rm or remove callback function
|
|
161
|
-
try{
|
|
162
|
-
((fn as IUnloadHook).rm || (fn as ILegacyUnloadHook).remove).call(fn);
|
|
163
|
-
} catch (e) {
|
|
164
|
-
_throwInternal(theUnloadCtx.diagLog(), eLoggingSeverity.WARNING, _eInternalMessageId.PluginException, "Unloading:" + dumpObj(e));
|
|
165
|
-
}
|
|
166
|
-
});
|
|
160
|
+
_hookContainer.run(theUnloadCtx.diagLog());
|
|
167
161
|
|
|
168
162
|
if (result === true) {
|
|
169
163
|
theUnloadCtx.processNext(theUnloadState);
|
|
@@ -215,13 +209,9 @@ export abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
|
215
209
|
return result;
|
|
216
210
|
};
|
|
217
211
|
|
|
218
|
-
_self._addHook = (hooks: IUnloadHook | IUnloadHook[] | ILegacyUnloadHook | ILegacyUnloadHook[]) => {
|
|
219
|
-
if (hooks) {
|
|
220
|
-
arrAppend(_hooks, hooks);
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
|
|
224
212
|
proxyFunctionAs(_self, "_addUnloadCb", () => _unloadHandlerContainer, "add");
|
|
213
|
+
proxyFunctionAs(_self, "_addHook", () => _hookContainer, "add");
|
|
214
|
+
objDefine(_self, "_unloadHooks" as keyof BaseTelemetryPlugin, { g: () => _hookContainer });
|
|
225
215
|
});
|
|
226
216
|
|
|
227
217
|
// These are added after the dynamicProto so that are not moved to the prototype
|
|
@@ -301,7 +291,7 @@ export abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
|
301
291
|
_self.core = null;
|
|
302
292
|
_rootCtx = null;
|
|
303
293
|
_nextPlugin = null;
|
|
304
|
-
|
|
294
|
+
_hookContainer = createUnloadHookContainer();
|
|
305
295
|
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
306
296
|
}
|
|
307
297
|
}
|
|
@@ -347,7 +337,7 @@ export abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
|
347
337
|
* Add this hook so that it is automatically removed during unloading
|
|
348
338
|
* @param hooks - The single hook or an array of IInstrumentHook objects
|
|
349
339
|
*/
|
|
350
|
-
protected _addHook(hooks: IUnloadHook | IUnloadHook[] | ILegacyUnloadHook | ILegacyUnloadHook[]): void {
|
|
340
|
+
protected _addHook(hooks: IUnloadHook | IUnloadHook[] | Iterator<IUnloadHook> | ILegacyUnloadHook | ILegacyUnloadHook[] | Iterator<ILegacyUnloadHook>): void {
|
|
351
341
|
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
352
342
|
}
|
|
353
343
|
}
|
|
@@ -162,19 +162,22 @@ function _createInternalContext<T extends IBaseProcessingContext>(telemetryChain
|
|
|
162
162
|
extCfg = {};
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
// Always set the value so that
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
// Always set the value so that the property always exists
|
|
166
|
+
cfg[STR_EXTENSION_CONFIG] = extCfg; // Note: it is valid for the "value" to be undefined
|
|
167
|
+
|
|
168
|
+
// Calling `ref()` has a side effect of causing the referenced property to become dynamic (if not already)
|
|
169
|
+
extCfg = dynamicHandler.ref(cfg, STR_EXTENSION_CONFIG);
|
|
169
170
|
if (extCfg) {
|
|
170
171
|
idCfg = extCfg[identifier];
|
|
171
172
|
if (!idCfg && createIfMissing) {
|
|
172
173
|
idCfg = {} as T;
|
|
173
174
|
}
|
|
174
175
|
|
|
175
|
-
// Always set the value so that
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
// Always set the value so that the property always exists
|
|
177
|
+
extCfg[identifier] = idCfg; // Note: it is valid for the "value" to be undefined
|
|
178
|
+
|
|
179
|
+
// Calling `ref()` has a side effect of causing the referenced property to become dynamic (if not already)
|
|
180
|
+
idCfg = dynamicHandler.ref(extCfg, identifier);
|
|
178
181
|
}
|
|
179
182
|
}
|
|
180
183
|
|
|
@@ -14,7 +14,7 @@ export interface IUnloadHandlerContainer {
|
|
|
14
14
|
run: (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export function createUnloadHandlerContainer() {
|
|
17
|
+
export function createUnloadHandlerContainer(): IUnloadHandlerContainer {
|
|
18
18
|
let handlers: UnloadHandler[] = [];
|
|
19
19
|
|
|
20
20
|
function _addHandler(handler: UnloadHandler) {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import { arrAppend, arrForEach, dumpObj } from "@nevware21/ts-utils";
|
|
5
|
+
import { eLoggingSeverity, _eInternalMessageId } from "../JavaScriptSDK.Enums/LoggingEnums";
|
|
6
|
+
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
7
|
+
import { ILegacyUnloadHook, IUnloadHook } from "../JavaScriptSDK.Interfaces/IUnloadHook";
|
|
8
|
+
import { _throwInternal } from "./DiagnosticLogger";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Interface which identifiesAdd this hook so that it is automatically removed during unloading
|
|
12
|
+
* @param hooks - The single hook or an array of IInstrumentHook objects
|
|
13
|
+
*/
|
|
14
|
+
export interface IUnloadHookContainer {
|
|
15
|
+
add: (hooks: IUnloadHook | IUnloadHook[] | Iterator<IUnloadHook> | ILegacyUnloadHook | ILegacyUnloadHook[] | Iterator<ILegacyUnloadHook>) => void;
|
|
16
|
+
run: (logger?: IDiagnosticLogger) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a IUnloadHookContainer which can be used to remember unload hook functions to be executed during the component unloading
|
|
21
|
+
* process.
|
|
22
|
+
* @returns A new IUnloadHookContainer instance
|
|
23
|
+
*/
|
|
24
|
+
export function createUnloadHookContainer(): IUnloadHookContainer {
|
|
25
|
+
let _hooks: Array<ILegacyUnloadHook | IUnloadHook> = [];
|
|
26
|
+
|
|
27
|
+
function _doUnload(logger: IDiagnosticLogger) {
|
|
28
|
+
let oldHooks = _hooks;
|
|
29
|
+
_hooks = [];
|
|
30
|
+
|
|
31
|
+
// Remove all registered unload hooks
|
|
32
|
+
arrForEach(oldHooks, (fn) => {
|
|
33
|
+
// allow either rm or remove callback function
|
|
34
|
+
try{
|
|
35
|
+
((fn as IUnloadHook).rm || (fn as ILegacyUnloadHook).remove).call(fn);
|
|
36
|
+
} catch (e) {
|
|
37
|
+
_throwInternal(logger, eLoggingSeverity.WARNING, _eInternalMessageId.PluginException, "Unloading:" + dumpObj(e));
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function _addHook(hooks: IUnloadHook | IUnloadHook[] | Iterator<IUnloadHook> | ILegacyUnloadHook | ILegacyUnloadHook[] | Iterator<ILegacyUnloadHook>) {
|
|
43
|
+
if (hooks) {
|
|
44
|
+
arrAppend(_hooks, hooks);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
run: _doUnload,
|
|
50
|
+
add: _addHook
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { _IDynamicConfigHandlerState } from "./_IDynamicConfigHandlerState";
|
|
2
|
-
export declare function _setDynamicProperty<T, C, V = any>(state: _IDynamicConfigHandlerState<T>, target: C, name: string, value: V): V;
|
|
2
|
+
export declare function _setDynamicProperty<T, C, V = any>(state: _IDynamicConfigHandlerState<T>, target: C, name: string, value: V, inPlace?: boolean, rdOnly?: boolean): V;
|
|
3
3
|
export declare function _makeDynamicObject<T>(state: _IDynamicConfigHandlerState<T>, target: any): any;
|
|
@@ -39,6 +39,20 @@ export interface IDynamicConfigHandler<T extends IConfiguration> {
|
|
|
39
39
|
* @param defaultValues - The default values to apply to the config
|
|
40
40
|
*/
|
|
41
41
|
setDf: <C>(theConfig: C, defaultValues: IConfigDefaults<C, T>) => C;
|
|
42
|
+
/**
|
|
43
|
+
* Set this named property of the target as referenced, which will cause any object or array instances
|
|
44
|
+
* to be updated in-place rather than being entirely replaced. All other values will continue to be replaced.
|
|
45
|
+
* @returns The referenced properties current value
|
|
46
|
+
*/
|
|
47
|
+
ref: <C, V = any>(target: C, name: string) => V;
|
|
48
|
+
/**
|
|
49
|
+
* Set this named property of the target as read-only, which will block this single named property from
|
|
50
|
+
* ever being changed for the target instance.
|
|
51
|
+
* This does NOT freeze or seal the instance, it just stops the direct re-assignment of the named property,
|
|
52
|
+
* if the value is a non-primitive (ie. an object or array) it's properties will still be mutable.
|
|
53
|
+
* @returns The referenced properties current value
|
|
54
|
+
*/
|
|
55
|
+
rdOnly: <C, V = any>(target: C, name: string) => V;
|
|
42
56
|
}
|
|
43
57
|
/**
|
|
44
58
|
* @internal
|
|
@@ -20,6 +20,20 @@ export interface IWatchDetails<T extends IConfiguration> {
|
|
|
20
20
|
* @param defaultValues - The default values to apply to the config
|
|
21
21
|
*/
|
|
22
22
|
setDf: <C>(theConfig: C, defaultValues: IConfigDefaults<C>) => C;
|
|
23
|
+
/**
|
|
24
|
+
* Set this named property of the target as referenced, which will cause any object or array instance
|
|
25
|
+
* to be updated in-place rather than being entirely replaced. All other values will continue to be replaced.
|
|
26
|
+
* @returns The referenced properties current value
|
|
27
|
+
*/
|
|
28
|
+
ref: <C, V = any>(target: C, name: string) => V;
|
|
29
|
+
/**
|
|
30
|
+
* Set this named property of the target as read-only, which will block this single named property from
|
|
31
|
+
* ever being changed for the target instance.
|
|
32
|
+
* This does NOT freeze or seal the instance, it just stops the direct re-assignment of the named property,
|
|
33
|
+
* if the value is a non-primitive (ie. an object or array) it's properties will still be mutable.
|
|
34
|
+
* @returns The referenced properties current value
|
|
35
|
+
*/
|
|
36
|
+
rdOnly: <C, V = any>(target: C, name: string) => V;
|
|
23
37
|
}
|
|
24
38
|
export declare type WatcherFunction<T extends IConfiguration> = (details: IWatchDetails<T>) => void;
|
|
25
39
|
/**
|
|
@@ -9,6 +9,7 @@ import { ITelemetryUnloadState } from "../JavaScriptSDK.Interfaces/ITelemetryUnl
|
|
|
9
9
|
import { ITelemetryUpdateState } from "../JavaScriptSDK.Interfaces/ITelemetryUpdateState";
|
|
10
10
|
import { ILegacyUnloadHook, IUnloadHook } from "../JavaScriptSDK.Interfaces/IUnloadHook";
|
|
11
11
|
import { UnloadHandler } from "./UnloadHandlerContainer";
|
|
12
|
+
import { IUnloadHookContainer } from "./UnloadHookContainer";
|
|
12
13
|
/**
|
|
13
14
|
* BaseTelemetryPlugin provides a basic implementation of the ITelemetryPlugin interface so that plugins
|
|
14
15
|
* can avoid implementation the same set of boiler plate code as well as provide a base
|
|
@@ -71,6 +72,12 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
|
71
72
|
* @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
|
|
72
73
|
*/
|
|
73
74
|
protected _doUpdate?: (updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: () => void) => void | boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Exposes the underlying unload hook container instance for this extension to allow it to be passed down to any sub components of the class.
|
|
77
|
+
* This should NEVER be exposed or called publically as it's scope is for internal use by BaseTelemetryPlugin and any derived class (which is why
|
|
78
|
+
* it's scoped as protected)
|
|
79
|
+
*/
|
|
80
|
+
protected readonly _unloadHooks: IUnloadHookContainer;
|
|
74
81
|
constructor();
|
|
75
82
|
initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
76
83
|
/**
|
|
@@ -99,5 +106,5 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
|
99
106
|
* Add this hook so that it is automatically removed during unloading
|
|
100
107
|
* @param hooks - The single hook or an array of IInstrumentHook objects
|
|
101
108
|
*/
|
|
102
|
-
protected _addHook(hooks: IUnloadHook | IUnloadHook[] | ILegacyUnloadHook | ILegacyUnloadHook[]): void;
|
|
109
|
+
protected _addHook(hooks: IUnloadHook | IUnloadHook[] | Iterator<IUnloadHook> | ILegacyUnloadHook | ILegacyUnloadHook[] | Iterator<ILegacyUnloadHook>): void;
|
|
103
110
|
}
|
|
@@ -5,7 +5,4 @@ export interface IUnloadHandlerContainer {
|
|
|
5
5
|
add: (handler: UnloadHandler) => void;
|
|
6
6
|
run: (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
7
7
|
}
|
|
8
|
-
export declare function createUnloadHandlerContainer():
|
|
9
|
-
add: (handler: UnloadHandler) => void;
|
|
10
|
-
run: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
|
|
11
|
-
};
|
|
8
|
+
export declare function createUnloadHandlerContainer(): IUnloadHandlerContainer;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
2
|
+
import { ILegacyUnloadHook, IUnloadHook } from "../JavaScriptSDK.Interfaces/IUnloadHook";
|
|
3
|
+
/**
|
|
4
|
+
* Interface which identifiesAdd this hook so that it is automatically removed during unloading
|
|
5
|
+
* @param hooks - The single hook or an array of IInstrumentHook objects
|
|
6
|
+
*/
|
|
7
|
+
export interface IUnloadHookContainer {
|
|
8
|
+
add: (hooks: IUnloadHook | IUnloadHook[] | Iterator<IUnloadHook> | ILegacyUnloadHook | ILegacyUnloadHook[] | Iterator<ILegacyUnloadHook>) => void;
|
|
9
|
+
run: (logger?: IDiagnosticLogger) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Create a IUnloadHookContainer which can be used to remember unload hook functions to be executed during the component unloading
|
|
13
|
+
* process.
|
|
14
|
+
* @returns A new IUnloadHookContainer instance
|
|
15
|
+
*/
|
|
16
|
+
export declare function createUnloadHookContainer(): IUnloadHookContainer;
|
|
@@ -24,7 +24,6 @@ export declare const _DYN_ADD_NOTIFICATION_LIS1 = "addNotificationListener";
|
|
|
24
24
|
export declare const _DYN_REMOVE_NOTIFICATION_2 = "removeNotificationListener";
|
|
25
25
|
export declare const _DYN_STOP_POLLING_INTERNA3 = "stopPollingInternalLogs";
|
|
26
26
|
export declare const _DYN_ON_COMPLETE = "onComplete";
|
|
27
|
-
export declare const _DYN_CALL = "call";
|
|
28
27
|
export declare const _DYN_VERSION = "version";
|
|
29
28
|
export declare const _DYN_LOGGING_LEVEL_CONSOL4 = "loggingLevelConsole";
|
|
30
29
|
export declare const _DYN_CREATE_NEW = "createNew";
|
|
@@ -42,6 +42,7 @@ export { getDebugListener, getDebugExt } from "./JavaScriptSDK/DbgExtensionUtils
|
|
|
42
42
|
export { TelemetryInitializerFunction, ITelemetryInitializerHandler, ITelemetryInitializerContainer } from "./JavaScriptSDK.Interfaces/ITelemetryInitializers";
|
|
43
43
|
export { createUniqueNamespace } from "./JavaScriptSDK/DataCacheHelper";
|
|
44
44
|
export { UnloadHandler, IUnloadHandlerContainer, createUnloadHandlerContainer } from "./JavaScriptSDK/UnloadHandlerContainer";
|
|
45
|
+
export { IUnloadHookContainer, createUnloadHookContainer } from "./JavaScriptSDK/UnloadHookContainer";
|
|
45
46
|
export { ITelemetryUpdateState } from "./JavaScriptSDK.Interfaces/ITelemetryUpdateState";
|
|
46
47
|
export { ITelemetryUnloadState } from "./JavaScriptSDK.Interfaces/ITelemetryUnloadState";
|
|
47
48
|
export { IDistributedTraceContext } from "./JavaScriptSDK.Interfaces/IDistributedTraceContext";
|