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

@apollo/react-hoc

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apollo/react-hoc - npm Package Compare versions

Comparing version 3.1.2 to 3.1.3

4

lib/hoc-utils.js

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

import * as tslib_1 from "tslib";
import { __extends } from "tslib";
import React from 'react';

@@ -29,3 +29,3 @@ import { invariant } from 'ts-invariant';

var GraphQLBase = (function (_super) {
tslib_1.__extends(GraphQLBase, _super);
__extends(GraphQLBase, _super);
function GraphQLBase(props) {

@@ -32,0 +32,0 @@ var _this = _super.call(this, props) || this;

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

import * as tslib_1 from "tslib";
import { __assign, __extends, __rest } from "tslib";
import React from 'react';

@@ -17,3 +17,3 @@ import hoistNonReactStatics from 'hoist-non-react-statics';

var GraphQL = (function (_super) {
tslib_1.__extends(GraphQL, _super);
__extends(GraphQL, _super);
function GraphQL() {

@@ -34,5 +34,5 @@ return _super !== null && _super.apply(this, arguments) || this;

}
return (React.createElement(Mutation, tslib_1.__assign({ ignoreResults: true }, opts, { mutation: document }), function (mutate, _a) {
return (React.createElement(Mutation, __assign({ ignoreResults: true }, opts, { mutation: document }), function (mutate, _a) {
var _b, _c;
var data = _a.data, r = tslib_1.__rest(_a, ["data"]);
var data = _a.data, r = __rest(_a, ["data"]);
var result = Object.assign(r, data || {});

@@ -55,3 +55,3 @@ var name = operationOptions.name || 'mutate';

}
return React.createElement(WrappedComponent, tslib_1.__assign({}, props, childProps));
return React.createElement(WrappedComponent, __assign({}, props, childProps));
}));

@@ -58,0 +58,0 @@ };

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

import * as tslib_1 from "tslib";
import { __assign, __extends, __rest } from "tslib";
import React from 'react';

@@ -23,3 +23,3 @@ import hoistNonReactStatics from 'hoist-non-react-statics';

var GraphQL = (function (_super) {
tslib_1.__extends(GraphQL, _super);
__extends(GraphQL, _super);
function GraphQL() {

@@ -34,9 +34,9 @@ return _super !== null && _super.apply(this, arguments) || this;

? Object.create(null)
: tslib_1.__assign({}, mapPropsToOptions(props));
: __assign({}, mapPropsToOptions(props));
if (!shouldSkip && !opts.variables && operation.variables.length > 0) {
opts.variables = calculateVariablesFromProps(operation, props);
}
return (React.createElement(Query, tslib_1.__assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, query: document }), function (_a) {
return (React.createElement(Query, __assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, query: document }), function (_a) {
var _b, _c;
var _ = _a.client, data = _a.data, r = tslib_1.__rest(_a, ["client", "data"]);
var _ = _a.client, data = _a.data, r = __rest(_a, ["client", "data"]);
if (operationOptions.withRef) {

@@ -49,3 +49,3 @@ _this.withRef = true;

if (shouldSkip) {
return (React.createElement(WrappedComponent, tslib_1.__assign({}, props, {})));
return (React.createElement(WrappedComponent, __assign({}, props, {})));
}

@@ -63,3 +63,3 @@ var result = Object.assign(r, data || {});

}
return (React.createElement(WrappedComponent, tslib_1.__assign({}, props, childProps)));
return (React.createElement(WrappedComponent, __assign({}, props, childProps)));
}));

@@ -66,0 +66,0 @@ };

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

exports.__esModule=!0,exports.graphql=function(t,n){void 0===n&&(n={});switch((0,e.parser)(t).type){case e.DocumentType.Mutation:return f(t,n);case e.DocumentType.Subscription:return v(t,n);case e.DocumentType.Query:default:return d(t,n)}},exports.withApollo=function(a,i){void 0===i&&(i={});var s="withApollo("+function(e){return e.displayName||e.name||"Component"}(a)+")",p=function(r){function p(e){var t=r.call(this,e)||this;return t.setWrappedInstance=t.setWrappedInstance.bind(t),t}return(0,t.__extends)(p,r),p.prototype.getWrappedInstance=function(){return(0,o.invariant)(i.withRef,1),this.wrappedInstance},p.prototype.setWrappedInstance=function(e){this.wrappedInstance=e},p.prototype.render=function(){var r=this;return n.default.createElement(e.ApolloConsumer,null,function(e){var o=Object.assign({},r.props,{client:e,ref:i.withRef?r.setWrappedInstance:void 0});return n.default.createElement(a,(0,t.__assign)({},o))})},p.displayName=s,p.WrappedComponent=a,p}(n.default.Component);return(0,r.default)(p,a,{})},exports.withMutation=f,exports.withQuery=d,exports.withSubscription=v,exports.resetApolloContext=exports.getApolloContext=exports.ApolloProvider=void 0;var e=require("@apollo/react-common");exports.ApolloConsumer=e.ApolloConsumer,exports.ApolloProvider=e.ApolloProvider,exports.getApolloContext=e.getApolloContext,exports.resetApolloContext=e.resetApolloContext;var t=require("tslib"),n=i(require("react")),r=i(require("hoist-non-react-statics")),a=require("@apollo/react-components"),o=require("ts-invariant");function i(e){return e&&e.__esModule?e:{default:e}}var s=function(){return{}},p=function(){return!1};function u(e){return e.displayName||e.name||"Component"}function l(e,t){for(var n={},r=0,a=e.variables;r<a.length;r++){var o=a[r],i=o.variable,s=o.type;if(i.name&&i.name.value){var p=i.name.value,u=t[p];void 0===u?"NonNullType"!==s.kind&&(n[p]=void 0):n[p]=u}}return n}var c=function(e){function n(t){var n=e.call(this,t)||this;return n.withRef=!1,n.setWrappedInstance=n.setWrappedInstance.bind(n),n}return(0,t.__extends)(n,e),n.prototype.getWrappedInstance=function(){return(0,o.invariant)(this.withRef,2),this.wrappedInstance},n.prototype.setWrappedInstance=function(e){this.wrappedInstance=e},n}(n.default.Component);function d(o,i){void 0===i&&(i={});var d=(0,e.parser)(o),f=i.options,v=void 0===f?s:f,h=i.skip,m=void 0===h?p:h,_=i.alias,b=void 0===_?"Apollo":_,y=v;"function"!=typeof y&&(y=function(){return v});var g,x=m;return"function"!=typeof x&&(x=function(){return m}),function(e){var s=b+"("+u(e)+")",p=function(r){function p(){return null!==r&&r.apply(this,arguments)||this}return(0,t.__extends)(p,r),p.prototype.render=function(){var r=this,p=this.props,u=x(p),c=u?Object.create(null):(0,t.__assign)({},y(p));return!u&&!c.variables&&d.variables.length>0&&(c.variables=l(d,p)),n.default.createElement(a.Query,(0,t.__assign)({},c,{displayName:s,skip:u,query:o}),function(a){a.client;var o,s,l=a.data,c=(0,t.__rest)(a,["client","data"]);if(i.withRef&&(r.withRef=!0,p=Object.assign({},p,{ref:r.setWrappedInstance})),u)return n.default.createElement(e,(0,t.__assign)({},p,{}));var d=Object.assign(c,l||{}),f=i.name||"data",v=((o={})[f]=d,o);if(i.props){var h=((s={})[f]=d,s.ownProps=p,s);v=g=i.props(h,g)}return n.default.createElement(e,(0,t.__assign)({},p,v))})},p.displayName=s,p.WrappedComponent=e,p}(c);return(0,r.default)(p,e,{})}}function f(o,i){void 0===i&&(i={});var p=(0,e.parser)(o),d=i.options,f=void 0===d?s:d,v=i.alias,h=void 0===v?"Apollo":v,m=f;return"function"!=typeof m&&(m=function(){return f}),function(e){var s=h+"("+u(e)+")",d=function(r){function u(){return null!==r&&r.apply(this,arguments)||this}return(0,t.__extends)(u,r),u.prototype.render=function(){var r=this.props,s=m(r);return i.withRef&&(this.withRef=!0,r=Object.assign({},r,{ref:this.setWrappedInstance})),!s.variables&&p.variables.length>0&&(s.variables=l(p,r)),n.default.createElement(a.Mutation,(0,t.__assign)({ignoreResults:!0},s,{mutation:o}),function(a,o){var s,p,u=o.data,l=(0,t.__rest)(o,["data"]),c=Object.assign(l,u||{}),d=i.name||"mutate",f=i.name?d+"Result":"result",v=((s={})[d]=a,s[f]=c,s);if(i.props){var h=((p={})[d]=a,p[f]=c,p.ownProps=r,p);v=i.props(h)}return n.default.createElement(e,(0,t.__assign)({},r,v))})},u.displayName=s,u.WrappedComponent=e,u}(c);return(0,r.default)(d,e,{})}}function v(o,i){void 0===i&&(i={});var d=(0,e.parser)(o),f=i.options,v=void 0===f?s:f,h=i.skip,m=void 0===h?p:h,_=i.alias,b=void 0===_?"Apollo":_,y=i.shouldResubscribe,g=v;"function"!=typeof g&&(g=function(){return v});var x,w=m;return"function"!=typeof w&&(w=function(){return m}),function(e){var s=b+"("+u(e)+")",p=function(r){function p(e){var t=r.call(this,e)||this;return t.state={resubscribe:!1},t}return(0,t.__extends)(p,r),p.prototype.componentDidUpate=function(e){y&&this.setState({resubscribe:y(e,this.props)})},p.prototype.render=function(){var r=this,p=this.props,u=w(p),c=u?Object.create(null):g(p);return!u&&!c.variables&&d.variables.length>0&&(c.variables=l(d,p)),n.default.createElement(a.Subscription,(0,t.__assign)({},c,{displayName:s,skip:u,subscription:o,shouldResubscribe:this.state.resubscribe}),function(a){var o,s,l=a.data,c=(0,t.__rest)(a,["data"]);if(i.withRef&&(r.withRef=!0,p=Object.assign({},p,{ref:r.setWrappedInstance})),u)return n.default.createElement(e,(0,t.__assign)({},p,{}));var d=Object.assign(c,l||{}),f=i.name||"data",v=((o={})[f]=d,o);if(i.props){var h=((s={})[f]=d,s.ownProps=p,s);v=x=i.props(h,x)}return n.default.createElement(e,(0,t.__assign)({},p,v))})},p.displayName=s,p.WrappedComponent=e,p}(c);return(0,r.default)(p,e,{})}}
exports.__esModule=!0,exports.graphql=function(t,n){void 0===n&&(n={});switch((0,e.parser)(t).type){case e.DocumentType.Mutation:return f(t,n);case e.DocumentType.Subscription:return v(t,n);case e.DocumentType.Query:default:return d(t,n)}},exports.withApollo=function(a,i){void 0===i&&(i={});var s="withApollo("+function(e){return e.displayName||e.name||"Component"}(a)+")",p=function(r){function p(e){var t=r.call(this,e)||this;return t.setWrappedInstance=t.setWrappedInstance.bind(t),t}return(0,t.__extends)(p,r),p.prototype.getWrappedInstance=function(){return(0,o.invariant)(i.withRef,1),this.wrappedInstance},p.prototype.setWrappedInstance=function(e){this.wrappedInstance=e},p.prototype.render=function(){var r=this;return n.default.createElement(e.ApolloConsumer,null,(function(e){var o=Object.assign({},r.props,{client:e,ref:i.withRef?r.setWrappedInstance:void 0});return n.default.createElement(a,(0,t.__assign)({},o))}))},p.displayName=s,p.WrappedComponent=a,p}(n.default.Component);return(0,r.default)(p,a,{})},exports.withMutation=f,exports.withQuery=d,exports.withSubscription=v,exports.resetApolloContext=exports.getApolloContext=exports.ApolloProvider=void 0;var e=require("@apollo/react-common");exports.ApolloConsumer=e.ApolloConsumer,exports.ApolloProvider=e.ApolloProvider,exports.getApolloContext=e.getApolloContext,exports.resetApolloContext=e.resetApolloContext;var t=require("tslib"),n=i(require("react")),r=i(require("hoist-non-react-statics")),a=require("@apollo/react-components"),o=require("ts-invariant");function i(e){return e&&e.__esModule?e:{default:e}}var s=function(){return{}},p=function(){return!1};function u(e){return e.displayName||e.name||"Component"}function l(e,t){for(var n={},r=0,a=e.variables;r<a.length;r++){var o=a[r],i=o.variable,s=o.type;if(i.name&&i.name.value){var p=i.name.value,u=t[p];void 0===u?"NonNullType"!==s.kind&&(n[p]=void 0):n[p]=u}}return n}var c=function(e){function n(t){var n=e.call(this,t)||this;return n.withRef=!1,n.setWrappedInstance=n.setWrappedInstance.bind(n),n}return(0,t.__extends)(n,e),n.prototype.getWrappedInstance=function(){return(0,o.invariant)(this.withRef,2),this.wrappedInstance},n.prototype.setWrappedInstance=function(e){this.wrappedInstance=e},n}(n.default.Component);function d(o,i){void 0===i&&(i={});var d=(0,e.parser)(o),f=i.options,v=void 0===f?s:f,h=i.skip,m=void 0===h?p:h,_=i.alias,b=void 0===_?"Apollo":_,y=v;"function"!=typeof y&&(y=function(){return v});var g,x=m;return"function"!=typeof x&&(x=function(){return m}),function(e){var s=b+"("+u(e)+")",p=function(r){function p(){return null!==r&&r.apply(this,arguments)||this}return(0,t.__extends)(p,r),p.prototype.render=function(){var r=this,p=this.props,u=x(p),c=u?Object.create(null):(0,t.__assign)({},y(p));return!u&&!c.variables&&d.variables.length>0&&(c.variables=l(d,p)),n.default.createElement(a.Query,(0,t.__assign)({},c,{displayName:s,skip:u,query:o}),(function(a){a.client;var o,s,l=a.data,c=(0,t.__rest)(a,["client","data"]);if(i.withRef&&(r.withRef=!0,p=Object.assign({},p,{ref:r.setWrappedInstance})),u)return n.default.createElement(e,(0,t.__assign)({},p,{}));var d=Object.assign(c,l||{}),f=i.name||"data",v=((o={})[f]=d,o);if(i.props){var h=((s={})[f]=d,s.ownProps=p,s);v=g=i.props(h,g)}return n.default.createElement(e,(0,t.__assign)({},p,v))}))},p.displayName=s,p.WrappedComponent=e,p}(c);return(0,r.default)(p,e,{})}}function f(o,i){void 0===i&&(i={});var p=(0,e.parser)(o),d=i.options,f=void 0===d?s:d,v=i.alias,h=void 0===v?"Apollo":v,m=f;return"function"!=typeof m&&(m=function(){return f}),function(e){var s=h+"("+u(e)+")",d=function(r){function u(){return null!==r&&r.apply(this,arguments)||this}return(0,t.__extends)(u,r),u.prototype.render=function(){var r=this.props,s=m(r);return i.withRef&&(this.withRef=!0,r=Object.assign({},r,{ref:this.setWrappedInstance})),!s.variables&&p.variables.length>0&&(s.variables=l(p,r)),n.default.createElement(a.Mutation,(0,t.__assign)({ignoreResults:!0},s,{mutation:o}),(function(a,o){var s,p,u=o.data,l=(0,t.__rest)(o,["data"]),c=Object.assign(l,u||{}),d=i.name||"mutate",f=i.name?d+"Result":"result",v=((s={})[d]=a,s[f]=c,s);if(i.props){var h=((p={})[d]=a,p[f]=c,p.ownProps=r,p);v=i.props(h)}return n.default.createElement(e,(0,t.__assign)({},r,v))}))},u.displayName=s,u.WrappedComponent=e,u}(c);return(0,r.default)(d,e,{})}}function v(o,i){void 0===i&&(i={});var d=(0,e.parser)(o),f=i.options,v=void 0===f?s:f,h=i.skip,m=void 0===h?p:h,_=i.alias,b=void 0===_?"Apollo":_,y=i.shouldResubscribe,g=v;"function"!=typeof g&&(g=function(){return v});var x,w=m;return"function"!=typeof w&&(w=function(){return m}),function(e){var s=b+"("+u(e)+")",p=function(r){function p(e){var t=r.call(this,e)||this;return t.state={resubscribe:!1},t}return(0,t.__extends)(p,r),p.prototype.componentDidUpate=function(e){y&&this.setState({resubscribe:y(e,this.props)})},p.prototype.render=function(){var r=this,p=this.props,u=w(p),c=u?Object.create(null):g(p);return!u&&!c.variables&&d.variables.length>0&&(c.variables=l(d,p)),n.default.createElement(a.Subscription,(0,t.__assign)({},c,{displayName:s,skip:u,subscription:o,shouldResubscribe:this.state.resubscribe}),(function(a){var o,s,l=a.data,c=(0,t.__rest)(a,["data"]);if(i.withRef&&(r.withRef=!0,p=Object.assign({},p,{ref:r.setWrappedInstance})),u)return n.default.createElement(e,(0,t.__assign)({},p,{}));var d=Object.assign(c,l||{}),f=i.name||"data",v=((o={})[f]=d,o);if(i.props){var h=((s={})[f]=d,s.ownProps=p,s);v=x=i.props(h,x)}return n.default.createElement(e,(0,t.__assign)({},p,v))}))},p.displayName=s,p.WrappedComponent=e,p}(c);return(0,r.default)(p,e,{})}}

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

import * as tslib_1 from "tslib";
import { __assign, __extends, __rest } from "tslib";
import React from 'react';

@@ -21,3 +21,3 @@ import hoistNonReactStatics from 'hoist-non-react-statics';

var GraphQL = (function (_super) {
tslib_1.__extends(GraphQL, _super);
__extends(GraphQL, _super);
function GraphQL(props) {

@@ -45,5 +45,5 @@ var _this = _super.call(this, props) || this;

}
return (React.createElement(Subscription, tslib_1.__assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, subscription: document, shouldResubscribe: this.state.resubscribe }), function (_a) {
return (React.createElement(Subscription, __assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, subscription: document, shouldResubscribe: this.state.resubscribe }), function (_a) {
var _b, _c;
var data = _a.data, r = tslib_1.__rest(_a, ["data"]);
var data = _a.data, r = __rest(_a, ["data"]);
if (operationOptions.withRef) {

@@ -56,3 +56,3 @@ _this.withRef = true;

if (shouldSkip) {
return (React.createElement(WrappedComponent, tslib_1.__assign({}, props, {})));
return (React.createElement(WrappedComponent, __assign({}, props, {})));
}

@@ -70,3 +70,3 @@ var result = Object.assign(r, data || {});

}
return (React.createElement(WrappedComponent, tslib_1.__assign({}, props, childProps)));
return (React.createElement(WrappedComponent, __assign({}, props, childProps)));
}));

@@ -73,0 +73,0 @@ };

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

import * as tslib_1 from "tslib";
import { __assign, __extends } from "tslib";
import React from 'react';

@@ -13,3 +13,3 @@ import { ApolloConsumer } from '@apollo/react-common';

var WithApollo = (function (_super) {
tslib_1.__extends(WithApollo, _super);
__extends(WithApollo, _super);
function WithApollo(props) {

@@ -37,3 +37,3 @@ var _this = _super.call(this, props) || this;

});
return React.createElement(WrappedComponent, tslib_1.__assign({}, props));
return React.createElement(WrappedComponent, __assign({}, props));
}));

@@ -40,0 +40,0 @@ };

{
"name": "@apollo/react-hoc",
"description": "React Apollo `graphql` higher-order component.",
"version": "3.1.2",
"version": "3.1.3",
"author": "opensource@apollographql.com",

@@ -46,4 +46,4 @@ "keywords": [

"dependencies": {
"@apollo/react-common": "^3.1.2",
"@apollo/react-components": "^3.1.2",
"@apollo/react-common": "^3.1.3",
"@apollo/react-components": "^3.1.3",
"hoist-non-react-statics": "^3.3.0",

@@ -60,9 +60,9 @@ "ts-invariant": "^0.4.4",

"devDependencies": {
"@apollo/react-ssr": "^3.1.2",
"@apollo/react-ssr": "^3.1.3",
"jest": "24.9.0",
"rollup": "1.21.4",
"rollup": "1.23.1",
"tsc-watch": "3.0.2",
"typescript": "3.6.3"
"typescript": "3.6.4"
},
"gitHead": "88162edbd24fa4c8914f681c927abfd32ca9a26c"
"gitHead": "07e404b089017f8a653d721c169a55191bf88f9b"
}

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