You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@apollo/client

Package Overview
Dependencies
Maintainers
1
Versions
559
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0-james.32.1 to 3.0.0-james.33.0

8

cache/inmemory/policies.d.ts

@@ -26,7 +26,9 @@ import { InlineFragmentNode, FragmentDefinitionNode, SelectionSetNode, FieldNode } from "graphql";

};
declare type KeyArgsFunction = (field: FieldNode, context: {
declare type KeyArgsFunction = (args: Record<string, any>, context: {
typename: string;
fieldName: string;
field: FieldNode;
variables: Record<string, any>;
policies: Policies;
}) => ReturnType<IdGetter>;
}) => KeySpecifier | ReturnType<IdGetter>;
export declare type FieldPolicy<TExisting = any, TIncoming = TExisting, TReadResult = TExisting> = {

@@ -51,3 +53,3 @@ keyArgs?: KeySpecifier | KeyArgsFunction | false;

}
export declare type FieldReadFunction<TExisting = any, TReadResult = TExisting> = (existing: SafeReadonly<TExisting> | undefined, options: FieldFunctionOptions) => TReadResult;
export declare type FieldReadFunction<TExisting = any, TReadResult = TExisting> = (existing: SafeReadonly<TExisting> | undefined, options: FieldFunctionOptions) => TReadResult | undefined;
export declare type FieldMergeFunction<TExisting = any, TIncoming = TExisting> = (existing: SafeReadonly<TExisting> | undefined, incoming: SafeReadonly<TIncoming>, options: FieldFunctionOptions) => TExisting;

@@ -54,0 +56,0 @@ export declare function defaultDataIdFromObject(object: StoreObject): string;

import { __assign } from 'tslib';
import { invariant, InvariantError } from 'ts-invariant';
import { getFragmentFromSelection } from '../../utilities/graphql/fragments.js';
import { makeReference, getTypenameFromResult, valueToObjectRepresentation, storeKeyNameFromField, isReference, argumentsObjectFromField, isField } from '../../utilities/graphql/storeUtils.js';
import { makeReference, getTypenameFromResult, argumentsObjectFromField, storeKeyNameFromField, isReference, isField } from '../../utilities/graphql/storeUtils.js';
import { canUseWeakMap } from '../../utilities/common/canUse.js';

@@ -21,3 +21,3 @@ import { KeyTrie } from 'optimism';

