2016-08-20 05:59:32 +00:00
|
|
|
import { GraphQLObjectType, GraphQLNonNull } from 'graphql/type'
|
2016-08-31 06:33:29 +00:00
|
|
|
import { connectionDefinitions } from 'graphql-relay'
|
|
|
|
|
import Node from './node'
|
2016-08-20 05:59:32 +00:00
|
|
|
import Entity from './entity'
|
|
|
|
|
import { URLString } from './scalars'
|
2016-08-31 06:33:29 +00:00
|
|
|
import { id, mbid, relations } from './helpers'
|
2016-08-20 05:59:32 +00:00
|
|
|
|
|
|
|
|
const URL = new GraphQLObjectType({
|
|
|
|
|
name: 'URL',
|
|
|
|
|
description:
|
|
|
|
|
'A URL pointing to a resource external to MusicBrainz, i.e. an official ' +
|
|
|
|
|
'homepage, a site where music can be acquired, an entry in another ' +
|
|
|
|
|
'database, etc.',
|
2016-08-31 06:33:29 +00:00
|
|
|
interfaces: () => [Node, Entity],
|
2016-08-20 05:59:32 +00:00
|
|
|
fields: () => ({
|
|
|
|
|
id,
|
2016-08-31 06:33:29 +00:00
|
|
|
mbid,
|
2016-08-20 05:59:32 +00:00
|
|
|
resource: { type: new GraphQLNonNull(URLString) },
|
|
|
|
|
relations
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
2016-08-31 06:33:29 +00:00
|
|
|
const { connectionType: URLConnection } = connectionDefinitions({ nodeType: URL })
|
|
|
|
|
export { URLConnection }
|
2016-08-20 05:59:32 +00:00
|
|
|
export default URL
|