Code Monkey home page Code Monkey logo

js-sdk-contrib's People

Contributors

adams85 avatar aepfli avatar ajwootto avatar beeme1mr avatar connyay avatar emmawillis avatar github-actions[bot] avatar james-milligan avatar juanparadox avatar kavindu-dodan avatar kyle-ssg avatar lukas-reining avatar markphelps avatar mateoc avatar moredip avatar msamper avatar odubajdt avatar renovate[bot] avatar robbert229 avatar rolodato avatar sago2k8 avatar thomaspoignant avatar toddbaert avatar yquansah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

js-sdk-contrib's Issues

[OFO/flagd] Implement flagd-web-provider

We need to build an experimental flagd-web provider. This should work in accordance with the proposed spec enhancements for client side. It should feature:

  • integration with the experimental-web-sdk
  • bulk evaluation on context change
  • synchronous evaluation

An implementation is already partially complete here.

[flagd-provider] add unit test for zero-value resolutions from flagd

Flagd sends empty values in flag response payloads when the value is equivalent to the zero-value of the associated go type. We should test that this works as expected and still returns an equivalent zero-value (ie: false, 0).

DoD:

  • manual test confirming zero values are returned from the flagd provider when they are missing from the gRPC message (boolean set to false or numeric set to 0 in flagd config)
  • new tests that assert correct values for zero-value flags

see: open-feature/flagd#218

[flagd-provider] fix non-conformant config options

Currently the flagd provider doesn't default to unlimited retries, and doesn't throw immediately if it can't start.

See: https://github.com/open-feature/flagd/blob/main/docs/other_resources/creating_providers.md#environment-variables and https://github.com/open-feature/flagd/blob/main/docs/other_resources/creating_providers.md#provider-lifecycle-initialization-and-shutdown

Definition of done:

  • update the flagd provider to default to 0 (infinite) retries
  • verify other defaults
  • reject immediately if the provider cannot connect, but continue to try to connect

[flagd-server] check if connected before attempting resolution

Before we try to resolve flag values, we should see if the provider is READY. If not, we should throw the not-ready error. With the current implementation, we'd attempt a gRPC call and then get a "general error".

Please also add the appropriate tests.

Configure a linter

  • Ensure the linter is in sync with Prettier.
  • Run linter when a PR is opened

Remove Context Transformer from Go Feature Flag

An upcoming change to the OpenFeature node SDK will remove the context transformer. The Go Feature Flag provider currently uses the context transforming and will be affected by this change. You can see an example of how the provider could look in this PR.

[otel hooks] Add custom attributes to traces

We should support the ability to add custom attributes to traces, as we do with metrics.

We should allow users to supply a function that maps flag metadata to custom span attributes.

Add ConfigCat provider

Add ConfigCat provider

Reasoning

I want to add an OpenFeature provider for ConfigCat.
This would be valuable because we are using that system in our projects and would like to be able to interface it with OpenFeature.
I would like to implement it and contribute the provider to this repo.

Requirements:

  • generate provider via tooling
  • implement Provider interface
  • add tests
  • complete README
  • add the new provider to the OpenFeature docs

Resources

Keep in mind the CONTRIBUTING guidelines: https://github.com/open-feature/js-sdk-contrib/blob/main/CONTRIBUTING.md

Update readme

  • Remove experimental badges
  • Add OpenFeature logo
  • Update title to match repo name

Set span attributes when starting span

The OTel hook should include the span attributes when starting the span. This is useful because OTel is able use this information for sampling purposes.

Add readme in hooks folder

Quickly describe what a hook is and how it can be used. It should also contain a section on how to add a new hook.

Add LaunchDarkly (client-side JS) provider

Add LaunchDarkly (client-side JS) provider

Reasoning

I want to add a provider which stores feature flags in LaunchDarkly via client-side JavaScript. This would be valuable because...

  • LaunchDarkly/OpenFeature Provider support is currently only server-side Node.js
  • the LD SDK's have some distinctions between server-side and client-side
  • not every feature flag implementation of LaunchDarkly is within a server
  • LaunchDarkly is growing in popularity as a flag vendor, especially as a FedRAMP-approved vendor

TODO:

  • generate provider via tooling
  • [] implement Provider interface
  • add tests
  • complete README

Keep in mind the CONTRIBUTING guidelines: https://github.com/open-feature/js-sdk-contrib/blob/main/CONTRIBUTING.md

[flagd-provider] add events, init support

