Commit graph

1185 commits

Author SHA1 Message Date
Evan Morikawa bd33c5fdc3 [local-sync] temporarily remove validation in send 2016-12-19 09:38:12 -08:00
Evan Morikawa d55a2af2cd [cloud-api] refactor cloud API routes to use es6 & fix Gmail Auth
Summary:
This is a refactor of the auth APIs to use async/await. Gmail Auth is
pretty confusing and I wanted to make it cleaner to read and easier to
use. This is also part of the general API upgrade to modern ES6

This also fixes the Gmail auth error we saw at showcase

Test Plan: manual

Reviewers: halla, jackie, mark, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3535
2016-12-19 09:25:07 -08:00
Juan Tejada 5810bb6b79 [local-sync] Fix issue with imap connection mail event
Summary:
See https://github.com/mscdex/node-imap/issues/585 for details.

This issue was causing us constantly run the sync loop without pauses,
i.e. every next sync loop was scheduled immediately.

Currently, when we receive a new `'mail'`event, we trigger a new sync loop. Previously, when this happened while a sync loop was already in progress we would just ignore the event. However, my recent patch keeps track of how many times we tried to start a sync loop while one was already in progress. If the number of times this happens is > 0, it will schedule the next sync loop immediately (as opposed to waiting a constant amount seconds before the next loop).

The problem is that this new logic is making the sync worker always schedule the next sync loop immediately (without pausing for a few seconds). This is due to the following chain of events (assume we are just syncing `all` and `trash` folders):

This commit is a temporary workaround to this problem.

Test Plan: manual

Reviewers: evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3537
2016-12-19 08:08:59 -08:00
Evan Morikawa 39b0e6c3ee [isomorphic-core] add office365 in provider list 2016-12-16 18:51:11 -05:00
Halla Moore b46ffd4a3f [local-sync] Fix a couple bugs that popped up while sending
- Pass in the account when creating an ImapConnection
- Wrap the return value of the SendMessage task in an object
2016-12-16 15:43:39 -08:00
Evan Morikawa 5a1fb3c9ad [local-api] fix validation errors on send 2016-12-16 18:29:52 -05:00
Christine Spang c6a80efc44 [local-sync] Fix parseFromImap specs
Lots has changed for the better! Tests work again also.
2016-12-16 14:42:26 -08:00
Juan Tejada abc5f35255 [local-sync] Ensure send runs fast, clean up multisend tasks
Summary:
Associated N1 Diff: D3530

This commit converts multi-send from a 3 step process into a 2 step
process

The first step creates the base message and sends a message per
recipient, each with its customized message body for tracking.

The second step reconciles all sent messages, specifically removing any
sent messages created by gmail, and saving the correct message to the
sent folder

This commit also ensures that we run the send tasks immediately by
ensuring we restart the sync loop if its already running

Test Plan: Manual

Reviewers: evan, jackie, halla

Reviewed By: jackie, halla

Differential Revision: https://phab.nylas.com/D3529
2016-12-16 14:41:20 -08:00
Evan Morikawa d095551e90 [isomorphic-core] add office365 auth support
Summary:
Adds support for office 365
Depends on D3532

Test Plan: manual

Reviewers: jackie, halla, mark, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3533
2016-12-16 16:53:05 -05:00
Karim Hamidou 101b99f4a7 [feat] Refresh Gmail access tokens when needed
Summary:
This is a small patch but it's pretty complex, because of the numbers of moving parts. Gmail has two types of tokens, access and refresh tokens. Access tokens have a limited shelf life of one hour. After that they expire and you need to use your refresh token to get a new one.

We've decided to do the access token generation on the server, because we don't feel comfortable giving our users both our Google client id and secret. To do that, I've added an endpoint, `/gmail/auth/refresh` which returns a valid access token as well as an expiration date for the token.

The only place where we handle token expiration is in the sync workers. Before trying opening a new connection we check if our access token is expired. If yes, we get a new one from the API. If there's an issue doing this, we notify N1 using `NylasAPIHelpers.handleAuthenticationFailure`.

There's a second patch for N1 with tiny related fixes.

Test Plan: Tested manually. Will need to test more in the real world.

