Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion dist/vuex-orm-graphql.es5.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vuex-orm-graphql.es5.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vuex-orm-graphql.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vuex-orm-graphql.umd.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/adapters/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ export default interface Adapter {

getFilterTypeName(model: Model): string;
getInputTypeName(model: Model, action?: string): string;

prepareSchemaTypeName(type: string): string;
}
4 changes: 4 additions & 0 deletions src/adapters/builtin/default-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,8 @@ export default class DefaultAdapter implements Adapter {
getNameForPush(model: Model): string {
return `update${upcaseFirstLetter(model.singularName)}`;
}

prepareSchemaTypeName(type: string): string {
return upcaseFirstLetter(type);
}
}
5 changes: 4 additions & 1 deletion src/graphql/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ export default class Schema {
private mutations: Map<string, GraphQLField>;
private queries: Map<string, GraphQLField>;

private readonly prepareTypeFunc: (type: string) => string;

public constructor(schema: GraphQLSchema) {
const context = Context.getInstance();

this.schema = schema;
this.types = new Map<string, GraphQLType>();
this.mutations = new Map<string, GraphQLField>();
this.queries = new Map<string, GraphQLField>();
this.prepareTypeFunc = context.adapter.prepareSchemaTypeName;

this.schema.types.forEach((t: GraphQLType) => this.types.set(t.name, t));

Expand Down Expand Up @@ -61,7 +64,7 @@ export default class Schema {
}

public getType(name: string, allowNull: boolean = false): GraphQLType | null {
name = upcaseFirstLetter(name);
name = this.prepareTypeFunc(name);
const type = this.types.get(name);

if (!allowNull && !type) {
Expand Down