@apollo/client
Advanced tools
Comparing version 3.0.0-alpha.5 to 3.0.0-alpha.6
@@ -83,3 +83,3 @@ import { __assign } from 'tslib'; | ||
return; | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(22) : new InvariantError("Can't find field " + info.fieldName + " on object " + JSON.stringify(info.object, null, 2) + "."); | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(27) : new InvariantError("Can't find field " + info.fieldName + " on object " + JSON.stringify(info.object, null, 2) + "."); | ||
}); | ||
@@ -167,3 +167,3 @@ } | ||
if (!fragment) { | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(23) : new InvariantError("No fragment named " + selection.name.value); | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(28) : new InvariantError("No fragment named " + selection.name.value); | ||
} | ||
@@ -287,3 +287,3 @@ } | ||
if (isReference(nestedValue)) { | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(24) : new InvariantError("Missing selection set for object of type " + getTypenameFromStoreObject(store, nestedValue) + " returned for query field " + field.name.value); | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(29) : new InvariantError("Missing selection set for object of type " + getTypenameFromStoreObject(store, nestedValue) + " returned for query field " + field.name.value); | ||
} | ||
@@ -290,0 +290,0 @@ return nestedValue; |
@@ -149,3 +149,3 @@ import { __assign } from 'tslib'; | ||
else if (isReference(existing)) { | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(25) : new InvariantError("Store error: the application attempted to write an object with no provided id but the store already contains an id of " + existing.__ref + " for this object."); | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(26) : new InvariantError("Store error: the application attempted to write an object with no provided id but the store already contains an id of " + existing.__ref + " for this object."); | ||
} | ||
@@ -152,0 +152,0 @@ if (Array.isArray(incoming)) { |
@@ -32,3 +32,3 @@ import { invariant } from 'ts-invariant'; | ||
previousQuery.document === query.document || | ||
equal(previousQuery.document, query.document), 26) : invariant(!previousQuery || | ||
equal(previousQuery.document, query.document), 30) : invariant(!previousQuery || | ||
previousQuery.document === query.document || | ||
@@ -35,0 +35,0 @@ equal(previousQuery.document, query.document), 'Internal Error: may not update existing query string in store'); |
@@ -17,2 +17,3 @@ export { NetworkStatus } from './core/networkStatus.js'; | ||
export { ApolloConsumer } from './react/context/ApolloConsumer.js'; | ||
export { DocumentType, operationName, parser } from './react/parser/parser.js'; | ||
export { useQuery } from './react/hooks/useQuery.js'; | ||
@@ -19,0 +20,0 @@ export { useLazyQuery } from './react/hooks/useLazyQuery.js'; |
{ | ||
"name": "@apollo/client", | ||
"version": "3.0.0-alpha.5", | ||
"version": "3.0.0-alpha.6", | ||
"description": "A fully-featured caching GraphQL client.", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -29,3 +29,3 @@ import { invariant } from 'ts-invariant'; | ||
(this.context && this.context.client); | ||
process.env.NODE_ENV === "production" ? invariant(!!client, 46) : invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' + | ||
process.env.NODE_ENV === "production" ? invariant(!!client, 50) : 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 ' + | ||
@@ -48,3 +48,3 @@ 'ApolloClient instance in via options.'); | ||
var usedOperationName = operationName(operation.type); | ||
process.env.NODE_ENV === "production" ? invariant(operation.type === type, 47) : invariant(operation.type === type, "Running a " + requiredOperationName + " requires a graphql " + | ||
process.env.NODE_ENV === "production" ? invariant(operation.type === type, 51) : invariant(operation.type === type, "Running a " + requiredOperationName + " requires a graphql " + | ||
(requiredOperationName + ", but a " + usedOperationName + " was used instead.")); | ||
@@ -51,0 +51,0 @@ }; |
export { ApolloProvider } from './context/ApolloProvider'; | ||
export { ApolloConsumer } from './context/ApolloConsumer'; | ||
export { getApolloContext, resetApolloContext } from './context/ApolloContext'; | ||
export { getApolloContext, resetApolloContext, ApolloContextValue } from './context/ApolloContext'; | ||
export { useQuery } from './hooks/useQuery'; | ||
@@ -10,3 +10,4 @@ export { useLazyQuery } from './hooks/useLazyQuery'; | ||
export { RenderPromises } from './ssr/RenderPromises'; | ||
export { QueryHookOptions, QueryResult, LazyQueryHookOptions, QueryTuple, MutationHookOptions, MutationTuple, SubscriptionHookOptions, } from './types/types'; | ||
export * from './types/types'; | ||
export * from './parser/parser'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -10,2 +10,3 @@ export { ApolloProvider } from './context/ApolloProvider'; | ||
export { RenderPromises } from './ssr/RenderPromises'; | ||
export * from './parser/parser'; | ||
//# sourceMappingURL=index.js.map |
@@ -30,3 +30,3 @@ import { invariant } from 'ts-invariant'; | ||
var variables, type, name; | ||
process.env.NODE_ENV === "production" ? invariant(!!document && !!document.kind, 48) : invariant(!!document && !!document.kind, "Argument of " + document + " passed to parser was not a valid GraphQL " + | ||
process.env.NODE_ENV === "production" ? invariant(!!document && !!document.kind, 22) : 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 " + | ||
@@ -45,6 +45,6 @@ "to convert your operation into a document"); | ||
process.env.NODE_ENV === "production" ? invariant(!fragments.length || | ||
(queries.length || mutations.length || subscriptions.length), 49) : invariant(!fragments.length || | ||
(queries.length || mutations.length || subscriptions.length), 23) : 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, 50) : 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, 24) : 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 + " ") + | ||
@@ -61,3 +61,3 @@ ("subscriptions and " + mutations.length + " mutations. ") + | ||
: subscriptions; | ||
process.env.NODE_ENV === "production" ? invariant(definitions.length === 1, 51) : invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. " + document + " had " + | ||
process.env.NODE_ENV === "production" ? invariant(definitions.length === 1, 25) : invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. " + document + " had " + | ||
(definitions.length + " definitions. ") + | ||
@@ -64,0 +64,0 @@ "You can use 'compose' to join multiple operation types to a component"); |
@@ -22,3 +22,3 @@ import { invariant } from 'ts-invariant'; | ||
evaledValue = variables[ifArgument.value.name.value]; | ||
process.env.NODE_ENV === "production" ? invariant(evaledValue !== void 0, 27) : invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); | ||
process.env.NODE_ENV === "production" ? invariant(evaledValue !== void 0, 31) : invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); | ||
} | ||
@@ -56,8 +56,8 @@ else { | ||
var directiveName = directive.name.value; | ||
process.env.NODE_ENV === "production" ? invariant(directiveArguments && directiveArguments.length === 1, 28) : invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); | ||
process.env.NODE_ENV === "production" ? invariant(directiveArguments && directiveArguments.length === 1, 32) : 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', 29) : 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', 33) : 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'), 30) : invariant(ifValue && | ||
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 34) : invariant(ifValue && | ||
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); | ||
@@ -64,0 +64,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(31) : new InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(35) : 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, 32) : 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, 36) : 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, 33) : invariant(fragment, "No fragment named " + selection.name.value + "."); | ||
process.env.NODE_ENV === "production" ? invariant(fragment, 37) : 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', 35) : 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', 39) : 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(36) : new InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(40) : new InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); | ||
} | ||
return definition; | ||
}); | ||
process.env.NODE_ENV === "production" ? invariant(operations.length <= 1, 37) : invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); | ||
process.env.NODE_ENV === "production" ? invariant(operations.length <= 1, 41) : 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', 39) : invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); | ||
process.env.NODE_ENV === "production" ? invariant(queryDef && queryDef.operation === 'query', 43) : invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); | ||
return queryDef; | ||
} | ||
function getFragmentDefinition(doc) { | ||
process.env.NODE_ENV === "production" ? invariant(doc.kind === 'Document', 40) : 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, 41) : invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); | ||
process.env.NODE_ENV === "production" ? invariant(doc.kind === 'Document', 44) : 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, 45) : 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', 42) : invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); | ||
process.env.NODE_ENV === "production" ? invariant(fragmentDef.kind === 'FragmentDefinition', 46) : invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); | ||
return fragmentDef; | ||
@@ -68,3 +68,3 @@ } | ||
} | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(43) : new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(47) : new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); | ||
} | ||
@@ -71,0 +71,0 @@ function getDefaultValues(definition) { |
@@ -14,4 +14,3 @@ export * from './directives'; | ||
export * from './util/mergeDeep'; | ||
export * from './util/warnOnce'; | ||
export * from './util/stripSymbols'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -14,4 +14,3 @@ export * from './directives'; | ||
export * from './util/mergeDeep'; | ||
export * from './util/warnOnce'; | ||
export * from './util/stripSymbols'; | ||
//# sourceMappingURL=index.js.map |
@@ -65,3 +65,3 @@ import 'tslib'; | ||
else { | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(44) : 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 ' + | ||
@@ -68,0 +68,0 @@ 'overcome this limitation.'); |
export declare function getEnv(): string | undefined; | ||
export declare function isEnv(env: string): boolean; | ||
export declare function isProduction(): boolean; | ||
export declare function isDevelopment(): boolean; | ||
export declare function isTest(): boolean; | ||
//# sourceMappingURL=environment.d.ts.map |
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 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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1705285
16416
0
320
181