Skip to content

Commit

Permalink
graphql-compose to 9.x and fix results of breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
darrellwarde committed Jul 29, 2021
1 parent fb89e20 commit 7a33746
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
2 changes: 1 addition & 1 deletion packages/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"debug": "^4.3.2",
"deep-equal": "^2.0.5",
"dot-prop": "^6.0.1",
"graphql-compose": "^8.1.0",
"graphql-compose": "^9.0.2",
"graphql-parse-resolve-info": "^4.12.0",
"graphql-relay": "^0.8.0",
"jsonwebtoken": "^8.5.1",
Expand Down
8 changes: 2 additions & 6 deletions packages/graphql/src/schema/make-augmented-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,7 @@ function makeAugmentedSchema(
name: node.name,
fields: nodeFields,
description: node.description,
extensions: {
directives: graphqlDirectivesToCompose(node.otherDirectives),
},
directives: graphqlDirectivesToCompose(node.otherDirectives),
interfaces: node.interfaces.map((x) => x.name.value),
});

Expand Down Expand Up @@ -1254,9 +1252,7 @@ function makeAugmentedSchema(
name: inter.name.value,
description: inter.description?.value,
fields: objectComposeFields,
extensions: {
directives: graphqlDirectivesToCompose((inter.directives || []).filter((x) => x.name.value !== "auth")),
},
directives: graphqlDirectivesToCompose((inter.directives || []).filter((x) => x.name.value !== "auth")),
});
});

Expand Down
8 changes: 3 additions & 5 deletions packages/graphql/src/schema/to-compose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { InputValueDefinitionNode, DirectiveNode } from "graphql";
import { ExtensionsDirective, DirectiveArgs, ObjectTypeComposerFieldConfigAsObjectDefinition } from "graphql-compose";
import { DirectiveArgs, ObjectTypeComposerFieldConfigAsObjectDefinition, Directive } from "graphql-compose";
import { isInt, Integer } from "neo4j-driver";
import getFieldTypeMeta from "./get-field-type-meta";
import parseValueNode from "./parse-value-node";
Expand All @@ -39,7 +39,7 @@ export function graphqlArgsToCompose(args: InputValueDefinitionNode[]) {
}, {});
}

export function graphqlDirectivesToCompose(directives: DirectiveNode[]): ExtensionsDirective[] {
export function graphqlDirectivesToCompose(directives: DirectiveNode[]): Directive[] {
return directives.map((directive) => ({
args: (directive.arguments || [])?.reduce(
(r: DirectiveArgs, d) => ({ ...r, [d.name.value]: parseValueNode(d.value) }),
Expand All @@ -64,9 +64,7 @@ export function objectFieldsToComposeFields(
} as ObjectTypeComposerFieldConfigAsObjectDefinition<any, any>;

if (field.otherDirectives.length) {
newField.extensions = {
directives: graphqlDirectivesToCompose(field.otherDirectives),
};
newField.directives = graphqlDirectivesToCompose(field.otherDirectives);
}

if (["Int", "Float"].includes(field.typeMeta.name)) {
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ __metadata:
deep-equal: ^2.0.5
dot-prop: ^6.0.1
faker: 5.2.0
graphql-compose: ^8.1.0
graphql-compose: ^9.0.2
graphql-parse-resolve-info: ^4.12.0
graphql-relay: ^0.8.0
graphql-tag: 2.11.0
Expand Down Expand Up @@ -6643,16 +6643,16 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"graphql-compose@npm:^8.1.0":
version: 8.1.0
resolution: "graphql-compose@npm:8.1.0"
"graphql-compose@npm:^9.0.2":
version: 9.0.2
resolution: "graphql-compose@npm:9.0.2"
dependencies:
"@types/object-path": ^0.11.0
graphql-type-json: 0.3.2
object-path: 0.11.5
peerDependencies:
graphql: ^14.2.0 || ^15.0.0
checksum: 9c660ed7c6500e4ff7d1e815884c5e197afb49b3a11d18f95f2d211e6744c54cbe9a2ba1b07c0aebc8cbbca1d6d03a7658c10809f61849f7b4e7459e583e28d5
graphql: ^14.2.0 || ^15.0.0 || ^16.0.0
checksum: 0c5c7967c1e8e6ea4fd7f65fb08212d65ddda980a9321a089599dd7e000b9d53a71be317abe6d16fb4079e6687b95470b383f6670a288322e7d1d16fdfcd2132
languageName: node
linkType: hard

Expand Down

0 comments on commit 7a33746

Please sign in to comment.