Skip to content

Commit 4c92400

Browse files
committed
Merge branch 'release-5.0.0'
2 parents eb6833f + 9ec0a4b commit 4c92400

73 files changed

Lines changed: 5452 additions & 3193 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ cache:
44
- node_modules
55
notifications:
66
email: false
7+
slack:
8+
secure: jnmTBfHGzU4rR9RAVsRmwMI3Rdul5PEKioh2oIsWv245DQrqr5DIwEONPRMsCbs1Duk69jiQFAzfLgzjtOjHleac79p0076pSxaG2zXNyzgya5YBMgYv6wrFh9eNZJoXyMvDw8jcipbRbx/Xp05aayClY39BJ7UUFlklvIeFb5wFqRfIlVXbLu5MFFatwCzB1IOeSeD90ZTX9VsWw97SJoJdta5gn7dx0P06SStPSJNOrLmV1/aXrSorBYmeTNJgUWPg4zHanocll8b7TR1a8Iyc5JBip0tEUpf1vJOMb/7bMdmNJ1XL8rzWw/87JujuzdOKikrsi52fzHE70TgsEBf0+BkwtFK2SzRvrwIKVesjj+ek/E2P1gal2qeqDVLVGZYuKAqbigv/0r6MHDcqJLoWb9MGHTLgcobZOfX3+UZetIc8dDA9/yme1auC8efrD4LOdo4Glhf6EZP4xCFUJpZive3VCKQfg/sMBaWAMWY508cxV+ey+fucV8fEqIsZHNPv7mCWoeMc5PnMd5TlR49UDgNrq0xcS8q2n9EKdZZARdsnqwdpmwJ3Ygd3gPsQTdYKsIBUxEoQKhMycO1XaqkbcUSHi8nSw85775cdEUscEob01WRN7D9IX7sGGp3LksFeR1CtjigBtMM9gHwmODUcPmcD+YRPYnnquoGzV9I=
79
node_js:
8-
- '8.9.4'
9-
- '6.11.1'
10+
- '8'
11+
- '10'
12+
- 'lts/*'
1013
before_script:
1114
- npm prune
1215
branches:

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [5.0.0] (2019-06-20)
8+
9+
### BREAKING CHANGES
10+
11+
The way API clients are internally stored has changed. After upgrading to 5.0.0, existing clients must be migrated. See https://docs.dadi.cloud/api/5.0#migrating-from-version-4-to-5 for more information.
12+
13+
### Added
14+
15+
- [#532](https://github.com/dadi/api/pull/532): add new endpoints for document versioning
16+
- [#533](https://github.com/dadi/api/pull/533): compress responses using gzip
17+
- [#538](https://github.com/dadi/api/pull/538): add global search endpoint and various improvements to search
18+
- [#547](https://github.com/dadi/api/pull/547): add support for ETag and If-None-Match headers
19+
20+
### Changed
21+
22+
- [#534](https://github.com/dadi/api/pull/534): hash client secrets
23+
24+
### Fixed
25+
26+
- [#539](https://github.com/dadi/api/issues/539): "false" filter on Boolean fields
27+
- [#553](https://github.com/dadi/api/pull/553): add default value for index keys
28+
- [#558](https://github.com/dadi/api/pull/558): make Media field output document IDs as String
29+
730
## [4.4.5] (2019-01-24)
831

932
### Fixed

config.js

Lines changed: 87 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,38 @@ var conf = convict({
1111
},
1212
publicUrl: {
1313
host: {
14-
doc: 'The host of the URL where the API instance can be publicly accessed at',
14+
doc:
15+
'The host of the URL where the API instance can be publicly accessed at',
1516
format: '*',
1617
default: null,
1718
env: 'URL_HOST'
1819
},
1920
port: {
20-
doc: 'The port of the URL where the API instance can be publicly accessed at',
21+
doc:
22+
'The port of the URL where the API instance can be publicly accessed at',
2123
format: '*',
2224
default: null,
2325
env: 'URL_PORT'
2426
},
2527
protocol: {
26-
doc: 'The protocol of the URL where the API instance can be publicly accessed at',
28+
doc:
29+
'The protocol of the URL where the API instance can be publicly accessed at',
2730
format: 'String',
2831
default: 'http',
2932
env: 'URL_PROTOCOL'
3033
}
3134
},
3235
server: {
3336
host: {
34-
doc: 'Accept connections on the specified address. If the host is omitted, the server will accept connections on any IPv6 address (::) when IPv6 is available, or any IPv4 address (0.0.0.0) otherwise.',
37+
doc:
38+
'Accept connections on the specified address. If the host is omitted, the server will accept connections on any IPv6 address (::) when IPv6 is available, or any IPv4 address (0.0.0.0) otherwise.',
3539
format: '*',
3640
default: null,
3741
env: 'HOST'
3842
},
3943
port: {
40-
doc: 'Accept connections on the specified port. A value of zero will assign a random port.',
44+
doc:
45+
'Accept connections on the specified port. A value of zero will assign a random port.',
4146
format: Number,
4247
default: 8081,
4348
env: 'PORT'
@@ -79,14 +84,16 @@ var conf = convict({
7984
env: 'SSL_INTERMEDIATE_CERTIFICATE_PATH'
8085
},
8186
sslIntermediateCertificatePaths: {
82-
doc: 'The filenames of SSL intermediate certificates, overrides sslIntermediateCertificate (singular)',
87+
doc:
88+
'The filenames of SSL intermediate certificates, overrides sslIntermediateCertificate (singular)',
8389
format: Array,
8490
default: [],
8591
env: 'SSL_INTERMEDIATE_CERTIFICATE_PATHS'
8692
}
8793
},
8894
datastore: {
89-
doc: 'The name of the npm module that implements the data connector used for storing documents',
95+
doc:
96+
'The name of the npm module that implements the data connector used for storing documents',
9097
format: String,
9198
default: '@dadi/api-mongodb'
9299
},
@@ -107,7 +114,8 @@ var conf = convict({
107114
default: 'YOU-MUST-CHANGE-ME!'
108115
},
109116
accessCollection: {
110-
doc: 'The name of the internal collection used to store aggregate permissions data',
117+
doc:
118+
'The name of the internal collection used to store aggregate permissions data',
111119
format: String,
112120
default: 'accessStore'
113121
},
@@ -122,7 +130,8 @@ var conf = convict({
122130
default: 'roleStore'
123131
},
124132
datastore: {
125-
doc: 'The name of the npm module that implements the data connector used for authentication',
133+
doc:
134+
'The name of the npm module that implements the data connector used for authentication',
126135
format: String,
127136
default: '@dadi/api-mongodb'
128137
},
@@ -131,34 +140,52 @@ var conf = convict({
131140
format: String,
132141
default: 'test',
133142
env: 'DB_AUTH_NAME'
143+
},
144+
hashSecrets: {
145+
doc: 'Whether to hash client secrets',
146+
format: Boolean,
147+
default: true
148+
},
149+
saltRounds: {
150+
doc: 'The number of rounds to go through when hashing a password',
151+
format: Number,
152+
default: 10
134153
}
135154
},
136155
search: {
156+
database: {
157+
doc:
158+
'The name of the database to use for storing and querying indexed documents',
159+
format: String,
160+
default: 'search',
161+
env: 'DB_SEARCH_NAME'
162+
},
163+
datastore: {
164+
doc: 'The datastore to use for storing and querying indexed documents',
165+
format: String,
166+
default: ''
167+
},
137168
enabled: {
138169
doc: 'If true, API responds to collection /search endpoints',
139170
format: Boolean,
140171
default: false
141172
},
173+
indexCollection: {
174+
doc:
175+
'The name of the datastore collection that will hold the index of word matches',
176+
format: String,
177+
default: 'searchIndex'
178+
},
142179
minQueryLength: {
143180
doc: 'Minimum search string length',
144181
format: Number,
145182
default: 3
146183
},
147184
wordCollection: {
148-
doc: 'The name of the datastore collection that will hold tokenized words',
149-
format: String,
150-
default: 'words'
151-
},
152-
datastore: {
153-
doc: 'The datastore to use for storing and querying indexed documents',
154-
format: String,
155-
default: '@dadi/api-mongodb'
156-
},
157-
database: {
158-
doc: 'The name of the database to use for storing and querying indexed documents',
185+
doc:
186+
'The name of the datastore collection that will hold tokenized words',
159187
format: String,
160-
default: 'search',
161-
env: 'DB_SEARCH_NAME'
188+
default: 'searchWords'
162189
}
163190
},
164191
caching: {
@@ -196,7 +223,8 @@ var conf = convict({
196223
},
197224
redis: {
198225
enabled: {
199-
doc: 'If enabled, cache files will be saved to the specified Redis server',
226+
doc:
227+
'If enabled, cache files will be saved to the specified Redis server',
200228
format: Boolean,
201229
default: false,
202230
env: 'REDIS_ENABLED'
@@ -249,7 +277,8 @@ var conf = convict({
249277
},
250278
accessLog: {
251279
enabled: {
252-
doc: 'If true, HTTP access logging is enabled. The log file name is similar to the setting used for normal logging, with the addition of "access". For example `api.access.log`.',
280+
doc:
281+
'If true, HTTP access logging is enabled. The log file name is similar to the setting used for normal logging, with the addition of "access". For example `api.access.log`.',
253282
format: Boolean,
254283
default: true
255284
},
@@ -290,14 +319,16 @@ var conf = convict({
290319
default: false
291320
},
292321
routes: {
293-
doc: 'An array of routes to test. Each route object must contain properties `route` and `expectedResponseTime`.',
322+
doc:
323+
'An array of routes to test. Each route object must contain properties `route` and `expectedResponseTime`.',
294324
format: Array,
295325
default: []
296326
}
297327
},
298328
query: {
299329
useVersionFilter: {
300-
doc: 'If true, the API version parameter is extracted from the request URL and passed to the database query',
330+
doc:
331+
'If true, the API version parameter is extracted from the request URL and passed to the database query',
301332
format: Boolean,
302333
default: false
303334
}
@@ -319,7 +350,8 @@ var conf = convict({
319350
default: 'catboat-beatific-drizzle'
320351
},
321352
tokenExpiresIn: {
322-
doc: 'The duration a signed token is valid for. Expressed in seconds or a string describing a time span (https://github.com/zeit/ms). Eg: 60, "2 days", "10h", "7d"',
353+
doc:
354+
'The duration a signed token is valid for. Expressed in seconds or a string describing a time span (https://github.com/zeit/ms). Eg: 60, "2 days", "10h", "7d"',
323355
format: '*',
324356
default: '1h'
325357
},
@@ -334,19 +366,22 @@ var conf = convict({
334366
default: 'workspace/media'
335367
},
336368
pathFormat: {
337-
doc: 'Determines the format for the generation of subdirectories to store uploads',
369+
doc:
370+
'Determines the format for the generation of subdirectories to store uploads',
338371
format: ['none', 'date', 'datetime', 'sha1/4', 'sha1/5', 'sha1/8'],
339372
default: 'date'
340373
},
341374
s3: {
342375
accessKey: {
343-
doc: 'The access key used to connect to an S3-compatible storage provider',
376+
doc:
377+
'The access key used to connect to an S3-compatible storage provider',
344378
format: String,
345379
default: '',
346380
env: 'AWS_S3_ACCESS_KEY'
347381
},
348382
secretKey: {
349-
doc: 'The secret key used to connect to an S3-compatible storage provider',
383+
doc:
384+
'The secret key used to connect to an S3-compatible storage provider',
350385
format: String,
351386
default: '',
352387
env: 'AWS_S3_SECRET_KEY'
@@ -378,12 +413,14 @@ var conf = convict({
378413
arg: 'node_env'
379414
},
380415
cluster: {
381-
doc: 'If true, API runs in cluster mode, starting a worker for each CPU core',
416+
doc:
417+
'If true, API runs in cluster mode, starting a worker for each CPU core',
382418
format: Boolean,
383419
default: false
384420
},
385421
cors: {
386-
doc: 'If true, responses will include headers for cross-domain resource sharing',
422+
doc:
423+
'If true, responses will include headers for cross-domain resource sharing',
387424
format: Boolean,
388425
default: true
389426
},
@@ -394,7 +431,8 @@ var conf = convict({
394431
},
395432
databaseConnection: {
396433
maxRetries: {
397-
doc: 'The maximum number of times to reconnection attempts after a database fails',
434+
doc:
435+
'The maximum number of times to reconnection attempts after a database fails',
398436
format: Number,
399437
default: 10
400438
}
@@ -422,6 +460,20 @@ var conf = convict({
422460
format: Boolean,
423461
default: true
424462
}
463+
},
464+
workQueue: {
465+
debounceTime: {
466+
doc:
467+
'The amount of idle time (in ms) required for the work queue to start a background job',
468+
format: Number,
469+
default: 500
470+
},
471+
pollingTime: {
472+
doc:
473+
'The interval (in ms) at which the work queue checks for new background jobs',
474+
format: Number,
475+
default: 200
476+
}
425477
}
426478
})
427479

@@ -430,7 +482,7 @@ var env = conf.get('env')
430482
conf.loadFile('./config/config.' + env + '.json')
431483

432484
// Load domain-specific configuration
433-
conf.updateConfigDataForDomain = function (domain) {
485+
conf.updateConfigDataForDomain = function(domain) {
434486
var domainConfig = './config/' + domain + '.json'
435487

436488
try {
@@ -447,6 +499,6 @@ conf.updateConfigDataForDomain = function (domain) {
447499
}
448500

449501
module.exports = conf
450-
module.exports.configPath = function () {
502+
module.exports.configPath = function() {
451503
return './config/config.' + conf.get('env') + '.json'
452504
}

config/config.test.json.sample

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,9 @@
5656
},
5757
"feedback": false,
5858
"cors": false,
59-
"cluster": false
59+
"cluster": false,
60+
"workQueue": {
61+
"debounceTime": 0,
62+
"pollingTime": 0
63+
}
6064
}

0 commit comments

Comments
 (0)