Skip to content

chore(node-client-sdk): adding ability to override storage implementation#1753

Open
joker23 wants to merge 3 commits into
mainfrom
skz/sdk-2195/node-client-sdk-next-storage-api
Open

chore(node-client-sdk): adding ability to override storage implementation#1753
joker23 wants to merge 3 commits into
mainfrom
skz/sdk-2195/node-client-sdk-next-storage-api

Conversation

@joker23

@joker23 joker23 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

This PR will add storage option, which takes in an implementation of the LDStorage interface. When this option is present, we will ignore localStoragePath option and wholesale replace the default storage implementation.

We also considered introducing the storage option as a discriminated union eg { type: "custom", implementation: <storage impl> } and { type: "local", path: "." }, but I decided against it as having a flat option like this is easier to understand/interact with in my opinion.


Note

Medium Risk
Custom storage affects persistent flag/cache behavior across SDK instances; misconfiguration or failing backends are mitigated by safe storage but still change runtime semantics. The unrelated sdkVersion bump in NodeInfo may affect telemetry/version reporting.

Overview
Adds a storage option on the Node client SDK so apps can plug in a custom LDStorage (get / set / clear) for the flag and anonymous-key cache. NodePlatform uses createSafeStorage when storage is set; otherwise it keeps the file-backed NodeStorage. Setting both localStoragePath and storage logs a warning and localStoragePath is ignored.

Option validation now checks storage shape, localStoragePath typing, and defaults useMobileKey to false, with a hard error if useMobileKey and secure-mode hash are both set. Public API docs for localStoragePath / storage are updated; resetNodeStorage is no longer exported from the package entry.

Tests cover custom storage wiring, safe-storage error handling, and the new validation rules. The diff also changes the embedded SDK version string in NodeInfo (0.0.40.0.1).

Reviewed by Cursor Bugbot for commit 680f73b. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 26365 bytes
Compressed size limit: 29000
Uncompressed size: 129044 bytes

@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 38739 bytes
Compressed size limit: 39000
Uncompressed size: 212244 bytes

@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 31978 bytes
Compressed size limit: 34000
Uncompressed size: 114243 bytes

@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 179579 bytes
Compressed size limit: 200000
Uncompressed size: 831422 bytes

@joker23 joker23 force-pushed the skz/sdk-2195/node-client-sdk-next-storage-api branch from cff0359 to a07f16b Compare June 17, 2026 18:52
* key mode. Setting both `useMobileKey: true` and `hash` will cause
* {@link createClient} to throw.
*/
useMobileKey?: boolean;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not wired yet and will come in the next PR. But would like some early feedback here if we do not think we should also support mobile keys.

@joker23

joker23 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

@cursor review

cursor[bot]

This comment was marked as resolved.

@joker23

joker23 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

1 issue from previous review remains unresolved.

Fix All in Cursor

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit bb337ef. Configure here.

@joker23 joker23 marked this pull request as ready for review June 17, 2026 19:29
@joker23 joker23 requested a review from a team as a code owner June 17, 2026 19:29
devin-ai-integration[bot]

This comment was marked as resolved.

@joker23 joker23 force-pushed the skz/sdk-2195/node-client-sdk-next-storage-api branch from 4f04732 to 680f73b Compare June 17, 2026 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant