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

Add support for typeDefs and resolvers ecosystem compatibility #233

Merged
merged 5 commits into from
Jan 21, 2019
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
Prev Previous commit
Next Next commit
feat(typedefs-resolvers): add buildTypeDefsAndResolvers util
  • Loading branch information
MichalLytek committed Jan 20, 2019
commit 9a0a8f2a46fdd33427532a286b7da67d554eb776
13 changes: 1 addition & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@ export * from "./decorators";
export * from "./scalars";
export * from "./errors";
export * from "./interfaces";

export { buildSchema, buildSchemaSync, BuildSchemaOptions } from "./utils/buildSchema";
export {
emitSchemaDefinitionFile,
emitSchemaDefinitionFileSync,
} from "./utils/emitSchemaDefinitionFile";
export {
useContainer,
ContainerType,
ContainerGetter,
UseContainerOptions,
} from "./utils/container";
export * from "./utils";

export { PubSubEngine } from "graphql-subscriptions";
11 changes: 11 additions & 0 deletions src/utils/buildTypeDefsAndResolvers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { printSchema } from "graphql";

import { BuildSchemaOptions, buildSchema } from "./buildSchema";
import { createResolversMap } from "./createResolversMap";

export async function buildTypeDefsAndResolvers(options: BuildSchemaOptions) {
const schema = await buildSchema(options);
const typeDefs = printSchema(schema);
const resolvers = createResolversMap(schema);
return { typeDefs, resolvers };
}
4 changes: 4 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { buildSchema, buildSchemaSync, BuildSchemaOptions } from "./buildSchema";
export { buildTypeDefsAndResolvers } from "./buildTypeDefsAndResolvers";
export { emitSchemaDefinitionFile, emitSchemaDefinitionFileSync } from "./emitSchemaDefinitionFile";
export { useContainer, ContainerType, ContainerGetter, UseContainerOptions } from "./container";