feat: Add Node platform abstraction for node-client#1393
Conversation
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk size report |
|
@launchdarkly/js-client-sdk-common size report |
|
@launchdarkly/browser size report |
|
@cursor review |
|
@cursor review |
There was a problem hiding this comment.
Old sdk used a package for storage and we implement it here. A lot of this logic is ported from what we have in the electron sdk for reference.
|
|
||
| encoding?: platform.Encoding = new NodeEncoding(); | ||
|
|
||
| storage?: platform.Storage; |
There was a problem hiding this comment.
I think we should allow for overriding the storage. Similar to what we do in the react-native sdk
e92eaf7 to
1f7be22
Compare
fef5d25 to
8eb2ea3
Compare
Summary
@launchdarkly/node-client-sdk:HeaderWrapper,NodeCrypto,NodeEncoding,NodeInfo,NodePlatform,NodeRequests,NodeResponse,NodeStorage. These implement thePlatformcontract from@launchdarkly/js-client-sdk-common.@launchdarkly/js-client-sdk-common,https-proxy-agent,launchdarkly-eventsource.packages/sdk/node-client/tsconfig.jsontomodule: ESNext+moduleResolution: bundler(tsup handles emit), addsesModuleInterop,types: ["jest", "node"],skipLibCheck. Matches the pattern used bypackages/sdk/server-ai.launchdarkly-node-client-sdkinto js-core. Follows PR chore: scaffolding node-client-sdk migration #1352 (scaffold).Note
Medium Risk
New networking (TLS/proxy), persistent cache I/O, and crypto primitives affect how the SDK talks to LaunchDarkly and stores user data; behavior is heavily tested but not yet covered by contract tests.
Overview
Adds the Node
Platformimplementation for@launchdarkly/node-client-sdkso the shared client can run on Node: crypto/encoding/info, HTTP/SSE viaNodeRequests(proxy/TLS agents, optional POST gzip,launchdarkly-eventsource), fetch-like responses/headers, and file-backedNodeStoragewith a process singleton and error-logging wrapper inNodePlatform.Introduces
NodeOptions(proxy, TLS, compression, cache path, logger), wires runtime deps (js-client-sdk-common,https-proxy-agent,launchdarkly-eventsource), and adds Jest coverage plus a GitHub Actions matrix (Node 18/22) for the workspace. TypeScript moves toESNext/bundlerresolution for tsup; release-please bumps version inNodeInfo.ts.Reviewed by Cursor Bugbot for commit ca22e5d. Bugbot is set up for automated code reviews on this repo. Configure here.