@urql/core
Advanced tools
Comparing version 4.1.4-canary-052d5f49 to 4.1.4-canary-423897f9
@@ -374,3 +374,3 @@ var graphql_web = require('@0no-co/graphql.web'); | ||
var makeResult = (operation, result, response) => { | ||
if (!('data' in result) && !('errors' in result)) { | ||
if (!('data' in result) && (!('errors' in result) || !Array.isArray(result.errors))) { | ||
throw new Error('No Content'); | ||
@@ -377,0 +377,0 @@ } |
@@ -1,2 +0,2 @@ | ||
var e=require("@0no-co/graphql.web"),r=require("wonka"),t=r=>r&&r.message&&(r.extensions||"GraphQLError"===r.name)?r:"object"==typeof r&&r.message?new e.GraphQLError(r.message,r.nodes,r.source,r.positions,r.path,r,r.extensions||{}):new e.GraphQLError(r);class n extends Error{constructor(e){var r=(e.graphQLErrors||[]).map(t),n=((e,r)=>{var t="";if(e)return`[Network] ${e.message}`;if(r)for(var n of r)t&&(t+="\n"),t+=`[GraphQL] ${n.message}`;return t})(e.networkError,r);super(n),this.name="CombinedError",this.message=n,this.graphQLErrors=r,this.networkError=e.networkError,this.response=e.response}toString(){return this.message}}var a=(e,r)=>{for(var t=0|(r||5381),n=0,a=0|e.length;n<a;n++)t=(t<<5)+t+e.charCodeAt(n);return t},o=new Set,s=new WeakMap,i=e=>{if(null===e||o.has(e))return"null";if("object"!=typeof e)return JSON.stringify(e)||"";if(e.toJSON)return i(e.toJSON());if(Array.isArray(e)){var r="[";for(var t of e)r.length>1&&(r+=","),r+=i(t)||"null";return r+"]"}if(p!==c&&e instanceof p||d!==c&&e instanceof d)return"null";var n=Object.keys(e).sort();if(!n.length&&e.constructor&&e.constructor!==Object){var a=s.get(e)||Math.random().toString(36).slice(2);return s.set(e,a),i({__key:a})}o.add(e);var f="{";for(var l of n){var u=i(e[l]);u&&(f.length>1&&(f+=","),f+=i(l)+":"+u)}return o.delete(e),f+"}"},f=(e,r,t)=>{if(null==t||"object"!=typeof t||t.toJSON||o.has(t));else if(Array.isArray(t))for(var n=0,a=t.length;n<a;n++)f(e,`${r}.${n}`,t[n]);else if(t instanceof p||t instanceof d)e.set(r,t);else for(var s of(o.add(t),Object.keys(t)))f(e,`${r}.${s}`,t[s])},l=e=>(o.clear(),i(e));class c{}var p="undefined"!=typeof File?File:c,d="undefined"!=typeof Blob?Blob:c,u=/("{3}[\s\S]*"{3}|"(?:\\.|[^"])*")/g,y=/(?:#[^\n\r]+)?(?:[\r\n]+|$)/g,h=(e,r)=>r%2==0?e.replace(y,"\n"):e,v=e=>e.split(u).map(h).join("").trim(),x=new Map,g=new Map,m=r=>{var t;return"string"==typeof r?t=v(r):r.loc&&g.get(r.__key)===r?t=r.loc.source.body:(t=x.get(r)||v(e.print(r)),x.set(r,t)),"string"==typeof r||r.loc||(r.loc={start:0,end:t.length,source:{body:t,name:"gql",locationOffset:{line:1,column:1}}}),t},b=e=>{var r=a(m(e));if(e.definitions){var t=k(e);t&&(r=a(`\n# ${t}`,r))}return r},w=r=>{var t,n;return"string"==typeof r?(t=b(r),n=g.get(t)||e.parse(r,{noLocation:!0})):(t=r.__key||b(r),n=g.get(t)||r),n.loc||m(n),n.__key=t,g.set(t,n),n},k=r=>{for(var t of r.definitions)if(t.kind===e.Kind.OPERATION_DEFINITION)return t.name?t.name.value:void 0},N=(e,r,t)=>{if(!("data"in r)&&!("errors"in r))throw new Error("No Content");var a="subscription"===e.kind;return{operation:e,data:r.data,error:Array.isArray(r.errors)?new n({graphQLErrors:r.errors,response:t}):void 0,extensions:r.extensions?{...r.extensions}:void 0,hasNext:null==r.hasNext?a:r.hasNext,stale:!1}},O=(e,r)=>{if("object"==typeof e&&null!=e&&(!e.constructor||e.constructor===Object||Array.isArray(e))){for(var t of(e=Array.isArray(e)?[...e]:{...e},Object.keys(r)))e[t]=O(e[t],r[t]);return e}return r},E=(e,r,t,a)=>{var o=e.error?e.error.graphQLErrors:[],s=!!e.extensions||!!r.extensions,i={...e.extensions,...r.extensions},f=r.incremental;"path"in r&&(f=[r]);var l={data:e.data};if(f){var c=function(e){Array.isArray(e.errors)&&o.push(...e.errors),e.extensions&&(Object.assign(i,e.extensions),s=!0);var r="data",t=l,n=[];if(e.path)n=e.path;else if(a){var f=a.find((r=>r.id===e.id));n=e.subPath?[...f.path,...e.subPath]:f.path}for(var c=0,p=n.length;c<p;r=n[c++])t=t[r]=Array.isArray(t[r])?[...t[r]]:{...t[r]};if(e.items)for(var d=+r>=0?r:0,u=0,y=e.items.length;u<y;u++)t[d+u]=O(t[d+u],e.items[u]);else void 0!==e.data&&(t[r]=O(t[r],e.data))};for(var p of f)c(p)}else l.data=r.data||e.data,o=r.errors||o;return{operation:e.operation,data:l.data,error:o.length?new n({graphQLErrors:o,response:t}):void 0,extensions:s?i:void 0,hasNext:null!=r.hasNext?r.hasNext:e.hasNext,stale:!1}},A=(e,r,t)=>({operation:e,data:void 0,error:new n({networkError:r,response:t}),extensions:void 0,hasNext:!1,stale:!1}),j="undefined"!=typeof TextDecoder?new TextDecoder:null,S=/boundary="?([^=";]+)"?/i,q=/data: ?([^\n]+)/,L=e=>"Buffer"===e.constructor.name?e.toString():j.decode(e);async function*T(e){if(e.body[Symbol.asyncIterator])for await(var r of e.body)yield L(r);else{var t,n=e.body.getReader();try{for(;!(t=await n.read()).done;)yield L(t.value)}finally{n.cancel()}}}async function*_(e,r){var t,n="";for await(var a of e)for(n+=a;(t=n.indexOf(r))>-1;)yield n.slice(0,t),n=n.slice(t+r.length)}exports.CombinedError=n,exports.createRequest=(e,r,t)=>{var n=r||{},o=w(e),s=l(n),i=o.__key;return"{}"!==s&&(i=a(s,i)),{key:i,query:o,variables:n,extensions:t}},exports.getOperationType=r=>{for(var t of r.definitions)if(t.kind===e.Kind.OPERATION_DEFINITION)return t.operation},exports.keyDocument=w,exports.makeErrorResult=A,exports.makeFetchBody=function(e){return{query:e.extensions&&e.extensions.persistedQuery&&!e.extensions.persistedQuery.miss?void 0:m(e.query),operationName:k(e.query),variables:e.variables||void 0,extensions:e.extensions}},exports.makeFetchOptions=(e,r)=>{var t={accept:"subscription"===e.kind?"text/event-stream, multipart/mixed":"application/graphql-response+json, application/graphql+json, application/json, text/event-stream, multipart/mixed"},n=("function"==typeof e.context.fetchOptions?e.context.fetchOptions():e.context.fetchOptions)||{};if(n.headers)for(var a in n.headers)t[a.toLowerCase()]=n.headers[a];var s=((e,r)=>{var t,n;if(r&&("query"!==e.kind||!e.context.preferGetMethod)){var a=l(r),s=(t=r.variables,n=new Map,p===c&&d===c||(o.clear(),f(n,"variables",t)),n);if(s.size){var i=new FormData;i.append("operations",a),i.append("map",l({...[...s.keys()].map((e=>[e]))}));var u=0;for(var y of s.values())i.append(""+u++,y);return i}return a}})(e,r);return"string"!=typeof s||t["content-type"]||(t["content-type"]="application/json"),{...n,method:s?"POST":"GET",body:s,headers:t}},exports.makeFetchSource=function(e,t,n){var a;return"undefined"!=typeof AbortController&&(n.signal=(a=new AbortController).signal),r.onEnd((()=>{a&&a.abort()}))(r.filter((e=>!!e))(r.fromAsyncIterable(async function*(e,r,t){var n,a=!0,o=null;try{yield await Promise.resolve();var s,i,f=(n=await(e.context.fetch||fetch)(r,t)).headers.get("Content-Type")||"";if(/multipart\/mixed/i.test(f))s=async function*(e,r){var t,n=e.match(S),a="--"+(n?n[1]:"-"),o=!0;for await(var s of _(T(r),"\r\n"+a)){if(o){o=!1;var i=s.indexOf(a);if(!(i>-1))continue;s=s.slice(i+a.length)}try{yield t=JSON.parse(s.slice(s.indexOf("\r\n\r\n")+4))}catch(e){if(!t)throw e}if(t&&!1===t.hasNext)break}t&&!1!==t.hasNext&&(yield{hasNext:!1})}(f,n);else if(/text\/event-stream/i.test(f))s=async function*(e){var r;for await(var t of _(T(e),"\n\n")){var n=t.match(q);if(n){var a=n[1];try{yield r=JSON.parse(a)}catch(e){if(!r)throw e}if(r&&!1===r.hasNext)break}}r&&!1!==r.hasNext&&(yield{hasNext:!1})}(n);else{if(/text\//i.test(f))throw new Error(await n.text());s=async function*(e){yield JSON.parse(await e.text())}(n)}for await(var l of s)l.pending&&!o?i=l.pending:l.pending&&(i=[...i,...l.pending]),o=o?E(o,l,n,i):N(e,l,n),a=!1,yield o,a=!0;o||(yield o=N(e,{},n))}catch(r){if(!a)throw r;yield A(e,n&&(n.status<200||n.status>=300)&&n.statusText?new Error(n.statusText):r,n)}}(e,t,n))))},exports.makeFetchURL=(e,r)=>{var t="query"===e.kind&&e.context.preferGetMethod;if(!t||!r)return e.context.url;var n=new URL(e.context.url);for(var a in r){var o=r[a];o&&n.searchParams.set(a,"object"==typeof o?l(o):o)}var s=n.toString();return s.length>2047&&"force"!==t?(e.context.preferGetMethod=!1,e.context.url):s},exports.makeResult=N,exports.mergeResultPatch=E,exports.stringifyDocument=m,exports.stringifyVariables=l; | ||
var e=require("@0no-co/graphql.web"),r=require("wonka"),t=r=>r&&r.message&&(r.extensions||"GraphQLError"===r.name)?r:"object"==typeof r&&r.message?new e.GraphQLError(r.message,r.nodes,r.source,r.positions,r.path,r,r.extensions||{}):new e.GraphQLError(r);class n extends Error{constructor(e){var r=(e.graphQLErrors||[]).map(t),n=((e,r)=>{var t="";if(e)return`[Network] ${e.message}`;if(r)for(var n of r)t&&(t+="\n"),t+=`[GraphQL] ${n.message}`;return t})(e.networkError,r);super(n),this.name="CombinedError",this.message=n,this.graphQLErrors=r,this.networkError=e.networkError,this.response=e.response}toString(){return this.message}}var a=(e,r)=>{for(var t=0|(r||5381),n=0,a=0|e.length;n<a;n++)t=(t<<5)+t+e.charCodeAt(n);return t},o=new Set,s=new WeakMap,i=e=>{if(null===e||o.has(e))return"null";if("object"!=typeof e)return JSON.stringify(e)||"";if(e.toJSON)return i(e.toJSON());if(Array.isArray(e)){var r="[";for(var t of e)r.length>1&&(r+=","),r+=i(t)||"null";return r+"]"}if(p!==c&&e instanceof p||d!==c&&e instanceof d)return"null";var n=Object.keys(e).sort();if(!n.length&&e.constructor&&e.constructor!==Object){var a=s.get(e)||Math.random().toString(36).slice(2);return s.set(e,a),i({__key:a})}o.add(e);var f="{";for(var l of n){var u=i(e[l]);u&&(f.length>1&&(f+=","),f+=i(l)+":"+u)}return o.delete(e),f+"}"},f=(e,r,t)=>{if(null==t||"object"!=typeof t||t.toJSON||o.has(t));else if(Array.isArray(t))for(var n=0,a=t.length;n<a;n++)f(e,`${r}.${n}`,t[n]);else if(t instanceof p||t instanceof d)e.set(r,t);else for(var s of(o.add(t),Object.keys(t)))f(e,`${r}.${s}`,t[s])},l=e=>(o.clear(),i(e));class c{}var p="undefined"!=typeof File?File:c,d="undefined"!=typeof Blob?Blob:c,u=/("{3}[\s\S]*"{3}|"(?:\\.|[^"])*")/g,y=/(?:#[^\n\r]+)?(?:[\r\n]+|$)/g,h=(e,r)=>r%2==0?e.replace(y,"\n"):e,v=e=>e.split(u).map(h).join("").trim(),x=new Map,g=new Map,m=r=>{var t;return"string"==typeof r?t=v(r):r.loc&&g.get(r.__key)===r?t=r.loc.source.body:(t=x.get(r)||v(e.print(r)),x.set(r,t)),"string"==typeof r||r.loc||(r.loc={start:0,end:t.length,source:{body:t,name:"gql",locationOffset:{line:1,column:1}}}),t},b=e=>{var r=a(m(e));if(e.definitions){var t=k(e);t&&(r=a(`\n# ${t}`,r))}return r},w=r=>{var t,n;return"string"==typeof r?(t=b(r),n=g.get(t)||e.parse(r,{noLocation:!0})):(t=r.__key||b(r),n=g.get(t)||r),n.loc||m(n),n.__key=t,g.set(t,n),n},k=r=>{for(var t of r.definitions)if(t.kind===e.Kind.OPERATION_DEFINITION)return t.name?t.name.value:void 0},N=(e,r,t)=>{if(!("data"in r||"errors"in r&&Array.isArray(r.errors)))throw new Error("No Content");var a="subscription"===e.kind;return{operation:e,data:r.data,error:Array.isArray(r.errors)?new n({graphQLErrors:r.errors,response:t}):void 0,extensions:r.extensions?{...r.extensions}:void 0,hasNext:null==r.hasNext?a:r.hasNext,stale:!1}},O=(e,r)=>{if("object"==typeof e&&null!=e&&(!e.constructor||e.constructor===Object||Array.isArray(e))){for(var t of(e=Array.isArray(e)?[...e]:{...e},Object.keys(r)))e[t]=O(e[t],r[t]);return e}return r},E=(e,r,t,a)=>{var o=e.error?e.error.graphQLErrors:[],s=!!e.extensions||!!r.extensions,i={...e.extensions,...r.extensions},f=r.incremental;"path"in r&&(f=[r]);var l={data:e.data};if(f){var c=function(e){Array.isArray(e.errors)&&o.push(...e.errors),e.extensions&&(Object.assign(i,e.extensions),s=!0);var r="data",t=l,n=[];if(e.path)n=e.path;else if(a){var f=a.find((r=>r.id===e.id));n=e.subPath?[...f.path,...e.subPath]:f.path}for(var c=0,p=n.length;c<p;r=n[c++])t=t[r]=Array.isArray(t[r])?[...t[r]]:{...t[r]};if(e.items)for(var d=+r>=0?r:0,u=0,y=e.items.length;u<y;u++)t[d+u]=O(t[d+u],e.items[u]);else void 0!==e.data&&(t[r]=O(t[r],e.data))};for(var p of f)c(p)}else l.data=r.data||e.data,o=r.errors||o;return{operation:e.operation,data:l.data,error:o.length?new n({graphQLErrors:o,response:t}):void 0,extensions:s?i:void 0,hasNext:null!=r.hasNext?r.hasNext:e.hasNext,stale:!1}},A=(e,r,t)=>({operation:e,data:void 0,error:new n({networkError:r,response:t}),extensions:void 0,hasNext:!1,stale:!1}),j="undefined"!=typeof TextDecoder?new TextDecoder:null,S=/boundary="?([^=";]+)"?/i,q=/data: ?([^\n]+)/,L=e=>"Buffer"===e.constructor.name?e.toString():j.decode(e);async function*T(e){if(e.body[Symbol.asyncIterator])for await(var r of e.body)yield L(r);else{var t,n=e.body.getReader();try{for(;!(t=await n.read()).done;)yield L(t.value)}finally{n.cancel()}}}async function*_(e,r){var t,n="";for await(var a of e)for(n+=a;(t=n.indexOf(r))>-1;)yield n.slice(0,t),n=n.slice(t+r.length)}exports.CombinedError=n,exports.createRequest=(e,r,t)=>{var n=r||{},o=w(e),s=l(n),i=o.__key;return"{}"!==s&&(i=a(s,i)),{key:i,query:o,variables:n,extensions:t}},exports.getOperationType=r=>{for(var t of r.definitions)if(t.kind===e.Kind.OPERATION_DEFINITION)return t.operation},exports.keyDocument=w,exports.makeErrorResult=A,exports.makeFetchBody=function(e){return{query:e.extensions&&e.extensions.persistedQuery&&!e.extensions.persistedQuery.miss?void 0:m(e.query),operationName:k(e.query),variables:e.variables||void 0,extensions:e.extensions}},exports.makeFetchOptions=(e,r)=>{var t={accept:"subscription"===e.kind?"text/event-stream, multipart/mixed":"application/graphql-response+json, application/graphql+json, application/json, text/event-stream, multipart/mixed"},n=("function"==typeof e.context.fetchOptions?e.context.fetchOptions():e.context.fetchOptions)||{};if(n.headers)for(var a in n.headers)t[a.toLowerCase()]=n.headers[a];var s=((e,r)=>{var t,n;if(r&&("query"!==e.kind||!e.context.preferGetMethod)){var a=l(r),s=(t=r.variables,n=new Map,p===c&&d===c||(o.clear(),f(n,"variables",t)),n);if(s.size){var i=new FormData;i.append("operations",a),i.append("map",l({...[...s.keys()].map((e=>[e]))}));var u=0;for(var y of s.values())i.append(""+u++,y);return i}return a}})(e,r);return"string"!=typeof s||t["content-type"]||(t["content-type"]="application/json"),{...n,method:s?"POST":"GET",body:s,headers:t}},exports.makeFetchSource=function(e,t,n){var a;return"undefined"!=typeof AbortController&&(n.signal=(a=new AbortController).signal),r.onEnd((()=>{a&&a.abort()}))(r.filter((e=>!!e))(r.fromAsyncIterable(async function*(e,r,t){var n,a=!0,o=null;try{yield await Promise.resolve();var s,i,f=(n=await(e.context.fetch||fetch)(r,t)).headers.get("Content-Type")||"";if(/multipart\/mixed/i.test(f))s=async function*(e,r){var t,n=e.match(S),a="--"+(n?n[1]:"-"),o=!0;for await(var s of _(T(r),"\r\n"+a)){if(o){o=!1;var i=s.indexOf(a);if(!(i>-1))continue;s=s.slice(i+a.length)}try{yield t=JSON.parse(s.slice(s.indexOf("\r\n\r\n")+4))}catch(e){if(!t)throw e}if(t&&!1===t.hasNext)break}t&&!1!==t.hasNext&&(yield{hasNext:!1})}(f,n);else if(/text\/event-stream/i.test(f))s=async function*(e){var r;for await(var t of _(T(e),"\n\n")){var n=t.match(q);if(n){var a=n[1];try{yield r=JSON.parse(a)}catch(e){if(!r)throw e}if(r&&!1===r.hasNext)break}}r&&!1!==r.hasNext&&(yield{hasNext:!1})}(n);else{if(/text\//i.test(f))throw new Error(await n.text());s=async function*(e){yield JSON.parse(await e.text())}(n)}for await(var l of s)l.pending&&!o?i=l.pending:l.pending&&(i=[...i,...l.pending]),o=o?E(o,l,n,i):N(e,l,n),a=!1,yield o,a=!0;o||(yield o=N(e,{},n))}catch(r){if(!a)throw r;yield A(e,n&&(n.status<200||n.status>=300)&&n.statusText?new Error(n.statusText):r,n)}}(e,t,n))))},exports.makeFetchURL=(e,r)=>{var t="query"===e.kind&&e.context.preferGetMethod;if(!t||!r)return e.context.url;var n=new URL(e.context.url);for(var a in r){var o=r[a];o&&n.searchParams.set(a,"object"==typeof o?l(o):o)}var s=n.toString();return s.length>2047&&"force"!==t?(e.context.preferGetMethod=!1,e.context.url):s},exports.makeResult=N,exports.mergeResultPatch=E,exports.stringifyDocument=m,exports.stringifyVariables=l; | ||
//# sourceMappingURL=urql-core-chunk.min.js.map |
{ | ||
"name": "@urql/core", | ||
"version": "4.1.4-canary-052d5f49", | ||
"version": "4.1.4-canary-423897f9", | ||
"description": "The shared core for the highly customizable and versatile GraphQL client", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
914509
5377