Skip to content

Commit a7556bb

Browse files
authored
Merge branch 'main' into feat/providers-aws-ssm
2 parents 5f953a9 + ca4db10 commit a7556bb

File tree

14 files changed

+70
-18
lines changed

14 files changed

+70
-18
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"checkObsoleteDependencies": true,
5757
"checkVersionMismatches": true,
5858
"ignoredDependencies": ["jest-cucumber", "jest"],
59-
"ignoredFiles": ["**/*.spec.ts", "**/*.spec.js", "**/*.test.ts", "**/*.test.js"]
59+
"ignoredFiles": ["**/test/**", "**/spec/**", "**/*.spec.ts", "**/*.spec.js", "**/*.test.ts", "**/*.test.js"]
6060
}
6161
]
6262
}

.release-please-manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"libs/hooks/open-telemetry": "0.4.0",
3-
"libs/providers/go-feature-flag": "0.7.5",
3+
"libs/providers/go-feature-flag": "0.7.6",
44
"libs/providers/flagd": "0.13.3",
55
"libs/providers/flagd-web": "0.7.2",
66
"libs/providers/env-var": "0.3.1",
77
"libs/providers/config-cat": "0.7.3",
8-
"libs/providers/launchdarkly-client": "0.3.1",
8+
"libs/providers/launchdarkly-client": "0.3.2",
99
"libs/providers/go-feature-flag-web": "0.2.5",
1010
"libs/shared/flagd-core": "1.0.0",
11-
"libs/shared/ofrep-core": "1.0.0",
11+
"libs/shared/ofrep-core": "1.0.1",
1212
"libs/providers/ofrep": "0.2.1",
1313
"libs/providers/ofrep-web": "0.3.2",
1414
"libs/providers/flipt": "0.1.2",

libs/providers/go-feature-flag/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [0.7.6](https://github.com/open-feature/js-sdk-contrib/compare/go-feature-flag-provider-v0.7.5...go-feature-flag-provider-v0.7.6) (2025-03-12)
4+
5+
6+
### 🐛 Bug Fixes
7+
8+
* **deps:** update dependency axios to v1.8.2 [security] ([#1222](https://github.com/open-feature/js-sdk-contrib/issues/1222)) ([ed50496](https://github.com/open-feature/js-sdk-contrib/commit/ed504968d93c77d4e049ad11d0eb55fcdbc8ff83))
9+
310
## [0.7.5](https://github.com/open-feature/js-sdk-contrib/compare/go-feature-flag-provider-v0.7.4...go-feature-flag-provider-v0.7.5) (2025-02-07)
411

512

libs/providers/go-feature-flag/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openfeature/go-feature-flag-provider",
3-
"version": "0.7.5",
3+
"version": "0.7.6",
44
"license": "Apache-2.0",
55
"scripts": {
66
"publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [ \"$(npm show $npm_package_name@$npm_package_version version)\" = \"$(npm run current-version -s)\" ]; then echo 'already published, skipping'; else npm publish --access public; fi",
@@ -12,7 +12,7 @@
1212
"dependencies": {
1313
"object-hash": "^3.0.0",
1414
"lru-cache": "^11.0.0",
15-
"axios": "1.7.9",
15+
"axios": "1.8.2",
1616
"copy-anything": "^3.0.5"
1717
}
1818
}

libs/providers/launchdarkly-client/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## [0.3.2](https://github.com/open-feature/js-sdk-contrib/compare/launchdarkly-client-provider-v0.3.1...launchdarkly-client-provider-v0.3.2) (2025-03-12)
4+
5+
6+
### ✨ New Features
7+
8+
* **launchdarkly-client-provider:** Add tracking API ([#1219](https://github.com/open-feature/js-sdk-contrib/issues/1219)) ([e888d03](https://github.com/open-feature/js-sdk-contrib/commit/e888d03fcae56a32edbb0edb1d7e0ee594588ac4))
9+
10+
11+
### 🧹 Chore
12+
13+
* update nx packages ([#1147](https://github.com/open-feature/js-sdk-contrib/issues/1147)) ([7f310fe](https://github.com/open-feature/js-sdk-contrib/commit/7f310fe87101b8aa793e1436e63c7602ccc202e3))
14+
315
## [0.3.1](https://github.com/open-feature/js-sdk-contrib/compare/launchdarkly-client-provider-v0.3.0...launchdarkly-client-provider-v0.3.1) (2024-12-17)
416

517

libs/providers/launchdarkly-client/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ await OpenFeature.setContext({ key: 'my-key' });
5959

6060
Read more about LD contexts [here](https://launchdarkly.github.io/js-client-sdk/interfaces/LDContextCommon.html)
6161

62+
## Tracking
63+
64+
You can send custom events to LaunchDarkly metrics for use in
65+
experiments and guarded rollouts. To learn more, read [Sending custom events](https://launchdarkly.com/docs/sdk/features/events).
66+
67+
```ts
68+
const client = await OpenFeature.getClient();
69+
client.track('event-key-123abc', { customProperty: someValue })
70+
```
71+
6272
## Building
6373

6474
Run `nx package providers-launchdarkly-client` to build the library.

libs/providers/launchdarkly-client/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/providers/launchdarkly-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openfeature/launchdarkly-client-provider",
3-
"version": "0.3.1",
3+
"version": "0.3.2",
44
"license": "Apache-2.0",
55
"scripts": {
66
"publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [ \"$(npm show $npm_package_name@$npm_package_version version)\" = \"$(npm run current-version -s)\" ]; then echo 'already published, skipping'; else npm publish --access public; fi",

libs/providers/launchdarkly-client/src/lib/launchdarkly-client-provider.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ describe('LaunchDarklyClientProvider', () => {
2727
waitForInitialization: jest.fn(),
2828
on: jest.fn(),
2929
close: jest.fn(),
30+
track: jest.fn(),
3031
} as unknown as jest.Mocked<LDClient>;
3132

3233
beforeAll(() => {
@@ -376,6 +377,18 @@ describe('LaunchDarklyClientProvider', () => {
376377
});
377378
});
378379

380+
it('calls the client track method properly', async () => {
381+
ldClientMock.track = jest.fn().mockResolvedValue({});
382+
ofClient.track('event-key-123abc', { value: 99.77, currency: 'USD' });
383+
expect(ldClientMock.track).toHaveBeenCalledWith('event-key-123abc', { currency: 'USD' }, 99.77);
384+
385+
ofClient.track('event-key-123abc', { value: 99.77 });
386+
expect(ldClientMock.track).toHaveBeenCalledWith('event-key-123abc', {}, 99.77);
387+
388+
ofClient.track('event-key-123abc', { currency: 'USD' });
389+
expect(ldClientMock.track).toHaveBeenCalledWith('event-key-123abc', { currency: 'USD' }, undefined);
390+
});
391+
379392
describe('onContextChange', () => {
380393
it('logs information about missing keys', async () => {
381394
ldClientMock.identify = jest.fn().mockResolvedValue({});

libs/providers/launchdarkly-client/src/lib/launchdarkly-client-provider.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
OpenFeatureEventEmitter,
1212
ProviderEvents,
1313
ProviderStatus,
14+
TrackingEventDetails,
1415
} from '@openfeature/web-sdk';
1516

1617
import isEmpty from 'lodash.isempty';
@@ -153,6 +154,11 @@ export class LaunchDarklyClientProvider implements Provider {
153154
return wrongTypeResult(defaultValue);
154155
}
155156

157+
track(trackingEventName: string, _context: EvaluationContext, { value, ...details }: TrackingEventDetails): void {
158+
// The LD Client already has the context form the identify method, so we can omit it here.
159+
this.client.track(trackingEventName, details, value);
160+
}
161+
156162
private translateContext(context: EvaluationContext) {
157163
return translateContext(this.logger, context);
158164
}

0 commit comments

Comments
 (0)