@coding-blocks/jsonapi-server
Advanced tools
Comparing version 3.2.3 to 3.2.4
@@ -0,1 +1,6 @@ | ||
- 2017-10-26 - v3.2.4 | ||
- 2017-10-26 - MemoryHandler supports autoincrement | ||
- 2017-10-26 - v3.2.3 | ||
- 2017-10-26 - Use integer autoincrement ID instead of UUID | ||
- 2017-10-26 - Forked from holidayextras to coding-blocks | ||
- 2017-10-21 - v3.2.2 | ||
@@ -2,0 +7,0 @@ - 2017-10-21 - Report coverage with Coveralls. |
@@ -156,9 +156,9 @@ ### Foreign Key Relations | ||
// get information about the linkage - list of ids and types | ||
self: "http://localhost:16006/rest/comments/6b017640-827c-4d50-8dcc-79d766abb408/relationships/author", | ||
self: "http://localhost:16006/rest/comments/1/relationships/author", | ||
// get full details of all linked resources | ||
related: "http://localhost:16006/rest/comments/6b017640-827c-4d50-8dcc-79d766abb408/author" | ||
related: "http://localhost:16006/rest/comments/1/author" | ||
}, | ||
data: { | ||
type: "people", | ||
id: "ad3aa89e-9c5b-4ac9-a652-6670f9f27587" | ||
id: "4" | ||
} | ||
@@ -176,5 +176,5 @@ }, | ||
// get information about the linkage - list of ids and types | ||
self: "http://localhost:16006/rest/articles/relationships/?comments=6b017640-827c-4d50-8dcc-79d766abb408", | ||
self: "http://localhost:16006/rest/articles/relationships/?comments=1", | ||
// get full details of all linked resources (perform a search against the foreign key) | ||
related: "http://localhost:16006/rest/articles/?filter[comments]=6b017640-827c-4d50-8dcc-79d766abb408" | ||
related: "http://localhost:16006/rest/articles/?filter[comments]=1" | ||
} | ||
@@ -181,0 +181,0 @@ } |
@@ -23,7 +23,7 @@ ### Creating Custom Handlers | ||
{ | ||
id: "aab14844-97e7-401c-98c8-0bd5ec922d93", | ||
id: "1", | ||
type: "photos", | ||
title: "Matrix Code", | ||
url: "http://www.example.com/foobar", | ||
photographer: { type: "people", id: "ad3aa89e-9c5b-4ac9-a652-6670f9f27587" } | ||
photographer: { type: "people", id: "4" } | ||
} | ||
@@ -102,6 +102,6 @@ ``` | ||
request.params.relationships = { | ||
user: "ad3aa89e-9c5b-4ac9-a652-6670f9f27587" | ||
user: "4" | ||
} | ||
``` | ||
translates to "Find me all of the resources whose user attribute is a link to a resource with id == ad3aa89e-9c5b-4ac9-a652-6670f9f27587". | ||
translates to "Find me all of the resources whose user attribute is a link to a resource with id == 4". | ||
@@ -108,0 +108,0 @@ #### find |
@@ -39,7 +39,7 @@ | ||
{ | ||
id: "aab14844-97e7-401c-98c8-0bd5ec922d93", | ||
id: 1, | ||
type: "photos", | ||
title: "Matrix Code", | ||
url: "http://www.example.com/foobar", | ||
photographer: { type: "people", id: "ad3aa89e-9c5b-4ac9-a652-6670f9f27587" } | ||
photographer: { type: "people", id: "4" } | ||
} | ||
@@ -49,2 +49,3 @@ ] | ||
``` | ||
The examples defined are seeded into the database/memory handler when the server starts. | ||
@@ -51,0 +52,0 @@ ### SearchParams |
@@ -44,3 +44,3 @@ 'use strict' | ||
{ | ||
id: 'de305d54-75b4-431b-adb2-eb6b9e546014', | ||
id: 1, | ||
type: 'articles', | ||
@@ -53,11 +53,11 @@ title: 'NodeJS Best Practices', | ||
type: 'people', | ||
id: 'cc5cca2e-0dd8-4b95-8cfc-a11230e73116', | ||
id: 1, | ||
meta: { updated: '2010-11-06' } | ||
}, | ||
tags: [ | ||
{ type: 'tags', id: '7541a4de-4986-4597-81b9-cf31b6762486' } | ||
{ type: 'tags', id: 1 } | ||
], | ||
photos: [ ], | ||
comments: [ | ||
{ type: 'comments', id: '3f1a89c2-eb85-4799-a048-6735db24b7eb' } | ||
{ type: 'comments', id: 2 } | ||
], | ||
@@ -69,3 +69,3 @@ meta: { | ||
{ | ||
id: '1be0913c-3c25-4261-98f1-e41174025ed5', | ||
id: 2, | ||
type: 'articles', | ||
@@ -76,9 +76,9 @@ title: 'Linux Rocks', | ||
views: 20, | ||
author: { type: 'people', id: 'd850ea75-4427-4f81-8595-039990aeede5' }, | ||
author: { type: 'people', id: 3 }, | ||
tags: [ | ||
{ type: 'tags', id: '2a3bdea4-a889-480d-b886-104498c86f69' } | ||
{ type: 'tags', id: 2 } | ||
], | ||
photos: [ | ||
{ type: 'photos', id: 'aab14844-97e7-401c-98c8-0bd5ec922d93' }, | ||
{ type: 'photos', id: '72695cbd-e9ef-44f6-85e0-0dbc06a269e8' } | ||
{ type: 'photos', id: 1 }, | ||
{ type: 'photos', id: 2 } | ||
], | ||
@@ -88,3 +88,3 @@ comments: [ ] | ||
{ | ||
id: 'd850ea75-4427-4f81-8595-039990aeede5', | ||
id: 3, | ||
type: 'articles', | ||
@@ -95,8 +95,8 @@ title: 'How to AWS', | ||
views: 30, | ||
author: { type: 'people', id: '32fb0105-acaa-4adb-9ec4-8b49633695e1' }, | ||
author: { type: 'people', id: 2 }, | ||
tags: [ | ||
{ type: 'tags', id: '8d196606-134c-4504-a93a-0d372f78d6c5' } | ||
{ type: 'tags', id: 5 } | ||
], | ||
photos: [ | ||
{ type: 'photos', id: 'aab14844-97e7-401c-98c8-0bd5ec922d93' } | ||
{ type: 'photos', id: 1 } | ||
], | ||
@@ -106,3 +106,3 @@ comments: [ ] | ||
{ | ||
id: 'fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5', | ||
id: 4, | ||
type: 'articles', | ||
@@ -113,12 +113,12 @@ title: 'Tea for Beginners', | ||
views: 40, | ||
author: { type: 'people', id: 'ad3aa89e-9c5b-4ac9-a652-6670f9f27587' }, | ||
author: { type: 'people', id: 4 }, | ||
tags: [ | ||
{ type: 'tags', id: '6ec62f6d-9f82-40c5-b4f4-279ed1765492' }, | ||
{ type: 'tags', id: '7541a4de-4986-4597-81b9-cf31b6762486' } | ||
{ type: 'tags', id: 3 }, | ||
{ type: 'tags', id: 1 } | ||
], | ||
photos: [ | ||
{ type: 'photos', id: '4a8acd65-78bb-4020-b9eb-2d058a86a2a0' } | ||
{ type: 'photos', id: 3 } | ||
], | ||
comments: [ | ||
{ type: 'comments', id: '6b017640-827c-4d50-8dcc-79d766abb408' } | ||
{ type: 'comments', id: 1 } | ||
] | ||
@@ -125,0 +125,0 @@ } |
@@ -28,17 +28,17 @@ 'use strict' | ||
{ | ||
id: '6b017640-827c-4d50-8dcc-79d766abb408', | ||
id: 1, | ||
type: 'comments', | ||
body: 'First!', | ||
timestamp: '2017-01-02', | ||
author: { type: 'people', id: 'ad3aa89e-9c5b-4ac9-a652-6670f9f27587' } | ||
author: { type: 'people', id: 4 } | ||
}, | ||
{ | ||
id: '3f1a89c2-eb85-4799-a048-6735db24b7eb', | ||
id: 2, | ||
type: 'comments', | ||
body: 'I like XML better', | ||
timestamp: '2017-06-20', | ||
author: { type: 'people', id: '32fb0105-acaa-4adb-9ec4-8b49633695e1', meta: { created: '2010-01-01' } } | ||
author: { type: 'people', id: 2, meta: { created: '2010-01-01' } } | ||
}, | ||
{ | ||
id: '2f716574-cef6-4238-8285-520911af86c1', | ||
id: 3, | ||
type: 'comments', | ||
@@ -45,0 +45,0 @@ body: 'Wibble wibble.', |
@@ -33,3 +33,3 @@ 'use strict' | ||
{ | ||
id: 'cc5cca2e-0dd8-4b95-8cfc-a11230e73116', | ||
id: 1, | ||
type: 'people', | ||
@@ -41,3 +41,3 @@ firstname: 'Oli', | ||
{ | ||
id: '32fb0105-acaa-4adb-9ec4-8b49633695e1', | ||
id: 2, | ||
type: 'people', | ||
@@ -49,3 +49,3 @@ firstname: 'Pedro', | ||
{ | ||
id: 'd850ea75-4427-4f81-8595-039990aeede5', | ||
id: 3, | ||
type: 'people', | ||
@@ -57,3 +57,3 @@ firstname: 'Mark', | ||
{ | ||
id: 'ad3aa89e-9c5b-4ac9-a652-6670f9f27587', | ||
id: 4, | ||
type: 'people', | ||
@@ -60,0 +60,0 @@ firstname: 'Rahul', |
@@ -40,3 +40,3 @@ 'use strict' | ||
{ | ||
id: 'aab14844-97e7-401c-98c8-0bd5ec922d93', | ||
id: 1, | ||
type: 'photos', | ||
@@ -49,6 +49,6 @@ title: 'Matrix Code', | ||
tags: ['neo', 'morpheus'], | ||
photographer: { type: 'people', id: 'ad3aa89e-9c5b-4ac9-a652-6670f9f27587' } | ||
photographer: { type: 'people', id: 4 } | ||
}, | ||
{ | ||
id: '72695cbd-e9ef-44f6-85e0-0dbc06a269e8', | ||
id: 2, | ||
type: 'photos', | ||
@@ -60,6 +60,6 @@ title: 'Penguins', | ||
tags: ['galapagos', 'emperor'], | ||
photographer: { type: 'people', id: 'd850ea75-4427-4f81-8595-039990aeede5' } | ||
photographer: { type: 'people', id: 3 } | ||
}, | ||
{ | ||
id: '4a8acd65-78bb-4020-b9eb-2d058a86a2a0', | ||
id: 3, | ||
type: 'photos', | ||
@@ -71,6 +71,6 @@ title: 'Cup of Tea', | ||
tags: ['black', 'green'], | ||
photographer: { type: 'people', id: 'ad3aa89e-9c5b-4ac9-a652-6670f9f27587' } | ||
photographer: { type: 'people', id: 4 } | ||
}, | ||
{ | ||
id: 'ed45eba1-15fe-41c7-93da-1df3dfa5289f', | ||
id: 4, | ||
type: 'photos', | ||
@@ -83,3 +83,3 @@ title: 'Sunset Horizon', | ||
tags: ['orange', 'sky', 'sun'], | ||
photographer: { type: 'people', id: 'cc5cca2e-0dd8-4b95-8cfc-a11230e73116' } | ||
photographer: { type: 'people', id: 1 } | ||
} | ||
@@ -86,0 +86,0 @@ |
@@ -28,27 +28,27 @@ 'use strict' | ||
{ | ||
id: '7541a4de-4986-4597-81b9-cf31b6762486', | ||
id: 1, | ||
type: 'tags', | ||
name: 'live', | ||
parent: { type: 'tags', id: '2a3bdea4-a889-480d-b886-104498c86f69' } | ||
parent: { type: 'tags', id: 2 } | ||
}, | ||
{ | ||
id: '2a3bdea4-a889-480d-b886-104498c86f69', | ||
id: 2, | ||
type: 'tags', | ||
name: 'staging', | ||
parent: { type: 'tags', id: '6ec62f6d-9f82-40c5-b4f4-279ed1765492' } | ||
parent: { type: 'tags', id: 3 } | ||
}, | ||
{ | ||
id: '6ec62f6d-9f82-40c5-b4f4-279ed1765492', | ||
id: 3, | ||
type: 'tags', | ||
name: 'building', | ||
parent: { type: 'tags', id: '68538177-7a62-4752-bc4e-8f971d253b42' } | ||
parent: { type: 'tags', id: 4 } | ||
}, | ||
{ | ||
id: '68538177-7a62-4752-bc4e-8f971d253b42', | ||
id: 4, | ||
type: 'tags', | ||
name: 'development', | ||
parent: { type: 'tags', id: '8d196606-134c-4504-a93a-0d372f78d6c5' } | ||
parent: { type: 'tags', id: 5 } | ||
}, | ||
{ | ||
id: '8d196606-134c-4504-a93a-0d372f78d6c5', | ||
id: 5, | ||
type: 'tags', | ||
@@ -55,0 +55,0 @@ name: 'planning', |
@@ -18,20 +18,20 @@ 'use strict' | ||
{ | ||
id: 'fbaefe1b-8b80-42c2-b17c-0c397e5b7a0b', | ||
id: 1, | ||
type: 'tuples', | ||
media: [ | ||
{ type: 'articles', id: 'fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5' }, | ||
{ type: 'photos', id: '72695cbd-e9ef-44f6-85e0-0dbc06a269e8' } | ||
{ type: 'articles', id: 4 }, | ||
{ type: 'photos', id: 2 } | ||
], | ||
preferred: { type: 'articles', id: 'fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5' } | ||
preferred: { type: 'articles', id: 4 } | ||
}, | ||
{ | ||
id: '53e4151d-d47d-4188-be22-2b3a290f6690', | ||
id: 2, | ||
type: 'tuples', | ||
media: [ | ||
{ type: 'articles', id: 'd850ea75-4427-4f81-8595-039990aeede5' }, | ||
{ type: 'photos', id: '4a8acd65-78bb-4020-b9eb-2d058a86a2a0' } | ||
{ type: 'articles', id: 3 }, | ||
{ type: 'photos', id: 3 } | ||
], | ||
preferred: { type: 'photos', id: '72695cbd-e9ef-44f6-85e0-0dbc06a269e8' } | ||
preferred: { type: 'photos', id: 2 } | ||
} | ||
] | ||
}) |
@@ -34,2 +34,5 @@ 'use strict' | ||
} | ||
if (!isNaN(parseInt(element))) { | ||
return { operator: null, value: parseInt(element) } | ||
} | ||
return { operator: null, value: element } | ||
@@ -119,3 +122,8 @@ } | ||
if (typeof filterElement === 'string') request.params.filter[key] = filterElement = filterElement.split(FILTER_SEPERATOR) | ||
if (typeof filterElement === 'string') { | ||
request.params.filter[key] = filterElement = filterElement.split(FILTER_SEPERATOR).map((i) => { | ||
if (isNaN(parseInt(i))) return i | ||
else return parseInt(i) | ||
}) | ||
} | ||
@@ -122,0 +130,0 @@ if (!Array.isArray(filterElement) && filterElement instanceof Object) continue // skip deep filters |
@@ -33,2 +33,3 @@ 'use strict' | ||
let results = [].concat(resources[request.params.type]) | ||
results = results.filter(() => true) | ||
self._sortList(request, results) | ||
@@ -47,3 +48,3 @@ const resultCount = results.length | ||
// Pull the requested resource from the in-memory store | ||
const theResource = resources[request.params.type].filter(anyResource => anyResource.id === request.params.id).pop() | ||
const theResource = resources[request.params.type].filter(anyResource => anyResource.id === parseInt(request.params.id)).pop() | ||
@@ -68,2 +69,16 @@ // If the resource doesn't exist, error | ||
MemoryStore.prototype.create = (request, newResource, callback) => { | ||
if (newResource.id == null) newResource.id = 0 | ||
if (isNaN(newResource.id)) { | ||
return callback({ // eslint-disable-line standard/no-callback-literal | ||
status: '404', | ||
code: 'ENOTFOUND', | ||
title: 'Requested resource does not exist', | ||
detail: `There is no ${request.params.type} with id ${request.params.id}` | ||
}) | ||
} | ||
if (newResource.id === 0) { | ||
newResource.id = resources[request.params.type].length + 1 | ||
} | ||
// Check to see if the ID already exists | ||
@@ -80,3 +95,3 @@ const index = MemoryStore._indexOf(resources[request.params.type], newResource) | ||
// Push the newResource into our in-memory store. | ||
resources[request.params.type].push(newResource) | ||
resources[request.params.type][newResource.id - 1] = (newResource) | ||
// Return the newly created resource | ||
@@ -83,0 +98,0 @@ return callback(null, MemoryStore._clone(newResource)) |
@@ -25,3 +25,3 @@ 'use strict' | ||
'id': { | ||
type: 'string' | ||
type: 'number' | ||
}, | ||
@@ -28,0 +28,0 @@ 'type': { |
{ | ||
"name": "@coding-blocks/jsonapi-server", | ||
"version": "3.2.3", | ||
"version": "3.2.4", | ||
"description": "A config driven NodeJS framework implementing json:api", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -1,10 +0,19 @@ | ||
[![Build Status](https://travis-ci.org/holidayextras/jsonapi-server.svg?branch=master)](https://travis-ci.org/holidayextras/jsonapi-server) | ||
[![Coverage Status](https://coveralls.io/repos/github/holidayextras/jsonapi-server/badge.svg?branch=master)](https://coveralls.io/github/holidayextras/jsonapi-server?branch=master) | ||
[![npm version](https://badge.fury.io/js/jsonapi-server.svg)](http://badge.fury.io/js/jsonapi-server) | ||
[![Dependencies Status](https://david-dm.org/holidayextras/jsonapi-server.svg)](https://david-dm.org/holidayextras/jsonapi-server) | ||
[![Build Status](https://travis-ci.org/coding-blocks/jsonapi-server.svg?branch=master)](https://travis-ci.org/coding-blocks/jsonapi-server) | ||
[![Coverage Status](https://coveralls.io/repos/github/coding-blocks/jsonapi-server/badge.svg?branch=master)](https://coveralls.io/github/coding-blocks/jsonapi-server?branch=master) | ||
[![npm version](https://badge.fury.io/js/%40coding-blocks%2Fjsonapi-server.svg)](https://badge.fury.io/js/%40coding-blocks%2Fjsonapi-server) | ||
[![Dependencies Status](https://david-dm.org/coding-blocks/jsonapi-server.svg)](https://david-dm.org/coding-blocks/jsonapi-server) | ||
# jsonapi-server | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/holidayextras/jsonapi-server.svg)](https://greenkeeper.io/) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/coding-blocks/jsonapi-server.svg)](https://greenkeeper.io/) | ||
**NOTE: This is a fork of holidayextra's [jsonapi-server](https://github.com/holidayextras/jsonapi-server) | ||
The difference being our fork uses integer autoincrement ids instead of UUIDs. | ||
Apart from that, it is exactly the same implementation** | ||
_**You'd want to use our version of jsonapi-store-\[\*\] plugins with this | ||
as the original versions will not be compatible with this**_ | ||
_The rest of the readme is verbatim copy of the original project_ | ||
A config driven NodeJS framework implementing [`json:api`](http://jsonapi.org/) and [`GraphQL`](http://graphql.org/). You define the resources, it provides the api. | ||
@@ -37,8 +46,8 @@ | ||
We've created `handler`s to automatically map our config over to database solutions help people get off the ground: | ||
* [jsonapi-store-memoryhandler](https://github.com/holidayextras/jsonapi-server/blob/master/lib/MemoryHandler.js) - an in-memory data store to enable rapid prototyping. This ships as a part of `jsonapi-server` and powers the core test suite. | ||
* [jsonapi-handler-chain](https://github.com/holidayextras/jsonapi-server/blob/master/lib/ChainHandler.js) - a handler to chain custom behaviour around an existing handler. This ships as a part of `jsonapi-server`. More info can be found [here](https://github.com/holidayextras/jsonapi-server/blob/master/documentation/chain-handler.md) | ||
* [jsonapi-store-memoryhandler](https://github.com/coding-blocks/jsonapi-server/blob/master/lib/MemoryHandler.js) - an in-memory data store to enable rapid prototyping. This ships as a part of `jsonapi-server` and powers the core test suite. | ||
* [jsonapi-handler-chain](https://github.com/coding-blocks/jsonapi-server/blob/master/lib/ChainHandler.js) - a handler to chain custom behaviour around an existing handler. This ships as a part of `jsonapi-server`. More info can be found [here](https://github.com/coding-blocks/jsonapi-server/blob/master/documentation/chain-handler.md) | ||
* [jsonapi-store-relationaldb](https://github.com/holidayextras/jsonapi-store-relationaldb) - using `sequelize` to support PostgreSQL, MySQL, MSSQL, MariaDB and SQLite. | ||
* [jsonapi-store-mongodb](https://github.com/holidayextras/jsonapi-store-mongodb) - for MongoDB. | ||
* [jsonapi-store-elasticsearch](https://github.com/holidayextras/jsonapi-store-elasticsearch) - for Elasticsearch. | ||
* [jsonapi-store-dynamodb](https://github.com/holidayextras/jsonapi-server/compare/dynamodb?expand=1) - *!SIGNIFICANT WIP!* for AWS DynamoDB. | ||
* [jsonapi-store-dynamodb](https://github.com/coding-blocks/jsonapi-server/compare/dynamodb?expand=1) - *!SIGNIFICANT WIP!* for AWS DynamoDB. | ||
@@ -93,3 +102,3 @@ We've also written a library to ease the consumption of a json:api compliant service, if GraphQL isn't your thing: | ||
``` | ||
$ git clone https://github.com/holidayextras/jsonapi-server.git | ||
$ git clone https://github.com/coding-blocks/jsonapi-server.git | ||
$ npm install | ||
@@ -96,0 +105,0 @@ $ npm start |
@@ -11,3 +11,3 @@ 'use strict' | ||
it('returns 200 if resource is ready', done => { | ||
const url = 'http://localhost:16006/rest/articles/de305d54-75b4-431b-adb2-eb6b9e546014' | ||
const url = 'http://localhost:16006/rest/articles/1' | ||
helpers.request({ | ||
@@ -27,3 +27,3 @@ method: 'GET', | ||
handlers.ready = false | ||
const url = 'http://localhost:16006/rest/articles/de305d54-75b4-431b-adb2-eb6b9e546014' | ||
const url = 'http://localhost:16006/rest/articles/1' | ||
helpers.request({ | ||
@@ -30,0 +30,0 @@ method: 'GET', |
@@ -31,3 +31,3 @@ 'use strict' | ||
body: JSON.stringify({ | ||
'data': { 'type': 'people', 'id': 'fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5' } | ||
'data': { 'type': 'people', 'id': 4 } | ||
}) | ||
@@ -47,3 +47,3 @@ } | ||
method: 'delete', | ||
url: 'http://localhost:16006/rest/articles/fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5/relationships/tags', | ||
url: 'http://localhost:16006/rest/articles/4/relationships/tags', | ||
headers: { | ||
@@ -53,3 +53,3 @@ 'Content-Type': 'application/vnd.api+json' | ||
body: JSON.stringify({ | ||
'data': { 'type': 'tags', 'id': 'foobar' } | ||
'data': { 'type': 'tags', 'id': 20 } | ||
}) | ||
@@ -69,3 +69,3 @@ } | ||
method: 'delete', | ||
url: 'http://localhost:16006/rest/articles/fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5/relationships/tags', | ||
url: 'http://localhost:16006/rest/articles/4/relationships/tags', | ||
headers: { | ||
@@ -75,3 +75,3 @@ 'Content-Type': 'application/vnd.api+json' | ||
body: JSON.stringify({ | ||
'data': { 'type': 'people', 'id': '7541a4de-4986-4597-81b9-cf31b6762486' } | ||
'data': { 'type': 'people', 'id': 1 } | ||
}) | ||
@@ -92,3 +92,3 @@ } | ||
method: 'delete', | ||
url: 'http://localhost:16006/rest/articles/fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5/relationships/tags', | ||
url: 'http://localhost:16006/rest/articles/4/relationships/tags', | ||
headers: { | ||
@@ -98,3 +98,3 @@ 'Content-Type': 'application/vnd.api+json' | ||
body: JSON.stringify({ | ||
'data': { 'type': 'tags', 'id': '7541a4de-4986-4597-81b9-cf31b6762486' } | ||
'data': { 'type': 'tags', 'id': 1 } | ||
}) | ||
@@ -113,3 +113,3 @@ } | ||
it('new resource has changed', done => { | ||
const url = 'http://localhost:16006/rest/articles/fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5/relationships/tags' | ||
const url = 'http://localhost:16006/rest/articles/4/relationships/tags' | ||
helpers.request({ | ||
@@ -127,3 +127,3 @@ method: 'GET', | ||
'type': 'tags', | ||
'id': '6ec62f6d-9f82-40c5-b4f4-279ed1765492' | ||
'id': 3 | ||
} | ||
@@ -141,3 +141,3 @@ ]) | ||
method: 'delete', | ||
url: 'http://localhost:16006/rest/articles/fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5/relationships/author', | ||
url: 'http://localhost:16006/rest/articles/4/relationships/author', | ||
headers: { | ||
@@ -147,3 +147,3 @@ 'Content-Type': 'application/vnd.api+json' | ||
body: JSON.stringify({ | ||
'data': { 'type': 'people', 'id': 'ad3aa89e-9c5b-4ac9-a652-6670f9f27587' } | ||
'data': { 'type': 'people', 'id': 4 } | ||
}) | ||
@@ -162,3 +162,3 @@ } | ||
it('new resource has changed', done => { | ||
const url = 'http://localhost:16006/rest/articles/fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5/relationships/author' | ||
const url = 'http://localhost:16006/rest/articles/4/relationships/author' | ||
helpers.request({ | ||
@@ -181,3 +181,3 @@ method: 'GET', | ||
method: 'post', | ||
url: 'http://localhost:16006/rest/articles/fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5/relationships/author', | ||
url: 'http://localhost:16006/rest/articles/4/relationships/author', | ||
headers: { | ||
@@ -187,3 +187,3 @@ 'Content-Type': 'application/vnd.api+json' | ||
body: JSON.stringify({ | ||
'data': { 'type': 'people', 'id': 'ad3aa89e-9c5b-4ac9-a652-6670f9f27587' } | ||
'data': { 'type': 'people', 'id': 4 } | ||
}) | ||
@@ -190,0 +190,0 @@ } |
@@ -42,3 +42,3 @@ 'use strict' | ||
method: 'delete', | ||
url: 'http://localhost:16006/rest/comments/6b017640-827c-4d50-8dcc-79d766abb408' | ||
url: 'http://localhost:16006/rest/comments/1' | ||
} | ||
@@ -57,3 +57,3 @@ request(data, (err, res, json) => { | ||
it('new resource is gone', done => { | ||
const url = 'http://localhost:16006/rest/comments/6b017640-827c-4d50-8dcc-79d766abb408' | ||
const url = 'http://localhost:16006/rest/comments/1' | ||
helpers.request({ | ||
@@ -60,0 +60,0 @@ method: 'GET', |
@@ -24,3 +24,3 @@ 'use strict' | ||
it('unknown relation should error', done => { | ||
const url = 'http://localhost:16006/rest/articles/de305d54-75b4-431b-adb2-eb6b9e546014/foobar' | ||
const url = 'http://localhost:16006/rest/articles/1/foobar' | ||
helpers.request({ | ||
@@ -39,3 +39,3 @@ method: 'GET', | ||
it('foreign relation should error', done => { | ||
const url = 'http://localhost:16006/rest/people/cc5cca2e-0dd8-4b95-8cfc-a11230e73116/articles' | ||
const url = 'http://localhost:16006/rest/people/1/articles' | ||
helpers.request({ | ||
@@ -55,3 +55,3 @@ method: 'GET', | ||
it('Lookup by id', done => { | ||
const url = 'http://localhost:16006/rest/articles/de305d54-75b4-431b-adb2-eb6b9e546014/author' | ||
const url = 'http://localhost:16006/rest/articles/1/author' | ||
helpers.request({ | ||
@@ -73,3 +73,3 @@ method: 'GET', | ||
it('with null data', done => { | ||
const url = 'http://localhost:16006/rest/comments/2f716574-cef6-4238-8285-520911af86c1/author' | ||
const url = 'http://localhost:16006/rest/comments/3/author' | ||
helpers.request({ | ||
@@ -90,3 +90,3 @@ method: 'GET', | ||
it('with fields', done => { | ||
const url = 'http://localhost:16006/rest/articles/de305d54-75b4-431b-adb2-eb6b9e546014/author?fields[people]=email' | ||
const url = 'http://localhost:16006/rest/articles/1/author?fields[people]=email' | ||
helpers.request({ | ||
@@ -109,3 +109,3 @@ method: 'GET', | ||
it('with filter', done => { | ||
const url = 'http://localhost:16006/rest/articles/de305d54-75b4-431b-adb2-eb6b9e546014/author?filter[email]=email@example.com' | ||
const url = 'http://localhost:16006/rest/articles/1/author?filter[email]=email@example.com' | ||
helpers.request({ | ||
@@ -126,3 +126,3 @@ method: 'GET', | ||
it('with includes', done => { | ||
const url = 'http://localhost:16006/rest/articles/de305d54-75b4-431b-adb2-eb6b9e546014/author?include=articles' | ||
const url = 'http://localhost:16006/rest/articles/1/author?include=articles' | ||
helpers.request({ | ||
@@ -129,0 +129,0 @@ method: 'GET', |
@@ -24,3 +24,3 @@ 'use strict' | ||
it('unknown relation should error', done => { | ||
const url = 'http://localhost:16006/rest/articles/de305d54-75b4-431b-adb2-eb6b9e546014/relationships/foobar' | ||
const url = 'http://localhost:16006/rest/articles/1/relationships/foobar' | ||
helpers.request({ | ||
@@ -39,3 +39,3 @@ method: 'GET', | ||
it('Lookup by id', done => { | ||
const url = 'http://localhost:16006/rest/articles/de305d54-75b4-431b-adb2-eb6b9e546014/relationships/author' | ||
const url = 'http://localhost:16006/rest/articles/1/relationships/author' | ||
helpers.request({ | ||
@@ -61,3 +61,3 @@ method: 'GET', | ||
assert.deepEqual(keys, [ 'type', 'id', 'meta' ], 'Relationship data blocks should have specific properties') | ||
assert.equal(typeof dataBlock.id, 'string', 'Relationship data blocks id should be string') | ||
assert.equal(typeof dataBlock.id, 'number', 'Relationship data blocks id should be string') | ||
assert.equal(typeof dataBlock.type, 'string', 'Relationship data blocks type should be string') | ||
@@ -64,0 +64,0 @@ }) |
@@ -11,3 +11,3 @@ 'use strict' | ||
it('unknown id should error', done => { | ||
const url = 'http://localhost:16006/rest/foobar/relationships?author=cc5cca2e-0dd8-4b95-8cfc-a11230e73116' | ||
const url = 'http://localhost:16006/rest/foobar/relationships?author=1' | ||
request({ | ||
@@ -26,3 +26,3 @@ method: 'GET', | ||
it('unknown relation should error', done => { | ||
const url = 'http://localhost:16006/rest/articles/relationships?title=cc5cca2e-0dd8-4b95-8cfc-a11230e73116' | ||
const url = 'http://localhost:16006/rest/articles/relationships?title=1' | ||
request({ | ||
@@ -41,3 +41,3 @@ method: 'GET', | ||
it('Lookup by id', done => { | ||
const url = 'http://localhost:16006/rest/articles/relationships?author=cc5cca2e-0dd8-4b95-8cfc-a11230e73116' | ||
const url = 'http://localhost:16006/rest/articles/relationships?author=1' | ||
request({ | ||
@@ -63,3 +63,3 @@ method: 'GET', | ||
assert.deepEqual(keys, [ 'id', 'type' ], 'Relationship data blocks should have specific properties') | ||
assert.equal(typeof dataBlock.id, 'string', 'Relationship data blocks id should be string') | ||
assert.equal(typeof dataBlock.id, 'number', 'Relationship data blocks id should be string') | ||
assert.equal(typeof dataBlock.type, 'string', 'Relationship data blocks type should be string') | ||
@@ -66,0 +66,0 @@ }) |
@@ -24,3 +24,3 @@ 'use strict' | ||
it('valid lookup', done => { | ||
const url = 'http://localhost:16006/rest/articles/de305d54-75b4-431b-adb2-eb6b9e546014' | ||
const url = 'http://localhost:16006/rest/articles/1' | ||
helpers.request({ | ||
@@ -42,3 +42,3 @@ method: 'GET', | ||
it('with fields', done => { | ||
const url = 'http://localhost:16006/rest/articles/de305d54-75b4-431b-adb2-eb6b9e546014?fields[articles]=title' | ||
const url = 'http://localhost:16006/rest/articles/1?fields[articles]=title' | ||
request({ | ||
@@ -61,3 +61,3 @@ method: 'GET', | ||
it('with filter', done => { | ||
const url = 'http://localhost:16006/rest/articles/de305d54-75b4-431b-adb2-eb6b9e546014?filter[title]=title' | ||
const url = 'http://localhost:16006/rest/articles/1?filter[title]=title' | ||
helpers.request({ | ||
@@ -79,3 +79,3 @@ method: 'GET', | ||
it('basic include', done => { | ||
const url = 'http://localhost:16006/rest/articles/de305d54-75b4-431b-adb2-eb6b9e546014?include=author' | ||
const url = 'http://localhost:16006/rest/articles/1?include=author' | ||
helpers.request({ | ||
@@ -99,3 +99,3 @@ method: 'GET', | ||
it('including over a null relation', done => { | ||
const url = 'http://localhost:16006/rest/tags/8d196606-134c-4504-a93a-0d372f78d6c5?include=parent' | ||
const url = 'http://localhost:16006/rest/tags/5?include=parent' | ||
helpers.request({ | ||
@@ -117,3 +117,3 @@ method: 'GET', | ||
it('works with a manually expanded string', done => { | ||
const url = 'http://localhost:16006/rest/tags/7541a4de-4986-4597-81b9-cf31b6762486?include=parent.parent.parent.parent.articles' | ||
const url = 'http://localhost:16006/rest/tags/1?include=parent.parent.parent.parent.articles' | ||
helpers.request({ | ||
@@ -120,0 +120,0 @@ method: 'GET', |
@@ -352,3 +352,3 @@ 'use strict' | ||
it('allows filtering by id', done => { | ||
const url = 'http://localhost:16006/rest/articles?filter[id]=1be0913c-3c25-4261-98f1-e41174025ed5&filter[id]=de305d54-75b4-431b-adb2-eb6b9e546014' | ||
const url = 'http://localhost:16006/rest/articles?filter[id]=2&filter[id]=1' | ||
helpers.request({ | ||
@@ -369,3 +369,3 @@ method: 'GET', | ||
it('allows for multiple filter values to be combined in a comma-separated list', done => { | ||
const url = 'http://localhost:16006/rest/articles?filter[tags]=6ec62f6d-9f82-40c5-b4f4-279ed1765492,7541a4de-4986-4597-81b9-cf31b6762486,2a3bdea4-a889-480d-b886-104498c86f69' | ||
const url = 'http://localhost:16006/rest/articles?filter[tags]=3,1,2' | ||
helpers.request({ | ||
@@ -386,3 +386,3 @@ method: 'GET', | ||
it('allows for a compound of comma-separated list filters', done => { | ||
const url = 'http://localhost:16006/rest/articles?filter[tags]=6ec62f6d-9f82-40c5-b4f4-279ed1765492,7541a4de-4986-4597-81b9-cf31b6762486,2a3bdea4-a889-480d-b886-104498c86f69&filter[id]=de305d54-75b4-431b-adb2-eb6b9e546014,1be0913c-3c25-4261-98f1-e41174025ed5' | ||
const url = 'http://localhost:16006/rest/articles?filter[tags]=3,1,2&filter[id]=1,2' | ||
helpers.request({ | ||
@@ -403,3 +403,3 @@ method: 'GET', | ||
it('allows deep filtering', done => { | ||
const url = 'http://localhost:16006/rest/articles?include=author&filter[author]=d850ea75-4427-4f81-8595-039990aeede5&filter[author][firstname]=Mark' | ||
const url = 'http://localhost:16006/rest/articles?include=author&filter[author]=3&filter[author][firstname]=Mark' | ||
helpers.request({ | ||
@@ -662,3 +662,3 @@ method: 'GET', | ||
it('include author.photos with multiple filters', done => { | ||
const url = 'http://localhost:16006/rest/articles?include=author.photos&filter[author]=ad3aa89e-9c5b-4ac9-a652-6670f9f27587&filter[author]=cc5cca2e-0dd8-4b95-8cfc-a11230e73116' | ||
const url = 'http://localhost:16006/rest/articles?include=author.photos&filter[author]=4&filter[author]=1' | ||
helpers.request({ | ||
@@ -709,3 +709,3 @@ method: 'GET', | ||
it('should find resources by a relation', done => { | ||
const url = 'http://localhost:16006/rest/articles/?filter[photos]=aab14844-97e7-401c-98c8-0bd5ec922d93' | ||
const url = 'http://localhost:16006/rest/articles/?filter[photos]=1' | ||
helpers.request({ | ||
@@ -725,3 +725,3 @@ method: 'GET', | ||
it('should find resources by many relations', done => { | ||
const url = 'http://localhost:16006/rest/articles/?filter[photos]=aab14844-97e7-401c-98c8-0bd5ec922d93&filter[photos]=4a8acd65-78bb-4020-b9eb-2d058a86a2a0' | ||
const url = 'http://localhost:16006/rest/articles/?filter[photos]=1&filter[photos]=3' | ||
helpers.request({ | ||
@@ -741,3 +741,3 @@ method: 'GET', | ||
it('should error with incorrectly named relations', done => { | ||
const url = 'http://localhost:16006/rest/articles/?filter[photo]=aab14844-97e7-401c-98c8-0bd5ec922d93' | ||
const url = 'http://localhost:16006/rest/articles/?filter[photo]=1' | ||
helpers.request({ | ||
@@ -760,3 +760,3 @@ method: 'GET', | ||
it('should error when querying the foreign end of a relationship', done => { | ||
const url = 'http://localhost:16006/rest/comments/?filter[article]=aab14844-97e7-401c-98c8-0bd5ec922d93' | ||
const url = 'http://localhost:16006/rest/comments/?filter[article]=1' | ||
helpers.request({ | ||
@@ -763,0 +763,0 @@ method: 'GET', |
@@ -74,3 +74,3 @@ 'use strict' | ||
describe('write operations', () => { | ||
let tagId = null | ||
let tagId = 10 | ||
@@ -80,5 +80,6 @@ it('create a tag', () => client.mutate(` | ||
createTags(tags: { | ||
id: ${tagId} | ||
name: "test1" | ||
parent: { | ||
id: "7541a4de-4986-4597-81b9-cf31b6762486" | ||
id: 1 | ||
} | ||
@@ -96,3 +97,3 @@ }) { | ||
assert.equal(result.createTags.name, 'test1') | ||
assert.equal(result.createTags.parent.id, '7541a4de-4986-4597-81b9-cf31b6762486') | ||
assert.equal(result.createTags.parent.id, 1) | ||
assert.equal(result.createTags.parent.name, 'live') | ||
@@ -105,6 +106,6 @@ tagId = result.createTags.id | ||
updateTags(tags: { | ||
id: "${tagId}" | ||
id: ${tagId} | ||
name: "test2" | ||
parent: { | ||
id: "68538177-7a62-4752-bc4e-8f971d253b42" | ||
id: 4 | ||
} | ||
@@ -126,3 +127,3 @@ }) { | ||
parent: { | ||
id: '68538177-7a62-4752-bc4e-8f971d253b42', | ||
id: 4, | ||
name: 'development' | ||
@@ -136,3 +137,3 @@ } | ||
{ | ||
deleteTags(id: "${tagId}") { | ||
deleteTags(id: ${tagId}) { | ||
name | ||
@@ -151,3 +152,3 @@ } | ||
{ | ||
tags(id: "${tagId}") { | ||
tags(id: ${tagId}) { | ||
name | ||
@@ -154,0 +155,0 @@ } |
@@ -103,3 +103,3 @@ 'use strict' | ||
assert.ok(dataBlock.id, 'Relationship block should have an id') | ||
assert.equal(typeof dataBlock.id, 'string', 'Relationship data blocks id should be string') | ||
assert.equal(typeof dataBlock.id, 'number', 'Relationship data blocks id should be number') | ||
assert.ok(dataBlock.type, 'Relationship block should have a type') | ||
@@ -106,0 +106,0 @@ assert.equal(typeof dataBlock.type, 'string', 'Relationship data blocks type should be string') |
@@ -31,3 +31,3 @@ 'use strict' | ||
body: JSON.stringify({ | ||
'data': { 'type': 'people', 'id': 'ad3aa89e-9c5b-4ac9-a652-6670f9f27587' } | ||
'data': { 'type': 'people', 'id': 4 } | ||
}) | ||
@@ -47,3 +47,3 @@ } | ||
method: 'patch', | ||
url: 'http://localhost:16006/rest/comments/3f1a89c2-eb85-4799-a048-6735db24b7eb/relationships/article', | ||
url: 'http://localhost:16006/rest/comments/2/relationships/article', | ||
headers: { | ||
@@ -53,3 +53,3 @@ 'Content-Type': 'application/vnd.api+json' | ||
body: JSON.stringify({ | ||
'data': { 'type': 'articles', 'id': 'de305d54-75b4-431b-adb2-eb6b9e546014' } | ||
'data': { 'type': 'articles', 'id': 1 } | ||
}) | ||
@@ -70,3 +70,3 @@ } | ||
method: 'patch', | ||
url: 'http://localhost:16006/rest/comments/3f1a89c2-eb85-4799-a048-6735db24b7eb/relationships/author', | ||
url: 'http://localhost:16006/rest/comments/2/relationships/author', | ||
headers: { | ||
@@ -76,3 +76,3 @@ 'Content-Type': 'application/vnd.api+json' | ||
body: JSON.stringify({ | ||
'data': { 'type': 'people', 'id': 'ad3aa89e-9c5b-4ac9-a652-6670f9f27587', meta: { updated: '2012-01-01' } } | ||
'data': { 'type': 'people', 'id': 4, meta: { updated: '2012-01-01' } } | ||
}) | ||
@@ -91,3 +91,3 @@ } | ||
it('new resource has changed', done => { | ||
const url = 'http://localhost:16006/rest/comments/3f1a89c2-eb85-4799-a048-6735db24b7eb/relationships/author' | ||
const url = 'http://localhost:16006/rest/comments/2/relationships/author' | ||
helpers.request({ | ||
@@ -104,3 +104,3 @@ method: 'GET', | ||
'type': 'people', | ||
'id': 'ad3aa89e-9c5b-4ac9-a652-6670f9f27587', | ||
'id': 4, | ||
'meta': { | ||
@@ -107,0 +107,0 @@ 'updated': '2012-01-01' |
@@ -52,3 +52,3 @@ 'use strict' | ||
method: 'patch', | ||
url: 'http://localhost:16006/rest/comments/3f1a89c2-eb85-4799-a048-6735db24b7eb', | ||
url: 'http://localhost:16006/rest/comments/2', | ||
headers: { | ||
@@ -77,3 +77,3 @@ 'Content-Type': 'application/vnd.api+json' | ||
method: 'patch', | ||
url: 'http://localhost:16006/rest/articles/d850ea75-4427-4f81-8595-039990aeede5', | ||
url: 'http://localhost:16006/rest/articles/3', | ||
headers: { | ||
@@ -104,3 +104,3 @@ 'Content-Type': 'application/vnd.api+json' | ||
method: 'patch', | ||
url: 'http://localhost:16006/rest/articles/d850ea75-4427-4f81-8595-039990aeede5', | ||
url: 'http://localhost:16006/rest/articles/3', | ||
headers: { | ||
@@ -131,3 +131,3 @@ 'Content-Type': 'application/vnd.api+json' | ||
method: 'patch', | ||
url: 'http://localhost:16006/rest/articles/d850ea75-4427-4f81-8595-039990aeede5', | ||
url: 'http://localhost:16006/rest/articles/3', | ||
headers: { | ||
@@ -140,3 +140,3 @@ 'Content-Type': 'application/vnd.api+json' | ||
'tags': { | ||
'data': [ { 'type': 'tags', 'id': '2a3bdea4-a889-480d-b886-104498c86f69' }, undefined ] | ||
'data': [ { 'type': 'tags', 'id': 2 }, undefined ] | ||
} | ||
@@ -160,3 +160,3 @@ } | ||
method: 'patch', | ||
url: 'http://localhost:16006/rest/articles/d850ea75-4427-4f81-8595-039990aeede5', | ||
url: 'http://localhost:16006/rest/articles/3', | ||
headers: { | ||
@@ -188,3 +188,3 @@ 'Content-Type': 'application/vnd.api+json' | ||
method: 'patch', | ||
url: 'http://localhost:16006/rest/comments/3f1a89c2-eb85-4799-a048-6735db24b7eb', | ||
url: 'http://localhost:16006/rest/comments/2', | ||
headers: { | ||
@@ -200,3 +200,3 @@ 'Content-Type': 'application/vnd.api+json' | ||
'author': { | ||
'data': { 'type': 'people', 'id': 'd850ea75-4427-4f81-8595-039990aeede5' } | ||
'data': { 'type': 'people', 'id': 3 } | ||
} | ||
@@ -221,3 +221,3 @@ }, | ||
it('new resource has changed', done => { | ||
const url = 'http://localhost:16006/rest/comments/3f1a89c2-eb85-4799-a048-6735db24b7eb' | ||
const url = 'http://localhost:16006/rest/comments/2' | ||
helpers.request({ | ||
@@ -234,3 +234,3 @@ method: 'GET', | ||
'type': 'comments', | ||
'id': '3f1a89c2-eb85-4799-a048-6735db24b7eb', | ||
'id': 2, | ||
'attributes': { | ||
@@ -241,3 +241,3 @@ 'body': 'I like XML better', | ||
'links': { | ||
'self': 'http://localhost:16006/rest/comments/3f1a89c2-eb85-4799-a048-6735db24b7eb' | ||
'self': 'http://localhost:16006/rest/comments/2' | ||
}, | ||
@@ -251,8 +251,8 @@ 'relationships': { | ||
'links': { | ||
'self': 'http://localhost:16006/rest/comments/3f1a89c2-eb85-4799-a048-6735db24b7eb/relationships/author', | ||
'related': 'http://localhost:16006/rest/comments/3f1a89c2-eb85-4799-a048-6735db24b7eb/author' | ||
'self': 'http://localhost:16006/rest/comments/2/relationships/author', | ||
'related': 'http://localhost:16006/rest/comments/2/author' | ||
}, | ||
'data': { | ||
'type': 'people', | ||
'id': 'd850ea75-4427-4f81-8595-039990aeede5' | ||
'id': 3 | ||
} | ||
@@ -269,4 +269,4 @@ }, | ||
'links': { | ||
'self': 'http://localhost:16006/rest/articles/relationships/?comments=3f1a89c2-eb85-4799-a048-6735db24b7eb', | ||
'related': 'http://localhost:16006/rest/articles/?filter[comments]=3f1a89c2-eb85-4799-a048-6735db24b7eb' | ||
'self': 'http://localhost:16006/rest/articles/relationships/?comments=2', | ||
'related': 'http://localhost:16006/rest/articles/?filter[comments]=2' | ||
} | ||
@@ -287,3 +287,3 @@ } | ||
method: 'patch', | ||
url: 'http://localhost:16006/rest/comments/3f1a89c2-eb85-4799-a048-6735db24b7eb', | ||
url: 'http://localhost:16006/rest/comments/2', | ||
headers: { | ||
@@ -319,3 +319,3 @@ 'Content-Type': 'application/vnd.api+json' | ||
it('new resource has changed', done => { | ||
const url = 'http://localhost:16006/rest/comments/3f1a89c2-eb85-4799-a048-6735db24b7eb' | ||
const url = 'http://localhost:16006/rest/comments/2' | ||
helpers.request({ | ||
@@ -332,3 +332,3 @@ method: 'GET', | ||
'type': 'comments', | ||
'id': '3f1a89c2-eb85-4799-a048-6735db24b7eb', | ||
'id': 2, | ||
'attributes': { | ||
@@ -339,3 +339,3 @@ 'body': 'I like XML better', | ||
'links': { | ||
'self': 'http://localhost:16006/rest/comments/3f1a89c2-eb85-4799-a048-6735db24b7eb' | ||
'self': 'http://localhost:16006/rest/comments/2' | ||
}, | ||
@@ -349,4 +349,4 @@ 'relationships': { | ||
'links': { | ||
'self': 'http://localhost:16006/rest/comments/3f1a89c2-eb85-4799-a048-6735db24b7eb/relationships/author', | ||
'related': 'http://localhost:16006/rest/comments/3f1a89c2-eb85-4799-a048-6735db24b7eb/author' | ||
'self': 'http://localhost:16006/rest/comments/2/relationships/author', | ||
'related': 'http://localhost:16006/rest/comments/2/author' | ||
}, | ||
@@ -364,4 +364,4 @@ 'data': null | ||
'links': { | ||
'self': 'http://localhost:16006/rest/articles/relationships/?comments=3f1a89c2-eb85-4799-a048-6735db24b7eb', | ||
'related': 'http://localhost:16006/rest/articles/?filter[comments]=3f1a89c2-eb85-4799-a048-6735db24b7eb' | ||
'self': 'http://localhost:16006/rest/articles/relationships/?comments=2', | ||
'related': 'http://localhost:16006/rest/articles/?filter[comments]=2' | ||
} | ||
@@ -368,0 +368,0 @@ } |
@@ -12,3 +12,3 @@ 'use strict' | ||
describe('creates a resource', () => { | ||
let id = 'e4a1a34f-151b-41ca-a0d9-21726068ba8b' | ||
let id = 10 | ||
@@ -15,0 +15,0 @@ it('works', done => { |
@@ -31,3 +31,3 @@ 'use strict' | ||
body: JSON.stringify({ | ||
'data': { 'type': 'people', 'id': 'ad3aa89e-9c5b-4ac9-a652-6670f9f27587' } | ||
'data': { 'type': 'people', 'id': 4 } | ||
}) | ||
@@ -47,3 +47,3 @@ } | ||
method: 'post', | ||
url: 'http://localhost:16006/rest/articles/fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5/relationships/comments', | ||
url: 'http://localhost:16006/rest/articles/4/relationships/comments', | ||
headers: { | ||
@@ -53,3 +53,3 @@ 'Content-Type': 'application/vnd.api+json' | ||
body: JSON.stringify({ | ||
'data': { 'type': 'people', 'id': '6b017640-827c-4d50-8dcc-79d766abb408' } | ||
'data': { 'type': 'people', 'id': 1 } | ||
}) | ||
@@ -70,3 +70,3 @@ } | ||
method: 'post', | ||
url: 'http://localhost:16006/rest/articles/de305d54-75b4-431b-adb2-eb6b9e546014/relationships/comments', | ||
url: 'http://localhost:16006/rest/articles/1/relationships/comments', | ||
headers: { | ||
@@ -76,3 +76,3 @@ 'Content-Type': 'application/vnd.api+json' | ||
body: JSON.stringify({ | ||
'data': { 'type': 'comments', 'id': '6b017640-827c-4d50-8dcc-79d766abb408', meta: { 'updated': '2016-01-01' } } | ||
'data': { 'type': 'comments', 'id': 1, meta: { 'updated': '2016-01-01' } } | ||
}) | ||
@@ -91,3 +91,3 @@ } | ||
it('new resource has changed', done => { | ||
const url = 'http://localhost:16006/rest/articles/de305d54-75b4-431b-adb2-eb6b9e546014/relationships/comments' | ||
const url = 'http://localhost:16006/rest/articles/1/relationships/comments' | ||
helpers.request({ | ||
@@ -105,7 +105,7 @@ method: 'GET', | ||
'type': 'comments', | ||
'id': '3f1a89c2-eb85-4799-a048-6735db24b7eb' | ||
'id': 2 | ||
}, | ||
{ | ||
'type': 'comments', | ||
'id': '6b017640-827c-4d50-8dcc-79d766abb408', | ||
'id': 1, | ||
'meta': { | ||
@@ -126,3 +126,3 @@ 'updated': '2016-01-01' | ||
method: 'post', | ||
url: 'http://localhost:16006/rest/articles/fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5/relationships/author', | ||
url: 'http://localhost:16006/rest/articles/4/relationships/author', | ||
headers: { | ||
@@ -132,3 +132,3 @@ 'Content-Type': 'application/vnd.api+json' | ||
body: JSON.stringify({ | ||
'data': { 'type': 'people', 'id': 'cc5cca2e-0dd8-4b95-8cfc-a11230e73116' } | ||
'data': { 'type': 'people', 'id': 1 } | ||
}) | ||
@@ -147,3 +147,3 @@ } | ||
it('new resource has changed', done => { | ||
const url = 'http://localhost:16006/rest/articles/fa2a073f-8c64-4cbb-9158-b8f67a4ab9f5/relationships/author' | ||
const url = 'http://localhost:16006/rest/articles/4/relationships/author' | ||
helpers.request({ | ||
@@ -160,3 +160,3 @@ method: 'GET', | ||
'type': 'people', | ||
'id': 'cc5cca2e-0dd8-4b95-8cfc-a11230e73116' | ||
'id': 1 | ||
}) | ||
@@ -163,0 +163,0 @@ |
@@ -164,3 +164,3 @@ 'use strict' | ||
'photographer': { | ||
'data': { 'type': 'people', 'id': 'cc5cca2e-0dd8-4b95-8cfc-a11230e73116' } | ||
'data': { 'type': 'people', 'id': 1 } | ||
} | ||
@@ -167,0 +167,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
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
6930
114
404217