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

prepare 5.0.0 release #83

Merged
merged 261 commits into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
261 commits
Select commit Hold shift + click to select a range
55c3852
copyedits
eli-darkly Oct 31, 2019
d361672
fix misnamed directory
eli-darkly Nov 1, 2019
f4eb20a
Merge pull request #2 from launchdarkly/eb/ch48393/initial
eli-darkly Nov 4, 2019
f072529
use spread operator instead of Object.assign
eli-darkly Nov 4, 2019
7c1299e
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
eli-darkly Nov 4, 2019
957f477
Merge pull request #4 from launchdarkly/eb/ch54985/object-assign
eli-darkly Nov 4, 2019
a57c404
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
eli-darkly Nov 4, 2019
1539659
add issue templates
eli-darkly Nov 4, 2019
013c273
add babel-eslint
eli-darkly Nov 4, 2019
db12eca
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
eli-darkly Nov 4, 2019
087773b
merge from public after release
LaunchDarklyCI Nov 4, 2019
5bac01d
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
bwoskow-ld Nov 7, 2019
e145270
add event capacity config property
eli-darkly Dec 3, 2019
34ed8a5
re-add deprecation warning on samplingInterval
eli-darkly Dec 3, 2019
2ef59bc
Merge pull request #5 from launchdarkly/eb/ch57883/event-capacity
eli-darkly Dec 3, 2019
33d0311
Merge pull request #6 from launchdarkly/eb/ch38635/deprecation-comment
eli-darkly Dec 3, 2019
3c3e22a
better config validation
eli-darkly Dec 3, 2019
5cfb5a0
remove rollup-plugins-node-resolve
eli-darkly Dec 4, 2019
3c0794a
use newer Rollup node-resolve plugin
eli-darkly Dec 4, 2019
6385bb7
rm rollup-plugin-includepaths (unused)
eli-darkly Dec 4, 2019
c1b6f09
npm audit fix (handlebars dependency from jest)
eli-darkly Dec 4, 2019
11e46e1
comment
eli-darkly Dec 4, 2019
7cc15ba
copyedit
eli-darkly Dec 4, 2019
c44052b
Merge pull request #7 from launchdarkly/eb/ch57985/config-validation
eli-darkly Dec 4, 2019
9dbb6b2
Merge pull request #8 from launchdarkly/eb/ch57982/rollup-builtins
eli-darkly Dec 4, 2019
1cf982b
use new test helpers + misc test cleanup
eli-darkly Dec 5, 2019
9077edf
clean up stream testing logic
eli-darkly Dec 6, 2019
3f77514
fix hash parameter
eli-darkly Dec 6, 2019
d1fe985
Merge pull request #9 from launchdarkly/eb/ch57131/test-cleanup
eli-darkly Dec 7, 2019
d0de600
linter
eli-darkly Dec 7, 2019
b0168db
Merge pull request #10 from launchdarkly/eb/ch57131/stream-tests
eli-darkly Dec 7, 2019
b489fb2
clearer way to model the config option defaults/types
eli-darkly Dec 9, 2019
a32383c
test improvements
eli-darkly Dec 9, 2019
cdc1e96
change internal param name
eli-darkly Dec 9, 2019
2fcfa79
comment
eli-darkly Dec 9, 2019
88aa416
fix default logger logic
eli-darkly Dec 9, 2019
ceb9e3d
simpler way to enforce minimum values
eli-darkly Dec 10, 2019
58ee382
Merge pull request #12 from launchdarkly/eb/ch57985/config-validation…
eli-darkly Dec 10, 2019
50bc6aa
implement diagnostic events in common JS package (#11)
eli-darkly Dec 11, 2019
53a8590
add support for function type in config options
eli-darkly Dec 12, 2019
0a782ca
add support for function type in config options (#13)
eli-darkly Dec 12, 2019
04130f7
add wrapper metadata options and fix custom header logic
eli-darkly Dec 12, 2019
9491e16
lint
eli-darkly Dec 12, 2019
c9e7d7e
Merge branch 'eb/ch57741/wrapper-desc' into eb/ch57741/diagnostic-wra…
eli-darkly Dec 12, 2019
2610fc7
lint
eli-darkly Dec 12, 2019
fd7e2bb
remove image-loading logic from common code, replace it with an abstr…
eli-darkly Dec 12, 2019
0f28ba9
Merge branch 'eb/ch57741/wrapper-desc' into eb/ch59034/no-image-loading
eli-darkly Dec 12, 2019
f40f19b
Merge branch 'eb/ch59034/no-image-loading' into eb/ch57741/diagnostic…
eli-darkly Dec 12, 2019
5bdb140
Merge branch 'master' into diagnostic-events
eli-darkly Dec 12, 2019
fedb366
Merge branch 'eb/ch57741/diagnostic-wrapper' into diagnostic-events
eli-darkly Dec 12, 2019
385cbcd
add validation for options.streaming
eli-darkly Dec 12, 2019
2affe2f
Merge branch 'eb/ch57741/wrapper-desc' into eb/ch59034/no-image-loading
eli-darkly Dec 12, 2019
9e653e8
typo
eli-darkly Dec 12, 2019
c88839c
rm unused params
eli-darkly Dec 12, 2019
6f50448
merge from public after release
LaunchDarklyCI Dec 13, 2019
b4e0bfd
typo in comment
eli-darkly Dec 13, 2019
c5494b1
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
eli-darkly Dec 13, 2019
6ef084a
Merge pull request #14 from launchdarkly/eb/ch57741/wrapper-desc
eli-darkly Dec 13, 2019
f3815bc
Merge pull request #15 from launchdarkly/eb/ch59034/no-image-loading
eli-darkly Dec 13, 2019
32d767f
misc fixes to merged code from external PR
eli-darkly Dec 13, 2019
7d4f67d
merge from public after release
LaunchDarklyCI Dec 13, 2019
3ba6e27
add event payload ID header
eli-darkly Jan 14, 2020
d9499df
Merge pull request #16 from launchdarkly/eb/ch61092/payload-id
eli-darkly Jan 15, 2020
a670c7f
merge from public after release
LaunchDarklyCI Jan 15, 2020
547b309
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
eli-darkly Jan 30, 2020
15b5072
npm audit fix
eli-darkly Jan 30, 2020
6294b02
change exact dependencies to best-compatible
eli-darkly Jan 30, 2020
f190577
Merge pull request #17 from launchdarkly/eb/ch63559/relax-deps
eli-darkly Feb 1, 2020
7068968
merge from public after release
LaunchDarklyCI Feb 1, 2020
8c42690
standardize linting
eli-darkly Feb 11, 2020
f838fb3
disallow "window" and "document"
eli-darkly Feb 11, 2020
5064c3b
Merge branch 'master' into diagnostic-events
eli-darkly Feb 11, 2020
ade0261
Merge pull request #18 from launchdarkly/eb/ch65303/linting
eli-darkly Feb 11, 2020
8db5bc2
Merge branch 'diagnostic-events'
eli-darkly Feb 11, 2020
b4affad
improve diag event tests + debug logging
eli-darkly Feb 12, 2020
a01e65f
misc cleanup
eli-darkly Feb 12, 2020
7862b29
Merge pull request #19 from launchdarkly/eb/ch57741/diag-tests-fixes
eli-darkly Feb 12, 2020
4140b85
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
eli-darkly Feb 12, 2020
20c655d
fix updating secure mode hash with identify()
eli-darkly Feb 13, 2020
8bf67c4
Merge pull request #20 from launchdarkly/eb/ch65728/identify-hash
eli-darkly Feb 13, 2020
ad44049
merge from public after release
LaunchDarklyCI Feb 13, 2020
232a404
don't omit streamInits.failed when it's false
eli-darkly Feb 14, 2020
bafa8da
Merge pull request #21 from launchdarkly/eb/ch65817/diag-explicit-false
eli-darkly Feb 14, 2020
ab182f0
merge from public after release
LaunchDarklyCI Feb 14, 2020
f954124
clean up init state logic, prevent unhandled rejections
eli-darkly Mar 5, 2020
78db776
lint
eli-darkly Mar 5, 2020
3136564
Merge pull request #22 from launchdarkly/eb/ch68119/init-state-error
eli-darkly Mar 6, 2020
bd3f238
merge from public after release
LaunchDarklyCI Mar 6, 2020
54099c8
less strict matching of json content-type header
eli-darkly Mar 18, 2020
e4c792c
Merge pull request #23 from launchdarkly/eb/ch69815/content-type
eli-darkly Mar 18, 2020
c610ffd
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
eli-darkly Mar 18, 2020
5a323d8
merge from public after release
LaunchDarklyCI Mar 18, 2020
c974e2c
remove unsafe usage of hasOwnProperty
eli-darkly Mar 18, 2020
f5177c7
Merge pull request #24 from launchdarkly/eb/ch69855/has-own-property
eli-darkly Mar 18, 2020
93ee649
merge from public after release
LaunchDarklyCI Mar 18, 2020
e7ee64a
console logger must tolerate console object not always existing
eli-darkly Mar 30, 2020
c2402de
Merge pull request #25 from launchdarkly/eb/ch71507/no-console
eli-darkly Mar 31, 2020
68f359b
merge from public after release
LaunchDarklyCI Mar 31, 2020
a84b943
fix double initialization of diagnostics manager
eli-darkly May 1, 2020
14134c9
Merge pull request #26 from launchdarkly/eb/ch75557/extra-diagnostics
eli-darkly May 1, 2020
bdc9335
merge from public after release
LaunchDarklyCI May 1, 2020
5aac8a2
fix TypeScript declaration for track() and add more TS compilation te…
eli-darkly May 13, 2020
ca937d3
merge from public after release
LaunchDarklyCI May 13, 2020
fc3a857
remove startsWith usage (#28)
bwoskow-ld Jul 10, 2020
88125a7
merge from public after release
LaunchDarklyCI Jul 10, 2020
b572761
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
eli-darkly Aug 5, 2020
1359aaf
prevent poll caused by a stream ping from overwriting later poll for …
eli-darkly Sep 12, 2020
b18f56f
merge from public after release
LaunchDarklyCI Sep 14, 2020
a6037a5
upgrade jest dependency and transitive yargs-parser dependency (#30)
bwoskow-ld Oct 15, 2020
bcb1573
Add null to LDEvaluationDetail.reason type (#31)
msiadak Oct 15, 2020
924213f
Merge branch 'contrib' of github.com:launchdarkly/js-sdk-common
bwoskow-ld Oct 15, 2020
88e42fb
Revert "Add null to LDEvaluationDetail.reason type (#31)"
bwoskow-ld Oct 16, 2020
6c26507
Revert "Add null to LDEvaluationDetail.reason type (#31)"
bwoskow-ld Oct 16, 2020
5125396
Merge branch 'contrib' of github.com:launchdarkly/js-sdk-common
bwoskow-ld Oct 16, 2020
b0f9c53
nullable evaluation reason (#32)
bwoskow-ld Nov 17, 2020
fdd97ee
merge from public after release
LaunchDarklyCI Nov 17, 2020
48bee4d
adding alias event functionality (#33)
bwoskow-ld Jan 20, 2021
7845b9a
set stream read timeout
eli-darkly Jan 26, 2021
f68c5b5
Merge pull request #35 from launchdarkly/eb/ch73764/stream-read-timeout
eli-darkly Jan 26, 2021
b36bb51
merge from public after release
LaunchDarklyCI Jan 26, 2021
efc11b0
Merge branch 'alias' of github.com:launchdarkly/js-sdk-common-private
bwoskow-ld Jan 27, 2021
b53732c
merge from public after release
LaunchDarklyCI Jan 27, 2021
a6ad9c8
Add prepare script (#34)
bwoskow-ld Jan 27, 2021
3911145
add a missing typescript verification (#36)
bwoskow-ld Jan 28, 2021
63c2ddd
Removed the guides link
bwoskow-ld Feb 3, 2021
fea10ae
Merge branch 'master' of github.com:launchdarkly/js-sdk-common into c…
bwoskow-ld Feb 9, 2021
4a5d31c
Correct doc link (#36)
sinchang Feb 9, 2021
72e9801
Merge branch 'contrib' of github.com:launchdarkly/js-sdk-common
bwoskow-ld Feb 9, 2021
0f83533
Fix typo in LDClient.on jsdoc (#37)
Doesntmeananything Mar 18, 2021
b493884
Merge branch 'contrib' of github.com:launchdarkly/js-sdk-common
bwoskow-ld Mar 18, 2021
94400df
add inlineUsersInEvents option in TypeScript (#37)
eli-darkly Apr 1, 2021
8d396dd
merge from public after release
LaunchDarklyCI Apr 1, 2021
4dfbc45
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
bwoskow-ld May 11, 2021
bb60a02
Filter private attributes on debug event users. Send variation for de…
gwhelanLD Jun 7, 2021
aef52df
Merge pull request #38 from launchdarkly/gw/ch110704/debug-private-attrs
gwhelanLD Jun 7, 2021
d7fc275
Merge remote-tracking branch 'public/master'
gwhelanLD Jun 8, 2021
717322a
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
eli-darkly Aug 13, 2021
3b2ff6c
update uuid package version (#39)
eli-darkly Aug 23, 2021
c7b2645
merge from public after release
Aug 23, 2021
e05d244
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
bwoskow-ld Sep 21, 2021
8689021
use Releaser v2 config + newer CI image
eli-darkly Sep 21, 2021
75380ab
Merge pull request #40 from launchdarkly/eb/ch118712/releaser-v2
eli-darkly Sep 21, 2021
fe2bd87
First half, add the type, create the new options, add the new util me…
louis-launchdarkly Sep 24, 2021
d3cb835
Second half, call the tranform util method before calling any HTTP re…
louis-launchdarkly Sep 24, 2021
80f3098
Update the transform to work on a copy of headers instead of mutating it
louis-launchdarkly Sep 29, 2021
decda5f
add comments about removing custom event warning logic in the future
eli-darkly Oct 13, 2021
c0ab7c6
Merge pull request #42 from launchdarkly/eb/sc-124547/deprecate-goals…
eli-darkly Oct 13, 2021
f3b4a9a
revert updating of UUID dependency (#43)
eli-darkly Oct 15, 2021
98f9a86
Merge branch 'master' into lc/sc108033/add-lazily-evaluated-header
eli-darkly Oct 15, 2021
b508c75
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
eli-darkly Oct 15, 2021
37af758
Merge branch 'master' into lc/sc108033/add-lazily-evaluated-header
eli-darkly Oct 15, 2021
b4294d8
Merge pull request #41 from launchdarkly/lc/sc108033/add-lazily-evalu…
louis-launchdarkly Oct 15, 2021
97c39ea
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
eli-darkly Oct 15, 2021
455d381
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
eli-darkly Oct 15, 2021
0444a31
merge from public after release
Oct 15, 2021
6edc3f6
better error handling for local storage operations (#44)
eli-darkly Jan 10, 2022
6fb8de6
add basic logger similar to server-side Node SDK (#45)
eli-darkly Jan 11, 2022
20bfe46
fix exports and add validation of custom logger (#46)
eli-darkly Jan 14, 2022
1f2076e
remove typedoc.js file that interferes with Releaser's docs build
eli-darkly Jan 14, 2022
52bc2af
update typescript version
eli-darkly Jan 14, 2022
00c0649
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
eli-darkly Jan 15, 2022
9474648
add maintenance branch
eli-darkly Jan 15, 2022
c26d831
remove deprecated things (#48)
eli-darkly Jan 15, 2022
cf9ec23
fix EvaluationDetail.reason to be nullable so we can get rid of NonNu…
eli-darkly Jan 15, 2022
ca4468b
re-bump uuid package (#50)
eli-darkly Jan 15, 2022
0ef060e
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
eli-darkly Jan 15, 2022
edf5c7a
use regular User-Agent header name unless overridden by js-client-sdk…
eli-darkly Jan 19, 2022
89c7a41
switch to publishing js-sdk-common as a regular Node module (#51)
eli-darkly Jan 20, 2022
59a9edc
fix CI
eli-darkly Jan 21, 2022
4e499a3
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
eli-darkly Jan 21, 2022
02895b1
remove `version` constant which can't be exported from js-sdk-common …
eli-darkly Jan 26, 2022
90098a2
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
eli-darkly Jan 26, 2022
7da82bb
Merge branch 'master' of github.com:launchdarkly/js-sdk-common
eli-darkly Jan 26, 2022
7b665ca
merge from public after release
Jan 26, 2022
d1b2875
catch errors in JSON parsing of stream data (#54)
eli-darkly Feb 17, 2022
df351a6
merge from public after release
Feb 17, 2022
7618644
backport sc-142333 fix
eli-darkly Feb 17, 2022
c2e5f5d
prepare 3.5.1 release (#63)
LaunchDarklyReleaseBot Feb 17, 2022
a736e46
Releasing version 3.5.1
Feb 17, 2022
b71603e
rm obsolete file to fix merge
eli-darkly Feb 17, 2022
a945a0c
Merge branch '3.x' of github.com:launchdarkly/js-sdk-common into 3.x
eli-darkly Feb 17, 2022
b6d90c7
Releasing version 3.5.1
Feb 17, 2022
ac38b52
merge from public after release
Feb 17, 2022
1cdbfd6
Migrate context code (#56)
kinyoklion Apr 8, 2022
b8f4b61
Migrate attribute reference code from node. (#57)
kinyoklion Apr 8, 2022
1922560
Add U2C types and make minimal adjustments for type changes. (#58)
kinyoklion Apr 18, 2022
8173212
make URL path concatenation work right whether base URL has a trailin…
eli-darkly Apr 18, 2022
ef919f0
Update event format and filtering for contexts. (#59)
kinyoklion Apr 18, 2022
2d65bc6
Update persistence of generated keys for transient contexts. (#60)
kinyoklion Apr 18, 2022
ea13ce5
Implement support for application tags. (#55)
kinyoklion Apr 20, 2022
3398942
Fix typing of LDOptionsBase. (#63)
kinyoklion Apr 21, 2022
c810e6f
Implement application tags for 3.x. (#62)
kinyoklion Apr 21, 2022
d3680b4
Merge branch '3.x'
eli-darkly Apr 21, 2022
088198c
lint
eli-darkly Apr 21, 2022
6f1feeb
merge from public after release
Apr 21, 2022
b58db4d
Add a line to refer to sendEventsOnlyForVariation
louis-launchdarkly Apr 22, 2022
ce963b3
Rename additional items. Functions, comments, variables. (#64)
kinyoklion Apr 22, 2022
3f01976
Merge pull request #65 from launchdarkly/lc/sc-151042/enhance-allFlag…
louis-launchdarkly Apr 22, 2022
784be57
don't include deleted flags in allFlags (#66)
eli-darkly Apr 29, 2022
8db6ad7
Clear last seen cache on identity change. (#67)
kinyoklion May 4, 2022
075f8e7
Merge branch 'main' of github.com:launchdarkly/js-sdk-common
eli-darkly May 7, 2022
7915ede
Enforce 64 character limit for tag value. (#68)
kinyoklion May 16, 2022
0df97d6
merge from public after release
Jun 7, 2022
97130dd
Rename transient back to anonymous. (#70)
kinyoklion Aug 8, 2022
2d7056b
[sc-160947] Switch to partial URL encoding. (#72)
kinyoklion Sep 7, 2022
06d1457
Remove the last seen cache, deprecate allowFrequentDuplicateEvents. (…
kinyoklion Sep 28, 2022
c6ca9d2
Update with changes from main, remove frequent duplicate events optio…
kinyoklion Sep 28, 2022
26dd615
merge from public after release
Oct 3, 2022
c8685e8
Inspector proposal V2. (#71)
kinyoklion Oct 12, 2022
803a63a
merge from public after release
Oct 17, 2022
aefe3d3
Fix invoking flagUsed. (#77)
kinyoklion Oct 17, 2022
50bee67
merge from public after release
Oct 17, 2022
095ce98
Port jitter and backoff. (#79) (#81)
kinyoklion Oct 19, 2022
1ce97b2
Update U2C branch with inspection interfaces. (#80)
kinyoklion Oct 20, 2022
364237c
Merge jitter/backoff to 5.0. (#85)
kinyoklion Oct 20, 2022
65783f7
Merge: Remove flatmap (#84)
kinyoklion Oct 20, 2022
b27d298
remove flatMap usage to support older browsers (#82)
kinyoklion Oct 20, 2022
b2e09b8
merge from public after release
Oct 20, 2022
1a71cd6
Remove support for secondary attribute. (#86)
kinyoklion Oct 27, 2022
6f5b8b0
[sc-176610] Import messages specifically from './messages' not '.'. (…
kinyoklion Nov 15, 2022
439d552
Update with changes from main. (#88)
kinyoklion Nov 15, 2022
dd74a95
Update comments for U2C. (#89)
kinyoklion Nov 16, 2022
379df8b
Fixes from contract tests. (#90)
kinyoklion Nov 18, 2022
eb8a0b2
Resolve conflicts.
kinyoklion Nov 18, 2022
45f46c4
Remove deprecation code.
kinyoklion Nov 18, 2022
7b78315
Merge pull request #93 from launchdarkly/rlamb/resolve-conflicts
kinyoklion Nov 18, 2022
0f8b889
[sc-177798] Export getContextKeys function for reuse
yusinto Nov 23, 2022
c38ff9a
Added unit tests
yusinto Nov 28, 2022
644e80c
Moved getContextKeys to context.js
yusinto Nov 28, 2022
fea0032
Update EventProcessor.js
yusinto Nov 28, 2022
54ce6b6
Ignore null and empty string keys. Added more tests.
yusinto Nov 28, 2022
dbff33c
Added warnings if kind is null or ''
yusinto Nov 28, 2022
e5071fc
Merge pull request #94 from launchdarkly/yus/sc-177798/export-getcont…
yusinto Nov 28, 2022
ac24f9d
Added types for getContextKeys
yusinto Nov 28, 2022
9aa9036
Update test-types.ts
yusinto Nov 28, 2022
58e8f98
Merge pull request #95 from launchdarkly/yus/sc-177975/export-type-de…
yusinto Nov 28, 2022
18bb860
Port event summarizer from node. (#97)
kinyoklion Nov 29, 2022
c7d25d9
Fix handling of results from sendingEvents. (#98)
kinyoklion Nov 29, 2022
455ae53
[sc-178144] Undefined case versus typeof. (#99)
kinyoklion Nov 29, 2022
50954a7
Fix copy/paste doc comment. (#96)
kinyoklion Nov 30, 2022
5eabfd8
[sc-178313] Replace minor instances of user
yusinto Nov 30, 2022
c5015ca
More replacements.
yusinto Nov 30, 2022
629b112
Update InspectorManager-test.js
yusinto Nov 30, 2022
453e255
Update utils-test.js
yusinto Nov 30, 2022
ab1403d
Adding kind to context for tests
yusinto Nov 30, 2022
4e2dfc7
Merge pull request #100 from launchdarkly/yus/sc-178313/prep-common-s…
yusinto Nov 30, 2022
f4642ea
Merge pull request #101 from launchdarkly/5.0
yusinto Nov 30, 2022
7f8419b
Revert to create maintenance branch. (#103)
kinyoklion Nov 30, 2022
fcb31f3
Restore U2C functionality. (#104)
kinyoklion Nov 30, 2022
bca5ea2
Update release config for 5.x (#102)
kinyoklion Nov 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .ldrelease/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ repo:

branches:
- name: main
description: 4.x
description: 5.x
- name: 4.x
- name: 3.x

publications:
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"scripts": {
"lint": "eslint --format 'node_modules/eslint-formatter-pretty' --ignore-path .eslintignore",
"lint:all": "eslint --format 'node_modules/eslint-formatter-pretty' --ignore-path .eslintignore src",
"lint-fix:all": "eslint --fix --format 'node_modules/eslint-formatter-pretty' --ignore-path .eslintignore src",
"format": "npm run format:md && npm run format:js",
"format:md": "prettier --parser markdown --ignore-path .prettierignore --write '*.md'",
"format:js": "prettier --ignore-path .prettierignore --write 'src/**/*.js'",
Expand All @@ -26,6 +27,7 @@
"@babel/preset-env": "^7.6.3",
"@babel/runtime": "7.6.3",
"@rollup/plugin-replace": "^2.2.0",
"@types/jest": "^27.4.1",
"babel-eslint": "^10.1.0",
"babel-jest": "^25.1.0",
"cross-env": "^5.1.4",
Expand Down
95 changes: 95 additions & 0 deletions src/AnonymousContextProcessor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
const { v1: uuidv1 } = require('uuid');
const { getContextKinds } = require('./context');

const errors = require('./errors');
const messages = require('./messages');
const utils = require('./utils');

const ldUserIdKey = 'ld:$anonUserId';

/**
* Create an object which can process a context and populate any required keys
* for anonymous objects.
*
* @param {Object} persistentStorage The persistent storage from which to store
* and access persisted anonymous context keys.
* @returns An AnonymousContextProcessor.
*/
function AnonymousContextProcessor(persistentStorage) {
function getContextKeyIdString(kind) {
if (kind === undefined || kind === null || kind === 'user') {
return ldUserIdKey;
}
return `ld:$contextKey:${kind}`;
}

function getCachedContextKey(kind) {
return persistentStorage.get(getContextKeyIdString(kind));
}

function setCachedContextKey(id, kind) {
return persistentStorage.set(getContextKeyIdString(kind), id);
}

/**
* Process a single kind context, or a single context within a multi-kind context.
* @param {string} kind The kind of the context. Independent because the kind is not prevent
* within a context in a multi-kind context.
* @param {Object} context
* @returns {Promise} a promise that resolves to a processed contexts, or rejects
* a context which cannot be processed.
*/
function processSingleKindContext(kind, context) {
// We are working on a copy of an original context, so we want to re-assign
// versus duplicating it again.

/* eslint-disable no-param-reassign */
if (context.key !== null && context.key !== undefined) {
context.key = context.key.toString();
return Promise.resolve(context);
}

if (context.anonymous) {
// If the key doesn't exist, then the persistent storage will resolve
// with undefined.
return getCachedContextKey(kind).then(cachedId => {
if (cachedId) {
context.key = cachedId;
return context;
} else {
const id = uuidv1();
context.key = id;
return setCachedContextKey(id, kind).then(() => context);
}
});
} else {
return Promise.reject(new errors.LDInvalidUserError(messages.invalidContext()));
}
/* eslint-enable no-param-reassign */
}

/**
* Process the context, returning a Promise that resolves to the processed context, or rejects if there is an error.
* @param {Object} context
* @returns {Promise} A promise which resolves to a processed context, or a rejection if the context cannot be
* processed. The context should still be checked for overall validity after being processed.
*/
this.processContext = context => {
if (!context) {
return Promise.reject(new errors.LDInvalidUserError(messages.contextNotSpecified()));
}

const processedContext = utils.clone(context);

if (context.kind === 'multi') {
const kinds = getContextKinds(processedContext);

return Promise.all(kinds.map(kind => processSingleKindContext(kind, processedContext[kind]))).then(
() => processedContext
);
}
return processSingleKindContext(context.kind, processedContext);
};
}

module.exports = AnonymousContextProcessor;
137 changes: 137 additions & 0 deletions src/ContextFilter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
const AttributeReference = require('./attributeReference');

function ContextFilter(config) {
const filter = {};

const allAttributesPrivate = config.allAttributesPrivate;
const privateAttributes = config.privateAttributes || [];

// These attributes cannot be removed via a private attribute.
const protectedAttributes = ['key', 'kind', '_meta', 'anonymous'];

const legacyTopLevelCopyAttributes = ['name', 'ip', 'firstName', 'lastName', 'email', 'avatar', 'country'];

/**
* For the given context and configuration get a list of attributes to filter.
* @param {Object} context
* @returns {string[]} A list of the attributes to filter.
*/
const getAttributesToFilter = context =>
(allAttributesPrivate
? Object.keys(context)
: [...privateAttributes, ...((context._meta && context._meta.privateAttributes) || [])]
).filter(attr => !protectedAttributes.some(protectedAttr => AttributeReference.compare(attr, protectedAttr)));

/**
* @param {Object} context
* @returns {Object} A copy of the context with private attributes removed,
* and the redactedAttributes meta populated.
*/
const filterSingleKind = context => {
if (typeof context !== 'object' || context === null || Array.isArray(context)) {
return undefined;
}

const { cloned, excluded } = AttributeReference.cloneExcluding(context, getAttributesToFilter(context));
cloned.key = String(cloned.key);
if (excluded.length) {
if (!cloned._meta) {
cloned._meta = {};
}
cloned._meta.redactedAttributes = excluded;
}
if (cloned._meta) {
delete cloned._meta['privateAttributes'];
if (Object.keys(cloned._meta).length === 0) {
delete cloned._meta;
}
}
// Make sure anonymous is boolean if present.
// Null counts as present, and would be falsy, which is the default.
if (cloned.anonymous !== undefined) {
cloned.anonymous = !!cloned.anonymous;
}

return cloned;
};

/**
* @param {Object} context
* @returns {Object} A copy of the context with the private attributes removed,
* and the redactedAttributes meta populated for each sub-context.
*/
const filterMultiKind = context => {
const filtered = {
kind: context.kind,
};
const contextKeys = Object.keys(context);

for (const contextKey of contextKeys) {
if (contextKey !== 'kind') {
const filteredContext = filterSingleKind(context[contextKey]);
if (filteredContext) {
filtered[contextKey] = filteredContext;
}
}
}
return filtered;
};

/**
* Convert the LDUser object into an LDContext object.
* @param {Object} user The LDUser to produce an LDContext for.
* @returns {Object} A single kind context based on the provided user.
*/
const legacyToSingleKind = user => {
const filtered = {
/* Destructure custom items into the top level.
Duplicate keys will be overridden by previously
top level items.
*/
...(user.custom || {}),

// Implicity a user kind.
kind: 'user',

key: user.key,
};

if (user.anonymous !== undefined) {
filtered.anonymous = !!user.anonymous;
}

// Copy top level keys and convert them to strings.
// Remove keys that may have been destructured from `custom`.
for (const key of legacyTopLevelCopyAttributes) {
delete filtered[key];
if (user[key] !== undefined && user[key] !== null) {
filtered[key] = String(user[key]);
}
}

if (user.privateAttributeNames !== undefined && user.privateAttributeNames !== null) {
filtered._meta = filtered._meta || {};
// If any private attributes started with '/' we need to convert them to references, otherwise the '/' will
// cause the literal to incorrectly be treated as a reference.
filtered._meta.privateAttributes = user.privateAttributeNames.map(
literal => (literal.startsWith('/') ? AttributeReference.literalToReference(literal) : literal)
);
}

return filtered;
};

filter.filter = context => {
if (context.kind === undefined || context.kind === null) {
return filterSingleKind(legacyToSingleKind(context));
} else if (context.kind === 'multi') {
return filterMultiKind(context);
} else {
return filterSingleKind(context);
}
};

return filter;
}

module.exports = ContextFilter;
29 changes: 15 additions & 14 deletions src/EventProcessor.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const EventSender = require('./EventSender');
const EventSummarizer = require('./EventSummarizer');
const UserFilter = require('./UserFilter');
const ContextFilter = require('./ContextFilter');
const errors = require('./errors');
const messages = require('./messages');
const utils = require('./utils');
const { getContextKeys } = require('./context');

function EventProcessor(
platform,
Expand All @@ -17,8 +18,7 @@ function EventProcessor(
const eventSender = sender || EventSender(platform, environmentId, options);
const mainEventsUrl = utils.appendUrlPath(options.eventsUrl, '/events/bulk/' + environmentId);
const summarizer = EventSummarizer();
const userFilter = UserFilter(options);
const inlineUsers = options.inlineUsersInEvents;
const contextFilter = ContextFilter(options);
const samplingInterval = options.samplingInterval;
const eventCapacity = options.eventCapacity;
const flushInterval = options.flushInterval;
Expand Down Expand Up @@ -47,16 +47,12 @@ function EventProcessor(
// Transform an event from its internal format to the format we use when sending a payload.
function makeOutputEvent(e) {
const ret = utils.extend({}, e);
if (e.kind === 'alias') {
// alias events do not require any transformation
return ret;
}
if (inlineUsers || e.kind === 'identify') {
// identify events always have an inline user
ret.user = userFilter.filterUser(e.user);
if (e.kind === 'identify') {
// identify events always have an inline context
ret.context = contextFilter.filter(e.context);
} else {
ret.userKey = e.user.key;
delete ret['user'];
ret.contextKeys = getContextKeysFromEvent(e);
delete ret['context'];
}
if (e.kind === 'feature') {
delete ret['trackEvents'];
Expand All @@ -65,6 +61,10 @@ function EventProcessor(
return ret;
}

function getContextKeysFromEvent(event) {
return getContextKeys(event.context, logger);
}

function addToOutbox(event) {
if (queue.length < eventCapacity) {
queue.push(event);
Expand Down Expand Up @@ -107,7 +107,7 @@ function EventProcessor(
}
if (addDebugEvent) {
const debugEvent = utils.extend({}, event, { kind: 'debug' });
debugEvent.user = userFilter.filterUser(debugEvent.user);
debugEvent.context = contextFilter.filter(debugEvent.context);
delete debugEvent['trackEvents'];
delete debugEvent['debugEventsUntilDate'];
addToOutbox(debugEvent);
Expand Down Expand Up @@ -136,7 +136,8 @@ function EventProcessor(
}
queue = [];
logger.debug(messages.debugPostingEvents(eventsToSend.length));
return eventSender.sendEvents(eventsToSend, mainEventsUrl).then(responseInfo => {
return eventSender.sendEvents(eventsToSend, mainEventsUrl).then(responses => {
const responseInfo = responses && responses[0];
if (responseInfo) {
if (responseInfo.serverTime) {
lastKnownPastTime = responseInfo.serverTime;
Expand Down
4 changes: 2 additions & 2 deletions src/EventSender.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function EventSender(platform, environmentId, options) {
const headers = isDiagnostic
? baseHeaders
: utils.extend({}, baseHeaders, {
'X-LaunchDarkly-Event-Schema': '3',
'X-LaunchDarkly-Event-Schema': '4',
'X-LaunchDarkly-Payload-ID': payloadId,
});
return platform
Expand Down Expand Up @@ -73,7 +73,7 @@ function EventSender(platform, environmentId, options) {
// no need to break up events into chunks if we can send a POST
chunks = [events];
} else {
chunks = utils.chunkUserEventsForUrl(MAX_URL_LENGTH - url.length, events);
chunks = utils.chunkEventsForUrl(MAX_URL_LENGTH - url.length, events);
}
const results = [];
for (let i = 0; i < chunks.length; i++) {
Expand Down
Loading