Socket
Socket
Sign inDemoInstall

@apollo/client

Package Overview
Dependencies
Maintainers
1
Versions
575
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apollo/client - npm Package Compare versions

Comparing version 3.0.0-beta.48 to 3.0.0-beta.49

5

cache/core/cache.d.ts

@@ -5,3 +5,2 @@ import { DocumentNode } from 'graphql';

import { Cache } from './types/Cache';
import { Modifier, Modifiers } from './types/common';
export declare type Transaction<T> = (c: ApolloCache<T>) => void;

@@ -14,3 +13,4 @@ export declare abstract class ApolloCache<TSerialized> implements DataProxy {

abstract reset(): Promise<void>;
abstract evict(dataId: string, fieldName?: string): boolean;
abstract evict(options: Cache.EvictOptions): boolean;
abstract evict(id: string, field?: string, args?: Record<string, any>): boolean;
abstract restore(serializedState: TSerialized): ApolloCache<TSerialized>;

@@ -23,3 +23,2 @@ abstract extract(optimistic?: boolean): TSerialized;

identify(object: StoreObject): string | undefined;
modify(modifiers: Modifier<any> | Modifiers, dataId?: string, optimistic?: boolean): boolean;
gc(): string[];

@@ -26,0 +25,0 @@ transformForLink(document: DocumentNode): DocumentNode;

@@ -14,5 +14,2 @@ import { getFragmentQueryDocument } from '../../utilities/graphql/fragments.js';

};
ApolloCache.prototype.modify = function (modifiers, dataId, optimistic) {
return false;
};
ApolloCache.prototype.gc = function () {

@@ -48,2 +45,3 @@ return [];

variables: options.variables,
broadcast: options.broadcast,
});

@@ -57,2 +55,3 @@ };

query: this.getFragmentDoc(options.fragment, options.fragmentName),
broadcast: options.broadcast,
});

@@ -59,0 +58,0 @@ };

9

