launchdarkly / openfeature-node-server Goto Github PK
View Code? Open in Web Editor NEWAn open feature provider for the LaunchDarkly node SDK.
License: Other
An open feature provider for the LaunchDarkly node SDK.
License: Other
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
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
npm install @launchdarkly/openfeature-node-server
import { LaunchDarklyProvider } from '@launchdarkly/openfeature-node-server';
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.
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:
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.