UNPKG

1.9 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../es6/GQLInterface.js"],"names":["GQLInterface","GQLBase","resolveType","model","Error","GQL_TYPE","GraphQLInterfaceType"],"mappings":";;;;;;;AAKA;;AACA;;AAEA;;;;;AARA;;;;;IAaaA,Y,WAAAA,Y,GAAN,MAAMA,YAAN,SAA2BC,gBAA3B,CAAmC;;AAExC;;;;;;;;;;;;;AAaA,SAAOC,WAAP,CAAmBC,KAAnB,EAAyC;AACvC,UAAM,IAAIC,KAAJ,CAAW;;;;KAAX,CAAN;AAKD;;AAED;;;;;;;;;;;;AAYA,aAAWC,QAAX,GAAgC;AAC9B,WAAOC,6BAAP;AACD;AArCuC,C","file":"GQLInterface.js","sourceRoot":"es6","sourcesContent":["/**\n @namespace GQLInterface\n @flow\n */\n\nimport { GQLBase } from './GQLBase'\nimport { GraphQLInterfaceType } from 'graphql'\n\n/**\n * Used by Lattice to implement interface types in the schema when necessary\n *\n * @class GQLInterface\n */\nexport class GQLInterface extends GQLBase {\n\n /**\n * This needs to be able to, depending on your implementors, identify\n * which on the data actually is given the model to work with.\n *\n * @memberof GQLInterface\n * @method ⌾⠀resolveType\n * @static\n *\n * @param {mixed} model the data you can use to instantiate the type of\n * object in question.\n * @return {string} a string matching the name of a defined GraphQL type\n * found elsewhere in your schema\n */\n static resolveType(model: mixed): string {\n throw new Error(`\n You must override \"resolveType(model)\" in your GQLInterface instance\n and determine the implementor type by the contents of the supplied\n model. Returning \"null\" when nothing matches.\n `);\n }\n\n /**\n * Denotes that this GQLBase descendent is describing a graphql\n * interface type.\n *\n * @memberof GQLInterface\n * @method ⬇︎⠀GQL_TYPE\n * @static\n * @const\n *\n * @return {Function} a type, such as `GraphQLObjectType` or\n * `GraphQLInterfaceType`\n */\n static get GQL_TYPE(): Function {\n return GraphQLInterfaceType;\n }\n}\n"]}
\No newline at end of file