Once the js-sdk has events and init/shutdown support, we need to update the flagd-provider to emit events and do proper init/shutdown. We already have a stream implemented for cache-busing, so this should be pretty simple.

Definition of done:

  • flagd does does startup logic (like initializing it's stream) in initialize function
  • flagd shuts down stream in close/shutdown function
  • flagd emits appropriate events on flag changes, and errors
  • associated testing

Blocked by:

CI - build for multiple nodeJS version

As we have seen in #428 we can introduce breaking changes for some version of NodeJS without noticing it in the CI.

We should be able to build/test in a matrix of versions, at least 16 and the latest version.

Refactor Jest Configuration

The Jest configuration has changed slightly. The repo should be updated accordingly. The OTel hook has already been updated. This approach should be done for the rest of the project (include the NX template).

Originally posted by @toddbaert in #179 (comment)

OTel Span in flagd Provider

The flagd provider should start an OTel span that will be passed to flagd to get cross-service tracing for evaluation.

Add a hook

Adding a hook

As described in the documentation, hooks are a mechanism that allow for the addition of arbitrary behavior at well-defined points of the flag evaluation life-cycle. Use cases include validation of the resolved flag value, modifying or adding data to the evaluation context, logging, telemetry, and tracking.

This repository has built in tooling for adding hooks. If you have a creative idea for a hook, we welcome your contribution! To add a hook:

[flagd-provider] consistent configuration options / add certPath support

We should make our options consistent, including the env vars. I think we want:

| Option name | Environment variable name | Type    | Default   |
| ----------- | ------------------------- | ------- | --------- |
| host        | FLAGD_HOST                | string  | localhost |
| port        | FLAGD_PORT                | number  | 8013      |
| tls         | FLAGD_TLS                 | boolean | false     |
| socketPath  | FLAGD_SOCKET_PATH         | string  | -         |
| certPath    | FLAGD_SERVER_CERT_PATH    | string  | -         |

We have all of these except FLAGD_SERVER_CERT_PATH.

Peer dependencies Handling

The build process current adds external dependencies as peer dependencies. This is likely what we want but we'll need to make it clear what additional packages must be installed.

Add Backstage provider

Add Backstage provider

Reasoning

I want to add an OpenFeature provider for Backstage. This would be valuable because...

  • Backstage is a popular CNCF project that already supports feature flags.
  • it would be a great way for developers to gain experience with OpenFeature.

Requirements:

  • generate provider via tooling
  • implement Provider interface
  • add tests
  • complete README
  • add the new provider to the OpenFeature docs

Resources

Keep in mind the CONTRIBUTING guidelines: https://github.com/open-feature/js-sdk-contrib/blob/main/CONTRIBUTING.md

Add a provider generator

Add a provider generator that makes it easy to start a new provider.

Requirements;

  • New NX generator is added
    • Jest tests
    • Package command should generate a valid esm and cjs package
    • License and readme should be included in the package
  • Script is added to package json
  • Update main readme with a reference
  • Add readme to /lib/providers

Newest npm go-feature-flag-provider version incompatible with older NodeJS versions

@thomaspoignant just a heads up that the most recent change to the the JS go-feature-flag-provider here used a feature (structuredClone()) that is only available in NodeJS 17 and above. This change will break builds for anyone who has the default value from npm install in their package.json (which is "@openfeature/go-feature-flag-provider": "^0.5.8") and using a NodeJS version either 16 or below.

This should probably be considered a breaking change if not a in the NodeJS world.

For anyone who uses this and finds their build is randomly failing, you can just remove the ^ from the version in package.json to pin the version so it works for older NodeJS versions.

"@openfeature/go-feature-flag-provider": "^0.5.8" -> "@openfeature/go-feature-flag-provider": "0.5.8"

Add OTel hook

Now that OTel 2529 is merged, we should update the (or create a new) Open Telemetry hook.

Basically, this would entail creating a hook which:

  • in the after stage: gets the current span and adds an appropriately named event (feature_flag), with the attributes (feature_flag.key, feature_flag.provider_name, and feature_flag.variant)
  • in the error stage, records the exception

In pseudocode, this looks something like:

class OTelHook implements Hook {
  after(context, details) {
    var currentTrace = trace.getActiveSpan();
    currentTrace.addEvent("feature_flag", { "feature_flag.key": details.key, /*  other props */ } );
  }

  error(err) {
    var currentTrace = trace.getActiveSpan();
    currentTrace.recordException(err);
  }
}

See: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/feature-flags.md

Note: For the this repo, we may want to deprecate the old hook.

[flagd-provider] Can't import flagd provider in ESM Typescript project

Trying to import FlagdProvider in Typescript with ESM causes the following error:

node_modules/@openfeature/flagd-provider/src/index.d.ts:1:15 - error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.

1 export * from './lib/flagd-provider';
                ~~~~~~~~~~~~~~~~~~~~~~

src/main.ts:2:10 - error TS2305: Module '"@openfeature/flagd-provider"' has no exported member 'FlagdProvider'.

2 import { FlagdProvider } from '@openfeature/flagd-provider';
           ~~~~~~~~~~~~~


Found 2 errors in 2 files.

Errors  Files
     1  node_modules/@openfeature/flagd-provider/src/index.d.ts:1
     1  src/main.ts:2

When I switch my project to CommonJS the problem is resolved.
I'm not sure if this is a bug or if I'm doing something wrong here.

Steps to reproduce

  • Create Typescript ESM project.
  • Import FlagdProvider like so: import { FlagdProvider } from '@openfeature/flagd-provider';.

I also created a simple example repo. Running npm run build shows the error.

Add a provider

Adding a provider

As described in the documentation, providers are responsible for performing flag evaluation. They provide an abstraction between the underlying flag management system and the OpenFeature SDK.

A flag management system could be a vendor solution, a custom feature flag system, or a thin wrapper around some other service, such as a cloud storage solution or an RDBMS.

This repository has built in tooling for adding providers. If you have a creative idea for a provider, we welcome your contribution! To add a provider:

[configcat-provider] add spec 0.6.0 support

Implement the changes to support the new features of spec 0.6.0.
Initialization is not needed by ConfigCat.

Tasks

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency @types/node to v20.14.11
  • chore(deps): update dependency testcontainers to v10.10.4
  • chore(deps): update dependency ts-jest to v29.2.3
  • chore(deps): update dependency @grpc/grpc-js to ~1.8.0 || ~1.9.0 || ~1.10.0 || ~1.11.0
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

docker-compose
libs/providers/flagd/docker-compose.yaml
  • ghcr.io/open-feature/flagd-testbed v0.5.6
  • ghcr.io/open-feature/flagd-testbed-unstable v0.5.6
  • ghcr.io/open-feature/sync-testbed v0.5.6
  • ghcr.io/open-feature/sync-testbed-unstable v0.5.6
github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/component-owners.yml
  • dyladan/component-owners a0a1a67d6955b6efe190e9646e0ba536f882414a
.github/workflows/lint-pr.yml
  • amannn/action-semantic-pull-request v5
  • marocchino/sticky-pull-request-comment v2
  • marocchino/sticky-pull-request-comment v2
.github/workflows/release-please.yml
  • google-github-actions/release-please-action v3
  • actions/checkout v4
  • bufbuild/buf-setup-action v1.32.0
  • actions/setup-node v4
npm
libs/hooks/open-telemetry/package.json
  • @openfeature/server-sdk ^1.13.0
  • @opentelemetry/api >=1.3.0
libs/providers/config-cat/package.json
  • @openfeature/server-sdk ^1.13.0
  • configcat-js-ssr >=7.1.2
libs/providers/env-var/package.json
  • @openfeature/server-sdk ^1.13.0
libs/providers/flagd-web/package.json
  • @openfeature/web-sdk ^1.0.0
libs/providers/flagd/package.json
  • @grpc/grpc-js ~1.8.0 || ~1.9.0 || ~1.10.0
  • @openfeature/server-sdk ^1.13.0
libs/providers/flagsmith-client/package.json
  • tslib ^2.3.0
  • @openfeature/web-sdk ^1.0.0
  • flagsmith 4.0.0
libs/providers/flipt-web/package.json
  • @flipt-io/flipt-client-browser ^0.0.17
  • tslib ^2.3.0
  • undici ^6.13.0
  • @openfeature/web-sdk ^1.0.0
libs/providers/flipt/package.json
  • tslib ^2.3.0
  • @openfeature/server-sdk ^1.13.0
  • @flipt-io/flipt ^1.0.0
libs/providers/go-feature-flag-web/package.json
  • @openfeature/web-sdk ^1.0.0
libs/providers/go-feature-flag/package.json
  • @openfeature/server-sdk ^1.15.0
libs/providers/growthbook-client/package.json
  • tslib ^2.3.0
  • @growthbook/growthbook ^1.0.0
  • @openfeature/web-sdk ^1.0.0
libs/providers/launchdarkly-client/package.json
  • @openfeature/web-sdk ^1.0.0
  • launchdarkly-js-client-sdk >=3.1.3
libs/providers/multi-provider-web/package.json
  • tslib ^2.3.0
  • @openfeature/web-sdk ^1.2.1
libs/providers/multi-provider/package.json
  • tslib ^2.3.0
  • @openfeature/server-sdk ^1.6.0
libs/providers/ofrep-web/package.json
  • tslib ^2.3.0
  • @openfeature/web-sdk >=0.4.0
libs/providers/ofrep/package.json
  • tslib ^2.3.0
  • @openfeature/server-sdk ^1.6.0
libs/shared/flagd-core/package.json
  • ajv ^8.12.0
  • tslib ^2.3.0
  • @openfeature/core >=0.0.16
libs/shared/ofrep-core/package.json
package.json
  • @bufbuild/protobuf ^1.2.0
  • @connectrpc/connect ^1.4.0
  • @connectrpc/connect-web ^1.4.0
  • @flipt-io/flipt ^1.0.0
  • @flipt-io/flipt-client-browser ^0.0.17
  • @growthbook/growthbook ^1.0.0
  • @grpc/grpc-js ^1.9.13
  • @opentelemetry/api ^1.3.0
  • @protobuf-ts/grpc-transport ^2.9.0
  • @protobuf-ts/runtime-rpc ^2.9.0
  • @swc/helpers 0.5.11
  • ajv ^8.12.0
  • axios 1.6.8
  • configcat-js-ssr ^8.3.0
  • copy-anything ^3.0.5
  • flagsmith ^4.0.0
  • imurmurhash ^0.1.4
  • json-logic-engine 1.3.4
  • launchdarkly-js-client-sdk ^3.1.3
  • lodash.isempty ^4.4.0
  • lodash.isequal ^4.5.0
  • lru-cache ^10.0.0
  • object-hash ^3.0.0
  • tslib 2.6.2
  • @openfeature/core ^1.1.0
  • @openfeature/server-sdk ^1.13.2
  • @openfeature/web-sdk ^1.1.0
  • @opentelemetry/sdk-metrics ^1.15.0
  • @swc-node/register ~1.10.0
  • @swc/cli ~0.4.0
  • @swc/core 1.6.13
  • @types/assert ^1.5.6
  • @types/events ^3.0.0
  • @types/imurmurhash ^0.1.3
  • @types/jest 29.5.12
  • @types/lodash.isempty ^4.4.7
  • @types/lodash.isequal ^4.5.6
  • @types/node 20.14.10
  • @types/object-hash ^3.0.0
  • @types/semver ^7.5.4
  • @typescript-eslint/eslint-plugin 5.62.0
  • @typescript-eslint/parser 5.62.0
  • assert ^2.0.0
  • axios-mock-adapter 1.22.0
  • babel-preset-minify 0.5.2
  • @bufbuild/buf ^1.34.0
  • eslint 8.57.0
  • eslint-config-prettier 8.10.0
  • eslint-plugin-prettier ^5.0.1
  • fetch-mock-jest ^1.5.1
  • jest ^29.4.1
  • jest-cucumber ^4.4.0
  • jest-environment-jsdom ^29.4.1
  • jest-fetch-mock ^3.0.3
  • jest-websocket-mock ^2.4.0
  • jsonc-eslint-parser ^2.1.0
  • msw ^2.2.3
  • prettier ^3.0.3
  • testcontainers 10.10.3
  • ts-jest 29.2.2
  • ts-node 10.9.2
  • typescript 5.5.3
  • undici ^5.0.0
tools/workspace-plugin/package.json
nvm
.nvmrc
  • node 20

  • Check this box to trigger a request for Renovate to run again on this repository

Launch darkly provider fixes

Hello everybody, don't really know if this is the correct process but we want to get launch darkly working for our frontend use case.

problem:

There is a provider but there are couple of issues:

  • the initialization proposed is outside the Provider which makes it hard to integrate and error prone.
  • The library includes imports from @openfeature/js-sdk for types, prefered in this case should be @openfeature/web-sdk
  • The provider seems to now work due the external initialisation, it seem to never get ready.

I opened a PR #418 that handles this issues, it has been tested in one of our frontend applications, the motivation for this change is basically to get the ball rolling and use the provider.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.