2016-08-20 05:59:32 +00:00
|
|
|
|
import { GraphQLObjectType, GraphQLString, GraphQLList } from 'graphql/type'
|
2016-08-31 06:33:29 +00:00
|
|
|
|
import Node from './node'
|
2016-08-20 05:59:32 +00:00
|
|
|
|
import Entity from './entity'
|
2016-12-10 02:55:41 +00:00
|
|
|
|
import { ASIN, DateType } from './scalars'
|
2016-11-26 01:38:32 +00:00
|
|
|
|
import { ReleaseStatus } from './enums'
|
2016-08-20 05:59:32 +00:00
|
|
|
|
import ReleaseEvent from './release-event'
|
2016-08-08 07:54:06 +00:00
|
|
|
|
import {
|
2016-08-20 05:59:32 +00:00
|
|
|
|
id,
|
2016-08-31 06:33:29 +00:00
|
|
|
|
mbid,
|
2016-08-20 05:59:32 +00:00
|
|
|
|
title,
|
|
|
|
|
|
disambiguation,
|
2016-11-28 13:49:04 +00:00
|
|
|
|
aliases,
|
2016-08-20 05:59:32 +00:00
|
|
|
|
artistCredit,
|
2016-12-11 20:32:58 +00:00
|
|
|
|
artistCredits,
|
2016-08-20 05:59:32 +00:00
|
|
|
|
artists,
|
|
|
|
|
|
labels,
|
|
|
|
|
|
recordings,
|
|
|
|
|
|
releaseGroups,
|
2016-11-26 01:38:32 +00:00
|
|
|
|
relationships,
|
2016-12-12 08:34:26 +00:00
|
|
|
|
collections,
|
2016-11-28 13:49:04 +00:00
|
|
|
|
tags,
|
|
|
|
|
|
fieldWithID,
|
2016-12-02 08:21:10 +00:00
|
|
|
|
resolveHyphenated,
|
2016-11-28 14:43:32 +00:00
|
|
|
|
connectionWithExtras
|
2016-08-20 05:59:32 +00:00
|
|
|
|
} from './helpers'
|
2016-08-08 07:54:06 +00:00
|
|
|
|
|
2016-08-20 05:59:32 +00:00
|
|
|
|
const Release = new GraphQLObjectType({
|
2016-08-08 07:54:06 +00:00
|
|
|
|
name: 'Release',
|
2016-11-26 01:38:32 +00:00
|
|
|
|
description: `A [release](https://musicbrainz.org/doc/Release) represents the
|
|
|
|
|
|
unique release (i.e. issuing) of a product on a specific date with specific
|
|
|
|
|
|
release information such as the country, label, barcode, packaging, etc. If you
|
|
|
|
|
|
walk into a store and purchase an album or single, they’re each represented in
|
|
|
|
|
|
MusicBrainz as one release.`,
|
2016-08-31 06:33:29 +00:00
|
|
|
|
interfaces: () => [Node, Entity],
|
2016-08-08 07:54:06 +00:00
|
|
|
|
fields: () => ({
|
2016-08-20 05:59:32 +00:00
|
|
|
|
id,
|
2016-08-31 06:33:29 +00:00
|
|
|
|
mbid,
|
2016-08-20 05:59:32 +00:00
|
|
|
|
title,
|
|
|
|
|
|
disambiguation,
|
2016-11-28 13:49:04 +00:00
|
|
|
|
aliases,
|
2016-08-20 05:59:32 +00:00
|
|
|
|
artistCredit,
|
2016-12-11 20:32:58 +00:00
|
|
|
|
artistCredits,
|
2016-08-08 07:54:06 +00:00
|
|
|
|
releaseEvents: {
|
2016-08-20 05:59:32 +00:00
|
|
|
|
type: new GraphQLList(ReleaseEvent),
|
2016-11-26 01:38:32 +00:00
|
|
|
|
description: 'The release events for this release.',
|
2016-12-02 08:21:10 +00:00
|
|
|
|
resolve: resolveHyphenated
|
2016-08-08 07:54:06 +00:00
|
|
|
|
},
|
2016-11-26 01:38:32 +00:00
|
|
|
|
date: {
|
|
|
|
|
|
type: DateType,
|
|
|
|
|
|
description: `The [release date](https://musicbrainz.org/doc/Release/Date)
|
|
|
|
|
|
is the date in which a release was made available through some sort of
|
|
|
|
|
|
distribution mechanism.`
|
|
|
|
|
|
},
|
|
|
|
|
|
country: {
|
|
|
|
|
|
type: GraphQLString,
|
|
|
|
|
|
description: 'The country in which the release was issued.'
|
|
|
|
|
|
},
|
2016-12-10 02:55:41 +00:00
|
|
|
|
asin: {
|
|
|
|
|
|
type: ASIN,
|
|
|
|
|
|
description: `The [Amazon Standard Identification Number](https://musicbrainz.org/doc/ASIN)
|
|
|
|
|
|
of the release.`
|
|
|
|
|
|
},
|
2016-11-26 01:38:32 +00:00
|
|
|
|
barcode: {
|
|
|
|
|
|
type: GraphQLString,
|
|
|
|
|
|
description: `The [barcode](https://en.wikipedia.org/wiki/Barcode), if the
|
|
|
|
|
|
release has one. The most common types found on releases are 12-digit
|
|
|
|
|
|
[UPCs](https://en.wikipedia.org/wiki/Universal_Product_Code) and 13-digit
|
|
|
|
|
|
[EANs](https://en.wikipedia.org/wiki/International_Article_Number).`
|
|
|
|
|
|
},
|
|
|
|
|
|
...fieldWithID('status', {
|
|
|
|
|
|
type: ReleaseStatus,
|
|
|
|
|
|
description: 'The status describes how “official” a release is.'
|
|
|
|
|
|
}),
|
|
|
|
|
|
...fieldWithID('packaging', {
|
|
|
|
|
|
description: `The physical packaging that accompanies the release. See
|
|
|
|
|
|
the [list of packaging](https://musicbrainz.org/doc/Release/Packaging) for more
|
|
|
|
|
|
information.`
|
|
|
|
|
|
}),
|
|
|
|
|
|
quality: {
|
|
|
|
|
|
type: GraphQLString,
|
|
|
|
|
|
description: `Data quality indicates how good the data for a release is.
|
|
|
|
|
|
It is not a mark of how good or bad the music itself is – for that, use
|
|
|
|
|
|
[ratings](https://musicbrainz.org/doc/Rating_System).`
|
|
|
|
|
|
},
|
2016-08-20 05:59:32 +00:00
|
|
|
|
artists,
|
|
|
|
|
|
labels,
|
|
|
|
|
|
recordings,
|
|
|
|
|
|
releaseGroups,
|
2016-11-28 13:49:04 +00:00
|
|
|
|
relationships,
|
2016-12-12 08:34:26 +00:00
|
|
|
|
collections,
|
2016-11-28 13:49:04 +00:00
|
|
|
|
tags
|
2016-08-08 07:54:06 +00:00
|
|
|
|
})
|
|
|
|
|
|
})
|
2016-08-20 05:59:32 +00:00
|
|
|
|
|
2016-11-28 14:43:32 +00:00
|
|
|
|
export const ReleaseConnection = connectionWithExtras(Release)
|
2016-08-20 05:59:32 +00:00
|
|
|
|
export default Release
|