forked from nestjs/graphql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from nestjs/master
merge
- Loading branch information
Showing
106 changed files
with
4,314 additions
and
2,334 deletions.
There are no files selected for viewing
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
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
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
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
21 changes: 21 additions & 0 deletions
21
packages/apollo/tests/code-first-duplicate-resolvers/app.module.ts
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,21 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { GraphQLModule } from '@nestjs/graphql'; | ||
import { ApolloDriver } from '../../lib'; | ||
import { ModuleAModule } from './module-a/module-a.module'; | ||
import { ModuleBModule } from './module-b/module-b.module'; | ||
import { QueryResolver } from './query.resolver'; | ||
|
||
@Module({ | ||
imports: [ | ||
GraphQLModule.forRoot({ | ||
driver: ApolloDriver, | ||
autoSchemaFile: true, | ||
}), | ||
ModuleAModule, | ||
ModuleBModule, | ||
QueryResolver, | ||
], | ||
controllers: [], | ||
providers: [], | ||
}) | ||
export class AppModule {} |
9 changes: 9 additions & 0 deletions
9
packages/apollo/tests/code-first-duplicate-resolvers/module-a/module-a.module.ts
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,9 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { UserResolver } from './user.resolver'; | ||
|
||
@Module({ | ||
imports: [], | ||
controllers: [], | ||
providers: [UserResolver], | ||
}) | ||
export class ModuleAModule {} |
9 changes: 9 additions & 0 deletions
9
packages/apollo/tests/code-first-duplicate-resolvers/module-a/user.resolver.ts
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,9 @@ | ||
import { Args, Mutation, Resolver } from '@nestjs/graphql'; | ||
|
||
@Resolver() | ||
export class UserResolver { | ||
@Mutation(() => String, { name: 'moduleALogin' }) | ||
login(@Args('code') code: string) { | ||
return code; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/apollo/tests/code-first-duplicate-resolvers/module-b/module-b.module.ts
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,9 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { UserResolver } from './user.resolver'; | ||
|
||
@Module({ | ||
imports: [], | ||
controllers: [], | ||
providers: [UserResolver], | ||
}) | ||
export class ModuleBModule {} |
9 changes: 9 additions & 0 deletions
9
packages/apollo/tests/code-first-duplicate-resolvers/module-b/user.resolver.ts
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,9 @@ | ||
import { Args, Mutation, Resolver } from '@nestjs/graphql'; | ||
|
||
@Resolver() | ||
export class UserResolver { | ||
@Mutation(() => String, { name: 'moduleBLogin' }) | ||
login(@Args('username') username: string) { | ||
return username; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/apollo/tests/code-first-duplicate-resolvers/query.resolver.ts
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,9 @@ | ||
import { Args, Mutation, Query, Resolver } from '@nestjs/graphql'; | ||
|
||
@Resolver() | ||
export class QueryResolver { | ||
@Query(() => Boolean, { name: '_' }) | ||
test() { | ||
return true; | ||
} | ||
} |
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,30 @@ | ||
import { CustomScalar, Scalar } from '@nestjs/graphql'; | ||
import { Kind } from 'graphql'; | ||
|
||
@Scalar('SampleScalar') | ||
export class SampleScalar implements CustomScalar<string, string> { | ||
description = 'A sample scalar'; | ||
|
||
parseValue(value: unknown): string { | ||
if (typeof value !== 'string') { | ||
throw new Error(`Expected a string, but got ${value}.`); | ||
} | ||
return value; | ||
} | ||
|
||
serialize(obj: unknown): string { | ||
if (typeof obj !== 'string') { | ||
throw new Error(`Expected a string, but got ${obj}.`); | ||
} | ||
return obj; | ||
} | ||
|
||
parseLiteral(ast: any): string { | ||
if (ast.kind === Kind.STRING) { | ||
return ast.value; | ||
} | ||
throw new Error( | ||
`Expected value of kind 'STRING', but got kind '${ast.kind}'.`, | ||
); | ||
} | ||
} |
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
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,20 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { GraphQLModule } from '@nestjs/graphql'; | ||
import { join } from 'path'; | ||
import { ApolloDriver } from '../../lib'; | ||
import { ModuleAModule } from './module-a/module-a.module'; | ||
import { ModuleBModule } from './module-b/module-b.module'; | ||
|
||
@Module({ | ||
imports: [ | ||
GraphQLModule.forRoot({ | ||
driver: ApolloDriver, | ||
typePaths: [join(__dirname, '*.graphql')], | ||
}), | ||
ModuleAModule, | ||
ModuleBModule, | ||
], | ||
controllers: [], | ||
providers: [], | ||
}) | ||
export class AppModule {} |
8 changes: 8 additions & 0 deletions
8
packages/apollo/tests/duplicate-resolvers/duplicate-resolver.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,8 @@ | ||
type Query { | ||
_: Boolean | ||
} | ||
|
||
type Mutation { | ||
moduleALogin(code: String): String | ||
moduleBLogin(username: String): String | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/apollo/tests/duplicate-resolvers/module-a/module-a.module.ts
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,9 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { UserResolver } from './user.resolver'; | ||
|
||
@Module({ | ||
imports: [], | ||
controllers: [], | ||
providers: [UserResolver], | ||
}) | ||
export class ModuleAModule {} |
Oops, something went wrong.