This repository was archived by the owner on Apr 3, 2019. It is now read-only.
refactor(server): Extract and simplify record retreival/storage, user defined rules. #324
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
server.js has a whole bunch of mixed concerns, part of which was record retrieval
and loading/checking user defined rules.
This PR extracts record handling logic as well as user defined rules logic
into their own modules.
Loading/saving records can now be done through a common interface. fetchRecords no longer
holds the assumption that an ip address will be passed in. setRecord no longer requires
passing in a key as the key is stored on the record, and setRecords now only accepts records
instead of it's confusing signature. It's now possible to define non-enumerable
properties on a record that are not saved when serialized.
I started to use async/await to simplify logic where it made sense as well as
started down the path to using native promises in places.
Note, no remote tests are modified, so functionality should be the same.
This is groundwork to simplify the DataFlow integration where a simple API is
needed to fetch records of varying types.
@mozilla/fxa-devs - r?
blocks #325