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); }); 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..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. @@ -75,7 +78,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: WRAPPER_NAME, + wrapperVersion: WRAPPER_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",