Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,162 changes: 1,843 additions & 1,319 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
"lodash": "^4.0.0"
},
"peerDependencies": {
"graphql": "^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14",
"graphql-relay": "^0.4.2 || ^0.5.0 || ^0.6.0",
"graphql": "^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14 || ^15 || ^16",
"graphql-relay": "^0.4.2 || ^0.5.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0",
"sequelize": ">=3.0.0"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be bumped also?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, this is one of the main complaints I get when I try to update packages, because 0.10.0 has a peerDep on 16+ https://github.com/graphql/graphql-relay-js/blob/main/package.json#L43

For 16 you need 0.10 and the lower ones still work as well

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@intellix Ah sorry, no I was curious whether we should also bump the peer dep requirement for sequelize. Would v3 still work with these updates?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, apart from the tests now running in v6, all I really added for sequelize was the findByPk in the ternary and fallback to constructor.options

},
"devDependencies": {
Expand All @@ -60,18 +60,18 @@
"chai": "^3.0.0",
"chai-as-promised": "^5.1.0",
"eslint": "^1.7.3",
"graphql": "^0.13.0",
"graphql-relay": "^0.6.0",
"graphql": "^16.6.0",
"graphql-relay": "^0.10.0",
"isparta": "^4.0.0",
"istanbul": "^0.4.0",
"mocha": "^3.0.1",
"mysql": "^2.11.1",
"pg": "^5.0.0",
"pg-hstore": "^2.3.2",
"sequelize": "^3.24.6",
"sequelize": "^6.25.6",
"sinon": "^1.15.4",
"sinon-as-promised": "^4.0.0",
"sinon-chai": "^2.8.0",
"sqlite3": "^4.0.0"
"sqlite3": "^5.1.2"
}
}
6 changes: 4 additions & 2 deletions src/relay.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function idFetcher(sequelize, nodeTypeMapper) {

const model = Object.keys(sequelize.models).find(model => model === type);
if (model) {
return sequelize.models[model].findById(id);
return sequelize.models[model].findByPk ? sequelize.models[model].findByPk(id) : sequelize.models[model].findById(id);
}

if (nodeType) {
Expand All @@ -75,6 +75,8 @@ export function typeResolver(nodeTypeMapper) {
? obj.Model.options.name.singular
: obj._modelOptions
? obj._modelOptions.name.singular
: obj.constructor.options
? obj.constructor.options.name.singular
: obj.name);

if (!type) {
Expand All @@ -84,7 +86,7 @@ export function typeResolver(nodeTypeMapper) {

const nodeType = nodeTypeMapper.item(type);
if (nodeType) {
return typeof nodeType.type === 'string' ? info.schema.getType(nodeType.type) : nodeType.type;
return typeof nodeType.type === 'string' ? nodeType.type : nodeType.type.name;
}

return null;
Expand Down
1 change: 0 additions & 1 deletion src/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import _ from 'lodash';
import argsToFindOptions from './argsToFindOptions';
import { isConnection, handleConnection, nodeType } from './relay';
import assert from 'assert';
import Promise from 'bluebird';

function whereQueryVarsToValues(o, vals) {
[
Expand Down
Loading