diff --git a/.eslintrc.js b/.eslintrc.js index 5f6d01889..bb50a6f60 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,7 +15,7 @@ module.exports = { 'import/no-extraneous-dependencies': [ 'error', { - devDependencies: ['**/jest*.ts', '**/*.test.ts'], + devDependencies: ['**/jest*.ts', '**/*.test.ts', '**/rollup.config.ts'], }, ], }, diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 06d9f6673..0d6fd22c8 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,13 +1,13 @@ { "packages/shared/common": "1.1.0", - "packages/shared/sdk-server": "1.2.2", - "packages/sdk/server-node": "8.2.3", - "packages/sdk/cloudflare": "2.1.3", - "packages/shared/sdk-server-edge": "1.0.12", - "packages/sdk/vercel": "1.1.3", - "packages/sdk/akamai-base": "1.0.6", - "packages/sdk/akamai-edgekv": "1.0.6", - "packages/shared/akamai-edgeworker-sdk": "0.3.3", - "packages/store/node-server-sdk-dynamodb": "5.0.10", - "packages/store/node-server-sdk-redis": "3.0.10" + "packages/shared/sdk-server": "1.2.3", + "packages/sdk/server-node": "8.2.4", + "packages/sdk/cloudflare": "2.2.0", + "packages/shared/sdk-server-edge": "1.0.13", + "packages/sdk/vercel": "1.1.4", + "packages/sdk/akamai-base": "1.0.7", + "packages/sdk/akamai-edgekv": "1.0.7", + "packages/shared/akamai-edgeworker-sdk": "0.3.4", + "packages/store/node-server-sdk-dynamodb": "5.0.11", + "packages/store/node-server-sdk-redis": "3.0.11" } diff --git a/packages/sdk/akamai-base/CHANGELOG.md b/packages/sdk/akamai-base/CHANGELOG.md index d8da8f053..1858b2e2a 100644 --- a/packages/sdk/akamai-base/CHANGELOG.md +++ b/packages/sdk/akamai-base/CHANGELOG.md @@ -2,6 +2,19 @@ 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.7](https://github.com/launchdarkly/js-core/compare/akamai-server-base-sdk-v1.0.6...akamai-server-base-sdk-v1.0.7) (2023-09-06) + +### Bug Fixes + +* Use clientSideAvailability instead of clientSide for filtering client side flags. ([#270](https://github.com/launchdarkly/js-core/issues/270)) ([2702342](https://github.com/launchdarkly/js-core/commit/27023429d36986466cda46aa4d95eb01c10cd455)) + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^0.3.3 to ^0.3.4 + * @launchdarkly/js-server-sdk-common bumped from ^1.2.2 to ^1.2.3 + ### Dependencies * The following workspace dependencies were updated diff --git a/packages/sdk/akamai-base/package.json b/packages/sdk/akamai-base/package.json index 09f511b90..b981824eb 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.6", + "version": "1.0.7", "description": "Akamai LaunchDarkly EdgeWorker SDK", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/akamai-base", "repository": { @@ -72,7 +72,7 @@ "typescript": "5.1.6" }, "dependencies": { - "@launchdarkly/akamai-edgeworker-sdk-common": "^0.3.3", - "@launchdarkly/js-server-sdk-common": "^1.2.2" + "@launchdarkly/akamai-edgeworker-sdk-common": "^0.3.4", + "@launchdarkly/js-server-sdk-common": "^1.2.3" } } diff --git a/packages/sdk/akamai-edgekv/CHANGELOG.md b/packages/sdk/akamai-edgekv/CHANGELOG.md index 41cb0d110..6033ee4fe 100644 --- a/packages/sdk/akamai-edgekv/CHANGELOG.md +++ b/packages/sdk/akamai-edgekv/CHANGELOG.md @@ -2,6 +2,19 @@ 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.7](https://github.com/launchdarkly/js-core/compare/akamai-server-edgekv-sdk-v1.0.6...akamai-server-edgekv-sdk-v1.0.7) (2023-08-14) + +### Bug Fixes + +* Use clientSideAvailability instead of clientSide for filtering client side flags. ([#270](https://github.com/launchdarkly/js-core/issues/270)) ([2702342](https://github.com/launchdarkly/js-core/commit/27023429d36986466cda46aa4d95eb01c10cd455)) + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^0.3.3 to ^0.3.4 + * @launchdarkly/js-server-sdk-common bumped from ^1.2.2 to ^1.2.3 + ### Dependencies * The following workspace dependencies were updated diff --git a/packages/sdk/akamai-edgekv/package.json b/packages/sdk/akamai-edgekv/package.json index 1b177e24d..fe2f3400d 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.6", + "version": "1.0.7", "description": "Akamai LaunchDarkly EdgeWorker SDK for EdgeKV feature store", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/akamai-edgekv", "repository": { @@ -72,7 +72,7 @@ "typescript": "5.1.6" }, "dependencies": { - "@launchdarkly/akamai-edgeworker-sdk-common": "^0.3.3", - "@launchdarkly/js-server-sdk-common": "^1.2.2" + "@launchdarkly/akamai-edgeworker-sdk-common": "^0.3.4", + "@launchdarkly/js-server-sdk-common": "^1.2.3" } } diff --git a/packages/sdk/cloudflare/CHANGELOG.md b/packages/sdk/cloudflare/CHANGELOG.md index c3e5f7cce..4334581e2 100644 --- a/packages/sdk/cloudflare/CHANGELOG.md +++ b/packages/sdk/cloudflare/CHANGELOG.md @@ -2,6 +2,25 @@ 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.2.0](https://github.com/launchdarkly/js-core/compare/cloudflare-server-sdk-v2.1.4...cloudflare-server-sdk-v2.2.0) (2023-09-21) + + +### Features + +* rollup cloudflare sdk ([#279](https://github.com/launchdarkly/js-core/issues/279)) ([7af4f6e](https://github.com/launchdarkly/js-core/commit/7af4f6e2d029b87396087d96904cdfa7d39a8cb3)) + +## [2.1.4](https://github.com/launchdarkly/js-core/compare/cloudflare-server-sdk-v2.1.3...cloudflare-server-sdk-v2.1.4) (2023-09-06) + +### Bug Fixes + +* Use clientSideAvailability instead of clientSide for filtering client side flags. ([#270](https://github.com/launchdarkly/js-core/issues/270)) ([2702342](https://github.com/launchdarkly/js-core/commit/27023429d36986466cda46aa4d95eb01c10cd455)) + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common-edge bumped from 1.0.12 to 1.0.13 + ### Dependencies * The following workspace dependencies were updated @@ -14,6 +33,7 @@ All notable changes to the LaunchDarkly SDK for Cloudflare Workers will be docum * dependencies * @launchdarkly/js-server-sdk-common-edge bumped from 1.0.11 to 1.0.12 + ## [2.1.1](https://github.com/launchdarkly/js-core/compare/cloudflare-server-sdk-v2.1.0...cloudflare-server-sdk-v2.1.1) (2023-08-14) Updated common dependency includes performance improvements. diff --git a/packages/sdk/cloudflare/example/package.json b/packages/sdk/cloudflare/example/package.json index 5b9cc8711..25ab3aa7c 100644 --- a/packages/sdk/cloudflare/example/package.json +++ b/packages/sdk/cloudflare/example/package.json @@ -5,7 +5,7 @@ "module": "./dist/index.mjs", "packageManager": "yarn@3.4.1", "dependencies": { - "@launchdarkly/cloudflare-server-sdk": "^2.0.2" + "@launchdarkly/cloudflare-server-sdk": "^2.1.4" }, "devDependencies": { "@cloudflare/workers-types": "^4.20230321.0", @@ -17,14 +17,13 @@ "prettier": "^2.6.2", "ts-jest": "^28.0.3", "typescript": "5.1.6", - "wrangler": "2.13.0" + "wrangler": "2.20.1" }, "scripts": { - "build": "yarn && yarn link-dev && node build.js", + "build": "node build.js", "start": "wrangler dev", "deploy": "wrangler publish", - "test": "yarn build && node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js", - "clean": "rm -rf dist && rm -rf node_modules && rm -rf .yarn/cache && yarn build", - "link-dev": "cd ../../../../ && yarn link-dev" + "test": "yarn build && jest", + "clean": "rm -rf dist && rm -rf node_modules && rm -rf .yarn/cache && yarn build" } } diff --git a/packages/sdk/cloudflare/example/src/index.test.ts b/packages/sdk/cloudflare/example/src/index.test.ts index 2c11ecb3c..0ada18236 100644 --- a/packages/sdk/cloudflare/example/src/index.test.ts +++ b/packages/sdk/cloudflare/example/src/index.test.ts @@ -1,15 +1,22 @@ import app from './index'; import testData from './testData.json'; -test('variation true', async () => { - // arrange - const env = getMiniflareBindings(); - const { LD_KV } = env; - await LD_KV.put('LD-Env-test-sdk-key', JSON.stringify(testData)); +describe('test', () => { + let env: Bindings; - // act - const res = await app.fetch(new Request('http://localhost'), env); + beforeEach(async () => { + env = getMiniflareBindings(); + const { LD_KV } = env; + await LD_KV.put('LD-Env-test-sdk-key', JSON.stringify(testData)); + }); - // assert - expect(await res.text()).toContain('testFlag1: true'); + test('variation true', async () => { + const res = await app.fetch(new Request('http://localhost/?email=truemail'), env); + expect(await res.text()).toContain('testFlag1: true'); + }); + + test('variation false', async () => { + const res = await app.fetch(new Request('http://localhost/?email=falsemail'), env); + expect(await res.text()).toContain('testFlag1: false'); + }); }); diff --git a/packages/sdk/cloudflare/example/src/index.ts b/packages/sdk/cloudflare/example/src/index.ts index 9f66c82f2..49a459a06 100644 --- a/packages/sdk/cloudflare/example/src/index.ts +++ b/packages/sdk/cloudflare/example/src/index.ts @@ -11,7 +11,11 @@ const handler: ExportedHandler = { ): Promise { const clientSideID = 'client-side-id'; const flagKey = 'testFlag1'; - const context = { kind: 'org', key: 'org-key-cf', email: 'testcforg@gmail.com' }; + const { searchParams } = new URL(request.url); + + // falsemail will return false, other emails return true + const email = searchParams.get('email') ?? 'test@anymail.com'; + const context = { kind: 'user', key: 'test-user-key-1', email }; // start using ld const client = initLD(clientSideID, env.LD_KV, { sendEvents: true }); diff --git a/packages/sdk/cloudflare/example/src/testData.json b/packages/sdk/cloudflare/example/src/testData.json index 495819a24..d4fbacd7b 100644 --- a/packages/sdk/cloudflare/example/src/testData.json +++ b/packages/sdk/cloudflare/example/src/testData.json @@ -14,7 +14,7 @@ "contextKind": "user", "attribute": "/email", "op": "contains", - "values": ["gmail"], + "values": ["falsemail"], "negate": false } ], diff --git a/packages/sdk/cloudflare/package.json b/packages/sdk/cloudflare/package.json index 705375ba4..c4726958d 100644 --- a/packages/sdk/cloudflare/package.json +++ b/packages/sdk/cloudflare/package.json @@ -1,6 +1,6 @@ { "name": "@launchdarkly/cloudflare-server-sdk", - "version": "2.1.3", + "version": "2.2.0", "description": "Cloudflare LaunchDarkly SDK", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/cloudflare", "repository": { @@ -17,34 +17,43 @@ ], "type": "module", "exports": { - "require": "./dist/cjs/src/index.js", - "import": "./dist/esm/src/index.js" + "types": "./dist/index.d.ts", + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js" }, - "main": "./dist/cjs/src/index.js", - "types": "./dist/cjs/src/index.d.ts", + "main": "./dist/cjs/index.js", + "types": "./dist/index.d.ts", "files": [ "dist" ], "scripts": { - "build": "../../../scripts/build-package.sh", "clean": "rimraf dist", + "rb": "rollup -c --configPlugin typescript", + "rbw": "yarn rb --watch", + "build": "yarn clean && yarn rb", "tsw": "yarn tsc --watch", "start": "rimraf dist && yarn tsw", "lint": "eslint . --ext .ts", "prettier": "prettier --write '**/*.@(js|ts|tsx|json|css)' --ignore-path ../../../.prettierignore", "test": "NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest --ci --runInBand", "coverage": "yarn test --coverage", - "check": "yarn prettier && yarn lint && yarn build && yarn test && yarn doc" + "check": "yarn prettier && yarn lint && yarn build && yarn test" }, "dependencies": { "@cloudflare/workers-types": "^4.20230321.0", - "@launchdarkly/js-server-sdk-common-edge": "1.0.12", "crypto-js": "^4.1.1" }, "devDependencies": { + "@launchdarkly/js-server-sdk-common-edge": "1.0.13", + "@rollup/plugin-commonjs": "^25.0.4", + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-node-resolve": "^15.2.1", + "@rollup/plugin-terser": "^0.4.3", + "@rollup/plugin-typescript": "^11.1.3", "@trivago/prettier-plugin-sort-imports": "^4.1.1", "@types/crypto-js": "^4.1.1", "@types/jest": "^29.5.0", + "@types/rollup-plugin-generate-package-json": "^3.2.3", "@typescript-eslint/eslint-plugin": "^6.1.0", "@typescript-eslint/parser": "^6.1.0", "eslint": "^8.45.0", @@ -57,9 +66,17 @@ "launchdarkly-js-test-helpers": "^2.2.0", "miniflare": "^2.13.0", "prettier": "^3.0.0", - "rimraf": "^5.0.0", + "rimraf": "^5.0.1", + "rollup": "^3.29.2", + "rollup-plugin-dts": "^6.0.2", + "rollup-plugin-esbuild": "^5.0.0", + "rollup-plugin-filesize": "^10.0.0", + "rollup-plugin-generate-package-json": "^3.2.0", "ts-jest": "^29.1.0", "typedoc": "0.25.0", "typescript": "5.1.6" - } + }, + "bundledDependencies": [ + "@launchdarkly/js-server-sdk-common-edge" + ] } diff --git a/packages/sdk/cloudflare/rollup.config.ts b/packages/sdk/cloudflare/rollup.config.ts new file mode 100644 index 000000000..4947a117c --- /dev/null +++ b/packages/sdk/cloudflare/rollup.config.ts @@ -0,0 +1,53 @@ +import commonjs from '@rollup/plugin-commonjs'; +import json from '@rollup/plugin-json'; +import resolve from '@rollup/plugin-node-resolve'; +import terser from '@rollup/plugin-terser'; +import dts from 'rollup-plugin-dts'; +import esbuild from 'rollup-plugin-esbuild'; +import filesize from 'rollup-plugin-filesize'; + +const inputPath = 'src/index.ts'; +const cjsPath = 'dist/cjs/index.js'; +const esmPath = 'dist/esm/index.js'; +const typingsPath = 'dist/index.d.ts'; + +const plugins = [resolve(), commonjs(), esbuild(), json(), terser(), filesize()]; + +// the second array item is a function to include all js-core packages in the bundle so they +// are not imported or required as separate npm packages +const external = [/node_modules/, (id: string) => !id.includes('js-core')]; + +export default [ + { + input: inputPath, + output: [ + { + file: cjsPath, + format: 'cjs', + sourcemap: true, + }, + ], + plugins, + external, + }, + { + input: inputPath, + output: [ + { + file: esmPath, + format: 'esm', + sourcemap: true, + }, + ], + plugins, + external, + }, + { + input: inputPath, + plugins: [dts(), json()], + output: { + file: typingsPath, + format: 'esm', + }, + }, +]; diff --git a/packages/sdk/cloudflare/src/index.test.ts b/packages/sdk/cloudflare/src/index.test.ts index baeed982f..978d525d6 100644 --- a/packages/sdk/cloudflare/src/index.test.ts +++ b/packages/sdk/cloudflare/src/index.test.ts @@ -51,7 +51,7 @@ describe('init', () => { }); test('rule match', async () => { - const contextWithEmail = { ...context, email: 'test@gmail.com' }; + const contextWithEmail = { ...context, email: 'test@falsemail.com' }; const value = await ldClient.variation(flagKey1, contextWithEmail, false); const detail = await ldClient.variationDetail(flagKey1, contextWithEmail, false); diff --git a/packages/sdk/cloudflare/src/testData.json b/packages/sdk/cloudflare/src/testData.json index b9e5296c0..f4b0b3e3f 100644 --- a/packages/sdk/cloudflare/src/testData.json +++ b/packages/sdk/cloudflare/src/testData.json @@ -14,7 +14,7 @@ "contextKind": "user", "attribute": "/email", "op": "contains", - "values": ["gmail"], + "values": ["falsemail"], "negate": false } ], diff --git a/packages/sdk/cloudflare/tsconfig.json b/packages/sdk/cloudflare/tsconfig.json index 3192817ef..cdc07991e 100644 --- a/packages/sdk/cloudflare/tsconfig.json +++ b/packages/sdk/cloudflare/tsconfig.json @@ -3,9 +3,9 @@ // Uses "." so it can load package.json. "rootDir": ".", "outDir": "dist", - "target": "es2017", + "target": "ES2017", "lib": ["es6"], - "module": "commonjs", + "module": "ES6", "strict": true, "noImplicitOverride": true, "allowSyntheticDefaultImports": true, diff --git a/packages/sdk/server-node/CHANGELOG.md b/packages/sdk/server-node/CHANGELOG.md index a62696ab6..9c5fb44cb 100644 --- a/packages/sdk/server-node/CHANGELOG.md +++ b/packages/sdk/server-node/CHANGELOG.md @@ -2,6 +2,19 @@ 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.4](https://github.com/launchdarkly/js-core/compare/node-server-sdk-v8.2.3...node-server-sdk-v8.2.4) (2023-09-06) + +### Bug Fixes + +* Use clientSideAvailability instead of clientSide for filtering client side flags. ([#270](https://github.com/launchdarkly/js-core/issues/270)) ([2702342](https://github.com/launchdarkly/js-core/commit/27023429d36986466cda46aa4d95eb01c10cd455)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common bumped from 1.2.2 to 1.2.3 + ## [8.2.3](https://github.com/launchdarkly/js-core/compare/node-server-sdk-v8.2.2...node-server-sdk-v8.2.3) (2023-08-28) ## Fixes: diff --git a/packages/sdk/server-node/package.json b/packages/sdk/server-node/package.json index 03bf9f147..ad1d283eb 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.2.3", + "version": "8.2.4", "description": "LaunchDarkly Server-Side SDK for Node.js", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/server-node", "repository": { @@ -45,7 +45,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@launchdarkly/js-server-sdk-common": "1.2.2", + "@launchdarkly/js-server-sdk-common": "1.2.3", "https-proxy-agent": "^5.0.1", "launchdarkly-eventsource": "2.0.1" }, diff --git a/packages/sdk/server-node/src/api/LDClient.ts b/packages/sdk/server-node/src/api/LDClient.ts index a2db76627..67810a88f 100644 --- a/packages/sdk/server-node/src/api/LDClient.ts +++ b/packages/sdk/server-node/src/api/LDClient.ts @@ -11,6 +11,11 @@ import { BigSegmentStoreStatusProvider } from './interfaces'; * and continue to use it throughout the lifetime of the application, rather than creating instances * on the fly. * + * Note that `LDClient` inherits from `EventEmitter`, so you can use the standard `on()`, `once()`, and + * `off()` methods to receive events. The standard `EventEmitter` methods are not documented here; see the + * {@link https://nodejs.org/api/events.html#events_class_eventemitter|Node API documentation}. For a + * description of events you can listen for, see {@link on}. + * */ export interface LDClient extends LDClientCommon, EventEmitter { /** @@ -21,4 +26,30 @@ export interface LDClient extends LDClientCommon, EventEmitter { * {@link interfaces.BigSegmentStoreStatusProvider} for more about this functionality. */ readonly bigSegmentStoreStatusProvider: BigSegmentStoreStatusProvider; + + /** + * + * Registers an event listener that will be called when the client triggers some type of event. + * + * This is the standard `on` method inherited from Node's `EventEmitter`; see the + * {@link https://nodejs.org/api/events.html#events_class_eventemitter|Node API docs} for more + * details on how to manage event listeners. Here is a description of the event types defined + * by `LDClient`. + * + * - `"ready"`: Sent only once, when the client has successfully connected to LaunchDarkly. + * Alternately, you can detect this with [[waitForInitialization]]. + * - `"failed"`: Sent only once, if the client has permanently failed to connect to LaunchDarkly. + * Alternately, you can detect this with [[waitForInitialization]]. + * - `"error"`: Contains an error object describing some abnormal condition that the client has detected + * (such as a network error). + * - `"update"`: The client has received a change to a feature flag. The event parameter is an object + * containing a single property, `key`, the flag key. Note that this does not necessarily mean the flag's + * value has changed for any particular context, only that some part of the flag configuration was changed. + * - `"update:KEY"`: The client has received a change to the feature flag whose key is KEY. This is the + * same as `"update"` but allows you to listen for a specific flag. + * + * @param event the name of the event to listen for + * @param listener the function to call when the event happens + */ + on(event: string | symbol, listener: (...args: any[]) => void): this; } diff --git a/packages/sdk/vercel/CHANGELOG.md b/packages/sdk/vercel/CHANGELOG.md index d24de7c68..afb629395 100644 --- a/packages/sdk/vercel/CHANGELOG.md +++ b/packages/sdk/vercel/CHANGELOG.md @@ -2,6 +2,12 @@ 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.4](https://github.com/launchdarkly/js-core/compare/vercel-server-sdk-v1.1.3...vercel-server-sdk-v1.1.4) (2023-09-06) + +### Bug Fixes + +* Use clientSideAvailability instead of clientSide for filtering client side flags. ([#270](https://github.com/launchdarkly/js-core/issues/270)) ([2702342](https://github.com/launchdarkly/js-core/commit/27023429d36986466cda46aa4d95eb01c10cd455)) + ### Dependencies * The following workspace dependencies were updated @@ -10,6 +16,12 @@ All notable changes to the LaunchDarkly SDK for Vercel Edge Config will be docum ### Dependencies +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common-edge bumped from 1.0.12 to 1.0.13 + +### Dependencies + * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common-edge bumped from 1.0.11 to 1.0.12 diff --git a/packages/sdk/vercel/package.json b/packages/sdk/vercel/package.json index f6c852683..3350e057c 100644 --- a/packages/sdk/vercel/package.json +++ b/packages/sdk/vercel/package.json @@ -1,6 +1,6 @@ { "name": "@launchdarkly/vercel-server-sdk", - "version": "1.1.3", + "version": "1.1.4", "description": "LaunchDarkly Server-Side SDK for Vercel Edge", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/vercel", "repository": { @@ -36,7 +36,7 @@ "check": "yarn prettier && yarn lint && yarn build && yarn test && yarn doc" }, "dependencies": { - "@launchdarkly/js-server-sdk-common-edge": "1.0.12", + "@launchdarkly/js-server-sdk-common-edge": "1.0.13", "@vercel/edge-config": "^0.1.8", "crypto-js": "^4.1.1" }, diff --git a/packages/shared/akamai-edgeworker-sdk/CHANGELOG.md b/packages/shared/akamai-edgeworker-sdk/CHANGELOG.md index 9e6a9cf32..ed6c47936 100644 --- a/packages/shared/akamai-edgeworker-sdk/CHANGELOG.md +++ b/packages/shared/akamai-edgeworker-sdk/CHANGELOG.md @@ -50,6 +50,20 @@ All notable changes to the LaunchDarkly SDK for Akamai Workers will be documente * dependencies * @launchdarkly/js-server-sdk-common bumped from ^1.2.1 to ^1.2.2 +## [0.3.4](https://github.com/launchdarkly/js-core/compare/akamai-edgeworker-sdk-common-v0.3.3...akamai-edgeworker-sdk-common-v0.3.4) (2023-09-06) + + +### Bug Fixes + +* Use clientSideAvailability instead of clientSide for filtering client side flags. ([#270](https://github.com/launchdarkly/js-core/issues/270)) ([2702342](https://github.com/launchdarkly/js-core/commit/27023429d36986466cda46aa4d95eb01c10cd455)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common bumped from ^1.2.2 to ^1.2.3 + ## [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) diff --git a/packages/shared/akamai-edgeworker-sdk/package.json b/packages/shared/akamai-edgeworker-sdk/package.json index 81a31e457..7717de974 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.3.3", + "version": "0.3.4", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/shared/akamai-edge-sdk", "repository": { "type": "git", @@ -54,7 +54,7 @@ "typescript": "5.1.6" }, "dependencies": { - "@launchdarkly/js-server-sdk-common": "^1.2.2", + "@launchdarkly/js-server-sdk-common": "^1.2.3", "crypto-js": "^4.1.1" } } diff --git a/packages/shared/akamai-edgeworker-sdk/src/__tests__/testData.json b/packages/shared/akamai-edgeworker-sdk/src/__tests__/testData.json index 3f1388b52..2ff385cdf 100644 --- a/packages/shared/akamai-edgeworker-sdk/src/__tests__/testData.json +++ b/packages/shared/akamai-edgeworker-sdk/src/__tests__/testData.json @@ -97,7 +97,7 @@ "variations": [true, false], "clientSideAvailability": { "usingMobileKey": true, - "usingEnvironmentId": true + "usingEnvironmentId": false }, "clientSide": false, "salt": "aef830243d6640d0a973be89988e008d", diff --git a/packages/shared/sdk-server-edge/CHANGELOG.md b/packages/shared/sdk-server-edge/CHANGELOG.md index 854f19c4c..1a2756ca0 100644 --- a/packages/shared/sdk-server-edge/CHANGELOG.md +++ b/packages/shared/sdk-server-edge/CHANGELOG.md @@ -60,6 +60,12 @@ * dependencies * @launchdarkly/js-server-sdk-common bumped from 1.2.1 to 1.2.2 +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @launchdarkly/js-server-sdk-common bumped from 1.2.2 to 1.2.3 + ## [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) diff --git a/packages/shared/sdk-server-edge/package.json b/packages/shared/sdk-server-edge/package.json index de25ba3c0..cba17cd4a 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.12", + "version": "1.0.13", "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/shared/sdk-server-edge", "repository": { "type": "git", @@ -36,7 +36,7 @@ "check": "yarn prettier && yarn lint && yarn build && yarn test && yarn doc" }, "dependencies": { - "@launchdarkly/js-server-sdk-common": "1.2.2", + "@launchdarkly/js-server-sdk-common": "1.2.3", "crypto-js": "^4.1.1" }, "devDependencies": { diff --git a/packages/shared/sdk-server/CHANGELOG.md b/packages/shared/sdk-server/CHANGELOG.md index a3f96ff1b..8dfed787e 100644 --- a/packages/shared/sdk-server/CHANGELOG.md +++ b/packages/shared/sdk-server/CHANGELOG.md @@ -2,6 +2,13 @@ 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.2.3](https://github.com/launchdarkly/js-core/compare/js-server-sdk-common-v1.2.2...js-server-sdk-common-v1.2.3) (2023-09-06) + + +### Bug Fixes + +* Use clientSideAvailability instead of clientSide for filtering client side flags. ([#270](https://github.com/launchdarkly/js-core/issues/270)) ([2702342](https://github.com/launchdarkly/js-core/commit/27023429d36986466cda46aa4d95eb01c10cd455)) + ## [1.2.2](https://github.com/launchdarkly/js-core/compare/js-server-sdk-common-v1.2.1...js-server-sdk-common-v1.2.2) (2023-08-28) diff --git a/packages/shared/sdk-server/__tests__/LDClient.allFlags.test.ts b/packages/shared/sdk-server/__tests__/LDClient.allFlags.test.ts index 5861068c2..4f3fd1987 100644 --- a/packages/shared/sdk-server/__tests__/LDClient.allFlags.test.ts +++ b/packages/shared/sdk-server/__tests__/LDClient.allFlags.test.ts @@ -108,28 +108,28 @@ describe('given an LDClient with test data', () => { on: false, offVariation: 0, variations: ['a'], - clientSide: false, }); td.usePreconfiguredFlag({ key: 'server-side-2', on: false, offVariation: 0, variations: ['b'], - clientSide: false, + // Absence and false should be equivalent, so we add a false one here. + clientSideAvailability: { usingEnvironmentId: false }, }); td.usePreconfiguredFlag({ key: 'client-side-1', on: false, offVariation: 0, variations: ['value1'], - clientSide: true, + clientSideAvailability: { usingEnvironmentId: true }, }); td.usePreconfiguredFlag({ key: 'client-side-2', on: false, offVariation: 0, variations: ['value2'], - clientSide: true, + clientSideAvailability: { usingEnvironmentId: true }, }); const state = await client.allFlagsState(defaultUser, { clientSideOnly: true }); expect(state.valid).toEqual(true); @@ -241,28 +241,26 @@ describe('given an LDClient with test data', () => { on: false, offVariation: 0, variations: ['a'], - clientSide: false, }); td.usePreconfiguredFlag({ key: 'server-side-2', on: false, offVariation: 0, variations: ['b'], - clientSide: false, }); td.usePreconfiguredFlag({ key: 'client-side-1', on: false, offVariation: 0, variations: ['value1'], - clientSide: true, + clientSideAvailability: { usingEnvironmentId: true }, }); td.usePreconfiguredFlag({ key: 'client-side-2', on: false, offVariation: 0, variations: ['value2'], - clientSide: true, + clientSideAvailability: { usingEnvironmentId: true }, }); client.allFlagsState(defaultUser, { clientSideOnly: true }, (err, state) => { expect(state.valid).toEqual(true); diff --git a/packages/shared/sdk-server/package.json b/packages/shared/sdk-server/package.json index 0b45b114d..9a3c4fbb9 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.2.2", + "version": "1.2.3", "type": "commonjs", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/packages/shared/sdk-server/src/LDClientImpl.ts b/packages/shared/sdk-server/src/LDClientImpl.ts index bd07fabd1..abecc4006 100644 --- a/packages/shared/sdk-server/src/LDClientImpl.ts +++ b/packages/shared/sdk-server/src/LDClientImpl.ts @@ -302,7 +302,7 @@ export default class LDClientImpl implements LDClient { Object.values(allFlags), (storeItem, iterCb) => { const flag = storeItem as Flag; - if (clientOnly && !flag.clientSide) { + if (clientOnly && !flag.clientSideAvailability?.usingEnvironmentId) { iterCb(true); return; } diff --git a/packages/store/node-server-sdk-dynamodb/CHANGELOG.md b/packages/store/node-server-sdk-dynamodb/CHANGELOG.md index a8b9278dd..b21c86d96 100644 --- a/packages/store/node-server-sdk-dynamodb/CHANGELOG.md +++ b/packages/store/node-server-sdk-dynamodb/CHANGELOG.md @@ -48,6 +48,12 @@ * devDependencies * @launchdarkly/node-server-sdk bumped from 8.2.2 to 8.2.3 +### Dependencies + +* The following workspace dependencies were updated + * devDependencies + * @launchdarkly/node-server-sdk bumped from 8.2.3 to 8.2.4 + ## [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) diff --git a/packages/store/node-server-sdk-dynamodb/package.json b/packages/store/node-server-sdk-dynamodb/package.json index f4a231c90..378efbae5 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.10", + "version": "5.0.11", "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": { @@ -35,7 +35,7 @@ }, "devDependencies": { "@aws-sdk/client-dynamodb": "3.348.0", - "@launchdarkly/node-server-sdk": "8.2.3", + "@launchdarkly/node-server-sdk": "8.2.4", "@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/CHANGELOG.md b/packages/store/node-server-sdk-redis/CHANGELOG.md index d828fcd2f..2612690f2 100644 --- a/packages/store/node-server-sdk-redis/CHANGELOG.md +++ b/packages/store/node-server-sdk-redis/CHANGELOG.md @@ -48,6 +48,12 @@ * devDependencies * @launchdarkly/node-server-sdk bumped from 8.2.2 to 8.2.3 +### Dependencies + +* The following workspace dependencies were updated + * devDependencies + * @launchdarkly/node-server-sdk bumped from 8.2.3 to 8.2.4 + ## [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) diff --git a/packages/store/node-server-sdk-redis/package.json b/packages/store/node-server-sdk-redis/package.json index c8968b57a..a04f34a9b 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.10", + "version": "3.0.11", "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": { @@ -33,7 +33,7 @@ "@launchdarkly/node-server-sdk": "8.x" }, "devDependencies": { - "@launchdarkly/node-server-sdk": "8.2.3", + "@launchdarkly/node-server-sdk": "8.2.4", "@trivago/prettier-plugin-sort-imports": "^4.1.1", "@types/jest": "^29.4.0", "@typescript-eslint/eslint-plugin": "^6.1.0", diff --git a/scripts/build-package.sh b/scripts/build-package.sh index 25282db79..0466d3697 100755 --- a/scripts/build-package.sh +++ b/scripts/build-package.sh @@ -1,5 +1,4 @@ -#!/bin/bash - +#!/usr/bin/env bash # Run this script like: # ./scripts/build-package.sh