Skip to content
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

consider correcting typing of LDOptions's bootstrap #70

Closed
jmhodges-color opened this issue Sep 22, 2022 · 7 comments
Closed

consider correcting typing of LDOptions's bootstrap #70

jmhodges-color opened this issue Sep 22, 2022 · 7 comments

Comments

@jmhodges-color
Copy link

Is this a support request?
No

Describe the bug
The actual bug and request for a change is a lil cryptic, but let me state it and then explain the details

Would it be possible to get a more accurate type for bootstrap in LDOptions to help guide folks to correctly interpret the output of the Python SDK (and I imagine other server-side SDK's) FeatureFlagsState?

LDOption's bootstrap has the type LDFlagSet. The docs for the Python SDK's FeatureFlagsState says its JSON format is suitable for passing into bootstrap. However, the types of bootstrap and FeatureFlagsState are actually incompatible in a way that effects customers trying to allow for local development. The LDFlagSet is type as, essentially, a keyed object, while FeatureFlagsState's JSON is an Array at its top with (possibly) multiple items in it.

They happen to work okay because the JS code here wriggles around the problem because LDFlagSet's type is loose enough to allow it.

However, when you go to solve problems like those raised by needing to write our camelCase'ing flag names to create fake LDClients to allow engineers to do local development without needing to share a single LaunchDarkly environment and project, you hit the problem.

We use an HTTP endpoint in our server in local dev that uses the PythonSDK's all_flags_state (that returns a FeatureFlagsState) to bootstrap from a local flag data file without needing to contact LaunchDarkly. That's fetch on loading of the React app to fill in the faked out Provider and Client we have. But when you try to create the LDFlagKeyMap type and others needed by those Providers, you hit the problem that the FeatureFlagsState's JSON format is actually an Array with an undefined accounting for each of the possible number of items in it.

I'm assuming that the first item is a LDFlagSet (we make the simplifying assumption that all the items in the array, but that's likely not true), but I'm not sure if that's true or not.

