@launchdarkly/cloudflare-server-sdk 2.4.1 → 2.5.0
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.
- package/CHANGELOG.md +20 -0
- package/README.md +15 -3
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,26 @@ All notable changes to the LaunchDarkly SDK for Cloudflare Workers will be docum
|
|
|
15
15
|
* devDependencies
|
|
16
16
|
* @launchdarkly/js-server-sdk-common-edge bumped from 2.1.1 to 2.1.2
|
|
17
17
|
|
|
18
|
+
### Dependencies
|
|
19
|
+
|
|
20
|
+
* The following workspace dependencies were updated
|
|
21
|
+
* devDependencies
|
|
22
|
+
* @launchdarkly/js-server-sdk-common-edge bumped from 2.2.1 to 2.2.2
|
|
23
|
+
|
|
24
|
+
## [2.5.0](https://github.com/launchdarkly/js-core/compare/cloudflare-server-sdk-v2.4.2...cloudflare-server-sdk-v2.5.0) (2024-04-09)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* JSR support for Cloudflare SDK. ([#415](https://github.com/launchdarkly/js-core/issues/415)) ([30866f3](https://github.com/launchdarkly/js-core/commit/30866f34a41b74e2cf08457f2382c647bc37bd64))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Dependencies
|
|
33
|
+
|
|
34
|
+
* The following workspace dependencies were updated
|
|
35
|
+
* devDependencies
|
|
36
|
+
* @launchdarkly/js-server-sdk-common-edge bumped from 2.2.2 to 2.2.3
|
|
37
|
+
|
|
18
38
|
## [2.4.1](https://github.com/launchdarkly/js-core/compare/cloudflare-server-sdk-v2.4.0...cloudflare-server-sdk-v2.4.1) (2024-03-15)
|
|
19
39
|
|
|
20
40
|
|
package/README.md
CHANGED
|
@@ -15,7 +15,14 @@ For more information, see the [complete reference guide for this SDK](https://do
|
|
|
15
15
|
## Install
|
|
16
16
|
|
|
17
17
|
```shell
|
|
18
|
+
# npm
|
|
18
19
|
npm i @launchdarkly/cloudflare-server-sdk
|
|
20
|
+
|
|
21
|
+
# yarn
|
|
22
|
+
yarn add @launchdarkly/cloudflare-server-sdk
|
|
23
|
+
|
|
24
|
+
# jsr
|
|
25
|
+
npx jsr add @launchdarkly/cloudflare-server-sdk
|
|
19
26
|
```
|
|
20
27
|
|
|
21
28
|
Then turn on the Node.js compatibility flag in your `wrangler.toml`. This allows the SDK to use `node:events`:
|
|
@@ -24,6 +31,10 @@ Then turn on the Node.js compatibility flag in your `wrangler.toml`. This allows
|
|
|
24
31
|
compatibility_flags = [ "nodejs_compat" ]
|
|
25
32
|
```
|
|
26
33
|
|
|
34
|
+
## Additional JSR setup
|
|
35
|
+
|
|
36
|
+
If you want to install this package as a JSR package, you will need to use [`esbuild` version >= 19.7](https://github.com/evanw/esbuild/releases/tag/v0.19.7) to enable support for `import attributes`.
|
|
37
|
+
|
|
27
38
|
## Quickstart
|
|
28
39
|
|
|
29
40
|
Initialize the ldClient with your client side sdk key and the [Cloudflare KV namespace](https://developers.cloudflare.com/workers/runtime-apis/kv#kv-bindings):
|
|
@@ -33,12 +44,12 @@ import { init as initLD } from '@launchdarkly/cloudflare-server-sdk';
|
|
|
33
44
|
|
|
34
45
|
export default {
|
|
35
46
|
async fetch(request: Request, env: Bindings): Promise<Response> {
|
|
36
|
-
const
|
|
47
|
+
const clientSideID = 'test-client-side-id';
|
|
37
48
|
const flagKey = 'testFlag1';
|
|
38
49
|
const context = { kind: 'user', key: 'test-user-key-1' };
|
|
39
50
|
|
|
40
51
|
// init the ldClient, wait and finally evaluate
|
|
41
|
-
const client = initLD(
|
|
52
|
+
const client = initLD(clientSideID, env.LD_KV);
|
|
42
53
|
await client.waitForInitialization();
|
|
43
54
|
const flagValue = await client.variation(flagKey, context, false);
|
|
44
55
|
|
|
@@ -69,7 +80,8 @@ LaunchDarkly uses the [SLSA framework](https://slsa.dev/spec/v1.0/about) (Supply
|
|
|
69
80
|
- Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
|
|
70
81
|
- Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
|
|
71
82
|
- Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
|
|
72
|
-
- Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan).
|
|
83
|
+
- Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan).
|
|
84
|
+
- Disable parts of your application to facilitate maintenance, without taking everything offline.
|
|
73
85
|
- LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read [our documentation](https://docs.launchdarkly.com/sdk) for a complete list.
|
|
74
86
|
- Explore LaunchDarkly
|
|
75
87
|
- [launchdarkly.com](https://www.launchdarkly.com/ 'LaunchDarkly Main Website') for more information
|