Skip to content

Commit

Permalink
fix(Dependencies): Fix due changes in graphql-compose@1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nodkz committed Oct 12, 2016
1 parent edfae85 commit 52c9fc3
Show file tree
Hide file tree
Showing 8 changed files with 3,633 additions and 28 deletions.
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,6 @@
"sane": "1.4.1",
"semantic-release": "4.3.5"
},
"scripts": {
"build": "npm run build-cjs && npm run build-flow && npm run build-es",
"build-cjs": "rimraf lib && babel src --ignore __tests__,__mocks__ -d lib",
"build-es": "rimraf es && BABEL_ENV=es babel src --ignore __tests__,__mocks__ -d es",
"build-flow": "find ./src -name '*.js' -not -path '*/__*' | while read filepath; do cp $filepath `echo $filepath | sed 's/\\/src\\//\\/lib\\//g'`.flow; done",
"coverage": "nyc npm run test",
"lint": "eslint src test *.js",
"test": "babel-node ./node_modules/.bin/_mocha --compilers js:babel-core/register --reporter dot --require ./resources/mocha-bootload src/**/__tests__/**/*-test.js",
"watch": "babel-node ./resources/watch.js",
"link": "npm link graphql && npm link graphql-compose && npm link",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"dependencies": {
"babel-runtime": "6.11.6"
},
Expand All @@ -87,5 +75,17 @@
"lcov",
"text"
]
},
"scripts": {
"build": "npm run build-cjs && npm run build-flow && npm run build-es",
"build-cjs": "rimraf lib && babel src --ignore __tests__,__mocks__ -d lib",
"build-es": "rimraf es && BABEL_ENV=es babel src --ignore __tests__,__mocks__ -d es",
"build-flow": "find ./src -name '*.js' -not -path '*/__*' | while read filepath; do cp $filepath `echo $filepath | sed 's/\\/src\\//\\/lib\\//g'`.flow; done",
"coverage": "nyc npm run test",
"lint": "eslint src test *.js",
"test": "babel-node ./node_modules/.bin/_mocha --compilers js:babel-core/register --reporter dot --require ./resources/mocha-bootload src/**/__tests__/**/*-test.js",
"watch": "babel-node ./resources/watch.js",
"link": "npm link graphql && npm link graphql-compose && npm link",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
}
}
2 changes: 1 addition & 1 deletion resources/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function runTests(filepaths) {
['src/**/__tests__/**/*-test.js']
);
// console.log(cmd);
return exec('babel-node', cmd).catch(() => false);
return exec('node', cmd).catch(() => false);
}

function lintFiles(filepaths) {
Expand Down
7 changes: 5 additions & 2 deletions src/__mocks__/userTypeComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function sortUserList(list, sortValue = {}) {
return list;
}

export const findManyResolver = new Resolver(userTypeComposer, {
export const findManyResolver = new Resolver({
name: 'findMany',
kind: 'query',
outputType: UserType,
Expand Down Expand Up @@ -167,8 +167,10 @@ export const findManyResolver = new Resolver(userTypeComposer, {
return Promise.resolve(list);
},
});
userTypeComposer.setResolver('findMany', findManyResolver);

export const countResolver = new Resolver(userTypeComposer, {

export const countResolver = new Resolver({
name: 'count',
kind: 'query',
outputType: GraphQLInt,
Expand All @@ -184,6 +186,7 @@ export const countResolver = new Resolver(userTypeComposer, {
);
},
});
userTypeComposer.setResolver('count', countResolver);


export const sortOptions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import { expect } from 'chai';
import { GraphQLInt } from 'graphql';
import { Resolver } from 'graphql-compose';
import { userTypeComposer, userList, sortOptions } from '../../__mocks__/userTypeComposer';
import { dataToCursor } from '../../cursor';
import { userTypeComposer, userList, sortOptions } from '../__mocks__/userTypeComposer';
import { dataToCursor } from '../cursor';
import {
prepareConnectionResolver,
prepareFilter,
preparePageInfo,
} from '../connectionResolver';
import Cursor from '../../types/cursorType';
import Cursor from '../types/cursorType';


describe('connectionResolver', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/composeWithConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { TypeComposer } from 'graphql-compose';
import type {
composeWithConnectionOpts,
} from './definition.js';
import { prepareConnectionResolver } from './resolvers/connectionResolver';
import { prepareConnectionResolver } from './connectionResolver';

export function composeWithConnection(
typeComposer: TypeComposer,
Expand All @@ -27,6 +27,6 @@ export function composeWithConnection(
opts
);

typeComposer.addResolver(resolver);
typeComposer.setResolver('connection', resolver);
return typeComposer;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import type {
composeWithConnectionOpts,
connectionSortOpts,
GraphQLConnectionType,
} from '../definition';
import { prepareConnectionType } from '../types/connectionType';
import { prepareSortType } from '../types/sortInputType';
import CursorType from '../types/cursorType';
import { cursorToData, dataToCursor } from '../cursor';
} from './definition';
import { prepareConnectionType } from './types/connectionType';
import { prepareSortType } from './types/sortInputType';
import CursorType from './types/cursorType';
import { cursorToData, dataToCursor } from './cursor';

export function prepareConnectionResolver(
typeComposer: TypeComposer,
Expand All @@ -33,7 +33,7 @@ export function prepareConnectionResolver(
+ `should have resolver with name '${opts.countResolverName}' `
+ 'due opts.countResolverName.');
}
const countResolve = countResolver.composeResolve();
const countResolve = countResolver.getResolve();

if (!opts.findResolverName) {
throw new Error(`TypeComposer(${typeComposer.getTypeName()}) provided to composeWithConnection `
Expand All @@ -45,7 +45,7 @@ export function prepareConnectionResolver(
+ `should have resolver with name '${opts.findResolverName}' `
+ 'due opts.countResolverName.');
}
const findManyResolve = findManyResolver.composeResolve();
const findManyResolve = findManyResolver.getResolve();

const additionalArgs = {};
if (findManyResolver.hasArg('filter')) {
Expand All @@ -54,7 +54,7 @@ export function prepareConnectionResolver(

const sortEnumType = prepareSortType(typeComposer, opts);

return new Resolver(typeComposer, {
return new Resolver({
outputType: prepareConnectionType(typeComposer),
name: 'connection',
kind: 'query',
Expand Down
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
import { composeWithConnection } from './composeWithConnection';

export default composeWithConnection;

export {
composeWithConnection
};
Loading

0 comments on commit 52c9fc3

Please sign in to comment.