-
Notifications
You must be signed in to change notification settings - Fork 26.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'canary' into remove-pocess-usage-from-polyfill
- Loading branch information
Showing
20 changed files
with
126 additions
and
140 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,6 @@ yarn-error.log* | |
*.graphql.d.ts | ||
*.graphqls.d.ts | ||
.cache | ||
|
||
lib/resolvers-types.ts | ||
lib/graphql-operations.ts |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
schema: | ||
- 'lib/schema.ts': | ||
noRequire: true | ||
documents: ./lib/documents/*.graphql | ||
generates: | ||
./lib/graphql-operations.ts: | ||
plugins: | ||
- typescript | ||
- typescript-operations | ||
- typed-document-node | ||
./lib/resolvers-types.ts: | ||
plugins: | ||
- typescript | ||
- typescript-resolvers |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
examples/with-typescript-graphql/lib/documents/updateName.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
mutation UpdateName($name: String!) { | ||
updateName(name: $name) { | ||
id | ||
name | ||
status | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
examples/with-typescript-graphql/lib/documents/viewer.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
query Viewer { | ||
viewer { | ||
...Partial | ||
status | ||
} | ||
} | ||
|
||
fragment Partial on User { | ||
id | ||
name | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import { QueryResolvers, MutationResolvers } from '@graphql-types@' | ||
import { ResolverContext } from './apollo' | ||
import { Resolvers } from './resolvers-types' | ||
|
||
const userProfile = { | ||
id: String(1), | ||
name: 'John Smith', | ||
status: 'cached', | ||
} | ||
|
||
const Query: Required<QueryResolvers<ResolverContext>> = { | ||
viewer(_parent, _args, _context, _info) { | ||
return userProfile | ||
const resolvers: Resolvers = { | ||
Query: { | ||
viewer(_parent, _args, _context, _info) { | ||
return userProfile | ||
}, | ||
}, | ||
} | ||
|
||
const Mutation: Required<MutationResolvers<ResolverContext>> = { | ||
updateName(_parent, _args, _context, _info) { | ||
userProfile.name = _args.name | ||
return userProfile | ||
Mutation: { | ||
updateName(_parent, _args, _context, _info) { | ||
userProfile.name = _args.name | ||
return userProfile | ||
}, | ||
}, | ||
} | ||
|
||
export default { Query, Mutation } | ||
export default resolvers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
import { join } from 'path' | ||
import { makeExecutableSchema } from '@graphql-tools/schema' | ||
import { loadFilesSync } from '@graphql-tools/load-files' | ||
import { mergeTypeDefs } from '@graphql-tools/merge' | ||
import graphQLLetConfig from '../.graphql-let.yml' | ||
import resolvers from './resolvers' | ||
const typeDefs = /* GraphQL */ ` | ||
type User { | ||
id: ID! | ||
name: String! | ||
status: String! | ||
} | ||
const loadedFiles = loadFilesSync(join(process.cwd(), graphQLLetConfig.schema)) | ||
const typeDefs = mergeTypeDefs(loadedFiles) | ||
type Query { | ||
viewer: User! | ||
} | ||
export const schema = makeExecutableSchema({ | ||
typeDefs, | ||
resolvers, | ||
}) | ||
type Mutation { | ||
updateName(name: String!): User! | ||
} | ||
` | ||
|
||
export default typeDefs |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,40 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"codegen": "graphql-let", | ||
"codegen": "graphql-codegen -r ts-node/register", | ||
"dev": "yarn codegen && next", | ||
"build": "yarn codegen && next build", | ||
"test": "yarn codegen && jest", | ||
"start": "next start" | ||
}, | ||
"dependencies": { | ||
"@apollo/client": "^3.1.3", | ||
"@apollo/client": "^3.5.10", | ||
"graphql-tag": "^2.12.6", | ||
"@graphql-tools/load-files": "6.0.18", | ||
"@graphql-yoga/node": "^2.2.1", | ||
"@graphql-tools/merge": "6.0.18", | ||
"@graphql-tools/schema": "6.0.18", | ||
"apollo-server-micro": "^2.16.1", | ||
"graphql": "15.3.0", | ||
"next": "latest", | ||
"graphql": "15.6.0", | ||
"next": "^12.1.5", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2" | ||
}, | ||
"devDependencies": { | ||
"@graphql-codegen/cli": "^2.2.1", | ||
"@graphql-codegen/import-types-preset": "^2.1.6", | ||
"@graphql-codegen/plugin-helpers": "^2.2.0", | ||
"@graphql-codegen/typescript": "^2.2.4", | ||
"@graphql-codegen/typescript-operations": "^2.1.8", | ||
"@graphql-codegen/typescript-react-apollo": "^3.1.6", | ||
"@graphql-codegen/typescript-resolvers": "^2.3.2", | ||
"@graphql-codegen/typed-document-node": "^2.2.8", | ||
"@graphql-codegen/cli": "^2.6.2", | ||
"@graphql-codegen/typescript": "^2.4.8", | ||
"@graphql-codegen/typescript-operations": "^2.3.5", | ||
"@graphql-codegen/typescript-resolvers": "^2.6.1", | ||
"@types/jest": "^27.0.2", | ||
"@types/mocha": "^9.0.0", | ||
"@types/react": "^16.9.46", | ||
"@types/react-dom": "^16.9.8", | ||
"@types/react-test-renderer": "^17.0.1", | ||
"@types/jest": "^27.0.2", | ||
"@types/mocha": "^9.0.0", | ||
"babel-jest": "27.2.5", | ||
"graphql-let": "^0.18.6", | ||
"graphql-tag": "2.11.0", | ||
"jest": "^27.2.5", | ||
"react-test-renderer": "^17.0.1", | ||
"typescript": "^4.5.4", | ||
"yaml-loader": "0.6.0" | ||
"typescript": "^4.6.3", | ||
"yaml-loader": "0.6.0", | ||
"ts-node": "10.8.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
import { ApolloServer } from 'apollo-server-micro' | ||
import { schema } from '../../lib/schema' | ||
import { createServer } from '@graphql-yoga/node' | ||
import gql from 'graphql-tag' | ||
|
||
const apolloServer = new ApolloServer({ schema }) | ||
import resolvers from 'lib/resolvers' | ||
import typeDefs from 'lib/schema' | ||
|
||
export const config = { | ||
api: { | ||
bodyParser: false, | ||
const server = createServer({ | ||
schema: { | ||
typeDefs: gql(typeDefs), | ||
resolvers, | ||
}, | ||
} | ||
endpoint: '/api/graphql', | ||
// graphiql: false // uncomment to disable GraphiQL | ||
}) | ||
|
||
export default apolloServer.createHandler({ path: '/api/graphql' }) | ||
export default server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.