@apollo/client
Advanced tools
Comparing version 3.0.0-beta.25 to 3.0.0-beta.26
@@ -285,3 +285,3 @@ import { __assign, __extends } from 'tslib'; | ||
} | ||
process.env.NODE_ENV === "production" ? invariant(!isReference(existing) || isReference(incoming), 54) : invariant(!isReference(existing) || isReference(incoming), "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."); | ||
process.env.NODE_ENV === "production" ? invariant(!isReference(existing) || isReference(incoming), 55) : invariant(!isReference(existing) || isReference(incoming), "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."); | ||
if (equal(existing, incoming)) { | ||
@@ -288,0 +288,0 @@ return existing; |
@@ -0,3 +1,4 @@ | ||
import { InvariantError } from 'ts-invariant'; | ||
import { Cache } from '../core/types/Cache'; | ||
import { DiffQueryAgainstStoreOptions, ReadQueryOptions, StoreObject } from './types'; | ||
import { DiffQueryAgainstStoreOptions, ReadQueryOptions } from './types'; | ||
import { Policies } from './policies'; | ||
@@ -7,9 +8,5 @@ export declare type VariableMap = { | ||
}; | ||
export declare type ExecResultMissingField = { | ||
object: StoreObject; | ||
fieldName: string; | ||
}; | ||
export declare type ExecResult<R = any> = { | ||
result: R; | ||
missing?: ExecResultMissingField[]; | ||
missing?: InvariantError[]; | ||
}; | ||
@@ -16,0 +13,0 @@ export interface StoreReaderConfig { |
@@ -63,5 +63,3 @@ import { __assign } from 'tslib'; | ||
if (hasMissingFields && !returnPartialData) { | ||
execResult.missing.forEach(function (info) { | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(51) : new InvariantError("Can't find field " + info.fieldName + " on object " + JSON.stringify(info.object, null, 2) + "."); | ||
}); | ||
throw execResult.missing[0]; | ||
} | ||
@@ -76,2 +74,10 @@ return { | ||
var selectionSet = _a.selectionSet, objectOrReference = _a.objectOrReference, context = _a.context; | ||
if (isReference(objectOrReference) && | ||
!context.policies.rootTypenamesById[objectOrReference.__ref] && | ||
!context.store.has(objectOrReference.__ref)) { | ||
return { | ||
result: {}, | ||
missing: [process.env.NODE_ENV === "production" ? new InvariantError(51) : new InvariantError("Dangling reference to missing " + objectOrReference.__ref + " object")], | ||
}; | ||
} | ||
var fragmentMap = context.fragmentMap, variables = context.variables, policies = context.policies, getFieldValue = context.getFieldValue; | ||
@@ -103,6 +109,5 @@ var objectsToMerge = []; | ||
if (!addTypenameToDocument.added(selection)) { | ||
getMissing().push({ | ||
object: objectOrReference, | ||
fieldName: selection.name.value, | ||
}); | ||
getMissing().push(process.env.NODE_ENV === "production" ? new InvariantError(52) : new InvariantError("Can't find field " + selection.name.value + " on " + (isReference(objectOrReference) | ||
? objectOrReference.__ref + " object" | ||
: "object " + JSON.stringify(objectOrReference, null, 2)))); | ||
} | ||
@@ -142,3 +147,3 @@ } | ||
else { | ||
process.env.NODE_ENV === "production" ? invariant(fragment = fragmentMap[selection.name.value], 52) : invariant(fragment = fragmentMap[selection.name.value], "No fragment named " + selection.name.value); | ||
process.env.NODE_ENV === "production" ? invariant(fragment = fragmentMap[selection.name.value], 53) : invariant(fragment = fragmentMap[selection.name.value], "No fragment named " + selection.name.value); | ||
} | ||
@@ -206,3 +211,3 @@ if (policies.fragmentMatches(fragment, typename)) { | ||
if (value && typeof value === "object") { | ||
process.env.NODE_ENV === "production" ? invariant(!isReference(value), 53) : invariant(!isReference(value), "Missing selection set for object of type " + getTypenameFromStoreObject(store, value) + " returned for query field " + field.name.value); | ||
process.env.NODE_ENV === "production" ? invariant(!isReference(value), 54) : invariant(!isReference(value), "Missing selection set for object of type " + getTypenameFromStoreObject(store, value) + " returned for query field " + field.name.value); | ||
Object.values(value).forEach(workSet_1.add, workSet_1); | ||
@@ -209,0 +214,0 @@ } |
@@ -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), 45) : 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'); |
{ | ||
"name": "@apollo/client", | ||
"version": "3.0.0-beta.25", | ||
"version": "3.0.0-beta.26", | ||
"description": "A fully-featured caching GraphQL client.", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -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 }; |
@@ -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."); | ||
@@ -61,0 +61,0 @@ return { directive: directive, ifArgument: ifArgument }; |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
2046250
19655
230
143