From 9b3d2bd46e3bd336dd88a3455ce4becbdf923670 Mon Sep 17 00:00:00 2001 From: Neamar Date: Wed, 10 Dec 2014 15:52:41 +0100 Subject: [PATCH 1/4] Linting --- bin/make-doc.js | 12 ++++++------ bin/make-mocks.js | 2 +- bin/run-test-server.js | 2 +- package.json | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/make-doc.js b/bin/make-doc.js index 93398cf..eee84e3 100644 --- a/bin/make-doc.js +++ b/bin/make-doc.js @@ -22,7 +22,7 @@ var applyAliases = function(descriptors, aliases) { descriptors[alias] = descriptors[original]; delete descriptors[original]; }); -} +}; var groupByEndpoint = function(descriptors) { var grouped = {}; @@ -52,7 +52,7 @@ var generateSignature = function(functionName, descriptor) { } if(descriptor.params) { args.push('[params]'); - var params = descriptor.params.map(function(param){ + var params = descriptor.params.map(function(param) { return '`' + param + '`'; }); details += ' - `params` (object): will be passed as GET parameters.\n'; @@ -60,7 +60,7 @@ var generateSignature = function(functionName, descriptor) { } if(descriptor.body) { args.push('[body]'); - var body = descriptor.body.map(function(key){ + var body = descriptor.body.map(function(key) { return '`' + key + '`'; }); @@ -77,7 +77,7 @@ var generateSignature = function(functionName, descriptor) { result += '\n'; } return result; -} +}; var generateBody = function(descriptorsByEndpoint) { var body = '## Mapping functions ordered by API endpoint\n\n'; @@ -112,7 +112,7 @@ var generateBody = function(descriptorsByEndpoint) { }); return body; -} +}; var writeMarkdown = function(content) { fs.writeFileSync(outputFilename, content); @@ -128,6 +128,6 @@ var make = function() { console.log('Reference documentation written to ' + outputFilename); process.exit(0); -} +}; make(); diff --git a/bin/make-mocks.js b/bin/make-mocks.js index 7505204..0eaf0bd 100644 --- a/bin/make-mocks.js +++ b/bin/make-mocks.js @@ -170,7 +170,7 @@ mkdirp(mocksDirectory, function(err) { var pre = anyfetch.getDocumentsById(documentId); var c = configuration.apiDescriptors.getDocumentsById.subFunctions; - async.map(subs, function(name, cb){ + async.map(subs, function(name, cb) { pre[name](function(err, res) { saveMock(c[name], res.body); cb(err); diff --git a/bin/run-test-server.js b/bin/run-test-server.js index 0b310b0..6d80b41 100644 --- a/bin/run-test-server.js +++ b/bin/run-test-server.js @@ -8,4 +8,4 @@ var port = configuration.test.port; var testServer = createTestServer(); testServer.listen(port, function() { console.log('Test server listening on port ' + port); -}); \ No newline at end of file +}); diff --git a/package.json b/package.json index 16ff84e..36e65a9 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ ], "scripts": { "test": "NODE_ENV=test mocha --recursive -R spec test/ -t 30000 -s 1000", - "lint": "jshint config/ lib/ test/ script/ && jscs config/ lib/ test/ script/" + "lint": "jshint config/ lib/ test/ script/ bin/ && jscs config/ lib/ test/ script/ bin/" }, "main": "./lib/", "repository": { From cdd14acb7d8d5c50b746c93477003575c18c57e6 Mon Sep 17 00:00:00 2001 From: Neamar Date: Wed, 10 Dec 2014 15:53:29 +0100 Subject: [PATCH 2/4] Removed console --- bin/make-mocks.js | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/make-mocks.js b/bin/make-mocks.js index 0eaf0bd..89380f7 100644 --- a/bin/make-mocks.js +++ b/bin/make-mocks.js @@ -56,7 +56,6 @@ var mockEndpoint = function(name, args, cb) { cb(err); }); - console.log(name, args); anyfetch[name].apply(anyfetch, args); }; From 0c25e47c35c0b6d56e49b88ca50ead3924a18450 Mon Sep 17 00:00:00 2001 From: Neamar Date: Wed, 10 Dec 2014 15:59:47 +0100 Subject: [PATCH 3/4] Updated documents and hydraters --- config/configuration.js | 5 ++++- lib/test-server/mocks/get-company.json | 2 +- lib/test-server/mocks/get-document_types.json | 2 +- .../mocks/get-documents-id-raw.json | 10 ++++++---- .../mocks/get-documents-id-related.json | 2 +- .../mocks/get-documents-id-similar.json | 4 +++- lib/test-server/mocks/get-documents-id.json | 14 ++++++------- .../get-documents-identifier-identifier.json | 14 ++++++------- lib/test-server/mocks/get-documents.json | 14 ++++++------- lib/test-server/mocks/get-index.json | 2 +- lib/test-server/mocks/get-providers.json | 2 +- .../mocks/get-subcompanies-id.json | 20 ++++++++++++++++--- lib/test-server/mocks/get-subcompanies.json | 20 ++++++++++++++++--- lib/test-server/mocks/post-documents.json | 10 ++++++---- lib/test-server/mocks/post-subcompanies.json | 20 ++++++++++++++++--- lib/test-server/mocks/post-users.json | 6 +++--- 16 files changed, 99 insertions(+), 48 deletions(-) diff --git a/config/configuration.js b/config/configuration.js index 5581891..f6e305f 100644 --- a/config/configuration.js +++ b/config/configuration.js @@ -64,7 +64,6 @@ module.exports = { }, fakeCompany: { name: 'the_fake_subcompany', - hydraters: [] }, fakeDocument: { identifier: 'the "unique" document identifier (éüà)', @@ -73,6 +72,8 @@ module.exports = { foo: 'some_string' }, metadata: { + title: 'Document title', + path: '/document.txt', some_key: 'some random sentence' } }, @@ -83,6 +84,8 @@ module.exports = { foo: 'some_other_string' }, metadata: { + title: 'Document #2 title', + path: '/document2.txt', some_key: 'some different random sentence' } }, diff --git a/lib/test-server/mocks/get-company.json b/lib/test-server/mocks/get-company.json index 44d7ed9..2006803 100644 --- a/lib/test-server/mocks/get-company.json +++ b/lib/test-server/mocks/get-company.json @@ -21,5 +21,5 @@ "user_count": 13, "subcompany_count": 1, "documents_per_update": 5000, - "last_update": "2014-12-10T14:49:41.647Z" + "last_update": "2014-12-10T14:58:29.891Z" } \ No newline at end of file diff --git a/lib/test-server/mocks/get-document_types.json b/lib/test-server/mocks/get-document_types.json index 389ed5f..4305ed3 100644 --- a/lib/test-server/mocks/get-document_types.json +++ b/lib/test-server/mocks/get-document_types.json @@ -28,7 +28,7 @@ } }, "document_count": 1, - "updated": "2014-12-10T14:50:42.835Z" + "updated": "2014-12-10T14:59:34.187Z" }, { "_type": "DocumentType", diff --git a/lib/test-server/mocks/get-documents-id-raw.json b/lib/test-server/mocks/get-documents-id-raw.json index 602c673..d53d988 100644 --- a/lib/test-server/mocks/get-documents-id-raw.json +++ b/lib/test-server/mocks/get-documents-id-raw.json @@ -1,9 +1,9 @@ { "_type": "Document", - "id": "54885dc2caef098362955e4f", + "id": "54885fd6caef098362955f54", "identifier": "the \"unique\" document identifier (éüà)", - "creation_date": "2014-12-10T14:50:42.784Z", - "modification_date": "2014-12-10T14:50:42.784Z", + "creation_date": "2014-12-10T14:59:34.132Z", + "modification_date": "2014-12-10T14:59:34.132Z", "provider": { "_type": "AccessToken", "id": "54885c04e782a7946271cf00", @@ -42,12 +42,14 @@ } }, "actions": {}, - "document_url": "https://api-staging.anyfetch.com/documents/54885dc2caef098362955e4f", + "document_url": "https://api-staging.anyfetch.com/documents/54885fd6caef098362955f54", "projection_type": "raw", "data": { "foo": "some_string" }, "metadata": { + "title": "Document title", + "path": "/document.txt", "some_key": "some random sentence" }, "last_hydration": null, diff --git a/lib/test-server/mocks/get-documents-id-related.json b/lib/test-server/mocks/get-documents-id-related.json index 2978303..f87ae2a 100644 --- a/lib/test-server/mocks/get-documents-id-related.json +++ b/lib/test-server/mocks/get-documents-id-related.json @@ -1,6 +1,6 @@ { "title": { - "title": "Unknown document: no path." + "title": "Document title" }, "document_type": { "_type": "DocumentType", diff --git a/lib/test-server/mocks/get-documents-id-similar.json b/lib/test-server/mocks/get-documents-id-similar.json index f389172..3c398b5 100644 --- a/lib/test-server/mocks/get-documents-id-similar.json +++ b/lib/test-server/mocks/get-documents-id-similar.json @@ -1,6 +1,6 @@ { "title": { - "title": "Unknown document: no path." + "title": "Document title" }, "document_type": { "_type": "DocumentType", @@ -11,6 +11,8 @@ } }, "keywords": [ + "title", + "/document.txt", "some", "random" ], diff --git a/lib/test-server/mocks/get-documents-id.json b/lib/test-server/mocks/get-documents-id.json index f50787d..baa717c 100644 --- a/lib/test-server/mocks/get-documents-id.json +++ b/lib/test-server/mocks/get-documents-id.json @@ -1,9 +1,9 @@ { "_type": "Document", - "id": "54885dc2caef098362955e4f", + "id": "54885fd6caef098362955f54", "identifier": "the \"unique\" document identifier (éüà)", - "creation_date": "2014-12-10T14:50:42.784Z", - "modification_date": "2014-12-10T14:50:42.784Z", + "creation_date": "2014-12-10T14:59:34.132Z", + "modification_date": "2014-12-10T14:59:34.132Z", "provider": { "_type": "AccessToken", "id": "54885c04e782a7946271cf00", @@ -22,12 +22,12 @@ } }, "actions": {}, - "document_url": "https://api-staging.anyfetch.com/documents/54885dc2caef098362955e4f", + "document_url": "https://api-staging.anyfetch.com/documents/54885fd6caef098362955f54", "projection_type": "full", "data": { - "title": "Unknown document: no path.", - "path": "", - "extension": "_blank" + "title": "Document title", + "path": "/document.txt", + "extension": "txt" }, "related": [] } \ No newline at end of file diff --git a/lib/test-server/mocks/get-documents-identifier-identifier.json b/lib/test-server/mocks/get-documents-identifier-identifier.json index f50787d..baa717c 100644 --- a/lib/test-server/mocks/get-documents-identifier-identifier.json +++ b/lib/test-server/mocks/get-documents-identifier-identifier.json @@ -1,9 +1,9 @@ { "_type": "Document", - "id": "54885dc2caef098362955e4f", + "id": "54885fd6caef098362955f54", "identifier": "the \"unique\" document identifier (éüà)", - "creation_date": "2014-12-10T14:50:42.784Z", - "modification_date": "2014-12-10T14:50:42.784Z", + "creation_date": "2014-12-10T14:59:34.132Z", + "modification_date": "2014-12-10T14:59:34.132Z", "provider": { "_type": "AccessToken", "id": "54885c04e782a7946271cf00", @@ -22,12 +22,12 @@ } }, "actions": {}, - "document_url": "https://api-staging.anyfetch.com/documents/54885dc2caef098362955e4f", + "document_url": "https://api-staging.anyfetch.com/documents/54885fd6caef098362955f54", "projection_type": "full", "data": { - "title": "Unknown document: no path.", - "path": "", - "extension": "_blank" + "title": "Document title", + "path": "/document.txt", + "extension": "txt" }, "related": [] } \ No newline at end of file diff --git a/lib/test-server/mocks/get-documents.json b/lib/test-server/mocks/get-documents.json index f748db7..8c022f1 100644 --- a/lib/test-server/mocks/get-documents.json +++ b/lib/test-server/mocks/get-documents.json @@ -30,10 +30,10 @@ "data": [ { "_type": "Document", - "id": "54885dc2caef098362955e4f", + "id": "54885fd6caef098362955f54", "identifier": "the \"unique\" document identifier (éüà)", - "creation_date": "2014-12-10T14:50:42.784Z", - "modification_date": "2014-12-10T14:50:42.784Z", + "creation_date": "2014-12-10T14:59:34.132Z", + "modification_date": "2014-12-10T14:59:34.132Z", "provider": { "_type": "AccessToken", "id": "54885c04e782a7946271cf00", @@ -52,12 +52,12 @@ } }, "actions": {}, - "document_url": "https://api-staging.anyfetch.com/documents/54885dc2caef098362955e4f", + "document_url": "https://api-staging.anyfetch.com/documents/54885fd6caef098362955f54", "projection_type": "snippet", "data": { - "title": "Unknown document: no path.", - "path": "", - "extension": "_blank" + "title": "Document title", + "path": "/document.txt", + "extension": "txt" }, "related_count": 0, "score": 2 diff --git a/lib/test-server/mocks/get-index.json b/lib/test-server/mocks/get-index.json index 2ff1693..2acc236 100644 --- a/lib/test-server/mocks/get-index.json +++ b/lib/test-server/mocks/get-index.json @@ -9,5 +9,5 @@ "update_url": "https://api-staging.anyfetch.com/company/update", "reset_url": "https://api-staging.anyfetch.com/company/reset", "token_url": "https://api-staging.anyfetch.com/token", - "server_time": "2014-12-10T14:50:43.585Z" + "server_time": "2014-12-10T14:59:34.825Z" } \ No newline at end of file diff --git a/lib/test-server/mocks/get-providers.json b/lib/test-server/mocks/get-providers.json index d9a7d7b..150698e 100644 --- a/lib/test-server/mocks/get-providers.json +++ b/lib/test-server/mocks/get-providers.json @@ -7,7 +7,7 @@ "account_name": "", "current": true, "document_count": 1, - "updated": "2014-12-10T14:50:42.835Z", + "updated": "2014-12-10T14:59:34.187Z", "providing": true } ] \ No newline at end of file diff --git a/lib/test-server/mocks/get-subcompanies-id.json b/lib/test-server/mocks/get-subcompanies-id.json index 2e3a291..f10e3d8 100644 --- a/lib/test-server/mocks/get-subcompanies-id.json +++ b/lib/test-server/mocks/get-subcompanies-id.json @@ -1,12 +1,26 @@ { "_type": "Company", - "id": "54885dc3e782a7946271cf11", + "id": "54885fd6e782a7946271d03f", "name": "the_fake_subcompany", - "hydraters": [], + "hydraters": [ + "https://deduplicator-staging.anyfetch.com/hydrate", + "https://embedmail-staging.anyfetch.com/hydrate", + "https://eml-staging.anyfetch.com/hydrate", + "https://event-staging.anyfetch.com/hydrate", + "https://filecleaner-staging.anyfetch.com/hydrate", + "https://ics-staging.anyfetch.com/hydrate", + "https://image-staging.anyfetch.com/hydrate", + "https://iptc-staging.anyfetch.com/hydrate", + "https://markdown-staging.anyfetch.com/hydrate", + "https://ocr-staging.anyfetch.com/hydrate", + "https://office-staging.anyfetch.com/hydrate", + "https://pdf-staging.anyfetch.com/hydrate", + "https://plaintext-staging.anyfetch.com/hydrate" + ], "document_count": 0, "user_count": 1, "subcompany_count": 0, "documents_per_update": 5000, - "last_update": "2014-12-10T14:50:43.129Z", + "last_update": "2014-12-10T14:59:34.390Z", "childs": [] } \ No newline at end of file diff --git a/lib/test-server/mocks/get-subcompanies.json b/lib/test-server/mocks/get-subcompanies.json index c24e303..936d467 100644 --- a/lib/test-server/mocks/get-subcompanies.json +++ b/lib/test-server/mocks/get-subcompanies.json @@ -1,14 +1,28 @@ [ { "_type": "Company", - "id": "54885dc3e782a7946271cf11", + "id": "54885fd6e782a7946271d03f", "name": "the_fake_subcompany", - "hydraters": [], + "hydraters": [ + "https://deduplicator-staging.anyfetch.com/hydrate", + "https://embedmail-staging.anyfetch.com/hydrate", + "https://eml-staging.anyfetch.com/hydrate", + "https://event-staging.anyfetch.com/hydrate", + "https://filecleaner-staging.anyfetch.com/hydrate", + "https://ics-staging.anyfetch.com/hydrate", + "https://image-staging.anyfetch.com/hydrate", + "https://iptc-staging.anyfetch.com/hydrate", + "https://markdown-staging.anyfetch.com/hydrate", + "https://ocr-staging.anyfetch.com/hydrate", + "https://office-staging.anyfetch.com/hydrate", + "https://pdf-staging.anyfetch.com/hydrate", + "https://plaintext-staging.anyfetch.com/hydrate" + ], "document_count": 0, "user_count": 1, "subcompany_count": 0, "documents_per_update": 5000, - "last_update": "2014-12-10T14:50:43.129Z", + "last_update": "2014-12-10T14:59:34.390Z", "childs": [] } ] \ No newline at end of file diff --git a/lib/test-server/mocks/post-documents.json b/lib/test-server/mocks/post-documents.json index f6c2119..2c56c96 100644 --- a/lib/test-server/mocks/post-documents.json +++ b/lib/test-server/mocks/post-documents.json @@ -1,9 +1,9 @@ { "_type": "Document", - "id": "54885dc2caef098362955e4f", + "id": "54885fd6caef098362955f54", "identifier": "the \"unique\" document identifier (éüà)", - "creation_date": "2014-12-10T14:50:42.784Z", - "modification_date": "2014-12-10T14:50:42.784Z", + "creation_date": "2014-12-10T14:59:34.132Z", + "modification_date": "2014-12-10T14:59:34.132Z", "provider": { "_type": "AccessToken", "id": "54885c04e782a7946271cf00", @@ -42,12 +42,14 @@ } }, "actions": {}, - "document_url": "https://api-staging.anyfetch.com/documents/54885dc2caef098362955e4f", + "document_url": "https://api-staging.anyfetch.com/documents/54885fd6caef098362955f54", "projection_type": "raw", "data": { "foo": "some_string" }, "metadata": { + "title": "Document title", + "path": "/document.txt", "some_key": "some random sentence" }, "last_hydration": null, diff --git a/lib/test-server/mocks/post-subcompanies.json b/lib/test-server/mocks/post-subcompanies.json index bebb1c0..f86e664 100644 --- a/lib/test-server/mocks/post-subcompanies.json +++ b/lib/test-server/mocks/post-subcompanies.json @@ -1,11 +1,25 @@ { "_type": "Company", - "id": "54885dc3e782a7946271cf11", + "id": "54885fd6e782a7946271d03f", "name": "the_fake_subcompany", - "hydraters": [], + "hydraters": [ + "https://deduplicator-staging.anyfetch.com/hydrate", + "https://embedmail-staging.anyfetch.com/hydrate", + "https://eml-staging.anyfetch.com/hydrate", + "https://event-staging.anyfetch.com/hydrate", + "https://filecleaner-staging.anyfetch.com/hydrate", + "https://ics-staging.anyfetch.com/hydrate", + "https://image-staging.anyfetch.com/hydrate", + "https://iptc-staging.anyfetch.com/hydrate", + "https://markdown-staging.anyfetch.com/hydrate", + "https://ocr-staging.anyfetch.com/hydrate", + "https://office-staging.anyfetch.com/hydrate", + "https://pdf-staging.anyfetch.com/hydrate", + "https://plaintext-staging.anyfetch.com/hydrate" + ], "document_count": 0, "user_count": 1, "subcompany_count": 0, "documents_per_update": 5000, - "last_update": "2014-12-10T14:50:43.129Z" + "last_update": "2014-12-10T14:59:34.390Z" } \ No newline at end of file diff --git a/lib/test-server/mocks/post-users.json b/lib/test-server/mocks/post-users.json index c4a04e9..b66daa3 100644 --- a/lib/test-server/mocks/post-users.json +++ b/lib/test-server/mocks/post-users.json @@ -1,8 +1,8 @@ { "_type": "User", - "id": "54885dc2e782a7946271cf10", - "email": "thechuck81@norris.com", + "id": "54885fd6e782a7946271d03e", + "email": "thechuck329@norris.com", "name": "Chuck Norris", "is_admin": true, - "user_url": "https://api-staging.anyfetch.com/users/54885dc2e782a7946271cf10" + "user_url": "https://api-staging.anyfetch.com/users/54885fd6e782a7946271d03e" } \ No newline at end of file From 34a57846914d72b29706d80122b55e66b6b2b76f Mon Sep 17 00:00:00 2001 From: Neamar Date: Wed, 10 Dec 2014 16:10:42 +0100 Subject: [PATCH 4/4] New update format --- lib/test-server/mocks/get-company.json | 2 +- lib/test-server/mocks/get-document_types.json | 8 ++++---- lib/test-server/mocks/get-documents-id-raw.json | 8 ++++---- lib/test-server/mocks/get-documents-id.json | 8 ++++---- .../mocks/get-documents-identifier-identifier.json | 8 ++++---- lib/test-server/mocks/get-documents.json | 8 ++++---- lib/test-server/mocks/get-index.json | 2 +- lib/test-server/mocks/get-providers.json | 2 +- lib/test-server/mocks/get-subcompanies-id.json | 4 ++-- lib/test-server/mocks/get-subcompanies.json | 4 ++-- lib/test-server/mocks/post-company-update.json | 8 +++++--- lib/test-server/mocks/post-documents.json | 8 ++++---- lib/test-server/mocks/post-subcompanies.json | 4 ++-- lib/test-server/mocks/post-users.json | 6 +++--- 14 files changed, 41 insertions(+), 39 deletions(-) diff --git a/lib/test-server/mocks/get-company.json b/lib/test-server/mocks/get-company.json index 2006803..1403781 100644 --- a/lib/test-server/mocks/get-company.json +++ b/lib/test-server/mocks/get-company.json @@ -21,5 +21,5 @@ "user_count": 13, "subcompany_count": 1, "documents_per_update": 5000, - "last_update": "2014-12-10T14:58:29.891Z" + "last_update": "2014-12-10T15:05:32.750Z" } \ No newline at end of file diff --git a/lib/test-server/mocks/get-document_types.json b/lib/test-server/mocks/get-document_types.json index 4305ed3..5ba5315 100644 --- a/lib/test-server/mocks/get-document_types.json +++ b/lib/test-server/mocks/get-document_types.json @@ -28,7 +28,7 @@ } }, "document_count": 1, - "updated": "2014-12-10T14:59:34.187Z" + "updated": "2014-12-10T15:09:14.681Z" }, { "_type": "DocumentType", @@ -331,8 +331,8 @@ "description": "An event, from a calendar for instance.", "projections": { "title": "{ \"name\": \"{{attr \"name\"}}\" }", - "full": "{\n \"eventName\": \"{{attr 'name'}}\",\n \"startDate\": \"{{dateRfc metadata.startDate}}\",\n \"endDate\": \"{{dateRfc metadata.endDate}}\",\n \"description\": \"{{attr 'description'}}\",\n \"organizer\": \"{{#if name}}{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}{{/if}} <{{#escapeQuotes .}}{{mail}}{{/escapeQuotes}}>\",\n \"attendee\": [\n {{#list metadata.attendee}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{mail}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"location\" : \"{{#if metadata.location}}{{attr 'location'}}{{/if}}\"\n}\n", - "snippet": "{\n \"eventName\": \"{{attr 'name'}}\",\n \"startDate\": \"{{dateRfc metadata.startDate}}\",\n \"endDate\": \"{{dateRfc metadata.endDate}}\",\n \"description\": \"{{attr 'description'}}\",\n \"organizer\": \"{{#if name}}{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}{{/if}} <{{#escapeQuotes .}}{{mail}}{{/escapeQuotes}}>\",\n \"attendee\": [\n {{#list metadata.attendee}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{mail}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"location\" : \"{{#if metadata.location}}{{attr 'location'}}{{/if}}\"\n}\n" + "full": "{\n \"eventName\": \"{{attr 'name'}}\",\n \"startDate\": \"{{dateRfc metadata.startDate}}\",\n \"endDate\": \"{{dateRfc metadata.endDate}}\",\n \"description\": \"{{#toBr}}{{attr 'description'}}{{/toBr}}\",\n \"organizer\": \"{{#if name}}{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}{{/if}} <{{#escapeQuotes .}}{{mail}}{{/escapeQuotes}}>\",\n \"attendee\": [\n {{#list metadata.attendee}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{mail}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"location\" : \"{{#if metadata.location}}{{attr 'location'}}{{/if}}\"\n}\n", + "snippet": "{\n \"eventName\": \"{{attr 'name'}}\",\n \"startDate\": \"{{dateRfc metadata.startDate}}\",\n \"endDate\": \"{{dateRfc metadata.endDate}}\",\n \"description\": \"{{#toBr}}{{attr 'description'}}{{/toBr}}\",\n \"organizer\": \"{{#if name}}{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}{{/if}} <{{#escapeQuotes .}}{{mail}}{{/escapeQuotes}}>\",\n \"attendee\": [\n {{#list metadata.attendee}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{mail}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"location\" : \"{{#if metadata.location}}{{attr 'location'}}{{/if}}\"\n}\n" }, "es_mapping": { "properties": { @@ -398,7 +398,7 @@ "description": "An email thread or conversation", "projections": { "title": "{ \"subject\": \"{{attr \"subject\"}}\" }", - "full": "{\n \"subject\": \"{{attr 'subject'}}\",\n \"date\": \"{{dateRfc metadata.date}}\",\n \"participants\": [\n {{#list metadata.participants}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{address}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"labels\": [ {{#list metadata.labels}}\"{{#escapeQuotes .}}{{.}}{{/escapeQuotes}}\"{{/list}} ],\n \"messages\": [\n {{#reverseList metadata.messages sibling=data.messages}}\n {\n \"subject\": \"{{#escapeQuotes .}}{{subject}}{{/escapeQuotes}}\",\n {{#if date}}\n \"date\": \"{{dateRfc date}}\",\n {{/if}}\n \"from\": [\n {{#list from}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{address}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"to\": [\n {{#list to}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{address}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"html\":\n {{#contextLookup ../data.messages reverse=true field=@index}}\n {{#if looked.html}}\n \"{{htmlHighlighter looked.html}}\"\n {{else}}\n \"{{textHighlighter text}}\"\n {{/if}}\n {{/contextLookup}}\n }\n {{/reverseList}}\n ],\n \"attachmentCount\": {{safeInt metadata.attachmentsCount}},\n \"messagesCount\": {{safeInt metadata.messages.length}},\n \"participantsCount\": {{safeInt metadata.participants.length}},\n \"singleEmail\":\n {{#if metadata.messages.[1]}}\n false\n {{else}}\n true\n {{/if}}\n\n}\n", + "full": "{\n \"subject\": \"{{attr 'subject'}}\",\n \"date\": \"{{dateRfc metadata.date}}\",\n \"participants\": [\n {{#list metadata.participants}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{address}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"labels\": [ {{#list metadata.labels}}\"{{#escapeQuotes .}}{{.}}{{/escapeQuotes}}\"{{/list}} ],\n \"messages\": [\n {{#reverseList metadata.messages sibling=data.messages}}\n {\n \"subject\": \"{{#escapeQuotes .}}{{subject}}{{/escapeQuotes}}\",\n {{#if date}}\n \"date\": \"{{dateRfc date}}\",\n {{/if}}\n \"from\": [\n {{#list from}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{address}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"to\": [\n {{#list to}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{address}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"html\":\n {{#contextLookup ../data.messages reverse=true field=@index}}\n {{#if looked.html}}\n \"{{htmlHighlighter looked.html}}\"\n {{else}}\n \"{{#toBr}}{{textHighlighter text}}{{/toBr}}\"\n {{/if}}\n {{/contextLookup}}\n }\n {{/reverseList}}\n ],\n \"attachmentCount\": {{safeInt metadata.attachmentsCount}},\n \"messagesCount\": {{safeInt metadata.messages.length}},\n \"participantsCount\": {{safeInt metadata.participants.length}},\n \"singleEmail\":\n {{#if metadata.messages.[1]}}\n false\n {{else}}\n true\n {{/if}}\n\n}\n", "snippet": "{\n \"subject\": \"{{attr 'subject'}}\",\n \"date\": \"{{dateRfc metadata.date}}\",\n \"participants\": [\n {{#list metadata.participants l=3}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{hideDomainEmail address}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"labels\": [ {{#list metadata.labels}}\"{{.}}\"{{/list}} ],\n \"snippet\":\n {{#contextLookup highlight field='messages.text'}}\n {{#if looked}}\n \"{{#escapeQuotes .}}{{{looked}}}{{/escapeQuotes}}\"\n {{else}}\n {{#if highlight.text}}\n \"{{#escapeQuotes .}}{{{highlight.text}}}{{/escapeQuotes}}\"\n {{else}}\n {{#last metadata.messages}}\n \"{{#escapeQuotes .}}{{#shorten .}}{{text}}{{/shorten}}{{/escapeQuotes}}\"\n {{else}}\n \"\"\n {{/last}}\n {{/if}}\n {{/if}}\n {{/contextLookup}},\n \"attachmentCount\": {{safeInt metadata.attachmentsCount}},\n \"participantsCount\": {{safeInt metadata.participants.length}},\n \"messagesCount\": {{safeInt metadata.messages.length}},\n \"singleEmail\":\n {{#if metadata.messages.[1]}}\n false\n {{else}}\n true\n {{/if}}\n}\n" }, "es_mapping": { diff --git a/lib/test-server/mocks/get-documents-id-raw.json b/lib/test-server/mocks/get-documents-id-raw.json index d53d988..5bfd2f1 100644 --- a/lib/test-server/mocks/get-documents-id-raw.json +++ b/lib/test-server/mocks/get-documents-id-raw.json @@ -1,9 +1,9 @@ { "_type": "Document", - "id": "54885fd6caef098362955f54", + "id": "5488621a42d43c8b0b302733", "identifier": "the \"unique\" document identifier (éüà)", - "creation_date": "2014-12-10T14:59:34.132Z", - "modification_date": "2014-12-10T14:59:34.132Z", + "creation_date": "2014-12-10T15:09:14.626Z", + "modification_date": "2014-12-10T15:09:14.626Z", "provider": { "_type": "AccessToken", "id": "54885c04e782a7946271cf00", @@ -42,7 +42,7 @@ } }, "actions": {}, - "document_url": "https://api-staging.anyfetch.com/documents/54885fd6caef098362955f54", + "document_url": "https://api-staging.anyfetch.com/documents/5488621a42d43c8b0b302733", "projection_type": "raw", "data": { "foo": "some_string" diff --git a/lib/test-server/mocks/get-documents-id.json b/lib/test-server/mocks/get-documents-id.json index baa717c..0f0236d 100644 --- a/lib/test-server/mocks/get-documents-id.json +++ b/lib/test-server/mocks/get-documents-id.json @@ -1,9 +1,9 @@ { "_type": "Document", - "id": "54885fd6caef098362955f54", + "id": "5488621a42d43c8b0b302733", "identifier": "the \"unique\" document identifier (éüà)", - "creation_date": "2014-12-10T14:59:34.132Z", - "modification_date": "2014-12-10T14:59:34.132Z", + "creation_date": "2014-12-10T15:09:14.626Z", + "modification_date": "2014-12-10T15:09:14.626Z", "provider": { "_type": "AccessToken", "id": "54885c04e782a7946271cf00", @@ -22,7 +22,7 @@ } }, "actions": {}, - "document_url": "https://api-staging.anyfetch.com/documents/54885fd6caef098362955f54", + "document_url": "https://api-staging.anyfetch.com/documents/5488621a42d43c8b0b302733", "projection_type": "full", "data": { "title": "Document title", diff --git a/lib/test-server/mocks/get-documents-identifier-identifier.json b/lib/test-server/mocks/get-documents-identifier-identifier.json index baa717c..0f0236d 100644 --- a/lib/test-server/mocks/get-documents-identifier-identifier.json +++ b/lib/test-server/mocks/get-documents-identifier-identifier.json @@ -1,9 +1,9 @@ { "_type": "Document", - "id": "54885fd6caef098362955f54", + "id": "5488621a42d43c8b0b302733", "identifier": "the \"unique\" document identifier (éüà)", - "creation_date": "2014-12-10T14:59:34.132Z", - "modification_date": "2014-12-10T14:59:34.132Z", + "creation_date": "2014-12-10T15:09:14.626Z", + "modification_date": "2014-12-10T15:09:14.626Z", "provider": { "_type": "AccessToken", "id": "54885c04e782a7946271cf00", @@ -22,7 +22,7 @@ } }, "actions": {}, - "document_url": "https://api-staging.anyfetch.com/documents/54885fd6caef098362955f54", + "document_url": "https://api-staging.anyfetch.com/documents/5488621a42d43c8b0b302733", "projection_type": "full", "data": { "title": "Document title", diff --git a/lib/test-server/mocks/get-documents.json b/lib/test-server/mocks/get-documents.json index 8c022f1..ff53784 100644 --- a/lib/test-server/mocks/get-documents.json +++ b/lib/test-server/mocks/get-documents.json @@ -30,10 +30,10 @@ "data": [ { "_type": "Document", - "id": "54885fd6caef098362955f54", + "id": "5488621a42d43c8b0b302733", "identifier": "the \"unique\" document identifier (éüà)", - "creation_date": "2014-12-10T14:59:34.132Z", - "modification_date": "2014-12-10T14:59:34.132Z", + "creation_date": "2014-12-10T15:09:14.626Z", + "modification_date": "2014-12-10T15:09:14.626Z", "provider": { "_type": "AccessToken", "id": "54885c04e782a7946271cf00", @@ -52,7 +52,7 @@ } }, "actions": {}, - "document_url": "https://api-staging.anyfetch.com/documents/54885fd6caef098362955f54", + "document_url": "https://api-staging.anyfetch.com/documents/5488621a42d43c8b0b302733", "projection_type": "snippet", "data": { "title": "Document title", diff --git a/lib/test-server/mocks/get-index.json b/lib/test-server/mocks/get-index.json index 2acc236..5052fc6 100644 --- a/lib/test-server/mocks/get-index.json +++ b/lib/test-server/mocks/get-index.json @@ -9,5 +9,5 @@ "update_url": "https://api-staging.anyfetch.com/company/update", "reset_url": "https://api-staging.anyfetch.com/company/reset", "token_url": "https://api-staging.anyfetch.com/token", - "server_time": "2014-12-10T14:59:34.825Z" + "server_time": "2014-12-10T15:09:15.433Z" } \ No newline at end of file diff --git a/lib/test-server/mocks/get-providers.json b/lib/test-server/mocks/get-providers.json index 150698e..2224ad0 100644 --- a/lib/test-server/mocks/get-providers.json +++ b/lib/test-server/mocks/get-providers.json @@ -7,7 +7,7 @@ "account_name": "", "current": true, "document_count": 1, - "updated": "2014-12-10T14:59:34.187Z", + "updated": "2014-12-10T15:09:14.681Z", "providing": true } ] \ No newline at end of file diff --git a/lib/test-server/mocks/get-subcompanies-id.json b/lib/test-server/mocks/get-subcompanies-id.json index f10e3d8..461cbbe 100644 --- a/lib/test-server/mocks/get-subcompanies-id.json +++ b/lib/test-server/mocks/get-subcompanies-id.json @@ -1,6 +1,6 @@ { "_type": "Company", - "id": "54885fd6e782a7946271d03f", + "id": "5488621ae181a1a20b5aa579", "name": "the_fake_subcompany", "hydraters": [ "https://deduplicator-staging.anyfetch.com/hydrate", @@ -21,6 +21,6 @@ "user_count": 1, "subcompany_count": 0, "documents_per_update": 5000, - "last_update": "2014-12-10T14:59:34.390Z", + "last_update": "2014-12-10T15:09:14.862Z", "childs": [] } \ No newline at end of file diff --git a/lib/test-server/mocks/get-subcompanies.json b/lib/test-server/mocks/get-subcompanies.json index 936d467..e9d5212 100644 --- a/lib/test-server/mocks/get-subcompanies.json +++ b/lib/test-server/mocks/get-subcompanies.json @@ -1,7 +1,7 @@ [ { "_type": "Company", - "id": "54885fd6e782a7946271d03f", + "id": "5488621ae181a1a20b5aa579", "name": "the_fake_subcompany", "hydraters": [ "https://deduplicator-staging.anyfetch.com/hydrate", @@ -22,7 +22,7 @@ "user_count": 1, "subcompany_count": 0, "documents_per_update": 5000, - "last_update": "2014-12-10T14:59:34.390Z", + "last_update": "2014-12-10T15:09:14.862Z", "childs": [] } ] \ No newline at end of file diff --git a/lib/test-server/mocks/post-company-update.json b/lib/test-server/mocks/post-company-update.json index 7b38303..ae72bda 100644 --- a/lib/test-server/mocks/post-company-update.json +++ b/lib/test-server/mocks/post-company-update.json @@ -1,5 +1,7 @@ { - "53234698c8318cc5d100004f": 202, - "5320a682c8318cba94000040": 202, - "5320a6abc8318cc5d1000049": 429 + "52f0bb24c8318c2d65000036": {}, + "5460f239fc0973bc40c19b23": {}, + "5409823bee7d24ef49b598fa": {}, + "542d1639ecc49603190b329b": {}, + "542d1758ecc49603190b32a7": {} } diff --git a/lib/test-server/mocks/post-documents.json b/lib/test-server/mocks/post-documents.json index 2c56c96..fb3d196 100644 --- a/lib/test-server/mocks/post-documents.json +++ b/lib/test-server/mocks/post-documents.json @@ -1,9 +1,9 @@ { "_type": "Document", - "id": "54885fd6caef098362955f54", + "id": "5488621a42d43c8b0b302733", "identifier": "the \"unique\" document identifier (éüà)", - "creation_date": "2014-12-10T14:59:34.132Z", - "modification_date": "2014-12-10T14:59:34.132Z", + "creation_date": "2014-12-10T15:09:14.626Z", + "modification_date": "2014-12-10T15:09:14.626Z", "provider": { "_type": "AccessToken", "id": "54885c04e782a7946271cf00", @@ -42,7 +42,7 @@ } }, "actions": {}, - "document_url": "https://api-staging.anyfetch.com/documents/54885fd6caef098362955f54", + "document_url": "https://api-staging.anyfetch.com/documents/5488621a42d43c8b0b302733", "projection_type": "raw", "data": { "foo": "some_string" diff --git a/lib/test-server/mocks/post-subcompanies.json b/lib/test-server/mocks/post-subcompanies.json index f86e664..6523bce 100644 --- a/lib/test-server/mocks/post-subcompanies.json +++ b/lib/test-server/mocks/post-subcompanies.json @@ -1,6 +1,6 @@ { "_type": "Company", - "id": "54885fd6e782a7946271d03f", + "id": "5488621ae181a1a20b5aa579", "name": "the_fake_subcompany", "hydraters": [ "https://deduplicator-staging.anyfetch.com/hydrate", @@ -21,5 +21,5 @@ "user_count": 1, "subcompany_count": 0, "documents_per_update": 5000, - "last_update": "2014-12-10T14:59:34.390Z" + "last_update": "2014-12-10T15:09:14.862Z" } \ No newline at end of file diff --git a/lib/test-server/mocks/post-users.json b/lib/test-server/mocks/post-users.json index b66daa3..759518c 100644 --- a/lib/test-server/mocks/post-users.json +++ b/lib/test-server/mocks/post-users.json @@ -1,8 +1,8 @@ { "_type": "User", - "id": "54885fd6e782a7946271d03e", - "email": "thechuck329@norris.com", + "id": "5488621a42d43c8b0b302732", + "email": "thechuck562@norris.com", "name": "Chuck Norris", "is_admin": true, - "user_url": "https://api-staging.anyfetch.com/users/54885fd6e782a7946271d03e" + "user_url": "https://api-staging.anyfetch.com/users/5488621a42d43c8b0b302732" } \ No newline at end of file