mirror of
https://github.com/BradNut/graphbrainz
synced 2025-09-08 17:40:32 +00:00
Add missing Area type/typeID, pass start() options to middleware (#46)
This commit is contained in:
parent
e77143fbd7
commit
75e24c18bc
28 changed files with 310 additions and 18 deletions
|
|
@ -58,6 +58,14 @@ type Area implements Node, Entity {
|
||||||
# the codes assigned by ISO to countries and subdivisions.
|
# the codes assigned by ISO to countries and subdivisions.
|
||||||
isoCodes: [String]
|
isoCodes: [String]
|
||||||
|
|
||||||
|
# The type of area (country, city, etc. – see the [possible
|
||||||
|
# values](https://musicbrainz.org/doc/Area)).
|
||||||
|
type: String
|
||||||
|
|
||||||
|
# The MBID associated with the value of the `type`
|
||||||
|
# field.
|
||||||
|
typeID: MBID
|
||||||
|
|
||||||
# A list of artists linked to this entity.
|
# A list of artists linked to this entity.
|
||||||
artists(after: String, first: Int): ArtistConnection
|
artists(after: String, first: Int): ArtistConnection
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -317,6 +317,26 @@ alternate names or misspellings.
|
||||||
[ISO 3166 codes](https://en.wikipedia.org/wiki/ISO_3166) are
|
[ISO 3166 codes](https://en.wikipedia.org/wiki/ISO_3166) are
|
||||||
the codes assigned by ISO to countries and subdivisions.
|
the codes assigned by ISO to countries and subdivisions.
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" valign="top"><strong>type</strong></td>
|
||||||
|
<td valign="top"><a href="#string">String</a></td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
The type of area (country, city, etc. – see the [possible
|
||||||
|
values](https://musicbrainz.org/doc/Area)).
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" valign="top"><strong>typeID</strong></td>
|
||||||
|
<td valign="top"><a href="#mbid">MBID</a></td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
The MBID associated with the value of the `type`
|
||||||
|
field.
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,6 @@
|
||||||
"dashify": "^0.2.2",
|
"dashify": "^0.2.2",
|
||||||
"dataloader": "^1.3.0",
|
"dataloader": "^1.3.0",
|
||||||
"debug": "^3.0.0",
|
"debug": "^3.0.0",
|
||||||
"deep-diff": "^0.3.8",
|
|
||||||
"dotenv": "^4.0.0",
|
"dotenv": "^4.0.0",
|
||||||
"es6-error": "^4.0.2",
|
"es6-error": "^4.0.2",
|
||||||
"express": "^4.16.2",
|
"express": "^4.16.2",
|
||||||
|
|
|
||||||
24
schema.json
24
schema.json
|
|
@ -591,6 +591,30 @@
|
||||||
"isDeprecated": false,
|
"isDeprecated": false,
|
||||||
"deprecationReason": null
|
"deprecationReason": null
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "type",
|
||||||
|
"description": "The type of area (country, city, etc. – see the [possible\nvalues](https://musicbrainz.org/doc/Area)).",
|
||||||
|
"args": [],
|
||||||
|
"type": {
|
||||||
|
"kind": "SCALAR",
|
||||||
|
"name": "String",
|
||||||
|
"ofType": null
|
||||||
|
},
|
||||||
|
"isDeprecated": false,
|
||||||
|
"deprecationReason": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "typeID",
|
||||||
|
"description": "The MBID associated with the value of the `type`\nfield.",
|
||||||
|
"args": [],
|
||||||
|
"type": {
|
||||||
|
"kind": "SCALAR",
|
||||||
|
"name": "MBID",
|
||||||
|
"ofType": null
|
||||||
|
},
|
||||||
|
"isDeprecated": false,
|
||||||
|
"deprecationReason": null
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "artists",
|
"name": "artists",
|
||||||
"description": "A list of artists linked to this entity.",
|
"description": "A list of artists linked to this entity.",
|
||||||
|
|
|
||||||
|
|
@ -97,15 +97,17 @@ export default class Client {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
debug(`Sending request. url=${this.baseURL}${path} attempt=${info.currentAttempt}`)
|
const url = `${options.baseUrl}${options.url}`
|
||||||
|
|
||||||
|
debug(`Sending request. url=${url} attempt=${info.currentAttempt}`)
|
||||||
|
|
||||||
request(options, (err, response, body) => {
|
request(options, (err, response, body) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
debug(`Error: “${err}” url=${this.baseURL}${path}`)
|
debug(`Error: “${err}” url=${url}`)
|
||||||
reject(err)
|
reject(err)
|
||||||
} else if (response.statusCode >= 400) {
|
} else if (response.statusCode >= 400) {
|
||||||
const message = this.parseErrorMessage(response, body)
|
const message = this.parseErrorMessage(response, body)
|
||||||
debug(`Error: “${message}” url=${this.baseURL}${path}`)
|
debug(`Error: “${message}” url=${url}`)
|
||||||
const ClientError = this.errorClass
|
const ClientError = this.errorClass
|
||||||
reject(new ClientError(message, response.statusCode))
|
reject(new ClientError(message, response.statusCode))
|
||||||
} else if (options.method === 'HEAD') {
|
} else if (options.method === 'HEAD') {
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ import { ONE_DAY } from '../../util'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Cover Art Archive',
|
name: 'Cover Art Archive',
|
||||||
description:
|
description: `Retrieve cover art images for releases from the [Cover Art
|
||||||
'Retrieve cover art images for releases from the [Cover Art Archive](https://coverartarchive.org/).',
|
Archive](https://coverartarchive.org/).`,
|
||||||
extendContext (context, { coverArtClient, coverArtArchive = {} } = {}) {
|
extendContext (context, { coverArtClient, coverArtArchive = {} } = {}) {
|
||||||
const client = coverArtClient || new CoverArtArchiveClient(coverArtArchive)
|
const client = coverArtClient || new CoverArtArchiveClient(coverArtArchive)
|
||||||
const cacheSize = parseInt(
|
const cacheSize = parseInt(
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,8 @@ import { ONE_DAY } from '../../util'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'fanart.tv',
|
name: 'fanart.tv',
|
||||||
description:
|
description: `Retrieve high quality artwork for artists, releases, and labels
|
||||||
'Retrieve high quality artwork for artists, releases, and labels from ' +
|
from [fanart.tv](https://fanart.tv/).`,
|
||||||
'[fanart.tv](https://fanart.tv/).',
|
|
||||||
extendContext (context, { fanArt = {} } = {}) {
|
extendContext (context, { fanArt = {} } = {}) {
|
||||||
const client = new FanArtClient(fanArt)
|
const client = new FanArtClient(fanArt)
|
||||||
const cacheSize = parseInt(
|
const cacheSize = parseInt(
|
||||||
|
|
|
||||||
|
|
@ -47,5 +47,6 @@ export default function createLoader (options) {
|
||||||
cacheKeyFn: ([ entityType, id ]) => `${entityType}/${id}`,
|
cacheKeyFn: ([ entityType, id ]) => `${entityType}/${id}`,
|
||||||
cacheMap: cache
|
cacheMap: cache
|
||||||
})
|
})
|
||||||
|
|
||||||
return loader
|
return loader
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,8 @@ import { ONE_DAY } from '../../util'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'MediaWiki',
|
name: 'MediaWiki',
|
||||||
description:
|
description: `Retrieve information from MediaWiki image pages, like the actual
|
||||||
'Retrieve information from MediaWiki image pages, like the actual image ' +
|
image file URL and EXIF metadata.`,
|
||||||
'file URL and EXIF metadata.',
|
|
||||||
extendContext (context, { mediaWiki = {} } = {}) {
|
extendContext (context, { mediaWiki = {} } = {}) {
|
||||||
const client = new MediaWikiClient(mediaWiki)
|
const client = new MediaWikiClient(mediaWiki)
|
||||||
const cacheSize = parseInt(
|
const cacheSize = parseInt(
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,8 @@ import { ONE_DAY } from '../../util'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TheAudioDB',
|
name: 'TheAudioDB',
|
||||||
description:
|
description: `Retrieve images and information about artists, releases, and
|
||||||
'Retrieve images and information about artists, releases, and recordings ' +
|
recordings from [TheAudioDB.com](http://www.theaudiodb.com/).`,
|
||||||
'from [TheAudioDB.com](http://www.theaudiodb.com/).',
|
|
||||||
extendContext (context, { theAudioDB = {} } = {}) {
|
extendContext (context, { theAudioDB = {} } = {}) {
|
||||||
const client = new TheAudioDBClient(theAudioDB)
|
const client = new TheAudioDBClient(theAudioDB)
|
||||||
const cacheSize = parseInt(
|
const cacheSize = parseInt(
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ const middleware = ({
|
||||||
|
|
||||||
export default middleware
|
export default middleware
|
||||||
|
|
||||||
export function start () {
|
export function start (options) {
|
||||||
require('dotenv').config({ silent: true })
|
require('dotenv').config({ silent: true })
|
||||||
const app = express()
|
const app = express()
|
||||||
const port = process.env.PORT || 3000
|
const port = process.env.PORT || 3000
|
||||||
|
|
@ -72,7 +72,7 @@ export function start () {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
app.use(compression())
|
app.use(compression())
|
||||||
app.use(route, cors(corsOptions), middleware())
|
app.use(route, cors(corsOptions), middleware(options))
|
||||||
app.listen(port)
|
app.listen(port)
|
||||||
console.log(`Listening on port ${port}.`)
|
console.log(`Listening on port ${port}.`)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import {
|
||||||
relationships,
|
relationships,
|
||||||
collections,
|
collections,
|
||||||
tags,
|
tags,
|
||||||
|
fieldWithID,
|
||||||
connectionWithExtras
|
connectionWithExtras
|
||||||
} from './helpers'
|
} from './helpers'
|
||||||
|
|
||||||
|
|
@ -37,6 +38,10 @@ or settlements (countries, cities, or the like).`,
|
||||||
the codes assigned by ISO to countries and subdivisions.`,
|
the codes assigned by ISO to countries and subdivisions.`,
|
||||||
resolve: data => data['iso-3166-1-codes']
|
resolve: data => data['iso-3166-1-codes']
|
||||||
},
|
},
|
||||||
|
...fieldWithID('type', {
|
||||||
|
description: `The type of area (country, city, etc. – see the [possible
|
||||||
|
values](https://musicbrainz.org/doc/Area)).`
|
||||||
|
}),
|
||||||
artists,
|
artists,
|
||||||
events,
|
events,
|
||||||
labels,
|
labels,
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,14 @@ export function fieldWithID (name, config = {}) {
|
||||||
type: isPlural ? new GraphQLList(MBID) : MBID,
|
type: isPlural ? new GraphQLList(MBID) : MBID,
|
||||||
description: `The MBID${s} associated with the value${s} of the \`${name}\`
|
description: `The MBID${s} associated with the value${s} of the \`${name}\`
|
||||||
field.`,
|
field.`,
|
||||||
resolve: resolveHyphenated
|
resolve: (entity, args, { loaders }) => {
|
||||||
|
const fieldName = toDashed(idName)
|
||||||
|
if (fieldName in entity) {
|
||||||
|
return entity[fieldName]
|
||||||
|
}
|
||||||
|
return loaders.lookup.load([entity._type, entity.id])
|
||||||
|
.then(data => data[fieldName])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
[name]: config,
|
[name]: config,
|
||||||
|
|
|
||||||
BIN
test/fixtures/0e70a8c76fbbaf74403b1979f99fbdeb
vendored
Normal file
BIN
test/fixtures/0e70a8c76fbbaf74403b1979f99fbdeb
vendored
Normal file
Binary file not shown.
29
test/fixtures/0e70a8c76fbbaf74403b1979f99fbdeb.headers
vendored
Normal file
29
test/fixtures/0e70a8c76fbbaf74403b1979f99fbdeb.headers
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
"statusCode": 200,
|
||||||
|
"headers": {
|
||||||
|
"date": "Sat, 04 Nov 2017 22:18:56 GMT",
|
||||||
|
"content-type": "application/json; charset=utf-8",
|
||||||
|
"transfer-encoding": "chunked",
|
||||||
|
"connection": "keep-alive",
|
||||||
|
"keep-alive": "timeout=15",
|
||||||
|
"vary": "Accept-Encoding",
|
||||||
|
"x-ratelimit-limit": "1200",
|
||||||
|
"x-ratelimit-remaining": "1049",
|
||||||
|
"x-ratelimit-reset": "1509833937",
|
||||||
|
"server": "Plack::Handler::Starlet",
|
||||||
|
"etag": "W/\"f3dbfd2359a7a02668094286e405c7d7\"",
|
||||||
|
"access-control-allow-origin": "*",
|
||||||
|
"content-encoding": "gzip"
|
||||||
|
},
|
||||||
|
"url": "http://musicbrainz.org:80/ws/2/area/d907b0ac-2956-386f-a246-62d55779aae1?fmt=json",
|
||||||
|
"time": 355,
|
||||||
|
"request": {
|
||||||
|
"method": "GET",
|
||||||
|
"headers": {
|
||||||
|
"User-Agent": "graphbrainz/7.0.0 ( https://github.com/exogen/graphbrainz )",
|
||||||
|
"host": "musicbrainz.org",
|
||||||
|
"accept-encoding": "gzip, deflate",
|
||||||
|
"accept": "application/json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
test/fixtures/756130058c8775fa7cb29d1dd73b0466
vendored
Normal file
1
test/fixtures/756130058c8775fa7cb29d1dd73b0466
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"type":"City","disambiguation":"","type-id":"6fd8f29a-3d0a-32fc-980d-ea697b69da78","sort-name":"New Germany","life-span":{"end":null,"ended":false,"begin":null},"name":"New Germany","id":"36721201-bb7c-4dce-be68-0553b1131205"}
|
||||||
27
test/fixtures/756130058c8775fa7cb29d1dd73b0466.headers
vendored
Normal file
27
test/fixtures/756130058c8775fa7cb29d1dd73b0466.headers
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"statusCode": 200,
|
||||||
|
"headers": {
|
||||||
|
"date": "Sat, 04 Nov 2017 22:19:01 GMT",
|
||||||
|
"content-type": "application/json; charset=utf-8",
|
||||||
|
"content-length": "227",
|
||||||
|
"connection": "keep-alive",
|
||||||
|
"keep-alive": "timeout=15",
|
||||||
|
"x-ratelimit-limit": "1200",
|
||||||
|
"x-ratelimit-remaining": "789",
|
||||||
|
"x-ratelimit-reset": "1509833941",
|
||||||
|
"server": "Plack::Handler::Starlet",
|
||||||
|
"etag": "\"f003dc5379faf397737ab63975fcacab\"",
|
||||||
|
"access-control-allow-origin": "*"
|
||||||
|
},
|
||||||
|
"url": "http://musicbrainz.org:80/ws/2/area/36721201-bb7c-4dce-be68-0553b1131205?fmt=json",
|
||||||
|
"time": 356,
|
||||||
|
"request": {
|
||||||
|
"method": "GET",
|
||||||
|
"headers": {
|
||||||
|
"User-Agent": "graphbrainz/7.0.0 ( https://github.com/exogen/graphbrainz )",
|
||||||
|
"host": "musicbrainz.org",
|
||||||
|
"accept-encoding": "gzip, deflate",
|
||||||
|
"accept": "application/json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
test/fixtures/761c6577dcc6cfe15f0c2143f6c6dfd1
vendored
Normal file
1
test/fixtures/761c6577dcc6cfe15f0c2143f6c6dfd1
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"type-id":"6fd8f29a-3d0a-32fc-980d-ea697b69da78","life-span":{"ended":false,"begin":null,"end":null},"type":"City","id":"84a30f29-682f-4642-a981-4ba0f50a42fa","sort-name":"Brakel","name":"Brakel","disambiguation":""}
|
||||||
27
test/fixtures/761c6577dcc6cfe15f0c2143f6c6dfd1.headers
vendored
Normal file
27
test/fixtures/761c6577dcc6cfe15f0c2143f6c6dfd1.headers
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"statusCode": 200,
|
||||||
|
"headers": {
|
||||||
|
"date": "Sat, 04 Nov 2017 22:19:01 GMT",
|
||||||
|
"content-type": "application/json; charset=utf-8",
|
||||||
|
"content-length": "217",
|
||||||
|
"connection": "keep-alive",
|
||||||
|
"keep-alive": "timeout=15",
|
||||||
|
"x-ratelimit-limit": "1200",
|
||||||
|
"x-ratelimit-remaining": "787",
|
||||||
|
"x-ratelimit-reset": "1509833941",
|
||||||
|
"server": "Plack::Handler::Starlet",
|
||||||
|
"etag": "\"313b6eef3c187e7f009395a2511cb6bc\"",
|
||||||
|
"access-control-allow-origin": "*"
|
||||||
|
},
|
||||||
|
"url": "http://musicbrainz.org:80/ws/2/area/84a30f29-682f-4642-a981-4ba0f50a42fa?fmt=json",
|
||||||
|
"time": 365,
|
||||||
|
"request": {
|
||||||
|
"method": "GET",
|
||||||
|
"headers": {
|
||||||
|
"User-Agent": "graphbrainz/7.0.0 ( https://github.com/exogen/graphbrainz )",
|
||||||
|
"host": "musicbrainz.org",
|
||||||
|
"accept-encoding": "gzip, deflate",
|
||||||
|
"accept": "application/json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
test/fixtures/7c1e7fa42910da45f700bc832c12f126
vendored
Normal file
1
test/fixtures/7c1e7fa42910da45f700bc832c12f126
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"id":"516dda4c-c58d-43a7-9bde-ef6b12a8b741","type-id":"6fd8f29a-3d0a-32fc-980d-ea697b69da78","life-span":{"ended":false,"end":null,"begin":null},"name":"New Germany","sort-name":"New Germany","disambiguation":"","type":"City"}
|
||||||
27
test/fixtures/7c1e7fa42910da45f700bc832c12f126.headers
vendored
Normal file
27
test/fixtures/7c1e7fa42910da45f700bc832c12f126.headers
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"statusCode": 200,
|
||||||
|
"headers": {
|
||||||
|
"date": "Sat, 04 Nov 2017 22:19:01 GMT",
|
||||||
|
"content-type": "application/json; charset=utf-8",
|
||||||
|
"content-length": "227",
|
||||||
|
"connection": "keep-alive",
|
||||||
|
"keep-alive": "timeout=15",
|
||||||
|
"x-ratelimit-limit": "1200",
|
||||||
|
"x-ratelimit-remaining": "788",
|
||||||
|
"x-ratelimit-reset": "1509833941",
|
||||||
|
"server": "Plack::Handler::Starlet",
|
||||||
|
"etag": "\"fd49c850b3796ed9dc7cfdb680d6142d\"",
|
||||||
|
"access-control-allow-origin": "*"
|
||||||
|
},
|
||||||
|
"url": "http://musicbrainz.org:80/ws/2/area/516dda4c-c58d-43a7-9bde-ef6b12a8b741?fmt=json",
|
||||||
|
"time": 365,
|
||||||
|
"request": {
|
||||||
|
"method": "GET",
|
||||||
|
"headers": {
|
||||||
|
"User-Agent": "graphbrainz/7.0.0 ( https://github.com/exogen/graphbrainz )",
|
||||||
|
"host": "musicbrainz.org",
|
||||||
|
"accept-encoding": "gzip, deflate",
|
||||||
|
"accept": "application/json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
test/fixtures/89450a383b06d3be5d7cf6f7c7234721
vendored
Normal file
BIN
test/fixtures/89450a383b06d3be5d7cf6f7c7234721
vendored
Normal file
Binary file not shown.
29
test/fixtures/89450a383b06d3be5d7cf6f7c7234721.headers
vendored
Normal file
29
test/fixtures/89450a383b06d3be5d7cf6f7c7234721.headers
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
"statusCode": 200,
|
||||||
|
"headers": {
|
||||||
|
"date": "Sat, 04 Nov 2017 22:18:55 GMT",
|
||||||
|
"content-type": "application/json; charset=UTF-8",
|
||||||
|
"transfer-encoding": "chunked",
|
||||||
|
"connection": "keep-alive",
|
||||||
|
"keep-alive": "timeout=15",
|
||||||
|
"vary": "Accept-Encoding",
|
||||||
|
"x-ratelimit-limit": "1200",
|
||||||
|
"x-ratelimit-remaining": "635",
|
||||||
|
"x-ratelimit-reset": "1509833935",
|
||||||
|
"last-modified": "Sat, 04 Nov 2017 21:24:29 GMT",
|
||||||
|
"server": "Jetty(9.3.10.v20160621)",
|
||||||
|
"access-control-allow-origin": "*",
|
||||||
|
"content-encoding": "gzip"
|
||||||
|
},
|
||||||
|
"url": "http://musicbrainz.org:80/ws/2/area?limit=5&query=Germany&fmt=json",
|
||||||
|
"time": 552,
|
||||||
|
"request": {
|
||||||
|
"method": "GET",
|
||||||
|
"headers": {
|
||||||
|
"User-Agent": "graphbrainz/7.0.0 ( https://github.com/exogen/graphbrainz )",
|
||||||
|
"host": "musicbrainz.org",
|
||||||
|
"accept-encoding": "gzip, deflate",
|
||||||
|
"accept": "application/json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
test/fixtures/d191cb9a3134c90cfaa98b8b73f9e8c9
vendored
Normal file
1
test/fixtures/d191cb9a3134c90cfaa98b8b73f9e8c9
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"iso-3166-1-codes":["DE"],"id":"85752fda-13c4-31a3-bee5-0e5cb1f51dad","name":"Germany","sort-name":"Germany","disambiguation":"","type":"Country","type-id":"06dd0ae4-8c74-30bb-b43d-95dcedf961de","life-span":{"begin":null,"ended":false,"end":null}}
|
||||||
27
test/fixtures/d191cb9a3134c90cfaa98b8b73f9e8c9.headers
vendored
Normal file
27
test/fixtures/d191cb9a3134c90cfaa98b8b73f9e8c9.headers
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"statusCode": 200,
|
||||||
|
"headers": {
|
||||||
|
"date": "Sat, 04 Nov 2017 22:18:56 GMT",
|
||||||
|
"content-type": "application/json; charset=utf-8",
|
||||||
|
"content-length": "248",
|
||||||
|
"connection": "keep-alive",
|
||||||
|
"keep-alive": "timeout=15",
|
||||||
|
"x-ratelimit-limit": "1200",
|
||||||
|
"x-ratelimit-remaining": "1048",
|
||||||
|
"x-ratelimit-reset": "1509833937",
|
||||||
|
"server": "Plack::Handler::Starlet",
|
||||||
|
"etag": "\"82c22921587af20efc7bb9480993b28f\"",
|
||||||
|
"access-control-allow-origin": "*"
|
||||||
|
},
|
||||||
|
"url": "http://musicbrainz.org:80/ws/2/area/85752fda-13c4-31a3-bee5-0e5cb1f51dad?fmt=json",
|
||||||
|
"time": 370,
|
||||||
|
"request": {
|
||||||
|
"method": "GET",
|
||||||
|
"headers": {
|
||||||
|
"User-Agent": "graphbrainz/7.0.0 ( https://github.com/exogen/graphbrainz )",
|
||||||
|
"host": "musicbrainz.org",
|
||||||
|
"accept-encoding": "gzip, deflate",
|
||||||
|
"accept": "application/json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -502,6 +502,22 @@ test('area maps iso-3166-1-codes to isoCodes', testData, `
|
||||||
t.deepEqual(data.lookup.area.isoCodes, ['US'])
|
t.deepEqual(data.lookup.area.isoCodes, ['US'])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('areas have a type and typeID', testData, `
|
||||||
|
{
|
||||||
|
search {
|
||||||
|
areas(query: "Germany", first: 5) {
|
||||||
|
nodes {
|
||||||
|
name
|
||||||
|
type
|
||||||
|
typeID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`, (t, data) => {
|
||||||
|
t.snapshot(data)
|
||||||
|
})
|
||||||
|
|
||||||
test('alias locales use the locale scalar', testData, `
|
test('alias locales use the locale scalar', testData, `
|
||||||
{
|
{
|
||||||
lookup {
|
lookup {
|
||||||
|
|
|
||||||
43
test/snapshots/schema.js.md
Normal file
43
test/snapshots/schema.js.md
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
# Snapshot report for `test/schema.js`
|
||||||
|
|
||||||
|
The actual snapshot is saved in `schema.js.snap`.
|
||||||
|
|
||||||
|
Generated by [AVA](https://ava.li).
|
||||||
|
|
||||||
|
## areas have a type and typeID
|
||||||
|
|
||||||
|
> Snapshot 1
|
||||||
|
|
||||||
|
{
|
||||||
|
search: {
|
||||||
|
areas: {
|
||||||
|
nodes: [
|
||||||
|
{
|
||||||
|
name: 'Germany',
|
||||||
|
type: 'Country',
|
||||||
|
typeID: '06dd0ae4-8c74-30bb-b43d-95dcedf961de',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'East Germany',
|
||||||
|
type: 'Country',
|
||||||
|
typeID: '06dd0ae4-8c74-30bb-b43d-95dcedf961de',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'New Germany',
|
||||||
|
type: 'City',
|
||||||
|
typeID: '6fd8f29a-3d0a-32fc-980d-ea697b69da78',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'New Germany',
|
||||||
|
type: 'City',
|
||||||
|
typeID: '6fd8f29a-3d0a-32fc-980d-ea697b69da78',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Brakel',
|
||||||
|
type: 'City',
|
||||||
|
typeID: '6fd8f29a-3d0a-32fc-980d-ea697b69da78',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
BIN
test/snapshots/schema.js.snap
Normal file
BIN
test/snapshots/schema.js.snap
Normal file
Binary file not shown.
Loading…
Reference in a new issue