Giter VIP home page Giter VIP logo

openfeature-node-server's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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

openfeature-node-server's Issues

release version 0.3.0 does not refference the new sdk but rather the old one

Describe the bug
if you look at the commit 9ef8d33#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519
you will see that the release is still referencing an old version of launch darkly node js package named 'launchdarkly-node-server-sdk'
instead of '@launchdarkly/node-server-sdk'
this creates a typescript bug where basic functionality does not work
To reproduce
just create a typescript project running the quickstart you will get the error
Argument of type 'import("/home/project/node_modules/@launchdarkly/node-server-sdk/dist/src/api/LDClient").LDClient' is not assignable to parameter of type 'import("launchdarkly-node-server-sdk").LDClient'. The types returned by 'waitForInitialization()' are incompatible between these types. Type 'Promise<import("/home/project/node_modules/@launchdarkly/js-server-sdk-common/dist/api/LDClient").LDClient>' is not assignable to type 'Promise<import("launchdarkly-node-server-sdk").LDClient>'. Type 'LDClient' is missing the following properties from type 'LDClient': bigSegmentStoreStatusProvider, on, addListener, emit, and 12 more

Expected behavior
expect to be able to compile

Logs
If applicable, add any log output related to your problem.

SDK version
latest version

Language version, developer tools
typescript -node
OS/platform
wsl

Additional context
self explanatory

Type definition were not included in dist (npm package)

Is this a support request?
This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the code in this library. If you're not sure whether the problem you are having is specifically related to this library, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going here and clicking "submit a request", or by emailing [email protected].

Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above.

Describe the bug
the npm package @launchdarkly@openfeature-node-server does not include type declarations. VSCode typescript linting shows error TS7016
with error message: "Could not find a declaration file for module '@launchdarkly/openfeature-node-server'. '/workspace/project/node_modules/@launchdarkly/openfeature-node-server/dist/index.js' implicitly has an 'any' type. Try npm i --save-dev @types/launchdarkly__openfeature-node-server if it exists or add a new declaration (.d.ts) file containing declare module '@launchdarkly/openfeature-node-server';"

To reproduce

  1. npm install @launchdarkly/openfeature-node-server
  2. open a Typescript file, and type import { LaunchDarklyProvider } from '@launchdarkly/openfeature-node-server';
  3. observe the "Problems" pane with the above message.

Expected behavior
VSCode TS intellisense should be able to read types and provide info on the types, and methods.

As a matter of fact, if I download the source code and do tsc --declaration, the index.d.ts and other .d.ts files will be created, and I would be able to use it as Typescript module with intellisense available. SO it seems an issue with the npm packaging, not the source code.

Logs
If applicable, add any log output related to your problem.

SDK version
@launchdarkly/[email protected]
[email protected]

Language version, developer tools
typescript 4.9.5

OS/platform
Ubuntu 21.04

Additional context
Add any other context about the problem here.

Support for shutdown/closure of LD Client

Is your feature request related to a problem? Please describe.
The LaunchDarkly documentation recommends shutting down an instantiated Client whenever it is done being used: LD docs.

Right now, this implementation does not provide any shutdown functionality to OpenFeature to meet that LaunchDarkly requirement. It's a great idea to add it for many reasons:

  • preventing memory leaks
  • preventing inaccurate flag evaluation if a user logs out but the LD Client is still instantiated and actively polling/streaming
  • promoting clean code paths and best practices

Describe the solution you'd like
A shutdown method could be added to the Provider that in turn invokes the LD SDK method client.close(). This would be very easy to add, and OpenFeature could then handle the upstream logic dependent upon a Provider with a valid and active Client. That will be on the OF side, but a simple and durable implementation would just check if the Provider is active or shut down, and handle appropriately. It can be up to OF whether or not to re-instantiate, throw an error, or some other behavior, but without the ability to shut down via the Provider first, that would not be a possible behavior decision to make.

Describe alternatives you've considered
The only real alternative seems to be never allowing a shutdown of the Provider (and LD Client), but that goes against LaunchDarkly's documentation of implementation best practices, and it is the current implementation of the Provider with no shutdown or close functionality in place.

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.