Skip to content

Instantly share code, notes, and snippets.

View kamilkisiela's full-sized avatar
🕶️
Kamil Kisiela

Kamil Kisiela kamilkisiela

🕶️
Kamil Kisiela
View GitHub Profile
@kamilkisiela
kamilkisiela / package.json
Created January 14, 2019 14:33
GraphQL Inspector setup
{
"name": "my-app",
"scripts": {
"graphql:write": "graphql-inspector introspect src/schema.js --write schema.graphql"
},
"graphql-inspector": {
"diff": true,
"schema": {
"ref": "head/master",
"path": "schema.graphql"
function skipIntro() {
const el = document.querySelector('.skip-credits');
if(el) {
el.children[0].click();
setTimeout(() => {
const play = document.querySelector('.button-nfplayerPlay');
if (play) {
play.click();
}
}, 500);
import { GetPostGQL, Post } from './generated/graphql';
@Component({...})
export class PostComponent {
@Input() postId: string;
post: Observable<Post>;
constructor(
private getPostGQL: GetPostGQL
) {}
query getPost ($id: String!) {
post(id: $id) {
id
text
}
}
import { Apollo } from 'apollo-angular';
import gql from 'graphql-tag';
interface Post {
id: string;
text: string;
}
interface PostQuery {
post: Post;
import { PostResolvers } from './generated-types';
const Post: PostResolvers.Resolvers = {
id: (parent) => parent._id,
text: (parent) => parent.content
};
const PostType = gql`
type Post {
id: String
text: String
}
`;
const Post = {
id: (parent) => parent._id,
text: (parent) => parent.content
new GraphQLObjectType({
name: 'Post',
fields: {
id: {
type: GraphQLString,
resolve: (parent) => parent._id
},
text: {
type: GraphQLString,
resolve: (parent) => parent.content
type Post {
id: String
text: String
}
new GraphQLObjectType({
name: 'Post',
fields: {
id: {
type: GraphQLString
},
text: {
type: GraphQLString
}
}