Commit graph

1943 commits

Author SHA1 Message Date
Evan Morikawa 31a8fb2b5b feat(auth): add office 365 support
Summary: Adds a new button in auth for native Office 365 support

Test Plan: manual

Reviewers: jackie, halla, mark, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3532
2016-12-16 16:53:46 -05:00
Karim Hamidou cb6f761df3 Required changes for refreshing access tokens. 2016-12-16 11:10:20 -08:00
Halla Moore d03049b403 fix(mail-rules): use the right field name to get an account id
Summary:
With the fix to the delta-processor, this is all that's needed to
get mail rules working! Some places were trying to use 'accountId'
to access an account object's id, but it needs to be 'id' instead.

Test Plan: tested locally

Reviewers: jackie

Reviewed By: jackie

Differential Revision: https://phab.nylas.com/D3525
2016-12-15 14:18:50 -08:00
Evan Morikawa 99b428f90c fix(import): require 'rx' from 'nylas-exports' 2016-12-15 15:32:47 -05:00
Halla Moore 9066078911 fix(delta-processor): Return created models in the expected format
Summary:
We were returning an array of arrays, when really we wanted an object
of arrays keyed by model type. This also involved removing an implementation
of mapObject that was overwriting underscore's implementation of it.

Test Plan: local, having others try it.

Reviewers: juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3509
2016-12-15 12:12:37 -08:00
Juan Tejada 9039c49dba fix(send/tasks): Fix deltas for SyncbackRequest SyncbackTaskAPIRequest
Summary:
This commit fixes processing deltas for `ProviderSyncbackRequests` and
resolution of the `SyncbackTaskAPIRequest`

Specifically:
- Fix and update field definitions for `ProviderSyncbackRequest`
- Correctly parse the error attached to any `ProviderSyncbackRequest`
- Correctly process deltas for `ProviderSyncbackRequests` inside the
delta-processor
- Fix any tasks that used `SyncbackTaskAPIRequest`, and update send to use those

Depends on D3510

Test Plan: Todo/Manual

Reviewers: jackie, halla, evan

Reviewed By: halla, evan

Differential Revision: https://phab.nylas.com/D3511
2016-12-15 11:57:14 -08:00
Juan Tejada d92506d8f1 fix(sync-status): Change old per model status, in favor of per folder
Summary:
Addresses T7275
Previously, we kept track of the sync status of each API model, and the progress
we'd made syncing all available models (e.g. all threads, messages, events, etc)

Given K2's set up, we are now keeping track of sync status per folder, i.e. what
percent of the folder's messages we've synced. This status is now reported from K2
to N1 via folder object deltas, and this commit rewrites the
NylasSyncStatusStore (in ES6) to reflect that.

The new Store keeps the sync state per account, which is the merged state of
per folder sync state, and delta connections state.
We also got rid of `CategoryStore.whenCategoriesReady` in favor of
`whenCategoryListSynced`, which is derived from the fact hat as long as we've
started syncing one folder, we've already synced the entire list of of folders/labels.

There are a couple of TODOs to be addressed in upcoming diffs:
- T7329 Restore the sidebar component to show sync progress, which was previously removed
- T7330 Figure out how to report sync progress per label, specifically, we are interested in knowing how much of the inbox we've synced, which is a label in Gmail. (This might be a non-issue if we sync the inbox very fast, first)

Depends on D3514

Test Plan: Manual

Reviewers: mark, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3515
2016-12-15 11:17:20 -08:00
Evan Morikawa d1c587a01c fix(spec): add support for async specs and disable misbehaving ones
More spec fixes

replace process.nextTick with setTimeout(fn, 0) for specs

Also added an unspy in the afterEach

Temporarily disable specs

fix(spec): start fixing specs

Summary:
This is the WIP fix to our spec runner.

Several tests have been completely commented out that will require
substantially more work to fix. These have been added to our sprint
backlog.

Other tests have been fixed to update to new APIs or to deal with genuine
bugs that were introduced without our knowing!

