UNPKG

29.6 kBMarkdownView Raw
1# Change Log
2All notable changes to this project will be documented in this file.
3
4The format is based on [Keep a Changelog](http://keepachangelog.com/)
5and this project adheres to [Semantic Versioning](http://semver.org/).
6
7## [4.1.0] (2018-08-01)
8
9### Added
10
11Two new features in this version of API, see https://docs.dadi.cloud/api for full details:
12
13- Multi-language support
14- Document indexing and Search
15
16## [4.0.4] (2018-07-30)
17
18### Fixed
19
20- [#469](https://github.com/dadi/api/issues/469): fix issue where querying String fields with a `$ne` operator causes the request to hang
21
22## [4.0.3] (2018-07-27)
23
24### Fixed
25
26- [#466](https://github.com/dadi/api/issues/466): allow processing of multiple image upload requests
27
28## [4.0.2] (2018-07-26)
29
30### Fixed
31
32- [#463](https://github.com/dadi/api/issues/463): fix issue with API version numbers containing a dot (`.`) when using the MongoDB data connector
33
34## [4.0.1] (2018-07-18)
35
36### Fixed
37
38- [#457](https://github.com/dadi/api/issues/457): reinstate `slug` property in /api/collections endpoint
39- [#460](https://github.com/dadi/api/pull/460): use correct permissions and status code when a role is revoked from a client
40
41## [4.0.0] (2018-07-11)
42
43### Added
44
45- [#396](https://github.com/dadi/api/issues/396): add access control list (see https://docs.dadi.cloud/api/4.0#authorisation-and-permissions)
46- [#449](https://github.com/dadi/api/pull/449): remove `/config` endpoints
47
48### Changed
49
50- [#438](https://github.com/dadi/api/issues/438): make CORS enabled by default
51- [#447](https://github.com/dadi/api/pull/447): adds an additional content type check when determining if the current request should be parsed by the JSON parsing middleware
52
53### BREAKING CHANGES
54
55#### Access control list
56
57The main change from version 3 to 4 is the introduction of the [access control list](https://docs.dadi.cloud/api/4.0#authorisation-and-permissions). It's technically a breaking change, since any clients without `{"accessType": "admin"}` will lose access to everything by default. They need to be assigned permissions for the individual resources they should be able to access, either directly or via roles.
58
59If you don't want to use the new advanced permissions and instead keep your clients with unrestricted access to API resources, make sure to set `{"accessType": "admin"}` in their database records. API doesn't currently offer a way to change this property via the endpoints, so you'll need to manually make this change in the database.
60
61#### Removal of write mode on configuration endpoints
62
63Version 4 removes the ability for clients to create, modify and delete collections, custom endpoints or update the main API configuration. The *read* endpoints were kept – e.g. `GET /api/config` is valid, but `POST /api/config` is not.
64
65#### Other breaking changes
66
67- Requesting a document by ID (e.g. `/version/database/collection/doc123456`) now returns a 404 if the given ID does not correspond to a valid document, instead of returning a 200 with an empty result set. This behaviour is consistent with the `DELETE` and `PUT` verbs.
68
69## [3.2.1] (2018-06-13)
70
71### Changed
72
73* [#435](https://github.com/dadi/api/issues/435): Fix issue where filtering `Object` fields with nested queries would return a 400 error.
74
75## [3.2.0] (2018-06-08)
76
77See release notes at https://github.com/dadi/api/releases/tag/v3.2.0
78
79### Added
80
81* [#431](https://github.com/dadi/api/pull/431): allow DELETE requests to media collection endpoints; enable `s3.endpoint` in the configuration to allow using Digital Ocean Spaces as a storage handler.
82
83## [3.1.2] (2018-05-01)
84
85### Changed
86
87* [#417](https://github.com/dadi/api/pull/417): Fix issue where `Reference` fields pointing to the media collection were not fully resolved.
88
89## [3.1.1] (2018-04-13)
90
91### Changed
92
93* [#413](https://github.com/dadi/api/pull/413): Pass `req` object to hooks.
94
95## [3.1.0-rc1] (2018-04-06)
96
97### Added
98
99* [#157](https://github.com/dadi/api/issues/157): Documents in Reference fields are now resolved multiple times if `settings.strictCompose` is set to `true`
100* [#177](https://github.com/dadi/api/issues/177): Model API now supports Promises and named parameters. old syntax is retained for backward-compatibility.
101* [#329](https://github.com/dadi/api/issues/329): Fields in referenced documents can now be specified using dot-notation in the existing `fields` parameter.
102* [#336](https://github.com/dadi/api/issues/336): A Reference field can now reference documents from multiple collections.
103* [#406](https://github.com/dadi/api/pull/406): Introduced handshake function to ensure compatibility of versions between API core and data connectors.
104
105### Changed
106
107* [#196](https://github.com/dadi/api/issues/196) and [#323](https://github.com/dadi/api/issues/323): Added field modules to encapsulate field-specific logic.
108* [#300](https://github.com/dadi/api/issues/300): `_createdAt` and `_lastModifiedAt` internal fields are now appended to documents in the Model class.
109* [#371](https://github.com/dadi/api/issues/371) and [#384](https://github.com/dadi/api/issues/384): Make defaults paths relative to the parent app, not the module.
110* [#390](https://github.com/dadi/api/issues/390): Falsy values of Reference fields are now ignored, preserving the behavior of any other Reference fields in the document.
111* [#394](https://github.com/dadi/api/issues/394): New DateTime field module now stores values as Unix timestamps and allows queries to be performed using any date format.
112* [#405](https://github.com/dadi/api/pull/405): Lock down major version of `@dadi/logger`.
113
114## [3.0.0] (2017-12-05)
115
116See full release notes at https://github.com/dadi/api/releases/tag/v3.0.0
117
118### Added
119
120#### Data Connectors
121
122API Version 3.0 supports multiple data connectors. In previous versions API used MongoDB as a backend; this is now configurable. API Data Connectors are available as NPM packages. To add one to your API installation, run the associated NPM install command:
123
124`$ npm install @dadi/api-mongodb --save`
125
126Each data connector has it's own configuration requirements, but API must also be configured to use the data connectors you select. Modify your API configuration as follows:
127
128```json
129{
130 "datastore": "@dadi/api-mongodb", // the NPM package name for the data connector to use for the content layer
131 "auth": {
132 "tokenUrl": "/token",
133 "tokenTtl": 1800,
134 "clientCollection": "clientStore",
135 "tokenCollection": "tokenStore",
136 "datastore": "@dadi/api-mongodb", // the NPM package name for the data connector to use for the authentication layer
137 "database": "test"
138 }
139}
140```
141
142In addition, the data connector itself normally requires it's own configuration file. For example the MongoDB data connector requires a file using the following naming convention `mongodb.<environment>.json`. These configuration files should be placed the `config` directory of the API application.
143
144#### Connection Recovery
145
146API is now capable of recovering from database connection failures. When API is started with no available database service it will keep retrying until a successful connection can be made, then it runs the normal boot process.
147
148In addition, if the database connection is lost during normal operation of API, any requests made while the connection is offline will result in a HTTP 503 returned to the client.
149
150The maximum number of connection retries can be configured in the main configuration file by adding the following block:
151
152```json
153"databaseConnection": {
154 "maxRetries": 5 // default 10
155}
156```
157
158### Changed
159
160* New startup message displayed, with links to documentation
161* [#141](https://github.com/dadi/api/issues/141): the internal fields will be prefixed with a special character (`_` by default) which is configurable using the configuration property `internalFieldsPrefix`
162* [#180](https://github.com/dadi/api/issues/180): document properties with `null` values are not returned as part of the response
163* [#251](https://github.com/dadi/api/issues/251): added a new `/hello` endpoint which returns HTTP 200 and a "Welcome to API" message
164* [#263](https://github.com/dadi/api/issues/263): all delete hooks now receive a `deletedDocs` property
165* [#314](https://github.com/dadi/api/issues/314): when configuration option `feedback` is `true` we now send a response body when deleting documents
166* [#327](https://github.com/dadi/api/issues/327): API becomes capable of recovering from database connection failures
167* [#328](https://github.com/dadi/api/issues/328): remove schema validation on settings: 'callback', 'defaultFilters', 'fieldLimiters' and 'count'. Now only requires 'cache' and 'authenticate'
168* [#332](https://github.com/dadi/api/issues/332): allow POST to collection endpoints using `text/plain` content-type, which will be converted if it is valid JSON
169* Configuration file validation removed, suppressing warnings on application startup
170* POST/PUT/DELETE using non-existing document identifiers returns a 404:
171
172DELETE requests throws a 404 (instead of 204) when deleting a non-existing document by ID. This applies to requests where the document ID is passed in the URL, not when in the body (e.g. DELETE /v1/db/collection/DOC-ID vs DELETE /v1/db/collection).
173
174POST/PUT requests throw a 404 when updating a non-existing document by ID. This applies to requests where the document ID is passed in the URL, not when in the body (e.g. PUT /v1/db/collection/DOC-ID vs PUT /v1/db/collection).
175
176Closes [#345](https://github.com/dadi/api/issues/345).
177
178## [2.2.9] (2017-12-05)
179
180### Changed
181
182Fix previous release 2.2.8: [#363](https://github.com/dadi/api/issues/363): allow OPTIONS method when calling the token route
183
184## [2.2.8] (2017-12-04)
185
186### Changed
187
188[#363](https://github.com/dadi/api/issues/363): allow OPTIONS method when calling the token route
189
190## [2.2.0] (2017-07-05)
191
192### Changed
193
194[#289](https://github.com/dadi/api/issues/289): improved error response from hooks, with custom error support
195[#311](https://github.com/dadi/api/issues/311): fix a bug that caused multiple newly-created reference field subdocuments to be returned as a poorly-formed array
196
197## [2.1.2] (2017-06-29)
198
199### Changed
200
201[#289](https://github.com/dadi/api/issues/289): improved error response from hooks
202[#305](https://github.com/dadi/api/issues/305): remove restriction on environment settings. Use any environment name and configuration file, rather than only "development", "qa", "production", "test"
203[#306](https://github.com/dadi/api/issues/306): fix reference field composition when value is an empty array
204
205## [2.1.0] (2017-05-29)
206
207### Added
208
209* [#298](https://github.com/dadi/api/issues/298): documents to be deleted will first have the current state written into the history collection, if enabled
210
211### Changed
212
213* add additional property `action` to history revision documents. Possible values are "update", "delete" and the appropriate value is selected when updating/deleting records
214* add additional property `originalDocumentId` to history revision documents, value is the identifier of the parent document.
215
216## [2.0.0] (2017-05-29)
217
218### Changed
219
220#### Upgraded MongoDB driver
221Upgrade MongoDB driver to 2.2.x, from the existing 1.4.x version.
222
223#### Fixed `create-client` script
224 * use correct `accessType` property in client store documents
225 * abort if chosen clientId exists already
226
227#### Generate new documents from a pre-composed document
228
229It is now possible to send API a full document containing pre-composed Reference fields. API will translate such a request into individual documents for the relevant collections. This functionality reduces the number of API calls that must be made from an application when inserting data.
230
231##### For example
232
233Assume we have two collections, `people` and `cars`. `cars` is a Reference field within the `people` collection schema. Given the following body in a POST request to `/1.0/car-club/people`:
234
235```json
236{
237 "name": "Joe",
238 "cars": [
239 {
240 "model": "Lamborghini Diablo",
241 "year": 1991
242 }
243 ]
244}
245```
246
247API will automatically create new documents in the `cars` collection and use the new identifier value in the `people` document. The final `people` document would look similar to this:
248
249```json
250{
251 "name": "Joe",
252 "cars": [
253 "587cb6aa80222c9e7266cec0"
254 ]
255}
256```
257
258
259#### Media collections
260This version introduces a few changes to how media is handled by API.
261
262The concept of media collections has been abstracted from the public API. It removes the requirement for a collection schema, instead using a schema kept internally in API. At the moment it's hardcoded to store images (containing dimensions, size, mime type, etc.), but in the future we will look into making the schema adapt to the type of file being uploaded.
263
264##### Endpoints
265
266| Method | Endpoint | Purpose | Example
267|:-|:---|:----|:--
268| POST |`/media/sign`| Requesting a signed URL for a media upload| |
269| POST |`/media/:signedUrl`|Uploading a media asset ||
270| GET | `/media`|Listing media assets ||
271| GET | `/media/:assetPath`|Access a specific media asset | `/media/2017/04/27/flowers.jpg`
272
273#### Media buckets
274
275Even though that's abstracted from the end user, assets still need to be stored in collections. Assets POSTed to /media will be stored in a `mediaStore` collection (configurable via the `media.defaultBucket` configuration parameter). It is also possible to add additional "media buckets", configured as an array in the `media.buckets` configuration parameter.
276
277##### Endpoints
278
279Here are the same media collection endpoints for interacting with a media bucket called `mediaAvatars`:
280
281| Method | Endpoint | Purpose | Example
282|:-|:---|:----|:--
283| POST |`/media/mediaAvatars/sign`| Requesting a signed URL for a media upload| |
284| POST |`/media/mediaAvatars/:signedUrl`|Uploading a media asset ||
285| GET | `/media/mediaAvatars`|Listing media assets ||
286| GET | `/media/mediaAvatars/:assetPath`|Access a specific media asset | `/media/mediaAvatars/2017/04/27/flowers.jpg`
287
288#### Naming conflicts
289
290If there is a data collection with the same name as one of the media buckets, API throws an error detailing the name of the conflicting collection.
291
292#### Discovering media buckets
293
294Added information about media buckets to the /api/collections endpoint, indicating a list of the available media buckets as well as the name of the default one.
295
296```
297GET /api/collections
298```
299
300```json
301{
302 "collections": [
303 {
304 "version": "1.0",
305 "database": "library",
306 "name": "Articles",
307 "slug": "articles",
308 "path": "/1.0/library/articles"
309 },
310 {
311 "version": "1.0",
312 "database": "library",
313 "name": "Books",
314 "slug": "books",
315 "path": "/1.0/library/books"
316 }
317 ],
318 "media": {
319 "buckets": [
320 "authorImages",
321 "mediaStore"
322 ],
323 "defaultBucket": "mediaStore"
324 }
325}
326```
327
328#### Add `url` property to media documents
329Instead of replacing the contents of `path`, leave that as it is and write the full URL to a new property called `url`.
330
331```json
332"image": {
333 "_id": "591b5f29795b683664af01e9",
334 "fileName": "3RdYMTLoL1X16djGF52cFtJovDT.jpg",
335 "mimetype": "image/jpeg",
336 "width": 600,
337 "height": 900,
338 "contentLength": 54907,
339 "path": "/media/2017/05/16/3RdYMTLoL1X16djGF52cFtJovDT-1494966057926.jpg",
340 "createdAt": 1494966057685,
341 "createdBy": null,
342 "v": 1,
343 "url": "http://localhost:5000/media/2017/05/16/3RdYMTLoL1X16djGF52cFtJovDT-1494966057926.jpg"
344}
345```
346
347#### Hook configuration endpoints
348
349Extended the hooks config endpoint (`/api/hooks/:hookName/config`) to accept POST, PUT and DELETE requests to create, update and delete hooks, respectively.
350
351#### Other
352
353* [#245](https://github.com/dadi/api/issues/245): fix media path formatting
354* [#246](https://github.com/dadi/api/issues/246): ignore _id field in query when processing query filters
355* [#257](https://github.com/dadi/api/issues/257): improve performance of Reference field composition
356* [#265](https://github.com/dadi/api/issues/265): validate arrays against schemas in POST requests
357* [#284](https://github.com/dadi/api/issues/284): check indexes correctly when given a sort key
358* remove `apiVersion` query property when composing reference fields, improves performance
359
360### Added
361
362#### MongoDB readPreference configuration
363Added `readPreference` configuration option. Default is `secondaryPreferred`. Closed [#156](https://github.com/dadi/api/issues/156)
364
365```json
366"database": {
367 "hosts": [
368 {
369 "host": "127.0.0.1",
370 "port": 27017
371 }
372 ],
373 "username": "",
374 "password": "",
375 "database": "api",
376 "ssl": false,
377 "replicaSet": "",
378 "enableCollectionDatabases": false,
379 "readPreference": "primary"
380}
381```
382
383#### API baseUrl
384
385We've introduced a `server.baseUrl` configuration parameter, which will be used to determine the URL of media assets when using the disk storage option.
386
387```json
388"baseUrl": {
389 "protocol": "http",
390 "port": 80,
391 "host": "mydomain.com"
392}
393```
394
395
396#### Post install script
397
398Added a post install script which runs following an install of API from NPM. A development configuration file is created along with a basic workspace directory containing two collections, an endpoint and a hook. No files are overwritten if the config and workspace directories already exist.
399
400## [1.16.6] (2017-05-25)
401
402### Changed
403* improved check within composer module that ignores "undefined" values as well as "null"
404
405## [1.16.5] (2017-05-12)
406
407### Changed
408* [#260](https://github.com/dadi/api/issues/260): change media collection type to "mediaCollection"
409
410## [1.16.4] (2017-05-12)
411
412### Changed
413* [#211](https://github.com/dadi/api/issues/211): fix composition so it doesn't return before all fields have been composed
414
415## [1.15.5] (2017-03-30)
416
417### Changed
418* [#226](https://github.com/dadi/api/issues/226): historyFilters corrupt model filters
419
420## [1.15.4] (2017-02-15)
421
422### Changed
423* pass auth indicator to connection ([1d3ebed](https://github.com/dadi/api/commit/1d3ebed))
424
425
426## [1.15.3] (2017-02-15)
427
428### Changed
429
430* [#200](https://github.com/dadi/api/issues/200): explicitly add "node" command to create-client script ([8394355](https://github.com/dadi/api/commit/8394355))
431
432
433## [1.15.2] (2017-01-31)
434
435### Changed
436
437* select non-null fields for composition ([21e48bf](https://github.com/dadi/api/commit/21e48bf))
438
439## [1.15.1] (2017-01-23)
440
441### Changed
442
443* revert mongodb version to allow full 1.4 range ([0d2398c](https://github.com/dadi/api/commit/0d2398c))
444
445## [1.15.0] (2017-01-18)
446
447### Added
448
449* add busboy dependency ([3eda9fe](https://github.com/dadi/api/commit/3eda9fe))
450* add configurable media collection name ([c038a58](https://github.com/dadi/api/commit/c038a58))
451* add error handling to remaining hook types ([79df695](https://github.com/dadi/api/commit/79df695))
452* add redirectPort to config ([e1d6c58](https://github.com/dadi/api/commit/e1d6c58))
453* add Redis cache tests back after a long time in exile ([5f3618e](https://github.com/dadi/api/commit/5f3618e))
454* improve SSL handling ([80073eb](https://github.com/dadi/api/commit/80073eb))
455* move media upload to new controller ([12cd39c](https://github.com/dadi/api/commit/12cd39c))
456
457### Changed
458
459* [#164](https://github.com/dadi/api/issues/164): use platform agnostic approach to directory separators ([d4e49b2](https://github.com/dadi/api/commit/d4e49b2))
460* add current year to copyright notice ([1e5be89](https://github.com/dadi/api/commit/1e5be89))
461* missing dependencies ([3a4dd51](https://github.com/dadi/api/commit/3a4dd51))
462* remove unnecessary escape chars ([73aad00](https://github.com/dadi/api/commit/73aad00))
463* remove unused variable ([4b741e3](https://github.com/dadi/api/commit/4b741e3))
464* resolve ObjectIDs in batch delete query ([3d407f9](https://github.com/dadi/api/commit/3d407f9))
465* send error response if path not specified ([c14edf2](https://github.com/dadi/api/commit/c14edf2))
466* use platform agnostic path separator ([cfec695](https://github.com/dadi/api/commit/cfec695))
467
468
469## [1.14.1] (2016-12-28)
470### Changed
471* [#164](https://github.com/dadi/api/issues/164): Modified collection and endpoint loading to use the current platform's directory separator, rather than assuming '/', which fails under Windows.
472
473
474## [1.14.0] (2016-11-10)
475### Added
476* Added a `matchType` property to fields in collection schemas. Determines the type of match allowed when querying using this field. Possible values:
477
478|Value | Behaviour
479|:---|:-----
480| "exact" | query will be performed using the exact value specified, e.g. { "publishedState": "published" }
481| "ignoreCase" | query will be performed using a case insensitive regex of the value specified, e.g. { "publishedState": /^published$/i }
482| "anything else" | query will be performed using a regex of the value specified, e.g. { "publishedState": /^published$/ }
483
484> **Note:** If `matchType` is not specified, the default (for legacy reasons) is _a case insensitive regex of the value specified_, e.g. { "publishedState": /^published$/i }
485
486* Added error handling to beforeCreate hooks. If an error is encountered while executing a beforeCreate hook, an error is returned in the response:
487
488```json
489{
490 "success": false,
491 "errors": [
492 {
493 "code": "API-0002",
494 "title": "Hook Error",
495 "details": "The hook 'myHook' failed: 'ReferenceError: title is not defined'",
496 "docLink": "http://docs.dadi.tech/api/errors/API-0002"
497 }
498 ]
499}
500```
501
502* Added environment variables for database configuration properties:
503
504|Property | Environment variable
505|:---|:-----
506|Database username| "DB_USERNAME"
507|Database password| "DB_PASSWORD"
508|Database name| "DB_NAME"
509|Auth database username| "DB_AUTH_USERNAME"
510|Auth database password| "DB_AUTH_PASSWORD"
511|Auth database name| "DB_AUTH_NAME"
512
513### Changed
514
515* Modified the model instantiation to wait a second if the database hasn't been connected yet. This avoids the error about maximum event listeners being added in the `createIndex` method.
516
517## [1.11.1] (2016-07-16)
518
519* no longer convert to ObjectID if the query is using dot notation and the parent field
520is of type `Mixed`. This supports legacy CMS use in some cases
521* remove the options when calling a collection's count endpoint, to ensure no
522`limit` parameter is sent
523
524## [1.11.0] (2016-07-14)
525
526### Batch delete of documents
527@eduardoboucas
528
529**Usage:**
530
531Method: DELETE
532URL: `http://api.example.com/1.0/fictional-magazine-brand/articles`
533
534Body:
535```
536{
537 "query": {
538 "title": {"$in": ["foo", "bar", "baz]}
539 }
540}
541```
542
543### Filter revision history and return specified fields
544@eduardoboucas
545
546The `includeHistory` param now respects the `fields` param, so that documents in history only contain the fields specified.
547
548Added: a `historyFilters` URL parameter, to be used in conjunction with `includeHistory`, which adds the option to have a filter specific to the documents in history, with the same syntax as the existing `filter`.
549
550This makes it possible to retrieve only the revisions where name is `Jim`:
551
552```
553http://api.example.com/1.0/fictional-magazine-brand/users/57866216acc4818e048efd36?includeHistory=true&historyFilters={"name":"Jim"}
554```
555
556Or get revisions between two dates:
557
558```
559http://api.example.com/1.0/fictional-magazine-brand/users/57866216acc4818e048efd36?includeHistory=true&historyFilters={"lastModifiedAt":{"$gte":1468424733361,"$lte":1468424737447}}
560```
561
562### Environment variables for sensitive data
563@dark12222000
564
565Configuration variables likely to contain sensitive data can now be set from environment variables, rather than committing this data to config files.
566
567Available variables:
568
569* NODE_ENV
570* HOST
571* PORT
572* REDIS_ENABLED
573* REDIS_HOST
574* REDIS_PORT
575* REDIS_PASSWORD
576* KINESIS_STREAM
577
578
579## [1.4.0] (2016-03-24)
580
581### Support for Hooks (beforeCreate, afterCreate, beforeUpdate, afterUpdate, beforeDelete, afterDelete).
582Provided by @eduardoboucas, many thanks for the hard work on this! Full documentation to be made available soon.
583
584### Breaking change: Endpoint Authentication
585
586The default setting is now 'must authenticate'. This means if you have custom endpoints
587that are currently open and you want them to stay that way, add this block to the JS file:
588
589```
590module.exports.model = {
591 settings: {
592 authenticate: false
593 }
594}
595```
596
597### Connection module
598
599Previously created connections for every loaded collection, resulting in a new connection pool
600for each collection. New behaviour is to create one connection per database - if you aren't
601using `enableCollectionDatabases` then this means you'll only be making one connection
602to the database.
603
604### Other
605* Fix #39. Apply apiVersion filter to query only if it's configured using the `useVersionFilter` property (ed1c1d8)
606* Fix #38. Allow Mixed fields through to the data query, giving back the power to use dot notation in the query (49a0a07)
607* Add timestamps to console log statements (018f4f2)
608* Modify API host and port requirements. `null` for host will allow connections on
609 any IPv6 address (if available), otherwise any IPv4 address. If port is `0` a random port will be assigned (3d5e0e0)
610* Add response to OPTIONS requests, thanks @eduardoboucas (969d808)
611* Add authentication on a per-HTTP method basis, thanks @eduardoboucas (a00b72c)
612* Use HTTP PUT for updates (also backwards-compatible with POST) (865e7f6)
613* Add WWW-Authenticate header to when sending HTTP 401 responses (4708020)
614* Add config settings for log file rotation (4e7e81d)
615* Add logging level to limit log records (e282e62)
616
617## [1.3.0] (2016-02-26)
618
619Fix #13: Removed auto-creation of API docs path (should only happen if api-doc module is installed)
620Close #14: Load domain-specific configuration if matching file exists
621Close #16: Check that generated auth token doesn't already exist, generate new one if it does
622Close #18: Validate `skip` & `page` parameters before calling `model.find()`
623Close #19: Database `replicaSet` property should be a String, not a Boolean
624Cache: add Redis caching ability and extend config to allow switching between filesystem and Redis caches
625Cache: locate endpoint matching the request URL using path-to-regex so we can be certain of a match
626---
627## [1.2.2] (2016-01-18)
628* Requests for paths containing `docs` skip authentication
629* Custom endpoints with JS comments in the head of the file will have those comments added to the global app object, making for more meaningful API documentation (with the use of npm package `dadi-apidoc`)
630
631## [1.2.1] (2016-01-13)
632
633* `Model.find()`
634 * convert simple string filters to ObjectID if they appear to be valid ObjectIDs
635
636## [1.2.0] (2016-01-06)
637
638* `Model.find()`
639 * collection setting `defaultFilters` now used when performing a GET request, in addition to filters passed in the querystring
640 * collection setting `fieldLimiters` now used when performing a GET request, in addition to fields passed in the querystring
641 * `skip` can be passed in the querystring to explicitly set an offset. The `skip` value is normally calculated using the `count` and `page` values, so if `count = 10` and `page = 2` then `skip` becomes `10` (i.e. `(page-1)*count`). If `skip` is specified in the querystring, this value is added to the calculated value to avoid overlapping records on subsequent pages.
642
643* Validation: the `limit` and `validationRule` schema properties have been deprecated in favour of the below. Not all rules are required, of course:
644
645 ```
646 validation: {
647 minLength: 1,
648 maxLength: 20,
649 regex: {
650 pattern: /^abc/
651 }
652 }
653 ```
654
655## v0.1.10 (2015-11-18)
656
657### Database
658
659* MongoDB Replica Set support
660* `create()` and `update()` operations return a `results` object the same as `find()`
661* Startup process now checks for existence of an index on the configured `tokenStore` collection: `{ 'token': 1,'tokenExpire': 1 }`
662* TTL index on the `tokenStore` collection is set to remove documents immediately after the `tokenExpire` value
663* Pass the API version from the querystring to the `find()` query
664* Collection-level databases are now fully enabled. A collection as `/1.0/reviews/articles` will use a `reviews` database. This mode is disabled by default and can be enabled within the database configuration section via the "enableCollectionDatabases" property:
665
666```
667 "database": {
668 "hosts": [
669 {
670 "host": "127.0.0.1",
671 "port": 27017
672 }
673 ],
674 "username": "",
675 "password": "",
676 "database": "serama",
677 "ssl": false,
678 "replicaSet": false,
679 "enableCollectionDatabases": true
680 }
681```
682
683
684### Collection Schema & Validation
685
686* Schema validation has been relaxed for update operations. Serama previously expected all required fields to be supplied in an update request, now it's fine to send only changed data
687* Fix to allow required Boolean fields to be set to false
688
689* removed references to /endpoints
690
691### Authentication & Authorisation
692
693* Add `created` field when creating new auth tokens to enable automatic removal by TTL index
694* Fixed support for client authorisation by API version, in case you need to restrict a set of users to a specific version of the API:
695
696```
697{
698 clientId: 'clientX',
699 secret: 'secret',
700 accessType: 'user',
701 permissions: {
702 collections: [ { apiVersion: "1.0", path: "test-collection" } ],
703 endpoints: [ { apiVersion: "1.0", path: "test-endpoint" } ]
704 }
705}
706```
707
708### Cache
709* Flush model cache on DELETE requests
710* added X-Cache and X-Cache-Lookup headers
711* added Server name header, default is `Bantam (Serama)`
712
713### Compose - Reference Fields
714* allow enabling compose by querystring
715* remove query parameters that don't exist in the model schema
716
717### Tests
718* check for existence of `test` database before continuing
719* use `test` database or `testdb` explicitly in some tests
720
\No newline at end of file