@microsoft/applicationinsights-core-js 3.0.0-beta.2210-04 → 3.0.0-beta.2210-06
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 +417 -221
- 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 +81 -92
- package/dist/applicationinsights-core-js.api.md +3 -6
- package/dist/applicationinsights-core-js.d.ts +29 -10
- package/dist/applicationinsights-core-js.js +417 -221
- 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 +29 -10
- package/dist-esm/Config/ConfigDefaults.js +5 -23
- package/dist-esm/Config/ConfigDefaults.js.map +1 -1
- package/dist-esm/Config/DynamicConfig.js +21 -9
- package/dist-esm/Config/DynamicConfig.js.map +1 -1
- package/dist-esm/Config/DynamicProperty.js +1 -1
- package/dist-esm/Config/DynamicState.js +7 -6
- 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/AppInsightsCore.js +5 -6
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +4 -5
- package/dist-esm/JavaScriptSDK/CookieMgr.js.map +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 +24 -19
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +1 -1
- package/dist-esm/JavaScriptSDK/W3cTraceParent.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -2
- package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js.map +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 +2 -1
- package/dist-esm/__DynamicConstants.js.map +1 -1
- package/dist-esm/applicationinsights-core-js.js +1 -2
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +3 -3
- package/src/JavaScriptSDK/AppInsightsCore.ts +3 -4
- package/src/JavaScriptSDK/CookieMgr.ts +2 -3
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +25 -18
- package/src/JavaScriptSDK.Interfaces/IDiagnosticLogger.ts +6 -8
- package/types/Config/ConfigDefaults.d.ts +3 -3
- package/types/Config/IDynamicConfigHandler.d.ts +7 -0
- package/types/Config/IDynamicWatcher.d.ts +17 -2
- package/types/JavaScriptSDK.Interfaces/IDiagnosticLogger.d.ts +6 -6
- package/types/__DynamicConstants.d.ts +1 -0
- package/types/applicationinsights-core-js.d.ts +0 -1
- package/types/tsdoc-metadata.json +1 -1
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.2210-
|
|
4
|
+
"version": "3.0.0-beta.2210-06",
|
|
5
5
|
"description": "Microsoft Application Insights Core Javascript SDK",
|
|
6
6
|
"homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
|
|
7
7
|
"keywords": [
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@microsoft/applicationinsights-shims": "2.0.1",
|
|
68
|
-
"@microsoft/dynamicproto-js": "^1.1.
|
|
69
|
-
"@nevware21/ts-utils": "^0.4.
|
|
68
|
+
"@microsoft/dynamicproto-js": "^1.1.7",
|
|
69
|
+
"@nevware21/ts-utils": "^0.4.4"
|
|
70
70
|
},
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"tag": "beta"
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
arrAppend, arrForEach, arrIndexOf, deepExtend, dumpObj, isFunction, isNullOrUndefined, objDeepFreeze, objDefineProp, objFreeze,
|
|
8
8
|
objHasOwn, throwError
|
|
9
9
|
} from "@nevware21/ts-utils";
|
|
10
|
-
import { applyDefaults } from "../Config/ConfigDefaults";
|
|
11
10
|
import { createDynamicConfig, onConfigChange } from "../Config/DynamicConfig";
|
|
12
11
|
import { IConfigDefaults } from "../Config/IConfigDefaults";
|
|
13
12
|
import { IDynamicConfigHandler, _IInternalDynamicConfigHandler } from "../Config/IDynamicConfigHandler";
|
|
@@ -154,7 +153,7 @@ function _deepMergeConfig(details: IWatchDetails<IConfiguration>, target: any, n
|
|
|
154
153
|
_deepMergeConfig(details, target[key], value, merge);
|
|
155
154
|
} else {
|
|
156
155
|
// Just Assign (replace) and/or make the property dynamic
|
|
157
|
-
details.
|
|
156
|
+
details.set(target, key, value);
|
|
158
157
|
}
|
|
159
158
|
});
|
|
160
159
|
}
|
|
@@ -612,13 +611,13 @@ export class AppInsightsCore implements IAppInsightsCore {
|
|
|
612
611
|
objForEachKey(theConfig, (key) => {
|
|
613
612
|
if (!objHasOwn(newConfig, key)) {
|
|
614
613
|
// Set the value to undefined
|
|
615
|
-
details.
|
|
614
|
+
details.set(theConfig, key, UNDEFINED_VALUE);
|
|
616
615
|
}
|
|
617
616
|
});
|
|
618
617
|
}
|
|
619
618
|
|
|
620
619
|
// Apply defaults to the new config
|
|
621
|
-
|
|
620
|
+
details.setDf(theConfig, defaultConfig as any);
|
|
622
621
|
|
|
623
622
|
// Reapply the notification manager
|
|
624
623
|
_initExtConfig();
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
arrForEach, dumpObj, getDocument, getNavigator, isArray, isFunction, isNullOrUndefined, isString, isTruthy, isUndefined, objDeepFreeze,
|
|
5
5
|
objForEachKey, strEndsWith, strTrim
|
|
6
6
|
} from "@nevware21/ts-utils";
|
|
7
|
-
import { applyDefaults } from "../Config/ConfigDefaults";
|
|
8
7
|
import { createDynamicConfig, onConfigChange } from "../Config/DynamicConfig";
|
|
9
8
|
import { IConfigDefaults } from "../Config/IConfigDefaults";
|
|
10
9
|
import { _eInternalMessageId, eLoggingSeverity } from "../JavaScriptSDK.Enums/LoggingEnums";
|
|
@@ -150,10 +149,10 @@ export function createCookieMgr(rootConfig?: IConfiguration, logger?: IDiagnosti
|
|
|
150
149
|
onConfigChange(rootConfig, (details) => {
|
|
151
150
|
|
|
152
151
|
// Make sure the root config has all of the the defaults to the root config to ensure they are dynamic
|
|
153
|
-
|
|
152
|
+
details.setDf(details.cfg, rootDefaultConfig);
|
|
154
153
|
|
|
155
154
|
// Create and apply the defaults to the cookieCfg element
|
|
156
|
-
cookieMgrConfig =
|
|
155
|
+
cookieMgrConfig = details.setDf(details.cfg.cookieCfg, defaultConfig);
|
|
157
156
|
let isEnabled = cookieMgrConfig.enabled;
|
|
158
157
|
if (isNullOrUndefined(isEnabled)) {
|
|
159
158
|
// Set the enabled from the provided setting or the legacy root values
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
5
|
import { arrForEach, dumpObj, isArray, isFunction, isNullOrUndefined, isUndefined, objFreeze, objKeys } from "@nevware21/ts-utils";
|
|
6
|
-
import { _applyDefaultValue
|
|
6
|
+
import { _applyDefaultValue } from "../Config/ConfigDefaults";
|
|
7
7
|
import { createDynamicConfig } from "../Config/DynamicConfig";
|
|
8
8
|
import { IConfigDefaults } from "../Config/IConfigDefaults";
|
|
9
9
|
import { IDynamicConfigHandler } from "../Config/IDynamicConfigHandler";
|
|
@@ -65,19 +65,19 @@ function _getNextProxyStart(proxy: ITelemetryPluginChain, core: IAppInsightsCore
|
|
|
65
65
|
/**
|
|
66
66
|
* @ignore
|
|
67
67
|
* @param telemetryChain
|
|
68
|
-
* @param
|
|
68
|
+
* @param dynamicHandler
|
|
69
69
|
* @param core
|
|
70
70
|
* @param startAt - Identifies the next plugin to execute, if null there is no "next" plugin and if undefined it should assume the start of the chain
|
|
71
71
|
* @returns
|
|
72
72
|
*/
|
|
73
|
-
function _createInternalContext<T extends IBaseProcessingContext>(telemetryChain: ITelemetryPluginChain,
|
|
73
|
+
function _createInternalContext<T extends IBaseProcessingContext>(telemetryChain: ITelemetryPluginChain, dynamicHandler: IDynamicConfigHandler<IConfiguration>, core: IAppInsightsCore, startAt?: IPlugin): IInternalContext<T> {
|
|
74
74
|
// We have a special case where we want to start execution from this specific plugin
|
|
75
75
|
// or we simply reuse the existing telemetry plugin chain (normal execution case)
|
|
76
76
|
let _nextProxy: ITelemetryPluginChain | null = null; // By Default set as no next plugin
|
|
77
77
|
let _onComplete: OnCompleteCallback[] = [];
|
|
78
78
|
|
|
79
|
-
if (!
|
|
80
|
-
|
|
79
|
+
if (!dynamicHandler) {
|
|
80
|
+
dynamicHandler = createDynamicConfig({}, null, core.logger);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
if (startAt !== null) {
|
|
@@ -92,10 +92,10 @@ function _createInternalContext<T extends IBaseProcessingContext>(telemetryChain
|
|
|
92
92
|
return core
|
|
93
93
|
},
|
|
94
94
|
diagLog: () => {
|
|
95
|
-
return safeGetLogger(core,
|
|
95
|
+
return safeGetLogger(core, dynamicHandler.cfg);
|
|
96
96
|
},
|
|
97
97
|
getCfg: () => {
|
|
98
|
-
return
|
|
98
|
+
return dynamicHandler.cfg;
|
|
99
99
|
},
|
|
100
100
|
getExtCfg: _resolveExtCfg,
|
|
101
101
|
getConfig: _getConfig,
|
|
@@ -153,19 +153,26 @@ function _createInternalContext<T extends IBaseProcessingContext>(telemetryChain
|
|
|
153
153
|
|
|
154
154
|
function _getExtCfg<T>(identifier: string, createIfMissing: boolean) {
|
|
155
155
|
let idCfg: T = null;
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
let cfg = dynamicHandler.cfg;
|
|
157
|
+
if (cfg && identifier) {
|
|
158
|
+
let extCfg = cfg.extensionConfig;
|
|
158
159
|
if (!extCfg && createIfMissing) {
|
|
159
|
-
|
|
160
|
-
extCfg = dynamicConfig.cfg.extensionConfig;
|
|
160
|
+
extCfg = {};
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
|
|
163
|
+
// Always set the value so that it's created as a dynamic config element (if not already)
|
|
164
|
+
dynamicHandler.set(cfg, "extensionConfig", extCfg); // Note: it is valid for the "value" to be undefined
|
|
165
|
+
extCfg = cfg.extensionConfig;
|
|
166
|
+
|
|
163
167
|
if (extCfg) {
|
|
164
168
|
idCfg = extCfg[identifier];
|
|
165
169
|
if (!idCfg && createIfMissing) {
|
|
166
|
-
|
|
167
|
-
idCfg = extCfg[identifier];
|
|
170
|
+
idCfg = {} as T;
|
|
168
171
|
}
|
|
172
|
+
|
|
173
|
+
// Always set the value so that it's created as a dynamic config element (if not already)
|
|
174
|
+
dynamicHandler.set(extCfg, identifier, idCfg);
|
|
175
|
+
idCfg = extCfg[identifier];
|
|
169
176
|
}
|
|
170
177
|
}
|
|
171
178
|
|
|
@@ -181,23 +188,23 @@ function _createInternalContext<T extends IBaseProcessingContext>(telemetryChain
|
|
|
181
188
|
objForEachKey(defaultValues, (field, defaultValue) => {
|
|
182
189
|
// for each unspecified field, set the default value
|
|
183
190
|
if (isNullOrUndefined(newConfig[field])) {
|
|
184
|
-
let cfgValue =
|
|
191
|
+
let cfgValue = dynamicHandler.cfg[field];
|
|
185
192
|
if (cfgValue || !isNullOrUndefined(cfgValue)) {
|
|
186
193
|
newConfig[field] = cfgValue;
|
|
187
194
|
}
|
|
188
195
|
}
|
|
189
196
|
|
|
190
|
-
_applyDefaultValue(newConfig, field, defaultValue);
|
|
197
|
+
_applyDefaultValue(dynamicHandler, newConfig, field, defaultValue);
|
|
191
198
|
});
|
|
192
199
|
}
|
|
193
200
|
|
|
194
|
-
return
|
|
201
|
+
return dynamicHandler.setDf(newConfig, defaultValues);
|
|
195
202
|
}
|
|
196
203
|
|
|
197
204
|
function _getConfig(identifier:string, field: string, defaultValue: number | string | boolean | string[] | RegExp[] | Function = false) {
|
|
198
205
|
let theValue;
|
|
199
206
|
let extConfig: T = _getExtCfg(identifier, false);
|
|
200
|
-
let rootConfig =
|
|
207
|
+
let rootConfig = dynamicHandler.cfg;
|
|
201
208
|
|
|
202
209
|
if (extConfig && (extConfig[field] || !isNullOrUndefined(extConfig[field]))) {
|
|
203
210
|
theValue = extConfig[field];
|
|
@@ -4,8 +4,6 @@ import { LoggingSeverity, _InternalMessageId } from "../JavaScriptSDK.Enums/Logg
|
|
|
4
4
|
import { _InternalLogMessage } from "../JavaScriptSDK/DiagnosticLogger";
|
|
5
5
|
import { ITelemetryUpdateState } from "./ITelemetryUpdateState";
|
|
6
6
|
|
|
7
|
-
"use strict"
|
|
8
|
-
|
|
9
7
|
export interface IDiagnosticLogger {
|
|
10
8
|
/**
|
|
11
9
|
* When this is true the SDK will throw exceptions to aid in debugging.
|
|
@@ -38,14 +36,14 @@ export interface IDiagnosticLogger {
|
|
|
38
36
|
|
|
39
37
|
/**
|
|
40
38
|
* This method will throw exceptions in debug mode or attempt to log the error as a console warning.
|
|
41
|
-
* @param severity -
|
|
42
|
-
* @param message -
|
|
39
|
+
* @param severity - The severity of the log message
|
|
40
|
+
* @param message - The log message.
|
|
43
41
|
*/
|
|
44
42
|
throwInternal(severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
|
|
45
43
|
|
|
46
44
|
/**
|
|
47
45
|
* This will write a warning to the console if possible
|
|
48
|
-
* @param message -
|
|
46
|
+
* @param message - The warning message
|
|
49
47
|
*/
|
|
50
48
|
warnToConsole(message: string): void;
|
|
51
49
|
|
|
@@ -53,7 +51,7 @@ export interface IDiagnosticLogger {
|
|
|
53
51
|
* This will write an error to the console if possible.
|
|
54
52
|
* Provided by the default DiagnosticLogger instance, and internally the SDK will fall back to warnToConsole, however,
|
|
55
53
|
* direct callers MUST check for its existence on the logger as you can provide your own IDiagnosticLogger instance.
|
|
56
|
-
* @param message -
|
|
54
|
+
* @param message - The error message
|
|
57
55
|
*/
|
|
58
56
|
errorToConsole?(message: string): void;
|
|
59
57
|
|
|
@@ -64,8 +62,8 @@ export interface IDiagnosticLogger {
|
|
|
64
62
|
|
|
65
63
|
/**
|
|
66
64
|
* Logs a message to the internal queue.
|
|
67
|
-
* @param severity -
|
|
68
|
-
* @param message -
|
|
65
|
+
* @param severity - The severity of the log message
|
|
66
|
+
* @param message - The message to log.
|
|
69
67
|
*/
|
|
70
68
|
logInternalMessage?(severity: LoggingSeverity, message: _InternalLogMessage): void;
|
|
71
69
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
2
|
-
import { IConfigDefaultCheck
|
|
2
|
+
import { IConfigDefaultCheck } from "./IConfigDefaults";
|
|
3
|
+
import { IDynamicConfigHandler } from "./IDynamicConfigHandler";
|
|
3
4
|
/**
|
|
4
5
|
* Applies the default value on the config property and makes sure that it's dynamic
|
|
5
6
|
* @param theConfig
|
|
6
7
|
* @param name
|
|
7
8
|
* @param defaultValue
|
|
8
9
|
*/
|
|
9
|
-
export declare function _applyDefaultValue<T extends IConfiguration, C>(theConfig: C, name: string, defaultValue: C[keyof C] | IConfigDefaultCheck<C, C[keyof C], T>): void;
|
|
10
|
-
export declare function applyDefaults<C>(theConfig: C, defaultValues: IConfigDefaults<C>): C;
|
|
10
|
+
export declare function _applyDefaultValue<T extends IConfiguration, C>(dynamicHandler: IDynamicConfigHandler<T>, theConfig: C, name: string, defaultValue: C[keyof C] | IConfigDefaultCheck<C, C[keyof C], T>): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
2
2
|
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
3
|
+
import { IConfigDefaults } from "./IConfigDefaults";
|
|
3
4
|
import { IWatcherHandler, WatcherFunction } from "./IDynamicWatcher";
|
|
4
5
|
/**
|
|
5
6
|
* This interface identifies the config which can track changes
|
|
@@ -32,6 +33,12 @@ export interface IDynamicConfigHandler<T extends IConfiguration> {
|
|
|
32
33
|
* @throws TypeError if the provided config is not a monitored dynamic config
|
|
33
34
|
*/
|
|
34
35
|
set: <C, V>(theConfig: C, name: string, value: V) => V;
|
|
36
|
+
/**
|
|
37
|
+
* Set default values for the config if not present.
|
|
38
|
+
* @param theConfig - The configuration object to set default on (if missing)
|
|
39
|
+
* @param defaultValues - The default values to apply to the config
|
|
40
|
+
*/
|
|
41
|
+
setDf: <C>(theConfig: C, defaultValues: IConfigDefaults<C, T>) => C;
|
|
35
42
|
}
|
|
36
43
|
/**
|
|
37
44
|
* @internal
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
2
2
|
import { IUnloadHook } from "../JavaScriptSDK.Interfaces/IUnloadHook";
|
|
3
|
-
import {
|
|
3
|
+
import { IConfigDefaults } from "./IConfigDefaults";
|
|
4
4
|
import { IDynamicPropertyHandler } from "./IDynamicPropertyHandler";
|
|
5
5
|
export interface IWatchDetails<T extends IConfiguration> {
|
|
6
|
+
/**
|
|
7
|
+
* The current config object
|
|
8
|
+
*/
|
|
6
9
|
cfg: T;
|
|
7
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Set the value against the provided config/name with the value, the property
|
|
12
|
+
* will be converted to be dynamic (if not already) as long as the provided config
|
|
13
|
+
* is already a tracked dynamic object.
|
|
14
|
+
* @throws TypeError if the provided config is not a monitored dynamic config
|
|
15
|
+
*/
|
|
16
|
+
set: <C, V>(theConfig: C, name: string, value: V) => V;
|
|
17
|
+
/**
|
|
18
|
+
* Set default values for the config if not present.
|
|
19
|
+
* @param theConfig - The configuration object to set default on (if missing)
|
|
20
|
+
* @param defaultValues - The default values to apply to the config
|
|
21
|
+
*/
|
|
22
|
+
setDf: <C>(theConfig: C, defaultValues: IConfigDefaults<C>) => C;
|
|
8
23
|
}
|
|
9
24
|
export declare type WatcherFunction<T extends IConfiguration> = (details: IWatchDetails<T>) => void;
|
|
10
25
|
/**
|
|
@@ -28,20 +28,20 @@ export interface IDiagnosticLogger {
|
|
|
28
28
|
queue: _InternalLogMessage[];
|
|
29
29
|
/**
|
|
30
30
|
* This method will throw exceptions in debug mode or attempt to log the error as a console warning.
|
|
31
|
-
* @param severity -
|
|
32
|
-
* @param message -
|
|
31
|
+
* @param severity - The severity of the log message
|
|
32
|
+
* @param message - The log message.
|
|
33
33
|
*/
|
|
34
34
|
throwInternal(severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void;
|
|
35
35
|
/**
|
|
36
36
|
* This will write a warning to the console if possible
|
|
37
|
-
* @param message -
|
|
37
|
+
* @param message - The warning message
|
|
38
38
|
*/
|
|
39
39
|
warnToConsole(message: string): void;
|
|
40
40
|
/**
|
|
41
41
|
* This will write an error to the console if possible.
|
|
42
42
|
* Provided by the default DiagnosticLogger instance, and internally the SDK will fall back to warnToConsole, however,
|
|
43
43
|
* direct callers MUST check for its existence on the logger as you can provide your own IDiagnosticLogger instance.
|
|
44
|
-
* @param message -
|
|
44
|
+
* @param message - The error message
|
|
45
45
|
*/
|
|
46
46
|
errorToConsole?(message: string): void;
|
|
47
47
|
/**
|
|
@@ -50,8 +50,8 @@ export interface IDiagnosticLogger {
|
|
|
50
50
|
resetInternalMessageCount(): void;
|
|
51
51
|
/**
|
|
52
52
|
* Logs a message to the internal queue.
|
|
53
|
-
* @param severity -
|
|
54
|
-
* @param message -
|
|
53
|
+
* @param severity - The severity of the log message
|
|
54
|
+
* @param message - The message to log.
|
|
55
55
|
*/
|
|
56
56
|
logInternalMessage?(severity: LoggingSeverity, message: _InternalLogMessage): void;
|
|
57
57
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const _DYN_LENGTH = "length";
|
|
2
2
|
export declare const _DYN_NOTIFY = "notify";
|
|
3
3
|
export declare const _DYN_THROW_INTERNAL = "throwInternal";
|
|
4
|
+
export declare const _DYN_SET_DF = "setDf";
|
|
4
5
|
export declare const _DYN_WATCH = "watch";
|
|
5
6
|
export declare const _DYN_LOGGER = "logger";
|
|
6
7
|
export declare const _DYN_CONFIGURABLE = "configurable";
|
|
@@ -50,6 +50,5 @@ export { IConfigCheckFn, IConfigDefaultCheck, IConfigDefaults, IConfigSetFn } fr
|
|
|
50
50
|
export { IDynamicConfigHandler } from "./Config/IDynamicConfigHandler";
|
|
51
51
|
export { IDynamicPropertyHandler } from "./Config/IDynamicPropertyHandler";
|
|
52
52
|
export { IWatchDetails, IWatcherHandler, WatcherFunction } from "./Config/IDynamicWatcher";
|
|
53
|
-
export { applyDefaults } from "./Config/ConfigDefaults";
|
|
54
53
|
export { createDynamicConfig, onConfigChange } from "./Config/DynamicConfig";
|
|
55
54
|
export { getDynamicConfigHandler } from "./Config/DynamicSupport";
|