Skip to content

Commit c1f1850

Browse files
committed
fix(Dependencies): Fixes due deprecated methods in graphql-compose
1 parent 9edc5a8 commit c1f1850

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
},
3030
"peerDependencies": {
3131
"graphql": ">=0.7.1 || >=0.8.0",
32-
"graphql-compose": ">=1.0.0",
33-
"graphql-compose-connection": ">=2.0.0",
32+
"graphql-compose": ">=1.4.0",
33+
"graphql-compose-connection": ">=2.0.2",
3434
"mongoose": ">=4.0.0"
3535
},
3636
"devDependencies": {

src/__tests__/composeWithMongoose-test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ describe('composeWithMongoose ->', () => {
120120
},
121121
}).getInputTypeComposer();
122122

123-
expect(inputTypeComposer.isFieldRequired('name')).to.be.true;
124-
expect(inputTypeComposer.isFieldRequired('gender')).to.be.true;
125-
expect(inputTypeComposer.isFieldRequired('age')).to.be.false;
123+
expect(inputTypeComposer.isRequired('name')).to.be.true;
124+
expect(inputTypeComposer.isRequired('gender')).to.be.true;
125+
expect(inputTypeComposer.isRequired('age')).to.be.false;
126126
});
127127
});
128128

@@ -167,7 +167,7 @@ describe('composeWithMongoose ->', () => {
167167
});
168168
const filterArgInFindOne = typeComposer.getResolver('findOne').getArg('filter');
169169
const inputConposer = new InputTypeComposer(filterArgInFindOne.type);
170-
expect(inputConposer.isFieldRequired('age')).to.be.true;
170+
expect(inputConposer.isRequired('age')).to.be.true;
171171
});
172172
});
173173
});

src/composeWithMongoose.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function prepareInputFields(
8484
inputTypeComposer.removeField(inputFieldsOpts.remove);
8585
}
8686
if (inputFieldsOpts.required) {
87-
inputTypeComposer.makeFieldsRequired(inputFieldsOpts.required);
87+
inputTypeComposer.makeRequired(inputFieldsOpts.required);
8888
}
8989
}
9090

src/resolvers/helpers/filter.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ export const filterHelperArgs = (
6666
inputComposer.removeField(removeFields);
6767

6868
if (opts.requiredFields) {
69-
inputComposer.makeFieldsRequired(opts.requiredFields);
69+
inputComposer.makeRequired(opts.requiredFields);
7070
}
7171

72-
if (!opts.hasOwnProperty('operators') || opts.operators !== false) {
72+
if (!{}.hasOwnProperty.call(opts, 'operators') || opts.operators !== false) {
7373
addFieldsWithOperator(
7474
// $FlowFixMe
7575
`Operators${opts.filterTypeName}`,
@@ -208,7 +208,7 @@ export function addFieldsWithOperator(
208208
});
209209
if (Object.keys(fields).length > 0) {
210210
const operatorTypeName = `${upperFirst(fieldName)}${typeName}`;
211-
operatorsComposer.addField(fieldName, {
211+
operatorsComposer.setField(fieldName, {
212212
type: typeStorage.getOrSet(
213213
operatorTypeName,
214214
new GraphQLInputObjectType({
@@ -223,7 +223,7 @@ export function addFieldsWithOperator(
223223
});
224224

225225
if (Object.keys(operatorsComposer.getFields()).length > 0) {
226-
inputComposer.addField(OPERATORS_FIELDNAME, {
226+
inputComposer.setField(OPERATORS_FIELDNAME, {
227227
type: operatorsComposer.getType(),
228228
description: 'List of fields that can be filtered via operators',
229229
});

src/resolvers/helpers/record.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const recordHelperArgs = (
3434
}
3535

3636
if (opts && opts.requiredFields) {
37-
recordComposer.makeFieldsRequired(opts.requiredFields);
37+
recordComposer.makeRequired(opts.requiredFields);
3838
}
3939

4040
return {

0 commit comments

Comments
 (0)