diff --git a/.eslintrc.js b/.eslintrc.js index 6dd1a6cc9..5f6d01889 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -12,5 +12,11 @@ module.exports = { rules: { 'prettier/prettier': ['error'], 'class-methods-use-this': 'off', + 'import/no-extraneous-dependencies': [ + 'error', + { + devDependencies: ['**/jest*.ts', '**/*.test.ts'], + }, + ], }, }; diff --git a/.github/workflows/server-node.yml b/.github/workflows/server-node.yml index b727a4ca4..7ccaec76d 100644 --- a/.github/workflows/server-node.yml +++ b/.github/workflows/server-node.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: # Node versions to run on. - version: [16, 19] + version: [16, 18] env: TEST_HARNESS_PARAMS: '--skip-from=./contract-tests/testharness-suppressions.txt' diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b1b60e631..db3b667a6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,13 +1,13 @@ { - "packages/shared/common": "1.0.2", - "packages/shared/sdk-server": "1.0.6", - "packages/sdk/server-node": "8.1.0", - "packages/sdk/cloudflare": "2.0.7", - "packages/shared/sdk-server-edge": "1.0.6", - "packages/sdk/vercel": "1.0.1", - "packages/sdk/akamai-base": "1.0.0", - "packages/sdk/akamai-edgekv": "1.0.0", - "packages/shared/akamai-edgeworker-sdk": "0.2.5", - "packages/store/node-server-sdk-dynamodb": "5.0.4", - "packages/store/node-server-sdk-redis": "3.0.4" + "packages/shared/common": "1.1.0", + "packages/shared/sdk-server": "1.1.0", + "packages/sdk/server-node": "8.2.0", + "packages/sdk/cloudflare": "2.1.0", + "packages/shared/sdk-server-edge": "1.0.9", + "packages/sdk/vercel": "1.1.0", + "packages/sdk/akamai-base": "1.0.3", + "packages/sdk/akamai-edgekv": "1.0.3", + "packages/shared/akamai-edgeworker-sdk": "0.3.0", + "packages/store/node-server-sdk-dynamodb": "5.0.7", + "packages/store/node-server-sdk-redis": "3.0.7" } diff --git a/packages/sdk/akamai-base/CHANGELOG.md b/packages/sdk/akamai-base/CHANGELOG.md index 59a38c388..944d01013 100644 --- a/packages/sdk/akamai-base/CHANGELOG.md +++ b/packages/sdk/akamai-base/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to the LaunchDarkly SDK for Akamai Workers will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org). +## [1.0.3](https://github.com/launchdarkly/js-core/compare/akamai-server-base-sdk-v1.0.2...akamai-server-base-sdk-v1.0.3) (2023-08-14) + +### Bug Fixes + +* Allow for negation of segment match clauses. ([#237](https://github.com/launchdarkly/js-core/issues/237)) ([d8e469a](https://github.com/launchdarkly/js-core/commit/d8e469a5e58b90c791fbbee80f7c0fc447c4e42f)) + ### Dependencies * The following workspace dependencies were updated @@ -23,6 +29,35 @@ All notable changes to the LaunchDarkly SDK for Akamai Workers will be documente * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^0.2.4 to ^0.2.5 * @launchdarkly/js-server-sdk-common bumped from ^1.0.5 to ^1.0.6 +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^0.2.5 to ^0.2.6 + * @launchdarkly/js-server-sdk-common bumped from ^1.0.6 to ^1.0.7 + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^0.2.7 to ^0.3.0 + * @launchdarkly/js-server-sdk-common bumped from ^1.0.8 to ^1.1.0 + +## [1.0.2](https://github.com/launchdarkly/js-core/compare/akamai-server-base-sdk-v1.0.1...akamai-server-base-sdk-v1.0.2) (2023-08-10) + + +### Bug Fixes + +* Switch to es2017 target to ensure native async/await. ([a83e4e6](https://github.com/launchdarkly/js-core/commit/a83e4e62d04c66105a1b0e8893640a7ca2d641e4)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^0.2.6 to ^0.2.7 + * @launchdarkly/js-server-sdk-common bumped from ^1.0.7 to ^1.0.8 + ## [1.0.0](https://github.com/launchdarkly/js-core/compare/akamai-server-base-sdk-v0.4.4...akamai-server-base-sdk-v1.0.0) (2023-07-05) diff --git a/packages/sdk/akamai-base/package.json b/packages/sdk/akamai-base/package.json index 29b93da52..a7dabf27f 100644 --- a/packages/sdk/akamai-base/package.json +++ b/packages/sdk/akamai-base/package.json @@ -1,6 +1,6 @@ { "name": "@launchdarkly/akamai-server-base-sdk", - "version": "1.0.0", + "version": "1.0.3", "description": "Akamai LaunchDarkly EdgeWorker SDK", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/akamai-base", "repository": { @@ -73,7 +73,7 @@ "typescript": "^5.1.6" }, "dependencies": { - "@launchdarkly/akamai-edgeworker-sdk-common": "^0.2.5", - "@launchdarkly/js-server-sdk-common": "^1.0.6" + "@launchdarkly/akamai-edgeworker-sdk-common": "^0.3.0", + "@launchdarkly/js-server-sdk-common": "^1.1.0" } } diff --git a/packages/sdk/akamai-base/tsconfig.json b/packages/sdk/akamai-base/tsconfig.json index aa1b75233..763d67b8b 100644 --- a/packages/sdk/akamai-base/tsconfig.json +++ b/packages/sdk/akamai-base/tsconfig.json @@ -3,7 +3,7 @@ // Uses "." so it can load package.json. "rootDir": ".", "outDir": "dist", - "target": "es6", + "target": "es2017", "lib": ["ESNext"], "module": "es6", "strict": true, diff --git a/packages/sdk/akamai-edgekv/CHANGELOG.md b/packages/sdk/akamai-edgekv/CHANGELOG.md index fb5fae1c3..760b2cb7a 100644 --- a/packages/sdk/akamai-edgekv/CHANGELOG.md +++ b/packages/sdk/akamai-edgekv/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to the LaunchDarkly SDK for Akamai Workers will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org). +## [1.0.3](https://github.com/launchdarkly/js-core/compare/akamai-server-edgekv-sdk-v1.0.2...akamai-server-edgekv-sdk-v1.0.3) (2023-08-14) + +### Bug Fixes + +* Allow for negation of segment match clauses. ([#237](https://github.com/launchdarkly/js-core/issues/237)) ([d8e469a](https://github.com/launchdarkly/js-core/commit/d8e469a5e58b90c791fbbee80f7c0fc447c4e42f)) + ### Dependencies * The following workspace dependencies were updated @@ -23,6 +29,35 @@ All notable changes to the LaunchDarkly SDK for Akamai Workers will be documente * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^0.2.4 to ^0.2.5 * @launchdarkly/js-server-sdk-common bumped from ^1.0.5 to ^1.0.6 +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^0.2.5 to ^0.2.6 + * @launchdarkly/js-server-sdk-common bumped from ^1.0.6 to ^1.0.7 + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^0.2.7 to ^0.3.0 + * @launchdarkly/js-server-sdk-common bumped from ^1.0.8 to ^1.1.0 + +## [1.0.2](https://github.com/launchdarkly/js-core/compare/akamai-server-edgekv-sdk-v1.0.1...akamai-server-edgekv-sdk-v1.0.2) (2023-08-10) + + +### Bug Fixes + +* Switch to es2017 target to ensure native async/await. ([a83e4e6](https://github.com/launchdarkly/js-core/commit/a83e4e62d04c66105a1b0e8893640a7ca2d641e4)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^0.2.6 to ^0.2.7 + * @launchdarkly/js-server-sdk-common bumped from ^1.0.7 to ^1.0.8 + ## [1.0.0](https://github.com/launchdarkly/js-core/compare/akamai-server-edgekv-sdk-v0.4.4...akamai-server-edgekv-sdk-v1.0.0) (2023-07-05) diff --git a/packages/sdk/akamai-edgekv/package.json b/packages/sdk/akamai-edgekv/package.json index d27142619..c7f10ea62 100644 --- a/packages/sdk/akamai-edgekv/package.json +++ b/packages/sdk/akamai-edgekv/package.json @@ -1,6 +1,6 @@ { "name": "@launchdarkly/akamai-server-edgekv-sdk", - "version": "1.0.0", + "version": "1.0.3", "description": "Akamai LaunchDarkly EdgeWorker SDK for EdgeKV feature store", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/akamai-edgekv", "repository": { @@ -73,7 +73,7 @@ "typescript": "^5.1.6" }, "dependencies": { - "@launchdarkly/akamai-edgeworker-sdk-common": "^0.2.5", - "@launchdarkly/js-server-sdk-common": "^1.0.6" + "@launchdarkly/akamai-edgeworker-sdk-common": "^0.3.0", + "@launchdarkly/js-server-sdk-common": "^1.1.0" } } diff --git a/packages/sdk/akamai-edgekv/tsconfig.json b/packages/sdk/akamai-edgekv/tsconfig.json index 7a5e98034..647a66011 100644 --- a/packages/sdk/akamai-edgekv/tsconfig.json +++ b/packages/sdk/akamai-edgekv/tsconfig.json @@ -3,7 +3,7 @@ // Uses "." so it can load package.json. "rootDir": ".", "outDir": "dist", - "target": "es6", + "target": "es2017", "lib": ["es6"], "module": "es6", "strict": true, diff --git a/packages/sdk/cloudflare/CHANGELOG.md b/packages/sdk/cloudflare/CHANGELOG.md index 215deaed5..338e5b6be 100644 --- a/packages/sdk/cloudflare/CHANGELOG.md +++ b/packages/sdk/cloudflare/CHANGELOG.md @@ -2,6 +2,23 @@ All notable changes to the LaunchDarkly SDK for Cloudflare Workers will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org). +## [2.1.0](https://github.com/launchdarkly/js-core/compare/cloudflare-server-sdk-v2.0.9...cloudflare-server-sdk-v2.1.0) (2023-08-14) + + +### Features + +* Allow specifying the user agent per-sdk implementation. ([#226](https://github.com/launchdarkly/js-core/issues/226)) ([e57716f](https://github.com/launchdarkly/js-core/commit/e57716f3f6f0ba8568e32b0937903ca46e5470ad)) + +### Bug Fixes + +* Allow for negation of segment match clauses. ([#237](https://github.com/launchdarkly/js-core/issues/237)) ([d8e469a](https://github.com/launchdarkly/js-core/commit/d8e469a5e58b90c791fbbee80f7c0fc447c4e42f)) + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common-edge bumped from 1.0.8 to 1.0.9 + ### Dependencies * The following workspace dependencies were updated @@ -32,6 +49,26 @@ All notable changes to the LaunchDarkly SDK for Cloudflare Workers will be docum * dependencies * @launchdarkly/js-server-sdk-common-edge bumped from 1.0.5 to 1.0.6 +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common-edge bumped from 1.0.6 to 1.0.7 + +## [2.0.9](https://github.com/launchdarkly/js-core/compare/cloudflare-server-sdk-v2.0.8...cloudflare-server-sdk-v2.0.9) (2023-08-10) + + +### Bug Fixes + +* Switch to es2017 target to ensure native async/await. ([a83e4e6](https://github.com/launchdarkly/js-core/commit/a83e4e62d04c66105a1b0e8893640a7ca2d641e4)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common-edge bumped from 1.0.7 to 1.0.8 + ## [2.0.3](https://github.com/launchdarkly/js-core/compare/cloudflare-server-sdk-v2.0.2...cloudflare-server-sdk-v2.0.3) (2023-05-01) diff --git a/packages/sdk/cloudflare/package.json b/packages/sdk/cloudflare/package.json index 8634caa3b..658ee0728 100644 --- a/packages/sdk/cloudflare/package.json +++ b/packages/sdk/cloudflare/package.json @@ -1,6 +1,6 @@ { "name": "@launchdarkly/cloudflare-server-sdk", - "version": "2.0.7", + "version": "2.1.0", "description": "Cloudflare LaunchDarkly SDK", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/cloudflare", "repository": { @@ -39,7 +39,7 @@ }, "dependencies": { "@cloudflare/workers-types": "^4.20230321.0", - "@launchdarkly/js-server-sdk-common-edge": "1.0.6", + "@launchdarkly/js-server-sdk-common-edge": "1.0.9", "crypto-js": "^4.1.1" }, "devDependencies": { diff --git a/packages/sdk/cloudflare/src/createPlatformInfo.ts b/packages/sdk/cloudflare/src/createPlatformInfo.ts index 23ffef15e..e66971d95 100644 --- a/packages/sdk/cloudflare/src/createPlatformInfo.ts +++ b/packages/sdk/cloudflare/src/createPlatformInfo.ts @@ -13,6 +13,7 @@ class CloudflarePlatformInfo implements Info { return { name, version, + userAgentBase: 'CloudflareEdgeSDK', }; } } diff --git a/packages/sdk/cloudflare/tsconfig.json b/packages/sdk/cloudflare/tsconfig.json index ba2b0ea35..3192817ef 100644 --- a/packages/sdk/cloudflare/tsconfig.json +++ b/packages/sdk/cloudflare/tsconfig.json @@ -3,7 +3,7 @@ // Uses "." so it can load package.json. "rootDir": ".", "outDir": "dist", - "target": "es6", + "target": "es2017", "lib": ["es6"], "module": "commonjs", "strict": true, diff --git a/packages/sdk/server-node/CHANGELOG.md b/packages/sdk/server-node/CHANGELOG.md index 03f8a485b..d656c769b 100644 --- a/packages/sdk/server-node/CHANGELOG.md +++ b/packages/sdk/server-node/CHANGELOG.md @@ -2,6 +2,50 @@ All notable changes to `@launchdarkly/node-server-sdk` will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org). +## [8.2.0](https://github.com/launchdarkly/js-core/compare/node-server-sdk-v8.1.2...node-server-sdk-v8.2.0) (2023-08-14) + + +### Features + +* Allow specifying the user agent per-sdk implementation. ([#226](https://github.com/launchdarkly/js-core/issues/226)) ([e57716f](https://github.com/launchdarkly/js-core/commit/e57716f3f6f0ba8568e32b0937903ca46e5470ad)) + +### Bug Fixes + +* Allow for negation of segment match clauses. ([#237](https://github.com/launchdarkly/js-core/issues/237)) ([d8e469a](https://github.com/launchdarkly/js-core/commit/d8e469a5e58b90c791fbbee80f7c0fc447c4e42f)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common bumped from 1.0.8 to 1.1.0 + +## [8.1.2](https://github.com/launchdarkly/js-core/compare/node-server-sdk-v8.1.1...node-server-sdk-v8.1.2) (2023-08-10) + + +### Bug Fixes + +* Switch to es2017 target to ensure native async/await. ([a83e4e6](https://github.com/launchdarkly/js-core/commit/a83e4e62d04c66105a1b0e8893640a7ca2d641e4)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common bumped from 1.0.7 to 1.0.8 + +## [8.1.1](https://github.com/launchdarkly/js-core/compare/node-server-sdk-v8.1.0...node-server-sdk-v8.1.1) (2023-08-03) + +### Bug Fixes + +* Ensure that test data user targets are handled correctly. ([#223](https://github.com/launchdarkly/js-core/issues/223)) ([8a423b2](https://github.com/launchdarkly/js-core/commit/8a423b22282624627200dfda1ebe4207f9db69a6)) + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common bumped from 1.0.6 to 1.0.7 + ### Dependencies * The following workspace dependencies were updated diff --git a/packages/sdk/server-node/package.json b/packages/sdk/server-node/package.json index 1bbf7d3b3..f15f155d4 100644 --- a/packages/sdk/server-node/package.json +++ b/packages/sdk/server-node/package.json @@ -1,6 +1,6 @@ { "name": "@launchdarkly/node-server-sdk", - "version": "8.1.0", + "version": "8.2.0", "description": "LaunchDarkly Server-Side SDK for Node.js", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/server-node", "repository": { @@ -46,7 +46,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@launchdarkly/js-server-sdk-common": "1.0.6", + "@launchdarkly/js-server-sdk-common": "1.1.0", "https-proxy-agent": "^5.0.1", "launchdarkly-eventsource": "2.0.0" }, diff --git a/packages/sdk/server-node/src/platform/NodeInfo.ts b/packages/sdk/server-node/src/platform/NodeInfo.ts index 5c2a2f985..4f3b5a2b6 100644 --- a/packages/sdk/server-node/src/platform/NodeInfo.ts +++ b/packages/sdk/server-node/src/platform/NodeInfo.ts @@ -37,6 +37,7 @@ export default class NodeInfo implements platform.Info { return { name: packageJson.name, version: packageJson.version, + userAgentBase: 'NodeJSClient', // No wrapper name/version at the moment. }; } diff --git a/packages/sdk/server-node/tsconfig.json b/packages/sdk/server-node/tsconfig.json index 1b9ac79b8..e4158b054 100644 --- a/packages/sdk/server-node/tsconfig.json +++ b/packages/sdk/server-node/tsconfig.json @@ -3,7 +3,7 @@ // Uses "." so it can load package.json. "rootDir": ".", "outDir": "dist", - "target": "es6", + "target": "es2017", "lib": ["es6"], "module": "commonjs", "strict": true, diff --git a/packages/sdk/vercel/CHANGELOG.md b/packages/sdk/vercel/CHANGELOG.md index 7100cc175..a7ae37e0e 100644 --- a/packages/sdk/vercel/CHANGELOG.md +++ b/packages/sdk/vercel/CHANGELOG.md @@ -2,6 +2,26 @@ All notable changes to the LaunchDarkly SDK for Vercel Edge Config will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org). +## [1.1.0](https://github.com/launchdarkly/js-core/compare/vercel-server-sdk-v1.0.2...vercel-server-sdk-v1.1.0) (2023-08-14) + + +### Features + +* Allow specifying the user agent per-sdk implementation. ([#226](https://github.com/launchdarkly/js-core/issues/226)) ([e57716f](https://github.com/launchdarkly/js-core/commit/e57716f3f6f0ba8568e32b0937903ca46e5470ad)) + + +### Bug Fixes + +* Allow for negation of segment match clauses. ([#237](https://github.com/launchdarkly/js-core/issues/237)) ([d8e469a](https://github.com/launchdarkly/js-core/commit/d8e469a5e58b90c791fbbee80f7c0fc447c4e42f)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common-edge bumped from 1.0.8 to 1.0.9 + + ### Dependencies * The following workspace dependencies were updated @@ -26,6 +46,26 @@ All notable changes to the LaunchDarkly SDK for Vercel Edge Config will be docum * dependencies * @launchdarkly/js-server-sdk-common-edge bumped from 1.0.5 to 1.0.6 +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common-edge bumped from 1.0.6 to 1.0.7 + +## [1.0.0](https://github.com/launchdarkly/js-core/compare/vercel-server-sdk-v1.0.2...vercel-server-sdk-v1.0.0) (2023-08-10) + + +### Bug Fixes + +* Switch to es2017 target to ensure native async/await. ([a83e4e6](https://github.com/launchdarkly/js-core/commit/a83e4e62d04c66105a1b0e8893640a7ca2d641e4)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common-edge bumped from 1.0.7 to 1.0.8 + ## [1.0.0](https://github.com/launchdarkly/js-core/compare/vercel-server-sdk-v0.4.4...vercel-server-sdk-v1.0.0) (2023-06-28) diff --git a/packages/sdk/vercel/package.json b/packages/sdk/vercel/package.json index e12812c0a..24f571c6d 100644 --- a/packages/sdk/vercel/package.json +++ b/packages/sdk/vercel/package.json @@ -1,6 +1,6 @@ { "name": "@launchdarkly/vercel-server-sdk", - "version": "1.0.1", + "version": "1.1.0", "description": "LaunchDarkly Server-Side SDK for Vercel Edge", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/vercel", "repository": { @@ -37,7 +37,7 @@ "check": "yarn prettier && yarn lint && yarn build && yarn test && yarn doc" }, "dependencies": { - "@launchdarkly/js-server-sdk-common-edge": "1.0.6", + "@launchdarkly/js-server-sdk-common-edge": "1.0.9", "@vercel/edge-config": "^0.1.8", "crypto-js": "^4.1.1" }, diff --git a/packages/sdk/vercel/src/createPlatformInfo.ts b/packages/sdk/vercel/src/createPlatformInfo.ts index cbd8874c5..524808b00 100644 --- a/packages/sdk/vercel/src/createPlatformInfo.ts +++ b/packages/sdk/vercel/src/createPlatformInfo.ts @@ -11,6 +11,7 @@ class VercelPlatformInfo implements Info { return { name: '@launchdarkly/vercel-server-sdk', version: '__LD_VERSION__', + userAgentBase: 'VercelEdgeSDK', }; } } diff --git a/packages/sdk/vercel/tsconfig.json b/packages/sdk/vercel/tsconfig.json index 2635087a0..39049b642 100644 --- a/packages/sdk/vercel/tsconfig.json +++ b/packages/sdk/vercel/tsconfig.json @@ -3,7 +3,7 @@ // Uses "." so it can load package.json. "rootDir": ".", "outDir": "dist", - "target": "es6", + "target": "es2017", "lib": ["es6"], "module": "commonjs", "strict": true, diff --git a/packages/shared/akamai-edgeworker-sdk/CHANGELOG.md b/packages/shared/akamai-edgeworker-sdk/CHANGELOG.md index 2a73d1aed..3e5781b5c 100644 --- a/packages/shared/akamai-edgeworker-sdk/CHANGELOG.md +++ b/packages/shared/akamai-edgeworker-sdk/CHANGELOG.md @@ -26,6 +26,40 @@ All notable changes to the LaunchDarkly SDK for Akamai Workers will be documente * dependencies * @launchdarkly/js-server-sdk-common bumped from ^1.0.5 to ^1.0.6 +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common bumped from ^1.0.6 to ^1.0.7 + +## [0.3.0](https://github.com/launchdarkly/js-core/compare/akamai-edgeworker-sdk-common-v0.2.7...akamai-edgeworker-sdk-common-v0.3.0) (2023-08-14) + + +### Features + +* Allow specifying the user agent per-sdk implementation. ([#226](https://github.com/launchdarkly/js-core/issues/226)) ([e57716f](https://github.com/launchdarkly/js-core/commit/e57716f3f6f0ba8568e32b0937903ca46e5470ad)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common bumped from ^1.0.8 to ^1.1.0 + +## [0.2.7](https://github.com/launchdarkly/js-core/compare/akamai-edgeworker-sdk-common-v0.2.6...akamai-edgeworker-sdk-common-v0.2.7) (2023-08-10) + + +### Bug Fixes + +* Switch to es2017 target to ensure native async/await. ([a83e4e6](https://github.com/launchdarkly/js-core/commit/a83e4e62d04c66105a1b0e8893640a7ca2d641e4)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common bumped from ^1.0.7 to ^1.0.8 + ## [0.2.3](https://github.com/launchdarkly/js-core/compare/akamai-edgeworker-sdk-common-v0.2.2...akamai-edgeworker-sdk-common-v0.2.3) (2023-06-23) diff --git a/packages/shared/akamai-edgeworker-sdk/package.json b/packages/shared/akamai-edgeworker-sdk/package.json index 8a3d24936..b605689c5 100644 --- a/packages/shared/akamai-edgeworker-sdk/package.json +++ b/packages/shared/akamai-edgeworker-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@launchdarkly/akamai-edgeworker-sdk-common", - "version": "0.2.5", + "version": "0.3.0", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/shared/akamai-edge-sdk", "repository": { "type": "git", @@ -55,7 +55,7 @@ "typescript": "^5.1.6" }, "dependencies": { - "@launchdarkly/js-server-sdk-common": "^1.0.6", + "@launchdarkly/js-server-sdk-common": "^1.1.0", "crypto-js": "^4.1.1" } } diff --git a/packages/shared/akamai-edgeworker-sdk/src/__tests__/platform/info/index.test.ts b/packages/shared/akamai-edgeworker-sdk/src/__tests__/platform/info/index.test.ts index 412ec2f9c..9890146d6 100644 --- a/packages/shared/akamai-edgeworker-sdk/src/__tests__/platform/info/index.test.ts +++ b/packages/shared/akamai-edgeworker-sdk/src/__tests__/platform/info/index.test.ts @@ -20,6 +20,7 @@ describe('Akamai Platform Info', () => { expect(platformData.sdkData()).toEqual({ name: packageJson.name, version: packageJson.version, + userAgentBase: 'AkamaiEdgeSDK', }); }); }); diff --git a/packages/shared/akamai-edgeworker-sdk/src/platform/info/index.ts b/packages/shared/akamai-edgeworker-sdk/src/platform/info/index.ts index 12f8bae02..557b312cb 100644 --- a/packages/shared/akamai-edgeworker-sdk/src/platform/info/index.ts +++ b/packages/shared/akamai-edgeworker-sdk/src/platform/info/index.ts @@ -17,6 +17,7 @@ class AkamaiPlatformInfo implements Info { return { name: this.sdkName, version: this.sdkVersion, + userAgentBase: 'AkamaiEdgeSDK', }; } } diff --git a/packages/shared/akamai-edgeworker-sdk/tsconfig.json b/packages/shared/akamai-edgeworker-sdk/tsconfig.json index 823c9c67d..def6a5c83 100644 --- a/packages/shared/akamai-edgeworker-sdk/tsconfig.json +++ b/packages/shared/akamai-edgeworker-sdk/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "rootDir": "src", "outDir": "dist", - "target": "es6", + "target": "es2017", "lib": ["es6"], "module": "commonjs", "strict": true, diff --git a/packages/shared/common/CHANGELOG.md b/packages/shared/common/CHANGELOG.md index bb2c86802..0bf5abc7b 100644 --- a/packages/shared/common/CHANGELOG.md +++ b/packages/shared/common/CHANGELOG.md @@ -2,6 +2,20 @@ All notable changes to `@launchdarkly/js-sdk-common` will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org). +## [1.1.0](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v1.0.3...js-sdk-common-v1.1.0) (2023-08-14) + + +### Features + +* Allow specifying the user agent per-sdk implementation. ([#226](https://github.com/launchdarkly/js-core/issues/226)) ([e57716f](https://github.com/launchdarkly/js-core/commit/e57716f3f6f0ba8568e32b0937903ca46e5470ad)) + +## [1.0.3](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v1.0.2...js-sdk-common-v1.0.3) (2023-08-10) + + +### Bug Fixes + +* Switch to es2017 target to ensure native async/await. ([a83e4e6](https://github.com/launchdarkly/js-core/commit/a83e4e62d04c66105a1b0e8893640a7ca2d641e4)) + ## [1.0.2](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v1.0.1...js-sdk-common-v1.0.2) (2023-06-13) diff --git a/packages/shared/common/package.json b/packages/shared/common/package.json index fc2f4b14e..7387d9359 100644 --- a/packages/shared/common/package.json +++ b/packages/shared/common/package.json @@ -1,6 +1,6 @@ { "name": "@launchdarkly/js-sdk-common", - "version": "1.0.2", + "version": "1.1.0", "type": "commonjs", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/packages/shared/common/src/api/platform/Info.ts b/packages/shared/common/src/api/platform/Info.ts index 7f724826b..9b0bf40f6 100644 --- a/packages/shared/common/src/api/platform/Info.ts +++ b/packages/shared/common/src/api/platform/Info.ts @@ -44,6 +44,12 @@ export interface SdkData { */ version?: string; + /** + * If this is a top-level (not a wrapper) SDK this will be used to create the user agent string. + * It will take the form 'userAgentBase/version`. + */ + userAgentBase?: string; + /** * Name of the wrapper SDK if present. */ diff --git a/packages/shared/common/tsconfig.json b/packages/shared/common/tsconfig.json index 19e8b1e59..cd3f7af3c 100644 --- a/packages/shared/common/tsconfig.json +++ b/packages/shared/common/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "rootDir": "src", "outDir": "dist", - "target": "es6", + "target": "es2017", "lib": ["es6"], "module": "commonjs", "strict": true, diff --git a/packages/shared/sdk-server-edge/CHANGELOG.md b/packages/shared/sdk-server-edge/CHANGELOG.md index 613c63736..fc0288d78 100644 --- a/packages/shared/sdk-server-edge/CHANGELOG.md +++ b/packages/shared/sdk-server-edge/CHANGELOG.md @@ -30,6 +30,32 @@ * dependencies * @launchdarkly/js-server-sdk-common bumped from 1.0.5 to 1.0.6 +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common bumped from 1.0.6 to 1.0.7 + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common bumped from 1.0.8 to 1.1.0 + +## [1.0.8](https://github.com/launchdarkly/js-core/compare/js-server-sdk-common-edge-v1.0.7...js-server-sdk-common-edge-v1.0.8) (2023-08-10) + + +### Bug Fixes + +* Switch to es2017 target to ensure native async/await. ([a83e4e6](https://github.com/launchdarkly/js-core/commit/a83e4e62d04c66105a1b0e8893640a7ca2d641e4)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common bumped from 1.0.7 to 1.0.8 + ## [1.0.2](https://github.com/launchdarkly/js-core/compare/js-server-sdk-common-edge-v1.0.1...js-server-sdk-common-edge-v1.0.2) (2023-04-28) diff --git a/packages/shared/sdk-server-edge/package.json b/packages/shared/sdk-server-edge/package.json index bfd02b667..acb02a812 100644 --- a/packages/shared/sdk-server-edge/package.json +++ b/packages/shared/sdk-server-edge/package.json @@ -1,6 +1,6 @@ { "name": "@launchdarkly/js-server-sdk-common-edge", - "version": "1.0.6", + "version": "1.0.9", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/shared/sdk-server-edge", "repository": { "type": "git", @@ -37,7 +37,7 @@ "check": "yarn prettier && yarn lint && yarn build && yarn test && yarn doc" }, "dependencies": { - "@launchdarkly/js-server-sdk-common": "1.0.6", + "@launchdarkly/js-server-sdk-common": "1.1.0", "crypto-js": "^4.1.1" }, "devDependencies": { diff --git a/packages/shared/sdk-server-edge/tsconfig.json b/packages/shared/sdk-server-edge/tsconfig.json index 4b0f39132..a34abfe7c 100644 --- a/packages/shared/sdk-server-edge/tsconfig.json +++ b/packages/shared/sdk-server-edge/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "rootDir": ".", "outDir": "dist", - "target": "es6", + "target": "es2017", "lib": ["es6", "webworker"], "module": "commonjs", "strict": true, diff --git a/packages/shared/sdk-server/CHANGELOG.md b/packages/shared/sdk-server/CHANGELOG.md index a7aa6d19f..f17f859d4 100644 --- a/packages/shared/sdk-server/CHANGELOG.md +++ b/packages/shared/sdk-server/CHANGELOG.md @@ -2,6 +2,46 @@ All notable changes to `@launchdarkly/js-server-sdk-common` will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org). +## [1.1.0](https://github.com/launchdarkly/js-core/compare/js-server-sdk-common-v1.0.8...js-server-sdk-common-v1.1.0) (2023-08-14) + + +### Features + +* Allow specifying the user agent per-sdk implementation. ([#226](https://github.com/launchdarkly/js-core/issues/226)) ([e57716f](https://github.com/launchdarkly/js-core/commit/e57716f3f6f0ba8568e32b0937903ca46e5470ad)) + + +### Bug Fixes + +* Allow for negation of segment match clauses. ([#237](https://github.com/launchdarkly/js-core/issues/237)) ([d8e469a](https://github.com/launchdarkly/js-core/commit/d8e469a5e58b90c791fbbee80f7c0fc447c4e42f)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-sdk-common bumped from 1.0.3 to 1.1.0 + +## [1.0.8](https://github.com/launchdarkly/js-core/compare/js-server-sdk-common-v1.0.7...js-server-sdk-common-v1.0.8) (2023-08-10) + + +### Bug Fixes + +* Switch to es2017 target to ensure native async/await. ([a83e4e6](https://github.com/launchdarkly/js-core/commit/a83e4e62d04c66105a1b0e8893640a7ca2d641e4)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-sdk-common bumped from 1.0.2 to 1.0.3 + +## [1.0.7](https://github.com/launchdarkly/js-core/compare/js-server-sdk-common-v1.0.6...js-server-sdk-common-v1.0.7) (2023-08-03) + + +### Bug Fixes + +* Ensure that test data user targets are handled correctly. ([#223](https://github.com/launchdarkly/js-core/issues/223)) ([8a423b2](https://github.com/launchdarkly/js-core/commit/8a423b22282624627200dfda1ebe4207f9db69a6)) + ## [1.0.6](https://github.com/launchdarkly/js-core/compare/js-server-sdk-common-v1.0.5...js-server-sdk-common-v1.0.6) (2023-07-05) diff --git a/packages/shared/sdk-server/__tests__/LDClient.evaluation.test.ts b/packages/shared/sdk-server/__tests__/LDClient.evaluation.test.ts index ad4ea1b07..a5665de72 100644 --- a/packages/shared/sdk-server/__tests__/LDClient.evaluation.test.ts +++ b/packages/shared/sdk-server/__tests__/LDClient.evaluation.test.ts @@ -137,6 +137,29 @@ describe('given an LDClient with test data', () => { reason: { kind: 'ERROR', errorKind: 'FLAG_NOT_FOUND' }, }); }); + + it('evaluates and updates user targets from test data', async () => { + // This is a specific test case for a customer issue. + // It tests the combination of evaluation and test data functionality. + const userUuid = '1234'; + const userContextObject = { + kind: 'user', + key: userUuid, + }; + + await td.update( + td.flag('my-feature-flag-1').variationForUser(userUuid, false).fallthroughVariation(false), + ); + const valueA = await client.variation('my-feature-flag-1', userContextObject, 'default'); + expect(valueA).toEqual(false); + + await td.update( + td.flag('my-feature-flag-1').variationForUser(userUuid, true).fallthroughVariation(false), + ); + + const valueB = await client.variation('my-feature-flag-1', userContextObject, 'default'); + expect(valueB).toEqual(true); + }); }); describe('given an offline client', () => { diff --git a/packages/shared/sdk-server/__tests__/data_sources/defaultHeaders.test.ts b/packages/shared/sdk-server/__tests__/data_sources/defaultHeaders.test.ts index e34761540..5da91e08b 100644 --- a/packages/shared/sdk-server/__tests__/data_sources/defaultHeaders.test.ts +++ b/packages/shared/sdk-server/__tests__/data_sources/defaultHeaders.test.ts @@ -3,13 +3,14 @@ import { Info, PlatformData, SdkData } from '@launchdarkly/js-sdk-common'; import defaultHeaders from '../../src/data_sources/defaultHeaders'; import Configuration from '../../src/options/Configuration'; -const makeInfo = (wrapperName?: string, wrapperVersion?: string): Info => ({ +const makeInfo = (wrapperName?: string, wrapperVersion?: string, userAgentBase?: string): Info => ({ platformData(): PlatformData { return {}; }, sdkData(): SdkData { const sdkData: SdkData = { version: '2.2.2', + userAgentBase, wrapperName, wrapperVersion, }; @@ -23,12 +24,18 @@ it('sets SDK key', () => { expect(h).toMatchObject({ authorization: 'my-sdk-key' }); }); -it('sets user agent', () => { +it('sets the default user agent', () => { const config = new Configuration({}); const h = defaultHeaders('my-sdk-key', config, makeInfo()); expect(h).toMatchObject({ 'user-agent': 'NodeJSClient/2.2.2' }); }); +it('sets the SDK specific user agent', () => { + const config = new Configuration({}); + const h = defaultHeaders('my-sdk-key', config, makeInfo(undefined, undefined, 'CATS')); + expect(h).toMatchObject({ 'user-agent': 'CATS/2.2.2' }); +}); + it('does not include wrapper header by default', () => { const config = new Configuration({}); const h = defaultHeaders('my-sdk-key', config, makeInfo()); diff --git a/packages/shared/sdk-server/__tests__/evaluation/Evaluator.segments.test.ts b/packages/shared/sdk-server/__tests__/evaluation/Evaluator.segments.test.ts index 5f94defa9..5843bfe05 100644 --- a/packages/shared/sdk-server/__tests__/evaluation/Evaluator.segments.test.ts +++ b/packages/shared/sdk-server/__tests__/evaluation/Evaluator.segments.test.ts @@ -110,6 +110,20 @@ describe('when evaluating user equivalent contexts for segments', () => { expect(res.detail.value).toBe(false); }); + it('can negate a segment match op', async () => { + const segment = { + key: 'test', + included: ['foo'], + version: 1, + }; + const evaluator = new Evaluator(basicPlatform, new TestQueries({ segments: [segment] })); + const flag = makeFlagWithSegmentMatch(segment); + flag.rules[0].clauses![0].negate = true; + const user = { key: 'bar' }; + const res = await evaluator.evaluate(flag, Context.fromLDContext(user)); + expect(res.detail.value).toBe(true); + }); + it.each([basicUser, basicSingleKindUser, basicMultiKindUser])( 'matches segment with user who is both included and excluded', async (context) => { diff --git a/packages/shared/sdk-server/__tests__/integrations/test_data/TestData.test.ts b/packages/shared/sdk-server/__tests__/integrations/test_data/TestData.test.ts index 4ba82b699..81690750b 100644 --- a/packages/shared/sdk-server/__tests__/integrations/test_data/TestData.test.ts +++ b/packages/shared/sdk-server/__tests__/integrations/test_data/TestData.test.ts @@ -207,9 +207,8 @@ describe('given a TestData instance', () => { expect(builtFlag.fallthrough).toEqual({ variation: 1 }); expect(builtFlag.offVariation).toEqual(0); expect(builtFlag.variations).toEqual([true, false]); - expect(builtFlag.contextTargets).toEqual([ - { contextKind: 'user', values: ['billy'], variation: 0 }, - ]); + expect(builtFlag.contextTargets).toEqual([{ contextKind: 'user', values: [], variation: 0 }]); + expect(builtFlag.targets).toEqual([{ values: ['billy'], variation: 0 }]); expect(builtFlag.rules).toEqual(flagRules); }); @@ -249,16 +248,32 @@ describe('given a TestData instance', () => { it('can set boolean values for a specific user target', () => { const flag = td.flag('test-flag').variationForContext('user', 'potato', false); const flag2 = td.flag('test-flag').variationForUser('potato', true); - expect(flag.build(0).contextTargets).toEqual([ + const builtFlag1 = flag.build(0); + const builtFlag2 = flag2.build(0); + // User targets order by the context targets, but use values from + // the legacy targets. + expect(builtFlag1.contextTargets).toEqual([ { contextKind: 'user', + variation: 1, + values: [], + }, + ]); + expect(builtFlag1.targets).toEqual([ + { variation: 1, values: ['potato'], }, ]); - expect(flag2.build(0).contextTargets).toEqual([ + expect(builtFlag2.contextTargets).toEqual([ { contextKind: 'user', + variation: 0, + values: [], + }, + ]); + expect(builtFlag2.targets).toEqual([ + { variation: 0, values: ['potato'], }, @@ -347,13 +362,32 @@ describe('given a TestData instance', () => { it('can move a targeted context from one variation to another', () => { const flag = td .flag('test-flag') - .variationForContext('user', 'ben', false) - .variationForContext('user', 'ben', true); + .variationForContext('org', 'ben', false) + .variationForContext('org', 'ben', true); + // Because there was only one target in the first variation there will be only + // a single variation after that target is removed. + expect(flag.build(1).contextTargets).toEqual([ + { + contextKind: 'org', + variation: 0, + values: ['ben'], + }, + ]); + }); + + it('can move a targeted user from one variation to another', () => { + const flag = td.flag('test-flag').variationForUser('ben', false).variationForUser('ben', true); // Because there was only one target in the first variation there will be only // a single variation after that target is removed. expect(flag.build(1).contextTargets).toEqual([ { contextKind: 'user', + variation: 0, + values: [], + }, + ]); + expect(flag.build(1).targets).toEqual([ + { variation: 0, values: ['ben'], }, @@ -363,19 +397,51 @@ describe('given a TestData instance', () => { it('if a targeted context is moved from one variation to another, then other targets remain for that variation', () => { const flag = td .flag('test-flag') - .variationForContext('user', 'ben', false) - .variationForContext('user', 'joe', false) - .variationForContext('user', 'ben', true); + .variationForUser('ben', false) + .variationForUser('joe', false) + .variationForUser('ben', true); expect(flag.build(1).contextTargets).toEqual([ { contextKind: 'user', variation: 0, - values: ['ben'], + values: [], }, { contextKind: 'user', variation: 1, + values: [], + }, + ]); + + expect(flag.build(1).targets).toEqual([ + { + variation: 0, + values: ['ben'], + }, + { + variation: 1, + values: ['joe'], + }, + ]); + }); + + it('if a targeted user is moved from one variation to another, then other targets remain for that variation', () => { + const flag = td + .flag('test-flag') + .variationForContext('org', 'ben', false) + .variationForContext('org', 'joe', false) + .variationForContext('org', 'ben', true); + + expect(flag.build(1).contextTargets).toEqual([ + { + contextKind: 'org', + variation: 0, + values: ['ben'], + }, + { + contextKind: 'org', + variation: 1, values: ['joe'], }, ]); @@ -393,7 +459,7 @@ describe('given a TestData instance', () => { { contextKind: 'user', variation: 1, - values: ['ben'], + values: [], }, { contextKind: 'potato', @@ -401,5 +467,6 @@ describe('given a TestData instance', () => { values: ['russet', 'yukon'], }, ]); + expect(flag.build(0).targets).toEqual([{ variation: 1, values: ['ben'] }]); }); }); diff --git a/packages/shared/sdk-server/package.json b/packages/shared/sdk-server/package.json index d37b44794..6459812f8 100644 --- a/packages/shared/sdk-server/package.json +++ b/packages/shared/sdk-server/package.json @@ -1,6 +1,6 @@ { "name": "@launchdarkly/js-server-sdk-common", - "version": "1.0.6", + "version": "1.1.0", "type": "commonjs", "main": "./dist/index.js", "types": "./dist/index.d.ts", @@ -28,7 +28,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@launchdarkly/js-sdk-common": "1.0.2", + "@launchdarkly/js-sdk-common": "1.1.0", "semver": "7.5.4" }, "devDependencies": { diff --git a/packages/shared/sdk-server/src/data_sources/defaultHeaders.ts b/packages/shared/sdk-server/src/data_sources/defaultHeaders.ts index 9f17672fe..42db4ac2a 100644 --- a/packages/shared/sdk-server/src/data_sources/defaultHeaders.ts +++ b/packages/shared/sdk-server/src/data_sources/defaultHeaders.ts @@ -12,7 +12,9 @@ export default function defaultHeaders( const sdkData = info.sdkData(); const headers: { [key: string]: string } = { authorization: sdkKey, - 'user-agent': `NodeJSClient/${sdkData.version}`, + 'user-agent': `${sdkData.userAgentBase ? sdkData.userAgentBase : 'NodeJSClient'}/${ + sdkData.version + }`, }; if (sdkData.wrapperName) { diff --git a/packages/shared/sdk-server/src/evaluation/Evaluator.ts b/packages/shared/sdk-server/src/evaluation/Evaluator.ts index 55b563b27..fc1d3b3bf 100644 --- a/packages/shared/sdk-server/src/evaluation/Evaluator.ts +++ b/packages/shared/sdk-server/src/evaluation/Evaluator.ts @@ -17,7 +17,7 @@ import ErrorKinds from './ErrorKinds'; import EvalResult from './EvalResult'; import evalTargets from './evalTargets'; import makeBigSegmentRef from './makeBigSegmentRef'; -import matchClauseWithoutSegmentOperations from './matchClause'; +import matchClauseWithoutSegmentOperations, { maybeNegate } from './matchClause'; import matchSegmentTargets from './matchSegmentTargets'; import { Queries } from './Queries'; import Reasons from './Reasons'; @@ -296,7 +296,7 @@ export default class Evaluator { return new MatchError(errorResult); } - return new Match(match); + return new Match(maybeNegate(clause, match)); } // This is after segment matching, which does not use the reference. if (!clause.attributeReference.isValid) { diff --git a/packages/shared/sdk-server/src/evaluation/matchClause.ts b/packages/shared/sdk-server/src/evaluation/matchClause.ts index c6d28eed9..282db748d 100644 --- a/packages/shared/sdk-server/src/evaluation/matchClause.ts +++ b/packages/shared/sdk-server/src/evaluation/matchClause.ts @@ -3,7 +3,7 @@ import { Context } from '@launchdarkly/js-sdk-common'; import { Clause } from './data/Clause'; import Operators from './Operations'; -function maybeNegate(clause: Clause, value: boolean): boolean { +export function maybeNegate(clause: Clause, value: boolean): boolean { if (clause.negate) { return !value; } diff --git a/packages/shared/sdk-server/src/integrations/test_data/TestDataFlagBuilder.ts b/packages/shared/sdk-server/src/integrations/test_data/TestDataFlagBuilder.ts index 8485cc784..168480f43 100644 --- a/packages/shared/sdk-server/src/integrations/test_data/TestDataFlagBuilder.ts +++ b/packages/shared/sdk-server/src/integrations/test_data/TestDataFlagBuilder.ts @@ -394,18 +394,24 @@ export default class TestDataFlagBuilder { if (this.data.targetsByVariation) { const contextTargets: Target[] = []; + const userTargets: Omit[] = []; Object.entries(this.data.targetsByVariation).forEach( ([variation, contextTargetsForVariation]) => { Object.entries(contextTargetsForVariation).forEach(([contextKind, values]) => { + const numberVariation = parseInt(variation, 10); contextTargets.push({ contextKind, - values, + values: contextKind === 'user' ? [] : values, // Iterating the object it will be a string. - variation: parseInt(variation, 10), + variation: numberVariation, }); + if (contextKind === 'user') { + userTargets.push({ values, variation: numberVariation }); + } }); }, ); + baseFlagObject.targets = userTargets; baseFlagObject.contextTargets = contextTargets; } diff --git a/packages/shared/sdk-server/src/store/PersistentDataStoreWrapper.ts b/packages/shared/sdk-server/src/store/PersistentDataStoreWrapper.ts index 1995486dc..63b21c80f 100644 --- a/packages/shared/sdk-server/src/store/PersistentDataStoreWrapper.ts +++ b/packages/shared/sdk-server/src/store/PersistentDataStoreWrapper.ts @@ -166,6 +166,7 @@ export default class PersistentDataStoreWrapper implements LDFeatureStore { const value = deserialize(persistKind, descriptor); this.itemCache?.set(cacheKey(kind, key), value); callback(itemIfNotDeleted(value)); + return; } callback(null); }); diff --git a/packages/shared/sdk-server/tsconfig.json b/packages/shared/sdk-server/tsconfig.json index 19e8b1e59..cd3f7af3c 100644 --- a/packages/shared/sdk-server/tsconfig.json +++ b/packages/shared/sdk-server/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "rootDir": "src", "outDir": "dist", - "target": "es6", + "target": "es2017", "lib": ["es6"], "module": "commonjs", "strict": true, diff --git a/packages/store/node-server-sdk-dynamodb/CHANGELOG.md b/packages/store/node-server-sdk-dynamodb/CHANGELOG.md index 06ac7735f..ab39d8a56 100644 --- a/packages/store/node-server-sdk-dynamodb/CHANGELOG.md +++ b/packages/store/node-server-sdk-dynamodb/CHANGELOG.md @@ -18,6 +18,32 @@ * devDependencies * @launchdarkly/node-server-sdk bumped from 8.0.2 to 8.1.0 +### Dependencies + +* The following workspace dependencies were updated + * devDependencies + * @launchdarkly/node-server-sdk bumped from 8.1.0 to 8.1.1 + +### Dependencies + +* The following workspace dependencies were updated + * devDependencies + * @launchdarkly/node-server-sdk bumped from 8.1.2 to 8.2.0 + +## [5.0.6](https://github.com/launchdarkly/js-core/compare/node-server-sdk-dynamodb-v5.0.5...node-server-sdk-dynamodb-v5.0.6) (2023-08-10) + + +### Bug Fixes + +* Switch to es2017 target to ensure native async/await. ([a83e4e6](https://github.com/launchdarkly/js-core/commit/a83e4e62d04c66105a1b0e8893640a7ca2d641e4)) + + +### Dependencies + +* The following workspace dependencies were updated + * devDependencies + * @launchdarkly/node-server-sdk bumped from 8.1.1 to 8.1.2 + ## [5.0.2](https://github.com/launchdarkly/js-core/compare/node-server-sdk-dynamodb-v5.0.1...node-server-sdk-dynamodb-v5.0.2) (2023-06-27) diff --git a/packages/store/node-server-sdk-dynamodb/README.md b/packages/store/node-server-sdk-dynamodb/README.md index 1fe7e9871..59f9c6917 100644 --- a/packages/store/node-server-sdk-dynamodb/README.md +++ b/packages/store/node-server-sdk-dynamodb/README.md @@ -27,7 +27,7 @@ Refer to [Using DynamoDB as a persistent feature store](https://docs.launchdarkl 2. Install this package with `npm` or `yarn`: -`npm install launchdarkly-node-server-sdk-dynamodb --save` +`npm install @launchdarkly/node-server-sdk-dynamodb --save` 3. If your application does not already have its own dependency on the `@aws-sdk/client-dynamodb` package, and if it will _not_ be running in AWS Lambda, add `@aws-sdk/client-dynamodb` as well: @@ -38,13 +38,13 @@ The `launchdarkly-node-server-sdk-dynamodb` package does not provide `@aws-sdk/c 4. Import the package: ```typescript -const { DynamoDBFeatureStoreFactory } = require('launchdarkly-node-server-sdk-dynamodb'); +const { DynamoDBFeatureStore } = require('launchdarkly-node-server-sdk-dynamodb'); ``` 5. When configuring your SDK client, add the DynamoDB feature store: ```typescript -const store = DynamoDBFeatureStoreFactory('YOUR TABLE NAME'); +const store = DynamoDBFeatureStore('YOUR TABLE NAME'); const config = { featureStore: store }; const client = LaunchDarkly.init('YOUR SDK KEY', config); ``` @@ -52,14 +52,14 @@ const client = LaunchDarkly.init('YOUR SDK KEY', config); By default, the DynamoDB client will try to get your AWS credentials and region name from environment variables and/or local configuration files, as described in the AWS SDK documentation. You can also specify any valid [DynamoDB client options](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#constructor-property) like this: ```typescript -const dynamoDBOptions = { accessKeyId: 'YOUR KEY', secretAccessKey: 'YOUR SECRET' }; -const store = DynamoDBFeatureStoreFactory('YOUR TABLE NAME', { clientOptions: dynamoDBOptions }); +const dynamoDBOptions = { credentials: { accessKeyId: 'YOUR KEY', secretAccessKey: 'YOUR SECRET' }}; +const store = DynamoDBFeatureStore('YOUR TABLE NAME', { clientOptions: dynamoDBOptions }); ``` Alternatively, if you already have a fully configured DynamoDB client object, you can tell LaunchDarkly to use that: ```typescript -const store = DynamoDBFeatureStoreFactory('YOUR TABLE NAME', { +const store = DynamoDBFeatureStore('YOUR TABLE NAME', { dynamoDBClient: myDynamoDBClientInstance, }); ``` @@ -74,7 +74,7 @@ const client = LaunchDarkly.init('YOUR SDK KEY', config); 7. If the same DynamoDB table is being shared by SDK clients for different LaunchDarkly environments, set the `prefix` option to a different short string for each one to keep the keys from colliding: ```typescript -const store = DynamoDBFeatureStoreFactory('YOUR TABLE NAME', { prefix: 'env1' }); +const store = DynamoDBFeatureStore('YOUR TABLE NAME', { prefix: 'env1' }); ``` ## Caching behavior @@ -82,7 +82,7 @@ const store = DynamoDBFeatureStoreFactory('YOUR TABLE NAME', { prefix: 'env1' }) To reduce traffic to DynamoDB, there is an optional in-memory cache that retains the last known data for a configurable amount of time. This is on by default; to turn it off (and guarantee that the latest feature flag data will always be retrieved from DynamoDB for every flag evaluation), configure the store as follows: ```typescript -const factory = DynamoDBFeatureStoreFactory({ cacheTTL: 0 }); +const factory = DynamoDBFeatureStore({ cacheTTL: 0 }); ``` ## Contributing diff --git a/packages/store/node-server-sdk-dynamodb/package.json b/packages/store/node-server-sdk-dynamodb/package.json index 59c3e89e9..0808125e2 100644 --- a/packages/store/node-server-sdk-dynamodb/package.json +++ b/packages/store/node-server-sdk-dynamodb/package.json @@ -1,6 +1,6 @@ { "name": "@launchdarkly/node-server-sdk-dynamodb", - "version": "5.0.4", + "version": "5.0.7", "description": "DynamoDB-backed feature store for the LaunchDarkly Server-Side SDK for Node.js", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/store/node-server-sdk-dynamodb", "repository": { @@ -36,7 +36,7 @@ }, "devDependencies": { "@aws-sdk/client-dynamodb": "3.348.0", - "@launchdarkly/node-server-sdk": "8.1.0", + "@launchdarkly/node-server-sdk": "8.2.0", "@trivago/prettier-plugin-sort-imports": "^4.1.1", "@types/jest": "^29.4.0", "@typescript-eslint/eslint-plugin": "^6.1.0", diff --git a/packages/store/node-server-sdk-dynamodb/tsconfig.json b/packages/store/node-server-sdk-dynamodb/tsconfig.json index 1b9ac79b8..e4158b054 100644 --- a/packages/store/node-server-sdk-dynamodb/tsconfig.json +++ b/packages/store/node-server-sdk-dynamodb/tsconfig.json @@ -3,7 +3,7 @@ // Uses "." so it can load package.json. "rootDir": ".", "outDir": "dist", - "target": "es6", + "target": "es2017", "lib": ["es6"], "module": "commonjs", "strict": true, diff --git a/packages/store/node-server-sdk-redis/CHANGELOG.md b/packages/store/node-server-sdk-redis/CHANGELOG.md index 6d290c4f6..ce410e997 100644 --- a/packages/store/node-server-sdk-redis/CHANGELOG.md +++ b/packages/store/node-server-sdk-redis/CHANGELOG.md @@ -18,6 +18,32 @@ * devDependencies * @launchdarkly/node-server-sdk bumped from 8.0.2 to 8.1.0 +### Dependencies + +* The following workspace dependencies were updated + * devDependencies + * @launchdarkly/node-server-sdk bumped from 8.1.0 to 8.1.1 + +### Dependencies + +* The following workspace dependencies were updated + * devDependencies + * @launchdarkly/node-server-sdk bumped from 8.1.2 to 8.2.0 + +## [3.0.6](https://github.com/launchdarkly/js-core/compare/node-server-sdk-redis-v3.0.5...node-server-sdk-redis-v3.0.6) (2023-08-10) + + +### Bug Fixes + +* Switch to es2017 target to ensure native async/await. ([a83e4e6](https://github.com/launchdarkly/js-core/commit/a83e4e62d04c66105a1b0e8893640a7ca2d641e4)) + + +### Dependencies + +* The following workspace dependencies were updated + * devDependencies + * @launchdarkly/node-server-sdk bumped from 8.1.1 to 8.1.2 + ## [3.0.2](https://github.com/launchdarkly/js-core/compare/node-server-sdk-redis-v3.0.1...node-server-sdk-redis-v3.0.2) (2023-06-27) diff --git a/packages/store/node-server-sdk-redis/README.md b/packages/store/node-server-sdk-redis/README.md index 3064596d7..ecaa55f00 100644 --- a/packages/store/node-server-sdk-redis/README.md +++ b/packages/store/node-server-sdk-redis/README.md @@ -41,13 +41,13 @@ npm install ioredis --save 3. Import the package: ```typescript -import { RedisFeatureStoreFactory } = from '@launchdarkly/node-server-sdk-redis'; +import { RedisFeatureStore } = from '@launchdarkly/node-server-sdk-redis'; ``` 4. When configuring your SDK client, add the Redis feature store: ```typescript -const storeFactory = RedisFeatureStoreFactory(); +const storeFactory = RedisFeatureStore(); const config = { featureStore: storeFactory }; const client = LaunchDarkly.init('YOUR SDK KEY', config); ``` diff --git a/packages/store/node-server-sdk-redis/package.json b/packages/store/node-server-sdk-redis/package.json index 1889aa6af..e641c6620 100644 --- a/packages/store/node-server-sdk-redis/package.json +++ b/packages/store/node-server-sdk-redis/package.json @@ -1,6 +1,6 @@ { "name": "@launchdarkly/node-server-sdk-redis", - "version": "3.0.4", + "version": "3.0.7", "description": "Redis-backed feature store for the LaunchDarkly Server-Side SDK for Node.js", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/store/node-server-sdk-redis", "repository": { @@ -34,7 +34,7 @@ "@launchdarkly/node-server-sdk": "8.x" }, "devDependencies": { - "@launchdarkly/node-server-sdk": "8.1.0", + "@launchdarkly/node-server-sdk": "8.2.0", "@trivago/prettier-plugin-sort-imports": "^4.1.1", "@types/jest": "^29.4.0", "@typescript-eslint/eslint-plugin": "^6.1.0", diff --git a/packages/store/node-server-sdk-redis/tsconfig.json b/packages/store/node-server-sdk-redis/tsconfig.json index 1b9ac79b8..e4158b054 100644 --- a/packages/store/node-server-sdk-redis/tsconfig.json +++ b/packages/store/node-server-sdk-redis/tsconfig.json @@ -3,7 +3,7 @@ // Uses "." so it can load package.json. "rootDir": ".", "outDir": "dist", - "target": "es6", + "target": "es2017", "lib": ["es6"], "module": "commonjs", "strict": true, diff --git a/release-please-config.json b/release-please-config.json index 639bc3262..63cc82409 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -9,8 +9,7 @@ "packages/sdk/server-node": {}, "packages/sdk/cloudflare": {}, "packages/sdk/vercel": { - "extra-files": ["src/createPlatformInfo.ts"], - "release-as": "1.0.0" + "extra-files": ["src/createPlatformInfo.ts"] }, "packages/sdk/akamai-base": { "extra-files": ["src/index.ts"]