@apollo/client
Advanced tools
Comparing version 3.0.0-beta.2 to 3.0.0-beta.3
@@ -49,3 +49,3 @@ import { __awaiter, __generator, __assign } from 'tslib'; | ||
this.fetchQueryRejectFns.forEach(function (reject) { | ||
reject(process.env.NODE_ENV === "production" ? new InvariantError(39) : new InvariantError('QueryManager stopped while query was in flight')); | ||
reject(process.env.NODE_ENV === "production" ? new InvariantError(37) : new InvariantError('QueryManager stopped while query was in flight')); | ||
}); | ||
@@ -61,4 +61,4 @@ }; | ||
case 0: | ||
process.env.NODE_ENV === "production" ? invariant(mutation, 40) : invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.'); | ||
process.env.NODE_ENV === "production" ? invariant(!fetchPolicy || fetchPolicy === 'no-cache', 41) : invariant(!fetchPolicy || fetchPolicy === 'no-cache', "Mutations only support a 'no-cache' fetchPolicy. If you don't want to disable the cache, remove your fetchPolicy setting to proceed with the default mutation behavior."); | ||
process.env.NODE_ENV === "production" ? invariant(mutation, 38) : invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.'); | ||
process.env.NODE_ENV === "production" ? invariant(!fetchPolicy || fetchPolicy === 'no-cache', 39) : invariant(!fetchPolicy || fetchPolicy === 'no-cache', "Mutations only support a 'no-cache' fetchPolicy. If you don't want to disable the cache, remove your fetchPolicy setting to proceed with the default mutation behavior."); | ||
mutationId = this.generateQueryId(); | ||
@@ -457,3 +457,3 @@ mutation = this.transform(mutation).document; | ||
if (shouldSubscribe === void 0) { shouldSubscribe = true; } | ||
process.env.NODE_ENV === "production" ? invariant(options.fetchPolicy !== 'standby', 42) : invariant(options.fetchPolicy !== 'standby', 'client.watchQuery cannot be called with fetchPolicy set to "standby"'); | ||
process.env.NODE_ENV === "production" ? invariant(options.fetchPolicy !== 'standby', 40) : invariant(options.fetchPolicy !== 'standby', 'client.watchQuery cannot be called with fetchPolicy set to "standby"'); | ||
options.variables = this.getVariables(options.query, options.variables); | ||
@@ -472,7 +472,7 @@ if (typeof options.notifyOnNetworkStatusChange === 'undefined') { | ||
var _this = this; | ||
process.env.NODE_ENV === "production" ? invariant(options.query, 43) : invariant(options.query, 'query option is required. You must specify your GraphQL document ' + | ||
process.env.NODE_ENV === "production" ? invariant(options.query, 41) : invariant(options.query, 'query option is required. You must specify your GraphQL document ' + | ||
'in the query option.'); | ||
process.env.NODE_ENV === "production" ? invariant(options.query.kind === 'Document', 44) : invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.'); | ||
process.env.NODE_ENV === "production" ? invariant(!options.returnPartialData, 45) : invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.'); | ||
process.env.NODE_ENV === "production" ? invariant(!options.pollInterval, 46) : invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.'); | ||
process.env.NODE_ENV === "production" ? invariant(options.query.kind === 'Document', 42) : invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.'); | ||
process.env.NODE_ENV === "production" ? invariant(!options.returnPartialData, 43) : invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.'); | ||
process.env.NODE_ENV === "production" ? invariant(!options.pollInterval, 44) : invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.'); | ||
return new Promise(function (resolve, reject) { | ||
@@ -545,3 +545,3 @@ var watchedQuery = _this.watchQuery(options, false); | ||
this.fetchQueryRejectFns.forEach(function (reject) { | ||
reject(process.env.NODE_ENV === "production" ? new InvariantError(47) : new InvariantError('Store reset while query was in flight (not completed in link chain)')); | ||
reject(process.env.NODE_ENV === "production" ? new InvariantError(45) : new InvariantError('Store reset while query was in flight (not completed in link chain)')); | ||
}); | ||
@@ -665,3 +665,3 @@ var resetIds = []; | ||
var foundObservableQuery = this.getQuery(queryIdOrObservable).observableQuery; | ||
process.env.NODE_ENV === "production" ? invariant(foundObservableQuery, 48) : invariant(foundObservableQuery, "ObservableQuery with this id doesn't exist: " + queryIdOrObservable); | ||
process.env.NODE_ENV === "production" ? invariant(foundObservableQuery, 46) : invariant(foundObservableQuery, "ObservableQuery with this id doesn't exist: " + queryIdOrObservable); | ||
observableQuery = foundObservableQuery; | ||
@@ -855,3 +855,3 @@ } | ||
var pollInterval = options.pollInterval; | ||
process.env.NODE_ENV === "production" ? invariant(pollInterval, 49) : invariant(pollInterval, 'Attempted to start a polling query without a polling interval.'); | ||
process.env.NODE_ENV === "production" ? invariant(pollInterval, 47) : invariant(pollInterval, 'Attempted to start a polling query without a polling interval.'); | ||
if (!this.ssrMode) { | ||
@@ -858,0 +858,0 @@ var info = this.pollingInfoByQueryId.get(queryId); |
{ | ||
"name": "@apollo/client", | ||
"version": "3.0.0-beta.2", | ||
"version": "3.0.0-beta.3", | ||
"description": "A fully-featured caching GraphQL client.", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -8,3 +8,3 @@ import { invariant } from 'ts-invariant'; | ||
return React.createElement(ApolloContext.Consumer, null, function (context) { | ||
process.env.NODE_ENV === "production" ? invariant(context && context.client, 5) : 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>.'); | ||
@@ -11,0 +11,0 @@ return props.children(context.client); |
@@ -13,3 +13,3 @@ import { invariant } from 'ts-invariant'; | ||
} | ||
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, 5) : invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' + | ||
'sure you pass in your client via the "client" prop.'); | ||
@@ -16,0 +16,0 @@ return (React.createElement(ApolloContext.Provider, { value: context }, children)); |
@@ -9,3 +9,3 @@ import { __assign, __spreadArrays } from 'tslib'; | ||
if (definition.kind === 'OperationDefinition') { | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(30) : new InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(20) : new InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + | ||
'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); | ||
@@ -18,3 +18,3 @@ } | ||
if (typeof actualFragmentName === 'undefined') { | ||
process.env.NODE_ENV === "production" ? invariant(fragments.length === 1, 31) : invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); | ||
process.env.NODE_ENV === "production" ? invariant(fragments.length === 1, 21) : invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); | ||
actualFragmentName = fragments[0].name.value; | ||
@@ -56,3 +56,3 @@ } | ||
var fragment = fragmentMap && fragmentMap[selection.name.value]; | ||
process.env.NODE_ENV === "production" ? invariant(fragment, 32) : invariant(fragment, "No fragment named " + selection.name.value + "."); | ||
process.env.NODE_ENV === "production" ? invariant(fragment, 22) : invariant(fragment, "No fragment named " + selection.name.value + "."); | ||
return fragment; | ||
@@ -59,0 +59,0 @@ } |
@@ -7,3 +7,3 @@ import { __spreadArrays } from 'tslib'; | ||
function checkDocument(doc) { | ||
process.env.NODE_ENV === "production" ? invariant(doc && doc.kind === 'Document', 21) : invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); | ||
process.env.NODE_ENV === "production" ? invariant(doc && doc.kind === 'Document', 24) : invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); | ||
var operations = doc.definitions | ||
@@ -13,7 +13,7 @@ .filter(function (d) { return d.kind !== 'FragmentDefinition'; }) | ||
if (definition.kind !== 'OperationDefinition') { | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(22) : new InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(25) : new InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); | ||
} | ||
return definition; | ||
}); | ||
process.env.NODE_ENV === "production" ? invariant(operations.length <= 1, 23) : invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); | ||
process.env.NODE_ENV === "production" ? invariant(operations.length <= 1, 26) : invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); | ||
return doc; | ||
@@ -37,10 +37,10 @@ } | ||
var queryDef = getOperationDefinition(doc); | ||
process.env.NODE_ENV === "production" ? invariant(queryDef && queryDef.operation === 'query', 25) : invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); | ||
process.env.NODE_ENV === "production" ? invariant(queryDef && queryDef.operation === 'query', 28) : invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); | ||
return queryDef; | ||
} | ||
function getFragmentDefinition(doc) { | ||
process.env.NODE_ENV === "production" ? invariant(doc.kind === 'Document', 26) : invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); | ||
process.env.NODE_ENV === "production" ? invariant(doc.definitions.length <= 1, 27) : invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); | ||
process.env.NODE_ENV === "production" ? invariant(doc.kind === 'Document', 29) : invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); | ||
process.env.NODE_ENV === "production" ? invariant(doc.definitions.length <= 1, 30) : invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); | ||
var fragmentDef = doc.definitions[0]; | ||
process.env.NODE_ENV === "production" ? invariant(fragmentDef.kind === 'FragmentDefinition', 28) : invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); | ||
process.env.NODE_ENV === "production" ? invariant(fragmentDef.kind === 'FragmentDefinition', 31) : invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); | ||
return fragmentDef; | ||
@@ -68,3 +68,3 @@ } | ||
} | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(29) : new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(32) : new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); | ||
} | ||
@@ -71,0 +71,0 @@ function getDefaultValues(definition) { |
@@ -70,3 +70,3 @@ import { InvariantError } from 'ts-invariant'; | ||
else { | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(37) : new InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(48) : new InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + | ||
'is not supported. Use variables instead of inline arguments to ' + | ||
@@ -73,0 +73,0 @@ 'overcome this limitation.'); |
export { MockedProvider } from './mocking/MockedProvider'; | ||
export { MockLink, mockSingleLink } from './mocking/mockLink'; | ||
export { MockLink, mockSingleLink, MockedResponse } from './mocking/mockLink'; | ||
export { MockSubscriptionLink, mockObservableLink } from './mocking/mockSubscriptionLink'; | ||
@@ -4,0 +4,0 @@ export { createMockClient } from './mocking/mockClient'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1915952