Socket
Socket
Sign inDemoInstall

@apollo/react-common

Package Overview
Dependencies
2
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0-beta.8 to 0.1.0-beta.9

4

lib/context/ApolloProvider.js

@@ -9,4 +9,4 @@ import React from 'react';

if (context === void 0) { context = {}; }
if (client) {
context.client = client;
if (client && context.client !== client) {
context = Object.assign({}, context, { client: client });
}

@@ -13,0 +13,0 @@ invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +

@@ -37,7 +37,9 @@ exports.__esModule = true;

if (client) {
context.client = client;
if (client && context.client !== client) {
context = Object.assign({}, context, {
client: client
});
}
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(context.client, 5) : (0, _tsInvariant.invariant)(context.client, 'ApolloProvider was not passed a client instance. Make ' + 'sure you pass in your client via the "client" prop.');
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(context.client, 1) : (0, _tsInvariant.invariant)(context.client, 'ApolloProvider was not passed a client instance. Make ' + 'sure you pass in your client via the "client" prop.');
return _react.default.createElement(ApolloContext.Provider, {

@@ -54,3 +56,3 @@ value: context

return _react.default.createElement(ApolloContext.Consumer, null, function (context) {
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(context && context.client, 6) : (0, _tsInvariant.invariant)(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' + 'Wrap the root component in an <ApolloProvider>.');
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(context && context.client, 2) : (0, _tsInvariant.invariant)(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' + 'Wrap the root component in an <ApolloProvider>.');
return props.children(context.client);

@@ -96,3 +98,3 @@ });

var variables, type, name;
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!!document && !!document.kind, 1) : (0, _tsInvariant.invariant)(!!document && !!document.kind, "Argument of " + document + " passed to parser was not a valid GraphQL " + "DocumentNode. You may need to use 'graphql-tag' or another method " + "to convert your operation into a document");
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!!document && !!document.kind, 3) : (0, _tsInvariant.invariant)(!!document && !!document.kind, "Argument of " + document + " passed to parser was not a valid GraphQL " + "DocumentNode. You may need to use 'graphql-tag' or another method " + "to convert your operation into a document");
var fragments = document.definitions.filter(function (x) {

@@ -110,8 +112,8 @@ return x.kind === 'FragmentDefinition';

});
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!fragments.length || queries.length || mutations.length || subscriptions.length, 2) : (0, _tsInvariant.invariant)(!fragments.length || queries.length || mutations.length || subscriptions.length, "Passing only a fragment to 'graphql' is not yet supported. " + "You must include a query, subscription or mutation as well");
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(queries.length + mutations.length + subscriptions.length <= 1, 3) : (0, _tsInvariant.invariant)(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " + (document + " had " + queries.length + " queries, " + subscriptions.length + " ") + ("subscriptions and " + mutations.length + " mutations. ") + "You can use 'compose' to join multiple operation types to a component");
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!fragments.length || queries.length || mutations.length || subscriptions.length, 4) : (0, _tsInvariant.invariant)(!fragments.length || queries.length || mutations.length || subscriptions.length, "Passing only a fragment to 'graphql' is not yet supported. " + "You must include a query, subscription or mutation as well");
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(queries.length + mutations.length + subscriptions.length <= 1, 5) : (0, _tsInvariant.invariant)(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " + (document + " had " + queries.length + " queries, " + subscriptions.length + " ") + ("subscriptions and " + mutations.length + " mutations. ") + "You can use 'compose' to join multiple operation types to a component");
type = queries.length ? DocumentType.Query : DocumentType.Mutation;
if (!queries.length && !mutations.length) type = DocumentType.Subscription;
var definitions = queries.length ? queries : mutations.length ? mutations : subscriptions;
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(definitions.length === 1, 4) : (0, _tsInvariant.invariant)(definitions.length === 1, "react-apollo only supports one definition per HOC. " + document + " had " + (definitions.length + " definitions. ") + "You can use 'compose' to join multiple operation types to a component");
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(definitions.length === 1, 6) : (0, _tsInvariant.invariant)(definitions.length === 1, "react-apollo only supports one definition per HOC. " + document + " had " + (definitions.length + " definitions. ") + "You can use 'compose' to join multiple operation types to a component");
var definition = definitions[0];

@@ -118,0 +120,0 @@ variables = definition.variableDefinitions || [];

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

exports.__esModule=!0,exports.getApolloContext=r,exports.operationName=function(e){var n;switch(e){case o.Query:n="Query";break;case o.Mutation:n="Mutation";break;case o.Subscription:n="Subscription"}return n},exports.parser=function(e){var n,t,r,u=a.get(e);if(u)return u;(0,i.invariant)(!!e&&!!e.kind,1);var l=e.definitions.filter(function(e){return"FragmentDefinition"===e.kind}),c=e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&"query"===e.operation}),s=e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}),p=e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&"subscription"===e.operation});(0,i.invariant)(!l.length||c.length||s.length||p.length,2),(0,i.invariant)(c.length+s.length+p.length<=1,3),t=c.length?o.Query:o.Mutation,c.length||s.length||(t=o.Subscription);var f=c.length?c:s.length?s:p;(0,i.invariant)(1===f.length,4);var v=f[0];n=v.variableDefinitions||[],r=v.name&&"Name"===v.name.kind?v.name.value:"data";var d={name:r,type:t,variables:n};return a.set(e,d),d},exports.resetApolloContext=function(){n=t.default.createContext({})},exports.DocumentType=exports.ApolloProvider=exports.ApolloConsumer=void 0;var e,n,t=(e=require("react"))&&e.__esModule?e:{default:e},i=require("ts-invariant");function r(){return n||(n=t.default.createContext({})),n}exports.ApolloProvider=function(e){var n=e.client,o=e.children,a=r();return t.default.createElement(a.Consumer,null,function(e){return void 0===e&&(e={}),n&&(e.client=n),(0,i.invariant)(e.client,5),t.default.createElement(a.Provider,{value:e},o)})};var o;exports.ApolloConsumer=function(e){var n=r();return t.default.createElement(n.Consumer,null,function(n){return(0,i.invariant)(n&&n.client,6),e.children(n.client)})},exports.DocumentType=o,function(e){e[e.Query=0]="Query",e[e.Mutation=1]="Mutation",e[e.Subscription=2]="Subscription"}(o||(exports.DocumentType=o={}));var a=new Map;
exports.__esModule=!0,exports.getApolloContext=r,exports.operationName=function(e){var n;switch(e){case o.Query:n="Query";break;case o.Mutation:n="Mutation";break;case o.Subscription:n="Subscription"}return n},exports.parser=function(e){var n,t,r,u=a.get(e);if(u)return u;(0,i.invariant)(!!e&&!!e.kind,3);var l=e.definitions.filter(function(e){return"FragmentDefinition"===e.kind}),c=e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&"query"===e.operation}),s=e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}),p=e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&"subscription"===e.operation});(0,i.invariant)(!l.length||c.length||s.length||p.length,4),(0,i.invariant)(c.length+s.length+p.length<=1,5),t=c.length?o.Query:o.Mutation,c.length||s.length||(t=o.Subscription);var f=c.length?c:s.length?s:p;(0,i.invariant)(1===f.length,6);var v=f[0];n=v.variableDefinitions||[],r=v.name&&"Name"===v.name.kind?v.name.value:"data";var d={name:r,type:t,variables:n};return a.set(e,d),d},exports.resetApolloContext=function(){n=t.default.createContext({})},exports.DocumentType=exports.ApolloProvider=exports.ApolloConsumer=void 0;var e,n,t=(e=require("react"))&&e.__esModule?e:{default:e},i=require("ts-invariant");function r(){return n||(n=t.default.createContext({})),n}exports.ApolloProvider=function(e){var n=e.client,o=e.children,a=r();return t.default.createElement(a.Consumer,null,function(e){return void 0===e&&(e={}),n&&e.client!==n&&(e=Object.assign({},e,{client:n})),(0,i.invariant)(e.client,1),t.default.createElement(a.Provider,{value:e},o)})};var o;exports.ApolloConsumer=function(e){var n=r();return t.default.createElement(n.Consumer,null,function(n){return(0,i.invariant)(n&&n.client,2),e.children(n.client)})},exports.DocumentType=o,function(e){e[e.Query=0]="Query",e[e.Mutation=1]="Mutation",e[e.Subscription=2]="Subscription"}(o||(exports.DocumentType=o={}));var a=new Map;

@@ -20,6 +20,6 @@ import React from 'react';

if (context === void 0) { context = {}; }
if (client) {
context.client = client;
if (client && context.client !== client) {
context = Object.assign({}, context, { client: client });
}
process.env.NODE_ENV === "production" ? invariant(context.client, 5) : invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
process.env.NODE_ENV === "production" ? invariant(context.client, 1) : invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
'sure you pass in your client via the "client" prop.');

@@ -33,3 +33,3 @@ return (React.createElement(ApolloContext.Provider, { value: context }, children));

return React.createElement(ApolloContext.Consumer, null, function (context) {
process.env.NODE_ENV === "production" ? invariant(context && context.client, 6) : invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' +
process.env.NODE_ENV === "production" ? invariant(context && context.client, 2) : invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' +
'Wrap the root component in an <ApolloProvider>.');

@@ -67,3 +67,3 @@ return props.children(context.client);

var variables, type, name;
process.env.NODE_ENV === "production" ? invariant(!!document && !!document.kind, 1) : invariant(!!document && !!document.kind, "Argument of " + document + " passed to parser was not a valid GraphQL " +
process.env.NODE_ENV === "production" ? invariant(!!document && !!document.kind, 3) : invariant(!!document && !!document.kind, "Argument of " + document + " passed to parser was not a valid GraphQL " +
"DocumentNode. You may need to use 'graphql-tag' or another method " +

@@ -82,6 +82,6 @@ "to convert your operation into a document");

process.env.NODE_ENV === "production" ? invariant(!fragments.length ||
(queries.length || mutations.length || subscriptions.length), 2) : invariant(!fragments.length ||
(queries.length || mutations.length || subscriptions.length), 4) : invariant(!fragments.length ||
(queries.length || mutations.length || subscriptions.length), "Passing only a fragment to 'graphql' is not yet supported. " +
"You must include a query, subscription or mutation as well");
process.env.NODE_ENV === "production" ? invariant(queries.length + mutations.length + subscriptions.length <= 1, 3) : invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
process.env.NODE_ENV === "production" ? invariant(queries.length + mutations.length + subscriptions.length <= 1, 5) : invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
(document + " had " + queries.length + " queries, " + subscriptions.length + " ") +

@@ -98,3 +98,3 @@ ("subscriptions and " + mutations.length + " mutations. ") +

: subscriptions;
process.env.NODE_ENV === "production" ? invariant(definitions.length === 1, 4) : invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. " + document + " had " +
process.env.NODE_ENV === "production" ? invariant(definitions.length === 1, 6) : invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. " + document + " had " +
(definitions.length + " definitions. ") +

@@ -101,0 +101,0 @@ "You can use 'compose' to join multiple operation types to a component");

@@ -48,7 +48,9 @@ (function (global, factory) {

if (client) {
context.client = client;
if (client && context.client !== client) {
context = Object.assign({}, context, {
client: client
});
}
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(context.client, 5) : (0, _tsInvariant.invariant)(context.client, 'ApolloProvider was not passed a client instance. Make ' + 'sure you pass in your client via the "client" prop.');
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(context.client, 1) : (0, _tsInvariant.invariant)(context.client, 'ApolloProvider was not passed a client instance. Make ' + 'sure you pass in your client via the "client" prop.');
return _react.default.createElement(ApolloContext.Provider, {

@@ -65,3 +67,3 @@ value: context

return _react.default.createElement(ApolloContext.Consumer, null, function (context) {
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(context && context.client, 6) : (0, _tsInvariant.invariant)(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' + 'Wrap the root component in an <ApolloProvider>.');
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(context && context.client, 2) : (0, _tsInvariant.invariant)(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' + 'Wrap the root component in an <ApolloProvider>.');
return props.children(context.client);

@@ -107,3 +109,3 @@ });

var variables, type, name;
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!!document && !!document.kind, 1) : (0, _tsInvariant.invariant)(!!document && !!document.kind, "Argument of " + document + " passed to parser was not a valid GraphQL " + "DocumentNode. You may need to use 'graphql-tag' or another method " + "to convert your operation into a document");
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!!document && !!document.kind, 3) : (0, _tsInvariant.invariant)(!!document && !!document.kind, "Argument of " + document + " passed to parser was not a valid GraphQL " + "DocumentNode. You may need to use 'graphql-tag' or another method " + "to convert your operation into a document");
var fragments = document.definitions.filter(function (x) {

@@ -121,8 +123,8 @@ return x.kind === 'FragmentDefinition';

});
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!fragments.length || queries.length || mutations.length || subscriptions.length, 2) : (0, _tsInvariant.invariant)(!fragments.length || queries.length || mutations.length || subscriptions.length, "Passing only a fragment to 'graphql' is not yet supported. " + "You must include a query, subscription or mutation as well");
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(queries.length + mutations.length + subscriptions.length <= 1, 3) : (0, _tsInvariant.invariant)(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " + (document + " had " + queries.length + " queries, " + subscriptions.length + " ") + ("subscriptions and " + mutations.length + " mutations. ") + "You can use 'compose' to join multiple operation types to a component");
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(!fragments.length || queries.length || mutations.length || subscriptions.length, 4) : (0, _tsInvariant.invariant)(!fragments.length || queries.length || mutations.length || subscriptions.length, "Passing only a fragment to 'graphql' is not yet supported. " + "You must include a query, subscription or mutation as well");
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(queries.length + mutations.length + subscriptions.length <= 1, 5) : (0, _tsInvariant.invariant)(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " + (document + " had " + queries.length + " queries, " + subscriptions.length + " ") + ("subscriptions and " + mutations.length + " mutations. ") + "You can use 'compose' to join multiple operation types to a component");
type = queries.length ? DocumentType.Query : DocumentType.Mutation;
if (!queries.length && !mutations.length) type = DocumentType.Subscription;
var definitions = queries.length ? queries : mutations.length ? mutations : subscriptions;
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(definitions.length === 1, 4) : (0, _tsInvariant.invariant)(definitions.length === 1, "react-apollo only supports one definition per HOC. " + document + " had " + (definitions.length + " definitions. ") + "You can use 'compose' to join multiple operation types to a component");
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(definitions.length === 1, 6) : (0, _tsInvariant.invariant)(definitions.length === 1, "react-apollo only supports one definition per HOC. " + document + " had " + (definitions.length + " definitions. ") + "You can use 'compose' to join multiple operation types to a component");
var definition = definitions[0];

@@ -129,0 +131,0 @@ variables = definition.variableDefinitions || [];

@@ -39,2 +39,3 @@ import ApolloClient, { ApolloQueryResult, ApolloError, FetchPolicy, WatchQueryFetchPolicy, ErrorPolicy, FetchMoreOptions, FetchMoreQueryOptions, PureQueryOptions, MutationUpdaterFn, NetworkStatus, ObservableQuery } from 'apollo-client';

networkStatus: NetworkStatus;
called: boolean;
}

@@ -41,0 +42,0 @@ export declare type RefetchQueriesFunction = (...args: any[]) => Array<string | PureQueryOptions>;

{
"name": "@apollo/react-common",
"description": "React Apollo common utilities.",
"version": "0.1.0-beta.8",
"version": "0.1.0-beta.9",
"author": "opensource@apollographql.com",

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

"scripts": {
"clean": "rm -Rf ./lib/* ./meta/bundlesize/* ./meta/coverage/*",
"clean": "rm -Rf ./lib/* ./meta/bundlesize/* ./meta/coverage/* ./.rpt2_cache",
"prepare": "npm run build",

@@ -52,8 +52,8 @@ "prebuild": "npm run clean",

"devDependencies": {
"jest": "^24.8.0",
"rollup": "1.16.2",
"tsc-watch": "^2.2.1",
"typescript": "^3.5.2"
"jest": "24.8.0",
"rollup": "1.16.7",
"tsc-watch": "2.2.1",
"typescript": "3.5.3"
},
"gitHead": "808e66755990a649202a662a6c6e8b8d20a0e9fb"
"gitHead": "bd87da901113c81e3e7e2a7edaeac791895abb96"
}

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc