mirror of
https://github.com/BradNut/graphbrainz
synced 2025-09-08 17:40:32 +00:00
* wip: Modernize dependencies, syntax, imports * Use final release of ava-nock v2 * Update Travis config * Remove Node 13 from test matrix * Replace errorClass with parseErrorMessage in subclasses * define exports, apply updated lint rules * Remove markdown eslint plugin * Update README * v9.0.0-beta.1 * Add gql tag to exports * v9.0.0-beta.2 * Bump ava-nock, add test * Update dataloader loadMany usage * Add modules note to README * Add retry option to got calls
37 lines
966 B
JavaScript
37 lines
966 B
JavaScript
import schema from './schema.js';
|
|
import resolvers from './resolvers.js';
|
|
import createLoader from './loader.js';
|
|
import FanArtClient from './client.js';
|
|
import { ONE_DAY } from '../../util.js';
|
|
|
|
export default {
|
|
name: 'fanart.tv',
|
|
description: `Retrieve high quality artwork for artists, releases, and labels
|
|
from [fanart.tv](https://fanart.tv/).`,
|
|
extendContext(context, { fanArt = {} } = {}) {
|
|
const client = new FanArtClient(fanArt);
|
|
const cacheSize = parseInt(
|
|
process.env.FANART_CACHE_SIZE ||
|
|
process.env.GRAPHBRAINZ_CACHE_SIZE ||
|
|
8192,
|
|
10
|
|
);
|
|
const cacheTTL = parseInt(
|
|
process.env.FANART_CACHE_TTL ||
|
|
process.env.GRAPHBRAINZ_CACHE_TTL ||
|
|
ONE_DAY,
|
|
10
|
|
);
|
|
return {
|
|
...context,
|
|
loaders: {
|
|
...context.loaders,
|
|
fanArt: createLoader({ client, cacheSize, cacheTTL }),
|
|
},
|
|
};
|
|
},
|
|
extendSchema: {
|
|
schemas: [schema],
|
|
resolvers,
|
|
},
|
|
};
|