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
(def graph {:roots {} :nodes {}}) | |
;; end up wit ha structure like this after adding a node | |
(def graph {:roots {} :nodes {'Organization {:fields {:id {}}}}}) | |
;; do I do this? | |
(let [field (get-in graph [:nodes 'Organization :fields :id])] | |
;; ... | |
) |
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
import RelayStoreData from 'react-relay/lib/RelayStoreData'; | |
import RelayQueryPath from 'react-relay/lib/RelayQueryPath'; | |
import printRelayQuery from 'react-relay/lib/printRelayQuery'; | |
import {List,Map} from 'immutable'; | |
var REMOVE_KEYS = [ | |
'_storage' | |
]; |
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
query { | |
organization16j31a7:organization(id: "facebook") { | |
description, | |
id, | |
name | |
}, | |
repository1awoa9m:repository(id: "facebook/react") { | |
description, | |
id, | |
name |
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
{ | |
"jsonGraph": { | |
"organization": { | |
"facebook": { | |
"repositoriesWithCursor": { | |
"0": { | |
"$type": "ref", | |
"value": [ | |
"repository", | |
"facebook/codemod" |
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
const hasRole = (role, next) => { | |
return (obj, args, ctx) => { | |
if (ctx.rootValue.user.hasRole(role)) { | |
next(obj, args, ctx); | |
} else { | |
return null; | |
} | |
} | |
} |
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
const rootValue = { | |
user, | |
client, | |
...root, | |
__timing: [] // store the timing info in here -- sorta hacky! | |
} | |
return graphql(schema, query, rootValue, variables).then(response => { |
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
let rootValue = { | |
response: { | |
timing: { | |
fields: [] | |
} | |
} | |
} | |
const start = new Date().getTime(); | |
return graphql(schema, query, rootValue, variables).then(response => { |
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
const node = Relay.QL` | |
query { | |
node(id: $channelId) { | |
... on Channel { | |
joined | |
${JoinChannelMutation.getFragment('channel')} | |
} | |
} | |
} | |
`; |
OlderNewer