jsonapi-server
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -0,1 +1,5 @@ | ||
- 2017-11-14 - v4.1.0 | ||
- 2017-11-14 - New configuration option to disable automatic id generation. | ||
- 2017-11-14 - Update GraphQL dependencies to latest versions. | ||
- 2017-11-14 - Remove yarn lockfile. | ||
- 2017-11-03 - v4.0.0 | ||
@@ -2,0 +6,0 @@ - 2017-11-03 - Return error when a response item does not validate. |
@@ -100,1 +100,4 @@ | ||
If you look through the example json:api resources in the `/example/resources` folder things should become clearer. | ||
#### generateId | ||
By default, the server autogenerates a UUID for resources which are created without specifying an ID. To disable this behavior (for example, if the database generates an ID by auto-incrementing), set `generateId` to `false`. If the resource's ID is not a UUID, it is also necessary to specify an `id` attribute with the correct type. See `/examples/resorces/autoincrement.js` for an example of such a resource. |
@@ -104,3 +104,3 @@ 'use strict' | ||
resolvers.generateFilterQueryFromAst = ast => { | ||
const arrays = (ast.fieldASTs || []).map(function (fieldAST) { | ||
const arrays = (ast.fieldNodes || []).map(function (fieldAST) { | ||
return fieldAST.arguments || [ ] | ||
@@ -107,0 +107,0 @@ }) |
@@ -36,6 +36,4 @@ 'use strict' | ||
theirResource = _.assign( | ||
{ | ||
id: uuid.v4(), | ||
type: request.params.type | ||
}, | ||
{ type: request.params.type }, | ||
(request.resourceConfig.generateId !== false) && { id: uuid.v4() }, | ||
theirs.id && { id: theirs.id }, | ||
@@ -42,0 +40,0 @@ theirs.attributes, |
{ | ||
"name": "jsonapi-server", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "A config driven NodeJS framework implementing json:api", | ||
@@ -30,3 +30,3 @@ "keywords": [ | ||
"dependencies": { | ||
"async": "2.5.0", | ||
"async": "2.6.0", | ||
"body-parser": "1.18.2", | ||
@@ -36,5 +36,5 @@ "cookie-parser": "1.4.3", | ||
"express": "4.16.2", | ||
"express-graphql": "0.5.4", | ||
"graphql": "0.7.2", | ||
"joi": "10.6.0", | ||
"express-graphql": "0.6.11", | ||
"graphql": "0.11.7", | ||
"joi": "13.0.2", | ||
"lodash.assign": "4.2.0", | ||
@@ -53,3 +53,3 @@ "lodash.isequal": "4.5.0", | ||
"coveralls": "3.0.0", | ||
"eslint": "4.10.0", | ||
"eslint": "4.11.0", | ||
"eslint-config-standard": "10.2.1", | ||
@@ -60,3 +60,3 @@ "eslint-plugin-import": "2.8.0", | ||
"eslint-plugin-standard": "3.0.1", | ||
"jscpd": "0.6.15", | ||
"jscpd": "0.6.17", | ||
"lokka": "1.7.0", | ||
@@ -66,4 +66,4 @@ "lokka-transport-http": "1.6.1", | ||
"mocha-performance": "0.1.1", | ||
"nyc": "11.2.1", | ||
"swagger-tools": "0.9.11", | ||
"nyc": "11.3.0", | ||
"swagger-tools": "0.10.3", | ||
"v8-profiler": "5.7.0" | ||
@@ -70,0 +70,0 @@ }, |
@@ -204,2 +204,49 @@ 'use strict' | ||
}) | ||
describe('creates a resource with non-UUID ID', () => { | ||
let id | ||
it('works', done => { | ||
const data = { | ||
method: 'post', | ||
url: 'http://localhost:16006/rest/autoincrement', | ||
headers: { | ||
'Content-Type': 'application/vnd.api+json' | ||
}, | ||
body: JSON.stringify({ | ||
'data': { | ||
'type': 'autoincrement', | ||
'attributes': { | ||
'name': 'bar' | ||
} | ||
} | ||
}) | ||
} | ||
helpers.request(data, (err, res, json) => { | ||
assert.equal(err, null) | ||
json = helpers.validateJson(json) | ||
assert.equal(json.data.id, '2') | ||
assert.equal(res.headers.location, `http://localhost:16006/rest/autoincrement/${json.data.id}`) | ||
assert.equal(res.statusCode, '201', 'Expecting 201') | ||
assert.equal(json.data.type, 'autoincrement', 'Should be a autoincrement resource') | ||
id = json.data.id | ||
done() | ||
}) | ||
}) | ||
it('new resource is retrievable', done => { | ||
const url = `http://localhost:16006/rest/autoincrement/${id}` | ||
helpers.request({ | ||
method: 'GET', | ||
url | ||
}, (err, res, json) => { | ||
assert.equal(err, null) | ||
json = helpers.validateJson(json) | ||
assert.equal(res.statusCode, '200', 'Expecting 200 OK') | ||
assert.equal(json.included.length, 0, 'Should be no included resources') | ||
done() | ||
}) | ||
}) | ||
}) | ||
}) | ||
@@ -206,0 +253,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
109
498129
7034
5
+ Addedasync@2.6.0(transitive)
+ Addedexpress-graphql@0.6.11(transitive)
+ Addedgraphql@0.11.7(transitive)
+ Addedhoek@5.0.46.1.3(transitive)
+ Addedisemail@3.2.0(transitive)
+ Addediterall@1.1.3(transitive)
+ Addedjoi@13.0.2(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedtopo@3.0.3(transitive)
- Removedasync@2.5.0(transitive)
- Removedexpress-graphql@0.5.4(transitive)
- Removedgraphql@0.7.2(transitive)
- Removedisemail@2.2.1(transitive)
- Removeditems@2.2.1(transitive)
- Removediterall@1.0.2(transitive)
- Removedjoi@10.6.0(transitive)
- Removedtopo@2.1.1(transitive)
Updatedasync@2.6.0
Updatedexpress-graphql@0.6.11
Updatedgraphql@0.11.7
Updatedjoi@13.0.2