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.1 to 3.2.0-alpha.0

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,3 +0,2 @@

import { ApolloClient, ApolloQueryResult, ApolloError, FetchMoreOptions, UpdateQueryOptions, FetchMoreQueryOptions, SubscribeToMoreOptions } from 'apollo-client';
import { OperationVariables, MutationFunction, BaseQueryOptions, BaseMutationOptions, MutationResult } from '@apollo/react-common';
import { ApolloClient, ApolloQueryResult, ApolloError, FetchMoreOptions, UpdateQueryOptions, FetchMoreQueryOptions, SubscribeToMoreOptions, OperationVariables, MutationFunction, BaseQueryOptions, BaseMutationOptions, MutationResult } from '@apollo/react-common';
export interface QueryControls<TData = any, TGraphQLVariables = OperationVariables> {

@@ -4,0 +3,0 @@ error?: ApolloError;

@@ -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.1",
"version": "3.2.0-alpha.0",
"author": "opensource@apollographql.com",

@@ -32,3 +32,3 @@ "keywords": [

"predeploy": "npm run build",
"deploy": "npm publish",
"deploy": "npm publish --tag alpha",
"test": "npx jest --config ../../config/jest.config.js --testPathPattern packages/hoc",

@@ -41,3 +41,2 @@ "test:watch": "npx jest --config ../../config/jest.config.js --testPathPattern packages/hoc --watch",

"@types/react": "^16.8.0",
"apollo-client": "^2.6.4",
"graphql": "^14.3.1",

@@ -48,4 +47,4 @@ "react": "^16.8.0",

"dependencies": {
"@apollo/react-common": "^3.1.1",
"@apollo/react-components": "^3.1.1",
"@apollo/react-common": "^3.2.0-alpha.0",
"@apollo/react-components": "^3.2.0-alpha.0",
"hoist-non-react-statics": "^3.3.0",

@@ -55,2 +54,10 @@ "ts-invariant": "^0.4.4",

},
"devDependencies": {
"@apollo/react-ssr": "^3.2.0-alpha.0",
"@apollo/react-testing": "^3.2.0-alpha.0",
"jest": "24.9.0",
"rollup": "1.21.4",
"tsc-watch": "3.0.2",
"typescript": "3.6.3"
},
"files": [

@@ -62,10 +69,3 @@ "lib"

},
"devDependencies": {
"@apollo/react-ssr": "^3.1.1",
"jest": "24.9.0",
"rollup": "1.20.3",
"tsc-watch": "3.0.1",
"typescript": "3.5.3"
},
"gitHead": "1ad1e76c298b8c8ff9a49c03a8dec4b1da812625"
"gitHead": "d6a6c693cde6dcd9cc9845d53daff0d73951ddca"
}

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

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