The most common non-trivial change relates to observing the `NylasAPI` and
`NylasAPIRequest`. We used to observe the arguments to `makeRequest`.
Unfortunately `NylasAPIRequest.run` is argumentless. Instead you can do:
`NylasAPIRequest.prototype.run.mostRecentCall.object.options` to get the
`options` passed into the object. the `.object` property grabs the context
of the spy when it was last called.

Fixing these tests uncovered several concerning issues with our test
runner. I spent a while tracking down why our participant-text-field-spec
was failling every so often. I chose that spec because it was the first
spec to likely fail, thereby requiring looking at the least number of
preceding files. I tried binary searching, turning on and off, several
files beforehand only to realize that the failure rate was not determined
by a particular preceding test, but rather the existing and quantity of
preceding tests, AND the number of console.log statements I had. There is
some processor-dependent race condition going on that needs further
investigation.

I also discovered an issue with the file-download-spec. We were getting
errors about it accessing a file, which was very suspicious given the code
stubs out all fs access. This was caused due to a spec that called an
async function outside ot a `waitsForPromise` block or a `waitsFor` block.
The test completed, the spies were cleaned up, but the downstream async
chain was still running. By the time the async chain finished the runner
was already working on the next spec and the spies had been restored
(causing the real fs access to run).

Juan had an idea to kill the specs once one fails to prevent cascading
failures. I'll implement this in the next diff update

Test Plan: npm test

Reviewers: juan, halla, jackie

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

Disable other specs

Disable more broken specs

All specs turned off till passing state

Use async-safe versions of spec functions

Add async test spec

Remove unused package code

Remove canary spec
2016-12-15 13:02:00 -05:00
Halla Moore ace6cf4c9e feat(showDetails): Allow a "Show Details" option on error dialogs
Summary:
Pass in more details on sending errors, so that they can be viewed
more easily by clicking "Show Details", rather than having to check
the worker window console.

Test Plan: tested locally

