Skip to content

chore: add node-client-sdk types, options validation, and basic logger#1408

Merged
joker23 merged 3 commits into
mainfrom
skz/sdk-2195/node-client-sdk-next-port-client-config-foundation
Jun 4, 2026
Merged

chore: add node-client-sdk types, options validation, and basic logger#1408
joker23 merged 3 commits into
mainfrom
skz/sdk-2195/node-client-sdk-next-port-client-config-foundation

Conversation

@joker23

@joker23 joker23 commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Note

Low Risk
Mostly new types, validation, and tests with no full client implementation wired yet; TLS disable warning is intentional security messaging.

Overview
Expands the Node client-side SDK surface with typed public APIs and runtime option handling ahead of wiring up createClient.

NodeOptions now extends shared LDOptions and adds initialConnectionMode, plugins, hash, plus existing Node fields (TLS, cache path, event compression). New validateOptions applies defaults (e.g. streaming mode, empty plugins), type-checks each Node-specific field with compile-time coverage for new options, warns on bad types, and flags insecure tlsParams.rejectUnauthorized: false. filterToBaseOptions strips Node-only keys before the common validator runs.

Adds LDClient (Node-specific identify, start, connection mode helpers), LDPlugin, and a large LDCommon type re-export barrel. basicLogger wraps shared BasicLogger with Node console + util.format.

NodePlatform now takes a ValidatedOptions pick instead of raw NodeOptions. Contract-test ESLint override removed; @types/node added as a dev dependency. Jest tests cover defaults, passthrough, invalid values, TLS warning, and base-option stripping.

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

@github-actions

github-actions Bot commented Jun 2, 2026

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

github-actions Bot commented Jun 2, 2026

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

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

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

@joker23

joker23 commented Jun 2, 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!

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

Reviewed by Cursor Bugbot for commit 1834a92. Configure here.

@joker23 joker23 marked this pull request as ready for review June 2, 2026 17:22
@joker23 joker23 requested a review from a team as a code owner June 2, 2026 17:22

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

@joker23 joker23 force-pushed the skz/sdk-2195/node-client-sdk-next-port-client-config-foundation branch from 1834a92 to bbdf442 Compare June 3, 2026 20:51
This cleans up unused dependencies after we upgraded to eslint 9
options.destination ??
((line: string) => {
// eslint-disable-next-line no-console
console.log(line);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lots of stuff will be needed in the changelog, but I assume the old node client still logged everything as an error? So item for the changelog.

export interface LDClient extends Omit<LDClientBase, 'identify'> {
/**
* Identifies a context to LaunchDarkly and returns a promise which resolves to an object
* containing the result of the identify operation.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if we need something this being for subsequent contexts and not the initial context for which you use start. (And then also updating others to have similar wording.)

*/
start(options?: LDStartOptions): Promise<LDWaitForInitializationResult>;

/**

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we want more robust wording on this as well.

*
* @see https://docs.launchdarkly.com/sdk/features/secure-mode
*/
hash?: string;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I always forget that we made node a web SDK.

@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.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b46eddb. Configure here.

if (value !== undefined) {
if (validator.is(value)) {
// @ts-ignore The type inference has some problems here.
output[key as keyof ValidatedOptions] = value as any;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Null tlsParams passes validation

Medium Severity

validateOptions treats tlsParams: null as valid because it only skips undefined and TypeValidators.Object accepts null in JavaScript. Validated output can then pass null into NodeRequests / EventSource TLS settings instead of falling back or warning.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b46eddb. Configure here.

tlsParams: TypeValidators.Object,
enableEventCompression: TypeValidators.Boolean,
initialConnectionMode: new ConnectionModeValidator(),
plugins: TypeValidators.createTypeArray('LDPlugin[]', {}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Plugin array allows null entries

Low Severity

The plugins validator uses createTypeArray with an object example, so each array element is only checked with typeof val === 'object'. In JavaScript, typeof null === 'object', so plugins: [null] passes validation without a warning.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b46eddb. Configure here.

@joker23 joker23 force-pushed the skz/sdk-2195/node-client-sdk-next-port-client-config-foundation branch from b46eddb to cea18dc Compare June 4, 2026 16:44
@joker23 joker23 merged commit b9297b8 into main Jun 4, 2026
47 checks passed
@joker23 joker23 deleted the skz/sdk-2195/node-client-sdk-next-port-client-config-foundation branch June 4, 2026 16:54
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.

2 participants