{"action":"created","comment":{"url":"https://api.github.com/repos/Kinto/kinto.js/pulls/comments/45625189","id":45625189,"diff_hunk":"@@ -787,4 +787,45 @@ export default class Collection {\n         return this.pullChanges(result, options);\n       });\n   }\n+\n+  /**\n+   * Synchronize remote and local data. The promise will resolve with a\n+   * {@link SyncResultObject}, though will reject:\n+   *\n+   * - if the server is currently backed off;\n+   * - if the server has been detected flushed.\n+   *\n+   * Options:\n+   * - {Object} headers: HTTP headers to attach to outgoing requests.\n+   * - {Collection.strategy} strategy: See {@link Collection.strategy}.\n+   * - {Boolean} ignoreBackoff: Force synchronization even if server is currently\n+   *   backed off.\n+   *\n+   * @param  {Object} options Options.\n+   * @return {Promise}\n+   */\n+  import(records) {\n+    const reject = msg => Promise.reject(new Error(msg));\n+    if (!(records instanceof Array)) {\n+      return reject(\"Records is not an array.\");\n+    }\n+\n+    if (!records.every(record => {\n+      return record.id && this.idSchema.validate(record.id);\n+    })) {\n+      return reject(\"Record has invalid ID.\");\n+    }\n+\n+    if (!records.every(record => record.last_modified)) {\n+      return reject(\"Record has no last_modified value.\");","path":"src/collection.js","position":34,"original_position":34,"commit_id":"a7af10f5ef5d2fb029705d94bd5fbb8b7b63f281","original_commit_id":"a7af10f5ef5d2fb029705d94bd5fbb8b7b63f281","user":{"login":"n1k0","id":41547,"avatar_url":"https://avatars.githubusercontent.com/u/41547?v=3","gravatar_id":"","url":"https://api.github.com/users/n1k0","html_url":"https://github.com/n1k0","followers_url":"https://api.github.com/users/n1k0/followers","following_url":"https://api.github.com/users/n1k0/following{/other_user}","gists_url":"https://api.github.com/users/n1k0/gists{/gist_id}","starred_url":"https://api.github.com/users/n1k0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n1k0/subscriptions","organizations_url":"https://api.github.com/users/n1k0/orgs","repos_url":"https://api.github.com/users/n1k0/repos","events_url":"https://api.github.com/users/n1k0/events{/privacy}","received_events_url":"https://api.github.com/users/n1k0/received_events","type":"User","site_admin":false},"body":"Ditto","created_at":"2015-11-23T16:33:19Z","updated_at":"2015-11-23T16:33:19Z","html_url":"https://github.com/Kinto/kinto.js/pull/265#discussion_r45625189","pull_request_url":"https://api.github.com/repos/Kinto/kinto.js/pulls/265","_links":{"self":{"href":"https://api.github.com/repos/Kinto/kinto.js/pulls/comments/45625189"},"html":{"href":"https://github.com/Kinto/kinto.js/pull/265#discussion_r45625189"},"pull_request":{"href":"https://api.github.com/repos/Kinto/kinto.js/pulls/265"}}},"pull_request":{"url":"https://api.github.com/repos/Kinto/kinto.js/pulls/265","id":51346552,"html_url":"https://github.com/Kinto/kinto.js/pull/265","diff_url":"https://github.com/Kinto/kinto.js/pull/265.diff","patch_url":"https://github.com/Kinto/kinto.js/pull/265.patch","issue_url":"https://api.github.com/repos/Kinto/kinto.js/issues/265","number":265,"state":"open","locked":false,"title":"Add support for db.import","user":{"login":"Natim","id":229453,"avatar_url":"https://avatars.githubusercontent.com/u/229453?v=3","gravatar_id":"","url":"https://api.github.com/users/Natim","html_url":"https://github.com/Natim","followers_url":"https://api.github.com/users/Natim/followers","following_url":"https://api.github.com/users/Natim/following{/other_user}","gists_url":"https://api.github.com/users/Natim/gists{/gist_id}","starred_url":"https://api.github.com/users/Natim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Natim/subscriptions","organizations_url":"https://api.github.com/users/Natim/orgs","repos_url":"https://api.github.com/users/Natim/repos","events_url":"https://api.github.com/users/Natim/events{/privacy}","received_events_url":"https://api.github.com/users/Natim/received_events","type":"User","site_admin":false},"body":"For some of the Mozilla platform use-cases, it's desirable to have the ability to import initial data. Since we only need it here, for the time being, we can prototype the idea in the Firefox storage adapter and apply what we learn to the other adapters.","created_at":"2015-11-20T11:38:20Z","updated_at":"2015-11-23T16:33:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8f6712b649288cacc256e058cdba5c67933f5a73","assignee":{"login":"Natim","id":229453,"avatar_url":"https://avatars.githubusercontent.com/u/229453?v=3","gravatar_id":"","url":"https://api.github.com/users/Natim","html_url":"https://github.com/Natim","followers_url":"https://api.github.com/users/Natim/followers","following_url":"https://api.github.com/users/Natim/following{/other_user}","gists_url":"https://api.github.com/users/Natim/gists{/gist_id}","starred_url":"https://api.github.com/users/Natim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Natim/subscriptions","organizations_url":"https://api.github.com/users/Natim/orgs","repos_url":"https://api.github.com/users/Natim/repos","events_url":"https://api.github.com/users/Natim/events{/privacy}","received_events_url":"https://api.github.com/users/Natim/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Kinto/kinto.js/milestones/4","html_url":"https://github.com/Kinto/kinto.js/milestones/1.2","labels_url":"https://api.github.com/repos/Kinto/kinto.js/milestones/4/labels","id":1413306,"number":4,"title":"1.2","description":"","creator":{"login":"n1k0","id":41547,"avatar_url":"https://avatars.githubusercontent.com/u/41547?v=3","gravatar_id":"","url":"https://api.github.com/users/n1k0","html_url":"https://github.com/n1k0","followers_url":"https://api.github.com/users/n1k0/followers","following_url":"https://api.github.com/users/n1k0/following{/other_user}","gists_url":"https://api.github.com/users/n1k0/gists{/gist_id}","starred_url":"https://api.github.com/users/n1k0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n1k0/subscriptions","organizations_url":"https://api.github.com/users/n1k0/orgs","repos_url":"https://api.github.com/users/n1k0/repos","events_url":"https://api.github.com/users/n1k0/events{/privacy}","received_events_url":"https://api.github.com/users/n1k0/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":1,"state":"open","created_at":"2015-11-16T09:58:48Z","updated_at":"2015-11-20T09:29:01Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/Kinto/kinto.js/pulls/265/commits","review_comments_url":"https://api.github.com/repos/Kinto/kinto.js/pulls/265/comments","review_comment_url":"https://api.github.com/repos/Kinto/kinto.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Kinto/kinto.js/issues/265/comments","statuses_url":"https://api.github.com/repos/Kinto/kinto.js/statuses/a7af10f5ef5d2fb029705d94bd5fbb8b7b63f281","head":{"label":"Kinto:265-import-records-feature","ref":"265-import-records-feature","sha":"a7af10f5ef5d2fb029705d94bd5fbb8b7b63f281","user":{"login":"Kinto","id":13413813,"avatar_url":"https://avatars.githubusercontent.com/u/13413813?v=3","gravatar_id":"","url":"https://api.github.com/users/Kinto","html_url":"https://github.com/Kinto","followers_url":"https://api.github.com/users/Kinto/followers","following_url":"https://api.github.com/users/Kinto/following{/other_user}","gists_url":"https://api.github.com/users/Kinto/gists{/gist_id}","starred_url":"https://api.github.com/users/Kinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kinto/subscriptions","organizations_url":"https://api.github.com/users/Kinto/orgs","repos_url":"https://api.github.com/users/Kinto/repos","events_url":"https://api.github.com/users/Kinto/events{/privacy}","received_events_url":"https://api.github.com/users/Kinto/received_events","type":"Organization","site_admin":false},"repo":{"id":35978199,"name":"kinto.js","full_name":"Kinto/kinto.js","owner":{"login":"Kinto","id":13413813,"avatar_url":"https://avatars.githubusercontent.com/u/13413813?v=3","gravatar_id":"","url":"https://api.github.com/users/Kinto","html_url":"https://github.com/Kinto","followers_url":"https://api.github.com/users/Kinto/followers","following_url":"https://api.github.com/users/Kinto/following{/other_user}","gists_url":"https://api.github.com/users/Kinto/gists{/gist_id}","starred_url":"https://api.github.com/users/Kinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kinto/subscriptions","organizations_url":"https://api.github.com/users/Kinto/orgs","repos_url":"https://api.github.com/users/Kinto/repos","events_url":"https://api.github.com/users/Kinto/events{/privacy}","received_events_url":"https://api.github.com/users/Kinto/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Kinto/kinto.js","description":"A JavaScript client for Kinto.","fork":false,"url":"https://api.github.com/repos/Kinto/kinto.js","forks_url":"https://api.github.com/repos/Kinto/kinto.js/forks","keys_url":"https://api.github.com/repos/Kinto/kinto.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kinto/kinto.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kinto/kinto.js/teams","hooks_url":"https://api.github.com/repos/Kinto/kinto.js/hooks","issue_events_url":"https://api.github.com/repos/Kinto/kinto.js/issues/events{/number}","events_url":"https://api.github.com/repos/Kinto/kinto.js/events","assignees_url":"https://api.github.com/repos/Kinto/kinto.js/assignees{/user}","branches_url":"https://api.github.com/repos/Kinto/kinto.js/branches{/branch}","tags_url":"https://api.github.com/repos/Kinto/kinto.js/tags","blobs_url":"https://api.github.com/repos/Kinto/kinto.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kinto/kinto.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kinto/kinto.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kinto/kinto.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kinto/kinto.js/statuses/{sha}","languages_url":"https://api.github.com/repos/Kinto/kinto.js/languages","stargazers_url":"https://api.github.com/repos/Kinto/kinto.js/stargazers","contributors_url":"https://api.github.com/repos/Kinto/kinto.js/contributors","subscribers_url":"https://api.github.com/repos/Kinto/kinto.js/subscribers","subscription_url":"https://api.github.com/repos/Kinto/kinto.js/subscription","commits_url":"https://api.github.com/repos/Kinto/kinto.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kinto/kinto.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kinto/kinto.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kinto/kinto.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kinto/kinto.js/contents/{+path}","compare_url":"https://api.github.com/repos/Kinto/kinto.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kinto/kinto.js/merges","archive_url":"https://api.github.com/repos/Kinto/kinto.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kinto/kinto.js/downloads","issues_url":"https://api.github.com/repos/Kinto/kinto.js/issues{/number}","pulls_url":"https://api.github.com/repos/Kinto/kinto.js/pulls{/number}","milestones_url":"https://api.github.com/repos/Kinto/kinto.js/milestones{/number}","notifications_url":"https://api.github.com/repos/Kinto/kinto.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kinto/kinto.js/labels{/name}","releases_url":"https://api.github.com/repos/Kinto/kinto.js/releases{/id}","created_at":"2015-05-20T22:46:31Z","updated_at":"2015-11-19T20:21:30Z","pushed_at":"2015-11-23T16:11:38Z","git_url":"git://github.com/Kinto/kinto.js.git","ssh_url":"git@github.com:Kinto/kinto.js.git","clone_url":"https://github.com/Kinto/kinto.js.git","svn_url":"https://github.com/Kinto/kinto.js","homepage":"http://kintojs.readthedocs.org/","size":6672,"stargazers_count":23,"watchers_count":23,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":45,"forks":5,"open_issues":45,"watchers":23,"default_branch":"master"}},"base":{"label":"Kinto:master","ref":"master","sha":"4b7dcdf6ef1f83e3890023412bf4f72031a2d5fe","user":{"login":"Kinto","id":13413813,"avatar_url":"https://avatars.githubusercontent.com/u/13413813?v=3","gravatar_id":"","url":"https://api.github.com/users/Kinto","html_url":"https://github.com/Kinto","followers_url":"https://api.github.com/users/Kinto/followers","following_url":"https://api.github.com/users/Kinto/following{/other_user}","gists_url":"https://api.github.com/users/Kinto/gists{/gist_id}","starred_url":"https://api.github.com/users/Kinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kinto/subscriptions","organizations_url":"https://api.github.com/users/Kinto/orgs","repos_url":"https://api.github.com/users/Kinto/repos","events_url":"https://api.github.com/users/Kinto/events{/privacy}","received_events_url":"https://api.github.com/users/Kinto/received_events","type":"Organization","site_admin":false},"repo":{"id":35978199,"name":"kinto.js","full_name":"Kinto/kinto.js","owner":{"login":"Kinto","id":13413813,"avatar_url":"https://avatars.githubusercontent.com/u/13413813?v=3","gravatar_id":"","url":"https://api.github.com/users/Kinto","html_url":"https://github.com/Kinto","followers_url":"https://api.github.com/users/Kinto/followers","following_url":"https://api.github.com/users/Kinto/following{/other_user}","gists_url":"https://api.github.com/users/Kinto/gists{/gist_id}","starred_url":"https://api.github.com/users/Kinto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kinto/subscriptions","organizations_url":"https://api.github.com/users/Kinto/orgs","repos_url":"https://api.github.com/users/Kinto/repos","events_url":"https://api.github.com/users/Kinto/events{/privacy}","received_events_url":"https://api.github.com/users/Kinto/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Kinto/kinto.js","description":"A JavaScript client for Kinto.","fork":false,"url":"https://api.github.com/repos/Kinto/kinto.js","forks_url":"https://api.github.com/repos/Kinto/kinto.js/forks","keys_url":"https://api.github.com/repos/Kinto/kinto.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kinto/kinto.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kinto/kinto.js/teams","hooks_url":"https://api.github.com/repos/Kinto/kinto.js/hooks","issue_events_url":"https://api.github.com/repos/Kinto/kinto.js/issues/events{/number}","events_url":"https://api.github.com/repos/Kinto/kinto.js/events","assignees_url":"https://api.github.com/repos/Kinto/kinto.js/assignees{/user}","branches_url":"https://api.github.com/repos/Kinto/kinto.js/branches{/branch}","tags_url":"https://api.github.com/repos/Kinto/kinto.js/tags","blobs_url":"https://api.github.com/repos/Kinto/kinto.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kinto/kinto.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kinto/kinto.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kinto/kinto.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kinto/kinto.js/statuses/{sha}","languages_url":"https://api.github.com/repos/Kinto/kinto.js/languages","stargazers_url":"https://api.github.com/repos/Kinto/kinto.js/stargazers","contributors_url":"https://api.github.com/repos/Kinto/kinto.js/contributors","subscribers_url":"https://api.github.com/repos/Kinto/kinto.js/subscribers","subscription_url":"https://api.github.com/repos/Kinto/kinto.js/subscription","commits_url":"https://api.github.com/repos/Kinto/kinto.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kinto/kinto.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kinto/kinto.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kinto/kinto.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kinto/kinto.js/contents/{+path}","compare_url":"https://api.github.com/repos/Kinto/kinto.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kinto/kinto.js/merges","archive_url":"https://api.github.com/repos/Kinto/kinto.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kinto/kinto.js/downloads","issues_url":"https://api.github.com/repos/Kinto/kinto.js/issues{/number}","pulls_url":"https://api.github.com/repos/Kinto/kinto.js/pulls{/number}","milestones_url":"https://api.github.com/repos/Kinto/kinto.js/milestones{/number}","notifications_url":"https://api.github.com/repos/Kinto/kinto.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kinto/kinto.js/labels{/name}","releases_url":"https://api.github.com/repos/Kinto/kinto.js/releases{/id}","created_at":"2015-05-20T22:46:31Z","updated_at":"2015-11-19T20:21:30Z","pushed_at":"2015-11-23T16:11:38Z","git_url":"git://github.com/Kinto/kinto.js.git","ssh_url":"git@github.com:Kinto/kinto.js.git","clone_url":"https://github.com/Kinto/kinto.js.git","svn_url":"https://github.com/Kinto/kinto.js","homepage":"http://kintojs.readthedocs.org/","size":6672,"stargazers_count":23,"watchers_count":23,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":45,"forks":5,"open_issues":45,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Kinto/kinto.js/pulls/265"},"html":{"href":"https://github.com/Kinto/kinto.js/pull/265"},"issue":{"href":"https://api.github.com/repos/Kinto/kinto.js/issues/265"},"comments":{"href":"https://api.github.com/repos/Kinto/kinto.js/issues/265/comments"},"review_comments":{"href":"https://api.github.com/repos/Kinto/kinto.js/pulls/265/comments"},"review_comment":{"href":"https://api.github.com/repos/Kinto/kinto.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Kinto/kinto.js/pulls/265/commits"},"statuses":{"href":"https://api.github.com/repos/Kinto/kinto.js/statuses/a7af10f5ef5d2fb029705d94bd5fbb8b7b63f281"}}}}