Skip to content

Commit 0ea135a

Browse files
committed
adding placeholder applyChanges to PersistentDataStoreWrapper
1 parent 35a565c commit 0ea135a

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

packages/shared/sdk-server/src/options/Configuration.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ const validations: Record<string, TypeValidator> = {
5959
hooks: TypeValidators.createTypeArray('Hook[]', {}),
6060
};
6161

62-
63-
6462
/**
6563
* @internal
6664
*/

packages/shared/sdk-server/src/store/PersistentDataStoreWrapper.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,19 @@ export default class PersistentDataStoreWrapper implements LDFeatureStore {
258258
_selector: String | undefined,
259259
_callback: () => void,
260260
): void {
261-
// TODO: implement
261+
// TODO: SDK-1029 - Transactional persistent store - update this to not iterate over items and instead send data to underlying PersistentDataStore
262+
// no need for queue at the moment as init and upsert handle that, but as part of SDK-1029, queue may be needed
263+
if (_basis) {
264+
this.init(_data, _callback);
265+
} else {
266+
Object.entries(_data).forEach(([namespace, items]) => {
267+
Object.keys(items || {}).forEach((key) => {
268+
const item = items[key];
269+
this.upsert({ namespace }, { key, ...item }, () => {});
270+
});
271+
});
272+
_callback();
273+
}
262274
}
263275

264276
close(): void {

0 commit comments

Comments
 (0)