launchdarkly-js-sdk-common 5.0.1 → 5.0.3
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/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/InspectorManager.js +11 -10
- package/src/configuration.js +1 -1
- package/src/context.js +1 -1
- package/typings.d.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the `launchdarkly-js-sdk-common` package will be documented in this file. Changes that affect the dependent SDKs such as `launchdarkly-js-client-sdk` should also be logged in those projects, in the next release that uses the updated version of this package. This project adheres to [Semantic Versioning](http://semver.org).
|
|
4
4
|
|
|
5
|
+
## [5.0.2] - 2023-02-15
|
|
6
|
+
### Changed:
|
|
7
|
+
- Removed usage of optional chaining (`?.`) to improve compatibility with projects which are using older transpilation tooling.
|
|
8
|
+
|
|
9
|
+
## [5.0.1] - 2023-01-10
|
|
10
|
+
### Changed:
|
|
11
|
+
- Updated all types in `typings.d.ts` to be exported. This is to ensure that those types are included in generated documentation of dependent SDKs.
|
|
12
|
+
|
|
5
13
|
## [5.0.0] - 2022-11-30
|
|
6
14
|
This major version release of `js-sdk-common` corresponds to the upcoming releases of the `js-client-sdk` v3 and `react-client-sdk` v3, and cannot be used with earlier SDK versions.
|
|
7
15
|
|
package/package.json
CHANGED
package/src/InspectorManager.js
CHANGED
|
@@ -31,16 +31,17 @@ function InspectorManager(inspectors, logger) {
|
|
|
31
31
|
[InspectorTypes.clientIdentityChanged]: [],
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
const safeInspectors = inspectors
|
|
34
|
+
const safeInspectors = inspectors && inspectors.map(inspector => SafeInspector(inspector, logger));
|
|
35
35
|
|
|
36
|
-
safeInspectors
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
inspectorsByType
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
safeInspectors &&
|
|
37
|
+
safeInspectors.forEach(safeInspector => {
|
|
38
|
+
// Only add inspectors of supported types.
|
|
39
|
+
if (Object.prototype.hasOwnProperty.call(inspectorsByType, safeInspector.type)) {
|
|
40
|
+
inspectorsByType[safeInspector.type].push(safeInspector);
|
|
41
|
+
} else {
|
|
42
|
+
logger.warn(messages.invalidInspector(safeInspector.type, safeInspector.name));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
47
|
* Check if there is an inspector of a specific type registered.
|
|
@@ -48,7 +49,7 @@ function InspectorManager(inspectors, logger) {
|
|
|
48
49
|
* @param {string} type The type of the inspector to check.
|
|
49
50
|
* @returns True if there are any inspectors of that type registered.
|
|
50
51
|
*/
|
|
51
|
-
manager.hasListeners = type => inspectorsByType[type]
|
|
52
|
+
manager.hasListeners = type => inspectorsByType[type] && inspectorsByType[type].length;
|
|
52
53
|
|
|
53
54
|
/**
|
|
54
55
|
* Notify registered inspectors of a flag being used.
|
package/src/configuration.js
CHANGED
package/src/context.js
CHANGED
|
@@ -107,7 +107,7 @@ function getContextKeys(context, logger = commonBasicLogger()) {
|
|
|
107
107
|
Object.entries(context)
|
|
108
108
|
.filter(([key]) => key !== 'kind')
|
|
109
109
|
.forEach(([key, value]) => {
|
|
110
|
-
if (value
|
|
110
|
+
if (value && value.key) {
|
|
111
111
|
keys[key] = value.key;
|
|
112
112
|
}
|
|
113
113
|
});
|
package/typings.d.ts
CHANGED