Mailspring/internal_packages/composer
Evan Morikawa e8d24ea1b5 refactor(DB): promisify database
Summary:
WIP. The app launches and works for me. I still need to fix the tests
just the DB ones though :D

I changed the `DatabaseProxy` into a `DatabaseConnection` object. It will
request a fully instantiated databse from the backend Browser.

If we're already setup, it'll connect straight to the existing DB.

If we're not setup, then it'll create a new database and run the inital
schema migration on it. The `_createNewDatabase` promise won't resolve
until the migration has run.

Until we add in a more sophisticated migration system and get rid of the
stupid `modelClassMap` that's shoved in `Utils`, I'm passing in a series
of `_setupQueries()` to get everything started.

The `DatabaseConnection` is also the one responsible for queuing up
queries until the DB is fully populated and ready to go.

We actually get a lot of queries before we're setup because a lot of
Stores will make DB requests on `require` in their `constructor` or `init`
methods. (remember all the times we call `_populateStore` in `init`).

Now those queries are aggregated by the `DatabaseConnection` and then
executed sequentially.

Our methods like `persistModel` now resolve only after both the queries
have completed AND their corresponding `triggerLater` has completed as
well.

Test Plan: in progress

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D1688
2015-06-26 07:42:41 -07:00
..
keymaps fix(keymap): add ctrl-enter to send email 2015-06-12 17:47:59 -07:00
lib refactor(DB): promisify database 2015-06-26 07:42:41 -07:00
spec fix(focus): Wait for cc/bcc to exist before trying to focus them 2015-06-17 12:29:32 -07:00
stylesheets fix(composer): Show a scrollbar in the popout composer 2015-06-23 15:21:25 -07:00
.bowerrc fix(drafts): Various improvements and fixes to drafts, draft state management 2015-02-03 16:24:31 -08:00
.gitignore fix(drafts): Various improvements and fixes to drafts, draft state management 2015-02-03 16:24:31 -08:00
bower.json refactor(utils): switch to regular underscore 2015-05-19 16:06:59 -07:00
build.js fix(drafts): Various improvements and fixes to drafts, draft state management 2015-02-03 16:24:31 -08:00
CHANGELOG.md fix(drafts): Various improvements and fixes to drafts, draft state management 2015-02-03 16:24:31 -08:00
end.frag fix(drafts): Various improvements and fixes to drafts, draft state management 2015-02-03 16:24:31 -08:00
package.json refactor(utils): switch to regular underscore 2015-05-19 16:06:59 -07:00
README.md fix(drafts): Rename files inbox-composer =>composer 2015-02-03 17:16:25 -08:00
start.frag fix(drafts): Various improvements and fixes to drafts, draft state management 2015-02-03 16:24:31 -08:00

composer package