@apollo/client
Advanced tools
Comparing version 3.0.0-beta.19 to 3.0.0-beta.20
@@ -84,3 +84,3 @@ import { __awaiter, __generator, __assign } from 'tslib'; | ||
else { | ||
process.env.NODE_ENV === "production" ? invariant(false, 34) : invariant(false, 'To use context.getCacheKey, you need to use a cache that has ' + | ||
process.env.NODE_ENV === "production" ? invariant(false, 23) : invariant(false, 'To use context.getCacheKey, you need to use a cache that has ' + | ||
'a configurable dataIdFromObject, like apollo-cache-inmemory.'); | ||
@@ -194,3 +194,3 @@ } | ||
fragment = fragmentMap[selection.name.value]; | ||
process.env.NODE_ENV === "production" ? invariant(fragment, 35) : invariant(fragment, "No fragment named " + selection.name.value); | ||
process.env.NODE_ENV === "production" ? invariant(fragment, 24) : invariant(fragment, "No fragment named " + selection.name.value); | ||
} | ||
@@ -197,0 +197,0 @@ if (fragment && fragment.typeCondition) { |
@@ -49,3 +49,3 @@ import { __awaiter, __generator, __assign } from 'tslib'; | ||
this.fetchQueryRejectFns.forEach(function (reject) { | ||
reject(process.env.NODE_ENV === "production" ? new InvariantError(23) : new InvariantError('QueryManager stopped while query was in flight')); | ||
reject(process.env.NODE_ENV === "production" ? new InvariantError(27) : new InvariantError('QueryManager stopped while query was in flight')); | ||
}); | ||
@@ -61,4 +61,4 @@ }; | ||
case 0: | ||
process.env.NODE_ENV === "production" ? invariant(mutation, 24) : 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', 25) : 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, 28) : 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', 29) : 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(); | ||
@@ -458,3 +458,3 @@ mutation = this.transform(mutation).document; | ||
if (shouldSubscribe === void 0) { shouldSubscribe = true; } | ||
process.env.NODE_ENV === "production" ? invariant(options.fetchPolicy !== 'standby', 26) : invariant(options.fetchPolicy !== 'standby', 'client.watchQuery cannot be called with fetchPolicy set to "standby"'); | ||
process.env.NODE_ENV === "production" ? invariant(options.fetchPolicy !== 'standby', 30) : invariant(options.fetchPolicy !== 'standby', 'client.watchQuery cannot be called with fetchPolicy set to "standby"'); | ||
options.variables = this.getVariables(options.query, options.variables); | ||
@@ -484,7 +484,7 @@ if (typeof options.notifyOnNetworkStatusChange === 'undefined') { | ||
var _this = this; | ||
process.env.NODE_ENV === "production" ? invariant(options.query, 27) : invariant(options.query, 'query option is required. You must specify your GraphQL document ' + | ||
process.env.NODE_ENV === "production" ? invariant(options.query, 31) : 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', 28) : invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.'); | ||
process.env.NODE_ENV === "production" ? invariant(!options.returnPartialData, 29) : invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.'); | ||
process.env.NODE_ENV === "production" ? invariant(!options.pollInterval, 30) : invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.'); | ||
process.env.NODE_ENV === "production" ? invariant(options.query.kind === 'Document', 32) : invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.'); | ||
process.env.NODE_ENV === "production" ? invariant(!options.returnPartialData, 33) : invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.'); | ||
process.env.NODE_ENV === "production" ? invariant(!options.pollInterval, 34) : invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.'); | ||
return new Promise(function (resolve, reject) { | ||
@@ -557,3 +557,3 @@ var watchedQuery = _this.watchQuery(options, false); | ||
this.fetchQueryRejectFns.forEach(function (reject) { | ||
reject(process.env.NODE_ENV === "production" ? new InvariantError(31) : new InvariantError('Store reset while query was in flight (not completed in link chain)')); | ||
reject(process.env.NODE_ENV === "production" ? new InvariantError(35) : new InvariantError('Store reset while query was in flight (not completed in link chain)')); | ||
}); | ||
@@ -677,3 +677,3 @@ var resetIds = []; | ||
var foundObservableQuery = this.getQuery(queryIdOrObservable).observableQuery; | ||
process.env.NODE_ENV === "production" ? invariant(foundObservableQuery, 32) : invariant(foundObservableQuery, "ObservableQuery with this id doesn't exist: " + queryIdOrObservable); | ||
process.env.NODE_ENV === "production" ? invariant(foundObservableQuery, 36) : invariant(foundObservableQuery, "ObservableQuery with this id doesn't exist: " + queryIdOrObservable); | ||
observableQuery = foundObservableQuery; | ||
@@ -867,3 +867,3 @@ } | ||
var pollInterval = options.pollInterval; | ||
process.env.NODE_ENV === "production" ? invariant(pollInterval, 33) : invariant(pollInterval, 'Attempted to start a polling query without a polling interval.'); | ||
process.env.NODE_ENV === "production" ? invariant(pollInterval, 37) : invariant(pollInterval, 'Attempted to start a polling query without a polling interval.'); | ||
if (!this.ssrMode) { | ||
@@ -870,0 +870,0 @@ var info = this.pollingInfoByQueryId.get(queryId); |
@@ -20,3 +20,3 @@ import { invariant } from 'ts-invariant'; | ||
previousQuery.document === query.document || | ||
equal(previousQuery.document, query.document), 41) : invariant(!previousQuery || | ||
equal(previousQuery.document, query.document), 50) : invariant(!previousQuery || | ||
previousQuery.document === query.document || | ||
@@ -23,0 +23,0 @@ equal(previousQuery.document, query.document), 'Internal Error: may not update existing query string in store'); |
@@ -88,3 +88,3 @@ import { __extends } from 'tslib'; | ||
ApolloLink.prototype.request = function (operation, forward) { | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(20) : new InvariantError('request is not implemented'); | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(12) : new InvariantError('request is not implemented'); | ||
}; | ||
@@ -91,0 +91,0 @@ ApolloLink.prototype.onError = function (reason) { |
@@ -8,3 +8,3 @@ import { InvariantError } from 'ts-invariant'; | ||
library = 'node-fetch'; | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(22) : new InvariantError('"fetch" has not been found globally and no fetcher has been ' + | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(14) : new InvariantError('"fetch" has not been found globally and no fetcher has been ' + | ||
'configured. To fix this, install a fetch package ' + | ||
@@ -11,0 +11,0 @@ ("(like https://www.npmjs.com/package/" + library + "), instantiate the ") + |
@@ -9,3 +9,3 @@ import { InvariantError } from 'ts-invariant'; | ||
catch (e) { | ||
var parseError = process.env.NODE_ENV === "production" ? new InvariantError(21) : new InvariantError("Network request failed. " + label + " is not serializable: " + e.message); | ||
var parseError = process.env.NODE_ENV === "production" ? new InvariantError(13) : new InvariantError("Network request failed. " + label + " is not serializable: " + e.message); | ||
parseError.parseError = e; | ||
@@ -12,0 +12,0 @@ throw parseError; |
@@ -14,3 +14,3 @@ import { InvariantError } from 'ts-invariant'; | ||
if (OPERATION_FIELDS.indexOf(key) < 0) { | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(37) : new InvariantError("illegal argument: " + key); | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(25) : new InvariantError("illegal argument: " + key); | ||
} | ||
@@ -17,0 +17,0 @@ } |
{ | ||
"name": "@apollo/client", | ||
"version": "3.0.0-beta.19", | ||
"version": "3.0.0-beta.20", | ||
"description": "A fully-featured caching GraphQL client.", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -36,4 +36,6 @@ import { __extends, __assign } from 'tslib'; | ||
this.verifyDocumentType(this.getOptions().mutation, DocumentType.Mutation); | ||
result.client = this.refreshClient().client; | ||
return [this.runMutation, result]; | ||
return [ | ||
this.runMutation, | ||
__assign(__assign({}, result), { client: this.refreshClient().client }) | ||
]; | ||
}; | ||
@@ -40,0 +42,0 @@ MutationData.prototype.afterExecute = function () { |
@@ -30,3 +30,3 @@ import { invariant } from 'ts-invariant'; | ||
(this.context && this.context.client); | ||
process.env.NODE_ENV === "production" ? invariant(!!client, 49) : invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' + | ||
process.env.NODE_ENV === "production" ? invariant(!!client, 48) : invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' + | ||
'Wrap the root component in an <ApolloProvider>, or pass an ' + | ||
@@ -49,3 +49,3 @@ 'ApolloClient instance in via options.'); | ||
var usedOperationName = operationName(operation.type); | ||
process.env.NODE_ENV === "production" ? invariant(operation.type === type, 50) : invariant(operation.type === type, "Running a " + requiredOperationName + " requires a graphql " + | ||
process.env.NODE_ENV === "production" ? invariant(operation.type === type, 49) : invariant(operation.type === type, "Running a " + requiredOperationName + " requires a graphql " + | ||
(requiredOperationName + ", but a " + usedOperationName + " was used instead.")); | ||
@@ -52,0 +52,0 @@ }; |
@@ -11,3 +11,3 @@ import { invariant } from 'ts-invariant'; | ||
evaledValue = variables[ifArgument.value.name.value]; | ||
process.env.NODE_ENV === "production" ? invariant(evaledValue !== void 0, 42) : invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); | ||
process.env.NODE_ENV === "production" ? invariant(evaledValue !== void 0, 41) : invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); | ||
} | ||
@@ -45,8 +45,8 @@ else { | ||
var directiveName = directive.name.value; | ||
process.env.NODE_ENV === "production" ? invariant(directiveArguments && directiveArguments.length === 1, 43) : invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); | ||
process.env.NODE_ENV === "production" ? invariant(directiveArguments && directiveArguments.length === 1, 42) : invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); | ||
var ifArgument = directiveArguments[0]; | ||
process.env.NODE_ENV === "production" ? invariant(ifArgument.name && ifArgument.name.value === 'if', 44) : invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); | ||
process.env.NODE_ENV === "production" ? invariant(ifArgument.name && ifArgument.name.value === 'if', 43) : invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); | ||
var ifValue = ifArgument.value; | ||
process.env.NODE_ENV === "production" ? invariant(ifValue && | ||
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 45) : invariant(ifValue && | ||
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 44) : invariant(ifValue && | ||
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); | ||
@@ -53,0 +53,0 @@ return { directive: directive, ifArgument: ifArgument }; |
@@ -9,3 +9,3 @@ import { __assign, __spreadArrays } from 'tslib'; | ||
if (definition.kind === 'OperationDefinition') { | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(46) : new InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(45) : 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, 47) : 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, 46) : 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, 48) : invariant(fragment, "No fragment named " + selection.name.value + "."); | ||
process.env.NODE_ENV === "production" ? invariant(fragment, 47) : 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', 12) : 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', 15) : 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(13) : new InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(16) : new InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); | ||
} | ||
return definition; | ||
}); | ||
process.env.NODE_ENV === "production" ? invariant(operations.length <= 1, 14) : invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); | ||
process.env.NODE_ENV === "production" ? invariant(operations.length <= 1, 17) : 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', 15) : invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); | ||
process.env.NODE_ENV === "production" ? invariant(queryDef && queryDef.operation === 'query', 18) : invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); | ||
return queryDef; | ||
} | ||
function getFragmentDefinition(doc) { | ||
process.env.NODE_ENV === "production" ? invariant(doc.kind === 'Document', 16) : 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, 17) : invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); | ||
process.env.NODE_ENV === "production" ? invariant(doc.kind === 'Document', 19) : 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, 20) : 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', 18) : invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); | ||
process.env.NODE_ENV === "production" ? invariant(fragmentDef.kind === 'FragmentDefinition', 21) : invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); | ||
return fragmentDef; | ||
@@ -68,3 +68,3 @@ } | ||
} | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(19) : new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(22) : 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(36) : new InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(26) : 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.'); |
@@ -19,3 +19,3 @@ 'use strict'; | ||
evaledValue = variables[ifArgument.value.name.value]; | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(evaledValue !== void 0, 42) : tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(evaledValue !== void 0, 41) : tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); | ||
} | ||
@@ -53,8 +53,8 @@ else { | ||
var directiveName = directive.name.value; | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 43) : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 42) : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); | ||
var ifArgument = directiveArguments[0]; | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', 44) : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', 43) : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); | ||
var ifValue = ifArgument.value; | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(ifValue && | ||
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 45) : tsInvariant.invariant(ifValue && | ||
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 44) : tsInvariant.invariant(ifValue && | ||
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); | ||
@@ -70,3 +70,3 @@ return { directive: directive, ifArgument: ifArgument }; | ||
if (definition.kind === 'OperationDefinition') { | ||
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(46) : new tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + | ||
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(45) : new tsInvariant.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.'); | ||
@@ -79,3 +79,3 @@ } | ||
if (typeof actualFragmentName === 'undefined') { | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(fragments.length === 1, 47) : tsInvariant.invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(fragments.length === 1, 46) : tsInvariant.invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); | ||
actualFragmentName = fragments[0].name.value; | ||
@@ -117,3 +117,3 @@ } | ||
var fragment = fragmentMap && fragmentMap[selection.name.value]; | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(fragment, 48) : tsInvariant.invariant(fragment, "No fragment named " + selection.name.value + "."); | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(fragment, 47) : tsInvariant.invariant(fragment, "No fragment named " + selection.name.value + "."); | ||
return fragment; | ||
@@ -207,3 +207,3 @@ } | ||
else { | ||
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(36) : new tsInvariant.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + | ||
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(26) : new tsInvariant.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + | ||
'is not supported. Use variables instead of inline arguments to ' + | ||
@@ -326,3 +326,3 @@ 'overcome this limitation.'); | ||
function checkDocument(doc) { | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(doc && doc.kind === 'Document', 12) : tsInvariant.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" ? tsInvariant.invariant(doc && doc.kind === 'Document', 15) : tsInvariant.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 | ||
@@ -332,7 +332,7 @@ .filter(function (d) { return d.kind !== 'FragmentDefinition'; }) | ||
if (definition.kind !== 'OperationDefinition') { | ||
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(13) : new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); | ||
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(16) : new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); | ||
} | ||
return definition; | ||
}); | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(operations.length <= 1, 14) : tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(operations.length <= 1, 17) : tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); | ||
return doc; | ||
@@ -356,10 +356,10 @@ } | ||
var queryDef = getOperationDefinition(doc); | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 15) : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 18) : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); | ||
return queryDef; | ||
} | ||
function getFragmentDefinition(doc) { | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(doc.kind === 'Document', 16) : tsInvariant.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" ? tsInvariant.invariant(doc.definitions.length <= 1, 17) : tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(doc.kind === 'Document', 19) : tsInvariant.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" ? tsInvariant.invariant(doc.definitions.length <= 1, 20) : tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); | ||
var fragmentDef = doc.definitions[0]; | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 18) : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); | ||
process.env.NODE_ENV === "production" ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 21) : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); | ||
return fragmentDef; | ||
@@ -387,3 +387,3 @@ } | ||
} | ||
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(19) : new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); | ||
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(22) : new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); | ||
} | ||
@@ -390,0 +390,0 @@ function getDefaultValues(definition) { |
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 not supported yet
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 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
2044275
19680