-
Notifications
You must be signed in to change notification settings - Fork 26
feat: Add client-side SDK plugin support. #834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add client-side SDK plugin support. #834
Conversation
@launchdarkly/js-sdk-common size report |
@launchdarkly/js-client-sdk size report |
@launchdarkly/js-client-sdk-common size report |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted from existing client tests to be re-used for plugin tests.
🤖 I have created a release *beep* *boop* --- <details><summary>akamai-edgeworker-sdk-common: 2.0.6</summary> ## [2.0.6](akamai-edgeworker-sdk-common-v2.0.5...akamai-edgeworker-sdk-common-v2.0.6) (2025-04-29) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from ^2.15.0 to ^2.15.1 </details> <details><summary>akamai-server-base-sdk: 3.0.6</summary> ## [3.0.6](akamai-server-base-sdk-v3.0.5...akamai-server-base-sdk-v3.0.6) (2025-04-29) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^2.0.5 to ^2.0.6 * @launchdarkly/js-server-sdk-common bumped from ^2.15.0 to ^2.15.1 </details> <details><summary>akamai-server-edgekv-sdk: 1.4.8</summary> ## [1.4.8](akamai-server-edgekv-sdk-v1.4.7...akamai-server-edgekv-sdk-v1.4.8) (2025-04-29) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^2.0.5 to ^2.0.6 * @launchdarkly/js-server-sdk-common bumped from ^2.15.0 to ^2.15.1 </details> <details><summary>browser-telemetry: 1.0.7</summary> ## [1.0.7](browser-telemetry-v1.0.6...browser-telemetry-v1.0.7) (2025-04-29) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/js-client-sdk bumped from 0.5.3 to 0.6.0 </details> <details><summary>cloudflare-server-sdk: 2.7.5</summary> ## [2.7.5](cloudflare-server-sdk-v2.7.4...cloudflare-server-sdk-v2.7.5) (2025-04-29) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common-edge bumped from 2.6.4 to 2.6.5 </details> <details><summary>fastly-server-sdk: 0.1.6</summary> ## [0.1.6](fastly-server-sdk-v0.1.5...fastly-server-sdk-v0.1.6) (2025-04-29) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from 2.15.0 to 2.15.1 </details> <details><summary>jest: 0.1.5</summary> ## [0.1.5](jest-v0.1.4...jest-v0.1.5) (2025-04-29) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/react-native-client-sdk bumped from ~10.9.9 to ~10.10.0 </details> <details><summary>js-client-sdk: 0.6.0</summary> ## [0.6.0](js-client-sdk-v0.5.3...js-client-sdk-v0.6.0) (2025-04-29) ### Features * Add client-side SDK plugin support. ([#834](#834)) ([a843a33](a843a33)) ### Bug Fixes * Client SDKs should use wrapper information. ([#836](#836)) ([1e0cf6a](1e0cf6a)) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-client-sdk-common bumped from 1.12.6 to 1.13.0 </details> <details><summary>js-client-sdk-common: 1.13.0</summary> ## [1.13.0](js-client-sdk-common-v1.12.6...js-client-sdk-common-v1.13.0) (2025-04-29) ### Features * Add client-side SDK plugin support. ([#834](#834)) ([a843a33](a843a33)) * Add hook support for the track series. ([#827](#827)) ([1519cb9](1519cb9)) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-sdk-common bumped from 2.16.0 to 2.17.0 </details> <details><summary>js-sdk-common: 2.17.0</summary> ## [2.17.0](js-sdk-common-v2.16.0...js-sdk-common-v2.17.0) (2025-04-29) ### Features * Add client-side SDK plugin support. ([#834](#834)) ([a843a33](a843a33)) </details> <details><summary>js-server-sdk-common: 2.15.1</summary> ## [2.15.1](js-server-sdk-common-v2.15.0...js-server-sdk-common-v2.15.1) (2025-04-29) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-sdk-common bumped from 2.16.0 to 2.17.0 </details> <details><summary>js-server-sdk-common-edge: 2.6.5</summary> ## [2.6.5](js-server-sdk-common-edge-v2.6.4...js-server-sdk-common-edge-v2.6.5) (2025-04-29) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from 2.15.0 to 2.15.1 </details> <details><summary>node-server-sdk: 9.9.1</summary> ## [9.9.1](node-server-sdk-v9.9.0...node-server-sdk-v9.9.1) (2025-04-29) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from 2.15.0 to 2.15.1 </details> <details><summary>node-server-sdk-dynamodb: 6.2.10</summary> ## [6.2.10](node-server-sdk-dynamodb-v6.2.9...node-server-sdk-dynamodb-v6.2.10) (2025-04-29) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/node-server-sdk bumped from 9.9.0 to 9.9.1 * peerDependencies * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.9.1 </details> <details><summary>node-server-sdk-otel: 1.2.1</summary> ## [1.2.1](node-server-sdk-otel-v1.2.0...node-server-sdk-otel-v1.2.1) (2025-04-29) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/node-server-sdk bumped from 9.9.0 to 9.9.1 * peerDependencies * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.9.1 </details> <details><summary>node-server-sdk-redis: 4.2.10</summary> ## [4.2.10](node-server-sdk-redis-v4.2.9...node-server-sdk-redis-v4.2.10) (2025-04-29) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/node-server-sdk bumped from 9.9.0 to 9.9.1 * peerDependencies * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.9.1 </details> <details><summary>react-native-client-sdk: 10.10.0</summary> ## [10.10.0](react-native-client-sdk-v10.9.9...react-native-client-sdk-v10.10.0) (2025-04-29) ### Features * Add client-side SDK plugin support. ([#834](#834)) ([a843a33](a843a33)) ### Bug Fixes * Client SDKs should use wrapper information. ([#836](#836)) ([1e0cf6a](1e0cf6a)) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-client-sdk-common bumped from 1.12.6 to 1.13.0 </details> <details><summary>server-sdk-ai: 0.9.7</summary> ## [0.9.7](server-sdk-ai-v0.9.6...server-sdk-ai-v0.9.7) (2025-04-29) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/js-server-sdk-common bumped from 2.15.0 to 2.15.1 * peerDependencies * @launchdarkly/js-server-sdk-common bumped from 2.x to 2.15.1 </details> <details><summary>vercel-server-sdk: 1.3.29</summary> ## [1.3.29](vercel-server-sdk-v1.3.28...vercel-server-sdk-v1.3.29) (2025-04-29) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common-edge bumped from 2.6.4 to 2.6.5 </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Adds plugin support for react native and browser.
Types are common, as well as most functionality, but SDK specific implementation is required. This is because the leaf-node SDKs have different types for the LDClient. Also the SDK needs control over the ordering of operations that happen during construction in order to register plugins at the correct point.
There is a bit more complexity in this implementation than would be required for most SDKs. Some refactoring of the base client implementation, potentially to use composition instead of inheritance, may allow for some better sharing here in the long-term.
Initially I tried using generics in the base implementation, to account for the different client implementations, but this introduced a lot of changes to all the layers and didn't play well with configuration, which also then needs to be generic.
The approach I took was to have the configuration in the individual SDKs and then use generics for utility methods to collect hooks and register plugins. In the long-term this would also benefit from the base implementation using generics for the configuration, which would allow a shared configuration and validation.