This repository has been archived by the owner on May 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce85963
commit 8f1e5ad
Showing
6 changed files
with
64 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type Query { | ||
posts: [String] | ||
} |
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,36 @@ | ||
import { Graphcool as BaseGraphcool, BaseGraphcoolOptions } from 'graphcool-binding' | ||
import { GraphQLResolveInfo } from 'graphql' | ||
|
||
const typeDefs = ` | ||
type Query { | ||
posts: [String] | ||
}` | ||
|
||
/* | ||
The `Boolean` scalar type represents `true` or `false`. | ||
*/ | ||
export type Boolean = boolean | ||
|
||
/* | ||
The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text. | ||
*/ | ||
export type String = string | ||
|
||
export interface Schema { | ||
query: Query | ||
} | ||
|
||
export type Query = { | ||
posts: (args: {}, info?: GraphQLResolveInfo | string) => Promise<Array<String> | null> | ||
} | ||
|
||
export class Graphcool extends BaseGraphcool { | ||
|
||
constructor({ endpoint, secret, fragmentReplacements, debug }: BaseGraphcoolOptions) { | ||
super({ typeDefs, endpoint, secret, fragmentReplacements, debug }); | ||
} | ||
|
||
query: Query = { | ||
posts: (args, info): Promise<Array<String> | null> => super.delegate('query', 'posts', args, {}, info) | ||
} | ||
} |