launchdarkly-js-sdk-common
Advanced tools
Comparing version 4.1.1 to 4.2.0
@@ -5,2 +5,9 @@ # Change log | ||
## [4.1.1] - 2022-06-07 | ||
### Changed: | ||
- Enforce a 64 character limit for `application.id` and `application.version` configuration options. | ||
### Fixed: | ||
- Do not include deleted flags in `allFlags`. | ||
## [4.1.0] - 2022-04-21 | ||
@@ -7,0 +14,0 @@ ### Added: |
{ | ||
"name": "launchdarkly-js-sdk-common", | ||
"version": "4.1.1", | ||
"version": "4.2.0", | ||
"description": "LaunchDarkly SDK for JavaScript - common code", | ||
@@ -5,0 +5,0 @@ "author": "LaunchDarkly <team@launchdarkly.com>", |
@@ -47,22 +47,20 @@ import { sleepAsync, eventSink } from 'launchdarkly-js-test-helpers'; | ||
// As of the latest major version, there are no deprecated options. This logic can be restored | ||
// the next time we deprecate something. | ||
// function checkDeprecated(oldName, newName, value) { | ||
// const desc = newName | ||
// ? 'allows "' + oldName + '" as a deprecated equivalent to "' + newName + '"' | ||
// : 'warns that "' + oldName + '" is deprecated'; | ||
// it(desc, async () => { | ||
// const listener = errorListener(); | ||
// const config0 = {}; | ||
// config0[oldName] = value; | ||
// const config1 = configuration.validate(config0, listener.emitter, null, listener.logger); | ||
// if (newName) { | ||
// expect(config1[newName]).toBe(value); | ||
// expect(config1[oldName]).toBeUndefined(); | ||
// } else { | ||
// expect(config1[oldName]).toEqual(value); | ||
// } | ||
// await listener.expectWarningOnly(messages.deprecated(oldName, newName)); | ||
// }); | ||
// } | ||
function checkDeprecated(oldName, newName, value) { | ||
const desc = newName | ||
? 'allows "' + oldName + '" as a deprecated equivalent to "' + newName + '"' | ||
: 'warns that "' + oldName + '" is deprecated'; | ||
it(desc, async () => { | ||
const listener = errorListener(); | ||
const config0 = {}; | ||
config0[oldName] = value; | ||
const config1 = configuration.validate(config0, listener.emitter, null, listener.logger); | ||
if (newName) { | ||
expect(config1[newName]).toBe(value); | ||
expect(config1[oldName]).toBeUndefined(); | ||
} else { | ||
expect(config1[oldName]).toEqual(value); | ||
} | ||
await listener.expectWarningOnly(messages.deprecated(oldName, newName)); | ||
}); | ||
} | ||
@@ -107,3 +105,2 @@ function checkBooleanProperty(name) { | ||
checkBooleanProperty('inlineUsersInEvents'); | ||
checkBooleanProperty('allowFrequentDuplicateEvents'); | ||
checkBooleanProperty('sendEventsOnlyForVariation'); | ||
@@ -115,2 +112,4 @@ checkBooleanProperty('useReport'); | ||
checkDeprecated('allowFrequentDuplicateEvents', undefined, true); | ||
function checkNumericProperty(name, validValue) { | ||
@@ -117,0 +116,0 @@ it('enforces numeric type and default for "' + name + '"', async () => { |
@@ -104,3 +104,2 @@ import { baseOptionDefs } from '../configuration'; | ||
allAttributesPrivate: false, | ||
allowFrequentDuplicateEvents: false, | ||
autoAliasingOptOut: false, | ||
@@ -193,3 +192,2 @@ bootstrapMode: false, | ||
[{ allAttributesPrivate: true }, { allAttributesPrivate: true }], | ||
[{ allowFrequentDuplicateEvents: true }, { allowFrequentDuplicateEvents: true }], | ||
[{ bootstrap: {} }, { bootstrapMode: true }], | ||
@@ -196,0 +194,0 @@ [{ baseUrl: 'http://other' }, { customBaseURI: true }], |
@@ -81,5 +81,6 @@ const errors = require('./errors'); | ||
const deprecatedOptions = { | ||
// As of the latest major version, there are no deprecated options. Next time we deprecate | ||
// something, add an item here where the property name is the deprecated name, and the | ||
// property value is the preferred name if any, or null/undefined if there is no replacement. | ||
// The property name is the deprecated name, and the property value is the preferred name if | ||
// any, or null/undefined if there is no replacement. This should be removed, along with | ||
// the option, in the next major version. | ||
allowFrequentDuplicateEvents: undefined, | ||
}; | ||
@@ -86,0 +87,0 @@ |
@@ -204,3 +204,2 @@ const { v1: uuidv1 } = require('uuid'); | ||
fetchGoalsDisabled: !config.fetchGoals, | ||
allowFrequentDuplicateEvents: !!config.allowFrequentDuplicateEvents, | ||
sendEventsOnlyForVariation: !!config.sendEventsOnlyForVariation, | ||
@@ -207,0 +206,0 @@ autoAliasingOptOut: !!config.autoAliasingOptOut, |
@@ -66,3 +66,2 @@ const EventProcessor = require('./EventProcessor'); | ||
const seenRequests = {}; | ||
let flags = {}; | ||
@@ -185,11 +184,2 @@ let useLocalStorage; | ||
const value = detail ? detail.value : null; | ||
if (!options.allowFrequentDuplicateEvents) { | ||
const cacheKey = JSON.stringify(value) + (user && user.key ? user.key : '') + key; // see below | ||
const cached = seenRequests[cacheKey]; | ||
// cache TTL is five minutes | ||
if (cached && now - cached < 300000) { | ||
return; | ||
} | ||
seenRequests[cacheKey] = now; | ||
} | ||
@@ -196,0 +186,0 @@ const event = { |
@@ -176,6 +176,9 @@ /** | ||
/** | ||
* Whether or not to send an analytics event for a flag evaluation even if the same flag was | ||
* evaluated with the same value within the last five minutes. | ||
* This option is deprecated, and setting it has no effect. | ||
* | ||
* By default, this is false (duplicate events within five minutes will be dropped). | ||
* The behavior is now to allow frequent duplicate events. | ||
* | ||
* This is not a problem because most events will be summarized, and | ||
* events which are not summarized are important to the operation of features such as | ||
* experimentation. | ||
*/ | ||
@@ -182,0 +185,0 @@ allowFrequentDuplicateEvents?: boolean; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
375851
8473