Socket
Socket
Sign inDemoInstall

gatsby-source-graphql

Package Overview
Dependencies
Maintainers
1
Versions
357
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-source-graphql - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

4

changelog.md
## Change Log
### [v1.1.1](https://github.com/wyze/gatsby-source-graphql/releases/tag/v1.1.1) (2018-06-06)
* [[`3403024845`](https://github.com/wyze/gatsby-source-graphql/commit/3403024845)] - Add preversion script to build before release (Neil Kistner)
### [v1.1.0](https://github.com/wyze/gatsby-source-graphql/releases/tag/v1.1.0) (2018-06-05)

@@ -4,0 +8,0 @@

2

gatsby-node.js

@@ -1,1 +0,1 @@

var e=require("crypto"),t=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e};function r(e,t){var r,o,n,s,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,o&&(n=o[2&s[0]?"return":s[0]?"throw":"next"])&&!(n=n.call(o,s[1])).done)return n;switch(o=0,n&&(s=[0,n.value]),s[0]){case 0:case 1:n=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,o=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(n=(n=i.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){i.label=s[1];break}if(6===s[0]&&i.label<n[1]){i.label=n[1],n=s;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(s);break}n[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],o=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}const o=Symbol("buffer"),n=Symbol("type");class s{constructor(){this[n]="";const e=arguments[0],t=arguments[1],r=[];if(e){const t=e,n=Number(t.length);for(let e=0;e<n;e++){const n=t[e];let i;i=n instanceof Buffer?n:ArrayBuffer.isView(n)?Buffer.from(n.buffer,n.byteOffset,n.byteLength):n instanceof ArrayBuffer?Buffer.from(n):n instanceof s?n[o]:Buffer.from("string"==typeof n?n:String(n)),r.push(i)}}this[o]=Buffer.concat(r);let i=t&&void 0!==t.type&&String(t.type).toLowerCase();i&&!/[^\u0020-\u007E]/.test(i)&&(this[n]=i)}get size(){return this[o].length}get type(){return this[n]}slice(){const e=this.size,t=arguments[0],r=arguments[1];let n,i;n=void 0===t?0:t<0?Math.max(e+t,0):Math.min(t,e),i=void 0===r?e:r<0?Math.max(e+r,0):Math.min(r,e);const a=Math.max(i-n,0),u=this[o].slice(n,n+a),l=new s([],{type:arguments[2]});return l[o]=u,l}}function i(e,t,r){Error.call(this,e),this.message=e,this.type=t,r&&(this.code=this.errno=r.code),Error.captureStackTrace(this,this.constructor)}Object.defineProperties(s.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),Object.defineProperty(s.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0}),(i.prototype=Object.create(Error.prototype)).constructor=i,i.prototype.name="FetchError";const a=require("stream");const u=require("stream").PassThrough;let l;try{l=require("encoding").convert}catch(e){}const c=Symbol("Body internals");function f(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.size;let n=void 0===o?0:o;var u=r.timeout;let l=void 0===u?0:u;null==e?e=null:"string"==typeof e||d(e)||e instanceof s||Buffer.isBuffer(e)||"[object ArrayBuffer]"===Object.prototype.toString.call(e)||e instanceof a||(e=String(e)),this[c]={body:e,disturbed:!1,error:null},this.size=n,this.timeout=l,e instanceof a&&e.on("error",function(e){t[c].error=new i(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e)})}function h(){var e=this;if(this[c].disturbed)return f.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[c].disturbed=!0,this[c].error)return f.Promise.reject(this[c].error);if(null===this.body)return f.Promise.resolve(Buffer.alloc(0));if("string"==typeof this.body)return f.Promise.resolve(Buffer.from(this.body));if(this.body instanceof s)return f.Promise.resolve(this.body[o]);if(Buffer.isBuffer(this.body))return f.Promise.resolve(this.body);if("[object ArrayBuffer]"===Object.prototype.toString.call(this.body))return f.Promise.resolve(Buffer.from(this.body));if(!(this.body instanceof a))return f.Promise.resolve(Buffer.alloc(0));let t=[],r=0,n=!1;return new f.Promise(function(o,s){let a;e.timeout&&(a=setTimeout(function(){n=!0,s(new i(`Response timeout while trying to fetch ${e.url} (over ${e.timeout}ms)`,"body-timeout"))},e.timeout)),e.body.on("error",function(t){s(new i(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t))}),e.body.on("data",function(o){if(!n&&null!==o){if(e.size&&r+o.length>e.size)return n=!0,void s(new i(`content size at ${e.url} over limit: ${e.size}`,"max-size"));r+=o.length,t.push(o)}}),e.body.on("end",function(){if(!n){clearTimeout(a);try{o(Buffer.concat(t))}catch(t){s(new i(`Could not create Buffer from response body for ${e.url}: ${t.message}`,"system",t))}}})})}function d(e){return"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.delete&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.has&&"function"==typeof e.set&&("URLSearchParams"===e.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(e)||"function"==typeof e.sort)}function p(e){let t,r,o=e.body;if(e.bodyUsed)throw new Error("cannot clone body after it is used");return o instanceof a&&"function"!=typeof o.getBoundary&&(t=new u,r=new u,o.pipe(t),o.pipe(r),e[c].body=t,o=r),o}function y(e){const t=e.body;return null===t?0:"string"==typeof t?Buffer.byteLength(t):d(t)?Buffer.byteLength(String(t)):t instanceof s?t.size:Buffer.isBuffer(t)?t.length:"[object ArrayBuffer]"===Object.prototype.toString.call(t)?t.byteLength:t&&"function"==typeof t.getLengthSync&&(t._lengthRetrievers&&0==t._lengthRetrievers.length||t.hasKnownLength&&t.hasKnownLength())?t.getLengthSync():null}f.prototype={get body(){return this[c].body},get bodyUsed(){return this[c].disturbed},arrayBuffer(){return h.call(this).then(function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)})},blob(){let e=this.headers&&this.headers.get("content-type")||"";return h.call(this).then(function(t){return Object.assign(new s([],{type:e.toLowerCase()}),{[o]:t})})},json(){var e=this;return h.call(this).then(function(t){try{return JSON.parse(t.toString())}catch(t){return f.Promise.reject(new i(`invalid json response body at ${e.url} reason: ${t.message}`,"invalid-json"))}})},text(){return h.call(this).then(function(e){return e.toString()})},buffer(){return h.call(this)},textConverted(){var e=this;return h.call(this).then(function(t){return function(e,t){if("function"!=typeof l)throw new Error("The package `encoding` must be installed to use the textConverted() function");const r=t.get("content-type");let o,n,s="utf-8";r&&(o=/charset=([^;]*)/i.exec(r));n=e.slice(0,1024).toString(),!o&&n&&(o=/<meta.+?charset=(['"])(.+?)\1/i.exec(n));!o&&n&&(o=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(n))&&(o=/charset=(.*)/i.exec(o.pop()));!o&&n&&(o=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(n));o&&("gb2312"!==(s=o.pop())&&"gbk"!==s||(s="gb18030"));return l(e,"UTF-8",s).toString()}(t,e.headers)})}},Object.defineProperties(f.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}}),f.mixIn=function(e){for(const t of Object.getOwnPropertyNames(f.prototype))if(!(t in e)){const r=Object.getOwnPropertyDescriptor(f.prototype,t);Object.defineProperty(e,t,r)}},f.Promise=global.Promise;const b=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,m=/[^\t\x20-\x7e\x80-\xff]/;function g(e){if(b.test(e=`${e}`))throw new TypeError(`${e} is not a legal HTTP header name`)}function w(e){if(m.test(e=`${e}`))throw new TypeError(`${e} is not a legal HTTP header value`)}function v(e,t){t=t.toLowerCase();for(const r in e)if(r.toLowerCase()===t)return r}const j=Symbol("map");class S{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[j]=Object.create(null),e instanceof S){const t=e.raw(),r=Object.keys(t);for(const e of r)for(const r of t[e])this.append(e,r)}else if(null==e);else{if("object"!=typeof e)throw new TypeError("Provided initializer must be an object");{const t=e[Symbol.iterator];if(null!=t){if("function"!=typeof t)throw new TypeError("Header pairs must be iterable");const r=[];for(const t of e){if("object"!=typeof t||"function"!=typeof t[Symbol.iterator])throw new TypeError("Each header pair must be iterable");r.push(Array.from(t))}for(const e of r){if(2!==e.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(e[0],e[1])}}else for(const t of Object.keys(e)){this.append(t,e[t])}}}}get(e){g(e=`${e}`);const t=v(this[j],e);return void 0===t?null:this[j][t].join(", ")}forEach(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=T(this),o=0;for(;o<r.length;){var n=r[o];e.call(t,n[1],n[0],this),r=T(this),o++}}set(e,t){t=`${t}`,g(e=`${e}`),w(t);const r=v(this[j],e);this[j][void 0!==r?r:e]=[t]}append(e,t){t=`${t}`,g(e=`${e}`),w(t);const r=v(this[j],e);void 0!==r?this[j][r].push(t):this[j][e]=[t]}has(e){return g(e=`${e}`),void 0!==v(this[j],e)}delete(e){g(e=`${e}`);const t=v(this[j],e);void 0!==t&&delete this[j][t]}raw(){return this[j]}keys(){return P(this,"key")}values(){return P(this,"value")}[Symbol.iterator](){return P(this,"key+value")}}function T(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key+value";return Object.keys(e[j]).sort().map("key"===t?function(e){return e.toLowerCase()}:"value"===t?function(t){return e[j][t].join(", ")}:function(t){return[t.toLowerCase(),e[j][t].join(", ")]})}S.prototype.entries=S.prototype[Symbol.iterator],Object.defineProperty(S.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(S.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const O=Symbol("internal");function P(e,t){const r=Object.create(x);return r[O]={target:e,kind:t,index:0},r}const x=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==x)throw new TypeError("Value of `this` is not a HeadersIterator");var e=this[O];const t=e.index,r=T(e.target,e.kind);return t>=r.length?{value:void 0,done:!0}:(this[O].index=t+1,{value:r[t],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));Object.defineProperty(x,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const B=require("http").STATUS_CODES,E=Symbol("Response internals");class ${constructor(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};f.call(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e);const t=e.status||200;this[E]={url:e.url,status:t,statusText:e.statusText||B[t],headers:new S(e.headers)}}get url(){return this[E].url}get status(){return this[E].status}get ok(){return this[E].status>=200&&this[E].status<300}get statusText(){return this[E].statusText}get headers(){return this[E].headers}clone(){return new $(p(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok})}}f.mixIn($.prototype),Object.defineProperties($.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty($.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});var C=require("url");const k=C.format,A=C.parse,L=Symbol("Request internals");function q(e){return"object"==typeof e&&"object"==typeof e[L]}class z{constructor(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};q(e)?t=A(e.url):(t=A(e&&e.href?e.href:`${e}`),e={});let o=r.method||e.method||"GET";if(o=o.toUpperCase(),(null!=r.body||q(e)&&null!==e.body)&&("GET"===o||"HEAD"===o))throw new TypeError("Request with GET/HEAD method cannot have body");let n=null!=r.body?r.body:q(e)&&null!==e.body?p(e):null;f.call(this,n,{timeout:r.timeout||e.timeout||0,size:r.size||e.size||0});const i=new S(r.headers||e.headers||{});if(null!=r.body){const e=function(e){const t=e.body;return null===t?null:"string"==typeof t?"text/plain;charset=UTF-8":d(t)?"application/x-www-form-urlencoded;charset=UTF-8":t instanceof s?t.type||null:Buffer.isBuffer(t)?null:"[object ArrayBuffer]"===Object.prototype.toString.call(t)?null:"function"==typeof t.getBoundary?`multipart/form-data;boundary=${t.getBoundary()}`:null}(this);null===e||i.has("Content-Type")||i.append("Content-Type",e)}this[L]={method:o,redirect:r.redirect||e.redirect||"follow",headers:i,parsedURL:t},this.follow=void 0!==r.follow?r.follow:void 0!==e.follow?e.follow:20,this.compress=void 0!==r.compress?r.compress:void 0===e.compress||e.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent}get method(){return this[L].method}get url(){return k(this[L].parsedURL)}get headers(){return this[L].headers}get redirect(){return this[L].redirect}clone(){return new z(this)}}function U(e){const t=e[L].parsedURL,r=new S(e[L].headers);if(r.has("Accept")||r.set("Accept","*/*"),!t.protocol||!t.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(t.protocol))throw new TypeError("Only HTTP(S) protocols are supported");let o=null;if(null==e.body&&/^(POST|PUT)$/i.test(e.method)&&(o="0"),null!=e.body){const t=y(e);"number"==typeof t&&(o=String(t))}return o&&r.set("Content-Length",o),r.has("User-Agent")||r.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),e.compress&&r.set("Accept-Encoding","gzip,deflate"),r.has("Connection")||e.agent||r.set("Connection","close"),Object.assign({},t,{method:e.method,headers:function(e){const t=Object.assign({__proto__:null},e[j]),r=v(e[j],"Host");return void 0!==r&&(t[r]=t[r][0]),t}(r),agent:e.agent})}f.mixIn(z.prototype),Object.defineProperty(z.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(z.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0}});const R=require("http"),_=require("https");const H=require("stream").PassThrough;const I=require("url").resolve,M=require("zlib");function N(e,t){if(!N.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return f.Promise=N.Promise,new N.Promise(function(r,n){const a=new z(e,t),u=U(a),l=(0,("https:"===u.protocol?_:R).request)(u);let c;function f(){l.abort(),clearTimeout(c)}a.timeout&&l.once("socket",function(e){c=setTimeout(function(){n(new i(`network timeout at: ${a.url}`,"request-timeout")),f()},a.timeout)}),l.on("error",function(e){n(new i(`request to ${a.url} failed, reason: ${e.message}`,"system",e)),f()}),l.on("response",function(e){clearTimeout(c);const t=function(e){const t=new S;for(const r of Object.keys(e))if(!b.test(r))if(Array.isArray(e[r]))for(const o of e[r])m.test(o)||(void 0===t[j][r]?t[j][r]=[o]:t[j][r].push(o));else m.test(e[r])||(t[j][r]=[e[r]]);return t}(e.headers);if(N.isRedirect(e.statusCode)){const o=t.get("Location"),s=null===o?null:I(a.url,o);switch(a.redirect){case"error":return n(new i(`redirect mode is set to error: ${a.url}`,"no-redirect")),void f();case"manual":null!==s&&t.set("Location",s);break;case"follow":if(null===s)break;if(a.counter>=a.follow)return n(new i(`maximum redirect reached at: ${a.url}`,"max-redirect")),void f();const o={headers:new S(a.headers),follow:a.follow,counter:a.counter+1,agent:a.agent,compress:a.compress,method:a.method,body:a.body};return 303!==e.statusCode&&a.body&&null===y(a)?(n(new i("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void f()):(303!==e.statusCode&&(301!==e.statusCode&&302!==e.statusCode||"POST"!==a.method)||(o.method="GET",o.body=void 0,o.headers.delete("content-length")),r(N(new z(s,o))),void f())}}let o=e.pipe(new H);const s={url:a.url,status:e.statusCode,statusText:e.statusMessage,headers:t,size:a.size,timeout:a.timeout},u=t.get("Content-Encoding");if(a.compress&&"HEAD"!==a.method&&null!==u&&204!==e.statusCode&&304!==e.statusCode){if("gzip"==u||"x-gzip"==u)return o=o.pipe(M.createGunzip({flush:M.Z_SYNC_FLUSH,finishFlush:M.Z_SYNC_FLUSH})),void r(new $(o,s));if("deflate"!=u&&"x-deflate"!=u)r(new $(o,s));else{e.pipe(new H).once("data",function(e){o=o.pipe(8==(15&e[0])?M.createInflate():M.createInflateRaw()),r(new $(o,s))})}}else r(new $(o,s))}),function(e,t){const r=t.body;null===r?e.end():"string"==typeof r?(e.write(r),e.end()):d(r)?(e.write(Buffer.from(String(r))),e.end()):r instanceof s?(e.write(r[o]),e.end()):Buffer.isBuffer(r)?(e.write(r),e.end()):"[object ArrayBuffer]"===Object.prototype.toString.call(r)?(e.write(Buffer.from(r)),e.end()):r.pipe(e)}(l,a)})}N.isRedirect=function(e){return 301===e||302===e||303===e||307===e||308===e},N.default=N,N.Promise=global.Promise;var G=function(e){return function(t){return t.replace(e,function(e,t){return t.toUpperCase()})}},F=G(/[_.-](\w|$)/g),D=G(/^(\w)/);exports.onCreateNode=function(o,n){var s,i,a,u,l=o.boundActionCreators,c=l.createNode,f=l.createParentChildLink,h=o.loadNodeContent,d=o.node,p=n.headers,y=void 0===p?{}:p,b=n.url,m=n.variables,g=void 0===m?{}:m;return s=void 0,i=void 0,u=function(){var o,n,s,i,a,u,l,p;return r(this,function(r){switch(r.label){case 0:return"graphql"!==d.extension?[2]:[4,h(d)];case 1:return o=r.sent(),function(e){var t=e.headers,r=e.queries,o=e.url,n=e.variables;if(!(Array.isArray(r)&&r.length>0))throw new Error("Must supply `queries` option with atleast one query.");if("object"!=typeof t||!1!==Array.isArray(t))throw new Error("Must supply `headers` option that is an object.");if(!("string"==typeof o&&o.length>0))throw new Error("Must supply `url` option to point to your GraphQL API.");if("object"!=typeof n||!1!==Array.isArray(n))throw new Error("Must supply `variables` option that is an object.")}({headers:y,queries:[o],url:b,variables:g}),n={body:JSON.stringify({query:o,variables:g}),headers:t({"content-type":"application/json"},y),method:"post"},[4,N(b,n)];case 2:return[4,(s=r.sent()).json()];case 3:if(i=r.sent(),!s.ok)throw new Error("["+s.statusText+"]: "+i.message);return a=JSON.stringify(i.data),u=function(t){return e.createHash("md5").update(t).digest("hex")}(a),l=D(F(d.name+"GraphQL")),p=t({},i.data,{id:"__graphql__"+u,children:[],parent:d.id,internal:{content:a,contentDigest:u,type:l}}),c(p),f({parent:d,child:p}),[2]}})},new((a=void 0)||(a=Promise))(function(e,t){function r(e){try{n(u.next(e))}catch(e){t(e)}}function o(e){try{n(u.throw(e))}catch(e){t(e)}}function n(t){t.done?e(t.value):new a(function(e){e(t.value)}).then(r,o)}n((u=u.apply(s,i||[])).next())})};
var e=require("crypto"),t=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e};function r(e,t){var r,o,n,s,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,o&&(n=o[2&s[0]?"return":s[0]?"throw":"next"])&&!(n=n.call(o,s[1])).done)return n;switch(o=0,n&&(s=[0,n.value]),s[0]){case 0:case 1:n=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,o=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(n=(n=i.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){i.label=s[1];break}if(6===s[0]&&i.label<n[1]){i.label=n[1],n=s;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(s);break}n[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],o=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}const o=Symbol("buffer"),n=Symbol("type");class s{constructor(){this[n]="";const e=arguments[0],t=arguments[1],r=[];if(e){const t=e,n=Number(t.length);for(let e=0;e<n;e++){const n=t[e];let i;i=n instanceof Buffer?n:ArrayBuffer.isView(n)?Buffer.from(n.buffer,n.byteOffset,n.byteLength):n instanceof ArrayBuffer?Buffer.from(n):n instanceof s?n[o]:Buffer.from("string"==typeof n?n:String(n)),r.push(i)}}this[o]=Buffer.concat(r);let i=t&&void 0!==t.type&&String(t.type).toLowerCase();i&&!/[^\u0020-\u007E]/.test(i)&&(this[n]=i)}get size(){return this[o].length}get type(){return this[n]}slice(){const e=this.size,t=arguments[0],r=arguments[1];let n,i;n=void 0===t?0:t<0?Math.max(e+t,0):Math.min(t,e),i=void 0===r?e:r<0?Math.max(e+r,0):Math.min(r,e);const a=Math.max(i-n,0),u=this[o].slice(n,n+a),l=new s([],{type:arguments[2]});return l[o]=u,l}}function i(e,t,r){Error.call(this,e),this.message=e,this.type=t,r&&(this.code=this.errno=r.code),Error.captureStackTrace(this,this.constructor)}Object.defineProperties(s.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),Object.defineProperty(s.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0}),(i.prototype=Object.create(Error.prototype)).constructor=i,i.prototype.name="FetchError";const a=require("stream");const u=require("stream").PassThrough;let l;try{l=require("encoding").convert}catch(e){}const c=Symbol("Body internals");function f(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.size;let n=void 0===o?0:o;var u=r.timeout;let l=void 0===u?0:u;null==e?e=null:"string"==typeof e||d(e)||e instanceof s||Buffer.isBuffer(e)||"[object ArrayBuffer]"===Object.prototype.toString.call(e)||e instanceof a||(e=String(e)),this[c]={body:e,disturbed:!1,error:null},this.size=n,this.timeout=l,e instanceof a&&e.on("error",function(e){t[c].error=new i(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e)})}function h(){var e=this;if(this[c].disturbed)return f.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[c].disturbed=!0,this[c].error)return f.Promise.reject(this[c].error);if(null===this.body)return f.Promise.resolve(Buffer.alloc(0));if("string"==typeof this.body)return f.Promise.resolve(Buffer.from(this.body));if(this.body instanceof s)return f.Promise.resolve(this.body[o]);if(Buffer.isBuffer(this.body))return f.Promise.resolve(this.body);if("[object ArrayBuffer]"===Object.prototype.toString.call(this.body))return f.Promise.resolve(Buffer.from(this.body));if(!(this.body instanceof a))return f.Promise.resolve(Buffer.alloc(0));let t=[],r=0,n=!1;return new f.Promise(function(o,s){let a;e.timeout&&(a=setTimeout(function(){n=!0,s(new i(`Response timeout while trying to fetch ${e.url} (over ${e.timeout}ms)`,"body-timeout"))},e.timeout)),e.body.on("error",function(t){s(new i(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t))}),e.body.on("data",function(o){if(!n&&null!==o){if(e.size&&r+o.length>e.size)return n=!0,void s(new i(`content size at ${e.url} over limit: ${e.size}`,"max-size"));r+=o.length,t.push(o)}}),e.body.on("end",function(){if(!n){clearTimeout(a);try{o(Buffer.concat(t))}catch(t){s(new i(`Could not create Buffer from response body for ${e.url}: ${t.message}`,"system",t))}}})})}function d(e){return"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.delete&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.has&&"function"==typeof e.set&&("URLSearchParams"===e.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(e)||"function"==typeof e.sort)}function p(e){let t,r,o=e.body;if(e.bodyUsed)throw new Error("cannot clone body after it is used");return o instanceof a&&"function"!=typeof o.getBoundary&&(t=new u,r=new u,o.pipe(t),o.pipe(r),e[c].body=t,o=r),o}function y(e){const t=e.body;return null===t?0:"string"==typeof t?Buffer.byteLength(t):d(t)?Buffer.byteLength(String(t)):t instanceof s?t.size:Buffer.isBuffer(t)?t.length:"[object ArrayBuffer]"===Object.prototype.toString.call(t)?t.byteLength:t&&"function"==typeof t.getLengthSync&&(t._lengthRetrievers&&0==t._lengthRetrievers.length||t.hasKnownLength&&t.hasKnownLength())?t.getLengthSync():null}f.prototype={get body(){return this[c].body},get bodyUsed(){return this[c].disturbed},arrayBuffer(){return h.call(this).then(function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)})},blob(){let e=this.headers&&this.headers.get("content-type")||"";return h.call(this).then(function(t){return Object.assign(new s([],{type:e.toLowerCase()}),{[o]:t})})},json(){var e=this;return h.call(this).then(function(t){try{return JSON.parse(t.toString())}catch(t){return f.Promise.reject(new i(`invalid json response body at ${e.url} reason: ${t.message}`,"invalid-json"))}})},text(){return h.call(this).then(function(e){return e.toString()})},buffer(){return h.call(this)},textConverted(){var e=this;return h.call(this).then(function(t){return function(e,t){if("function"!=typeof l)throw new Error("The package `encoding` must be installed to use the textConverted() function");const r=t.get("content-type");let o,n,s="utf-8";r&&(o=/charset=([^;]*)/i.exec(r));n=e.slice(0,1024).toString(),!o&&n&&(o=/<meta.+?charset=(['"])(.+?)\1/i.exec(n));!o&&n&&(o=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(n))&&(o=/charset=(.*)/i.exec(o.pop()));!o&&n&&(o=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(n));o&&("gb2312"!==(s=o.pop())&&"gbk"!==s||(s="gb18030"));return l(e,"UTF-8",s).toString()}(t,e.headers)})}},Object.defineProperties(f.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}}),f.mixIn=function(e){for(const t of Object.getOwnPropertyNames(f.prototype))if(!(t in e)){const r=Object.getOwnPropertyDescriptor(f.prototype,t);Object.defineProperty(e,t,r)}},f.Promise=global.Promise;const b=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,m=/[^\t\x20-\x7e\x80-\xff]/;function g(e){if(b.test(e=`${e}`))throw new TypeError(`${e} is not a legal HTTP header name`)}function w(e){if(m.test(e=`${e}`))throw new TypeError(`${e} is not a legal HTTP header value`)}function v(e,t){t=t.toLowerCase();for(const r in e)if(r.toLowerCase()===t)return r}const j=Symbol("map");class S{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[j]=Object.create(null),e instanceof S){const t=e.raw(),r=Object.keys(t);for(const e of r)for(const r of t[e])this.append(e,r)}else if(null==e);else{if("object"!=typeof e)throw new TypeError("Provided initializer must be an object");{const t=e[Symbol.iterator];if(null!=t){if("function"!=typeof t)throw new TypeError("Header pairs must be iterable");const r=[];for(const t of e){if("object"!=typeof t||"function"!=typeof t[Symbol.iterator])throw new TypeError("Each header pair must be iterable");r.push(Array.from(t))}for(const e of r){if(2!==e.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(e[0],e[1])}}else for(const t of Object.keys(e)){this.append(t,e[t])}}}}get(e){g(e=`${e}`);const t=v(this[j],e);return void 0===t?null:this[j][t].join(", ")}forEach(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=T(this),o=0;for(;o<r.length;){var n=r[o];e.call(t,n[1],n[0],this),r=T(this),o++}}set(e,t){t=`${t}`,g(e=`${e}`),w(t);const r=v(this[j],e);this[j][void 0!==r?r:e]=[t]}append(e,t){t=`${t}`,g(e=`${e}`),w(t);const r=v(this[j],e);void 0!==r?this[j][r].push(t):this[j][e]=[t]}has(e){return g(e=`${e}`),void 0!==v(this[j],e)}delete(e){g(e=`${e}`);const t=v(this[j],e);void 0!==t&&delete this[j][t]}raw(){return this[j]}keys(){return P(this,"key")}values(){return P(this,"value")}[Symbol.iterator](){return P(this,"key+value")}}function T(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key+value";return Object.keys(e[j]).sort().map("key"===t?function(e){return e.toLowerCase()}:"value"===t?function(t){return e[j][t].join(", ")}:function(t){return[t.toLowerCase(),e[j][t].join(", ")]})}S.prototype.entries=S.prototype[Symbol.iterator],Object.defineProperty(S.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(S.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const O=Symbol("internal");function P(e,t){const r=Object.create(x);return r[O]={target:e,kind:t,index:0},r}const x=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==x)throw new TypeError("Value of `this` is not a HeadersIterator");var e=this[O];const t=e.index,r=T(e.target,e.kind);return t>=r.length?{value:void 0,done:!0}:(this[O].index=t+1,{value:r[t],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));Object.defineProperty(x,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const B=require("http").STATUS_CODES,E=Symbol("Response internals");class ${constructor(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};f.call(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e);const t=e.status||200;this[E]={url:e.url,status:t,statusText:e.statusText||B[t],headers:new S(e.headers)}}get url(){return this[E].url}get status(){return this[E].status}get ok(){return this[E].status>=200&&this[E].status<300}get statusText(){return this[E].statusText}get headers(){return this[E].headers}clone(){return new $(p(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok})}}f.mixIn($.prototype),Object.defineProperties($.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty($.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});var C=require("url");const k=C.format,L=C.parse,A=Symbol("Request internals");function q(e){return"object"==typeof e&&"object"==typeof e[A]}class z{constructor(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};q(e)?t=L(e.url):(t=L(e&&e.href?e.href:`${e}`),e={});let o=r.method||e.method||"GET";if(o=o.toUpperCase(),(null!=r.body||q(e)&&null!==e.body)&&("GET"===o||"HEAD"===o))throw new TypeError("Request with GET/HEAD method cannot have body");let n=null!=r.body?r.body:q(e)&&null!==e.body?p(e):null;f.call(this,n,{timeout:r.timeout||e.timeout||0,size:r.size||e.size||0});const i=new S(r.headers||e.headers||{});if(null!=r.body){const e=function(e){const t=e.body;return null===t?null:"string"==typeof t?"text/plain;charset=UTF-8":d(t)?"application/x-www-form-urlencoded;charset=UTF-8":t instanceof s?t.type||null:Buffer.isBuffer(t)?null:"[object ArrayBuffer]"===Object.prototype.toString.call(t)?null:"function"==typeof t.getBoundary?`multipart/form-data;boundary=${t.getBoundary()}`:null}(this);null===e||i.has("Content-Type")||i.append("Content-Type",e)}this[A]={method:o,redirect:r.redirect||e.redirect||"follow",headers:i,parsedURL:t},this.follow=void 0!==r.follow?r.follow:void 0!==e.follow?e.follow:20,this.compress=void 0!==r.compress?r.compress:void 0===e.compress||e.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent}get method(){return this[A].method}get url(){return k(this[A].parsedURL)}get headers(){return this[A].headers}get redirect(){return this[A].redirect}clone(){return new z(this)}}function U(e){const t=e[A].parsedURL,r=new S(e[A].headers);if(r.has("Accept")||r.set("Accept","*/*"),!t.protocol||!t.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(t.protocol))throw new TypeError("Only HTTP(S) protocols are supported");let o=null;if(null==e.body&&/^(POST|PUT)$/i.test(e.method)&&(o="0"),null!=e.body){const t=y(e);"number"==typeof t&&(o=String(t))}return o&&r.set("Content-Length",o),r.has("User-Agent")||r.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),e.compress&&r.set("Accept-Encoding","gzip,deflate"),r.has("Connection")||e.agent||r.set("Connection","close"),Object.assign({},t,{method:e.method,headers:function(e){const t=Object.assign({__proto__:null},e[j]),r=v(e[j],"Host");return void 0!==r&&(t[r]=t[r][0]),t}(r),agent:e.agent})}f.mixIn(z.prototype),Object.defineProperty(z.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(z.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0}});const R=require("http"),_=require("https");const H=require("stream").PassThrough;const I=require("url").resolve,M=require("zlib");function N(e,t){if(!N.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return f.Promise=N.Promise,new N.Promise(function(r,n){const a=new z(e,t),u=U(a),l=(0,("https:"===u.protocol?_:R).request)(u);let c;function f(){l.abort(),clearTimeout(c)}a.timeout&&l.once("socket",function(e){c=setTimeout(function(){n(new i(`network timeout at: ${a.url}`,"request-timeout")),f()},a.timeout)}),l.on("error",function(e){n(new i(`request to ${a.url} failed, reason: ${e.message}`,"system",e)),f()}),l.on("response",function(e){clearTimeout(c);const t=function(e){const t=new S;for(const r of Object.keys(e))if(!b.test(r))if(Array.isArray(e[r]))for(const o of e[r])m.test(o)||(void 0===t[j][r]?t[j][r]=[o]:t[j][r].push(o));else m.test(e[r])||(t[j][r]=[e[r]]);return t}(e.headers);if(N.isRedirect(e.statusCode)){const o=t.get("Location"),s=null===o?null:I(a.url,o);switch(a.redirect){case"error":return n(new i(`redirect mode is set to error: ${a.url}`,"no-redirect")),void f();case"manual":null!==s&&t.set("Location",s);break;case"follow":if(null===s)break;if(a.counter>=a.follow)return n(new i(`maximum redirect reached at: ${a.url}`,"max-redirect")),void f();const o={headers:new S(a.headers),follow:a.follow,counter:a.counter+1,agent:a.agent,compress:a.compress,method:a.method,body:a.body};return 303!==e.statusCode&&a.body&&null===y(a)?(n(new i("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void f()):(303!==e.statusCode&&(301!==e.statusCode&&302!==e.statusCode||"POST"!==a.method)||(o.method="GET",o.body=void 0,o.headers.delete("content-length")),r(N(new z(s,o))),void f())}}let o=e.pipe(new H);const s={url:a.url,status:e.statusCode,statusText:e.statusMessage,headers:t,size:a.size,timeout:a.timeout},u=t.get("Content-Encoding");if(a.compress&&"HEAD"!==a.method&&null!==u&&204!==e.statusCode&&304!==e.statusCode){if("gzip"==u||"x-gzip"==u)return o=o.pipe(M.createGunzip({flush:M.Z_SYNC_FLUSH,finishFlush:M.Z_SYNC_FLUSH})),void r(new $(o,s));if("deflate"!=u&&"x-deflate"!=u)r(new $(o,s));else{e.pipe(new H).once("data",function(e){o=o.pipe(8==(15&e[0])?M.createInflate():M.createInflateRaw()),r(new $(o,s))})}}else r(new $(o,s))}),function(e,t){const r=t.body;null===r?e.end():"string"==typeof r?(e.write(r),e.end()):d(r)?(e.write(Buffer.from(String(r))),e.end()):r instanceof s?(e.write(r[o]),e.end()):Buffer.isBuffer(r)?(e.write(r),e.end()):"[object ArrayBuffer]"===Object.prototype.toString.call(r)?(e.write(Buffer.from(r)),e.end()):r.pipe(e)}(l,a)})}N.isRedirect=function(e){return 301===e||302===e||303===e||307===e||308===e},N.default=N,N.Promise=global.Promise;var G=function(e){return function(t){return t.replace(e,function(e,t){return t.toUpperCase()})}},F=function(e){return"object"==typeof e&&!1===Array.isArray(e)&&null!==e},D=G(/[_.-](\w|$)/g),J=G(/^(\w)/);exports.onCreateNode=function(o,n){var s,i,a,u,l=o.boundActionCreators,c=l.createNode,f=l.createParentChildLink,h=o.loadNodeContent,d=o.node;return s=void 0,i=void 0,u=function(){var o,s,i,a,u,l,p,y,b,m,g,w,v,j,S;return r(this,function(r){switch(r.label){case 0:return"graphql"!==d.extension?[2]:[4,h(d)];case 1:return o=r.sent(),s=[o],[4,n];case 2:return i=r.sent(),function(e){var t=e.headers,r=e.queries,o=e.url,n=e.variables;if(!(Array.isArray(r)&&r.length>0))throw new Error("Must supply `queries` option with atleast one query.");if(!F(t))throw new Error("Must supply `headers` option that is an object.");if(!("string"==typeof o&&o.length>0))throw new Error("Must supply `url` option to point to your GraphQL API.");if(!F(n))throw new Error("Must supply `variables` option that is an object.")}({headers:u=void 0===(a=i.headers)?{}:a,queries:s,url:l=i.url,variables:y=void 0===(p=i.variables)?{}:p}),b={body:JSON.stringify({query:o,variables:y}),headers:t({"content-type":"application/json"},u),method:"post"},[4,N(l,b)];case 3:return[4,(m=r.sent()).json()];case 4:if(g=r.sent(),!m.ok)throw new Error("["+m.statusText+"]: "+g.message);return w=JSON.stringify(g.data),v=function(t){return e.createHash("md5").update(t).digest("hex")}(w),j=J(D(d.name+"GraphQL")),S=t({},g.data,{id:"__graphql__"+v,children:[],parent:d.id,internal:{content:w,contentDigest:v,type:j}}),c(S),f({parent:d,child:S}),[2]}})},new((a=void 0)||(a=Promise))(function(e,t){function r(e){try{n(u.next(e))}catch(e){t(e)}}function o(e){try{n(u.throw(e))}catch(e){t(e)}}function n(t){t.done?e(t.value):new a(function(e){e(t.value)}).then(r,o)}n((u=u.apply(s,i||[])).next())})};
{
"name": "gatsby-source-graphql",
"version": "1.1.0",
"version": "1.1.1",
"description": "A Gatsby source plugin for pulling in data from GraphQL APIs.",

@@ -18,2 +18,3 @@ "license": "MIT",

"prebuild": "yarn clean",
"preversion": "yarn build",
"test": "jest",

@@ -20,0 +21,0 @@ "version": "write-changelog"

@@ -87,6 +87,5 @@ # gatsby-source-graphql

### [v1.1.0](https://github.com/wyze/gatsby-source-graphql/releases/tag/v1.1.0) (2018-06-05)
### [v1.1.1](https://github.com/wyze/gatsby-source-graphql/releases/tag/v1.1.1) (2018-06-06)
* [[`67d99754ad`](https://github.com/wyze/gatsby-source-graphql/commit/67d99754ad)] - Allow a promise for asynchronously loading options (#4) (Judah Anthony)
* [[`4471e2c221`](https://github.com/wyze/gatsby-source-graphql/commit/4471e2c221)] - Improve usage instructions (#3) (Tomasz Radziejewski)
* [[`3403024845`](https://github.com/wyze/gatsby-source-graphql/commit/3403024845)] - Add preversion script to build before release (Neil Kistner)

@@ -93,0 +92,0 @@ ## License

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc