launchdarkly-node-client-sdk 3.3.1 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,5 +43,6 @@ jobs:
43
43
  with:
44
44
  test_service_port: ${{ env.TEST_SERVICE_PORT }}
45
45
  token: ${{ secrets.GITHUB_TOKEN }}
46
+ extra_params: '--skip-from=${{ github.workspace }}/contract-tests/suppressions.txt'
46
47
  - name: Build Docs
47
48
  run: npm run doc
@@ -7,6 +7,9 @@ on:
7
7
  - edited
8
8
  - synchronize
9
9
 
10
+ permissions:
11
+ pull-requests: read
12
+
10
13
  jobs:
11
14
  lint-pr-title:
12
15
  uses: launchdarkly/gh-actions/.github/workflows/lint-pr-title.yml@main
@@ -8,10 +8,13 @@ on:
8
8
  jobs:
9
9
  release-please:
10
10
  runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write
13
+ pull-requests: write
11
14
  outputs:
12
15
  release_created: ${{ steps.release.outputs.release_created }}
13
16
  steps:
14
- - uses: googleapis/release-please-action@v4
17
+ - uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
15
18
  id: release
16
19
  with:
17
20
  token: ${{secrets.GITHUB_TOKEN}}
@@ -1,9 +1,13 @@
1
- name: 'Close stale issues and PRs'
1
+ name: "Close stale issues and PRs"
2
2
  on:
3
3
  workflow_dispatch:
4
4
  schedule:
5
5
  # Happen once per day at 1:30 AM
6
- - cron: '30 1 * * *'
6
+ - cron: "30 1 * * *"
7
+
8
+ permissions:
9
+ issues: write
10
+ pull-requests: write
7
11
 
8
12
  jobs:
9
13
  sdk-close-stale:
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "3.3.1"
2
+ ".": "3.4.1"
3
3
  }
@@ -7,7 +7,21 @@
7
7
  "languages": [
8
8
  "JavaScript", "TypeScript"
9
9
  ],
10
- "userAgents": ["NodeClientSide"]
10
+ "userAgents": ["NodeClientSide"],
11
+ "features": {
12
+ "allFlags": { "introduced": "1.0" },
13
+ "appMetadata": { "introduced": "2.0.4" },
14
+ "bigSegments": { "introduced": "1.0" },
15
+ "bootstrapping": { "introduced": "1.0" },
16
+ "contexts": { "introduced": "3.0" },
17
+ "experimentation": { "introduced": "1.1" },
18
+ "flagChanges": { "introduced": "1.0" },
19
+ "privateAttrs": { "introduced": "1.0" },
20
+ "relayProxyProxy": { "introduced": "1.0" },
21
+ "secureMode": { "introduced": "1.0" },
22
+ "track": { "introduced": "1.0" },
23
+ "variationDetail": { "introduced": "1.0" }
24
+ }
11
25
  }
12
26
  }
13
27
  }
package/CHANGELOG.md CHANGED
@@ -2,6 +2,32 @@
2
2
 
3
3
  All notable changes to the LaunchDarkly Client-Side SDK for Node.js will be documented in this file.
4
4
 
5
+ ## [3.4.1](https://github.com/launchdarkly/node-client-sdk/compare/3.4.0...3.4.1) (2026-07-20)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * update launchdarkly-js-sdk-common to 5.8.2 ([#72](https://github.com/launchdarkly/node-client-sdk/issues/72)) ([627ddb0](https://github.com/launchdarkly/node-client-sdk/commit/627ddb0fc47ebbaac3dc88f0961fc3f96ce49708))
11
+
12
+ ## [3.4.0](https://github.com/launchdarkly/node-client-sdk/compare/3.3.1...3.4.0) (2026-05-26)
13
+
14
+
15
+ ### Features
16
+
17
+ * add experimental debug override functionality ([532df60](https://github.com/launchdarkly/node-client-sdk/commit/532df60292372fab03f178827bdadc2166f9da02))
18
+ * add hook support ([532df60](https://github.com/launchdarkly/node-client-sdk/commit/532df60292372fab03f178827bdadc2166f9da02))
19
+ * add support for per-context summary events ([532df60](https://github.com/launchdarkly/node-client-sdk/commit/532df60292372fab03f178827bdadc2166f9da02))
20
+ * add support for plugins ([532df60](https://github.com/launchdarkly/node-client-sdk/commit/532df60292372fab03f178827bdadc2166f9da02))
21
+ * add support for the afterTrack stage for hooks ([532df60](https://github.com/launchdarkly/node-client-sdk/commit/532df60292372fab03f178827bdadc2166f9da02))
22
+ * inline context in custom events ([532df60](https://github.com/launchdarkly/node-client-sdk/commit/532df60292372fab03f178827bdadc2166f9da02))
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * add hooks to default options to prevent warning ([532df60](https://github.com/launchdarkly/node-client-sdk/commit/532df60292372fab03f178827bdadc2166f9da02))
28
+ * remove uuid dependency, replace with inline implementation ([532df60](https://github.com/launchdarkly/node-client-sdk/commit/532df60292372fab03f178827bdadc2166f9da02))
29
+ * update launchdarkly-js-sdk-common to 5.8.1 ([532df60](https://github.com/launchdarkly/node-client-sdk/commit/532df60292372fab03f178827bdadc2166f9da02))
30
+
5
31
  ## [3.3.1](https://github.com/launchdarkly/node-client-sdk/compare/3.3.0...3.3.1) (2025-12-02)
6
32
 
7
33
 
package/SECURITY.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Reporting and Fixing Security Issues
2
2
 
3
- Please report all security issues to the LaunchDarkly security team by submitting a bug bounty report to our [HackerOne program](https://hackerone.com/launchdarkly?type=team). LaunchDarkly will triage and address all valid security issues following the response targets defined in our program policy. Valid security issues may be eligible for a bounty.
3
+ **Do not open Issues or Pull Requests for security issues.**
4
+ This will make potential issues publicly visible before LaunchDarkly's Security Team can address them, which could lead to a compromise of the platform and negatively impact our customers.
4
5
 
5
- Please do not open issues or pull requests for security issues. This makes the problem immediately visible to everyone, including potentially malicious actors.
6
+ Security issues must be reported through our [Bug Bounty program](https://bugcrowd.com/engagements/launchdarkly-mbb-og), following the program policy, for triage and remediation by the LaunchDarkly Security Team. Valid security issues may be eligible for a bounty.
7
+
8
+ Please do not attempt to directly contact members of LaunchDarkly staff.
@@ -0,0 +1,61 @@
1
+ let postChain = Promise.resolve();
2
+
3
+ function safePost(url, body) {
4
+ postChain = postChain.then(() =>
5
+ fetch(url, {
6
+ method: 'POST',
7
+ headers: { 'Content-Type': 'application/json' },
8
+ body: JSON.stringify(body),
9
+ }).catch(() => {})
10
+ );
11
+ }
12
+
13
+ class TestHook {
14
+ constructor(name, endpoint, data, errors) {
15
+ this.hookName = name;
16
+ this.endpoint = endpoint;
17
+ this.hookData = data || {};
18
+ this.hookErrors = errors || {};
19
+ }
20
+
21
+ getMetadata() {
22
+ return { name: this.hookName };
23
+ }
24
+
25
+ beforeEvaluation(hookContext, data) {
26
+ if (this.hookErrors.beforeEvaluation) {
27
+ throw new Error(this.hookErrors.beforeEvaluation);
28
+ }
29
+ safePost(this.endpoint, {
30
+ evaluationSeriesContext: hookContext,
31
+ evaluationSeriesData: data,
32
+ stage: 'beforeEvaluation',
33
+ });
34
+ return { ...data, ...(this.hookData.beforeEvaluation || {}) };
35
+ }
36
+
37
+ afterEvaluation(hookContext, data, detail) {
38
+ if (this.hookErrors.afterEvaluation) {
39
+ throw new Error(this.hookErrors.afterEvaluation);
40
+ }
41
+ safePost(this.endpoint, {
42
+ evaluationSeriesContext: hookContext,
43
+ evaluationSeriesData: data,
44
+ evaluationDetail: detail,
45
+ stage: 'afterEvaluation',
46
+ });
47
+ return { ...data, ...(this.hookData.afterEvaluation || {}) };
48
+ }
49
+
50
+ afterTrack(hookContext) {
51
+ if (this.hookErrors.afterTrack) {
52
+ throw new Error(this.hookErrors.afterTrack);
53
+ }
54
+ safePost(this.endpoint, {
55
+ trackSeriesContext: hookContext,
56
+ stage: 'afterTrack',
57
+ });
58
+ }
59
+ }
60
+
61
+ module.exports = { TestHook };
@@ -25,8 +25,11 @@ app.get('/', (req, res) => {
25
25
  'tags',
26
26
  'user-type',
27
27
  'inline-context',
28
- 'anonymous-redaction',
28
+ 'inline-context-all',
29
29
  'client-prereq-events',
30
+ 'client-per-context-summaries',
31
+ 'evaluation-hooks',
32
+ 'track-hooks',
30
33
  ],
31
34
  });
32
35
  });
@@ -1,6 +1,7 @@
1
1
  const ld = require('launchdarkly-node-client-sdk');
2
2
 
3
3
  const { Log, sdkLogger } = require('./log');
4
+ const { TestHook } = require('./TestHook');
4
5
 
5
6
  const badCommandError = new Error('unsupported command');
6
7
 
@@ -60,6 +61,12 @@ function makeSdkConfig(options, tag) {
60
61
  };
61
62
  }
62
63
 
64
+ if (options.hooks) {
65
+ cf.hooks = options.hooks.hooks.map(
66
+ hook => new TestHook(hook.name, hook.callbackUri, hook.data, hook.errors)
67
+ );
68
+ }
69
+
63
70
  return cf;
64
71
  }
65
72
 
@@ -0,0 +1,2 @@
1
+ hooks/evaluation/executes beforeEvaluation hooks in registration order
2
+ hooks/track/executes afterTrack hooks in registration order
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "launchdarkly-node-client-sdk",
3
- "version": "3.3.1",
3
+ "version": "3.4.1",
4
4
  "description": "LaunchDarkly Client-Side SDK for Node.js",
5
5
  "author": "LaunchDarkly <team@launchdarkly.com>",
6
6
  "license": "Apache-2.0",
@@ -66,7 +66,7 @@
66
66
  },
67
67
  "dependencies": {
68
68
  "launchdarkly-eventsource": "2.0.3",
69
- "launchdarkly-js-sdk-common": "5.4.0",
69
+ "launchdarkly-js-sdk-common": "5.8.2",
70
70
  "node-localstorage": "^1.3.1"
71
71
  },
72
72
  "repository": {
@@ -30,7 +30,7 @@ describe('LDClient', () => {
30
30
  const trackEvent = events[1];
31
31
  expect(trackEvent.kind).toEqual('custom');
32
32
  expect(trackEvent.key).toEqual('eventkey');
33
- expect(trackEvent.contextKeys).toEqual({ user: 'user' });
33
+ expect(trackEvent.context).toEqual({ kind: 'user', key: 'user' });
34
34
  expect(trackEvent.data).toEqual(data);
35
35
  expect(trackEvent.url).toEqual(null);
36
36
  });