Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@urql/core

Package Overview
Dependencies
Maintainers
19
Versions
263
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@urql/core - npm Package Compare versions

Comparing version 4.3.0-canary-969935c6 to 4.3.0-canary-973da7ff

25

dist/urql-core-chunk.js

@@ -592,2 +592,3 @@ var graphql_web = require('@0no-co/graphql.web');

};
var isHeaders = headers => 'has' in headers && !Object.keys(headers).length;

@@ -612,3 +613,25 @@ /** Creates a `RequestInit` object for a given `Operation`.

var extraOptions = (typeof operation.context.fetchOptions === 'function' ? operation.context.fetchOptions() : operation.context.fetchOptions) || {};
if (extraOptions.headers) for (var key in extraOptions.headers) headers[key.toLowerCase()] = extraOptions.headers[key];
if (extraOptions.headers) {
if (isHeaders(extraOptions.headers)) {
extraOptions.headers.forEach((value, key) => {
headers[key] = value;
});
} else if (Array.isArray(extraOptions.headers)) {
extraOptions.headers.forEach((value, key) => {
if (Array.isArray(value)) {
if (headers[value[0]]) {
headers[value[0]] = `${headers[value[0]]},${value[1]}`;
} else {
headers[value[0]] = value[1];
}
} else {
headers[key] = value;
}
});
} else {
for (var key in extraOptions.headers) {
headers[key.toLowerCase()] = extraOptions.headers[key];
}
}
}
var serializedBody = serializeBody(operation, body);

@@ -615,0 +638,0 @@ if (typeof serializedBody === 'string' && !headers['content-type']) headers['content-type'] = 'application/json';

2

dist/urql-core-chunk.min.js

@@ -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(l!==d&&e instanceof l||p!==d&&e instanceof p)return"null";var n=Object.keys(e).sort();if(!n.length&&e.constructor&&Object.getPrototypeOf(e).constructor!==Object.prototype.constructor){var a=s.get(e)||Math.random().toString(36).slice(2);return s.set(e,a),i({__key:a})}o.add(e);var c="{";for(var f of n){var u=i(e[f]);u&&(c.length>1&&(c+=","),c+=i(f)+":"+u)}return o.delete(e),c+"}"},c=(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++)c(e,`${r}.${n}`,t[n]);else if(t instanceof l||t instanceof p)e.set(r,t);else for(var s of(o.add(t),Object.keys(t)))c(e,`${r}.${s}`,t[s])},f=e=>(o.clear(),i(e));class d{}var l="undefined"!=typeof File?File:d,p="undefined"!=typeof Blob?Blob:d,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},O=(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}},N=(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]=N(e[t],r[t]);return e}return r},E=(e,r,t,a)=>{var o=e.error?e.error.graphQLErrors:[],s=!!e.extensions||!!(r.payload||r).extensions,i={...e.extensions,...(r.payload||r).extensions},c=r.incremental;"path"in r&&(c=[r]);var f={data:e.data};if(c){var d=function(e){Array.isArray(e.errors)&&o.push(...e.errors),e.extensions&&(Object.assign(i,e.extensions),s=!0);var r="data",t=f,n=[];if(e.path)n=e.path;else if(a){var c=a.find((r=>r.id===e.id));n=e.subPath?[...c.path,...e.subPath]:c.path}for(var d=0,l=n.length;d<l;r=n[d++])t=t[r]=Array.isArray(t[r])?[...t[r]]:{...t[r]};if(e.items)for(var p=+r>=0?r:0,u=0,y=e.items.length;u<y;u++)t[p+u]=N(t[p+u],e.items[u]);else void 0!==e.data&&(t[r]=N(t[r],e.data))};for(var l of c)d(l)}else f.data=(r.payload||r).data||e.data,o=r.errors||r.payload&&r.payload.errors||o;return{operation:e.operation,data:f.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}),q="undefined"!=typeof TextDecoder?new TextDecoder:null,j=/boundary="?([^=";]+)"?/i,S=/data: ?([^\n]+)/,I=e=>"Buffer"===e.constructor.name?e.toString():q.decode(e);async function*L(e){if(e.body[Symbol.asyncIterator])for await(var r of e.body)yield I(r);else{var t,n=e.body.getReader();try{for(;!(t=await n.read()).done;)yield I(t.value)}finally{n.cancel()}}}async function*T(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=f(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){var r={query:void 0,documentId:void 0,operationName:k(e.query),variables:e.variables||void 0,extensions:e.extensions};return!("documentId"in e.query)||!e.query.documentId||e.query.definitions&&e.query.definitions.length?e.extensions&&e.extensions.persistedQuery&&!e.extensions.persistedQuery.miss||(r.query=m(e.query)):r.documentId=e.query.documentId,r},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=f(r),s=(t=r.variables,n=new Map,l===d&&p===d||(o.clear(),c(n,"variables",t)),n);if(s.size){var i=new FormData;i.append("operations",a),i.append("map",f({...[...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,c=(n=await(e.context.fetch||fetch)(r,t)).headers.get("Content-Type")||"";for await(var f of(s=/multipart\/mixed/i.test(c)?async function*(e,r){var t,n=e.match(j),a="--"+(n?n[1]:"-"),o=!0;for await(var s of T(L(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})}(c,n):/text\/event-stream/i.test(c)?async function*(e){var r;for await(var t of T(L(e),"\n\n")){var n=t.match(S);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):/text\//i.test(c)?async function*(e){var r=await e.text();try{var t=JSON.parse(r);yield t}catch(e){throw new Error(r)}}(n):async function*(e){yield JSON.parse(await e.text())}(n),s))f.pending&&!o?i=f.pending:f.pending&&(i=[...i,...f.pending]),o=o?E(o,f,n,i):O(e,f,n),a=!1,yield o,a=!0;o||(yield o=O(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?f(o):o)}var s=n.toString();return s.length>2047&&"force"!==t?(e.context.preferGetMethod=!1,e.context.url):s},exports.makeResult=O,exports.mergeResultPatch=E,exports.stringifyDocument=m,exports.stringifyVariables=f;
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 a extends Error{constructor(e){var r=(e.graphQLErrors||[]).map(t),a=((e,r)=>{var t="";if(e)return`[Network] ${e.message}`;if(r)for(var a of r)t&&(t+="\n"),t+=`[GraphQL] ${a.message}`;return t})(e.networkError,r);super(a),this.name="CombinedError",this.message=a,this.graphQLErrors=r,this.networkError=e.networkError,this.response=e.response}toString(){return this.message}}var n=(e,r)=>{for(var t=0|(r||5381),a=0,n=0|e.length;a<n;a++)t=(t<<5)+t+e.charCodeAt(a);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(l!==d&&e instanceof l||p!==d&&e instanceof p)return"null";var a=Object.keys(e).sort();if(!a.length&&e.constructor&&Object.getPrototypeOf(e).constructor!==Object.prototype.constructor){var n=s.get(e)||Math.random().toString(36).slice(2);return s.set(e,n),i({__key:n})}o.add(e);var f="{";for(var c of a){var u=i(e[c]);u&&(f.length>1&&(f+=","),f+=i(c)+":"+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 a=0,n=t.length;a<n;a++)f(e,`${r}.${a}`,t[a]);else if(t instanceof l||t instanceof p)e.set(r,t);else for(var s of(o.add(t),Object.keys(t)))f(e,`${r}.${s}`,t[s])},c=e=>(o.clear(),i(e));class d{}var l="undefined"!=typeof File?File:d,p="undefined"!=typeof Blob?Blob:d,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=n(m(e));if(e.definitions){var t=k(e);t&&(r=n(`\n# ${t}`,r))}return r},w=r=>{var t,a;return"string"==typeof r?(t=b(r),a=g.get(t)||e.parse(r,{noLocation:!0})):(t=r.__key||b(r),a=g.get(t)||r),a.loc||m(a),a.__key=t,g.set(t,a),a},k=r=>{for(var t of r.definitions)if(t.kind===e.Kind.OPERATION_DEFINITION)return t.name?t.name.value:void 0},O=(e,r,t)=>{if(!("data"in r||"errors"in r&&Array.isArray(r.errors)))throw new Error("No Content");var n="subscription"===e.kind;return{operation:e,data:r.data,error:Array.isArray(r.errors)?new a({graphQLErrors:r.errors,response:t}):void 0,extensions:r.extensions?{...r.extensions}:void 0,hasNext:null==r.hasNext?n:r.hasNext,stale:!1}},N=(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]=N(e[t],r[t]);return e}return r},E=(e,r,t,n)=>{var o=e.error?e.error.graphQLErrors:[],s=!!e.extensions||!!(r.payload||r).extensions,i={...e.extensions,...(r.payload||r).extensions},f=r.incremental;"path"in r&&(f=[r]);var c={data:e.data};if(f){var d=function(e){Array.isArray(e.errors)&&o.push(...e.errors),e.extensions&&(Object.assign(i,e.extensions),s=!0);var r="data",t=c,a=[];if(e.path)a=e.path;else if(n){var f=n.find((r=>r.id===e.id));a=e.subPath?[...f.path,...e.subPath]:f.path}for(var d=0,l=a.length;d<l;r=a[d++])t=t[r]=Array.isArray(t[r])?[...t[r]]:{...t[r]};if(e.items)for(var p=+r>=0?r:0,u=0,y=e.items.length;u<y;u++)t[p+u]=N(t[p+u],e.items[u]);else void 0!==e.data&&(t[r]=N(t[r],e.data))};for(var l of f)d(l)}else c.data=(r.payload||r).data||e.data,o=r.errors||r.payload&&r.payload.errors||o;return{operation:e.operation,data:c.data,error:o.length?new a({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 a({networkError:r,response:t}),extensions:void 0,hasNext:!1,stale:!1}),q="undefined"!=typeof TextDecoder?new TextDecoder:null,j=/boundary="?([^=";]+)"?/i,S=/data: ?([^\n]+)/,I=e=>"Buffer"===e.constructor.name?e.toString():q.decode(e);async function*L(e){if(e.body[Symbol.asyncIterator])for await(var r of e.body)yield I(r);else{var t,a=e.body.getReader();try{for(;!(t=await a.read()).done;)yield I(t.value)}finally{a.cancel()}}}async function*T(e,r){var t,a="";for await(var n of e)for(a+=n;(t=a.indexOf(r))>-1;)yield a.slice(0,t),a=a.slice(t+r.length)}exports.CombinedError=a,exports.createRequest=(e,r,t)=>{var a=r||{},o=w(e),s=c(a),i=o.__key;return"{}"!==s&&(i=n(s,i)),{key:i,query:o,variables:a,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){var r={query:void 0,documentId:void 0,operationName:k(e.query),variables:e.variables||void 0,extensions:e.extensions};return!("documentId"in e.query)||!e.query.documentId||e.query.definitions&&e.query.definitions.length?e.extensions&&e.extensions.persistedQuery&&!e.extensions.persistedQuery.miss||(r.query=m(e.query)):r.documentId=e.query.documentId,r},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"},a=("function"==typeof e.context.fetchOptions?e.context.fetchOptions():e.context.fetchOptions)||{};if(a.headers)if((e=>"has"in e&&!Object.keys(e).length)(a.headers))a.headers.forEach(((e,r)=>{t[r]=e}));else if(Array.isArray(a.headers))a.headers.forEach(((e,r)=>{Array.isArray(e)?t[e[0]]=t[e[0]]?`${t[e[0]]},${e[1]}`:e[1]:t[r]=e}));else for(var n in a.headers)t[n.toLowerCase()]=a.headers[n];var s=((e,r)=>{var t,a;if(r&&("query"!==e.kind||!e.context.preferGetMethod)){var n=c(r),s=(t=r.variables,a=new Map,l===d&&p===d||(o.clear(),f(a,"variables",t)),a);if(s.size){var i=new FormData;i.append("operations",n),i.append("map",c({...[...s.keys()].map((e=>[e]))}));var u=0;for(var y of s.values())i.append(""+u++,y);return i}return n}})(e,r);return"string"!=typeof s||t["content-type"]||(t["content-type"]="application/json"),{...a,method:s?"POST":"GET",body:s,headers:t}},exports.makeFetchSource=function(e,t,a){var n;return"undefined"!=typeof AbortController&&(a.signal=(n=new AbortController).signal),r.onEnd((()=>{n&&n.abort()}))(r.filter((e=>!!e))(r.fromAsyncIterable(async function*(e,r,t){var a,n=!0,o=null;try{yield await Promise.resolve();var s,i,f=(a=await(e.context.fetch||fetch)(r,t)).headers.get("Content-Type")||"";for await(var c of(s=/multipart\/mixed/i.test(f)?async function*(e,r){var t,a=e.match(j),n="--"+(a?a[1]:"-"),o=!0;for await(var s of T(L(r),"\r\n"+n)){if(o){o=!1;var i=s.indexOf(n);if(!(i>-1))continue;s=s.slice(i+n.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,a):/text\/event-stream/i.test(f)?async function*(e){var r;for await(var t of T(L(e),"\n\n")){var a=t.match(S);if(a){var n=a[1];try{yield r=JSON.parse(n)}catch(e){if(!r)throw e}if(r&&!1===r.hasNext)break}}r&&!1!==r.hasNext&&(yield{hasNext:!1})}(a):/text\//i.test(f)?async function*(e){var r=await e.text();try{var t=JSON.parse(r);yield t}catch(e){throw new Error(r)}}(a):async function*(e){yield JSON.parse(await e.text())}(a),s))c.pending&&!o?i=c.pending:c.pending&&(i=[...i,...c.pending]),o=o?E(o,c,a,i):O(e,c,a),n=!1,yield o,n=!0;o||(yield o=O(e,{},a))}catch(r){if(!n)throw r;yield A(e,a&&(a.status<200||a.status>=300)&&a.statusText?new Error(a.statusText):r,a)}}(e,t,a))))},exports.makeFetchURL=(e,r)=>{var t="query"===e.kind&&e.context.preferGetMethod;if(!t||!r)return e.context.url;var a=new URL(e.context.url);for(var n in r){var o=r[n];o&&a.searchParams.set(n,"object"==typeof o?c(o):o)}var s=a.toString();return s.length>2047&&"force"!==t?(e.context.preferGetMethod=!1,e.context.url):s},exports.makeResult=O,exports.mergeResultPatch=E,exports.stringifyDocument=m,exports.stringifyVariables=c;
//# sourceMappingURL=urql-core-chunk.min.js.map
{
"name": "@urql/core",
"version": "4.3.0-canary-969935c6",
"version": "4.3.0-canary-973da7ff",
"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

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