Skip to content

Instantly share code, notes, and snippets.

@kbrandwijk
kbrandwijk / gateway.yml
Last active October 31, 2017 01:20
Graphcool API Gateway configuration
endpoints:
- url: http://localhost:60000/simple/v1/cj9bgncpa00040157l0nft8x4
authentication: caller
- url: ${env:GRAPHCOOL_SECOND_ENDPOINT}
authentication:
token: ${env:GRAPHCOOL_TOKEN}
types:
- sdl: ./src/linkingSchema.graphql
- code: ./src/permissionSchema.ts
@kbrandwijk
kbrandwijk / graphcool.lua
Created November 12, 2017 15:16
Graphcool autocomplete for clink/cmder
-- For clink, place this file in one of the folders described here:
-- https://github.com/mridgers/clink/blob/master/docs/clink.md#file-locations
-- For cmder, place this file in the cmder config folder
local parser = clink.arg.new_parser
local no_options_parser = parser({})
local target_options = {
@kbrandwijk
kbrandwijk / finalSchema.ts
Created November 28, 2017 12:16
Schema imports
export const finalSchema = `
# import { topExperiences, topHomes, topReservations, featuredDestinations, experiencesByCity } from 'homepage'
# import { viewer } from 'viewer'
# import { signup, login } from 'auth'
# import { addPaymentMethod, book } from 'newmutations'
type Query {
topExperiences: [Experience!]!
topHomes: [Home!]!
topReservations: [Reservation!]!
@kbrandwijk
kbrandwijk / Query.ts
Created January 4, 2018 13:18
forwardTo
import { Context, forwardTo } from '../utils'
export const Query = {
viewer: () => ({}),
topExperiences: async (parent, args, ctx: Context, info) => {
return ctx.db.query.experiences({ orderBy: 'popularity_DESC' }, info)
},
// Here's the magic line
@kbrandwijk
kbrandwijk / _Integration ideas.md
Last active September 28, 2018 04:46
Graphcool-AWS integration ideas

Graphcool and AWS functions

Context

I have a Graphcool project definition, with multiple stages, and I have a Serverless AWS definition. I use the Serverless AWS definition to deploy all of my functions, and I link them to Graphcool by using Webhooks. This document describes some of the ideas for linking those two deployments together.

Information exchange

So what kind of information do the Graphcool service and the Serverless service need to know about each other in order to connect?

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<map width="2048" height="2048" imageFilename="maps/pda_map_H.png" >
...
<gamePlayHints filename="gameplayHints.xml" />
...
</map>
<?xml version="1.0" encoding="utf-8" standalone="no" ?><gameplayHints>
<gameplayHint>This is a hint specific to your map.</gameplayHint>
<gameplayHint>This is another hint.</gameplayHint>
<gameplayHint>And one more.</gameplayHint>
<gameplayHint>And another one.</gameplayHint>
<gameplayHint>More hints...</gameplayHint>
<gameplayHint>As many as you want.</gameplayHint>
</gameplayHints>
local modDirectory = g_currentModDirectory
function overwriteGameplayHints()
-- remove the existing hints
g_gameplayHintManager.gameplayHints = {}
-- open your own hints xml file
local xmlFile = loadXMLFile("gameplayHints", Utils.getFilename("maps/gameplayHints.xml", modDirectory))
-- loop through all the entries and feed them to the gameplayManager
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<map width="2048" height="2048" imageFilename="maps/pda_map_H.png" >
...
<helpline filename="helpLine.xml" />
...
</map>
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<helpLines>
<category title="Test Category">
<page title="Page Title">
<item type="text" value="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac felis ac velit sagittis tempor quis a risus. Donec ac enim eget turpis porta dapibus. Phasellus efficitur iaculis nibh, sit amet elementum erat pellentesque in." />
<item type="image" value="maps/myimage.png" imageSize="1024 512" imageUVs="0px 0px 1024px 256px"/>
<item type="text" value="Vestibulum nunc quam, aliquam eget iaculis in, rutrum a velit. Nunc elementum risus ligula, sed maximus ligula feugiat ac. In congue enim sed lectus mattis, sed porttitor orci lacinia. Curabitur id porttitor arcu." />
<item type="image" value="maps/myimage.png" imageSize="1024 512" imageUVs="0px 256px 1024px 256px"/>
<item type="text" value="The end" />
</page>