Commit graph

4090 commits

Author SHA1 Message Date
Juan Tejada eb1c7aadf5 bump submodule 2016-12-06 15:54:58 -08:00
Juan Tejada d08da72ae2 fix(k2) 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:46 -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
Evan Morikawa 3e54c37edb bump(k2) 2016-12-05 17:30:56 -08:00
Evan Morikawa d624f6657a fix(key): only migrate if key doesn't exist 2016-12-05 17:28:37 -08:00
Evan Morikawa ace9b94053 feat(key): use unified key manager 2016-12-05 17:19:19 -08:00
Christine Spang a04dca2755 add watchman config file for fast fuzzy find 2016-12-05 16:23:48 -08:00
Jackie Luo 871eb524ec fix(nylas-api): Correct some imports and remove tests for plugin auth 2016-12-05 11:37:27 -08:00
Ben Gotow 2e995c344c bump(submodule) 2016-12-05 10:19:50 -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 7713a375eb bump(k2) 2016-12-02 18:02:08 -05:00
Evan Morikawa 1f63680fd1 refactor(plugins): use plugin name instead of appId 2016-12-02 17:34:42 -05:00
Ben Gotow db7f966f0f fix(metadata): Remove all plugin auth 2016-12-02 14:34:37 -08: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 7b44583ddc fix(folder): fix returning db transaction promise 2016-12-02 16:26:09 -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 3f681ddced bump(k2) 2016-12-02 15:12:11 -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
Jackie Luo bd30adec15 (account-store): Convert to ES6 2016-12-02 11:00:32 -08:00
Evan Morikawa 30ce9be8d9 bump(k2) 2016-12-02 13:28:18 -05:00
Ben Gotow e3b4fc859e fix(deltas): Remove extra params passed to streaming endpoint 2016-12-01 18:42:13 -08:00
Juan Tejada 6cfbb80403 fix(tasks): /Actually/ fix moving threads in Gmail
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

Revert "fix(categories): Fix tasks for moving threads in Gmail"

This reverts commit 527de80ad2.
2016-12-01 16:38:30 -08:00
Ben Gotow 6d85a8ef81 lint(*): Fix linter errors within K2, update eslint grunt task 2016-12-01 15:38:16 -08:00
Juan Tejada b9511e75b2 🎨(task-factory) 2016-12-01 14:10:05 -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 ce14e3b12e fix(specs): Fix AccountStore specs 2016-12-01 13:50:31 -08:00
Ben Gotow 6fb08f55c5 fix(accounts): Save both local and cloud tokens per account 2016-12-01 13:35:20 -08:00
Evan Morikawa d722e6c224 bump(k2) 2016-12-01 15:45:51 -05:00
Evan Morikawa 77799519e4 fix(spec): fixed specs for nylas-sync-worker 2016-12-01 14:00:20 -05:00
Juan Tejada 527de80ad2 fix(categories): Fix tasks for moving threads in Gmail
Since our backend now reflects the actual gmail model, a thread actually
has folder and labels. Updating our N1 data model to reflect that would
take too much time right now.

Instead, I updated the task factory to generate both ChangeLabel and
ChangeFolder tasks when moving threads for gmail, by detecting if its
moving to all, trash, or spam, or returning to inbox (if moving
something to inbox, just makes sure we move to all as well)

TODO: there are still inconsistencies because k2 doesn't generate unique
ids across the entire database, which causes 3 labels and 3 folders to
have the same ids. In our code, we expect all categories to have
distinct ids
2016-12-01 10:39:53 -08: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
Evan Morikawa b51c6e0bd3 bump(k2) 2016-12-01 10:31:14 -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
Jackie Luo b7b451bdff (nylas-api): Convert to ES6 2016-11-30 16:27:25 -08:00
Juan Tejada dfee7ea9b6 fix(k2) fix local sync deltas 2016-11-30 16:13:26 -08:00
Juan Tejada e4460d3577 bump submoduels 2016-11-30 15:09:17 -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