graphbrainz/src/types/artist.js

99 lines
3 KiB
JavaScript
Raw Normal View History

import GraphQL from 'graphql';
import { Node } from './node.js';
import { Entity } from './entity.js';
import { Area } from './area.js';
import { aliases } from './alias.js';
import { collections } from './collection.js';
import { lifeSpan } from './life-span.js';
import { recordings } from './recording.js';
import { releases } from './release.js';
import { releaseGroups } from './release-group.js';
import { works } from './work.js';
import { relationships } from './relationship.js';
import { rating } from './rating.js';
import { tags } from './tag.js';
import { IPI, ISNI } from './scalars.js';
2016-08-08 07:54:06 +00:00
import {
resolveWithFallback,
2016-08-20 05:59:32 +00:00
fieldWithID,
id,
2016-08-31 06:33:29 +00:00
mbid,
2016-08-20 05:59:32 +00:00
name,
sortName,
disambiguation,
connectionWithExtras,
linkedQuery,
} from './helpers.js';
2016-08-08 07:54:06 +00:00
const { GraphQLObjectType, GraphQLString, GraphQLList } = GraphQL;
export const Artist = new GraphQLObjectType({
2016-08-08 07:54:06 +00:00
name: 'Artist',
2016-11-26 01:38:32 +00:00
description: `An [artist](https://musicbrainz.org/doc/Artist) is generally a
musician, group of musicians, or other music professional (like a producer or
engineer). Occasionally, it can also be a non-musical person (like a
photographer, an illustrator, or a poet whose writings are set to music), or
even a fictional character.`,
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
name,
sortName,
disambiguation,
aliases,
2016-11-26 01:38:32 +00:00
country: {
type: GraphQLString,
description: `The country with which an artist is primarily identified. It
is often, but not always, its birth/formation country.`,
2016-11-26 01:38:32 +00:00
},
area: {
type: Area,
description: `The area with which an artist is primarily identified. It
is often, but not always, its birth/formation country.`,
2016-11-26 01:38:32 +00:00
},
2016-08-20 05:59:32 +00:00
beginArea: {
type: Area,
2016-11-26 01:38:32 +00:00
description: `The area in which an artist began their career (or where
2016-12-14 04:05:35 +00:00
they were born, if the artist is a person).`,
resolve: resolveWithFallback(['begin-area', 'begin_area']),
2016-08-20 05:59:32 +00:00
},
endArea: {
type: Area,
2016-11-26 01:38:32 +00:00
description: `The area in which an artist ended their career (or where
they died, if the artist is a person).`,
resolve: resolveWithFallback(['end-area', 'end_area']),
2016-08-20 05:59:32 +00:00
},
lifeSpan,
2016-11-26 01:38:32 +00:00
...fieldWithID('gender', {
description: `Whether a person or character identifies as male, female, or
neither. Groups do not have genders.`,
2016-11-26 01:38:32 +00:00
}),
...fieldWithID('type', {
description: 'Whether an artist is a person, a group, or something else.',
2016-11-26 01:38:32 +00:00
}),
2016-12-10 17:51:33 +00:00
ipis: {
type: new GraphQLList(IPI),
description: `List of [Interested Parties Information](https://musicbrainz.org/doc/IPI)
(IPI) codes for the artist.`,
2016-12-10 17:51:33 +00:00
},
isnis: {
type: new GraphQLList(ISNI),
description: `List of [International Standard Name Identifier](https://musicbrainz.org/doc/ISNI)
(ISNI) codes for the artist.`,
2016-12-10 17:51:33 +00:00
},
2016-08-20 05:59:32 +00:00
recordings,
releases,
releaseGroups,
works,
relationships,
collections,
2016-12-14 04:50:38 +00:00
rating,
tags,
}),
});
export const ArtistConnection = connectionWithExtras(Artist);
2016-08-20 05:59:32 +00:00
export const artists = linkedQuery(ArtistConnection);