Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Problem with using Promises in TypeScript #141

Closed
eli-darkly opened this issue Feb 22, 2019 · 1 comment
Closed

Problem with using Promises in TypeScript #141

eli-darkly opened this issue Feb 22, 2019 · 1 comment

Comments

@eli-darkly
Copy link
Contributor

The SDK has some asynchronous methods that are supposed to support using either callbacks or Promises:

client.variation(key, user, default, (err, result) => { ... });  // callback
client.variation(key, user, default).then(result => { ...  });  // Promise

However, due to a problem in the SDK's TypeScript declarations, the second line above does not compile in TypeScript.

@eli-darkly eli-darkly mentioned this issue Feb 22, 2019
@eli-darkly
Copy link
Contributor Author

Fixed in version 5.7.2.

eli-darkly added a commit that referenced this issue Mar 28, 2022
* fix sending of update events on stream put

* misc fixes in polling

* add TLS tests

* TS fix

* support metric value in track()

* update method description

* don't fail test if there's one extra file reload

* add unit tests for polling and requestor

* apparently we can't use ES6 imports in this code although they worked for me locally

* add ability to skip Redis tests

* doc updates + build improvements

* fix repo name

* update package name + fix some test stuff

* Bump to a slightly newer version of 'request' to resolve a security vulnerability with 'extend' (#140)

* bump request to resolve a security vulnerability with extend

* remove incorrect build step

* update language

* restore dependency change overwritten by merge

* Adding a note to reference the client-side sdk, plus fixing name inconsistencies (#141)

* update doc comment for track() with metricValue

* fix merge error (obsolete code)

* fix ruleIndex in rule match reason

* reimplement flag change events to use dependency graph

* rm unused

* fix setting of empty dependencies

* misc cleanup

* typo

* update syntax: const, let, arrow functions

* more syntax fixes, linting

* more syntax fixes, linting

* more syntax fixes, linting

* downgrade ESLint because we must support Node 6

* skip update event logic if there are no update event listeners

* consequence of passing an empty object was correct but non-self-evident

* rm meaningless "arguments"

* avoid unnecessary deferral of internal callbacks

* better handling of invalid data types

* fix regex, add comment

* don't signal init failure & don't fire an error unless it's unrecoverable

* fix tests

* remove unused "hoek" dependency

* remove typedoc dependency

* use semver 6.x

* update eslint to 6.x

* update async package (removes old lodash dependency)

* update node-cache package (removes old lodash dependency)

* add audit script

* Revert "update node-cache package (removes old lodash dependency)"

This reverts commit 7d8d074.

* Revert "update async package (removes old lodash dependency)"

This reverts commit 587b777.

* fix dependency path parsing

* Revert "Revert "update async package (removes old lodash dependency)""

This reverts commit 6af73a8.

* Revert "Revert "update node-cache package (removes old lodash dependency)""

This reverts commit 81c3aad.

* run "npm audit fix" for dev dependencies

* update eslint to 6.x (#152)

* update eslint to 6.x

* use CircleCI 2.1 syntax

* typo

* rm unused

* minor cleanup

* syntax fix

* add job names

* add TS decl for new Redis parameter

* add TS syntax check code

* better config validation

* rm unused

* new config options and headers for diagnostic events

* fix tests

* object shorthand

* add more end-to-end tests, improve HTTP test helpers, general cleanup

* rm nock

* Node 6 compatibility

* remove redundant helper, misc cleanup

* Node 6 compatibility

* fix comment

* change asyncify to promisifySingle

* misc fixes

* add Windows CircleCI job

* fix config

* syntax

* diagnostic events, part 2: initial event and stats, except for stream inits

* comments

* add test for stats event

* capture stream connection stats in diagnostic events

* fix test

* remove eventReportingDisabled from diagnostic event; only create diagnosticsManager if needed

* revise tests to use new helper package

* misc cleanup

* use launchdarkly-js-test-helpers 1.0.0

* fix package reference

* minor fixes to config validation messages + add comment

* diagnostic eventsInQueue counter should be # of events at last flush

* rename eventsInQueue to eventsInLastBatch

* don't let user fall outside of last bucket in rollout

* add unit tests for basic bucketing logic and edge case

* avoid redundant property lookups

* fix Redis client parameter to match TS declaration (but still support old incorrect parameter)

* add event payload ID

* remove mistakenly checked-in test code (note, this SDK key was only valid on staging)

* add mention of singleton usage

* update diagnostic event info for OS name, data store type, Node version

* standardize linting

* disallow window and document

* fix null/undef checks

* misc linting fixes

* inlineUsersInEvents is not an unknown option

* drop node-sha1 dependency

* don't omit streamInits.failed when it's false

* bump request dependency to get security patch; loosen some exact dependencies

* remove request package; improve polling cache logic + add test

* bump typescript version to fix build error in Node 6

* update @types/node to fix TypeScript check step

* lint

* make sure we keep polling regardless of whether we got new data

* use launchdarkly-eventsource, make stream retry behavior consistent

* stream retry delay option should be in seconds & should be included in diagnostics

* minor test fix

* fix: Throw an error on malformed user-supplied logger

* don't call unref() on Redis client; ensure that database integration tests close the store

* update Redis driver to major version 3

* add test case

* allow redisOpts parameter to be omitted

* add logger adapter shim + tests

* minor cleanup and comments for ch74741 fix (logger wrapper)

* fix proxy tunnel configuration and make sure it's used in streaming

* change some string concatenation expressions to use interpolation

* feat: upgrade winston (#189)

* fix merge

* remove support for indirect/patch and indirect/put (#182)

* reuse same Promise and same event listeners for all waitForInitialization calls

* better docs for waitForInitialization + misc doc cleanup (#184)

* update js-eventsource to 1.3.1 for stream parsing bugfix (#185)

* fix broken logger format (#186)

* retroactively update changelog for bugfix in 5.13.2 release

* allow get/getAll Redis queries to be queued if Redis client hasn't yet connected

* set stream read timeout

* adding the alias functionality (#190)

* Removed the guides link

* remove monkey-patching of setImmediate

* Persist contextKind property during feature and custom event transformations (#194)

* add inlineUsersInEvents option in TypeScript

* redis lower bounds bump (#199)

* update launchdarkly-js-test-helpers to fix TLS tests (#200)

* update js-eventsource to remove vulnerability warning (#201)

* add CI jobs for all compatible Node versions (#202)

* update release metadata to include maintenance branch

* remove package-lock.json

* adjust test expectation about error message to work in recent Node versions

Co-authored-by: Eli Bishop <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: LaunchDarklyCI <[email protected]>
Co-authored-by: Ben Woskow <[email protected]>
Co-authored-by: Maxwell Gerber <[email protected]>
Co-authored-by: Chris West <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant