Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use upperFirst from graphql-compose in all cases #262

Merged
merged 2 commits into from
Jun 16, 2021
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 changes: 1 addition & 2 deletions packages/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@
"graphql-compose": "^7.25.1",
"graphql-parse-resolve-info": "^4.11.0",
"jsonwebtoken": "^8.5.1",
"pluralize": "^8.0.0",
"upper-case-first": "^2.0.2"
"pluralize": "^8.0.0"
},
"peerDependencies": {
"graphql": "^15.0.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/graphql/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@
* limitations under the License.
*/

import { upperFirst } from "graphql-compose";
danstarns marked this conversation as resolved.
Show resolved Hide resolved

export { upperFirst };
export { DriverConfig, GraphQLOptionsArg, GraphQLWhereArg, DeleteInfo, GraphQLSortArg } from "./types";
export { Neo4jGraphQL, Neo4jGraphQLConstructor } from "./classes";
18 changes: 9 additions & 9 deletions packages/graphql/src/schema/make-augmented-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
UnionTypeDefinitionNode,
} from "graphql";
import {
upperFirst,
SchemaComposer,
InputTypeComposer,
ObjectTypeComposer,
Expand All @@ -43,7 +44,6 @@ import pluralize from "pluralize";
import { Node, Exclude } from "../classes";
import getAuth from "./get-auth";
import { PrimitiveField, Auth } from "../types";
import { upperFirstLetter } from "../utils";
import { findResolver, createResolver, deleteResolver, cypherResolver, updateResolver } from "./resolvers";
import checkNodeImplementsInterfaces from "./check-node-implements-interfaces";
import * as Scalars from "./scalars";
Expand All @@ -62,9 +62,9 @@ function makeAugmentedSchema(
const document = mergeTypeDefs(Array.isArray(typeDefs) ? (typeDefs as string[]) : [typeDefs as string]);

/*
Issue caused by a combination of GraphQL Compose removing types and
Issue caused by a combination of GraphQL Compose removing types and
that we are not adding Points to the validation schema. This should be a
temporary fix and does not detriment usability of the library.
temporary fix and does not detriment usability of the library.
*/
// validateTypeDefs(document);

Expand Down Expand Up @@ -443,11 +443,11 @@ function makeAugmentedSchema(
const concatFieldName = `${rel.fieldName}_${n.name}`;
const createField = rel.typeMeta.array ? `[${n.name}CreateInput!]` : `${n.name}CreateInput`;
const updateField = `${n.name}UpdateInput`;
const nodeFieldInputName = `${node.name}${upperFirstLetter(rel.fieldName)}${n.name}FieldInput`;
const nodeFieldUpdateInputName = `${node.name}${upperFirstLetter(rel.fieldName)}${
const nodeFieldInputName = `${node.name}${upperFirst(rel.fieldName)}${n.name}FieldInput`;
const nodeFieldUpdateInputName = `${node.name}${upperFirst(rel.fieldName)}${
n.name
}UpdateFieldInput`;
const nodeFieldDeleteInputName = `${node.name}${upperFirstLetter(rel.fieldName)}${
const nodeFieldDeleteInputName = `${node.name}${upperFirst(rel.fieldName)}${
n.name
}DeleteFieldInput`;

Expand Down Expand Up @@ -532,9 +532,9 @@ function makeAugmentedSchema(
const n = nodes.find((x) => x.name === rel.typeMeta.name) as Node;
const createField = rel.typeMeta.array ? `[${n.name}CreateInput!]` : `${n.name}CreateInput`;
const updateField = `${n.name}UpdateInput`;
const nodeFieldInputName = `${node.name}${upperFirstLetter(rel.fieldName)}FieldInput`;
const nodeFieldUpdateInputName = `${node.name}${upperFirstLetter(rel.fieldName)}UpdateFieldInput`;
const nodeFieldDeleteInputName = `${node.name}${upperFirstLetter(rel.fieldName)}DeleteFieldInput`;
const nodeFieldInputName = `${node.name}${upperFirst(rel.fieldName)}FieldInput`;
const nodeFieldUpdateInputName = `${node.name}${upperFirst(rel.fieldName)}UpdateFieldInput`;
const nodeFieldDeleteInputName = `${node.name}${upperFirst(rel.fieldName)}DeleteFieldInput`;
const connectField = rel.typeMeta.array ? `[${n.name}ConnectFieldInput!]` : `${n.name}ConnectFieldInput`;
const disconnectField = rel.typeMeta.array
? `[${n.name}DisconnectFieldInput!]`
Expand Down
1 change: 0 additions & 1 deletion packages/graphql/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@
export { default as trimmer } from "./trimmer";
export { default as execute } from "./execute";
export { default as checkNeo4jCompat } from "./verify-database";
export { default as upperFirstLetter } from "./upper-first-letter";
30 changes: 0 additions & 30 deletions packages/graphql/src/utils/upper-first-letter.test.ts

This file was deleted.

24 changes: 0 additions & 24 deletions packages/graphql/src/utils/upper-first-letter.ts

This file was deleted.

3 changes: 1 addition & 2 deletions packages/ogm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
"@graphql-tools/merge": "^6.2.13",
"@neo4j/graphql": "^1.0.2",
"camelcase": "^6.2.0",
"pluralize": "^8.0.0",
"upper-case-first": "^2.0.2"
"pluralize": "^8.0.0"
danstarns marked this conversation as resolved.
Show resolved Hide resolved
},
"peerDependencies": {
"graphql": "^15.0.0",
Expand Down
9 changes: 4 additions & 5 deletions packages/ogm/src/classes/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
import { DocumentNode, graphql, parse, print } from "graphql";
import pluralize from "pluralize";
import camelCase from "camelcase";
import { Neo4jGraphQL } from "@neo4j/graphql";
import { upperCaseFirst } from "upper-case-first";
import { Neo4jGraphQL, upperFirst } from "@neo4j/graphql";
import { GraphQLOptionsArg, GraphQLWhereArg, DeleteInfo } from "../types";

export interface ModelConstructor {
Expand Down Expand Up @@ -122,7 +121,7 @@ class Model {
context?: any;
rootValue?: any;
} = {}): Promise<T> {
const mutationName = `create${upperCaseFirst(this.namePluralized)}`;
const mutationName = `create${upperFirst(this.namePluralized)}`;

let selection = "";
if (selectionSet) {
Expand Down Expand Up @@ -174,7 +173,7 @@ class Model {
context?: any;
rootValue?: any;
} = {}): Promise<T> {
const mutationName = `update${upperCaseFirst(this.namePluralized)}`;
const mutationName = `update${upperFirst(this.namePluralized)}`;

let selection = "";
if (selectionSet) {
Expand Down Expand Up @@ -239,7 +238,7 @@ class Model {
context?: any;
rootValue?: any;
} = {}): Promise<DeleteInfo> {
const mutationName = `delete${upperCaseFirst(this.namePluralized)}`;
const mutationName = `delete${upperFirst(this.namePluralized)}`;

const argWorthy = where || deleteInput;

Expand Down
2 changes: 0 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,6 @@ __metadata:
semver: 7.3.5
ts-jest: 26.1.4
typescript: 3.9.7
upper-case-first: ^2.0.2
peerDependencies:
graphql: ^15.0.0
neo4j-driver: ^4.1.0
Expand Down Expand Up @@ -959,7 +958,6 @@ __metadata:
semver: 7.3.5
ts-jest: 26.1.4
typescript: 3.9.7
upper-case-first: ^2.0.2
peerDependencies:
graphql: ^15.0.0
neo4j-driver: ^4.1.0
Expand Down