To reproduce
Try to use a Python (or similar server-side client's) all_flags_state data to create your own no-request-making Client (and react Provider) by handling camelCasing and all that.

@jmhodges-color
Copy link
Author

(This, of course, would also be mooted by the JS and React SDK's providing fakes for local development that don't contact LaunchDarkly)

@jmhodges-color jmhodges-color changed the title Incorrect typing for LDOptions's bootstrap Correct typing for LDOptions's bootstrap Sep 22, 2022
@jmhodges-color jmhodges-color changed the title Correct typing for LDOptions's bootstrap consider correcting typing of LDOptions's bootstrap Sep 22, 2022
@kinyoklion
Copy link
Member

Hello @jmhodges-color,

Did you use the to_json_dict method of the FeatureFlagsState? This is supposed to produce output which is compatible with the JS SDK.

Returns a dictionary suitable for passing as JSON, in the format used by the LaunchDarkly
        JavaScript SDK. Use this method if you are passing data to the front end in order to
        "bootstrap" the JavaScript client.

Thank you,
Ryan

@eli-darkly
Copy link
Contributor

To be clear, all of the server-side SDKs that have an "all flags" feature are supposed to produce JSON in the same format that the JS SDK understands; that's a primary use case for the feature, and it's intended to be consistent across platforms. So if there's any inconsistency there, it would be either a bug in the server-side SDK (in this case Python) or some kind of usage error.

It might be worth re-filing this issue in https://github.com/launchdarkly/python-server-sdk, since unless I've misunderstood what you wrote, this sounds more like a Python issue and we would want to know if other Python developers have run into it. It'd also be helpful to know how you are producing the JSON output (like are you using jsonpickle, json.dumps, etc.).

@jmhodges-color
Copy link
Author

jmhodges-color commented Sep 22, 2022

I we're in agreement that all the server-side SDKs generating the same stuff. What I'm saying is the type of bootstrap needs to change because it doesn't represent what's actually be passed to LDOptions's bootstrap (because it can take the old style of LDFlags but also support the new bootstrap format that Python and others create now). The LDFlags type for bootstrap is just-so-happening to work because it's a very vague type.

@eli-darkly
Copy link
Contributor

@jmhodges-color: I want to make sure we really are talking about the same thing. The JSON representation of the Python SDK's FeatureFlagsState object should look more or less like this:

{
  "flagkey1": "value1",
  "flagkey2": "value2",
  "$flagsState": {
    "flagkey1": {
      "variation": 0
    },
    "flagkey2": {
      "variation": 1
    }
  },
  "$valid": true
}

There could be more properties within each object, and of course the flag keys and values will be different, but the intended format is still that there's one big JSON object containing a flag value for each flag key, plus two special keys $flagsState and $valid.

So, the reason I'm spelling all this out is that your original message said "FeatureFlagsState's JSON is an Array at its top with (possibly) multiple items in it." I don't mean to nitpick, but an array and an object are two very different things in JSON; the intended format does not include any arrays, and if you're seeing one, something is wrong. And, if you're seeing something that looks significantly different from what I wrote above, then please provide an example of what it looks like.

But, if what you're seeing does look like my example— see my next comment.

@eli-darkly
Copy link
Contributor

Now, if the reference to arrays was just a mistake, and what you're seeing is really a JSON object that looks like my example, then I'm guessing that the unexpected data you saw was the two metadata properties $flagsState and $valid. Technically, the presence of those keys does not violate the definition of the LDFlagsSet type in TypeScript; they are just keys, and the type is defined as a map of keys to values of any type.

It's true that those two are not flag keys, so if you are trying to interpret this data with an assumption that every key is a flag key, that would be a problem. We don't advise trying to interpret that data— the purpose of that JSON representation is to be consumed by the JS SDK, which is why its exact schema isn't documented, because we don't recommend for applications to rely on such implementation details that are subject to change. But if you do want to interpret it, there's a simple rule of thumb you can use to avoid wrongly thinking something is a flag key: if it starts with $, then it is not a flag key. LaunchDarkly doesn't allow that character to ever be in a flag key— that's a documented restriction at the product level.

It'd be reasonable to wonder why we used this schema, rather than just doing something more straightforward like:

{
  "valid": true,
  "flags": {
    "flagkey1": {
      "value": "value1",
      "variation": 0
    },
    "flagkey2": {
      "value": "value2",
      "variation": 1
    }
  }
}

The answer to that is simply backward compatibility. Older versions of SDKs did not provide any of the metadata that those two special keys represent; the only information about a flag was its value, and so the format of the bootstrap data was defined as a map with a single value for each key, rather than an object with multiple properties like value and variation for each key. In order to extend this in a way that would allow newer server-side SDK versions to pass additional metadata to newer JS SDK versions, but that would still allow older SDK versions to interact with newer ones without completely breaking, we had to leave the "flagkey": "value" key-value pairs where they were, as top-level properties, and add the new information as new properties that could not overlap with any real flag key.

Unfortunately, TypeScript is not well suited to describing a schema with the pattern "it's an object where optional property X has a value of type T, and optional property Y has a value of type U, but any properties whose names are not X or Y are flag keys that map to flag values." But, again, these details were not really intended to be inspected programmatically by application code. It's a schema for communication between two LaunchDarkly SDKs, and its awkward shape was a necessary compromise due to the inherent compatibility issues in any such communication.

@jmhodges-color
Copy link
Author

This was definitely our bug! Our team added some ( around some multi-line calls but did so in the context of a Python dict literal instead of the right-hand side of an assignment. In the dict literal, the the ( ... ) was interpreted as a single-item tuple instead of "do all these things and return the normal bit".

LaunchDarklyReleaseBot added a commit that referenced this issue Dec 1, 2022
* copyedits

* fix misnamed directory

* use spread operator instead of Object.assign

* add issue templates

* add babel-eslint

* add event capacity config property

* re-add deprecation warning on samplingInterval

* better config validation

* remove rollup-plugins-node-resolve

* use newer Rollup node-resolve plugin

* rm rollup-plugin-includepaths (unused)

* npm audit fix (handlebars dependency from jest)

* comment

* copyedit

* use new test helpers + misc test cleanup

* clean up stream testing logic

* fix hash parameter

* linter

* clearer way to model the config option defaults/types

* test improvements

* change internal param name

* comment

* fix default logger logic

* simpler way to enforce minimum values

* implement diagnostic events in common JS package (#11)

* add support for function type in config options

* add support for function type in config options (#13)

* add wrapper metadata options and fix custom header logic

* lint

* lint

* remove image-loading logic from common code, replace it with an abstraction

* add validation for options.streaming

* typo

* rm unused params

* typo in comment

* misc fixes to merged code from external PR

* add event payload ID header

* npm audit fix

* change exact dependencies to best-compatible

* standardize linting

* disallow "window" and "document"

* improve diag event tests + debug logging

* misc cleanup

* fix updating secure mode hash with identify()

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

* clean up init state logic, prevent unhandled rejections

* lint

* less strict matching of json content-type header

* remove unsafe usage of hasOwnProperty

* console logger must tolerate console object not always existing

* fix double initialization of diagnostics manager

* fix TypeScript declaration for track() and add more TS compilation tests (#27)

* remove startsWith usage (#28)

* prevent poll caused by a stream ping from overwriting later poll for another user (#29)

* upgrade jest dependency and transitive yargs-parser dependency (#30)

* Add null to LDEvaluationDetail.reason type (#31)

* Revert "Add null to LDEvaluationDetail.reason type (#31)"

This reverts commit bcb1573.

* Revert "Add null to LDEvaluationDetail.reason type (#31)"

This reverts commit bcb1573.

* nullable evaluation reason (#32)

* adding alias event functionality (#33)

* set stream read timeout

* Add prepare script (#34)

* add a missing typescript verification (#36)

* Removed the guides link

* Correct doc link (#36)

* Fix typo in LDClient.on jsdoc (#37)

* add inlineUsersInEvents option in TypeScript (#37)

* Filter private attributes on debug event users. Send variation for debug events.

* update uuid package version (#39)

* use Releaser v2 config + newer CI image

* First half, add the type, create the new options, add the new util method, and add tests

* Second half, call the tranform util method before calling any HTTP requests

* Update the transform to work on a copy of headers instead of mutating it

* add comments about removing custom event warning logic in the future

* revert updating of UUID dependency (#43)

* Revert "update uuid package version (#39)"

This reverts commit 3b2ff6c.

* update package-lock.json

* better error handling for local storage operations (#44)

* better error handling for local storage operations

* lint

* fix obsolete comments

* add basic logger similar to server-side Node SDK (#45)

* fix exports and add validation of custom logger (#46)

* remove typedoc.js file that interferes with Releaser's docs build

* update typescript version

* add maintenance branch

* remove deprecated things (#48)

* remove deprecated options and function

* rm references to obsolete function

* restore deprecation logic, just leave the data empty

* remove samplingInterval from TS test code

* fix TS test code again

* fix EvaluationDetail.reason to be nullable so we can get rid of NonNullableLDEvaluationReason type (#49)

* remove deprecated options and function

* rm references to obsolete function

* restore deprecation logic, just leave the data empty

* remove samplingInterval from TS test code

* fix TS test code again

* fix EvaluationDetail.reason to be nullable so we can get rid of NonNullableLDEvaluationReason type

* fix TS test code

* re-bump uuid package (#50)

* Revert "Revert "update uuid package version (#39)""

This reverts commit 89359b1bf4ddbe6b2fedb95f1dc11240483c60f7.

* remove lockfile (sc-107301)

* use regular User-Agent header name unless overridden by js-client-sdk (#52)

* switch to publishing js-sdk-common as a regular Node module (#51)

* fix CI

* remove `version` constant which can't be exported from js-sdk-common (#53)

* catch errors in JSON parsing of stream data (#54)

* catch errors in JSON parsing of stream data

* lint

* backport sc-142333 fix

* prepare 3.5.1 release (#63)

* initial move of code from js-client-sdk-private

* changelog note

* rm obsolete comment

* add npm audit helper

* update babel, jest, rollup

* fix rollup config

* fix ES build, dependency cleanup

* add Releaser metadata

* Update babel config to work in `test` without `useBuiltIns`

* copyedits

* fix misnamed directory

* use spread operator instead of Object.assign

* add issue templates

* add babel-eslint

* add event capacity config property

* re-add deprecation warning on samplingInterval

* better config validation

* remove rollup-plugins-node-resolve

* use newer Rollup node-resolve plugin

* rm rollup-plugin-includepaths (unused)

* npm audit fix (handlebars dependency from jest)

* comment

* copyedit

* use new test helpers + misc test cleanup

* clean up stream testing logic

* fix hash parameter

* linter

* clearer way to model the config option defaults/types

* test improvements

* change internal param name

* comment

* fix default logger logic

* simpler way to enforce minimum values

* implement diagnostic events in common JS package (#11)

* add support for function type in config options

* add support for function type in config options (#13)

* add wrapper metadata options and fix custom header logic

* lint

* lint

* remove image-loading logic from common code, replace it with an abstraction

* add validation for options.streaming

* typo

* rm unused params

* typo in comment

* misc fixes to merged code from external PR

* add event payload ID header

* npm audit fix

* change exact dependencies to best-compatible

* standardize linting

* disallow "window" and "document"

* improve diag event tests + debug logging

* misc cleanup

* fix updating secure mode hash with identify()

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

* clean up init state logic, prevent unhandled rejections

* lint

* less strict matching of json content-type header

* remove unsafe usage of hasOwnProperty

* console logger must tolerate console object not always existing

* fix double initialization of diagnostics manager

* fix TypeScript declaration for track() and add more TS compilation tests (#27)

* remove startsWith usage (#28)

* prevent poll caused by a stream ping from overwriting later poll for another user (#29)

* upgrade jest dependency and transitive yargs-parser dependency (#30)

* Add null to LDEvaluationDetail.reason type (#31)

* Revert "Add null to LDEvaluationDetail.reason type (#31)"

This reverts commit bcb1573.

* Revert "Add null to LDEvaluationDetail.reason type (#31)"

This reverts commit bcb1573.

* nullable evaluation reason (#32)

* adding alias event functionality (#33)

* set stream read timeout

* Add prepare script (#34)

* add a missing typescript verification (#36)

* Removed the guides link

* Correct doc link (#36)

* Fix typo in LDClient.on jsdoc (#37)

* add inlineUsersInEvents option in TypeScript (#37)

* Filter private attributes on debug event users. Send variation for debug events.

* update uuid package version (#39)

* use Releaser v2 config + newer CI image

* First half, add the type, create the new options, add the new util method, and add tests

* Second half, call the tranform util method before calling any HTTP requests

* Update the transform to work on a copy of headers instead of mutating it

* add comments about removing custom event warning logic in the future

* revert updating of UUID dependency (#43)

* Revert "update uuid package version (#39)"

This reverts commit 3b2ff6c.

* update package-lock.json

* better error handling for local storage operations (#44)

* better error handling for local storage operations

* lint

* fix obsolete comments

* add basic logger similar to server-side Node SDK (#45)

* fix exports and add validation of custom logger (#46)

* remove typedoc.js file that interferes with Releaser's docs build

* update typescript version

* add maintenance branch

* backport sc-142333 fix

Co-authored-by: Eli Bishop <eli@launchdarkly.com>
Co-authored-by: Zach Davis <zach@launchdarkly.com>
Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com>
Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com>
Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com>
Co-authored-by: Michael Siadak <mike.siadak@gmail.com>
Co-authored-by: Jeff Wen <sinchangwen@gmail.com>
Co-authored-by: Andrey Krasnov <34657799+Doesntmeananything@users.noreply.github.com>
Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com>
Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com>
Co-authored-by: Louis Chan <lchan@launchdarkly.com>
Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com>

* Releasing version 3.5.1

* rm obsolete file to fix merge

* Releasing version 3.5.1

* Migrate context code (#56)

* Migrate attribute reference code from node. (#57)

* Add U2C types and make minimal adjustments for type changes. (#58)

* Add U2C types.

* Update typings.d.ts. Make minimal adjustments for changes to typings.

* make URL path concatenation work right whether base URL has a trailing slash or not (#61)

* make URL path concatenation work right whether base URL has a trailing slash or not

* lint

* Update event format and filtering for contexts. (#59)

* Update persistence of generated keys for transient contexts. (#60)

* Implement support for application tags. (#55)

* Fix typing of LDOptionsBase. (#63)

* Implement application tags for 3.x. (#62)

* lint

* Add a line to refer to sendEventsOnlyForVariation

* Rename additional items. Functions, comments, variables. (#64)

* don't include deleted flags in allFlags (#66)

* Clear last seen cache on identity change. (#67)

* Enforce 64 character limit for tag value. (#68)

* Enforce 64 character limit for tag value.

* Lint. Comments. Remove unused param.

* Rename transient back to anonymous. (#70)

* [sc-160947] Switch to partial URL encoding. (#72)

* Remove the last seen cache, deprecate allowFrequentDuplicateEvents. (#73)

* Update with changes from main, remove frequent duplicate events option. (#75)

* Inspector proposal V2. (#71)

* Fix invoking flagUsed. (#77)

* Port jitter and backoff. (#79) (#81)

* Update U2C branch with inspection interfaces. (#80)

Co-authored-by: Eli Bishop <eli@launchdarkly.com>
Co-authored-by: Zach Davis <zach@launchdarkly.com>
Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com>
Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com>
Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com>
Co-authored-by: Michael Siadak <mike.siadak@gmail.com>
Co-authored-by: Jeff Wen <sinchangwen@gmail.com>
Co-authored-by: Andrey Krasnov <34657799+Doesntmeananything@users.noreply.github.com>
Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com>
Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com>
Co-authored-by: Louis Chan <lchan@launchdarkly.com>
Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com>
Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
Co-authored-by: LaunchDarklyReleaseBot <86431345+LaunchDarklyReleaseBot@users.noreply.github.com>

* Merge jitter/backoff to 5.0. (#85)

* Merge: Remove flatmap (#84)

Co-authored-by: Mateusz Sikora <mateusz.sikora@ramp.network>

* remove flatMap usage to support older browsers (#82)

Co-authored-by: Mateusz Sikora <mateusz.sikora@ramp.network>

* Remove support for secondary attribute. (#86)

* [sc-176610] Import messages specifically from './messages' not '.'. (#87)

* Update with changes from main. (#88)

* Update comments for U2C. (#89)

* Fixes from contract tests. (#90)

* Remove deprecation code.

* [sc-177798] Export getContextKeys function for reuse

* Added unit tests

* Moved getContextKeys to context.js

* Update EventProcessor.js

* Ignore null and empty string keys. Added more tests.

* Added warnings if kind is null or ''

* Added types for getContextKeys

* Update test-types.ts

* Port event summarizer from node. (#97)

* Fix handling of results from sendingEvents. (#98)

* [sc-178144] Undefined case versus typeof. (#99)

* Fix copy/paste doc comment. (#96)

* [sc-178313] Replace minor instances of user

* More replacements.

* Update InspectorManager-test.js

* Update utils-test.js

* Adding kind to context for tests

* Revert to create maintenance branch. (#103)

* Restore U2C functionality. (#104)

* Update release config for 5.x (#102)

Co-authored-by: Eli Bishop <eli@launchdarkly.com>
Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com>
Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com>
Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com>
Co-authored-by: Michael Siadak <mike.siadak@gmail.com>
Co-authored-by: Jeff Wen <sinchangwen@gmail.com>
Co-authored-by: Andrey Krasnov <34657799+Doesntmeananything@users.noreply.github.com>
Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com>
Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com>
Co-authored-by: Louis Chan <lchan@launchdarkly.com>
Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com>
Co-authored-by: Zach Davis <zach@launchdarkly.com>
Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
Co-authored-by: Mateusz Sikora <mateusz.sikora@ramp.network>
Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com>
Co-authored-by: Yusinto Ngadiman <yusinto@gmail.com>
LaunchDarklyReleaseBot added a commit that referenced this issue Jan 10, 2023
* use spread operator instead of Object.assign

* add issue templates

* add babel-eslint

* add event capacity config property

* re-add deprecation warning on samplingInterval

* better config validation

* remove rollup-plugins-node-resolve

* use newer Rollup node-resolve plugin

* rm rollup-plugin-includepaths (unused)

* npm audit fix (handlebars dependency from jest)

* comment

* copyedit

* use new test helpers + misc test cleanup

* clean up stream testing logic

* fix hash parameter

* linter

* clearer way to model the config option defaults/types

* test improvements

* change internal param name

* comment

* fix default logger logic

* simpler way to enforce minimum values

* implement diagnostic events in common JS package (#11)

* add support for function type in config options

* add support for function type in config options (#13)

* add wrapper metadata options and fix custom header logic

* lint

* lint

* remove image-loading logic from common code, replace it with an abstraction

* add validation for options.streaming

* typo

* rm unused params

* typo in comment

* misc fixes to merged code from external PR

* add event payload ID header

* npm audit fix

* change exact dependencies to best-compatible

* standardize linting

* disallow "window" and "document"

* improve diag event tests + debug logging

* misc cleanup

* fix updating secure mode hash with identify()

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

* clean up init state logic, prevent unhandled rejections

* lint

* less strict matching of json content-type header

* remove unsafe usage of hasOwnProperty

* console logger must tolerate console object not always existing

* fix double initialization of diagnostics manager

* fix TypeScript declaration for track() and add more TS compilation tests (#27)

* remove startsWith usage (#28)

* prevent poll caused by a stream ping from overwriting later poll for another user (#29)

* upgrade jest dependency and transitive yargs-parser dependency (#30)

* Add null to LDEvaluationDetail.reason type (#31)

* Revert "Add null to LDEvaluationDetail.reason type (#31)"

This reverts commit bcb1573.

* Revert "Add null to LDEvaluationDetail.reason type (#31)"

This reverts commit bcb1573.

* nullable evaluation reason (#32)

* adding alias event functionality (#33)

* set stream read timeout

* Add prepare script (#34)

* add a missing typescript verification (#36)

* Removed the guides link

* Correct doc link (#36)

* Fix typo in LDClient.on jsdoc (#37)

* add inlineUsersInEvents option in TypeScript (#37)

* Filter private attributes on debug event users. Send variation for debug events.

* update uuid package version (#39)

* use Releaser v2 config + newer CI image

* First half, add the type, create the new options, add the new util method, and add tests

* Second half, call the tranform util method before calling any HTTP requests

* Update the transform to work on a copy of headers instead of mutating it

* add comments about removing custom event warning logic in the future

* revert updating of UUID dependency (#43)

* Revert "update uuid package version (#39)"

This reverts commit 3b2ff6c.

* update package-lock.json

* better error handling for local storage operations (#44)

* better error handling for local storage operations

* lint

* fix obsolete comments

* add basic logger similar to server-side Node SDK (#45)

* fix exports and add validation of custom logger (#46)

* remove typedoc.js file that interferes with Releaser's docs build

* update typescript version

* add maintenance branch

* remove deprecated things (#48)

* remove deprecated options and function

* rm references to obsolete function

* restore deprecation logic, just leave the data empty

* remove samplingInterval from TS test code

* fix TS test code again

* fix EvaluationDetail.reason to be nullable so we can get rid of NonNullableLDEvaluationReason type (#49)

* remove deprecated options and function

* rm references to obsolete function

* restore deprecation logic, just leave the data empty

* remove samplingInterval from TS test code

* fix TS test code again

* fix EvaluationDetail.reason to be nullable so we can get rid of NonNullableLDEvaluationReason type

* fix TS test code

* re-bump uuid package (#50)

* Revert "Revert "update uuid package version (#39)""

This reverts commit 89359b1bf4ddbe6b2fedb95f1dc11240483c60f7.

* remove lockfile (sc-107301)

* use regular User-Agent header name unless overridden by js-client-sdk (#52)

* switch to publishing js-sdk-common as a regular Node module (#51)

* fix CI

* remove `version` constant which can't be exported from js-sdk-common (#53)

* catch errors in JSON parsing of stream data (#54)

* catch errors in JSON parsing of stream data

* lint

* backport sc-142333 fix

* prepare 3.5.1 release (#63)

* initial move of code from js-client-sdk-private

* changelog note

* rm obsolete comment

* add npm audit helper

* update babel, jest, rollup

* fix rollup config

* fix ES build, dependency cleanup

* add Releaser metadata

* Update babel config to work in `test` without `useBuiltIns`

* copyedits

* fix misnamed directory

* use spread operator instead of Object.assign

* add issue templates

* add babel-eslint

* add event capacity config property

* re-add deprecation warning on samplingInterval

* better config validation

* remove rollup-plugins-node-resolve

* use newer Rollup node-resolve plugin

* rm rollup-plugin-includepaths (unused)

* npm audit fix (handlebars dependency from jest)

* comment

* copyedit

* use new test helpers + misc test cleanup

* clean up stream testing logic

* fix hash parameter

* linter

* clearer way to model the config option defaults/types

* test improvements

* change internal param name

* comment

* fix default logger logic

* simpler way to enforce minimum values

* implement diagnostic events in common JS package (#11)

* add support for function type in config options

* add support for function type in config options (#13)

* add wrapper metadata options and fix custom header logic

* lint

* lint

* remove image-loading logic from common code, replace it with an abstraction

* add validation for options.streaming

* typo

* rm unused params

* typo in comment

* misc fixes to merged code from external PR

* add event payload ID header

* npm audit fix

* change exact dependencies to best-compatible

* standardize linting

* disallow "window" and "document"

* improve diag event tests + debug logging

* misc cleanup

* fix updating secure mode hash with identify()

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

* clean up init state logic, prevent unhandled rejections

* lint

* less strict matching of json content-type header

* remove unsafe usage of hasOwnProperty

* console logger must tolerate console object not always existing

* fix double initialization of diagnostics manager

* fix TypeScript declaration for track() and add more TS compilation tests (#27)

* remove startsWith usage (#28)

* prevent poll caused by a stream ping from overwriting later poll for another user (#29)

* upgrade jest dependency and transitive yargs-parser dependency (#30)

* Add null to LDEvaluationDetail.reason type (#31)

* Revert "Add null to LDEvaluationDetail.reason type (#31)"

This reverts commit bcb1573.

* Revert "Add null to LDEvaluationDetail.reason type (#31)"

This reverts commit bcb1573.

* nullable evaluation reason (#32)

* adding alias event functionality (#33)

* set stream read timeout

* Add prepare script (#34)

* add a missing typescript verification (#36)

* Removed the guides link

* Correct doc link (#36)

* Fix typo in LDClient.on jsdoc (#37)

* add inlineUsersInEvents option in TypeScript (#37)

* Filter private attributes on debug event users. Send variation for debug events.

* update uuid package version (#39)

* use Releaser v2 config + newer CI image

* First half, add the type, create the new options, add the new util method, and add tests

* Second half, call the tranform util method before calling any HTTP requests

* Update the transform to work on a copy of headers instead of mutating it

* add comments about removing custom event warning logic in the future

* revert updating of UUID dependency (#43)

* Revert "update uuid package version (#39)"

This reverts commit 3b2ff6c.

* update package-lock.json

* better error handling for local storage operations (#44)

* better error handling for local storage operations

* lint

* fix obsolete comments

* add basic logger similar to server-side Node SDK (#45)

* fix exports and add validation of custom logger (#46)

* remove typedoc.js file that interferes with Releaser's docs build

* update typescript version

* add maintenance branch

* backport sc-142333 fix

Co-authored-by: Eli Bishop <eli@launchdarkly.com>
Co-authored-by: Zach Davis <zach@launchdarkly.com>
Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com>
Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com>
Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com>
Co-authored-by: Michael Siadak <mike.siadak@gmail.com>
Co-authored-by: Jeff Wen <sinchangwen@gmail.com>
Co-authored-by: Andrey Krasnov <34657799+Doesntmeananything@users.noreply.github.com>
Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com>
Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com>
Co-authored-by: Louis Chan <lchan@launchdarkly.com>
Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com>

* Releasing version 3.5.1

* rm obsolete file to fix merge

* Releasing version 3.5.1

* Migrate context code (#56)

* Migrate attribute reference code from node. (#57)

* Add U2C types and make minimal adjustments for type changes. (#58)

* Add U2C types.

* Update typings.d.ts. Make minimal adjustments for changes to typings.

* make URL path concatenation work right whether base URL has a trailing slash or not (#61)

* make URL path concatenation work right whether base URL has a trailing slash or not

* lint

* Update event format and filtering for contexts. (#59)

* Update persistence of generated keys for transient contexts. (#60)

* Implement support for application tags. (#55)

* Fix typing of LDOptionsBase. (#63)

* Implement application tags for 3.x. (#62)

* lint

* Add a line to refer to sendEventsOnlyForVariation

* Rename additional items. Functions, comments, variables. (#64)

* don't include deleted flags in allFlags (#66)

* Clear last seen cache on identity change. (#67)

* Enforce 64 character limit for tag value. (#68)

* Enforce 64 character limit for tag value.

* Lint. Comments. Remove unused param.

* Rename transient back to anonymous. (#70)

* [sc-160947] Switch to partial URL encoding. (#72)

* Remove the last seen cache, deprecate allowFrequentDuplicateEvents. (#73)

* Update with changes from main, remove frequent duplicate events option. (#75)

* Inspector proposal V2. (#71)

* Fix invoking flagUsed. (#77)

* Port jitter and backoff. (#79) (#81)

* Update U2C branch with inspection interfaces. (#80)

Co-authored-by: Eli Bishop <eli@launchdarkly.com>
Co-authored-by: Zach Davis <zach@launchdarkly.com>
Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com>
Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com>
Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com>
Co-authored-by: Michael Siadak <mike.siadak@gmail.com>
Co-authored-by: Jeff Wen <sinchangwen@gmail.com>
Co-authored-by: Andrey Krasnov <34657799+Doesntmeananything@users.noreply.github.com>
Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com>
Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com>
Co-authored-by: Louis Chan <lchan@launchdarkly.com>
Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com>
Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
Co-authored-by: LaunchDarklyReleaseBot <86431345+LaunchDarklyReleaseBot@users.noreply.github.com>

* Merge jitter/backoff to 5.0. (#85)

* Merge: Remove flatmap (#84)

Co-authored-by: Mateusz Sikora <mateusz.sikora@ramp.network>

* remove flatMap usage to support older browsers (#82)

Co-authored-by: Mateusz Sikora <mateusz.sikora@ramp.network>

* Remove support for secondary attribute. (#86)

* [sc-176610] Import messages specifically from './messages' not '.'. (#87)

* Update with changes from main. (#88)

* Update comments for U2C. (#89)

* Fixes from contract tests. (#90)

* Remove deprecation code.

* [sc-177798] Export getContextKeys function for reuse

* Added unit tests

* Moved getContextKeys to context.js

* Update EventProcessor.js

* Ignore null and empty string keys. Added more tests.

* Added warnings if kind is null or ''

* Added types for getContextKeys

* Update test-types.ts

* Port event summarizer from node. (#97)

* Fix handling of results from sendingEvents. (#98)

* [sc-178144] Undefined case versus typeof. (#99)

* Fix copy/paste doc comment. (#96)

* [sc-178313] Replace minor instances of user

* More replacements.

* Update InspectorManager-test.js

* Update utils-test.js

* Adding kind to context for tests

* Revert to create maintenance branch. (#103)

* Restore U2C functionality. (#104)

* Update release config for 5.x (#102)

* Ensure all types are exported in typings.d.ts. (#105)

Co-authored-by: Eli Bishop <eli@launchdarkly.com>
Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com>
Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com>
Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com>
Co-authored-by: Michael Siadak <mike.siadak@gmail.com>
Co-authored-by: Jeff Wen <sinchangwen@gmail.com>
Co-authored-by: Andrey Krasnov <34657799+Doesntmeananything@users.noreply.github.com>
Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com>
Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com>
Co-authored-by: Louis Chan <lchan@launchdarkly.com>
Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com>
Co-authored-by: Zach Davis <zach@launchdarkly.com>
Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
Co-authored-by: Mateusz Sikora <mateusz.sikora@ramp.network>
Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com>
Co-authored-by: Yusinto Ngadiman <yusinto@gmail.com>
LaunchDarklyReleaseBot added a commit that referenced this issue Feb 15, 2023
* add issue templates

* add babel-eslint

* add event capacity config property

* re-add deprecation warning on samplingInterval

* better config validation

* remove rollup-plugins-node-resolve

* use newer Rollup node-resolve plugin

* rm rollup-plugin-includepaths (unused)

* npm audit fix (handlebars dependency from jest)

* comment

* copyedit

* use new test helpers + misc test cleanup

* clean up stream testing logic

* fix hash parameter

* linter

* clearer way to model the config option defaults/types

* test improvements

* change internal param name

* comment

* fix default logger logic

* simpler way to enforce minimum values

* implement diagnostic events in common JS package (#11)

* add support for function type in config options

* add support for function type in config options (#13)

* add wrapper metadata options and fix custom header logic

* lint

* lint

* remove image-loading logic from common code, replace it with an abstraction

* add validation for options.streaming

* typo

* rm unused params

* typo in comment

* misc fixes to merged code from external PR

* add event payload ID header

* npm audit fix

* change exact dependencies to best-compatible

* standardize linting

* disallow "window" and "document"

* improve diag event tests + debug logging

* misc cleanup

* fix updating secure mode hash with identify()

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

* clean up init state logic, prevent unhandled rejections

* lint

* less strict matching of json content-type header

* remove unsafe usage of hasOwnProperty

* console logger must tolerate console object not always existing

* fix double initialization of diagnostics manager

* fix TypeScript declaration for track() and add more TS compilation tests (#27)

* remove startsWith usage (#28)

* prevent poll caused by a stream ping from overwriting later poll for another user (#29)

* upgrade jest dependency and transitive yargs-parser dependency (#30)

* Add null to LDEvaluationDetail.reason type (#31)

* Revert "Add null to LDEvaluationDetail.reason type (#31)"

This reverts commit bcb1573.

* Revert "Add null to LDEvaluationDetail.reason type (#31)"

This reverts commit bcb1573.

* nullable evaluation reason (#32)

* adding alias event functionality (#33)

* set stream read timeout

* Add prepare script (#34)

* add a missing typescript verification (#36)

* Removed the guides link

* Correct doc link (#36)

* Fix typo in LDClient.on jsdoc (#37)

* add inlineUsersInEvents option in TypeScript (#37)

* Filter private attributes on debug event users. Send variation for debug events.

* update uuid package version (#39)

* use Releaser v2 config + newer CI image

* First half, add the type, create the new options, add the new util method, and add tests

* Second half, call the tranform util method before calling any HTTP requests

* Update the transform to work on a copy of headers instead of mutating it

* add comments about removing custom event warning logic in the future

* revert updating of UUID dependency (#43)

* Revert "update uuid package version (#39)"

This reverts commit 3b2ff6c.

* update package-lock.json

* better error handling for local storage operations (#44)

* better error handling for local storage operations

* lint

* fix obsolete comments

* add basic logger similar to server-side Node SDK (#45)

* fix exports and add validation of custom logger (#46)

* remove typedoc.js file that interferes with Releaser's docs build

* update typescript version

* add maintenance branch

* remove deprecated things (#48)

* remove deprecated options and function

* rm references to obsolete function

* restore deprecation logic, just leave the data empty

* remove samplingInterval from TS test code

* fix TS test code again

* fix EvaluationDetail.reason to be nullable so we can get rid of NonNullableLDEvaluationReason type (#49)

* remove deprecated options and function

* rm references to obsolete function

* restore deprecation logic, just leave the data empty

* remove samplingInterval from TS test code

* fix TS test code again

* fix EvaluationDetail.reason to be nullable so we can get rid of NonNullableLDEvaluationReason type

* fix TS test code

* re-bump uuid package (#50)

* Revert "Revert "update uuid package version (#39)""

This reverts commit 89359b1bf4ddbe6b2fedb95f1dc11240483c60f7.

* remove lockfile (sc-107301)

* use regular User-Agent header name unless overridden by js-client-sdk (#52)

* switch to publishing js-sdk-common as a regular Node module (#51)

* fix CI

* remove `version` constant which can't be exported from js-sdk-common (#53)

* catch errors in JSON parsing of stream data (#54)

* catch errors in JSON parsing of stream data

* lint

* backport sc-142333 fix

* prepare 3.5.1 release (#63)

* initial move of code from js-client-sdk-private

* changelog note

* rm obsolete comment

* add npm audit helper

* update babel, jest, rollup

* fix rollup config

* fix ES build, dependency cleanup

* add Releaser metadata

* Update babel config to work in `test` without `useBuiltIns`

* copyedits

* fix misnamed directory

* use spread operator instead of Object.assign

* add issue templates

* add babel-eslint

* add event capacity config property

* re-add deprecation warning on samplingInterval

* better config validation

* remove rollup-plugins-node-resolve

* use newer Rollup node-resolve plugin

* rm rollup-plugin-includepaths (unused)

* npm audit fix (handlebars dependency from jest)

* comment

* copyedit

* use new test helpers + misc test cleanup

* clean up stream testing logic

* fix hash parameter

* linter

* clearer way to model the config option defaults/types

* test improvements

* change internal param name

* comment

* fix default logger logic

* simpler way to enforce minimum values

* implement diagnostic events in common JS package (#11)

* add support for function type in config options

* add support for function type in config options (#13)

* add wrapper metadata options and fix custom header logic

* lint

* lint

* remove image-loading logic from common code, replace it with an abstraction

* add validation for options.streaming

* typo

* rm unused params

* typo in comment

* misc fixes to merged code from external PR

* add event payload ID header

* npm audit fix

* change exact dependencies to best-compatible

* standardize linting

* disallow "window" and "document"

* improve diag event tests + debug logging

* misc cleanup

* fix updating secure mode hash with identify()

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

* clean up init state logic, prevent unhandled rejections

* lint

* less strict matching of json content-type header

* remove unsafe usage of hasOwnProperty

* console logger must tolerate console object not always existing

* fix double initialization of diagnostics manager

* fix TypeScript declaration for track() and add more TS compilation tests (#27)

* remove startsWith usage (#28)

* prevent poll caused by a stream ping from overwriting later poll for another user (#29)

* upgrade jest dependency and transitive yargs-parser dependency (#30)

* Add null to LDEvaluationDetail.reason type (#31)

* Revert "Add null to LDEvaluationDetail.reason type (#31)"

This reverts commit bcb1573.

* Revert "Add null to LDEvaluationDetail.reason type (#31)"

This reverts commit bcb1573.

* nullable evaluation reason (#32)

* adding alias event functionality (#33)

* set stream read timeout

* Add prepare script (#34)

* add a missing typescript verification (#36)

* Removed the guides link

* Correct doc link (#36)

* Fix typo in LDClient.on jsdoc (#37)

* add inlineUsersInEvents option in TypeScript (#37)

* Filter private attributes on debug event users. Send variation for debug events.

* update uuid package version (#39)

* use Releaser v2 config + newer CI image

* First half, add the type, create the new options, add the new util method, and add tests

* Second half, call the tranform util method before calling any HTTP requests

* Update the transform to work on a copy of headers instead of mutating it

* add comments about removing custom event warning logic in the future

* revert updating of UUID dependency (#43)

* Revert "update uuid package version (#39)"

This reverts commit 3b2ff6c.

* update package-lock.json

* better error handling for local storage operations (#44)

* better error handling for local storage operations

* lint

* fix obsolete comments

* add basic logger similar to server-side Node SDK (#45)

* fix exports and add validation of custom logger (#46)

* remove typedoc.js file that interferes with Releaser's docs build

* update typescript version

* add maintenance branch

* backport sc-142333 fix

Co-authored-by: Eli Bishop <eli@launchdarkly.com>
Co-authored-by: Zach Davis <zach@launchdarkly.com>
Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com>
Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com>
Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com>
Co-authored-by: Michael Siadak <mike.siadak@gmail.com>
Co-authored-by: Jeff Wen <sinchangwen@gmail.com>
Co-authored-by: Andrey Krasnov <34657799+Doesntmeananything@users.noreply.github.com>
Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com>
Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com>
Co-authored-by: Louis Chan <lchan@launchdarkly.com>
Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com>

* Releasing version 3.5.1

* rm obsolete file to fix merge

* Releasing version 3.5.1

* Migrate context code (#56)

* Migrate attribute reference code from node. (#57)

* Add U2C types and make minimal adjustments for type changes. (#58)

* Add U2C types.

* Update typings.d.ts. Make minimal adjustments for changes to typings.

* make URL path concatenation work right whether base URL has a trailing slash or not (#61)

* make URL path concatenation work right whether base URL has a trailing slash or not

* lint

* Update event format and filtering for contexts. (#59)

* Update persistence of generated keys for transient contexts. (#60)

* Implement support for application tags. (#55)

* Fix typing of LDOptionsBase. (#63)

* Implement application tags for 3.x. (#62)

* lint

* Add a line to refer to sendEventsOnlyForVariation

* Rename additional items. Functions, comments, variables. (#64)

* don't include deleted flags in allFlags (#66)

* Clear last seen cache on identity change. (#67)

* Enforce 64 character limit for tag value. (#68)

* Enforce 64 character limit for tag value.

* Lint. Comments. Remove unused param.

* Rename transient back to anonymous. (#70)

* [sc-160947] Switch to partial URL encoding. (#72)

* Remove the last seen cache, deprecate allowFrequentDuplicateEvents. (#73)

* Update with changes from main, remove frequent duplicate events option. (#75)

* Inspector proposal V2. (#71)

* Fix invoking flagUsed. (#77)

* Port jitter and backoff. (#79) (#81)

* Update U2C branch with inspection interfaces. (#80)

Co-authored-by: Eli Bishop <eli@launchdarkly.com>
Co-authored-by: Zach Davis <zach@launchdarkly.com>
Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com>
Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com>
Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com>
Co-authored-by: Michael Siadak <mike.siadak@gmail.com>
Co-authored-by: Jeff Wen <sinchangwen@gmail.com>
Co-authored-by: Andrey Krasnov <34657799+Doesntmeananything@users.noreply.github.com>
Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com>
Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com>
Co-authored-by: Louis Chan <lchan@launchdarkly.com>
Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com>
Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
Co-authored-by: LaunchDarklyReleaseBot <86431345+LaunchDarklyReleaseBot@users.noreply.github.com>

* Merge jitter/backoff to 5.0. (#85)

* Merge: Remove flatmap (#84)

Co-authored-by: Mateusz Sikora <mateusz.sikora@ramp.network>

* remove flatMap usage to support older browsers (#82)

Co-authored-by: Mateusz Sikora <mateusz.sikora@ramp.network>

* Remove support for secondary attribute. (#86)

* [sc-176610] Import messages specifically from './messages' not '.'. (#87)

* Update with changes from main. (#88)

* Update comments for U2C. (#89)

* Fixes from contract tests. (#90)

* Remove deprecation code.

* [sc-177798] Export getContextKeys function for reuse

* Added unit tests

* Moved getContextKeys to context.js

* Update EventProcessor.js

* Ignore null and empty string keys. Added more tests.

* Added warnings if kind is null or ''

* Added types for getContextKeys

* Update test-types.ts

* Port event summarizer from node. (#97)

* Fix handling of results from sendingEvents. (#98)

* [sc-178144] Undefined case versus typeof. (#99)

* Fix copy/paste doc comment. (#96)

* [sc-178313] Replace minor instances of user

* More replacements.

* Update InspectorManager-test.js

* Update utils-test.js

* Adding kind to context for tests

* Revert to create maintenance branch. (#103)

* Restore U2C functionality. (#104)

* Update release config for 5.x (#102)

* Ensure all types are exported in typings.d.ts. (#105)

* fix: Remove option chaining. (#106)

---------

Co-authored-by: Eli Bishop <eli@launchdarkly.com>
Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com>
Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com>
Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com>
Co-authored-by: Michael Siadak <mike.siadak@gmail.com>
Co-authored-by: Jeff Wen <sinchangwen@gmail.com>
Co-authored-by: Andrey Krasnov <34657799+Doesntmeananything@users.noreply.github.com>
Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com>
Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com>
Co-authored-by: Louis Chan <lchan@launchdarkly.com>
Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com>
Co-authored-by: Zach Davis <zach@launchdarkly.com>
Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
Co-authored-by: Mateusz Sikora <mateusz.sikora@ramp.network>
Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com>
Co-authored-by: Yusinto Ngadiman <yusinto@gmail.com>
LaunchDarklyReleaseBot added a commit that referenced this issue Mar 21, 2023
* add issue templates

* add babel-eslint

* add event capacity config property

* re-add deprecation warning on samplingInterval

* better config validation

* remove rollup-plugins-node-resolve

* use newer Rollup node-resolve plugin

* rm rollup-plugin-includepaths (unused)

* npm audit fix (handlebars dependency from jest)

* comment

* copyedit

* use new test helpers + misc test cleanup

* clean up stream testing logic

* fix hash parameter

* linter

* clearer way to model the config option defaults/types

* test improvements

* change internal param name

* comment

* fix default logger logic

* simpler way to enforce minimum values

* implement diagnostic events in common JS package (#11)

* add support for function type in config options

* add support for function type in config options (#13)

* add wrapper metadata options and fix custom header logic

* lint

* lint

* remove image-loading logic from common code, replace it with an abstraction

* add validation for options.streaming

* typo

* rm unused params

* typo in comment

* misc fixes to merged code from external PR

* add event payload ID header

* npm audit fix

* change exact dependencies to best-compatible

* standardize linting

* disallow "window" and "document"

* improve diag event tests + debug logging

* misc cleanup

* fix updating secure mode hash with identify()

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

* clean up init state logic, prevent unhandled rejections

* lint

* less strict matching of json content-type header

* remove unsafe usage of hasOwnProperty

* console logger must tolerate console object not always existing

* fix double initialization of diagnostics manager

* fix TypeScript declaration for track() and add more TS compilation tests (#27)

* remove startsWith usage (#28)

* prevent poll caused by a stream ping from overwriting later poll for another user (#29)

* upgrade jest dependency and transitive yargs-parser dependency (#30)

* Add null to LDEvaluationDetail.reason type (#31)

* Revert "Add null to LDEvaluationDetail.reason type (#31)"

This reverts commit bcb1573.

* Revert "Add null to LDEvaluationDetail.reason type (#31)"

This reverts commit bcb1573.

* nullable evaluation reason (#32)

* adding alias event functionality (#33)

* set stream read timeout

* Add prepare script (#34)

* add a missing typescript verification (#36)

* Removed the guides link

* Correct doc link (#36)

* Fix typo in LDClient.on jsdoc (#37)

* add inlineUsersInEvents option in TypeScript (#37)

* Filter private attributes on debug event users. Send variation for debug events.

* update uuid package version (#39)

* use Releaser v2 config + newer CI image

* First half, add the type, create the new options, add the new util method, and add tests

* Second half, call the tranform util method before calling any HTTP requests

* Update the transform to work on a copy of headers instead of mutating it

* add comments about removing custom event warning logic in the future

* revert updating of UUID dependency (#43)

* Revert "update uuid package version (#39)"

This reverts commit 3b2ff6c.

* update package-lock.json

* better error handling for local storage operations (#44)

* better error handling for local storage operations

* lint

* fix obsolete comments

* add basic logger similar to server-side Node SDK (#45)

* fix exports and add validation of custom logger (#46)

* remove typedoc.js file that interferes with Releaser's docs build

* update typescript version

* add maintenance branch

* remove deprecated things (#48)

* remove deprecated options and function

* rm references to obsolete function

* restore deprecation logic, just leave the data empty

* remove samplingInterval from TS test code

* fix TS test code again

* fix EvaluationDetail.reason to be nullable so we can get rid of NonNullableLDEvaluationReason type (#49)

* remove deprecated options and function

* rm references to obsolete function

* restore deprecation logic, just leave the data empty

* remove samplingInterval from TS test code

* fix TS test code again

* fix EvaluationDetail.reason to be nullable so we can get rid of NonNullableLDEvaluationReason type

* fix TS test code

* re-bump uuid package (#50)

* Revert "Revert "update uuid package version (#39)""

This reverts commit 89359b1bf4ddbe6b2fedb95f1dc11240483c60f7.

* remove lockfile (sc-107301)

* use regular User-Agent header name unless overridden by js-client-sdk (#52)

* switch to publishing js-sdk-common as a regular Node module (#51)

* fix CI

* remove `version` constant which can't be exported from js-sdk-common (#53)

* catch errors in JSON parsing of stream data (#54)

* catch errors in JSON parsing of stream data

* lint

* backport sc-142333 fix

* prepare 3.5.1 release (#63)

* initial move of code from js-client-sdk-private

* changelog note

* rm obsolete comment

* add npm audit helper

* update babel, jest, rollup

* fix rollup config

* fix ES build, dependency cleanup

* add Releaser metadata

* Update babel config to work in `test` without `useBuiltIns`

* copyedits

* fix misnamed directory

* use spread operator instead of Object.assign

* add issue templates

* add babel-eslint

* add event capacity config property

* re-add deprecation warning on samplingInterval

* better config validation

* remove rollup-plugins-node-resolve

* use newer Rollup node-resolve plugin

* rm rollup-plugin-includepaths (unused)

* npm audit fix (handlebars dependency from jest)

* comment

* copyedit

* use new test helpers + misc test cleanup

* clean up stream testing logic

* fix hash parameter

* linter

* clearer way to model the config option defaults/types

* test improvements

* change internal param name

* comment

* fix default logger logic

* simpler way to enforce minimum values

* implement diagnostic events in common JS package (#11)

* add support for function type in config options

* add support for function type in config options (#13)

* add wrapper metadata options and fix custom header logic

* lint

* lint

* remove image-loading logic from common code, replace it with an abstraction

* add validation for options.streaming

* typo

* rm unused params

* typo in comment

* misc fixes to merged code from external PR

* add event payload ID header

* npm audit fix

* change exact dependencies to best-compatible

* standardize linting

* disallow "window" and "document"

* improve diag event tests + debug logging

* misc cleanup

* fix updating secure mode hash with identify()

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

* clean up init state logic, prevent unhandled rejections

* lint

* less strict matching of json content-type header

* remove unsafe usage of hasOwnProperty

* console logger must tolerate console object not always existing

* fix double initialization of diagnostics manager

* fix TypeScript declaration for track() and add more TS compilation tests (#27)

* remove startsWith usage (#28)

* prevent poll caused by a stream ping from overwriting later poll for another user (#29)

* upgrade jest dependency and transitive yargs-parser dependency (#30)

* Add null to LDEvaluationDetail.reason type (#31)

* Revert "Add null to LDEvaluationDetail.reason type (#31)"

This reverts commit bcb1573.

* Revert "Add null to LDEvaluationDetail.reason type (#31)"

This reverts commit bcb1573.

* nullable evaluation reason (#32)

* adding alias event functionality (#33)

* set stream read timeout

* Add prepare script (#34)

* add a missing typescript verification (#36)

* Removed the guides link

* Correct doc link (#36)

* Fix typo in LDClient.on jsdoc (#37)

* add inlineUsersInEvents option in TypeScript (#37)

* Filter private attributes on debug event users. Send variation for debug events.

* update uuid package version (#39)

* use Releaser v2 config + newer CI image

* First half, add the type, create the new options, add the new util method, and add tests

* Second half, call the tranform util method before calling any HTTP requests

* Update the transform to work on a copy of headers instead of mutating it

* add comments about removing custom event warning logic in the future

* revert updating of UUID dependency (#43)

* Revert "update uuid package version (#39)"

This reverts commit 3b2ff6c.

* update package-lock.json

* better error handling for local storage operations (#44)

* better error handling for local storage operations

* lint

* fix obsolete comments

* add basic logger similar to server-side Node SDK (#45)

* fix exports and add validation of custom logger (#46)

* remove typedoc.js file that interferes with Releaser's docs build

* update typescript version

* add maintenance branch

* backport sc-142333 fix

Co-authored-by: Eli Bishop <eli@launchdarkly.com>
Co-authored-by: Zach Davis <zach@launchdarkly.com>
Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com>
Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com>
Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com>
Co-authored-by: Michael Siadak <mike.siadak@gmail.com>
Co-authored-by: Jeff Wen <sinchangwen@gmail.com>
Co-authored-by: Andrey Krasnov <34657799+Doesntmeananything@users.noreply.github.com>
Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com>
Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com>
Co-authored-by: Louis Chan <lchan@launchdarkly.com>
Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com>

* Releasing version 3.5.1

* rm obsolete file to fix merge

* Releasing version 3.5.1

* Migrate context code (#56)

* Migrate attribute reference code from node. (#57)

* Add U2C types and make minimal adjustments for type changes. (#58)

* Add U2C types.

* Update typings.d.ts. Make minimal adjustments for changes to typings.

* make URL path concatenation work right whether base URL has a trailing slash or not (#61)

* make URL path concatenation work right whether base URL has a trailing slash or not

* lint

* Update event format and filtering for contexts. (#59)

* Update persistence of generated keys for transient contexts. (#60)

* Implement support for application tags. (#55)

* Fix typing of LDOptionsBase. (#63)

* Implement application tags for 3.x. (#62)

* lint

* Add a line to refer to sendEventsOnlyForVariation

* Rename additional items. Functions, comments, variables. (#64)

* don't include deleted flags in allFlags (#66)

* Clear last seen cache on identity change. (#67)

* Enforce 64 character limit for tag value. (#68)

* Enforce 64 character limit for tag value.

* Lint. Comments. Remove unused param.

* Rename transient back to anonymous. (#70)

* [sc-160947] Switch to partial URL encoding. (#72)

* Remove the last seen cache, deprecate allowFrequentDuplicateEvents. (#73)

* Update with changes from main, remove frequent duplicate events option. (#75)

* Inspector proposal V2. (#71)

* Fix invoking flagUsed. (#77)

* Port jitter and backoff. (#79) (#81)

* Update U2C branch with inspection interfaces. (#80)

Co-authored-by: Eli Bishop <eli@launchdarkly.com>
Co-authored-by: Zach Davis <zach@launchdarkly.com>
Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com>
Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com>
Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com>
Co-authored-by: Michael Siadak <mike.siadak@gmail.com>
Co-authored-by: Jeff Wen <sinchangwen@gmail.com>
Co-authored-by: Andrey Krasnov <34657799+Doesntmeananything@users.noreply.github.com>
Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com>
Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com>
Co-authored-by: Louis Chan <lchan@launchdarkly.com>
Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com>
Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
Co-authored-by: LaunchDarklyReleaseBot <86431345+LaunchDarklyReleaseBot@users.noreply.github.com>

* Merge jitter/backoff to 5.0. (#85)

* Merge: Remove flatmap (#84)

Co-authored-by: Mateusz Sikora <mateusz.sikora@ramp.network>

* remove flatMap usage to support older browsers (#82)

Co-authored-by: Mateusz Sikora <mateusz.sikora@ramp.network>

* Remove support for secondary attribute. (#86)

* [sc-176610] Import messages specifically from './messages' not '.'. (#87)

* Update with changes from main. (#88)

* Update comments for U2C. (#89)

* Fixes from contract tests. (#90)

* Remove deprecation code.

* [sc-177798] Export getContextKeys function for reuse

* Added unit tests

* Moved getContextKeys to context.js

* Update EventProcessor.js

* Ignore null and empty string keys. Added more tests.

* Added warnings if kind is null or ''

* Added types for getContextKeys

* Update test-types.ts

* Port event summarizer from node. (#97)

* Fix handling of results from sendingEvents. (#98)

* [sc-178144] Undefined case versus typeof. (#99)

* Fix copy/paste doc comment. (#96)

* [sc-178313] Replace minor instances of user

* More replacements.

* Update InspectorManager-test.js

* Update utils-test.js

* Adding kind to context for tests

* Revert to create maintenance branch. (#103)

* Restore U2C functionality. (#104)

* Update release config for 5.x (#102)

* Ensure all types are exported in typings.d.ts. (#105)

* fix: Remove option chaining. (#106)

* fix: Make key optional on LDContext common. (#107)

---------

Co-authored-by: Eli Bishop <eli@launchdarkly.com>
Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com>
Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com>
Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com>
Co-authored-by: Michael Siadak <mike.siadak@gmail.com>
Co-authored-by: Jeff Wen <sinchangwen@gmail.com>
Co-authored-by: Andrey Krasnov <34657799+Doesntmeananything@users.noreply.github.com>
Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com>
Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com>
Co-authored-by: Louis Chan <lchan@launchdarkly.com>
Co-authored-by: Louis Chan <91093020+louis-launchdarkly@users.noreply.github.com>
Co-authored-by: Zach Davis <zach@launchdarkly.com>
Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
Co-authored-by: Mateusz Sikora <mateusz.sikora@ramp.network>
Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com>
Co-authored-by: Yusinto Ngadiman <yusinto@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants