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')} | |
} | |
} | |
} | |
`; |
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 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
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
{ | |
"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
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
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
(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
(defn paged-http-get | |
([url] | |
(paged-http-get url 1)) | |
([url page] | |
(let [sink (s/stream)] | |
(d/loop [page page] | |
(d/chain (http-get url {:query-params {"page" page}}) | |
(fn [response] | |
(let [body (:body response)] | |
(if (seq body) |
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
{:name nil | |
:description nil | |
:email nil | |
:repositories {:count nil | |
:filters {:first {:count 50} | |
:after {:cursor 22046023}} | |
:edges {:cursor nil | |
:node {:id nil | |
:name nil | |
:full_name nil |
NewerOlder