diff --git a/src/resolvers/__tests__/count-test.js b/src/resolvers/__tests__/count-test.js index 4888e271..14b82f58 100644 --- a/src/resolvers/__tests__/count-test.js +++ b/src/resolvers/__tests__/count-test.js @@ -72,9 +72,9 @@ describe('count() ->', () => { }); }); - describe('Resolver.getOutputType()', () => { + describe('Resolver.getType()', () => { it('should return GraphQLInt type', () => { - const outputType = count(UserModel, UserTypeComposer).getOutputType(); + const outputType = count(UserModel, UserTypeComposer).getType(); expect(outputType).to.equal(GraphQLInt); }); }); diff --git a/src/resolvers/__tests__/createOne-test.js b/src/resolvers/__tests__/createOne-test.js index 8560d2e1..b2c3f10a 100644 --- a/src/resolvers/__tests__/createOne-test.js +++ b/src/resolvers/__tests__/createOne-test.js @@ -113,21 +113,21 @@ describe('createOne() ->', () => { }); }); - describe('Resolver.getOutputType()', () => { + describe('Resolver.getType()', () => { it('should have correct output type name', () => { - const outputType = createOne(UserModel, UserTypeComposer).getOutputType(); + const outputType = createOne(UserModel, UserTypeComposer).getType(); expect(outputType).property('name') .to.equal(`CreateOne${UserTypeComposer.getTypeName()}Payload`); }); it('should have recordId field', () => { - const outputType = createOne(UserModel, UserTypeComposer).getOutputType(); + const outputType = createOne(UserModel, UserTypeComposer).getType(); const recordIdField = new TypeComposer(outputType).getField('recordId'); expect(recordIdField).property('type').to.equal(GraphQLMongoID); }); it('should have record field', () => { - const outputType = createOne(UserModel, UserTypeComposer).getOutputType(); + const outputType = createOne(UserModel, UserTypeComposer).getType(); const recordField = new TypeComposer(outputType).getField('record'); expect(recordField).property('type').to.equal(UserTypeComposer.getType()); }); @@ -139,7 +139,7 @@ describe('createOne() ->', () => { fields: () => ({}), }); typeStorage.set(outputTypeName, existedType); - const outputType = createOne(UserModel, UserTypeComposer).getOutputType(); + const outputType = createOne(UserModel, UserTypeComposer).getType(); expect(outputType).to.equal(existedType); }); }); diff --git a/src/resolvers/__tests__/findOne-test.js b/src/resolvers/__tests__/findOne-test.js index da9629a8..19b32b76 100644 --- a/src/resolvers/__tests__/findOne-test.js +++ b/src/resolvers/__tests__/findOne-test.js @@ -117,9 +117,9 @@ describe('findOne() ->', () => { }); }); - describe('Resolver.getOutputType()', () => { + describe('Resolver.getType()', () => { it('should return model type', () => { - const outputType = findOne(UserModel, UserTypeComposer).getOutputType(); + const outputType = findOne(UserModel, UserTypeComposer).getType(); expect(outputType).to.equal(UserTypeComposer.getType()); }); }); diff --git a/src/resolvers/__tests__/removeById-test.js b/src/resolvers/__tests__/removeById-test.js index 45017814..1f7821a7 100644 --- a/src/resolvers/__tests__/removeById-test.js +++ b/src/resolvers/__tests__/removeById-test.js @@ -167,21 +167,21 @@ describe('removeById() ->', () => { }); }); - describe('Resolver.getOutputType()', () => { + describe('Resolver.getType()', () => { it('should have correct output type name', () => { - const outputType = removeById(UserModel, UserTypeComposer).getOutputType(); + const outputType = removeById(UserModel, UserTypeComposer).getType(); expect(outputType.name).to.equal(`RemoveById${UserTypeComposer.getTypeName()}Payload`); }); it('should have recordId field', () => { - const outputType = removeById(UserModel, UserTypeComposer).getOutputType(); + const outputType = removeById(UserModel, UserTypeComposer).getType(); const typeComposer = new TypeComposer(outputType); expect(typeComposer.hasField('recordId')).to.be.true; expect(typeComposer.getField('recordId').type).to.equal(GraphQLMongoID); }); it('should have record field', () => { - const outputType = removeById(UserModel, UserTypeComposer).getOutputType(); + const outputType = removeById(UserModel, UserTypeComposer).getType(); const typeComposer = new TypeComposer(outputType); expect(typeComposer.hasField('record')).to.be.true; expect(typeComposer.getField('record').type).to.equal(UserTypeComposer.getType()); @@ -194,7 +194,7 @@ describe('removeById() ->', () => { fields: () => ({}), }); typeStorage.set(outputTypeName, existedType); - const outputType = removeById(UserModel, UserTypeComposer).getOutputType(); + const outputType = removeById(UserModel, UserTypeComposer).getType(); expect(outputType).to.equal(existedType); }); }); diff --git a/src/resolvers/__tests__/removeMany-test.js b/src/resolvers/__tests__/removeMany-test.js index 2347c070..ac78fe7b 100644 --- a/src/resolvers/__tests__/removeMany-test.js +++ b/src/resolvers/__tests__/removeMany-test.js @@ -135,15 +135,15 @@ describe('removeMany() ->', () => { }); }); - describe('Resolver.getOutputType()', () => { + describe('Resolver.getType()', () => { it('should have correct output type name', () => { - const outputType = removeMany(UserModel, UserTypeComposer).getOutputType(); + const outputType = removeMany(UserModel, UserTypeComposer).getType(); expect(outputType).property('name') .to.equal(`RemoveMany${UserTypeComposer.getTypeName()}Payload`); }); it('should have numAffected field', () => { - const outputType = removeMany(UserModel, UserTypeComposer).getOutputType(); + const outputType = removeMany(UserModel, UserTypeComposer).getType(); const numAffectedField = new TypeComposer(outputType).getField('numAffected'); expect(numAffectedField).property('type').to.equal(GraphQLInt); }); @@ -155,7 +155,7 @@ describe('removeMany() ->', () => { fields: () => ({}), }); typeStorage.set(outputTypeName, existedType); - const outputType = removeMany(UserModel, UserTypeComposer).getOutputType(); + const outputType = removeMany(UserModel, UserTypeComposer).getType(); expect(outputType).to.equal(existedType); }); }); diff --git a/src/resolvers/__tests__/removeOne-test.js b/src/resolvers/__tests__/removeOne-test.js index 450bcdaa..588dfc13 100644 --- a/src/resolvers/__tests__/removeOne-test.js +++ b/src/resolvers/__tests__/removeOne-test.js @@ -203,21 +203,21 @@ describe('removeOne() ->', () => { }); }); - describe('Resolver.getOutputType()', () => { + describe('Resolver.getType()', () => { it('should have correct output type name', () => { - const outputType = removeOne(UserModel, UserTypeComposer).getOutputType(); + const outputType = removeOne(UserModel, UserTypeComposer).getType(); expect(outputType).property('name') .to.equal(`RemoveOne${UserTypeComposer.getTypeName()}Payload`); }); it('should have recordId field', () => { - const outputType = removeOne(UserModel, UserTypeComposer).getOutputType(); + const outputType = removeOne(UserModel, UserTypeComposer).getType(); const recordIdField = new TypeComposer(outputType).getField('recordId'); expect(recordIdField).property('type').to.equal(GraphQLMongoID); }); it('should have record field', () => { - const outputType = removeOne(UserModel, UserTypeComposer).getOutputType(); + const outputType = removeOne(UserModel, UserTypeComposer).getType(); const recordField = new TypeComposer(outputType).getField('record'); expect(recordField).property('type').to.equal(UserTypeComposer.getType()); }); @@ -229,7 +229,7 @@ describe('removeOne() ->', () => { fields: () => ({}), }); typeStorage.set(outputTypeName, existedType); - const outputType = removeOne(UserModel, UserTypeComposer).getOutputType(); + const outputType = removeOne(UserModel, UserTypeComposer).getType(); expect(outputType).to.equal(existedType); }); }); diff --git a/src/resolvers/__tests__/updateById-test.js b/src/resolvers/__tests__/updateById-test.js index 0f45348c..e330a7f3 100644 --- a/src/resolvers/__tests__/updateById-test.js +++ b/src/resolvers/__tests__/updateById-test.js @@ -186,22 +186,22 @@ describe('updateById() ->', () => { }); }); - describe('Resolver.getOutputType()', () => { + describe('Resolver.getType()', () => { it('should have correct output type name', () => { - const outputType = updateById(UserModel, UserTypeComposer).getOutputType(); + const outputType = updateById(UserModel, UserTypeComposer).getType(); expect(outputType.name) .to.equal(`UpdateById${UserTypeComposer.getTypeName()}Payload`); }); it('should have recordId field', () => { - const outputType = updateById(UserModel, UserTypeComposer).getOutputType(); + const outputType = updateById(UserModel, UserTypeComposer).getType(); const typeComposer = new TypeComposer(outputType); expect(typeComposer.hasField('recordId')).to.be.true; expect(typeComposer.getField('recordId').type).to.equal(GraphQLMongoID); }); it('should have record field', () => { - const outputType = updateById(UserModel, UserTypeComposer).getOutputType(); + const outputType = updateById(UserModel, UserTypeComposer).getType(); const typeComposer = new TypeComposer(outputType); expect(typeComposer.hasField('record')).to.be.true; expect(typeComposer.getField('record').type).to.equal(UserTypeComposer.getType()); @@ -214,7 +214,7 @@ describe('updateById() ->', () => { fields: () => ({}), }); typeStorage.set(outputTypeName, existedType); - const outputType = updateById(UserModel, UserTypeComposer).getOutputType(); + const outputType = updateById(UserModel, UserTypeComposer).getType(); expect(outputType).to.equal(existedType); }); }); diff --git a/src/resolvers/__tests__/updateMany-test.js b/src/resolvers/__tests__/updateMany-test.js index 54b8062d..fe848b9b 100644 --- a/src/resolvers/__tests__/updateMany-test.js +++ b/src/resolvers/__tests__/updateMany-test.js @@ -135,15 +135,15 @@ describe('updateMany() ->', () => { }); }); - describe('Resolver.getOutputType()', () => { + describe('Resolver.getType()', () => { it('should have correct output type name', () => { - const outputType = updateMany(UserModel, UserTypeComposer).getOutputType(); + const outputType = updateMany(UserModel, UserTypeComposer).getType(); expect(outputType).property('name') .to.equal(`UpdateMany${UserTypeComposer.getTypeName()}Payload`); }); it('should have numAffected field', () => { - const outputType = updateMany(UserModel, UserTypeComposer).getOutputType(); + const outputType = updateMany(UserModel, UserTypeComposer).getType(); const numAffectedField = new TypeComposer(outputType).getField('numAffected'); expect(numAffectedField).property('type').to.equal(GraphQLInt); }); @@ -155,7 +155,7 @@ describe('updateMany() ->', () => { fields: () => ({}), }); typeStorage.set(outputTypeName, existedType); - const outputType = updateMany(UserModel, UserTypeComposer).getOutputType(); + const outputType = updateMany(UserModel, UserTypeComposer).getType(); expect(outputType).to.equal(existedType); }); }); diff --git a/src/resolvers/__tests__/updateOne-test.js b/src/resolvers/__tests__/updateOne-test.js index 025cc47f..e64b5ee7 100644 --- a/src/resolvers/__tests__/updateOne-test.js +++ b/src/resolvers/__tests__/updateOne-test.js @@ -211,21 +211,21 @@ describe('updateOne() ->', () => { }); }); - describe('Resolver.getOutputType()', () => { + describe('Resolver.getType()', () => { it('should have correct output type name', () => { - const outputType = updateOne(UserModel, UserTypeComposer).getOutputType(); + const outputType = updateOne(UserModel, UserTypeComposer).getType(); expect(outputType).property('name') .to.equal(`UpdateOne${UserTypeComposer.getTypeName()}Payload`); }); it('should have recordId field', () => { - const outputType = updateOne(UserModel, UserTypeComposer).getOutputType(); + const outputType = updateOne(UserModel, UserTypeComposer).getType(); const recordIdField = new TypeComposer(outputType).getField('recordId'); expect(recordIdField).property('type').to.equal(GraphQLMongoID); }); it('should have record field', () => { - const outputType = updateOne(UserModel, UserTypeComposer).getOutputType(); + const outputType = updateOne(UserModel, UserTypeComposer).getType(); const recordField = new TypeComposer(outputType).getField('record'); expect(recordField).property('type').to.equal(UserTypeComposer.getType()); }); @@ -237,7 +237,7 @@ describe('updateOne() ->', () => { fields: () => ({}), }); typeStorage.set(outputTypeName, existedType); - const outputType = updateOne(UserModel, UserTypeComposer).getOutputType(); + const outputType = updateOne(UserModel, UserTypeComposer).getType(); expect(outputType).to.equal(existedType); }); }); diff --git a/src/resolvers/count.js b/src/resolvers/count.js index 1bdf9435..3af28e8e 100644 --- a/src/resolvers/count.js +++ b/src/resolvers/count.js @@ -27,7 +27,7 @@ export default function count( } return new Resolver({ - outputType: GraphQLInt, + type: GraphQLInt, name: 'count', kind: 'query', args: { diff --git a/src/resolvers/createOne.js b/src/resolvers/createOne.js index 4de755c6..f29fe81a 100644 --- a/src/resolvers/createOne.js +++ b/src/resolvers/createOne.js @@ -50,7 +50,7 @@ export default function createOne( name: 'createOne', kind: 'mutation', description: 'Create one document with mongoose defaults, setters, hooks and validation', - outputType, + type: outputType, args: { ...recordHelperArgs(typeComposer, { recordTypeName: `CreateOne${typeComposer.getTypeName()}Input`, diff --git a/src/resolvers/findById.js b/src/resolvers/findById.js index f2e16c09..7d65a1ee 100644 --- a/src/resolvers/findById.js +++ b/src/resolvers/findById.js @@ -27,7 +27,7 @@ export default function findById( } return new Resolver({ - outputType: typeComposer.getType(), + type: typeComposer.getType(), name: 'findById', kind: 'query', args: { diff --git a/src/resolvers/findByIds.js b/src/resolvers/findByIds.js index abe6f67f..72154535 100644 --- a/src/resolvers/findByIds.js +++ b/src/resolvers/findByIds.js @@ -30,7 +30,7 @@ export default function findByIds( } return new Resolver({ - outputType: new GraphQLList(typeComposer.getType()), + type: new GraphQLList(typeComposer.getType()), name: 'findByIds', kind: 'query', args: { diff --git a/src/resolvers/findMany.js b/src/resolvers/findMany.js index d256da2f..836e6746 100644 --- a/src/resolvers/findMany.js +++ b/src/resolvers/findMany.js @@ -31,7 +31,7 @@ export default function findMany( } return new Resolver({ - outputType: new GraphQLList(typeComposer.getType()), + type: new GraphQLList(typeComposer.getType()), name: 'findMany', kind: 'query', args: { diff --git a/src/resolvers/findOne.js b/src/resolvers/findOne.js index 26b37a41..7846ddb2 100644 --- a/src/resolvers/findOne.js +++ b/src/resolvers/findOne.js @@ -29,7 +29,7 @@ export default function findOne( } return new Resolver({ - outputType: typeComposer.getType(), + type: typeComposer.getType(), name: 'findOne', kind: 'query', args: { diff --git a/src/resolvers/removeById.js b/src/resolvers/removeById.js index fa379d94..358bf1a0 100644 --- a/src/resolvers/removeById.js +++ b/src/resolvers/removeById.js @@ -59,7 +59,7 @@ export default function removeById( description: 'Remove one document: ' + '1) Retrieve one document and remove with hooks via findByIdAndRemove. ' + '2) Return removed document.', - outputType, + type: outputType, args: { _id: { name: '_id', diff --git a/src/resolvers/removeMany.js b/src/resolvers/removeMany.js index 47596f1d..bf090ee0 100644 --- a/src/resolvers/removeMany.js +++ b/src/resolvers/removeMany.js @@ -50,7 +50,7 @@ export default function removeMany( description: 'Remove many documents without returning them: ' + 'Use Query.remove mongoose method. ' + 'Do not apply mongoose defaults, setters, hooks and validation. ', - outputType, + type: outputType, args: { ...filterHelperArgs(typeComposer, model, { filterTypeName: `FilterRemoveMany${typeComposer.getTypeName()}Input`, diff --git a/src/resolvers/removeOne.js b/src/resolvers/removeOne.js index 9f55dbfd..369cc36b 100644 --- a/src/resolvers/removeOne.js +++ b/src/resolvers/removeOne.js @@ -58,7 +58,7 @@ export default function removeOne( description: 'Remove one document: ' + '1) Remove with hooks via findOneAndRemove. ' + '2) Return removed document.', - outputType, + type: outputType, args: { ...filterHelperArgs(typeComposer, model, { filterTypeName: `FilterRemoveOne${typeComposer.getTypeName()}Input`, diff --git a/src/resolvers/updateById.js b/src/resolvers/updateById.js index f7465d59..ddba02b0 100644 --- a/src/resolvers/updateById.js +++ b/src/resolvers/updateById.js @@ -60,7 +60,7 @@ export default function updateById( + '2) Apply updates to mongoose document. ' + '3) Mongoose applies defaults, setters, hooks and validation. ' + '4) And save it.', - outputType, + type: outputType, args: { ...recordHelperArgs(typeComposer, { recordTypeName: `UpdateById${typeComposer.getTypeName()}Input`, diff --git a/src/resolvers/updateMany.js b/src/resolvers/updateMany.js index 68da81f1..3be7ebc4 100644 --- a/src/resolvers/updateMany.js +++ b/src/resolvers/updateMany.js @@ -53,7 +53,7 @@ export default function updateMany( description: 'Update many documents without returning them: ' + 'Use Query.update mongoose method. ' + 'Do not apply mongoose defaults, setters, hooks and validation. ', - outputType, + type: outputType, args: { ...recordHelperArgs(typeComposer, { recordTypeName: `UpdateMany${typeComposer.getTypeName()}Input`, diff --git a/src/resolvers/updateOne.js b/src/resolvers/updateOne.js index 5c8f4a93..11fe0fa3 100644 --- a/src/resolvers/updateOne.js +++ b/src/resolvers/updateOne.js @@ -62,7 +62,7 @@ export default function updateOne( + '2) Apply updates to mongoose document. ' + '3) Mongoose applies defaults, setters, hooks and validation. ' + '4) And save it.', - outputType, + type: outputType, args: { ...recordHelperArgs(typeComposer, { recordTypeName: `UpdateOne${typeComposer.getTypeName()}Input`,