Skip to content

Commit b29d4d4

Browse files
LaunchDarklyReleaseBoteli-darklyzmdavisLaunchDarklyCIbwoskow-ld
authored
prepare 4.2.0 release (#72)
* 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 * 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 * 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 * 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 * don't include deleted flags in allFlags (#66) * Enforce 64 character limit for tag value. (#68) * Enforce 64 character limit for tag value. * Lint. Comments. Remove unused param. * Remove the last seen cache, deprecate allowFrequentDuplicateEvents. (#73) 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>
1 parent ea82745 commit b29d4d4

File tree

6 files changed

+30
-40
lines changed

6 files changed

+30
-40
lines changed

src/__tests__/configuration-test.js

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,24 @@ describe('configuration', () => {
4444
await listener.expectNoErrors();
4545
}
4646

47-
// As of the latest major version, there are no deprecated options. This logic can be restored
48-
// the next time we deprecate something.
49-
// function checkDeprecated(oldName, newName, value) {
50-
// const desc = newName
51-
// ? 'allows "' + oldName + '" as a deprecated equivalent to "' + newName + '"'
52-
// : 'warns that "' + oldName + '" is deprecated';
53-
// it(desc, async () => {
54-
// const listener = errorListener();
55-
// const config0 = {};
56-
// config0[oldName] = value;
57-
// const config1 = configuration.validate(config0, listener.emitter, null, listener.logger);
58-
// if (newName) {
59-
// expect(config1[newName]).toBe(value);
60-
// expect(config1[oldName]).toBeUndefined();
61-
// } else {
62-
// expect(config1[oldName]).toEqual(value);
63-
// }
64-
// await listener.expectWarningOnly(messages.deprecated(oldName, newName));
65-
// });
66-
// }
47+
function checkDeprecated(oldName, newName, value) {
48+
const desc = newName
49+
? 'allows "' + oldName + '" as a deprecated equivalent to "' + newName + '"'
50+
: 'warns that "' + oldName + '" is deprecated';
51+
it(desc, async () => {
52+
const listener = errorListener();
53+
const config0 = {};
54+
config0[oldName] = value;
55+
const config1 = configuration.validate(config0, listener.emitter, null, listener.logger);
56+
if (newName) {
57+
expect(config1[newName]).toBe(value);
58+
expect(config1[oldName]).toBeUndefined();
59+
} else {
60+
expect(config1[oldName]).toEqual(value);
61+
}
62+
await listener.expectWarningOnly(messages.deprecated(oldName, newName));
63+
});
64+
}
6765

6866
function checkBooleanProperty(name) {
6967
it('enforces boolean type and default for "' + name + '"', async () => {
@@ -103,13 +101,14 @@ describe('configuration', () => {
103101
checkBooleanProperty('allAttributesPrivate');
104102
checkBooleanProperty('sendLDHeaders');
105103
checkBooleanProperty('inlineUsersInEvents');
106-
checkBooleanProperty('allowFrequentDuplicateEvents');
107104
checkBooleanProperty('sendEventsOnlyForVariation');
108105
checkBooleanProperty('useReport');
109106
checkBooleanProperty('evaluationReasons');
110107
checkBooleanProperty('diagnosticOptOut');
111108
checkBooleanProperty('streaming');
112109

110+
checkDeprecated('allowFrequentDuplicateEvents', undefined, true);
111+
113112
function checkNumericProperty(name, validValue) {
114113
it('enforces numeric type and default for "' + name + '"', async () => {
115114
await expectDefault(name);

src/__tests__/diagnosticEvents-test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ describe('DiagnosticsManager', () => {
101101
};
102102
const defaultConfigInEvent = {
103103
allAttributesPrivate: false,
104-
allowFrequentDuplicateEvents: false,
105104
autoAliasingOptOut: false,
106105
bootstrapMode: false,
107106
customBaseURI: false,
@@ -189,7 +188,6 @@ describe('DiagnosticsManager', () => {
189188
it('sends init event on start() with custom config', async () => {
190189
const configAndResultValues = [
191190
[{ allAttributesPrivate: true }, { allAttributesPrivate: true }],
192-
[{ allowFrequentDuplicateEvents: true }, { allowFrequentDuplicateEvents: true }],
193191
[{ bootstrap: {} }, { bootstrapMode: true }],
194192
[{ baseUrl: 'http://other' }, { customBaseURI: true }],
195193
[{ eventsUrl: 'http://other' }, { customEventsURI: true }],

src/configuration.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ function validate(options, emitter, extraOptionDefs, logger) {
7878
const optionDefs = utils.extend({ logger: { default: logger } }, baseOptionDefs, extraOptionDefs);
7979

8080
const deprecatedOptions = {
81-
// As of the latest major version, there are no deprecated options. Next time we deprecate
82-
// something, add an item here where the property name is the deprecated name, and the
83-
// property value is the preferred name if any, or null/undefined if there is no replacement.
81+
// The property name is the deprecated name, and the property value is the preferred name if
82+
// any, or null/undefined if there is no replacement. This should be removed, along with
83+
// the option, in the next major version.
84+
allowFrequentDuplicateEvents: undefined,
8485
};
8586

8687
function checkDeprecatedOptions(config) {

src/diagnosticEvents.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ function DiagnosticsManager(
201201
usingSecureMode: !!config.hash,
202202
bootstrapMode: !!config.bootstrap,
203203
fetchGoalsDisabled: !config.fetchGoals,
204-
allowFrequentDuplicateEvents: !!config.allowFrequentDuplicateEvents,
205204
sendEventsOnlyForVariation: !!config.sendEventsOnlyForVariation,
206205
autoAliasingOptOut: !!config.autoAliasingOptOut,
207206
};

src/index.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ function initialize(env, user, specifiedOptions, platform, extraOptionDefs) {
6363

6464
const requestor = Requestor(platform, options, environment);
6565

66-
const seenRequests = {};
6766
let flags = {};
6867
let useLocalStorage;
6968
let streamActive;
@@ -181,15 +180,6 @@ function initialize(env, user, specifiedOptions, platform, extraOptionDefs) {
181180
const user = ident.getUser();
182181
const now = new Date();
183182
const value = detail ? detail.value : null;
184-
if (!options.allowFrequentDuplicateEvents) {
185-
const cacheKey = JSON.stringify(value) + (user && user.key ? user.key : '') + key; // see below
186-
const cached = seenRequests[cacheKey];
187-
// cache TTL is five minutes
188-
if (cached && now - cached < 300000) {
189-
return;
190-
}
191-
seenRequests[cacheKey] = now;
192-
}
193183

194184
const event = {
195185
kind: 'feature',

typings.d.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,13 @@ declare module 'launchdarkly-js-sdk-common' {
173173
inlineUsersInEvents?: boolean;
174174

175175
/**
176-
* Whether or not to send an analytics event for a flag evaluation even if the same flag was
177-
* evaluated with the same value within the last five minutes.
176+
* This option is deprecated, and setting it has no effect.
178177
*
179-
* By default, this is false (duplicate events within five minutes will be dropped).
178+
* The behavior is now to allow frequent duplicate events.
179+
*
180+
* This is not a problem because most events will be summarized, and
181+
* events which are not summarized are important to the operation of features such as
182+
* experimentation.
180183
*/
181184
allowFrequentDuplicateEvents?: boolean;
182185

0 commit comments

Comments
 (0)