@apollo/react-common
Advanced tools
Comparing version 3.1.0-beta.0 to 3.1.0
@@ -43,3 +43,3 @@ exports.__esModule = true; | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(context.client, 6) : (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, { | ||
@@ -56,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, 1) : (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, 6) : (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); | ||
@@ -59,0 +59,0 @@ }); |
@@ -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,2);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,3),(0,i.invariant)(c.length+s.length+p.length<=1,4),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,5);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,6),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,1),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,2);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,3),(0,i.invariant)(c.length+s.length+p.length<=1,4),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,5);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,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; |
@@ -23,3 +23,3 @@ import React from 'react'; | ||
} | ||
process.env.NODE_ENV === "production" ? invariant(context.client, 6) : 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, 1) : invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' + | ||
process.env.NODE_ENV === "production" ? invariant(context && context.client, 6) : invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' + | ||
'Wrap the root component in an <ApolloProvider>.'); | ||
@@ -36,0 +36,0 @@ return props.children(context.client); |
@@ -54,3 +54,3 @@ (function (global, factory) { | ||
process.env.NODE_ENV === "production" ? (0, _tsInvariant.invariant)(context.client, 6) : (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, { | ||
@@ -67,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, 1) : (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, 6) : (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); | ||
@@ -70,0 +70,0 @@ }); |
@@ -77,3 +77,3 @@ import ApolloClient, { ApolloQueryResult, ApolloError, FetchPolicy, WatchQueryFetchPolicy, ErrorPolicy, FetchMoreOptions, FetchMoreQueryOptions, PureQueryOptions, MutationUpdaterFn, NetworkStatus, ObservableQuery } from 'apollo-client'; | ||
}; | ||
export declare type MutationFunction<TData = any, TVariables = OperationVariables> = (options?: MutationFunctionOptions<TData, TVariables>) => Promise<void | MutationFetchResult<TData>>; | ||
export declare type MutationFunction<TData = any, TVariables = OperationVariables> = (options?: MutationFunctionOptions<TData, TVariables>) => Promise<MutationFetchResult<TData>>; | ||
export interface OnSubscriptionDataOptions<TData = any> { | ||
@@ -88,2 +88,3 @@ client: ApolloClient<object>; | ||
client?: ApolloClient<object>; | ||
skip?: boolean; | ||
onSubscriptionData?: (options: OnSubscriptionDataOptions<TData>) => any; | ||
@@ -90,0 +91,0 @@ onSubscriptionComplete?: () => void; |
{ | ||
"name": "@apollo/react-common", | ||
"description": "React Apollo common utilities.", | ||
"version": "3.1.0-beta.0", | ||
"version": "3.1.0", | ||
"author": "opensource@apollographql.com", | ||
@@ -28,3 +28,3 @@ "keywords": [ | ||
"predeploy": "npm run build", | ||
"deploy": "npm publish --tag beta", | ||
"deploy": "npm publish", | ||
"test": "npx jest --config ../../config/jest.config.js --testPathPattern packages/common", | ||
@@ -54,7 +54,7 @@ "test:watch": "npx jest --config ../../config/jest.config.js --testPathPattern packages/common --watch", | ||
"jest": "24.9.0", | ||
"rollup": "1.19.4", | ||
"rollup": "1.20.3", | ||
"tsc-watch": "2.4.0", | ||
"typescript": "3.5.3" | ||
}, | ||
"gitHead": "241ccacb9e27ab9cda90aa4a5c1f7ee29c05391b" | ||
"gitHead": "3bc12b7f5b2064acc7ec0e15ec59cd2acfa61d49" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
598
2
67298