@launchdarkly/js-server-sdk-common
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -5,2 +5,10 @@ # Changelog | ||
## [1.2.2](https://github.com/launchdarkly/js-core/compare/js-server-sdk-common-v1.2.1...js-server-sdk-common-v1.2.2) (2023-08-28) | ||
### Bug Fixes | ||
* Client cannot become un-initialized. ([#251](https://github.com/launchdarkly/js-core/issues/251)) ([e2e8971](https://github.com/launchdarkly/js-core/commit/e2e8971fc1945a1121649ca84b752eb5d819aedd)) | ||
* Dispatch change events after ready event. ([#252](https://github.com/launchdarkly/js-core/issues/252)) ([2e2a865](https://github.com/launchdarkly/js-core/commit/2e2a8653671b7e7c814446ccb7ba696e301e81bb)) | ||
## [1.2.1](https://github.com/launchdarkly/js-core/compare/js-server-sdk-common-v1.2.0...js-server-sdk-common-v1.2.1) (2023-08-24) | ||
@@ -7,0 +15,0 @@ |
@@ -46,21 +46,24 @@ "use strict"; | ||
this.featureStore.init(allData, () => { | ||
this.dependencyTracker.reset(); | ||
Object.entries(allData).forEach(([namespace, items]) => { | ||
Object.keys(items || {}).forEach((key) => { | ||
const item = items[key]; | ||
this.dependencyTracker.updateDependenciesFrom(namespace, key, computeDependencies(namespace, item)); | ||
// Defer change events so they execute after the callback. | ||
Promise.resolve().then(() => { | ||
this.dependencyTracker.reset(); | ||
Object.entries(allData).forEach(([namespace, items]) => { | ||
Object.keys(items || {}).forEach((key) => { | ||
const item = items[key]; | ||
this.dependencyTracker.updateDependenciesFrom(namespace, key, computeDependencies(namespace, item)); | ||
}); | ||
}); | ||
if (checkForChanges) { | ||
const updatedItems = new NamespacedDataSet_1.default(); | ||
Object.keys(allData).forEach((namespace) => { | ||
const oldDataForKind = (oldData === null || oldData === void 0 ? void 0 : oldData[namespace]) || {}; | ||
const newDataForKind = allData[namespace]; | ||
const mergedData = Object.assign(Object.assign({}, oldDataForKind), newDataForKind); | ||
Object.keys(mergedData).forEach((key) => { | ||
this.addIfModified(namespace, key, oldDataForKind && oldDataForKind[key], newDataForKind && newDataForKind[key], updatedItems); | ||
}); | ||
}); | ||
this.sendChangeEvents(updatedItems); | ||
} | ||
}); | ||
if (checkForChanges) { | ||
const updatedItems = new NamespacedDataSet_1.default(); | ||
Object.keys(allData).forEach((namespace) => { | ||
const oldDataForKind = (oldData === null || oldData === void 0 ? void 0 : oldData[namespace]) || {}; | ||
const newDataForKind = allData[namespace]; | ||
const mergedData = Object.assign(Object.assign({}, oldDataForKind), newDataForKind); | ||
Object.keys(mergedData).forEach((key) => { | ||
this.addIfModified(namespace, key, oldDataForKind && oldDataForKind[key], newDataForKind && newDataForKind[key], updatedItems); | ||
}); | ||
}); | ||
this.sendChangeEvents(updatedItems); | ||
} | ||
callback === null || callback === void 0 ? void 0 : callback(); | ||
@@ -89,8 +92,11 @@ }); | ||
this.featureStore.upsert(kind, data, () => { | ||
this.dependencyTracker.updateDependenciesFrom(kind.namespace, key, computeDependencies(kind.namespace, data)); | ||
if (checkForChanges) { | ||
const updatedItems = new NamespacedDataSet_1.default(); | ||
this.addIfModified(kind.namespace, key, oldItem, data, updatedItems); | ||
this.sendChangeEvents(updatedItems); | ||
} | ||
// Defer change events so they execute after the callback. | ||
Promise.resolve().then(() => { | ||
this.dependencyTracker.updateDependenciesFrom(kind.namespace, key, computeDependencies(kind.namespace, data)); | ||
if (checkForChanges) { | ||
const updatedItems = new NamespacedDataSet_1.default(); | ||
this.addIfModified(kind.namespace, key, oldItem, data, updatedItems); | ||
this.sendChangeEvents(updatedItems); | ||
} | ||
}); | ||
callback === null || callback === void 0 ? void 0 : callback(); | ||
@@ -97,0 +103,0 @@ }); |
@@ -106,4 +106,6 @@ "use strict"; | ||
this.onFailed(error); | ||
(_a = this.initReject) === null || _a === void 0 ? void 0 : _a.call(this, error); | ||
this.initState = InitState.Failed; | ||
if (!this.initialized()) { | ||
this.initState = InitState.Failed; | ||
(_a = this.initReject) === null || _a === void 0 ? void 0 : _a.call(this, error); | ||
} | ||
} | ||
@@ -110,0 +112,0 @@ else if (!this.initialized()) { |
{ | ||
"name": "@launchdarkly/js-server-sdk-common", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"type": "commonjs", | ||
@@ -51,5 +51,5 @@ "main": "./dist/index.js", | ||
"ts-jest": "^29.0.5", | ||
"typedoc": "0.23.26", | ||
"typescript": "^5.1.6" | ||
"typedoc": "0.24.8", | ||
"typescript": "5.1.6" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
502847
7090