chore(node-client-sdk): adding ability to override storage implementation#1753
chore(node-client-sdk): adding ability to override storage implementation#1753joker23 wants to merge 3 commits into
Conversation
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk-common size report |
|
@launchdarkly/js-client-sdk size report |
|
@launchdarkly/browser size report |
cff0359 to
a07f16b
Compare
| * key mode. Setting both `useMobileKey: true` and `hash` will cause | ||
| * {@link createClient} to throw. | ||
| */ | ||
| useMobileKey?: boolean; |
There was a problem hiding this comment.
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.
|
@cursor review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
1 issue from previous review remains unresolved.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit bb337ef. Configure here.
4f04732 to
680f73b
Compare

This PR will add
storageoption, which takes in an implementation of the LDStorage interface. When this option is present, we will ignorelocalStoragePathoption and wholesale replace the default storage implementation.We also considered introducing the
storageoption 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
storageoption on the Node client SDK so apps can plug in a customLDStorage(get/set/clear) for the flag and anonymous-key cache.NodePlatformusescreateSafeStoragewhenstorageis set; otherwise it keeps the file-backedNodeStorage. Setting bothlocalStoragePathandstoragelogs a warning andlocalStoragePathis ignored.Option validation now checks
storageshape,localStoragePathtyping, and defaultsuseMobileKeytofalse, with a hard error ifuseMobileKeyand secure-modehashare both set. Public API docs forlocalStoragePath/storageare updated;resetNodeStorageis 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.4→0.0.1).Reviewed by Cursor Bugbot for commit 680f73b. Bugbot is set up for automated code reviews on this repo. Configure here.