Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

launchdarkly-js-sdk-common

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

launchdarkly-js-sdk-common - npm Package Compare versions

Comparing version 4.1.0 to 4.1.1

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Change log

## [4.1.0] - 2022-04-21
### Added:
- `LDOptionsBase.application`, for configuration of application metadata that may be used in LaunchDarkly analytics or other product features. This does not affect feature flag evaluations.
### Fixed:
- The `baseUrl`, `streamUrl`, and `eventsUrl` properties now work properly regardless of whether the URL string has a trailing slash. Previously, a trailing slash would cause request URL paths to have double slashes.
## [4.0.3] - 2022-02-16

@@ -7,0 +14,0 @@ ### Fixed:

2

package.json
{
"name": "launchdarkly-js-sdk-common",
"version": "4.1.0",
"version": "4.1.1",
"description": "LaunchDarkly SDK for JavaScript - common code",

@@ -5,0 +5,0 @@ "author": "LaunchDarkly <team@launchdarkly.com>",

@@ -233,2 +233,9 @@ import { sleepAsync, eventSink } from 'launchdarkly-js-test-helpers';

it('logs a warning when a tag value is too long', async () => {
const listener = errorListener();
const configIn = { application: { id: 'a'.repeat(65), version: 'b'.repeat(64) } };
expect(configuration.validate(configIn, listener.emitter, null, listener.logger).application.id).toBeUndefined();
await listener.expectWarningOnly(messages.tagValueTooLong('application.id'));
});
it('handles a valid application version', async () => {

@@ -235,0 +242,0 @@ const listener = errorListener();

@@ -51,6 +51,6 @@ const errors = require('./errors');

* Verify that a value meets the requirements for a tag value.
* @param {Object} config
* @param {string} tagValue
* @param {Object} logger
*/
function validateTagValue(name, config, tagValue, logger) {
function validateTagValue(name, tagValue, logger) {
if (typeof tagValue !== 'string' || !tagValue.match(allowedTagCharacters)) {

@@ -60,12 +60,16 @@ logger.warn(messages.invalidTagValue(name));

}
if (tagValue.length > 64) {
logger.warn(messages.tagValueTooLong(name));
return undefined;
}
return tagValue;
}
function applicationConfigValidator(name, config, value, logger) {
function applicationConfigValidator(name, value, logger) {
const validated = {};
if (value.id) {
validated.id = validateTagValue(`${name}.id`, config, value.id, logger);
validated.id = validateTagValue(`${name}.id`, value.id, logger);
}
if (value.version) {
validated.version = validateTagValue(`${name}.version`, config, value.version, logger);
validated.version = validateTagValue(`${name}.version`, value.version, logger);
}

@@ -141,3 +145,3 @@ return validated;

if (validator) {
const validated = validator(name, config, config[name], logger);
const validated = validator(name, config[name], logger);
if (validated !== undefined) {

@@ -144,0 +148,0 @@ ret[name] = validated;

@@ -316,3 +316,3 @@ const EventProcessor = require('./EventProcessor');

for (const key in flags) {
if (utils.objectHasOwnProperty(flags, key)) {
if (utils.objectHasOwnProperty(flags, key) && !flags[key].deleted) {
results[key] = variationDetailInternal(key, null, !options.sendEventsOnlyForVariation).value;

@@ -319,0 +319,0 @@ }

@@ -185,2 +185,4 @@ const errors = require('./errors');

const tagValueTooLong = name => `Value of "${name}" was longer than 64 characters and was discarded.`;
module.exports = {

@@ -221,2 +223,3 @@ bootstrapInvalid,

streamError,
tagValueTooLong,
unknownCustomEventKey,

@@ -223,0 +226,0 @@ unknownOption,

@@ -704,3 +704,4 @@ /**

/**
* Returns a map of all available flags to the current user's values.
* Returns a map of all available flags to the current user's values. This will send analytics
* events unless [[LDOptions.sendEventsOnlyForVariation]] is true.
*

@@ -707,0 +708,0 @@ * @returns

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc