@launchdarkly/cloudflare-server-sdk 2.4.2 → 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 +14 -0
- package/README.md +13 -2
- 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
|
@@ -21,6 +21,20 @@ All notable changes to the LaunchDarkly SDK for Cloudflare Workers will be docum
|
|
|
21
21
|
* devDependencies
|
|
22
22
|
* @launchdarkly/js-server-sdk-common-edge bumped from 2.2.1 to 2.2.2
|
|
23
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
|
+
|
|
24
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)
|
|
25
39
|
|
|
26
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
|
|