cache/core/types/Cache.d.ts
import { DataProxy } from './DataProxy';
export declare namespace Cache {
type WatchCallback = (newData: any) => void;
type WatchCallback = (diff: Cache.DiffResult<any>) => void;
interface ReadOptions<TVariables = any> extends DataProxy.Query<TVariables> {

@@ -12,2 +12,3 @@ rootId?: string;

result: TResult;
broadcast?: boolean;
}

@@ -21,2 +22,8 @@ interface DiffOptions extends ReadOptions {

}
interface EvictOptions {
id: string;
fieldName?: string;
args?: Record<string, any>;
broadcast?: boolean;
}
export import DiffResult = DataProxy.DiffResult;

@@ -23,0 +30,0 @@ export import WriteQueryOptions = DataProxy.WriteQueryOptions;

import { DocumentNode } from 'graphql';
import { isReference, StoreValue, StoreObject, Reference } from '../../../utilities/graphql/storeUtils';
import { ToReferenceFunction } from '../../inmemory/entityStore';
export declare type SafeReadonly<T> = T extends object ? Readonly<T> : T;
export declare type Modifier<T> = (value: T, details: {
DELETE: any;
fieldName: string;
storeFieldName: string;
isReference: typeof isReference;
toReference: ToReferenceFunction;
readField<V = StoreValue>(fieldName: string, objOrRef?: StoreObject | Reference): SafeReadonly<V>;
}) => T;
export declare type Modifiers = {
[fieldName: string]: Modifier<any>;
};
export declare class MissingFieldError {

@@ -17,0 +4,0 @@ readonly message: string;

@@ -17,5 +17,7 @@ import { DocumentNode } from 'graphql';

data: TData;
broadcast?: boolean;
}
interface WriteFragmentOptions<TData, TVariables> extends Fragment<TVariables> {
data: TData;
broadcast?: boolean;
}

@@ -22,0 +24,0 @@ type DiffResult<T> = {

@@ -7,2 +7,3 @@ export { ApolloCache } from './core/cache';

export { defaultDataIdFromObject, } from './inmemory/policies';
export * from './inmemory/types';
//# sourceMappingURL=index.js.map

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

import { Policies } from './policies';
import { Modifier, Modifiers, SafeReadonly } from '../core/types/common';
import { SafeReadonly } from '../core/types/common';
import { Cache } from '../core/types/Cache';
export declare abstract class EntityStore implements NormalizedCache {

@@ -18,6 +19,5 @@ readonly policies: Policies;

protected lookup(dataId: string, dependOnExistence?: boolean): StoreObject | undefined;
merge(dataId: string, incoming: StoreObject): void;
modify(dataId: string, modifiers: Modifier<any> | Modifiers): boolean;
merge(dataId: string, incoming: StoreObject): StoreObject;
delete(dataId: string, fieldName?: string, args?: Record<string, any>): boolean;
evict(dataId: string, fieldName?: string, args?: Record<string, any>): boolean;
evict(options: Cache.EvictOptions): boolean;
clear(): void;

@@ -33,3 +33,3 @@ replace(newData: NormalizedCacheObject | null): void;

makeCacheKey(...args: any[]): object;
getFieldValue: <T = StoreValue>(objectOrReference: Reference | StoreObject, storeFieldName: string) => SafeReadonly<T>;
getFieldValue: <T = StoreValue>(objectOrReference: StoreObject | Reference, storeFieldName: string) => SafeReadonly<T>;
toReference: (object: StoreObject, mergeIntoStore?: boolean | undefined) => "" | Reference | undefined;

@@ -36,0 +36,0 @@ }

@@ -8,8 +8,5 @@ import { __assign, __extends } from 'tslib';

import { maybeDeepFreeze } from '../../utilities/common/maybeDeepFreeze.js';
import { fieldNameFromStoreName } from './helpers.js';
import { hasOwn, fieldNameFromStoreName } from './helpers.js';
import './policies.js';
var hasOwn = Object.prototype.hasOwnProperty;
var DELETE = Object.create(null);
var delModifier = function () { return DELETE; };
var EntityStore = (function () {

@@ -70,90 +67,65 @@ function EntityStore(policies, group) {

delete this.refs[dataId];
if (this.group.caching) {
var fieldsToDirty_1 = Object.create(null);
if (!existing)
fieldsToDirty_1.__exists = 1;
Object.keys(incoming).forEach(function (storeFieldName) {
if (!existing || existing[storeFieldName] !== merged[storeFieldName]) {
fieldsToDirty_1[fieldNameFromStoreName(storeFieldName)] = 1;
if (merged[storeFieldName] === void 0 && !(_this instanceof Layer)) {
delete merged[storeFieldName];
}
var fieldsToDirty_1 = Object.create(null);
if (!existing)
fieldsToDirty_1.__exists = 1;
Object.keys(incoming).forEach(function (storeFieldName) {
if (!existing || existing[storeFieldName] !== merged[storeFieldName]) {
fieldsToDirty_1[fieldNameFromStoreName(storeFieldName)] = 1;
if (merged[storeFieldName] === void 0 && !(_this instanceof Layer)) {
delete merged[storeFieldName];
}
});
Object.keys(fieldsToDirty_1).forEach(function (fieldName) { return _this.group.dirty(dataId, fieldName); });
}
}
});
Object.keys(fieldsToDirty_1).forEach(function (fieldName) { return _this.group.dirty(dataId, fieldName); });
}
return merged;
};
EntityStore.prototype.modify = function (dataId, modifiers) {
var _this = this;
EntityStore.prototype.delete = function (dataId, fieldName, args) {
var storeObject = this.lookup(dataId);
if (storeObject) {
var changedFields_1 = Object.create(null);
var needToMerge_1 = false;
var allDeleted_1 = true;
var readField_1 = function (fieldName, objOrRef) { return _this.getFieldValue(objOrRef || makeReference(dataId), fieldName); };
if (!storeObject)
return false;
var changedFields = Object.create(null);
if (fieldName && args) {
var storeFieldName = this.policies.getStoreFieldName({
typename: this.getFieldValue(storeObject, "__typename"),
fieldName: fieldName,
args: args,
});
if (storeObject[storeFieldName] !== void 0) {
changedFields[storeFieldName] = void 0;
}
}
else {
Object.keys(storeObject).forEach(function (storeFieldName) {
var fieldName = fieldNameFromStoreName(storeFieldName);
var fieldValue = storeObject[storeFieldName];
if (fieldValue === void 0)
return;
var modify = typeof modifiers === "function"
? modifiers
: modifiers[storeFieldName] || modifiers[fieldName];
if (modify) {
var newValue = modify === delModifier ? DELETE :
modify(maybeDeepFreeze(fieldValue), {
DELETE: DELETE,
fieldName: fieldName,
storeFieldName: storeFieldName,
isReference: isReference,
toReference: _this.toReference,
readField: readField_1,
});
if (newValue === DELETE)
newValue = void 0;
if (newValue !== fieldValue) {
changedFields_1[storeFieldName] = newValue;
needToMerge_1 = true;
fieldValue = newValue;
}
if (storeObject[storeFieldName] !== void 0 &&
(!fieldName ||
fieldName === fieldNameFromStoreName(storeFieldName))) {
changedFields[storeFieldName] = void 0;
}
if (fieldValue !== void 0) {
allDeleted_1 = false;
}
});
if (needToMerge_1) {
this.merge(dataId, changedFields_1);
if (allDeleted_1) {
if (this instanceof Layer) {
this.data[dataId] = void 0;
}
else {
delete this.data[dataId];
}
this.group.dirty(dataId, "__exists");
}
if (Object.keys(changedFields).length) {
var merged_1 = this.merge(dataId, changedFields);
if (Object.keys(merged_1).every(function (key) { return merged_1[key] === void 0; })) {
if (this instanceof Layer) {
this.data[dataId] = void 0;
}
return true;
else {
delete this.data[dataId];
}
this.group.dirty(dataId, "__exists");
}
return true;
}
return false;
};
EntityStore.prototype.delete = function (dataId, fieldName, args) {
var _a;
var storeFieldName = fieldName && args
? this.policies.getStoreFieldName(dataId, fieldName, args)
: fieldName;
return this.modify(dataId, storeFieldName ? (_a = {},
_a[storeFieldName] = delModifier,
_a) : delModifier);
};
EntityStore.prototype.evict = function (dataId, fieldName, args) {
EntityStore.prototype.evict = function (options) {
var evicted = false;
if (hasOwn.call(this.data, dataId)) {
evicted = this.delete(dataId, fieldName, args);
if (hasOwn.call(this.data, options.id)) {
evicted = this.delete(options.id, options.fieldName, options.args);
}
if (this instanceof Layer) {
evicted = this.parent.evict(dataId, fieldName, args) || evicted;
evicted = this.parent.evict(options) || evicted;
}
this.group.dirty(dataId, fieldName || "__exists");
this.group.dirty(options.id, options.fieldName || "__exists");
return evicted;

@@ -160,0 +132,0 @@ };

@@ -5,2 +5,3 @@ import { FieldNode } from 'graphql';

import { DeepMerger } from '../../utilities/common/mergeDeep';
export declare const hasOwn: (v: string | number | symbol) => boolean;
export declare function getTypenameFromStoreObject(store: NormalizedCache, objectOrReference: StoreObject | Reference): string | undefined;

@@ -7,0 +8,0 @@ export declare function fieldNameFromStoreName(storeFieldName: string): string;

import { isReference, isField } from '../../utilities/graphql/storeUtils.js';
import { DeepMerger } from '../../utilities/common/mergeDeep.js';
var hasOwn = Object.prototype.hasOwnProperty;
function getTypenameFromStoreObject(store, objectOrReference) {

@@ -43,3 +44,3 @@ return isReference(objectOrReference)

export { fieldNameFromStoreName, getTypenameFromStoreObject, isFieldValueToBeMerged, makeProcessedFieldsMerger, storeValueIsStoreObject };
export { fieldNameFromStoreName, getTypenameFromStoreObject, hasOwn, isFieldValueToBeMerged, makeProcessedFieldsMerger, storeValueIsStoreObject };
//# sourceMappingURL=helpers.js.map

@@ -5,3 +5,2 @@ import './fixPolyfills';

import { Cache } from '../core/types/Cache';
import { Modifier, Modifiers } from '../core/types/common';
import { StoreObject } from '../../utilities/graphql/storeUtils';

@@ -30,3 +29,2 @@ import { ApolloReducerConfig, NormalizedCacheObject } from './types';

write(options: Cache.WriteOptions): void;
modify(modifiers: Modifier<any> | Modifiers, dataId?: string, optimistic?: boolean): boolean;
diff<T>(options: Cache.DiffOptions): Cache.DiffResult<T>;

@@ -38,3 +36,3 @@ watch(watch: Cache.WatchOptions): () => void;

identify(object: StoreObject): string | undefined;
evict(dataId: string, fieldName?: string, args?: Record<string, any>): boolean;
evict(idOrOptions: string | Cache.EvictOptions, fieldName?: string, args?: Record<string, any>): boolean;
reset(): Promise<void>;

@@ -41,0 +39,0 @@ removeOptimistic(idToRemove: string): void;

@@ -89,17 +89,5 @@ import { __extends, __assign } from 'tslib';

});
this.broadcastWatches();
};
InMemoryCache.prototype.modify = function (modifiers, dataId, optimistic) {
var _a;
if (dataId === void 0) { dataId = "ROOT_QUERY"; }
if (optimistic === void 0) { optimistic = false; }
if (typeof modifiers === "string") {
_a = [dataId, modifiers], modifiers = _a[0], dataId = _a[1];
}
var store = optimistic ? this.optimisticData : this.data;
if (store.modify(dataId, modifiers)) {
if (options.broadcast !== false) {
this.broadcastWatches();
return true;
}
return false;
};

@@ -138,5 +126,12 @@ InMemoryCache.prototype.diff = function (options) {

};
InMemoryCache.prototype.evict = function (dataId, fieldName, args) {
var evicted = this.optimisticData.evict(dataId, fieldName, args);
this.broadcastWatches();
InMemoryCache.prototype.evict = function (idOrOptions, fieldName, args) {
var evicted = this.optimisticData.evict(typeof idOrOptions === "string" ? {
id: idOrOptions,
fieldName: fieldName,
args: args,
} : idOrOptions);
if (typeof idOrOptions === "string" ||
idOrOptions.broadcast !== false) {
this.broadcastWatches();
}
return evicted;

@@ -143,0 +138,0 @@ };

@@ -16,3 +16,2 @@ import { InlineFragmentNode, FragmentDefinitionNode, SelectionSetNode, FieldNode } from "graphql";

fragmentMap?: FragmentMap;
policies: Policies;
keyObject?: Record<string, any>;

@@ -34,3 +33,2 @@ };

field: FieldNode | null;
policies: Policies;
}) => KeySpecifier | ReturnType<IdGetter>;

@@ -43,2 +41,12 @@ export declare type FieldPolicy<TExisting = any, TIncoming = TExisting, TReadResult = TExisting> = {

declare type StorageType = Record<string, any>;
interface FieldSpecifier {
typename?: string;
fieldName: string;
field?: FieldNode;
args?: Record<string, any>;
variables?: Record<string, any>;
}
export interface ReadFieldOptions extends FieldSpecifier {
from?: StoreObject | Reference;
}
export interface FieldFunctionOptions<TArgs = Record<string, any>, TVars = Record<string, any>> {

@@ -50,6 +58,6 @@ args: TArgs | null;

variables?: TVars;
policies: Policies;
isReference: typeof isReference;
toReference: ToReferenceFunction;
readField<T = StoreValue>(nameOrField: string | FieldNode, foreignObjOrRef?: StoreObject | Reference): SafeReadonly<T> | undefined;
readField<T = StoreValue>(options: ReadFieldOptions): SafeReadonly<T> | undefined;
readField<T = StoreValue>(fieldName: string, from?: StoreObject | Reference): SafeReadonly<T> | undefined;
storage: StorageType | null;

@@ -60,3 +68,3 @@ mergeObjects<T extends StoreObject | Reference>(existing: T, incoming: T): T | undefined;

export declare type FieldMergeFunction<TExisting = any, TIncoming = TExisting> = (existing: SafeReadonly<TExisting> | undefined, incoming: SafeReadonly<TIncoming>, options: FieldFunctionOptions) => TExisting;
export declare function defaultDataIdFromObject(object: StoreObject): string | undefined;
export declare const defaultDataIdFromObject: KeyFieldsFunction;
export declare type PossibleTypesMap = {

@@ -84,5 +92,5 @@ [supertype: string]: string[];

fragmentMatches(fragment: InlineFragmentNode | FragmentDefinitionNode, typename: string | undefined): boolean;
getStoreFieldName(typename: string | undefined, nameOrField: string | FieldNode, argsOrVars: Record<string, any>): string;
getStoreFieldName(fieldSpec: FieldSpecifier): string;
private storageTrie;
readField<V = StoreValue>(objectOrReference: StoreObject | Reference, nameOrField: string | FieldNode, context: ReadMergeContext, typename?: string): SafeReadonly<V>;
readField<V = StoreValue>(options: ReadFieldOptions, context: ReadMergeContext): SafeReadonly<V> | undefined;
hasMergeFunction(typename: string | undefined, fieldName: string): boolean;

@@ -89,0 +97,0 @@ applyMerges<T extends StoreValue>(existing: T | Reference, incoming: T | FieldValueToBeMerged, context: ReadMergeContext, storageKeys?: [string | StoreObject, string]): T;

@@ -10,11 +10,22 @@ import { __assign } from 'tslib';

var hasOwn = Object.prototype.hasOwnProperty;
function defaultDataIdFromObject(object) {
var __typename = object.__typename, id = object.id, _id = object._id;
function argsFromFieldSpecifier(spec) {
return spec.args !== void 0 ? spec.args :
spec.field ? argumentsObjectFromField(spec.field, spec.variables) : null;
}
var defaultDataIdFromObject = function (_a, context) {
var __typename = _a.__typename, id = _a.id, _id = _a._id;
if (typeof __typename === "string") {
if (id !== void 0)
return __typename + ":" + id;
if (_id !== void 0)
return __typename + ":" + _id;
if (context) {
context.keyObject =
id !== void 0 ? { id: id } :
_id !== void 0 ? { _id: _id } :
void 0;
}
var idValue = id || _id;
if (idValue !== void 0) {
return __typename + ":" + ((typeof idValue === "number" ||
typeof idValue === "string") ? idValue : JSON.stringify(idValue));
}
}
}
};
var nullKeyFieldsFn = function () { return void 0; };

@@ -50,3 +61,2 @@ var simpleKeyArgsFn = function (_args, context) { return context.fieldName; };

fragmentMap: fragmentMap,
policies: this,
};

@@ -177,13 +187,4 @@ var id;

};
Policies.prototype.getStoreFieldName = function (typename, nameOrField, argsOrVars) {
var field;
var fieldName;
if (typeof nameOrField === "string") {
field = null;
fieldName = nameOrField;
}
else {
field = nameOrField;
fieldName = field.name.value;
}
Policies.prototype.getStoreFieldName = function (fieldSpec) {
var typename = fieldSpec.typename, fieldName = fieldSpec.fieldName;
var policy = this.getFieldPolicy(typename, fieldName, false);

@@ -193,4 +194,8 @@ var storeFieldName;

if (keyFn && typename) {
var args = field ? argumentsObjectFromField(field, argsOrVars) : argsOrVars;
var context = { typename: typename, fieldName: fieldName, field: field, policies: this };
var context = {
typename: typename,
fieldName: fieldName,
field: fieldSpec.field || null,
};
var args = argsFromFieldSpecifier(fieldSpec);
while (keyFn) {

@@ -208,5 +213,5 @@ var specifierOrString = keyFn(args, context);

if (storeFieldName === void 0) {
storeFieldName = field
? storeKeyNameFromField(field, argsOrVars)
: getStoreKeyName(fieldName, argsOrVars);
storeFieldName = fieldSpec.field
? storeKeyNameFromField(fieldSpec.field, fieldSpec.variables)
: getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec));
}

@@ -217,17 +222,24 @@ return fieldName === fieldNameFromStoreName(storeFieldName)

};
Policies.prototype.readField = function (objectOrReference, nameOrField, context, typename) {
if (typename === void 0) { typename = context.getFieldValue(objectOrReference, "__typename"); }
process.env.NODE_ENV === "production" ? invariant(objectOrReference, 35) : invariant(objectOrReference, "Must provide an object or Reference when calling Policies#readField");
var policies = this;
var storeFieldName = typeof nameOrField === "string" ? nameOrField
: policies.getStoreFieldName(typename, nameOrField, context.variables);
Policies.prototype.readField = function (options, context) {
var objectOrReference = options.from;
if (!objectOrReference)
return;
var nameOrField = options.field || options.fieldName;
if (!nameOrField)
return;
if (options.typename === void 0) {
var typename = context.getFieldValue(objectOrReference, "__typename");
if (typename)
options.typename = typename;
}
var storeFieldName = this.getStoreFieldName(options);
var fieldName = fieldNameFromStoreName(storeFieldName);
var existing = context.getFieldValue(objectOrReference, storeFieldName);
var policy = policies.getFieldPolicy(typename, fieldName, false);
var policy = this.getFieldPolicy(options.typename, fieldName, false);
var read = policy && policy.read;
if (read) {
var storage = policies.storageTrie.lookup(isReference(objectOrReference)
var storage = this.storageTrie.lookup(isReference(objectOrReference)
? objectOrReference.__ref
: objectOrReference, storeFieldName);
return read(existing, makeFieldFunctionOptions(policies, typename, objectOrReference, nameOrField, storage, context));
return read(existing, makeFieldFunctionOptions(this, objectOrReference, options, storage, context));
}

@@ -241,14 +253,15 @@ return existing;

Policies.prototype.applyMerges = function (existing, incoming, context, storageKeys) {
var policies = this;
var _this = this;
if (isFieldValueToBeMerged(incoming)) {
var field = incoming.__field;
var fieldName = field.name.value;
var merge = policies.getFieldPolicy(incoming.__typename, fieldName, false).merge;
var merge = this.getFieldPolicy(incoming.__typename, fieldName, false).merge;
var storage = storageKeys
? policies.storageTrie.lookupArray(storageKeys)
? this.storageTrie.lookupArray(storageKeys)
: null;
incoming = merge(existing, incoming.__value, makeFieldFunctionOptions(policies, incoming.__typename, null, field, storage, context));
incoming = merge(existing, incoming.__value, makeFieldFunctionOptions(this, void 0, { typename: incoming.__typename, fieldName: fieldName,
field: field, variables: context.variables }, storage, context));
}
if (Array.isArray(incoming)) {
return incoming.map(function (item) { return policies.applyMerges(void 0, item, context); });
return incoming.map(function (item) { return _this.applyMerges(void 0, item, context); });
}

@@ -264,3 +277,3 @@ if (storeValueIsStoreObject(incoming)) {

var incomingValue = i_1[storeFieldName];
var appliedValue = policies.applyMerges(context.getFieldValue(e_1, storeFieldName), incomingValue, context, firstStorageKey_1 ? [firstStorageKey_1, storeFieldName] : void 0);
var appliedValue = _this.applyMerges(context.getFieldValue(e_1, storeFieldName), incomingValue, context, firstStorageKey_1 ? [firstStorageKey_1, storeFieldName] : void 0);
if (appliedValue !== incomingValue) {

@@ -279,24 +292,25 @@ newFields_1 = newFields_1 || Object.create(null);

}());
function makeFieldFunctionOptions(policies, typename, objectOrReference, nameOrField, storage, context) {
function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, storage, context) {
var toReference = context.toReference, getFieldValue = context.getFieldValue, variables = context.variables;
var storeFieldName = typeof nameOrField === "string" ? nameOrField :
policies.getStoreFieldName(typename, nameOrField, variables);
var storeFieldName = policies.getStoreFieldName(fieldSpec);
var fieldName = fieldNameFromStoreName(storeFieldName);
return {
args: typeof nameOrField === "string" ? null :
argumentsObjectFromField(nameOrField, variables),
field: typeof nameOrField === "string" ? null : nameOrField,
args: argsFromFieldSpecifier(fieldSpec),
field: fieldSpec.field || null,
fieldName: fieldName,
storeFieldName: storeFieldName,
variables: variables,
policies: policies,
isReference: isReference,
toReference: toReference,
storage: storage,
readField: function (nameOrField, foreignObjOrRef) {
return policies.readField(foreignObjOrRef || objectOrReference, nameOrField, context);
readField: function (fieldNameOrOptions, from) {
var options = typeof fieldNameOrOptions === "string" ? {
fieldName: fieldNameOrOptions,
from: from,
} : fieldNameOrOptions;
return policies.readField(options.from ? options : __assign(__assign({}, options), { from: objectOrReference }), context);
},
mergeObjects: function (existing, incoming) {
if (Array.isArray(existing) || Array.isArray(incoming)) {
throw process.env.NODE_ENV === "production" ? new InvariantError(36) : new InvariantError("Cannot automatically merge arrays");
throw process.env.NODE_ENV === "production" ? new InvariantError(35) : new InvariantError("Cannot automatically merge arrays");
}

@@ -385,3 +399,3 @@ if (existing && typeof existing === "object" &&

var responseName = aliases && aliases[s] || s;
process.env.NODE_ENV === "production" ? invariant(hasOwn.call(response, responseName), 37) : invariant(hasOwn.call(response, responseName), "Missing field '" + responseName + "' while computing key fields");
process.env.NODE_ENV === "production" ? invariant(hasOwn.call(response, responseName), 36) : invariant(hasOwn.call(response, responseName), "Missing field '" + responseName + "' while computing key fields");
keyObj[prevKey = s] = response[responseName];

@@ -388,0 +402,0 @@ }

@@ -100,3 +100,3 @@ import { __assign } from 'tslib';

result: {},
missing: [missingFromInvariant(process.env.NODE_ENV === "production" ? new InvariantError(48) : new InvariantError("Dangling reference to missing " + objectOrReference.__ref + " object"), context)],
missing: [missingFromInvariant(process.env.NODE_ENV === "production" ? new InvariantError(46) : new InvariantError("Dangling reference to missing " + objectOrReference.__ref + " object"), context)],
};

@@ -128,3 +128,8 @@ }

if (isField(selection)) {
var fieldValue = policies.readField(objectOrReference, selection, context);
var fieldValue = policies.readField({
fieldName: selection.name.value,
field: selection,
variables: context.variables,
from: objectOrReference,
}, context);
var resultName = resultKeyNameFromField(selection);

@@ -134,3 +139,3 @@ context.path.push(resultName);

if (!addTypenameToDocument.added(selection)) {
getMissing().push(missingFromInvariant(process.env.NODE_ENV === "production" ? new InvariantError(49) : new InvariantError("Can't find field '" + selection.name.value + "' on " + (isReference(objectOrReference)
getMissing().push(missingFromInvariant(process.env.NODE_ENV === "production" ? new InvariantError(47) : new InvariantError("Can't find field '" + selection.name.value + "' on " + (isReference(objectOrReference)
? objectOrReference.__ref + " object"

@@ -171,3 +176,3 @@ : "object " + JSON.stringify(objectOrReference, null, 2))), context));

else {
process.env.NODE_ENV === "production" ? invariant(fragment = fragmentMap[selection.name.value], 50) : invariant(fragment = fragmentMap[selection.name.value], "No fragment named " + selection.name.value);
process.env.NODE_ENV === "production" ? invariant(fragment = fragmentMap[selection.name.value], 48) : invariant(fragment = fragmentMap[selection.name.value], "No fragment named " + selection.name.value);
}

@@ -235,3 +240,3 @@ if (policies.fragmentMatches(fragment, typename)) {

if (value && typeof value === "object") {
process.env.NODE_ENV === "production" ? invariant(!isReference(value), 51) : 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), 49) : 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);

@@ -238,0 +243,0 @@ }

import { DocumentNode } from 'graphql';
import { Transaction } from '../core/cache';
import { Modifier, Modifiers } from '../core/types/common';
import { StoreValue, StoreObject } from '../../utilities/graphql/storeUtils';

@@ -17,5 +16,3 @@ import { FieldValueGetter, ToReferenceFunction } from './entityStore';

get(dataId: string, fieldName: string): StoreValue;
merge(dataId: string, incoming: StoreObject): void;
modify(dataId: string, modifiers: Modifier<any> | Modifiers): boolean;
delete(dataId: string, fieldName?: string): boolean;
merge(dataId: string, incoming: StoreObject): StoreObject;
clear(): void;

@@ -22,0 +19,0 @@ toObject(): NormalizedCacheObject;

@@ -80,3 +80,8 @@ import { __assign } from 'tslib';

if (typeof value !== 'undefined') {
var storeFieldName = policies.getStoreFieldName(typename, selection, context.variables);
var storeFieldName = policies.getStoreFieldName({
typename: typename,
fieldName: selection.name.value,
field: selection,
variables: context.variables,
});
var incomingValue = _this.processFieldValue(value, selection, context, out);

@@ -97,3 +102,3 @@ if (policies.hasMergeFunction(typename, selection.name.value)) {

!hasDirectives(["defer", "client"], selection)) {
throw process.env.NODE_ENV === "production" ? new InvariantError(47) : new InvariantError("Missing field '" + resultFieldKey + "' in " + JSON.stringify(result, null, 2).substring(0, 100));
throw process.env.NODE_ENV === "production" ? new InvariantError(50) : new InvariantError("Missing field '" + resultFieldKey + "' in " + JSON.stringify(result, null, 2).substring(0, 100));
}

@@ -100,0 +105,0 @@ }

@@ -182,3 +182,3 @@ import { __awaiter, __generator, __assign } from 'tslib';

fragment = fragmentMap[selection.name.value];
process.env.NODE_ENV === "production" ? invariant(fragment, 14) : invariant(fragment, "No fragment named " + selection.name.value);
process.env.NODE_ENV === "production" ? invariant(fragment, 22) : invariant(fragment, "No fragment named " + selection.name.value);
}

@@ -185,0 +185,0 @@ if (fragment && fragment.typeCondition) {

@@ -8,2 +8,3 @@ /// <reference types="zen-observable" />

import { WatchQueryOptions, FetchMoreQueryOptions, SubscribeToMoreOptions, ErrorPolicy } from './watchQueryOptions';
import { QueryStoreValue } from './QueryInfo';
export declare type ApolloCurrentQueryResult<T> = ApolloQueryResult<T> & {

@@ -22,3 +23,3 @@ error?: ApolloError;

}
export declare const hasError: (storeValue: Pick<import("./QueryInfo").QueryInfo, "variables" | "graphQLErrors" | "networkError" | "networkStatus">, policy?: ErrorPolicy) => boolean | Error;
export declare const hasError: (storeValue: QueryStoreValue, policy?: ErrorPolicy) => boolean | Error;
export declare class ObservableQuery<TData = any, TVariables = OperationVariables> extends Observable<ApolloQueryResult<TData>> {

@@ -25,0 +26,0 @@ readonly options: WatchQueryOptions<TVariables>;

@@ -53,3 +53,3 @@ import { __extends, __assign } from 'tslib';

},
enumerable: true,
enumerable: false,
configurable: true

@@ -259,4 +259,4 @@ });

ObservableQuery.prototype.getCurrentQueryResult = function (optimistic) {
var _a, _b;
if (optimistic === void 0) { optimistic = true; }
var _a, _b;
var fetchPolicy = this.options.fetchPolicy;

@@ -263,0 +263,0 @@ if (fetchPolicy === 'no-cache' ||

/// <reference types="zen-observable" />
import { ExecutionResult, DocumentNode, GraphQLError } from 'graphql';
import { DocumentNode, GraphQLError } from 'graphql';
import { Cache } from '../cache/core/types/Cache';

@@ -8,2 +8,3 @@ import { ApolloCache } from '../cache/core/cache';

import { QueryListener } from './types';
import { FetchResult } from '../link/core/types';
import { NetworkStatus } from './networkStatus';

@@ -44,3 +45,3 @@ import { ApolloError } from '../errors/ApolloError';

updateWatch<TVars = Record<string, any>>(variables: TVars): this;
markResult<T>(result: ExecutionResult<T>, options: Pick<WatchQueryOptions, "variables" | "fetchPolicy" | "errorPolicy">, allowCacheWrite: boolean): void;
markResult<T>(result: FetchResult<T>, options: Pick<WatchQueryOptions, "variables" | "fetchPolicy" | "errorPolicy">, allowCacheWrite: boolean): void;
markReady(): NetworkStatus;

@@ -47,0 +48,0 @@ markError(error: ApolloError): ApolloError;

@@ -49,3 +49,3 @@ import { __awaiter, __generator, __assign } from 'tslib';

});
this.cancelPendingFetches(process.env.NODE_ENV === "production" ? new InvariantError(15) : new InvariantError('QueryManager stopped while query was in flight'));
this.cancelPendingFetches(process.env.NODE_ENV === "production" ? new InvariantError(14) : new InvariantError('QueryManager stopped while query was in flight'));
};

@@ -64,4 +64,4 @@ QueryManager.prototype.cancelPendingFetches = function (error) {

case 0:
process.env.NODE_ENV === "production" ? invariant(mutation, 16) : 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', 17) : 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, 15) : 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', 16) : 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.generateMutationId();

@@ -276,7 +276,7 @@ mutation = this.transform(mutation).document;

var _this = this;
process.env.NODE_ENV === "production" ? invariant(options.query, 18) : invariant(options.query, 'query option is required. You must specify your GraphQL document ' +
process.env.NODE_ENV === "production" ? invariant(options.query, 17) : 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', 19) : invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.');
process.env.NODE_ENV === "production" ? invariant(!options.returnPartialData, 20) : invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.');
process.env.NODE_ENV === "production" ? invariant(!options.pollInterval, 21) : invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.');
process.env.NODE_ENV === "production" ? invariant(options.query.kind === 'Document', 18) : invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.');
process.env.NODE_ENV === "production" ? invariant(!options.returnPartialData, 19) : invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.');
process.env.NODE_ENV === "production" ? invariant(!options.pollInterval, 20) : invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.');
var queryId = this.generateQueryId();

@@ -307,3 +307,3 @@ return this.fetchQuery(queryId, options).finally(function () { return _this.stopQuery(queryId); });

QueryManager.prototype.clearStore = function () {
this.cancelPendingFetches(process.env.NODE_ENV === "production" ? new InvariantError(22) : new InvariantError('Store reset while query was in flight (not completed in link chain)'));
this.cancelPendingFetches(process.env.NODE_ENV === "production" ? new InvariantError(21) : new InvariantError('Store reset while query was in flight (not completed in link chain)'));
this.queries.forEach(function (queryInfo) {

@@ -310,0 +310,0 @@ if (queryInfo.observableQuery) {

@@ -1,2 +0,2 @@

export declare const checkFetcher: (fetcher: ((input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>) | undefined) => void;
export declare const checkFetcher: (fetcher: WindowOrWorkerGlobalScope['fetch'] | undefined) => void;
//# sourceMappingURL=checkFetcher.d.ts.map

@@ -5,15 +5,3 @@ import { InvariantError } from 'ts-invariant';

if (!fetcher && typeof fetch === 'undefined') {
var library = 'unfetch';
if (typeof window === 'undefined')
library = 'node-fetch';
throw process.env.NODE_ENV === "production" ? new InvariantError(13) : new InvariantError('"fetch" has not been found globally and no fetcher has been ' +
'configured. To fix this, install a fetch package ' +
("(like https://www.npmjs.com/package/" + library + "), instantiate the ") +
'fetcher, and pass it into your `HttpLink` constructor. For example:' +
'\n\n' +
("import fetch from '" + library + "';\n") +
"import { ApolloClient, HttpLink } from '@apollo/client';\n" +
'const client = new ApolloClient({\n' +
" link: new HttpLink({ uri: '/graphq', fetch })\n" +
'});');
throw process.env.NODE_ENV === "production" ? new InvariantError(13) : new InvariantError("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n ");
}

@@ -20,0 +8,0 @@ };

@@ -40,3 +40,3 @@ import { Operation } from '../core/types';

};
export declare const selectHttpOptionsAndBody: (operation: Operation, fallbackConfig: HttpConfig, ...configs: HttpConfig[]) => {
export declare const selectHttpOptionsAndBody: (operation: Operation, fallbackConfig: HttpConfig, ...configs: Array<HttpConfig>) => {
options: HttpConfig & Record<string, any>;

@@ -43,0 +43,0 @@ body: Body;

{
"name": "@apollo/client",
"version": "3.0.0-beta.48",
"version": "3.0.0-beta.49",
"description": "A fully-featured caching GraphQL client.",

@@ -63,2 +63,3 @@ "private": false,

"bundlesize": "0.18.0",
"cross-fetch": "3.0.4",
"fetch-mock": "7.7.3",

@@ -69,3 +70,2 @@ "graphql": "14.6.0",

"lodash": "4.17.15",
"node-fetch": "2.6.0",
"prop-types": "15.7.2",

@@ -83,3 +83,3 @@ "react": "^16.13.1",

"tsc-watch": "3.0.1",
"typescript": "3.8.3"
"typescript": "3.9.2"
},

@@ -86,0 +86,0 @@ "publishConfig": {

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

(this.context && this.context.client);
process.env.NODE_ENV === "production" ? invariant(!!client, 45) : invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' +
process.env.NODE_ENV === "production" ? invariant(!!client, 44) : 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, 46) : invariant(operation.type === type, "Running a " + requiredOperationName + " requires a graphql " +
process.env.NODE_ENV === "production" ? invariant(operation.type === type, 45) : invariant(operation.type === type, "Running a " + requiredOperationName + " requires a graphql " +
(requiredOperationName + ", but a " + usedOperationName + " was used instead."));

@@ -52,0 +52,0 @@ };

@@ -11,2 +11,3 @@ export { ApolloProvider } from './context/ApolloProvider';

export { DocumentType, operationName, parser } from './parser/parser';
export * from './types/types';
//# sourceMappingURL=index.js.map

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

evaledValue = variables && variables[ifArgument.value.name.value];
process.env.NODE_ENV === "production" ? invariant(evaledValue !== void 0, 41) : invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.");
process.env.NODE_ENV === "production" ? invariant(evaledValue !== void 0, 37) : invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.");
}

@@ -52,8 +52,8 @@ else {

var directiveName = directive.name.value;
process.env.NODE_ENV === "production" ? invariant(directiveArguments && directiveArguments.length === 1, 42) : invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.");
process.env.NODE_ENV === "production" ? invariant(directiveArguments && directiveArguments.length === 1, 38) : 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', 43) : 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', 39) : 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'), 44) : invariant(ifValue &&
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 40) : invariant(ifValue &&
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value.");

@@ -60,0 +60,0 @@ result.push({ 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(38) : new InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " +
throw process.env.NODE_ENV === "production" ? new InvariantError(41) : 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, 39) : 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, 42) : 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, 40) : invariant(fragment, "No fragment named " + selection.name.value + ".");
process.env.NODE_ENV === "production" ? invariant(fragment, 43) : invariant(fragment, "No fragment named " + selection.name.value + ".");
return fragment;

@@ -59,0 +59,0 @@ }

@@ -20,4 +20,4 @@ import { DirectiveNode, FieldNode, VariableNode, InlineFragmentNode, ValueNode, SelectionNode, NameNode, SelectionSetNode } from 'graphql';

};
export declare function getStoreKeyName(fieldName: string, args?: Object, directives?: Directives): string;
export declare function argumentsObjectFromField(field: FieldNode | DirectiveNode, variables: Object): Object | null;
export declare function getStoreKeyName(fieldName: string, args?: Record<string, any> | null, directives?: Directives): string;
export declare function argumentsObjectFromField(field: FieldNode | DirectiveNode, variables?: Record<string, any>): Object | null;
export declare function resultKeyNameFromField(field: FieldNode): string;

@@ -24,0 +24,0 @@ export declare function getTypenameFromResult(result: Record<string, any>, selectionSet: SelectionSetNode, fragmentMap?: FragmentMap): string | undefined;

@@ -108,3 +108,4 @@ import { InvariantError } from 'ts-invariant';

function getStoreKeyName(fieldName, args, directives) {
if (directives &&
if (args &&
directives &&
directives['connection'] &&

@@ -118,6 +119,5 @@ directives['connection']['key']) {

filterKeys.sort();
var queryArgs_1 = args;
var filteredArgs_1 = {};
filterKeys.forEach(function (key) {
filteredArgs_1[key] = queryArgs_1[key];
filteredArgs_1[key] = args[key];
});

@@ -124,0 +124,0 @@ return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")";

@@ -6,5 +6,5 @@ /// <reference types="zen-observable" />

export declare type ResultFunction<T> = () => T;
export interface MockedResponse {
export interface MockedResponse<TData = Record<string, any>> {
request: GraphQLRequest;
result?: FetchResult | ResultFunction<FetchResult>;
result?: FetchResult<TData> | ResultFunction<FetchResult<TData>>;
error?: Error;

@@ -11,0 +11,0 @@ delay?: number;

import { MockedResponse } from './mockLink';
import { ObservableQuery } from '../../../core/ObservableQuery';
declare const _default: (reject: (reason: any) => any, ...mockedResponses: MockedResponse[]) => ObservableQuery<any, Record<string, any>>;
declare const _default: (reject: (reason: any) => any, ...mockedResponses: MockedResponse[]) => ObservableQuery<any>;
export default _default;
//# sourceMappingURL=mockWatchQuery.d.ts.map

@@ -22,3 +22,3 @@ 'use strict';

evaledValue = variables && variables[ifArgument.value.name.value];
process.env.NODE_ENV === "production" ? tsInvariant.invariant(evaledValue !== void 0, 41) : tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.");
process.env.NODE_ENV === "production" ? tsInvariant.invariant(evaledValue !== void 0, 37) : tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.");
}

@@ -60,8 +60,8 @@ else {

var directiveName = directive.name.value;
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.");
process.env.NODE_ENV === "production" ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 38) : 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', 43) : 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', 39) : 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'), 44) : tsInvariant.invariant(ifValue &&
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 40) : tsInvariant.invariant(ifValue &&
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value.");

@@ -79,3 +79,3 @@ result.push({ directive: directive, ifArgument: ifArgument });

if (definition.kind === 'OperationDefinition') {
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(38) : new tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " +
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(41) : 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.');

@@ -88,3 +88,3 @@ }

if (typeof actualFragmentName === 'undefined') {
process.env.NODE_ENV === "production" ? tsInvariant.invariant(fragments.length === 1, 39) : 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, 42) : 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;

@@ -126,3 +126,3 @@ }

var fragment = fragmentMap && fragmentMap[selection.name.value];
process.env.NODE_ENV === "production" ? tsInvariant.invariant(fragment, 40) : tsInvariant.invariant(fragment, "No fragment named " + selection.name.value + ".");
process.env.NODE_ENV === "production" ? tsInvariant.invariant(fragment, 43) : tsInvariant.invariant(fragment, "No fragment named " + selection.name.value + ".");
return fragment;

@@ -238,3 +238,4 @@ }

function getStoreKeyName(fieldName, args, directives) {
if (directives &&
if (args &&
directives &&
directives['connection'] &&

@@ -248,6 +249,5 @@ directives['connection']['key']) {

filterKeys.sort();
var queryArgs_1 = args;
var filteredArgs_1 = {};
filterKeys.forEach(function (key) {
filteredArgs_1[key] = queryArgs_1[key];
filteredArgs_1[key] = args[key];
});

@@ -254,0 +254,0 @@ return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")";

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 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 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 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 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

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 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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc