💌 A beautiful, fast and fully open source mail client for Mac, Windows and Linux.
Find a file
Evan Morikawa 5561462568 feat(metadata): add cloudState that sync with Metadata service
Summary:
Now all plugins get passed a `cloudState` object to their `activate`
method.

The `cloudState` object is an instance of `CloudState` and acts like a
key-value store backed by the yet-to-be-implemented Metadata service.

It has a `get`, `getAll`, and `observe` method. The `observe` method
returns a new `Rx.Observable` for the given key.

It has a `set`, and `unset` method that doesn't actually mutate state, but
rather dispatches new `Task`s to Create, Update, and Delete `Metadata`
objects.

The whole object is backed by `Metadata` objects. Since these are standard
Database Objects that will appear on the delta sync streaming API, any
updates from the server will automatically propagate down to listening
views via the `Rx.Observable`s.

Additionally, there is a new `N1-Send-Later` stub plugin that demonstrates
how to use the `cloudState`.

There are few other minor refactors included in this diff:

**Generic CUD Tasks**: There is now a generic `CreateModelTask`,
`UpdateModelTask`, and `DestroyModelTask`. These can either be used as-is
or trivially overridden to easily update simple objects. Hopefully all of
the boilerplate rollback, error handling, and undo logic won't have to be
re-duplicated on every task. There are also tests for these tasks. We use
them to perform mutating actions on `Metadata` objects.

**New `boundProps` for `InjectedComponents`**: When making the
`N1-Send_later` plugin, I realized that the injected component needed to
get the `cloudState` somehow. Traditionally components would require
Stores and load data that way, but these are setup at `require`-time. Now
that `cloudState` only is available on `activate` we needed a way to get
the data to the components. There's now the concept of `boundProps` which
will be props added to the Component when it gets injected. This required
changing the return signature of `findComponentMatching`, which got
renamed to `findComponentDataMatching`.

**Failing on Promise Rejects**: Turns out that if a Promise rejected
due to an error or `Promise.reject` we were ignoring it and letting tests
pass. Now, tests will Fail if any unhandled promise rejects. This
uncovered a variety of errors throughout the test suite that had to be
fixed. The most significant one was during the `theme-manager` tests when
all packages (and their stores with async DB requests) was loaded. Long
after the `theme-manager` specs finished, those DB requests were
(somtimes) silently failing.

**Globally stub `DatabaseStore._query`**: All tests shouldn't actually
make queries on the database. Furthremore, the `inTransaction` block
doesn't resolve at all unless `_query` is stubbed. Instead of manually
remembering to do this in every test that touches the DB, it's now mocked
in `spec_helper`. This broke a handful of tests that needed to be manually
fixed.

**ESLint Fixes**: Some minor fixes to the linter config to prevent
yelling about minor ES6 things and ensuring we have the correct parser.

Test Plan: new tests

Reviewers: drew, bengotow, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D2419
2016-02-02 15:28:06 -05:00
apm refactor(env): new NylasEnv global 2015-11-17 16:41:20 -08:00
build fix(eslint): Avoid eslint/eslint/issues/5125 by specifying escope version 2016-02-01 11:08:15 -08:00
docs rm(Nilas-contact-elements): Remove unused package 2016-02-01 19:12:06 -08:00
dot-nylas feat(keymap): add new <KeymapHandlers /> 2015-11-06 11:47:06 -08:00
examples rm(mispelled): Stranded package.json file 2016-01-07 14:59:10 -08:00
internal_packages feat(metadata): add cloudState that sync with Metadata service 2016-02-02 15:28:06 -05:00
keymaps fix(keymap): don't use alt key in Windows keymaps 2016-01-28 14:26:56 -08:00
menus feat(screenshot-mode): Tiny feature for removing PII when taking debug screenshots 2016-01-29 16:39:07 -08:00
script build(linux): Ensure that target files are not group writable 2016-01-13 16:09:53 -08:00
spec feat(metadata): add cloudState that sync with Metadata service 2016-02-02 15:28:06 -05:00
spec_integration fix(composer): list creation edge case fixes and tests 2016-01-22 10:36:15 -08:00
src feat(metadata): add cloudState that sync with Metadata service 2016-02-02 15:28:06 -05:00
static 💄(thread-list): Correct top border on selected threads. Fixes #1189 2016-02-02 11:12:28 -08:00
.eslintrc Update grunt tasks to lint and transpile es6 code using babel 2015-11-06 17:40:42 -08:00
.gitignore feat(spec): add config dir to integration specs 2015-12-10 10:52:20 -05:00
.gitmodules feat(build): add nylas build resources 2015-12-02 13:59:54 -08:00
.travis.yml feat(build): new rpm builds 2016-01-04 09:56:14 -08:00
appveyor.yml fix(appveyor): check if the decryption password env variable is set 2015-12-21 20:51:04 -05:00
CHANGELOG.md Update CHANGELOG.md 2016-01-21 14:31:27 -08:00
CONTRIBUTING.md fix(contributing): Mention syncEngine.APIRoot 2016-01-21 10:42:31 -08:00
LICENSE.md meta(license): Add GPLv3 License 2015-10-01 10:23:42 -07:00
N1.sh fix(N1.sh): allow additional parameters specified on command line 2016-01-15 12:14:07 -05:00
package.json bump(version): 0.4.1 Beta 2016-02-01 18:31:04 -08:00
README.md add levelup theme 2016-01-28 13:23:10 -08:00

N1 Logo

N1 Screenshot

N1 is an open-source mail client built on the modern web with Electron, React, and Flux. It is designed to be extensible, so it's easy to create new experiences and workflows around email. N1 is built on the Nylas Sync Engine which is also open source free software.

Build Status Slack Invite Button

Download N1

You can download compiled versions of N1 for Windows, Mac OS X, and Linux (.deb) from https://nylas.com/N1. You can also build and run N1 on Fedora. A Fedora distribution is coming soon!

Build A Plugin

Plugins lie at the heart of N1 and give it its powerful features. Building your own plugins allows you to integrate the app with other tools, experiment with new workflows, and more. Follow the Getting Started guide to write your first plugin in 5 minutes.

If you would like to run the N1 source and contribute, check out our contributing guide.

Plugin List

We're working on building a plugin index that makes it super easy to add them to N1. For now, check out the list below! (Feel free to submit a PR if you build a plugin and want it featured here.)

Themes
Composer
Sidebar
Navbar
Threadlist
Message View

Running Locally

By default the N1 source points to our hosted version of the Nylas Sync Engine; however, the Sync Engine is open source and you can run it yourself.

Feature Requests / Plugin Ideas

Have an idea for a package, or a feature you'd love to see in N1? Check out our public Trello board to contribute your thoughts and vote on existing ideas.