From 96dd7eeaa1086fd990db80974d2081fc7f1bfff2 Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Mon, 11 Aug 2025 14:04:37 -0700 Subject: [PATCH 1/3] feat: Add wrapper information to the LaunchDarkly client-side provider. Signed-off-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> --- .../src/lib/launchdarkly-client-provider.ts | 7 ++++++- release-please-config.json | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libs/providers/launchdarkly-client/src/lib/launchdarkly-client-provider.ts b/libs/providers/launchdarkly-client/src/lib/launchdarkly-client-provider.ts index 0e666fe1c..3cded682d 100644 --- a/libs/providers/launchdarkly-client/src/lib/launchdarkly-client-provider.ts +++ b/libs/providers/launchdarkly-client/src/lib/launchdarkly-client-provider.ts @@ -75,7 +75,12 @@ export class LaunchDarklyClientProvider implements Provider { this.logger = basicLogger({ level: 'info' }); } this.initializationTimeout = initializationTimeout; - this.ldOptions = { ...ldOptions, logger: this.logger }; + this.ldOptions = { + ...ldOptions, + logger: this.logger, + wrapperName: 'open-feature-community-js-client', + wrapperVersion: '0.3.2', // {{ x-release-please-version }} + }; } private get client(): LDClient { diff --git a/release-please-config.json b/release-please-config.json index b807055d1..05ac57ed5 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -63,7 +63,10 @@ "prerelease": false, "bump-minor-pre-major": true, "bump-patch-for-minor-pre-major": true, - "versioning": "default" + "versioning": "default", + "extra-files": [ + "src/lib/launchdarkly-client-provider.ts" + ] }, "libs/providers/go-feature-flag-web": { "release-type": "node", From cf358038f5dbb445844d05ae3bb0ca0f603694de Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Mon, 11 Aug 2025 14:23:04 -0700 Subject: [PATCH 2/3] Fix tests for LaunchDarkly provider. Signed-off-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> --- .../lib/launchdarkly-client-provider.spec.ts | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/libs/providers/launchdarkly-client/src/lib/launchdarkly-client-provider.spec.ts b/libs/providers/launchdarkly-client/src/lib/launchdarkly-client-provider.spec.ts index 3b96a1c11..a2baa0e29 100644 --- a/libs/providers/launchdarkly-client/src/lib/launchdarkly-client-provider.spec.ts +++ b/libs/providers/launchdarkly-client/src/lib/launchdarkly-client-provider.spec.ts @@ -68,7 +68,12 @@ describe('LaunchDarklyClientProvider', () => { const provider = new LaunchDarklyClientProvider(envKey, { logger, ...ldOptionsMock }); - expect(provider['ldOptions']).toStrictEqual({ ...ldOptionsMock, logger }); + expect(provider['ldOptions']).toStrictEqual({ + ...ldOptionsMock, + logger, + wrapperName: 'open-feature-community-js-client', + wrapperVersion: expect.any(String), + }); }); }); @@ -81,7 +86,15 @@ describe('LaunchDarklyClientProvider', () => { await provider.initialize(); expect(initialize).toHaveBeenCalledTimes(1); /* when not set in open feauture LD sdk initialize should be called with the anonymous context*/ - expect(initialize).toHaveBeenCalledWith(envKey, { anonymous: true }, { logger }); + expect(initialize).toHaveBeenCalledWith( + envKey, + { anonymous: true }, + { + logger, + wrapperName: 'open-feature-community-js-client', + wrapperVersion: expect.any(String), + }, + ); expect(ldClientMock.waitForInitialization).toHaveBeenCalledWith(undefined); }); @@ -90,7 +103,15 @@ describe('LaunchDarklyClientProvider', () => { await provider.initialize(); expect(initialize).toHaveBeenCalledTimes(1); /* when not set in open feauture LD sdk initialize should be called with the anonymous context*/ - expect(initialize).toHaveBeenCalledWith(envKey, { anonymous: true }, { logger }); + expect(initialize).toHaveBeenCalledWith( + envKey, + { anonymous: true }, + { + logger, + wrapperName: 'open-feature-community-js-client', + wrapperVersion: expect.any(String), + }, + ); expect(ldClientMock.waitForInitialization).toHaveBeenCalledTimes(1); expect(ldClientMock.waitForInitialization).toHaveBeenCalledWith(5); }); From 485d25a69b7f2f82852bfe2b139b765c3922eed3 Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Mon, 11 Aug 2025 14:24:58 -0700 Subject: [PATCH 3/3] Extract to constants. Signed-off-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> --- .../src/lib/launchdarkly-client-provider.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/providers/launchdarkly-client/src/lib/launchdarkly-client-provider.ts b/libs/providers/launchdarkly-client/src/lib/launchdarkly-client-provider.ts index 3cded682d..908b94658 100644 --- a/libs/providers/launchdarkly-client/src/lib/launchdarkly-client-provider.ts +++ b/libs/providers/launchdarkly-client/src/lib/launchdarkly-client-provider.ts @@ -25,6 +25,9 @@ import type { LaunchDarklyProviderOptions } from './launchdarkly-provider-option import translateContext from './translate-context'; import translateResult from './translate-result'; +const WRAPPER_NAME = 'open-feature-community-js-client'; +const WRAPPER_VERSION = '0.3.2'; // {{ x-release-please-version }} + /** * Create a ResolutionDetails for an evaluation that produced a type different * from the expected type. @@ -78,8 +81,8 @@ export class LaunchDarklyClientProvider implements Provider { this.ldOptions = { ...ldOptions, logger: this.logger, - wrapperName: 'open-feature-community-js-client', - wrapperVersion: '0.3.2', // {{ x-release-please-version }} + wrapperName: WRAPPER_NAME, + wrapperVersion: WRAPPER_VERSION, }; }