Skip to content

Commit

Permalink
fix(Dependencies): Fixes due deprecated methods in graphql-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
nodkz committed Oct 25, 2016
1 parent 9edc5a8 commit c1f1850
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
},
"peerDependencies": {
"graphql": ">=0.7.1 || >=0.8.0",
"graphql-compose": ">=1.0.0",
"graphql-compose-connection": ">=2.0.0",
"graphql-compose": ">=1.4.0",
"graphql-compose-connection": ">=2.0.2",
"mongoose": ">=4.0.0"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions src/__tests__/composeWithMongoose-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ describe('composeWithMongoose ->', () => {
},
}).getInputTypeComposer();

expect(inputTypeComposer.isFieldRequired('name')).to.be.true;
expect(inputTypeComposer.isFieldRequired('gender')).to.be.true;
expect(inputTypeComposer.isFieldRequired('age')).to.be.false;
expect(inputTypeComposer.isRequired('name')).to.be.true;
expect(inputTypeComposer.isRequired('gender')).to.be.true;
expect(inputTypeComposer.isRequired('age')).to.be.false;
});
});

Expand Down Expand Up @@ -167,7 +167,7 @@ describe('composeWithMongoose ->', () => {
});
const filterArgInFindOne = typeComposer.getResolver('findOne').getArg('filter');
const inputConposer = new InputTypeComposer(filterArgInFindOne.type);
expect(inputConposer.isFieldRequired('age')).to.be.true;
expect(inputConposer.isRequired('age')).to.be.true;
});
});
});
2 changes: 1 addition & 1 deletion src/composeWithMongoose.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function prepareInputFields(
inputTypeComposer.removeField(inputFieldsOpts.remove);
}
if (inputFieldsOpts.required) {
inputTypeComposer.makeFieldsRequired(inputFieldsOpts.required);
inputTypeComposer.makeRequired(inputFieldsOpts.required);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/resolvers/helpers/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ export const filterHelperArgs = (
inputComposer.removeField(removeFields);

if (opts.requiredFields) {
inputComposer.makeFieldsRequired(opts.requiredFields);
inputComposer.makeRequired(opts.requiredFields);
}

if (!opts.hasOwnProperty('operators') || opts.operators !== false) {
if (!{}.hasOwnProperty.call(opts, 'operators') || opts.operators !== false) {
addFieldsWithOperator(
// $FlowFixMe
`Operators${opts.filterTypeName}`,
Expand Down Expand Up @@ -208,7 +208,7 @@ export function addFieldsWithOperator(
});
if (Object.keys(fields).length > 0) {
const operatorTypeName = `${upperFirst(fieldName)}${typeName}`;
operatorsComposer.addField(fieldName, {
operatorsComposer.setField(fieldName, {
type: typeStorage.getOrSet(
operatorTypeName,
new GraphQLInputObjectType({
Expand All @@ -223,7 +223,7 @@ export function addFieldsWithOperator(
});

if (Object.keys(operatorsComposer.getFields()).length > 0) {
inputComposer.addField(OPERATORS_FIELDNAME, {
inputComposer.setField(OPERATORS_FIELDNAME, {
type: operatorsComposer.getType(),
description: 'List of fields that can be filtered via operators',
});
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/helpers/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const recordHelperArgs = (
}

if (opts && opts.requiredFields) {
recordComposer.makeFieldsRequired(opts.requiredFields);
recordComposer.makeRequired(opts.requiredFields);
}

return {
Expand Down

0 comments on commit c1f1850

Please sign in to comment.