var nullKeyFieldsFn = function () { return null; };
var simpleKeyArgsFn = function (field) { return field.name.value; };
var simpleKeyArgsFn = function (_args, context) { return context.fieldName; };
var Policies = (function () {

@@ -179,12 +179,17 @@ function Policies(config) {

var fieldName = field.name.value;
var policy = this.getFieldPolicy(typename, fieldName, false);
var storeFieldName;
if (typeof typename === "string") {
var policy = this.getFieldPolicy(typename, fieldName, false);
var keyFn = policy && policy.keyFn;
if (keyFn) {
storeFieldName = keyFn(field, {
typename: typename,
variables: variables,
policies: this,
}) || fieldName;
var keyFn = policy && policy.keyFn;
if (keyFn) {
var args = argumentsObjectFromField(field, variables);
var context = { typename: typename, fieldName: fieldName, field: field, variables: variables, policies: this };
while (keyFn) {
var specifierOrString = keyFn(args, context);
if (Array.isArray(specifierOrString)) {
keyFn = keyArgsFnFromSpecifier(specifierOrString);
}
else {
storeFieldName = specifierOrString || fieldName;
break;
}
}

@@ -296,20 +301,6 @@ }

function keyArgsFnFromSpecifier(specifier) {
var topLevelArgNames = Object.create(null);
specifier.forEach(function (name) {
if (typeof name === "string") {
topLevelArgNames[name] = true;
}
});
return function (field, context) {
return function (args, context) {
var field = context.field;
var fieldName = field.name.value;
if (field.arguments && field.arguments.length > 0) {
var args_1 = Object.create(null);
field.arguments.forEach(function (arg) {
if (topLevelArgNames[arg.name.value] === true) {
valueToObjectRepresentation(args_1, arg.name, arg.value, context.variables);
}
});
return fieldName + ":" + JSON.stringify(computeKeyObject(args_1, specifier));
}
return fieldName;
return fieldName + ":" + JSON.stringify(computeKeyObject(args, specifier));
};

@@ -316,0 +307,0 @@ }

@@ -20,3 +20,3 @@ import { invariant } from 'ts-invariant';

previousQuery.document === query.document ||
equal(previousQuery.document, query.document), 42) : invariant(!previousQuery ||
equal(previousQuery.document, query.document), 46) : 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(5) : new InvariantError('request is not implemented');
throw process.env.NODE_ENV === "production" ? new InvariantError(14) : 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(7) : new InvariantError('"fetch" has not been found globally and no fetcher has been ' +
throw process.env.NODE_ENV === "production" ? new InvariantError(12) : 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(6) : 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;

{
"name": "@apollo/client",
"version": "3.0.0-james.32.1",
"version": "3.0.0-james.33.0",
"description": "A fully-featured caching GraphQL client.",

@@ -5,0 +5,0 @@ "private": false,

@@ -9,3 +9,3 @@ import { invariant } from 'ts-invariant';

return React.createElement(ApolloContext.Consumer, null, function (context) {
process.env.NODE_ENV === "production" ? invariant(context && context.client, 8) : 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>.');

@@ -12,0 +12,0 @@ return props.children(context.client);

@@ -14,3 +14,3 @@ import { invariant } from 'ts-invariant';

}
process.env.NODE_ENV === "production" ? invariant(context.client, 9) : 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.');

@@ -17,0 +17,0 @@ return (React.createElement(ApolloContext.Provider, { value: context }, children));

@@ -8,3 +8,3 @@ import { invariant } from 'ts-invariant';

var client = React.useContext(getApolloContext()).client;
process.env.NODE_ENV === "production" ? invariant(client, 10) : invariant(client, 'No Apollo Client instance can be found. Please ensure that you ' +
process.env.NODE_ENV === "production" ? invariant(client, 7) : invariant(client, 'No Apollo Client instance can be found. Please ensure that you ' +
'have called `ApolloProvider` higher up in your tree.');

@@ -11,0 +11,0 @@ return client;

@@ -30,3 +30,3 @@ import { invariant } from 'ts-invariant';

var variables, type, name;
process.env.NODE_ENV === "production" ? invariant(!!document && !!document.kind, 11) : invariant(!!document && !!document.kind, "Argument of " + document + " passed to parser was not a valid GraphQL " +
process.env.NODE_ENV === "production" ? invariant(!!document && !!document.kind, 8) : 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), 12) : invariant(!fragments.length ||
(queries.length || mutations.length || subscriptions.length), 9) : 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, 13) : 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, 10) : 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, 14) : invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. " + document + " had " +
process.env.NODE_ENV === "production" ? invariant(definitions.length === 1, 11) : 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");

@@ -11,3 +11,3 @@ import { invariant } from 'ts-invariant';

evaledValue = variables[ifArgument.value.name.value];
process.env.NODE_ENV === "production" ? invariant(evaledValue !== void 0, 43) : invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.");
process.env.NODE_ENV === "production" ? invariant(evaledValue !== void 0, 42) : 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, 44) : invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.");
process.env.NODE_ENV === "production" ? invariant(directiveArguments && directiveArguments.length === 1, 43) : 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', 45) : 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', 44) : 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'), 46) : invariant(ifValue &&
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 45) : 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, 43) : tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.");
process.env.NODE_ENV === "production" ? tsInvariant.invariant(evaledValue !== void 0, 42) : 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, 44) : 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, 43) : 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', 45) : 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', 44) : 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'), 46) : tsInvariant.invariant(ifValue &&
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 45) : 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 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 too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc