graphqljs-rails 0.4.16 → 0.4.17
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58b69e4bd101e2c2eb10b78f3fffa16d3f52c3dc
|
4
|
+
data.tar.gz: 67e073f2a83b55ad22e368e9a197df80644c28f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c49b6ad28444d20d9ff65129ae0284076f9116bbdc89fcc18feb87d107858805135fb3a64d81929eb7777b91d71fb8af7ee7cf2066f87c354f5bfba86f51fd9b
|
7
|
+
data.tar.gz: 4d88e61d9a8a0d6495d4b975f1fbdf110ee8850e254e3c68c0dba794d237d9a6204dfda3e00f7047d0ba24df98f7291f4848d76ed2895ab9a1090d0327677e41
|
@@ -170,7 +170,7 @@
|
|
170
170
|
if (typeof query == 'object' && query.hasOwnProperty('kind') && query.hasOwnProperty('definitions')) {
|
171
171
|
// This looks like a graphql AST.
|
172
172
|
try {
|
173
|
-
var graphql = require('graphql')
|
173
|
+
var graphql = eval('require(\'graphql\')') // webpack tries to include this
|
174
174
|
query = graphql.print(query)
|
175
175
|
} catch (e) {
|
176
176
|
throw new Error("You tried to pass a graphql syntax tree but it cannot be compiled to string.")
|
@@ -1 +1 @@
|
|
1
|
-
!function(){function
|
1
|
+
!function(){function __extend(){var a={},b=!1,c=0,d=arguments.length;"[object Boolean]"==Object.prototype.toString.call(arguments[0])&&(b=arguments[0],c++);for(var e=function(c){for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(b&&"[object Object]"==Object.prototype.toString.call(c[d])?a[d]=__extend(!0,a[d],c[d]):a[d]=c[d])};d>c;c++){var f=arguments[c];e(f)}return a}function __unique(a){return a.filter(function(a,b,c){return c.indexOf(a)===b})}function __request(a,b,c,d,e,f){if(e)var g=JSON.stringify({query:d.query,variables:d.variables});else var g="query="+encodeURIComponent(d.query)+"&variables="+encodeURIComponent(JSON.stringify(d.variables));if("undefined"!=typeof XMLHttpRequest){var h=new XMLHttpRequest;h.open(a,b,!0),h.setRequestHeader("Content-Type",e?"application/json":"application/x-www-form-urlencoded"),h.setRequestHeader("Accept","application/json");for(var i in c)h.setRequestHeader(i,c[i]);h.onerror=function(){f(h,h.status)},h.onload=function(){f(JSON.parse(h.responseText),h.status)},h.send(g)}else if("function"==typeof require){var j=require("http"),k=require("https"),l=require("url"),m=l.parse(b),n=("https:"===m.protocol?k:j).request({protocol:m.protocol,hostname:m.hostname,port:m.port,path:m.path,method:"POST",headers:__extend({"Content-type":e?"application/json":"application/x-www-form-urlencoded",Accept:"application/json"},c)},function(a){var b="";a.setEncoding("utf8"),a.on("data",function(a){b+=a}),a.on("end",function(){f(JSON.parse(b),a.statusCode)})});n.write(g),n.end()}}function __isTagCall(a){return"[object Array]"==Object.prototype.toString.call(a)&&a.raw}function GraphQLClient(a,b){if(!(this instanceof GraphQLClient)){var c=new GraphQLClient(a,b,!0),d=c._sender;for(var e in c)"function"==typeof c[e]&&(d[e]=c[e].bind(c),c[e].declare&&(d[e].declare=c[e].declare.bind(c)),c[e].run&&(d[e].run=c[e].run.bind(c)));return d}if(arguments[2]!==!0)throw new Error("You cannot create GraphQLClient instance. Please call GraphQLClient as function.");b||(b={}),b.fragments||(b.fragments={}),this.options=b||{},this._fragments=this.buildFragments(b.fragments),this._sender=this.createSenderFunction(a),this.createHelpers(this._sender)}FRAGMENT_SEPERATOR="_",GraphQLClient.AUTODECLARE_PATTERN=/\(@autodeclare\)|\(@autotype\)/,GraphQLClient.FRAGMENT_PATTERN=/\.\.\.\s*([A-Za-z0-9\.\_]+)/g,GraphQLClient.prototype.flatten=function(a){var b,c=arguments[1]||"",d=arguments[2]||{};for(b in a)a.hasOwnProperty(b)&&("object"==typeof a[b]?this.flatten(a[b],c+b+FRAGMENT_SEPERATOR,d):d[c+b]=a[b]);return d},GraphQLClient.prototype.fragmentPath=function(a,b){var c=new Function("fragments","return fragments."+b.replace(/\./g,FRAGMENT_SEPERATOR)),d=c(a);if("on"!=b&&(!d||"string"!=typeof d))throw new Error("Fragment "+b+" not found");return d},GraphQLClient.prototype.collectFragments=function(a,b){var c=this,d=GraphQLClient.FRAGMENT_PATTERN,e=[];return(a.match(d)||[]).forEach(function(a){var f=a.replace(d,function(a,b){return b}),a=c.fragmentPath(b,f);if(a){var g=new RegExp(d.source.replace(/\((.*)\)/,f));if(a.match(g))throw new Error("Recursive fragment usage detected on "+f+".");e.push(a);var h=e.filter(function(a){return a.match(new RegExp("fragment "+f))});h.length>0&&d.test(a)&&c.collectFragments(a,b).forEach(function(a){e.unshift(a)})}}),__unique(e)},GraphQLClient.prototype.processQuery=function(query,fragments){if("object"==typeof query&&query.hasOwnProperty("kind")&&query.hasOwnProperty("definitions"))try{var graphql=eval("require('graphql')");query=graphql.print(query)}catch(e){throw new Error("You tried to pass a graphql syntax tree but it cannot be compiled to string.")}var fragmentRegexp=GraphQLClient.FRAGMENT_PATTERN,collectedFragments=this.collectFragments(query,fragments);return query=query.replace(fragmentRegexp,function(a,b){return"... "+b.split(".").join(FRAGMENT_SEPERATOR)}),[query].concat(collectedFragments.filter(function(a){return!query.match(a)})).join("\n")},GraphQLClient.prototype.autoDeclare=function(a,b){var c={string:"String",number:function(a){return a%1===0?"Int":"Float"},"boolean":"Boolean"};return a.replace(GraphQLClient.AUTODECLARE_PATTERN,function(){var a=[];for(var d in b){var e=b[d],f=d.split("!"),g=c[typeof e],h="function"==typeof g?g(e):g,i=f[1]||h;i&&a.push("$"+f[0]+": "+i+"!")}return a=a.join(", "),a?"("+a+")":""})},GraphQLClient.prototype.cleanAutoDeclareAnnotations=function(a){a||(a={});var b={};for(var c in a){var d=a[c],e=c.split("!");b[e[0]]=d}return b},GraphQLClient.prototype.buildFragments=function(a){var b=this;a=this.flatten(a||{});var c={};for(var d in a){var e=a[d];"object"==typeof e?c[d]=b.buildFragments(e):c[d]="\nfragment "+d+" "+e}return c},GraphQLClient.prototype.buildQuery=function(a,b){return this.autoDeclare(this.processQuery(a,this._fragments),b)},GraphQLClient.prototype.createSenderFunction=function(a){var b=this;return function(c){if(__isTagCall(c))return b.run(b.ql.apply(b,arguments));var d=function(d,e){e||(e={}),d||(d={});var f=b.buildQuery(c,d);return headers=__extend(b.options.headers||{},e.headers||{}),new Promise(function(c,e){__request(b.options.method||"post",a,headers,{query:f,variables:b.cleanAutoDeclareAnnotations(d)},!!b.options.asJSON,function(a,b){200==b?a.errors?e(a.errors):a.data&&c(a.data):e(a)})})};return arguments.length>1?d.apply(null,Array.prototype.slice.call(arguments,1)):d}},GraphQLClient.prototype.createHelpers=function(a){function b(b){if(__isTagCall(b)){c.__prefix=this.prefix,c.__suffix=this.suffix;var d=c.run(c.ql.apply(c,arguments));return c.__prefix="",c.__suffix="",d}var e=a(this.prefix+" "+b+" "+this.suffix);return arguments.length>1&&null!=arguments[1]?e.apply(null,Array.prototype.slice.call(arguments,1)):e}var c=this,d=[{method:"mutate",type:"mutation"},{method:"query",type:"query"},{method:"subscribe",type:"subscription"}];d.forEach(function(a){c[a.method]=function(d,e,f){return c.options.alwaysAutodeclare===!0||f&&f.declare===!0?b.call({prefix:a.type+" (@autodeclare) {",suffix:"}"},d,e):b.call({prefix:a.type,suffix:""},d,e)},c[a.method].run=function(b,d){return c[a.method](b,d)({})}}),this.run=function(b){return a(b,{})}},GraphQLClient.prototype.fragments=function(){return this._fragments},GraphQLClient.prototype.getOptions=function(){return this.options||{}},GraphQLClient.prototype.headers=function(a){return this.options.headers=__extend(this.options.headers,a)},GraphQLClient.prototype.fragment=function(a){if("string"==typeof a){var b=this._fragments[a.replace(/\./g,FRAGMENT_SEPERATOR)];if(!b)throw"Fragment "+a+" not found!";return b.trim()}return this.options.fragments=__extend(!0,this.options.fragments,a),this._fragments=this.buildFragments(this.options.fragments),this._fragments},GraphQLClient.prototype.ql=function(a){fragments=Array.prototype.slice.call(arguments,1),fragments=fragments.map(function(a){return"string"==typeof a?a.match(/fragment\s+([^\s]*)\s/)[1]:void 0});var b="string"==typeof a?a:a.reduce(function(a,b,c){return a+fragments[c-1]+b});return b=this.buildQuery(b),b=((this.__prefix||"")+" "+b+" "+(this.__suffix||"")).trim()},function(a,b){"function"==typeof define&&define.amd?define(function(){return a.graphql=b(GraphQLClient)}):"object"==typeof module&&module.exports?module.exports=b(a.GraphQLClient):a.graphql=b(a.GraphQLClient)}(this,function(){return GraphQLClient})}();
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphqljs-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fatih Kadir Akın
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.6.
|
122
|
+
rubygems_version: 2.6.12
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: GraphQL.js integration for Rails
|