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

@urql/exchange-populate

Package Overview
Dependencies
Maintainers
31
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@urql/exchange-populate - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

8

CHANGELOG.md
# @urql/exchange-populate
## 0.1.5
### Patch Changes
- Pick modules from graphql package, instead of importing from graphql/index.mjs, by [@kitten](https://github.com/kitten) (See [#700](https://github.com/FormidableLabs/urql/pull/700))
- Updated dependencies (See [#700](https://github.com/FormidableLabs/urql/pull/700))
- @urql/core@1.10.9
## 0.1.4

@@ -4,0 +12,0 @@

32

dist/urql-exchange-populate.js
"use strict";
var graphql = require("graphql"), wonka = require("wonka");
var buildClientSchema = require("graphql/utilities/buildClientSchema"), TypeInfo = require("graphql/utilities/TypeInfo"), definition = require("graphql/type/definition"), kinds = require("graphql/language/kinds"), visitor = require("graphql/language/visitor"), wonka = require("wonka");

@@ -20,3 +20,3 @@ function _extends() {

}, unwrapType = function(a) {
return graphql.isWrappingType(a) ? unwrapType(a.ofType) : a || null;
return definition.isWrappingType(a) ? unwrapType(a.ofType) : a || null;
}, helpUrl = "\nhttps://bit.ly/38yWDau#", cache = new Set;

@@ -27,4 +27,4 @@

}, extractSelectionsFromQuery = function(a, b) {
var c = [], f = [], h = new graphql.TypeInfo(a);
graphql.visit(b, graphql.visitWithTypeInfo(h, {
var c = [], f = [], h = new TypeInfo.TypeInfo(a);
visitor.visit(b, TypeInfo.visitWithTypeInfo(h, {
Field: function(a) {

@@ -34,5 +34,5 @@ if (a.selectionSet) {

f.push({
kind: graphql.Kind.FRAGMENT_DEFINITION,
kind: kinds.Kind.FRAGMENT_DEFINITION,
typeCondition: {
kind: graphql.Kind.NAMED_TYPE,
kind: kinds.Kind.NAMED_TYPE,
name: nameNode(b)

@@ -73,3 +73,3 @@ },

a.push({
kind: graphql.Kind.FRAGMENT_SPREAD,
kind: kinds.Kind.FRAGMENT_SPREAD,
name: nameNode(g)

@@ -80,4 +80,4 @@ });

}
var k = new graphql.TypeInfo(a), n = makeDict(), m = makeDict(), p = new Set;
return graphql.visit(b, graphql.visitWithTypeInfo(k, {
var k = new TypeInfo.TypeInfo(a), n = makeDict(), m = makeDict(), p = new Set;
return visitor.visit(b, TypeInfo.visitWithTypeInfo(k, {
Field: {

@@ -92,3 +92,3 @@ enter: function(b) {

d = 0 !== l.length + d.length ? d.concat(l) : [ {
kind: graphql.Kind.FIELD,
kind: kinds.Kind.FIELD,
name: nameNode("__typename")

@@ -99,3 +99,3 @@ } ];

selectionSet: {
kind: graphql.Kind.SELECTION_SET,
kind: kinds.Kind.SELECTION_SET,
selections: d

@@ -128,3 +128,3 @@ }

return {
kind: graphql.Kind.NAME,
kind: kinds.Kind.NAME,
value: a

@@ -134,3 +134,3 @@ };

b = unwrapType(b.getType());
return graphql.isCompositeType(b) ? graphql.isAbstractType(b) ? a.getPossibleTypes(b) : [ b ] : ("production" !== process.env.NODE_ENV && function warn(a, b) {
return definition.isCompositeType(b) ? definition.isAbstractType(b) ? a.getPossibleTypes(b) : [ b ] : ("production" !== process.env.NODE_ENV && function warn(a, b) {
cache.has(a) || (console.warn(a + helpUrl + b), cache.add(a));

@@ -145,7 +145,7 @@ }("Invalid type: The type ` + type + ` is used with @populate but does not exist.", 17),

}
}((a = unwrapType(a.getType())) && !graphql.isAbstractType(a), "production" !== process.env.NODE_ENV ? "Invalid TypeInfo state: Found no flat schema type when one was expected." : "", 18);
}((a = unwrapType(a.getType())) && !definition.isAbstractType(a), "production" !== process.env.NODE_ENV ? "Invalid TypeInfo state: Found no flat schema type when one was expected." : "", 18);
return a.toString();
}, getUsedFragments = function(a) {
var b = [];
graphql.visit(a, {
visitor.visit(a, {
FragmentSpread: function(a) {

@@ -168,3 +168,3 @@ b.push(getName(a));

}
var h = a.forward, k = graphql.buildClientSchema(b), n = new Set, m = new Set, p = makeDict(), l = makeDict(), g = function(a) {
var h = a.forward, k = buildClientSchema.buildClientSchema(b), n = new Set, m = new Set, p = makeDict(), l = makeDict(), g = function(a) {
if ("mutation" !== a.operationName) {

@@ -171,0 +171,0 @@ return a;

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

"use strict";var e=require("graphql"),n=require("wonka");function t(){return(t=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t,r=arguments[n];for(t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e}).apply(this,arguments)}var r=function(e){return e.name.value},i=function(n){return e.isWrappingType(n)?i(n.ofType):n||null},o=function(){return Object.create(null)},a=function(n,t){var r=[],i=[],o=new e.TypeInfo(n);return e.visit(t,e.visitWithTypeInfo(o,{Field:function(n){if(n.selectionSet){var t=l(o);i.push({kind:e.Kind.FRAGMENT_DEFINITION,typeCondition:{kind:e.Kind.NAMED_TYPE,name:s(t)},name:s(t+"_PopulateFragment_"),selectionSet:n.selectionSet})}},FragmentDefinition:function(e){r.push(e)}})),[r,i]};function u(e){return"populate"!==r(e)}function c(e,n){return"FragmentDefinition"===n.kind&&e.add(n.name.value),e}var f=function(n,i,a,f){function l(n,t){if(!(t=a[t.name]))return n;for(var i=0,o=t.length;i<o;i++){for(var u=t[i].fragment,c=r(u),p=d(u),l=0,v=p.length;l<v;l++){var g=p[l];m.has(g)||(h[g]=f[g])}y[c]=u,n.push({kind:e.Kind.FRAGMENT_SPREAD,name:s(c)})}return n}var v=new e.TypeInfo(n),h=o(),y=o(),m=new Set;return e.visit(i,e.visitWithTypeInfo(v,{Field:{enter:function(r){if(r.directives){var i=r.directives.filter(u);if(i.length!==r.directives.length){var o=p(n,v).reduce(l,[]),a=function(e){return void 0!==e.selectionSet?e.selectionSet.selections:[]}(r);return o=0!==a.length+o.length?o.concat(a):[{kind:e.Kind.FIELD,name:s("__typename")}],t({},r,{directives:i,selectionSet:{kind:e.Kind.SELECTION_SET,selections:o}})}}}},Document:{enter:function(e){e.definitions.reduce(c,m)},leave:function(e){var n,r=[].concat(e.definitions);for(n in y)r.push(y[n]);for(var i in h)r.push(h[i]);return t({},e,{definitions:r})}}}))},s=function(n){return{kind:e.Kind.NAME,value:n}},p=function(n,t){return t=i(t.getType()),e.isCompositeType(t)?e.isAbstractType(t)?n.getPossibleTypes(t):[t]:[]},l=function(n){return function(e,n,t){if(!e)throw(e=Error("Minfied Error #18\n\nhttps://bit.ly/38yWDau#18")).name="Graphcache Error",e}((n=i(n.getType()))&&!e.isAbstractType(n)),n.toString()},d=function(n){var t=[];return e.visit(n,{FragmentSpread:function(e){t.push(r(e))}}),t};exports.addFragmentsToQuery=f,exports.extractSelectionsFromQuery=a,exports.populateExchange=function(i){var u=i.schema;return function(i){function c(e){return d.has(e.key)}var s=i.forward,p=e.buildClientSchema(u),l=new Set,d=new Set,v=o(),h=o(),y=function(e){if("mutation"!==e.operationName)return e;var n,r=o();for(n in h)r[n]=h[n].filter(c);return t({},e,{query:f(p,e.query,r,v)})},m=function(e){var n=e.key,t=e.query;if("query"===e.operationName&&(d.add(n),!l.has(n))){l.add(n),t=(e=a(p,t))[0],e=e[1];for(var i=0,o=t.length;i<o;i++){var u=t[i];v[r(u)]=u}for(t=0,i=e.length;t<i;t++)u=r((o=e[t]).typeCondition),u=h[u]||(h[u]=[]),o.name.value+=u.length,u.push({key:n,fragment:o})}},g=function(e){"teardown"===e.operationName&&d.delete(e.key)};return function(e){return s(n.map(y)(n.tap(g)(n.tap(m)(e))))}}};
"use strict";var e=require("graphql/utilities/buildClientSchema"),n=require("graphql/utilities/TypeInfo"),t=require("graphql/type/definition"),r=require("graphql/language/kinds"),i=require("graphql/language/visitor"),o=require("wonka");function a(){return(a=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t,r=arguments[n];for(t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e}).apply(this,arguments)}var u=function(e){return e.name.value},c=function(e){return t.isWrappingType(e)?c(e.ofType):e||null},f=function(){return Object.create(null)},s=function(e,t){var o=[],a=[],u=new n.TypeInfo(e);return i.visit(t,n.visitWithTypeInfo(u,{Field:function(e){if(e.selectionSet){var n=g(u);a.push({kind:r.Kind.FRAGMENT_DEFINITION,typeCondition:{kind:r.Kind.NAMED_TYPE,name:v(n)},name:v(n+"_PopulateFragment_"),selectionSet:e.selectionSet})}},FragmentDefinition:function(e){o.push(e)}})),[o,a]};function l(e){return"populate"!==u(e)}function p(e,n){return"FragmentDefinition"===n.kind&&e.add(n.name.value),e}var d=function(e,t,o,c){function s(e,n){if(!(n=o[n.name]))return e;for(var t=0,i=n.length;t<i;t++){for(var a=n[t].fragment,f=u(a),s=y(a),l=0,p=s.length;l<p;l++){var d=s[l];T.has(d)||(g[d]=c[d])}m[f]=a,e.push({kind:r.Kind.FRAGMENT_SPREAD,name:v(f)})}return e}var d=new n.TypeInfo(e),g=f(),m=f(),T=new Set;return i.visit(t,n.visitWithTypeInfo(d,{Field:{enter:function(n){if(n.directives){var t=n.directives.filter(l);if(t.length!==n.directives.length){var i=h(e,d).reduce(s,[]),o=function(e){return void 0!==e.selectionSet?e.selectionSet.selections:[]}(n);return i=0!==o.length+i.length?i.concat(o):[{kind:r.Kind.FIELD,name:v("__typename")}],a({},n,{directives:t,selectionSet:{kind:r.Kind.SELECTION_SET,selections:i}})}}}},Document:{enter:function(e){e.definitions.reduce(p,T)},leave:function(e){var n,t=[].concat(e.definitions);for(n in m)t.push(m[n]);for(var r in g)t.push(g[r]);return a({},e,{definitions:t})}}}))},v=function(e){return{kind:r.Kind.NAME,value:e}},h=function(e,n){return n=c(n.getType()),t.isCompositeType(n)?t.isAbstractType(n)?e.getPossibleTypes(n):[n]:[]},g=function(e){return function(e,n,t){if(!e)throw(e=Error("Minfied Error #18\n\nhttps://bit.ly/38yWDau#18")).name="Graphcache Error",e}((e=c(e.getType()))&&!t.isAbstractType(e)),e.toString()},y=function(e){var n=[];return i.visit(e,{FragmentSpread:function(e){n.push(u(e))}}),n};exports.addFragmentsToQuery=d,exports.extractSelectionsFromQuery=s,exports.populateExchange=function(n){var t=n.schema;return function(n){function r(e){return p.has(e.key)}var i=n.forward,c=e.buildClientSchema(t),l=new Set,p=new Set,v=f(),h=f(),g=function(e){if("mutation"!==e.operationName)return e;var n,t=f();for(n in h)t[n]=h[n].filter(r);return a({},e,{query:d(c,e.query,t,v)})},y=function(e){var n=e.key,t=e.query;if("query"===e.operationName&&(p.add(n),!l.has(n))){l.add(n),t=(e=s(c,t))[0],e=e[1];for(var r=0,i=t.length;r<i;r++){var o=t[r];v[u(o)]=o}for(t=0,r=e.length;t<r;t++)o=u((i=e[t]).typeCondition),o=h[o]||(h[o]=[]),i.name.value+=o.length,o.push({key:n,fragment:i})}},m=function(e){"teardown"===e.operationName&&p.delete(e.key)};return function(e){return i(o.map(g)(o.tap(m)(o.tap(y)(e))))}}};
//# sourceMappingURL=urql-exchange-populate.min.js.map
{
"name": "@urql/exchange-populate",
"version": "0.1.4",
"version": "0.1.5",
"description": "An exchange that automaticcally populates the mutation selection body",

@@ -51,3 +51,3 @@ "sideEffects": false,

"dependencies": {
"@urql/core": ">=1.10.8",
"@urql/core": ">=1.10.9",
"wonka": "^4.0.9"

@@ -54,0 +54,0 @@ },

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