Reviewers: evan, jackie, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3522
2016-12-16 11:38:45 -08:00
Juan Tejada 86a2b13730 [local-sync] Fix sync worker
- Correctly await async functions
- Make sync in progress more explicit
2016-12-16 11:38:15 -08:00
Christine Spang e77fbc21e1 [local-sync] Update comment 2016-12-16 11:06:04 -08:00
Halla Moore 5a7aa45629 [local-sync] Fix a couple of message parsing bugs
Summary:
- Don't fail if there's no subject, just set it to `(no subject)`
- Support "BINARY" content-transfer-encoding. (This really means
that there is no encoding, so it's simple to add support for it)

Test Plan: tested locally

Reviewers: jackie

Reviewed By: jackie

Differential Revision: https://phab.nylas.com/D3528
2016-12-16 10:50:35 -08:00
Evan Morikawa 1d254a7aaa [*] Add basic babel toolchain
Summary:
Adds babel to K2
Creates a simple build script so it'll run on prod.

Test Plan: manual

Reviewers: jackie, halla, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3527
2016-12-16 13:08:21 -05:00
Juan Tejada b17be6b873 [local-sync] Fix sync worker - Restore fns removed by mistake 2016-12-15 20:43:52 -08:00
Juan Tejada 2c6be51970 [local-sync] Fix typo 2016-12-15 18:45:24 -08:00
Juan Tejada 2233992f27 [local-sync] Allow sync-worker to be restarted
Summary:
Add internal state to the sync worker to allow for it to be interrupted
and restarted.

The concept in this commit is that if we've tried to trigger a sync enough times
while its already in progress, bail and start over.

Usually, we manually trigger sync loops when we queue a new SyncbackTasks,
so that the newly queued task gets executed. This is necessary because the only
way to run SyncbackTasks is via the sync loop, for consistency and simplicity
reasons.

For example, we might run into a case where we queue a SendMessage task,
and we want it to be executed ASAP, but if we're in the middle of a
syncing a mailbox with a ton of folders, we wont get to the SendMessage
task after some considerable time.

Specifically this commit makes it so:

- If the number of sync attempts while in progress is > 0, make sure we schedule the next sync immediately
- If we reach a threshold of sync attempts while in progress, interrupt sync and restart

Test Plan: todo :(

Reviewers: mark, spang, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3520
2016-12-15 15:17:45 -08:00
Juan Tejada 5189407e38 [local-sync] Fix syncback tasks execution
Summary:
We were doing all of this fancy filtering and sorting to determine which
tasks to run, but in the end, we were just running the whole unsorted
list (using the wrong variable)

Also extracted getting the list of tasks into its own function, for
easier unit tests (it should really have some)

And, also wanted to make sure other people looked at this code, since I
believe no one has before.

Test Plan: todo

Reviewers: mark, khamidou, spang, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D3516
2016-12-15 14:41:53 -08:00
Evan Morikawa 2d145800ae [local-sync] fix missing dependency 2016-12-15 17:04:51 -05:00
Evan Morikawa b542edce02 [local-private] require Rx from nylas-exports 2016-12-15 15:32:29 -05:00
Juan Tejada 3910799683 [local-sync] Fix contact parsing from T7327
Summary: See description at T7327

Test Plan: Manual, but this should have unit tests

Reviewers: mark, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3513
2016-12-15 12:30:59 -08:00
Juan Tejada e17b6d8d17 [local-sync]: Move sendmail-client and errors to isomorphic-core
Summary:
Move sendmail-client and errors to isomorphic-core, given that they will
probably be used by cloud-workers (plugin backends) and cloud-api

Depends on D3510

Test Plan: Manual

Reviewers: halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D3512
2016-12-15 12:29:56 -08:00
Juan Tejada c8e71464f9 [local-sync] Update send endpoints to use SyncbackTasks
Summary:
Associated N1 diff: D3511
Convert send endpoints to use syncback tasks for consistency with how we
perform other imap operations, but primarily:
- So that it triggers a sync loop immediately and we pick up changes quickly
- To keep track of various send operations as a single unit (e.g. sending + saving to sent folder or deleting from sent)

This commit also fixes SyncbackRequest error handling and processing in
N1-- previously we were saving error fields to the syncbackRequests with
a format that didn't match N1's API error and which wasn't properly
serializable. (Also rename HTTPError to APIError)

Test Plan: Todo/Manual

Reviewers: jackie, halla, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3510
2016-12-15 11:55:40 -08:00
Juan Tejada b6d8459d50 [local-sync] Report folder syncState to N1
Summary:
Associated N1 diff: D3515

Stop ignoring deltas for Folder.syncState updates

Test Plan: Manual

Reviewers: mark, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3514
2016-12-15 11:08:20 -08:00
Christine Spang e5a9e2cc9e [local-sync] Allow logging parsed messages to disk with NYLAS_DEBUG env var
Summary:
I've found this useful for generating test cases and am tired
of adding and removing this code!

Test Plan: inspect output of /tmp/k2-parse-output

Reviewers: juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3518
2016-12-15 10:45:48 -08:00
Christine Spang ac5c7e3d2c [local-sync] Escape HTML entities in plaintext
Summary: This was understandably causing some messages to fail to display correctly.

Test Plan: unit tests are already broken for message parsing -- will fix in follow up diff

Reviewers: juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3517
2016-12-15 10:41:36 -08:00
Evan Morikawa ee831ba0aa [local-private, local-sync] temporarily disable specs
[local-private] Disable more broken specs

Disable specs

Reenable local-sync tests
2016-12-15 12:57:24 -05:00
Juan Tejada b79488ae43 [local-sync, cloud-api, cloud-workers] Fix msg id collision, tracking and sending issues, some refactoring
Summary:
This diff solves a few separate issues from T7313, T7316, T7282, and it refactors
the send code a little bit.

Initially, the problem that led to this diff was generating message ids that
wouldn't collide (which was causing errors in the message-processor). Collisions
in ids were being caused by messages that contained the exact same participants,
subject and date (most likely due bots or scripts sending emails in quick
succession)

To prevent collisions this commit adds the `message-id` header as part of the
database message id, and ensures that we set it correctly before sending, and
that it remains consistent through send, multi-send, and the sync loop.

During the refactor and review, I removed some code that assumed that we were
syncing drafts (which we aren't), and also fixes a few other known and
unknown issues around sending, message creation, and tracking, like assigning
the correct date header (we were previously assigning the draft creation date
from within N1), fixing the tracking regex, among other smaller bugs/typos.

Will address inline TODOs in a separate diff

Test Plan: TODO!!! I will add tests in another diff

Reviewers: evan, halla, jackie, khamidou

Reviewed By: halla, jackie

Differential Revision: https://phab.nylas.com/D3507
2016-12-14 19:35:48 -08:00
Mark Hahnenberg a45bd4515a [local-sync] Fix Contact.toJSON
Summary:
We forgot to refactor `publicId` to just `id`, which was breaking contact
deltas in N1.

Test Plan: Run locally

Reviewers: khamidou, evan, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3508
2016-12-14 17:20:56 -08:00
Mark Hahnenberg cfc8d3e315 [local-sync] Implement /thread/search endpoint for generic IMAP
Summary: See title

Test Plan: Run locally

Reviewers: juan, evan

Reviewed By: juan, evan

Maniphest Tasks: T7281

Differential Revision: https://phab.nylas.com/D3498
2016-12-14 11:50:22 -08:00
Halla Moore 138c79bf71 [local-sync] Fix contact validation
Summary:
Allow other fields to be passed in with participants, so that Contact
objects can be passed in as JSON. Also fix an error check.

Test Plan: tested locally

Reviewers: jackie

Reviewed By: jackie

Differential Revision: https://phab.nylas.com/D3504
2016-12-14 10:43:20 -08:00
Christine Spang c214ba1e34 [local-sync] Parse DOM to extract snippets
Summary:
This fixes multiple issues, including snippets telling you you
ought to look at the HTML as well as cruft like HTML entities
and CSS in snippets.

Test Plan: unit tests included o.O

Reviewers: juan

Reviewed By: juan

Subscribers: evan

Differential Revision: https://phab.nylas.com/D3500
2016-12-13 16:32:22 -08:00
Jackie Luo 5243629831 [local-sync] Update URLs and regex 2016-12-13 16:26:05 -08:00
Mark Hahnenberg b47cd28d89 [local-sync] Implement /threads/search endpoint for Gmail
Summary: See title

Test Plan: Ran it locally

Reviewers: khamidou, juan, evan

Reviewed By: juan, evan

Differential Revision: https://phab.nylas.com/D3496
2016-12-13 13:44:00 -08:00
Jackie Luo 4a6f1dd012 fix(tracking): Update server URLs and send MESSAGE_ID 2016-12-13 12:53:48 -08:00
Halla Moore 547ff416e7 [local-sync] Fix a couple of multi-send bugs
Summary:
1) Send the custom body, rather than the generic body
2) Extract contacts correctly so that the saved sent message has all the
   participants, rather than just the last one

Test Plan: Tested locally

Reviewers: jackie

Reviewed By: jackie

Differential Revision: https://phab.nylas.com/D3499
2016-12-13 11:45:59 -08:00
Evan Morikawa 655175d94f [cloud-api, local-sync] reordering for lerna 2016-12-12 10:37:43 -05:00
Evan Morikawa 5a5aeb6bb3 [local-private] move old edgehill src/pro into packages/local-private
Summary: This is a test

Test Plan: Testing

Reviewers: juan

Differential Revision: https://phab.nylas.com/D3493

[local-private] add old edgehill src/pro into packages/local-private
2016-12-12 10:09:58 -05:00
Mark Hahnenberg f32d0df7e0 [local-sync] Increment streamAll offset by chunkSize (#5)
Otherwise we'll infinite loop if there are more than 2000 results.
2016-12-09 11:15:04 -08:00
Mark Hahnenberg 60bca4acb2 [local-sync] Add index for Thread.id (#4) 2016-12-09 11:12:47 -08:00
Christine Spang 587f7787a6 fix(local-sync): Fix charset interpretation in message parsing
Summary:
This commit fixes the following bugs in message parsing:
- we were unilaterally decoding MIME bodies as UTF-8; instead, decode according
  to the charset data in the mimepart header
- '7bit' content-transfer-encoding means us-ascii, NOT utf-7
- only interpret valid content-transfer-encodings (previously we were trying
  to treat various charsets as transfer-encodings)
- clearer naming: s/values/parsedMessage/
- unify snippet cleanup between plaintext & stripped HTML (merging
  whitespace etc.)

Test Plan: units tests coming

Reviewers: juan

Differential Revision: https://phab.nylas.com/D3491
2016-12-09 11:01:04 -08:00
Jackie Luo 162dbbd141 fix(error): Treat error as object, not string 2016-12-08 18:32:23 -08:00
Jackie Luo 4a11bfe977 fix(message-factory): Unlink circular dependency 2016-12-08 18:10:17 -08:00
Jackie Luo 6e111c073a fix(message-ids): Use correct hashing for headers 2016-12-08 17:55:39 -08:00
Jackie Luo fae855f0fe feat(message-ids): Hash message IDs and replace in draft before sending 2016-12-08 17:48:34 -08:00
Evan Morikawa 947eb99b8d [local-sync] fix builds. Routes with trailing slash and main extension 2016-12-08 14:17:42 -08:00
Jackie Luo 7a763b604e feat(tracking): Add routes for open and link tracking 2016-12-08 13:38:29 -08:00
Juan Tejada 1ba56c5c05 [local-sync] Fix lint error 2016-12-08 10:28:29 -08:00
Evan Morikawa 2f786a8e91 [local-sync] fix delta sync not getting threads with updated labels 2016-12-07 17:47:49 -08:00
Evan Morikawa d161a30a34 [local-sync] Add global dbs and cleanup orphan messages 2016-12-07 16:39:01 -08:00
Juan Tejada 878735f52e [local-sync] Add todos 2016-12-07 16:16:45 -08:00
Juan Tejada a185a8a5fe [local-sync] Fix file/contact creation
We were getting sql unique constraint violation errors for ids because
we were attempting to create objects with the same id within the same
transaction.

This commit ensures that only attempt to write a contact with the same
id once, and that we check for all exsiting contacts before hand.

For file, we ensure that we don't attempt to write 2 files with the same
id more than once
2016-12-07 14:48:57 -08:00
Halla Moore 56f8d41b8c [local-sync] feat(send): Add support for attachments
Also move some helper function logic onto the Message model
2016-12-07 14:16:36 -08:00
Juan Tejada 8307976df8 [local-sync]: Fix label/folder id creation
We were using the stripped version of label/folder names for the id
hash, e.g. [Gmail]/Drafts would be Drafts.
However, we can't do this because it might collide with other names. e.g. if the
user created a Drafts label, it would end up colliding with [Gmail]/Drafts

Minor lint fix
2016-12-07 13:39:41 -08:00
Evan Morikawa edbf869ff7 [isomorphic-core] add more auth error states 2016-12-07 10:10:49 -08:00
Christine Spang a23c68092e [local-sync] Add specs for message parsing
Summary:
This commit also fixes snippets for HTML-only messages to strip out HTML
tags, and makes us preserve whitespace for plaintext emails by
displaying them in <pre class="nylas-plaintext"> tags, and makes us log
messages that fail to parse at all to a tempdir.

The only issue I found with using <pre> tags for plaintext email was
that some lines may trigger scrolling, so there is an associated commit
(D3484) that changes the CSS for <pre class="nylas-plaintext"> to wrap
lines.

In the future, we can add regression tests to this test suite whenever
we fix parsing bugs.

Test Plan: unit tests included

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D3483
2016-12-07 07:25:28 -08:00
Ben Gotow c3bd3dc297 [local-sync] Don’t update contacts if name is the same 2016-12-06 17:51:12 -08:00
Evan Morikawa 6ac46d1079 remove console log 2016-12-06 17:20:43 -08:00
Evan Morikawa 7e485228af [cloud-api] fix param names 2016-12-06 16:03:31 -08:00
Evan Morikawa 83ef47d049 [*] package.json updates from lerna 2016-12-06 16:03:31 -08:00
Evan Morikawa 8cbda7505a [*] fix auth 2016-12-06 16:03:31 -08:00
Evan Morikawa 2cbb90bb3b [*] DRY Auth 2016-12-06 16:03:31 -08:00
Evan Morikawa 896f981408 [isomorphic-core] extract AuthHelpers to DRY 2016-12-06 16:03:31 -08:00
Juan Tejada 7468e8123e [local-sync] Update DeleteSentMessage task for ordering 2016-12-06 15:54:45 -08:00
Juan Tejada fda7fe18cc [local-sync] Ensure order correct order when running syncback requests
When running syncback requests, if a task is meant to change the UID of
a message (e.g. move it to a new folder), that task should be run after
other tasks that don't affect the UID. Otherwise, when trying to run the
other tasks, they would reference a UID that is no longer valid.

This commit will make sure that we run any tasks that will change message uids last,
/and/ make sure that we don't run more than 1 task that will affect the uids of
the same messages in a row (i.e. without running a sync loop in between)
2016-12-06 15:45:34 -08:00
Halla Moore e785d73bdc [local-sync, iso-core] feat(send): add finishing touches to gmail multi-send
Delete the sent messages that gmail automatically creates and save our
generic form of the draft as a sent message.
2016-12-06 11:37:47 -08:00
Juan Tejada 1a24840062 [local-sync] Correctly sync folders and labels
This commit will correctly keep track of folder and label ids when
creating them from N1.

Previously, when we sent the request to create a folder or label to our api,
we would immediately get back a serverId because it was created optimistically
in the back end— given that K2 is strictly non-optimistic, we won’t have a serverId
until some undetermined time in the future, and we need to somehow reference
the object that /was/ optimistically created in N1 to update the ui when
we do get the server id.

Since we can deterministically generate ids for folders and labels,
we "guess" what its going to be, and include it in the props of the syncback request
returned to N1. This is the simplest solution to get thing working
correctly right now, but we’ll need to revisit this in the future for
other types of objects (drafts, contacts, events), and revisit how we
will manage optimistic updates in N1 when we merge the 2 codebases
with K2 (given that K2 was designed to be non-optimisitc).
2016-12-05 18:56:36 -08:00
Ben Gotow aed1d59916 [local-sync] fix(folder-list): Support children when parent has no attribs 2016-12-05 16:20:17 -08:00
Ben Gotow 1e3b346c94 [local-sync] feat(specs): Add basic tests for folder sync 2016-12-05 16:07:49 -08:00
Karim Hamidou 04b1763965 [fix] Fix transaction creation for contacts
Summary:
Fixes T7283. We weren't creating deltas for contacts because we were inserting contacts using `UPSERT`, which requires us to add another sequelize hook.  Unfortunately, support for this hook is only available on sequelize 4.x.

I didn't want to upgrade our sequelize version right now and cause of bunch of mysterious failures, so I've simply changed the `UPSERT` to be either an `INSERT`or `UPDATE`. We didn't really need it anyway.

Test Plan: Checked that N1 was receiving contact deltas.

Reviewers: bengotow

Reviewed By: bengotow

Maniphest Tasks: T7283

Differential Revision: https://phab.nylas.com/D3481
2016-12-05 15:37:17 -08:00
Ben Gotow 269d61171a [local-sync] fix(specs): New specs for threading 2016-12-05 15:00:37 -08:00
Halla Moore 63032a2449 [local-sync] Fix(send): change some validation fields for multi-send 2016-12-05 12:55:56 -08:00
Ben Gotow 30c8bedd7a [local-sync] fix(specs): run npm test in local-sync dir 2016-12-05 12:16:53 -08:00
Ben Gotow 017e22c88d [*] Allow zero elements in the replyTo field 2016-12-05 09:57:47 -08:00
Halla Moore 6a51036e48 [local-sync, iso-core, cloud-core] feat(send): add multi-send support
Also renames JSONType() -> buildJSONColumnOptions() and
JSONARRAYType() -> buildJSONARRAYColumnOptions() to prevent passing
those return values in as just the type value instead of the entire
options object.
2016-12-02 15:20:31 -08:00
Evan Morikawa 2ba326dfc6 [local-sync] only enable logging in dev mode of N1 2016-12-02 17:34:05 -05:00
Christine Spang 9752eea9f7 [local-sync] Set thread IDs to the ID of a message in the thread
Since message IDs are now static but there's no good way to generate
static thread IDs while syncing an account from newest message first,
we give threads the ID of any message on that thread and, when setting
metadata, look up the local thread ID by first going through the
message table.
2016-12-02 14:13:47 -08:00
Evan Morikawa d9f3edad0f [isomorphic-core] ignore folder deltas due to just syncState version issues 2016-12-02 16:25:42 -05:00
Evan Morikawa b06566d8bd [local-sync] make syncbackRequest objects N1-ready 2016-12-02 16:14:42 -05:00
Juan Tejada b36f61812d [local-sync]: Don't create or sync \NonExistent or \NoSelect folders 2016-12-02 12:14:09 -08:00
Juan Tejada f1491fa4cc fix observable disposable 2016-12-02 12:09:35 -08:00
Juan Tejada 5ac3fe9ea8 [local-sync] Fix starred role on folders 2016-12-02 12:07:21 -08:00
Ben Gotow 5ff7a92197 [*] fix(deltas): 0 as first cursor, deltas from redis are already JSON 2016-12-01 18:54:26 -08:00
Ben Gotow 7712269402 [*] fix(deltas): Cloud-API not filtering deltas at all, refactor a few things
- Don’t need functions in delta.js which must be called to return promsies. Fun of promsies is that you don’t need to care when they’re built to attach a .then.

- Make boundary between route handler and delta stream builder more explicit, don’t do query parsing in helpers, always reply from handler.

- Remove pushJSON extension to outputStream which never actually received JSON.

- Remove `takeUntil` - disposing of the downstream observable should dispose of all the merged/upstream observables

- Rename inflate => stringify since the returned value is a string not an object.

- Remove support for delta streams with no cursors. Don’t think this was supposed to be a feature.

- Add accountId to Transaction models

- Make database hooks shared in isomorphic core
2016-12-01 18:41:46 -08:00
Karim Hamidou 15cfe2cec0 Strip the '[Gmail]/' prefix from folder names.
Summary:
T7253 has two related parts:
1. Stripping the '[Gmail]/' prefix from any canonical Gmail folders
2. Handling nested IMAP folders.

This diff fixes 1. Changes for 2. are forthcoming.

Test Plan: Tested manually. Checked that the part was stripped from the N1 folder list.

Reviewers: juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3475
2016-12-01 16:49:09 -08:00
Juan Tejada d650be5429 [local-sync] Refactor tasks and /actually/ fix moving between Gmail folders
Moving to between gmail folders (all, spam, trash) or moving to inbox,
involves changing labels /and/ folders, simultaneously. For this I added
a task to perform both operations, and apply labels first before
attempting to move the folder
2016-12-01 16:37:49 -08:00
Ben Gotow 4b4ab726e2 [💄] fix eslint issues before they get overwhelming 2016-12-01 15:37:48 -08:00
Karim Hamidou aa49f85980 Fix bug where we wouldn't create an id for file parts. 2016-12-01 15:30:01 -08:00
Juan Tejada 2d932dd090 [*] Generate persistent id for Accounts based on email+settings
This also ensures that we can use the accountId as part of the ids for
other models, like labels and folders

Before this commit, labels and folders with the same name for different
accounts would have the same id, screwing things up in n1
2016-12-01 14:51:33 -08:00
Ben Gotow 47d8614ed7 [local-sync] Ship first sync metrics to honeycomb 2016-12-01 14:23:52 -08:00
Juan Tejada ce27b0db2a [local-sync] Fix setlabels task
Make sure we /remove/ the labels when we get an empty set of label ids
2016-12-01 14:03:19 -08:00
Evan Morikawa aba77ca637 [cloud-api] add npm start for pm2 launch 2016-12-01 16:33:05 -05:00
Juan Tejada b43be69cd3 [local-sync] Give better name to thread folders task 2016-12-01 13:30:47 -08:00
Juan Tejada 8939364dc3 [local-sync]: Add distinct ids to folders and labels 2016-12-01 11:57:29 -08:00
Ben Gotow 209122c346 [cloud-api] Fix more broken package.jsons 2016-12-01 11:39:25 -08:00
Karim Hamidou 47e0683cac First step to getting persistent id in K2
Summary:
This diff adds persistent unique ids for messages and contacts. For messages, we just take a hash of the headers. For contacts, we hash the contact's email address.

This diff bundles a couple of tiny fixes too, like always trying to restart an account's sync, even after an exception.

Note that since there's no reliable way to have persistent ids for threads, we'll have to change our code to use message ids instead. Alas, that's a story for another (massive) diff.

Test Plan: Tested manually.

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D3468
2016-12-01 11:15:13 -08:00
Ben Gotow 3d79f9b8be [local-sync] Run message processor for one message at a time
This avoids issues that arise when we process two messages on the same thread concurrently!
2016-11-30 17:26:23 -08:00
Ben Gotow 94722f27ab [local-sync] Fix “Add INBOX label” issue 2016-11-30 16:26:53 -08:00
Ben Gotow d8703b90c4 [local-sync] Fix deletion of labels 2016-11-30 16:26:53 -08:00
Ben Gotow bf9db2738c [local-sync] Fix ingestion of flags and labels 2016-11-30 16:26:53 -08:00
Ben Gotow 935d8cf141 [local-sync] Fix transaction log to only ignore syncState 2016-11-30 16:25:28 -08:00
Ben Gotow 2476cae297 [local-sync] Sync a bit faster for testing 2016-11-30 16:25:28 -08:00
Juan Tejada 1470565bcf [local-sync] Fix observable for deltas
We were missing a return :'(
2016-11-30 16:12:35 -08:00
Ben Gotow 1e01878e5a fix(sync): Fix attribute updates applying to threads 2016-11-30 13:55:49 -08:00
Evan Morikawa a36b1e1f28 [*] add delta endpoints and DRY deltaStreamBuilder
[cloud-core] add objectType to Metadata

[*] binding fixes to delta stream
2016-11-30 13:41:09 -05:00
Juan Tejada a37b90a209 [local-sync] Remove unecessary db queries in detect-thread 2016-11-30 10:17:59 -08:00
Ben Gotow ece519553f fix(sync): Issue with CONDSTORE args not passed to fetch 2016-11-29 18:02:25 -08:00
Ben Gotow 82f505b659 refactor(sync-worker): Convert IMAP operations to async/await 2016-11-29 17:04:01 -08:00
Ben Gotow fb9d770cc6 refactor(sync-worker) async/await for Karim 2016-11-29 16:20:18 -08:00
Ben Gotow 0c79ebb86a [local-sync] Synchronize K2 accounts with N1 accounts 2016-11-29 16:07:33 -08:00
Karim Hamidou 0879b6390e Make db reset synchronous. 2016-11-29 15:13:42 -08:00
Juan Tejada 20be7cc513 [local-sync] properly save folders when detecting thread 2016-11-29 15:04:45 -08:00
Karim Hamidou ac818f30fe Add a shortcut to restart the sync for an account from scratch. 2016-11-29 14:59:37 -08:00
Ben Gotow 48fff4f4e1 fix(dashboard): Remove sync policy 2016-11-29 14:58:52 -08:00
Juan Tejada b459076415 [local-sync] minor fix 2016-11-29 12:52:36 -08:00
Juan Tejada b7b0808689 [local-sync]: Load all db models 2016-11-29 12:38:49 -08:00
Juan Tejada 2fe5f73401 [iso-core] Fix dependencyin model 2016-11-29 11:56:00 -08:00
Juan Tejada a9be3bb3ed [local-sync]: Refactor message ingestion to write new messages only once
This will only generate 1 delta per new message instead of 2
Adds a MessageFactory to create messages from imapmessage objects, and
unifies and cleans up that logic
Also modified the message-processor to be more suited for local sync,
made emphasis that it's only for processing new messages, and got rid of
the while "pipeline" concept

- TODO message-processor specs are broken
2016-11-29 11:24:27 -08:00
Evan Morikawa fc24ffea63 [isomorphic-core]: move Transaction model to isomorphic-core 2016-11-29 13:57:19 -05:00
Ben Gotow f804c53522 [dashboard] Put dashboard into work window 2016-11-28 18:02:42 -08:00
Halla Moore 10f62f6b5a [local-sync, iso-core] feat(send): Support basic sending for gmail accounts 2016-11-28 14:46:31 -08:00
Ben Gotow 217ba1e020 [sync]: Sync again immediately if more emails remain 2016-11-28 12:00:57 -08:00
Juan Tejada f9b6e63958 [local-sync] Support parsing 8bit encoded messages 2016-11-28 11:41:16 -08:00
Evan Morikawa 048e077cc5 [local-sync] retry sync after error 2016-11-28 10:39:23 -08:00
Evan Morikawa 2c0c6164ec [local-sync] print sync error when in error state 2016-11-28 10:37:04 -08:00
Juan Tejada 64cb03f4cd Move non shared-models to local sync / remove duplicate DatabaseTypes 2016-11-26 12:48:48 -08:00
Ben Gotow 4bbfd6b906 fix(storage): Move to ~/.nylas-k2 2016-11-23 17:08:38 -08:00
Ben Gotow 5c37abc578 [n1] fix(sync): Add support for message encodings 2016-11-23 17:07:09 -08:00
Ben Gotow dd28d6b146 [n1] fix(api): Add support for messages?thread_id=1 2016-11-23 16:25:45 -08:00
Ben Gotow 42e20f106c fix(account): 2016-11-23 15:47:49 -08:00
Ben Gotow cfb1356be6 fix(account): Include name 2016-11-23 15:24:41 -08:00
Ben Gotow e7386ff4ae Gmail auth: resolved settings tests 2016-11-23 15:23:46 -08:00
Ben Gotow 30a94a6c9b [cloud] Store resolved settings for returning to client 2016-11-23 14:51:39 -08:00
Juan Tejada 3f050ea150 fix dangling paren 2016-11-23 14:26:24 -08:00
Juan Tejada f0caf042bd [local-sync]: Restore message-processor
Don't use pubsub for scheduling a message for processing, just use
nextTick
2016-11-23 14:25:15 -08:00
Evan Morikawa 78b96d24ca [local-sync] fix promise instance of check 2016-11-23 14:22:38 -08:00
Evan Morikawa 931943bea6 [local-sync] fix unnecessary transaction JSON parse and binding issue 2016-11-23 13:43:00 -08:00
Juan Tejada f45425a7b6 [local-sync] Remove unused message-types 2016-11-23 13:30:51 -08:00
Karim Hamidou 43030789a8 Make the delta stream work
Also replaces our LocalPubsubConnector by a TransactionConnector which
just uses EventEmitter.
2016-11-23 13:08:59 -08:00
Evan Morikawa 60801262c7 [local-sync] return as auth_token instead of token for N1 2016-11-23 12:35:48 -08:00
Juan Tejada f98c38fef4 [iso-core]: Make loadModels reusable by cloud-core 2016-11-23 12:16:58 -08:00
Evan Morikawa eacbb99f15 rearrange logging so message comes first in console 2016-11-23 12:01:47 -08:00
Karim Hamidou c05bc8ee63 Remove redis dependency
Conflicts:
	packages/local-sync/src/local-sync-worker/sync-process-manager.js
2016-11-23 11:50:13 -08:00
Juan Tejada f2a032c87c [iso-core]: Update api for loadModels 2016-11-23 11:49:32 -08:00
Evan Morikawa edd49c0f4a Use 2578 as port on example 2016-11-23 11:48:48 -08:00
Evan Morikawa 0243edeee3 [local-sync] Remove Gmail auth from local-sync 2016-11-23 11:07:04 -08:00
Juan Tejada 53a1f6e824 [local-sync]: Properly remove all refs to global.Metrics 2016-11-23 11:01:48 -08:00
Juan Tejada 654260b1a5 [iso-core] Use sequelize.import now that eval is enabled 2016-11-23 11:01:29 -08:00
Evan Morikawa 9707092cc9 Add logger fallback 2016-11-23 10:53:02 -08:00
Karim Hamidou ba58409f2c Fix module loading bug
Conflicts:
	packages/isomorphic-core/src/models/index.js
	packages/local-sync/package.json
2016-11-23 10:51:03 -08:00
Juan Tejada dcb78302b8 fix loadModels 2016-11-23 10:32:46 -08:00
Evan Morikawa 2cce4e0d7d Add sqlite3 since sequelize can't use better-sqlite3 2016-11-23 10:32:07 -08:00
Evan Morikawa 4eacd22846 Fix JSON parsing error 2016-11-23 10:19:35 -08:00
Evan Morikawa ae42c37606 Add better-sqlite3 2016-11-23 10:18:47 -08:00
Juan Tejada 5b7214e464 [local-sync]: Let local-sync start, add loadModels to iso-core 2016-11-23 10:18:35 -08:00
Evan Morikawa 3fac21458c Update local port to 2578 2016-11-23 10:12:02 -08:00
Evan Morikawa cd65135feb [isomorphic-core] add trailing ./ 2016-11-23 09:34:38 -08:00
Evan Morikawa 0793e97f33 [*] package.json updates post lerna bootstrap 2016-11-23 09:33:54 -08:00
Evan Morikawa 1112d3bccd [local-sync] update package.json to include missing deps 2016-11-23 09:27:41 -08:00
Evan Morikawa c3cca9f518 [isomorphic-core] Remove packages no longer used in isomorphic-core 2016-11-23 09:12:59 -08:00
Evan Morikawa b5bf4e07c4 [isomorphic-core] Move files into src folder for isomorphic-core 2016-11-23 09:12:54 -08:00
Evan Morikawa 21977a25ca [isomorphic-core] Rename nylas-core -> isomorphic-core 2016-11-23 09:12:50 -08:00
Evan Morikawa d01b4ffe77 [isomorphic-core] Uppdate refs nylas-core => isomorphic-core 2016-11-23 09:12:45 -08:00
Juan Tejada 814e014e39 Final nylas-core and cloud-core cleanup
- Remove unused exported PromiseUtils from cloud-core, import instead
from nylas-core where needed
- Remove unused MessageTypes from cloud-core
- Move MessageTypes from nylas-core to local-sync. It's completely
isolated to local-sync
2016-11-22 20:36:38 -08:00
Juan Tejada 3b7c40a870 [local-sync] Misc fixes from database-connector move 2016-11-22 20:25:43 -08:00
Juan Tejada 792ed2bb5c local[sync] Move missing file for local-syncs database-connector 2016-11-22 20:18:19 -08:00
Juan Tejada 0a24c01b5a [local-sync] fix path for local pubsub-connector 2016-11-22 20:13:35 -08:00
Juan Tejada 957ba73bd0 [local-sync] Make local logger es6 for compilation 2016-11-22 20:10:54 -08:00
Juan Tejada 296846adf5 [local-sync] Remove logger and metrics from local-sync and nylas-core 2016-11-22 20:07:11 -08:00
Evan Morikawa 3ff98f45a9 Rename generic Errors to IMAPErrors 2016-11-22 18:24:46 -08:00
Evan Morikawa 65fafc0390 Move SyncPolicy out of nylas-core to DefaultSyncPolicy 2016-11-22 18:20:34 -08:00
Evan Morikawa 106d7e57a1 Rename DatabaseConnector to LocalDatabaseConnector and move 2016-11-22 17:51:43 -08:00
Evan Morikawa 2b1c787eec Move PubSubConnector to LocalPubSubConnector out of nylas-core 2016-11-22 17:51:43 -08:00
Evan Morikawa c019e9a23b Move SchedulerUtils out of nylas-core to local-sync/src/shared 2016-11-22 17:07:48 -08:00
Juan Tejada 008a294242 fix(deps) Fix deps for local-sync and nylas-core 2016-11-22 16:55:08 -08:00
Evan Morikawa 951feae657 [local-sync]: moved spec into similarly named folder and updated refs 2016-11-22 16:08:10 -08:00
Evan Morikawa 9e867fa4fd [local-sync]: move folders into src folder 2016-11-22 16:03:38 -08:00
Ben Gotow 18c0ff40ba [cloud] fix(*): More misplaced packages 2016-11-22 15:40:18 -08:00
Evan Morikawa 25cca505b7 Moved cloud-metrics into cloud-core 2016-11-22 15:34:00 -08:00
Evan Morikawa e772e11196 [local]: rename folder nylas-api to local-api 2016-11-22 15:34:00 -08:00
Halla Moore 845139826b [local-sync] Check for missing Category roles by localized display names
Sometimes imap mailboxes aren't properly flagged with their roles, so we
check the display names against known variations to see if we can find any
missing roles.
2016-11-22 15:31:35 -08:00
Juan Tejada 5e42a7dd9e Merge branch 'master' of github.com:nylas/K2 2016-11-22 15:16:00 -08:00
Ben Gotow 1ec3c2e162 [cloud] fix(*): remove all traces of loggly 2016-11-22 15:13:48 -08:00
Juan Tejada 637d3ac6cc fix local-sync package 2016-11-22 15:13:28 -08:00
Evan Morikawa d4608dd3a6 Update package.json post lerna install 2016-11-22 14:52:42 -08:00
Karim Hamidou 372beeef52 More structure adapts.
Conflicts:
	packages/local-sync/package.json
2016-11-22 14:26:48 -08:00
Karim Hamidou 4d91dcd3a3 Basic structure changes to run K2 in N1 2016-11-22 14:23:16 -08:00
Ben Gotow 424ee4e1d2 [local] Fix package json 2016-11-22 13:55:04 -08:00
Karim Hamidou 0c5dd6ded7 Flesh out skeleton. 2016-11-22 12:25:27 -08:00
Juan Tejada ddd5641463 fix(folders): Properly update thread folders on sync 2016-11-22 12:24:13 -08:00
Karim Hamidou 3d31150bbb (fix) Set up base structure for local sync. 2016-11-22 12:01:45 -08:00
Ben Gotow 27ba2544dd Pull in cloud packages 2016-11-22 10:58:27 -08:00
Juan Tejada f2dbb2144b feat(labels): Add functioning endpoint for updating labels for messages & threads
- This commit also correctly sets the labels on the corresponding thread
whenever a message has its labels updated
- Fix removing labels from messages
2016-11-22 09:58:41 -08:00
Juan Tejada 45d682c957 feat(api): Can now set labels for messages 2016-11-21 17:41:57 -08:00
Evan Morikawa 1b1d356753 fix(package): re-order package.json files 2016-11-21 17:07:52 -08:00
Juan Tejada eba33080ac fix(messages): Fix raw message api endpoint 2016-11-21 14:36:54 -08:00
Ben Gotow 8efd4f7935 Fix another linter issue 2016-11-21 14:05:38 -08:00
Ben Gotow e87e67cea3 Fix linter issues 2016-11-21 14:00:35 -08:00
Halla Moore 7906e3303d Add placeholders for various routes that N1 uses. 2016-11-21 13:50:34 -08:00
Halla Moore 0fe6343137 Remove filtering from the collection APIs.
Affected collections were categories, contacts, files, messages, and threads.
2016-11-21 13:50:29 -08:00
Ben Gotow e10e51ab5d A few changes to support linking to K2 via the new GUI 2016-10-11 00:44:10 -07:00
Ben Gotow f9f78968b1 Use defaultValue as a template, fix critical sync issue 2016-07-15 19:01:50 -07:00
Ben Gotow 549ced6128 Revert change, @evan’s fix is better 2016-07-15 16:28:13 -07:00
Ben Gotow 18a8e5f09a Merge branch 'master' of ssh://github.com/nylas/k2 2016-07-15 16:25:21 -07:00
Ben Gotow 7efe5db7e9 USE_CONSOLE_LOG for simple console logs 2016-07-15 16:25:18 -07:00
Halla Moore 8140076e17 Remove auto-scaling for the collapsed dashboard view, at least for now. 2016-07-15 16:09:17 -07:00
Ben Gotow 5095f0626f Merge branch 'master' of ssh://github.com/nylas/k2 2016-07-15 13:29:25 -07:00
Halla Moore 0dad9bf7fa Auto-scale MiniAccounts in the collapsed, ungrouped dashboard view 2016-07-15 13:20:09 -07:00
Evan Morikawa dffb87bd4a Report errors earlier 2016-07-15 13:15:26 -07:00
Evan Morikawa 5e0bcc5eff Quieter logging on dev 2016-07-15 13:07:12 -07:00
Ben Gotow e13097045b Log boxname and category name as well 2016-07-15 12:39:28 -07:00
Halla Moore 0abd70c746 Add option to group by process in collapsed dashboard view 2016-07-15 12:31:07 -07:00
Ben Gotow 579fe43fdf Log when recovering from uidvalidity, don’t do it on first sync 2016-07-15 11:47:26 -07:00
Ben Gotow 95793877c6 Do file creation in a transaction, and with fewer saves 2016-07-15 11:14:35 -07:00
Ben Gotow e5bada04d3 Do contact insertion in a transaction 2016-07-15 10:23:01 -07:00
Ben Gotow 979401883d Make db connection pools smaller 2016-07-15 10:22:49 -07:00
Ben Gotow ac3f96e2d4 Fix accounts syncing in a hard loop due to redis loopback 2016-07-15 10:07:33 -07:00
Ben Gotow 13a723e663 Correctly detect condstore to lower db load 2016-07-15 09:46:31 -07:00
Ben Gotow 13879db9c8 Wait until tables are created before queueing sync 2016-07-14 19:32:13 -07:00
Ben Gotow 08c7ca8b0d Use EC2 instance ID instead of hostname 2016-07-14 18:52:30 -07:00
Ben Gotow 5062f8d02b Sort process ids 2016-07-14 18:33:46 -07:00
Ben Gotow 1996666516 Merge branch 'master' of ssh://github.com/nylas/k2 2016-07-14 18:18:54 -07:00
Ben Gotow daaa67818d Add missing unique indexes, only create tables when authing account 2016-07-14 18:18:48 -07:00
Halla Moore 6e2ae25519 Add a sum line to the dashboard's process load counts 2016-07-14 18:01:52 -07:00
Evan Morikawa 45f132b746 Fix thread moving to support new Promises 2016-07-14 17:37:38 -07:00
Ben Gotow a229ba1a90 Sort process entries on the dashboard 2016-07-14 17:34:33 -07:00
Ben Gotow 1ce7787632 Disable sequelize logging 2016-07-14 17:21:21 -07:00
Ben Gotow 1d08faece3 Fixes to still support sqlite 2016-07-14 17:21:02 -07:00
Ben Gotow 2f3ca2a906 Merge branch 'master' of ssh://github.com/nylas/k2
# Conflicts:
#	packages/nylas-core/hook-transaction-log.js
#	packages/nylas-core/models/account/transaction.js
2016-07-14 17:17:22 -07:00
Ben Gotow de3151cab4 Move to single database with many tables for accts 2016-07-14 17:14:16 -07:00
Evan Morikawa 1eef4c3428 Remove logs and rename variables 2016-07-14 16:36:13 -07:00
Annie 5b3f5c8a91 fixed thread syncing 2016-07-14 16:28:09 -07:00
Ben Gotow ea497f7ea2 A few changes for upcoming db refactoring 2016-07-14 15:48:48 -07:00
Halla Moore b14d5f7e8d Add process load counts to the dashboard 2016-07-14 14:51:54 -07:00
Juan Tejada 099e200ec5 Only log sync errors if they are permanent errors 2016-07-14 13:44:43 -07:00
Juan Tejada 37b2323cc7 Add metric for sync errors 2016-07-14 12:00:05 -07:00
Evan Morikawa 0921df432b Uses default from address 2016-07-14 11:40:46 -07:00
Evan Morikawa 6ce54c2a34 Add send endpoint 2016-07-14 11:34:30 -07:00
Juan Tejada b58c11605c Moves metrics into its own pkg to be able to instrument other services
- With the Metrics module inside nylas-core, and bc of our current lerna
setup, we required other modules like sequelize and redis before requiring
newrelic, thus preventing them from being properly instrumented
2016-07-14 11:20:58 -07:00
Juan Tejada 592b2af986 Update metric type for accounts_syncing_count 2016-07-14 10:49:40 -07:00
Juan Tejada 16b91ea394 Update metrics with signalfx - report # of syncing accts per host 2016-07-14 10:39:05 -07:00
Juan Tejada 0c900b072d Add new relic to all pkgs + Revert to PromiseUtils methods
- PromiseUtils does not conflict with newrelics changes to Promise
- Other misc fixes
2016-07-13 19:08:24 -07:00
Ben Gotow ec9f8581f7 Merge branch 'master' of ssh://github.com/nylas/k2 2016-07-13 18:26:49 -07:00
Ben Gotow 66951b4b1a Add more logging to process claiming 2016-07-13 18:26:46 -07:00
Annie a07174cc4e fixed json parsing of message 2016-07-13 18:19:13 -07:00
Halla Moore 0706701378 Make the grayAfter time more appropriate for production, 10 mins 2016-07-13 18:00:17 -07:00
Halla Moore 49f475cdd1 Add collapsed dashboard view 2016-07-13 17:45:54 -07:00
Juan Tejada 5c1704ac8e Fix thenReturn + misc logger fixes 2016-07-13 17:41:07 -07:00
Ben Gotow 07e3f3ab19 Make dashboard boxes slightly smaller 2016-07-13 17:34:42 -07:00
Ben Gotow 2a05e69e4c Sort IDs as numbers not strings 2016-07-13 17:25:39 -07:00
Ben Gotow b43b623ca6 Expand promise utils 2016-07-13 17:22:02 -07:00
Juan b60595f0f8 Merge pull request #3 from nylas/remove-bluebird
Remove bluebird
2016-07-13 16:54:21 -07:00
Ben Gotow 35c32a3645 After authing an account, close IMAP connection 2016-07-13 16:42:13 -07:00
Juan Tejada ab9c01a249 Remove bluebird
- Implement `each` and `promisifyAll` + other bluebird fns
2016-07-13 16:35:22 -07:00
Evan Morikawa 87905d0145 Fix transaction log to ignore syncState changes 2016-07-13 16:31:34 -07:00
Halla Moore fcbaac302b Change dashboard error appearances 2016-07-13 16:31:14 -07:00
Halla Moore 971b64b4c2 Add other dashboard optimizations
Fix typo in Account's shouldComponentUpdate method
Consolidate intervals into custom window events
Manually update ElapsedTime contents
2016-07-13 16:31:14 -07:00
Ben Gotow 93942e792d Also conert imap errors in createConnectionPromise 2016-07-13 16:20:43 -07:00
Evan Morikawa 8c33c4976f Better IMAP Error handling 2016-07-13 15:57:59 -07:00
Halla Moore 0b9933b514 Re-render accounts in more scenarios and update onWebsocketConnectedFake 2016-07-13 14:53:56 -07:00
Halla Moore b03b8b537d Optimize dashboard rendering
Add version to local copy of account and only re-render entire account
if the version is different. Create an ElapsedTime component that
re-renders on its own, and update SyncGraph to re-render on its
own as well.
2016-07-13 14:34:27 -07:00
Ben Gotow a5e3ddb445 Merge branch 'master' of ssh://github.com/nylas/k2 2016-07-13 12:39:11 -07:00
Ben Gotow a11ee2987b Change proxy to honor null values, create helper for open box name 2016-07-13 12:39:07 -07:00
Evan Morikawa 3d64affc52 Delta stream adhere to old Nylas spec 2016-07-13 12:37:38 -07:00
Halla Moore f2f6dec35a Add dashboard optimizations
Make account elements absolutely positioned and opaque
Send account updates all at once, at timed intervals
2016-07-13 12:35:49 -07:00
Juan Tejada 7f72ab7f14 Add loggly logging service to test it out
- Adds env to all logs, cleans up code a bit
2016-07-13 11:58:46 -07:00
Ben Gotow ffc2593c4e Log all box attributes to help track down bug 2016-07-13 11:42:34 -07:00
Annie 6e19cd84f5 Added view query param for contact and message routes 2016-07-13 11:37:35 -07:00
Ben Gotow 7056a4b8f4 Fix bug with accounts that have uidmin=0, not 1 2016-07-13 11:30:22 -07:00
Ben Gotow ecc8bd67d3 Clean up dashboard websocket code a bit 2016-07-13 11:11:32 -07:00
Ben Gotow 8629b5a055 New function to stub dashboard view 2016-07-13 10:57:05 -07:00
Ben Gotow ea4d5d0054 Merge branch 'master' of ssh://github.com/nylas/k2 2016-07-12 18:33:33 -07:00
Annie 17f920fb90 Ordered inbox messages chronologically 2016-07-12 18:33:19 -07:00
Ben Gotow eac4f72431 Merge branch 'master' of ssh://github.com/nylas/k2 2016-07-12 18:32:00 -07:00
Ben Gotow e89975456b Fix scenario where sync worker is re-assigned the same account before fully releasing it 2016-07-12 18:31:55 -07:00
Evan Morikawa e658f066dd Change transaction schema to match current API 2016-07-12 18:31:00 -07:00
Halla Moore 1ce430cd2a Add an auto refresh option to the dashboard's syncback requests modal 2016-07-12 18:27:04 -07:00
Halla Moore 8e790a0e15 Spruce up the dashboard
Consloidate modal functionality into its own component and make
general appearance fixes, especially with the Syncback Request
Details.
2016-07-12 18:27:04 -07:00
Ben Gotow 3e8623d383 Move charset definition to single location 2016-07-12 18:03:08 -07:00
Ben Gotow a62e858389 Make charset explicit on connection and models 2016-07-12 17:41:16 -07:00
Ben Gotow efc8d8ba12 Merge branch 'master' of ssh://github.com/nylas/k2 2016-07-12 16:46:17 -07:00
Ben Gotow 562cedf971 Fix sync worker stopping forever on errors 2016-07-12 16:46:14 -07:00
Annie 83a6a8008b Add thread id to message model 2016-07-12 16:27:57 -07:00
Ben Gotow 9d7343eb91 Fix UTF7 reference - prod will not use ssh 2016-07-12 16:24:03 -07:00
Ben Gotow ae082c5b53 Fix support for Gmail accts with non-english folders 2016-07-12 16:12:04 -07:00
Ben Gotow 8b1e9564cf Fix UTF7 support — module didn’t support Node6 2016-07-12 16:11:29 -07:00
Ben Gotow 7d92438d57 Change firstSyncCompletion to string, cast to int for JSON 2016-07-12 15:23:55 -07:00
Ben Gotow dfa16fb5fc Allow firstSyncCompletion to be null 2016-07-12 15:04:12 -07:00
Ben Gotow 84d8979265 Add ability to auth gmail account via /auth 2016-07-12 13:24:48 -07:00
Halla Moore 3e6e5e95b9 Add dashboard functionality to clear sync errors 2016-07-12 12:20:12 -07:00
Ben Gotow 674da27296 Fix flipped errored / ended handlers 2016-07-12 12:15:46 -07:00
Ben Gotow b0a6ec066b Sync non-active accounts more infrequently 2016-07-12 09:53:04 -07:00
Ben Gotow ac627f1580 Remove use of Rx.toPromise(), which wasn't behaving as expected 2016-07-12 01:33:56 -07:00
Ben Gotow b44272621d Misc cleanup, put account ids on dashboard 2016-07-12 00:59:41 -07:00
Ben Gotow 4fb848e91f fix for re-authing the same account 2016-07-11 21:38:05 -07:00
Annie 87091a414a Merge branch 'master' into contacts 2016-07-11 18:30:28 -07:00
Annie c5dce43da7 Merge branch 'master' of github.com:nylas/K2 2016-07-11 18:30:19 -07:00
Annie d575e63ede replaced console logs with new logger 2016-07-11 18:30:08 -07:00
Ben Gotow 73fc371825 Make the graphs on the dashboard retina 💄 2016-07-11 18:24:18 -07:00
Juan Tejada afeb0e7b27 Create one CloudWatch stream per host
- This prevents `InvalidSequenceTokenException` when running in
production with multiple machines in an elastic beanstalk environment
- See
https://github.com/mirkokiefer/bunyan-cloudwatch/issues/1#issuecomment-193116799
2016-07-11 17:57:43 -07:00
Juan Tejada 413a77c323 Log unhandled errors in api and sync 2016-07-11 17:42:49 -07:00
Ben Gotow 74430dd80e Merge branch 'master' of ssh://github.com/nylas/k2 2016-07-11 16:56:27 -07:00
Ben Gotow 492ac21bb6 Primitive account deletion via DELETE /account 2016-07-11 16:56:18 -07:00
Annie caee5dbef0 Merge branch 'master' of github.com:nylas/K2 into contacts 2016-07-11 16:42:15 -07:00
Juan Tejada f8b8dfb87f Revert to running pm2 in no-daemon mode in dev
- Add a stream for pretty logging in dev mode
2016-07-11 16:40:48 -07:00
Annie 1fc30fa810 Merge branch 'master' of github.com:nylas/K2 2016-07-11 16:37:44 -07:00
Annie e673573fcd added folder view api route 2016-07-11 16:37:39 -07:00
Juan Tejada ae51646de6 Comment out new relic for now 2016-07-11 16:33:56 -07:00
Juan Tejada 2dc31cb576 Add number of syncing accounts to sync process manager heartbeat 2016-07-11 16:24:48 -07:00
Ben Gotow 8e0cd92bad Require a logger when instantiating a connection 2016-07-11 16:02:53 -07:00
Ben Gotow 06d31b4d49 Merge branch 'master' of ssh://github.com/nylas/k2 2016-07-11 16:01:22 -07:00
Ben Gotow 3c63268eec Return a new token for existing account instead of duplicating accounts 2016-07-11 16:01:18 -07:00
Juan Tejada 960dbdeb8f Update logger for sync process manager
- Log identity data always
2016-07-11 15:40:36 -07:00
Ben Gotow 5085730902 Merge pull request #1 from nylas/contacts
Build(contacts): built contact model, added routes and processor
2016-07-11 15:22:04 -07:00
Halla Moore 04ab0d9034 Change firstSyncCompletedAt to firstSyncCompletion, now explicitly 14 bytes. 2016-07-11 14:23:46 -07:00
Halla Moore 0860f3027c Fix two small errors 2016-07-11 14:23:46 -07:00
Evan Morikawa 1360599ffc Fix deafult test account email address 2016-07-11 14:23:35 -07:00
Juan Tejada b7301f5dc5 Fix more error handling in sync worker 2016-07-11 14:10:30 -07:00
Annie 5868fb5207 make changes requested before pull 2016-07-11 13:48:00 -07:00
Juan Tejada 6ff596b5a7 Properly log uncaight errors in sync worker 2016-07-11 13:46:50 -07:00
Halla Moore 877a6bf612 Add SyncbackRequest details to dashboard 2016-07-11 12:57:18 -07:00
Juan Tejada 1c4434c136 Re-emit error events on bunyan log streams 2016-07-11 12:12:38 -07:00
Juan Tejada 98c17c9780 Fix api logger decorator 2016-07-11 11:47:42 -07:00
Juan Tejada 600245ebcb Fix cloudwatch config 2016-07-11 11:28:53 -07:00
Ben Gotow 4ce68e3dd4 Merge branch 'master' of ssh://github.com/nylas/k2 2016-07-11 10:56:11 -07:00
Ben Gotow 93189b0f22 Try adding newrelic logging 2016-07-11 10:56:08 -07:00
Juan Tejada dce872fac8 Adds bunyan for json logging on every package!
- Bunyan logs json output, and added a stream to send our logs to
cloudwatch
- Replaces /all/ instances of console.log. Turned eslint rule back on,
so we don't use console.log ever again.
- Added npm scripts to view pretty logs
2016-07-08 17:30:24 -07:00
Annie cb20f8cecd resolved merge -- Accounts and contacts are now both added to serilaization 2016-07-08 17:09:57 -07:00
Annie 2a776e6cff Build(contacts): built contact model, added routes and processor 2016-07-08 17:06:21 -07:00
Ben Gotow 14b5bef0a7 Fix error handling on connection close 2016-07-08 16:59:00 -07:00
Ben Gotow 016bad67b9 Temporarily patch /account to not check schema 2016-07-08 16:53:01 -07:00
Ben Gotow 26ac02e0bf Merge branch 'master' of ssh://github.com/nylas/k2 2016-07-08 15:36:56 -07:00
Ben Gotow 8c122a57a3 Stop syncing in a hard loop 2016-07-08 15:36:50 -07:00
Evan Morikawa ab8f1b4fbf Silent transactions if only syncState changes 2016-07-08 18:33:37 -04:00
Ben Gotow 53a2e7e56b Add ping to dashboard, wait to get shared db 2016-07-08 14:55:12 -07:00
Ben Gotow 3e348252ab Fix issue with default values — just implement in getters 2016-07-08 14:41:53 -07:00
Ben Gotow 17df581105 Use TEXT vs STRING, specify string column lengths 2016-07-08 13:49:51 -07:00
Evan Morikawa 1ff61beec9 package json fixed 2016-07-07 16:08:19 -07:00
Evan Morikawa 0972592aa5 Add ports to pm2-dev 2016-07-07 16:05:44 -07:00
Ben Gotow 0bfa8023f2 Merge branch 'master' of ssh://github.com/nylas/k2
Conflicts:
	Dockerfile
2016-07-07 15:27:56 -07:00
Ben Gotow 63f66fb7e7 Switch to PM2 for dev + prod 2016-07-07 15:25:45 -07:00
Halla Moore a71e5c6a63 Merge branch 'master' of github.com:nylas/k2 2016-07-07 14:31:08 -07:00
Halla Moore 2db11d7dec Enhance sync stats on dashboard 2016-07-07 14:30:51 -07:00
Evan Morikawa 3820521d62 Dockerfile successfully building ping endpoint 2016-07-07 12:10:01 -07:00
Ben Gotow 822b8e54e6 Allow usage with mysql in addition to SQLite 2016-07-07 11:37:55 -07:00
Halla Moore 40ab07cfdf Add account filtering (by error status) to dashboard 2016-07-06 16:49:16 -07:00
Halla Moore 44e377eb80 Merge branch 'master' of github.com:nylas/k2 2016-07-06 15:48:47 -07:00
Halla Moore 12560ab711 Add ability to apply a sync policy to all accounts from dashboard 2016-07-06 15:48:25 -07:00
Evan Morikawa 2e4427d96e Add console to ping 2016-07-06 14:59:56 -07:00
Halla Moore 3bfc5aff60 Merge branch 'master' of github.com:nylas/k2 2016-07-05 15:45:18 -07:00
Halla Moore 9c342c0c77 Add ability to edit sync policy from dashboard 2016-07-05 15:41:56 -07:00
Evan Morikawa e2e827297c Add authless /ping endpoint that returns "pong" 2016-07-05 14:09:44 -07:00
Juan Tejada 8b1f012a3c Fix error serialization
- Remove cumbersome NylasError
- Add helper to serialize error when saving to account
2016-07-01 15:49:47 -07:00
Ben Gotow a43b3fb015 Merge branch 'master' of ssh://github.com/nylas/k2 2016-07-01 15:41:29 -07:00
Ben Gotow 8453985b1f Change worker removal so it waits for sync to complete 2016-07-01 15:41:22 -07:00
Jackie Luo 81145eae32 Change error styling 2016-07-01 13:24:08 -07:00
Jackie Luo 0af1a43794 Add first sync completion time 2016-07-01 13:15:55 -07:00
Ben Gotow 3ccb7f164b Fix closing connection twice 2016-07-01 11:36:14 -07:00
Evan Morikawa fd0c4d734c Fix delta sync to properly includes sub models 2016-07-01 11:27:20 -07:00
Juan Tejada 05091a4447 Update thrown errors to use serializable NylasError 2016-07-01 10:24:39 -07:00
Juan Tejada 80f9ff38e3 Remove dead code 2016-07-01 10:19:25 -07:00
Jackie Luo a99ffbce3c Add favicon :snow_capped_mountain: 2016-06-30 17:31:52 -07:00
Jackie Luo 27eba6dfaa Add sync times and update styles 2016-06-30 17:24:25 -07:00
Halla Moore 84ce3bdeb3 Merge branch 'master' of github.com:nylas/k2 2016-06-30 17:11:05 -07:00
Halla Moore c5157b3553 Fixed 'in' filter for threads endpoint 2016-06-30 17:10:48 -07:00
Jackie Luo ddf73b6b02 Keep track of sync completion timestamps 2016-06-30 17:04:13 -07:00
Halla Moore ce61326f7c Make query keys not camel case 2016-06-30 16:23:55 -07:00
Halla Moore 7221ae3bb9 Added File filtering 2016-06-30 16:19:57 -07:00
Halla Moore f94acfcb9b Added filename query to threads endpoint 2016-06-30 16:09:02 -07:00
Halla Moore d68151a684 Merge branch 'master' of github.com:nylas/k2 2016-06-30 15:49:03 -07:00
Halla Moore aec946f7de Added 'in' query to messages endpoint 2016-06-30 15:23:34 -07:00
Halla Moore 6225f09018 Added some filter queries for Messages 2016-06-30 14:22:23 -07:00
Ben Gotow 04d482650c Fix processor running out of file descriptors due to re-creating redis connections 2016-06-30 13:28:41 -07:00
Ben Gotow 65a6ea4546 Redis takes seconds, not milliseconds 2016-06-30 13:28:26 -07:00
Ben Gotow 3c2b8bcb15 Fix account creation redis publish, rename to make more clear 2016-06-30 13:25:13 -07:00
Ben Gotow ef5c4a29fe Fix redis keys, dashboard app, show account active state on dashboard 2016-06-30 12:33:10 -07:00
Ben Gotow f9952f9fa7 Fix 500 error when account token does not resolve to account 2016-06-30 12:33:10 -07:00
Halla Moore d0666540b9 Added syncback tasks for folders 2016-06-30 11:54:12 -07:00
Ben Gotow 4d4a4cec32 Fix backwards logic preventing thread creation! 2016-06-30 11:04:51 -07:00
Ben Gotow a1419a65a5 Update folderId => folderImapUID, rename messageI to uid 2016-06-30 09:33:04 -07:00
Ben Gotow b033b94091 Break Category into Folder, Label, populate Gmail lables for messages 2016-06-30 09:29:21 -07:00
Ben Gotow 5a6daf9556 Stop sqlite from waiting 1sec to retry table locks 2016-06-30 00:19:57 -07:00
Jackie Luo b3b5a5106c Add endpoint for file downloads 2016-06-29 19:14:04 -07:00
Halla Moore fd7570f6c8 Add various syncback tasks for messages 2016-06-29 18:52:58 -07:00
Halla Moore 80d80eb306 Added StarThread and UnstarThread imap tasks 2016-06-29 17:36:34 -07:00
Halla Moore 2a77196fd9 Merge branch 'master' of github.com:nylas/k2 2016-06-29 17:23:27 -07:00
Halla Moore ef11508b38 Added MarkThreadAsUnread task 2016-06-29 17:23:18 -07:00
Evan Morikawa 4d7f728a75 categoryUID -> categoryImapUID and messageId -> messageHeaderId 2016-06-29 17:10:34 -07:00
Halla Moore d3fd671ff6 Update MarkThreadAsRead task 2016-06-29 17:01:30 -07:00
Evan Morikawa 6cb67e417c Fix to use Imap BOX and simplify move helper 2016-06-29 16:25:51 -07:00
Halla Moore c7fa9a782f Merge branch 'master' of github.com:nylas/k2 2016-06-29 16:12:44 -07:00
Halla Moore 825ce2eba3 Use categoryUID instead of categoryId, change default value to match node-imap 2016-06-29 16:12:29 -07:00
Ben Gotow b00b1e6d21 Add replyTo to message model 2016-06-29 16:10:45 -07:00
Halla Moore da27959009 Changed some variables so that first letter is lowercase 2016-06-29 15:07:29 -07:00
Evan Morikawa fc3796ff66 Fix transaction case issue 2016-06-29 14:58:38 -07:00
Evan Morikawa 5a56c9a4e4 AccountId -> accountId 2016-06-29 14:43:20 -07:00
Evan Morikawa 9ba3ac1bfd Merge branch 'syncback' 2016-06-29 14:25:52 -07:00
Evan Morikawa 905d797fd2 Remove comments 2016-06-29 14:25:42 -07:00
Evan Morikawa 124f0a9579 Add sigterm 2016-06-29 14:19:04 -07:00
Halla Moore a45306729f Merge branch 'syncback' of github.com:nylas/k2 into syncback 2016-06-29 14:01:01 -07:00
Halla Moore bf39b51e08 Correct some function names/params 2016-06-29 14:00:47 -07:00
Evan Morikawa 6a6e1f4f60 Remove loggin in api 2016-06-29 12:29:21 -07:00
Halla Moore 2721617665 Use CategoryId instead of messageId 2016-06-29 12:28:22 -07:00
Evan Morikawa 0e80bce433 readonly false 2016-06-29 12:26:45 -07:00
Evan Morikawa 3753d9743a Fix return 2016-06-29 12:25:38 -07:00
Evan Morikawa d26824771d Clean up loggin 2016-06-29 12:08:31 -07:00
Halla Moore bdfee404e5 Add move imap wrapper, make sure wrapper methods are called 2016-06-29 12:07:28 -07:00
Evan Morikawa 7cf59c3c11 Fix retrun value in MoveToFolderIMAP task 2016-06-29 12:04:46 -07:00
Ben Gotow a25c399652 Downcase remaining model names 2016-06-29 12:04:22 -07:00
Ben Gotow 53d6c6284e Support for /threads?view=count/expanded, thread & message JSON includes folders 2016-06-29 12:02:31 -07:00
Evan Morikawa 941180c1df Syncback WIP 2016-06-29 11:44:30 -07:00
Ben Gotow 9ff7d3aea5 Add folders and labels to /threads response, version numbers to all models 2016-06-29 11:22:38 -07:00
Ben Gotow 6ecacdd591 Add account_id to all responses, downcase model ref columns 2016-06-29 10:36:35 -07:00
Evan Morikawa ab19133b20 Add SyncbackTask super class 2016-06-29 10:13:56 -07:00
Evan Morikawa cf87325c5d Fix syncback request object 2016-06-29 10:13:56 -07:00
Halla Moore 8a53dca755 Merge branch 'master' of github.com:nylas/k2 2016-06-29 10:10:49 -07:00
Evan Morikawa ba2d865a5d Cleanup syncback request 2016-06-28 19:07:49 -07:00
Evan Morikawa 11a3a8f58e Cleanup syncback task 2016-06-28 19:02:24 -07:00
Ben Gotow c7422ffaea Fix bug where always closing connection after sync 2016-06-28 18:43:53 -07:00
Ben Gotow 0189e3e77d Break Gmail mailboxes into folders and labels 2016-06-28 18:31:40 -07:00
Evan Morikawa 7180ebbb70 PUT route works on threads to create SyncbackRequests 2016-06-28 18:17:11 -07:00
Ben Gotow ad484e8ae1 Add object key to all JSON responses 2016-06-28 18:14:54 -07:00
Evan Morikawa 306086091d syncbackMessageActions refactor 2016-06-28 18:13:49 -07:00
Halla Moore f5af9c0cb5 Added a syncback task to mark a thread as read, untested 2016-06-28 18:13:49 -07:00
Ben Gotow 222c68a598 Deprecate thread.cleanedSubject, since the only subject is the clean one 2016-06-28 18:11:55 -07:00
Ben Gotow 1d1186cb34 Add more attributes to /threads, move processor to it's own process 2016-06-28 18:10:52 -07:00
Evan Morikawa cea7783a5f syncbackMessageActions refactor 2016-06-28 17:12:45 -07:00
Halla Moore b867bcb31e Merge branch 'master' of github.com:nylas/k2 2016-06-28 15:56:35 -07:00
Evan Morikawa 2d90c5bb14 Fixes to sync worker 2016-06-28 15:44:38 -07:00
Ben Gotow ca0120a824 Allow sync after errors with env var 2016-06-28 15:37:22 -07:00
Evan Morikawa 14cffcf8a5 Change to notify / observe for syncback requests 2016-06-28 15:35:59 -07:00
Ben Gotow a10543c1c8 Chunk sync of large mailboxes, keep track of synced UID range, not just uidnext 2016-06-28 15:30:56 -07:00
Halla Moore 0f64b6e58e Add category filtering to threads api endpoint 2016-06-28 15:01:41 -07:00
Evan Morikawa 0f4ed7f4a1 Fix package json 2016-06-28 14:09:56 -07:00
Ben Gotow 8108a875ee Allow trailing slashes on API endpoints 2016-06-28 13:57:07 -07:00
Jackie Luo eaf19cc522 Add files endpoint for metadata 2016-06-28 13:55:00 -07:00
Jackie Luo a00f86660c Create file objects from MIME parts 2016-06-28 11:32:18 -07:00
Juan Tejada c5d753a434 Add /very/ basic initial error status to dashboard
- TODO: add option to solve the error
2016-06-27 23:59:22 -07:00
Ben Gotow f68948c23f Fix population of db fields in processor 2016-06-27 16:38:40 -07:00
Ben Gotow 91887a6e11 Speed up sync by fetching preferred body block only 2016-06-27 16:11:36 -07:00
Juan Tejada ed749e0f51 Add sync worker error handling
- Handles sync errors in a single place. For now, if error is not a
socket error, will treat as a permanent error, save the error to the
account object, and prevent any other syncing until the error is cleared
from the account object
- Adds a NylasError class that can be extended and serialized. Adds it
to global namespace on all packages and replaces all uses of regular
Error
2016-06-27 16:03:38 -07:00
Jackie Luo cf421cbb2d Check In-Reply-To instead of References 2016-06-27 14:58:09 -07:00
Jackie Luo 179f24449b Refactor code and add test for threading 2016-06-27 14:52:05 -07:00
Halla Moore 5077b3f027 Add subject query to threads route 2016-06-27 13:45:11 -07:00
Halla Moore 2e56d3ced4 Add timestamp queries to threads route 2016-06-27 12:30:28 -07:00
Ben Gotow 76d873c2b2 Reintroduce concept of provider, start work on Gmail 2016-06-27 10:43:53 -07:00
Halla Moore ab4c8cf32c Add id query to threads route 2016-06-27 10:35:34 -07:00
Juan Tejada 1fe7fdf4b1 More sync error handling WIP 2016-06-27 10:27:38 -07:00
Halla Moore 621f8b5c2b Add starred query to threads route 2016-06-27 10:15:05 -07:00
Juan Tejada 63b929e59b Fix missing promise based error handling in sync-worker 2016-06-26 09:52:03 -07:00
Juan Tejada dd350a5081 Update IMAPConnection api + error handling fixes + misc
- `IMAPConnection::openBox` now returns a Promise that resolves to an
IMAPBox, and IMAPBox contains all of the `fetch` operations. This makes
the dependency between fetch operations and the currently open mailbox
explicit rather than implicit and by forcing the operations to be called on
a box instance and hopefully prevent errors. It will also throw an error
if the constraint is no longer satisfied.

- `fetch` operations now return an observable stream of messages (or Promise for single value),
while preserving the same logic of the original implementation. You can use `.toPromise()` on
the observable to get a Promise that resolves when the observable stream has
completely drained.

- Fixes error handling in a few places and renames some variables
2016-06-26 01:57:33 -07:00
Juan Tejada 63f48ae817 Adds hapi-boom for easy error responses 2016-06-26 01:44:39 -07:00
Juan Tejada 1336dea0d4 Fix auth response + log errors 2016-06-25 22:19:05 -07:00
Juan Tejada caaef8d5b5 Add /messages/<id> enpoint + support for raw message/rfc822
- When message/rfc822 is requested, fetch ray message from IMAP
connection
2016-06-25 11:25:34 -07:00
Ben Gotow 69e87cbf49 Gmail auth at http://localhost:5100/auth/gmail 2016-06-24 16:46:41 -07:00
Halla Moore bc5a4ecf3c Add unread query to threads route 2016-06-24 16:14:04 -07:00
Halla Moore 18ad15937f Change uppercase instance of Joi to lowercase 2016-06-24 14:07:10 -07:00
Juan Tejada 8f945888e4 Add missing test fixtures and fix path for reading them 2016-06-24 10:39:30 -07:00
Juan Tejada ee2dc6c3f6 Expect true to be true 2016-06-24 10:36:57 -07:00
Juan Tejada 0ac3c8c313 Add jasmine for message-processor 2016-06-24 10:35:34 -07:00
Ben Gotow b67a3ae3e4 Launch dashboard when in dev mode, publish change on acct creation 2016-06-23 18:17:04 -07:00
Ben Gotow f678045c4f sync db <=> redis with sequelize hooks 2016-06-23 16:28:51 -07:00
Ben Gotow eac019f536 Rather than changing policies, just set expiring redis key to track activity 2016-06-23 16:28:48 -07:00
Ben Gotow 09bb7874f8 Dashboard with a sweet background. Also realtime assignment / policy view. 2016-06-23 15:52:53 -07:00
Evan Morikawa 3f5cac4342 Adding in syncback message actions 2016-06-23 16:47:07 -06:00
Jackie Luo b6f57f3ce8 Add threading algorithm 2016-06-23 15:44:03 -07:00
Jackie Luo f9fe836899 Fix syntax error 2016-06-23 15:21:54 -07:00
Jackie Luo 5cc4841ac6 Add check for Gmail thread ID 2016-06-23 15:19:20 -07:00
Evan Morikawa 6ad9cdd322 Fixing broken processors 2016-06-23 14:15:30 -06:00
Evan Morikawa 8160acc81e Add imap dependency to package.json 2016-06-23 13:18:33 -06:00
Evan Morikawa 1460a0ae9f Rename Refresh to Sync 2016-06-23 13:16:15 -06:00
Ben Gotow 8e692982bb Remove concept of self-limiting workers, will use cloudwatch metrics collection to scale fleet instead of queue length 2016-06-23 12:02:57 -07:00
Ben Gotow f7c647f7ba Return syncs to unclaimed queue after CLAIM_DURATION, just because it's healthy 2016-06-23 11:45:33 -07:00
Ben Gotow c2e9093b42 Escalate sync policy based on number of stream connections 2016-06-23 11:45:33 -07:00
Jackie Luo ae54192ed6 Update threading and fix typo 2016-06-23 10:35:47 -07:00
Juan Tejada a917022505 Update order of threading processor 2016-06-23 10:26:41 -07:00
Ben Gotow ad1683c9a5 Fix reference to __base 2016-06-23 10:11:07 -07:00
Ben Gotow 12d9db8dd9 Redis coordination of sync processes / assignment 2016-06-23 00:49:26 -07:00
Ben Gotow 2e9bfa68b5 Refactor DeltaStreamQueue (connection per subscription) 2016-06-23 00:49:26 -07:00
Jackie Luo cb95574378 Fix associations 2016-06-22 17:34:29 -07:00
Jackie Luo e64c2ae4c0 Add basic threading 2016-06-22 17:34:29 -07:00
Ben Gotow f5f435236f /auth + remove hardcoded stub in favor of curl request 2016-06-22 17:19:48 -07:00
Evan Morikawa 06393dd07c Move categories & messages to new monorepo structure 2016-06-22 14:44:09 -07:00
Ben Gotow 95fbb64d17 Add /messages, /folders, /account 2016-06-22 14:42:08 -07:00
Evan Morikawa 18f2925b43 Convert to monorepo 2016-06-22 14:41:32 -07:00