Reviewers: evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3505
2016-12-14 13:02:18 -08:00
Evan Morikawa 476bbb0e5f feat(auth): add better error state handling 2016-12-07 10:11:22 -08:00
Evan Morikawa f170d14b8d fix(errors): properly rethrow api error 2016-12-06 17:21:37 -08:00
Evan Morikawa e595590a9a refactor(auth): DRY auth 2016-12-06 16:03:42 -08:00
Juan Tejada 68e596bdf4 [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:57:13 -08:00
Ben Gotow b0b231094d fix(deltas): Minor tweaks to metadata delta processing 2016-12-05 10:19:37 -08:00
Ben Gotow a9ccd7370c fix(deltas): Minor adjustments for thread deltas 2016-12-02 15:59:05 -08:00
Jackie Luo ad5a1a6316 refactor(nylas-api): Make requests with helpers 2016-12-02 15:51:38 -08:00
Ben Gotow 0e8829b929 fix linter errors 2016-12-02 15:44:52 -08:00
Evan Morikawa 1f63680fd1 refactor(plugins): use plugin name instead of appId 2016-12-02 17:34:42 -05:00
Christine Spang a1a85e04be feat(metadata): Look up local thread IDs via message table when setting metadata
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:58 -08:00
Evan Morikawa fcb36abbe8 fix(account): Remove unsupported account types 2016-12-02 16:44:44 -05:00
Evan Morikawa 2b2c998dee feat(sync): let N1 be aware of provider synback requests 2016-12-02 16:15:17 -05:00
Evan Morikawa cee7d05017 debug(delta): add logs 2016-12-02 15:11:48 -05:00
Evan Morikawa cfc605136b refactor(sync): sync workers only use delta syncs now 2016-12-02 14:48:56 -05:00
Ben Gotow fb13abe8f4 fix(deltas): Process all deltas of each class in a single pass
Also changed the DeltaProcessor so it doesn’t query for models before sending out `Actions.didPassivelyReceiveCreateDeltas`, and renames it to be more clear it’s about deltas.
2016-12-02 11:41:49 -08:00
Ben Gotow e3b4fc859e fix(deltas): Remove extra params passed to streaming endpoint 2016-12-01 18:42:13 -08:00
Ben Gotow 6d85a8ef81 lint(*): Fix linter errors within K2, update eslint grunt task 2016-12-01 15:38:16 -08:00
Evan Morikawa 00832b5a83 fix(auth): now authing IMAP through n1-cloud 2016-12-01 16:56:02 -05:00
Evan Morikawa 2ee11006e9 feat(auth): IMAP request to both n1-cloud and local sync 2016-12-01 16:56:02 -05:00
Ben Gotow 6fb08f55c5 fix(accounts): Save both local and cloud tokens per account 2016-12-01 13:35:20 -08:00
Evan Morikawa 77799519e4 fix(spec): fixed specs for nylas-sync-worker 2016-12-01 14:00:20 -05:00
Evan Morikawa 278a4d16d4 fix(spec): progress on spec fixes for sync worker 2016-12-01 13:17:55 -05:00
Juan Tejada d409a5a3f9 fix(delats): Warn when receiving unkown obejct class 2016-12-01 09:14:02 -08:00
Evan Morikawa 380f370e7d fix(sync): Support N1Cloud auth errors. Fix LongConnection cleanup 2016-12-01 12:04:37 -05:00
Evan Morikawa 58874e8ad3 fix(delta): JSON blob persist failed to save properly 2016-12-01 11:04:19 -05:00
Ben Gotow ed74e454d2 fix(deltas): Fix deltaProcessor handling deletes wrong 2016-11-30 17:00:11 -08:00
Ben Gotow daed7146b5 fix(deltas): Delta.id is now a transaction id, need objectId 2016-11-30 16:53:52 -08:00
Ben Gotow 063f38f211 fix(deltas): We’ve been flipping deltas by accident for a while! 2016-11-30 16:51:51 -08:00
Juan Tejada dfee7ea9b6 fix(k2) fix local sync deltas 2016-11-30 16:13:26 -08:00
Evan Morikawa 3a72987f4d fix(delta): default cursor to 0 if no transactions exist yet 2016-11-30 17:56:59 -05:00
Evan Morikawa 3d4035ac64 fix(delta): fix issues with delta sync 2016-11-30 17:55:45 -05:00
Jackie Luo a177146a6f fix(auth): Make N1 Cloud API request correctly 2016-11-30 14:13:46 -08:00
Evan Morikawa 5582782ddd refactor(delta): add a second delta stream, convert to es6, and cleanup
This reverts commit ee5609bdb0.

Updates to nylas sync worker to support multiple cursors

Convert NylasSyncWorker to es6

Convert NylasSyncWorkerPool to es6

Extract into deltaProcessor

Update names to NylasSyncWorker state

Working on spec fixes

More spec fixes

Delta stream refactor fixes
2016-11-30 13:42:10 -05:00
Jackie Luo 7b7fbb3b1b refactor(nylas-api): Create API requests from tasks 2016-11-29 16:33:44 -08:00
Jackie Luo bab39a5c21 fix(nylas-api): Send API and options as object 2016-11-29 16:33:44 -08:00
Ben Gotow 4baf80ac21 rm(*): Internal packages don’t need engine version locking 2016-11-29 15:12:52 -08:00
Ben Gotow 848feaad60 fix(sync-worker): Missing binding arrow… 2016-11-29 12:44:02 -08:00
Juan Tejada 0b5f2841d5 fix(deltas) Update syncworker signature 2016-11-29 12:39:36 -08:00
Ben Gotow 56fded79c7 fix(sync): Put K2 dashboard into work window 2016-11-28 18:03:27 -08:00
Evan Morikawa ee5609bdb0 Rename DeltaStreamingConnection -> LocalDeltaSyncConnection 2016-11-28 17:13:18 -08:00
Evan Morikawa caba64d39d Update nylas-sync-worker to better fetch metadata 2016-11-28 16:59:04 -08:00