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-beta.32 to 3.0.0-beta.32-james

2

cache/index.d.ts

@@ -6,4 +6,4 @@ export { Transaction, ApolloCache } from './core/cache';

export { InMemoryCache, InMemoryCacheConfig, LocalVar, } from './inmemory/inMemoryCache';
export { defaultDataIdFromObject, TypePolicies, TypePolicy, FieldPolicy, FieldReadFunction, FieldMergeFunction, PossibleTypesMap, } from './inmemory/policies';
export { defaultDataIdFromObject, TypePolicies, TypePolicy, FieldPolicy, FieldReadFunction, FieldMergeFunction, FieldFunctionOptions, PossibleTypesMap, } from './inmemory/policies';
export * from './inmemory/types';
//# sourceMappingURL=index.d.ts.map
import { KeyTrie } from 'optimism';
import { StoreValue } from '../../utilities/graphql/storeUtils';
import { NormalizedCache, NormalizedCacheObject, StoreObject } from './types';
import { isReference, StoreValue, Reference } from '../../utilities/graphql/storeUtils';
import { NormalizedCache, NormalizedCacheObject, StoreObject, SafeReadonly } from './types';
import { Policies } from './policies';
export interface Modifiers {
[fieldName: string]: <T>(value: T, details: {
DELETE: typeof DELETE;
fieldName: string;
storeFieldName: string;
isReference: typeof isReference;
toReference: Policies["toReference"];
readField<T = StoreValue>(fieldName: string, objOrRef?: StoreObject | Reference): SafeReadonly<T>;
}) => T;
}
declare const DELETE: any;
export declare abstract class EntityStore implements NormalizedCache {
readonly policies: Policies;
readonly group: CacheGroup;
protected data: NormalizedCacheObject;
readonly group: CacheGroup;
constructor(policies: Policies, group: CacheGroup);
abstract addLayer(layerId: string, replay: (layer: EntityStore) => any): EntityStore;

@@ -12,4 +26,5 @@ abstract removeLayer(layerId: string): EntityStore;

get(dataId: string, fieldName: string): StoreValue;
private lookup;
protected lookup(dataId: string, dependOnExistence?: boolean): StoreObject;
merge(dataId: string, incoming: StoreObject): void;
modify(dataId: string, modifiers: Modifiers | Modifiers[string]): boolean;
delete(dataId: string, fieldName?: string): boolean;

@@ -28,2 +43,4 @@ evict(dataId: string, fieldName?: string): boolean;

}
export declare type FieldValueGetter = ReturnType<typeof makeFieldValueGetter>;
export declare function makeFieldValueGetter(store: NormalizedCache): <T = StoreValue>(objectOrReference: Reference | StoreObject, storeFieldName: string) => SafeReadonly<T>;
declare class CacheGroup {

@@ -40,3 +57,4 @@ readonly caching: boolean;

private sharedLayerGroup;
constructor({ resultCaching, seed, }: {
constructor({ policies, resultCaching, seed, }: {
policies: Policies;
resultCaching?: boolean;

@@ -43,0 +61,0 @@ seed?: NormalizedCacheObject;

import { __assign, __extends } from 'tslib';
import { invariant } from 'ts-invariant';
import { isReference } from '../../utilities/graphql/storeUtils.js';
import { isReference, makeReference } from '../../utilities/graphql/storeUtils.js';
import { canUseWeakMap } from '../../utilities/common/canUse.js';

@@ -8,7 +7,13 @@ import { equal } from '@wry/equality';

import { KeyTrie, dep } from 'optimism';
import { fieldNameFromStoreName, getTypenameFromStoreObject } from './helpers.js';
import { maybeDeepFreeze } from '../../utilities/common/maybeDeepFreeze.js';
import { fieldNameFromStoreName } from './helpers.js';
import { Policies } from './policies.js';
var hasOwn = Object.prototype.hasOwnProperty;
var DELETE = Object.create(null);
var delModifier = function () { return DELETE; };
var EntityStore = (function () {
function EntityStore() {
function EntityStore(policies, group) {
this.policies = policies;
this.group = group;
this.data = Object.create(null);

@@ -32,2 +37,6 @@ this.rootIds = Object.create(null);

}
if (fieldName === "__typename" &&
hasOwn.call(this.policies.rootTypenamesById, dataId)) {
return this.policies.rootTypenamesById[dataId];
}
if (this instanceof Layer) {

@@ -46,54 +55,80 @@ return this.parent.get(dataId, fieldName);

var existing = this.lookup(dataId);
var merged = new DeepMerger(storeObjectReconciler).merge(existing, incoming, this);
var merged = new DeepMerger(storeObjectReconciler).merge(existing, incoming);
this.data[dataId] = merged;
if (merged !== existing) {
this.data[dataId] = merged;
delete this.refs[dataId];
if (this.group.caching) {
var fieldsToDirty_1 = Object.create(null);
if (!existing)
this.group.dirty(dataId, "__exists");
fieldsToDirty_1.__exists = 1;
Object.keys(incoming).forEach(function (storeFieldName) {
if (!existing || incoming[storeFieldName] !== existing[storeFieldName]) {
_this.group.dirty(dataId, storeFieldName);
if (!existing || existing[storeFieldName] !== merged[storeFieldName]) {
fieldsToDirty_1[fieldNameFromStoreName(storeFieldName)] = 1;
}
});
Object.keys(fieldsToDirty_1).forEach(function (fieldName) { return _this.group.dirty(dataId, fieldName); });
}
}
};
EntityStore.prototype.delete = function (dataId, fieldName) {
EntityStore.prototype.modify = function (dataId, modifiers) {
var _this = this;
var storeObject = this.lookup(dataId);
if (storeObject) {
fieldName = fieldName && fieldNameFromStoreName(fieldName);
var storeNamesToDelete = Object.keys(storeObject).filter(function (storeFieldName) { return storeObject[storeFieldName] !== void 0 &&
(!fieldName || fieldName === fieldNameFromStoreName(storeFieldName)); });
if (storeNamesToDelete.length) {
var canDelete_1 = this instanceof EntityStore.Root;
var remove_1 = function (obj, key) {
if (canDelete_1) {
delete obj[key];
var fieldsToDirty_2 = Object.create(null);
var changedFields_1 = Object.create(null);
var needToMerge_1 = false;
var allDeleted_1 = true;
var readField_1;
var lazyReadField_1 = function () {
if (!readField_1) {
var getFieldValue_1 = makeFieldValueGetter(_this);
var selfRef_1 = makeReference(dataId);
readField_1 = function (fieldName, objOrRef) { return getFieldValue_1(objOrRef || selfRef_1, fieldName); };
}
return readField_1;
};
Object.keys(storeObject).forEach(function (storeFieldName) {
var fieldName = fieldNameFromStoreName(storeFieldName);
var modify = typeof modifiers === "function" ? modifiers :
hasOwn.call(modifiers, fieldName) && modifiers[fieldName];
var fieldValue = storeObject[storeFieldName];
if (modify) {
var newValue = modify === delModifier ? DELETE :
modify(maybeDeepFreeze(fieldValue), {
DELETE: DELETE,
fieldName: fieldName,
storeFieldName: storeFieldName,
isReference: isReference,
toReference: _this.policies.toReference,
readField: lazyReadField_1(),
});
if (newValue === DELETE)
newValue = void 0;
if (newValue !== fieldValue) {
fieldsToDirty_2[fieldName] = 1;
changedFields_1[storeFieldName] = newValue;
needToMerge_1 = true;
fieldValue = newValue;
}
}
if (fieldValue !== void 0) {
allDeleted_1 = false;
}
});
if (needToMerge_1) {
if (allDeleted_1) {
if (this instanceof Layer) {
this.data[dataId] = void 0;
}
else {
obj[key] = void 0;
delete this.data[dataId];
}
};
delete this.refs[dataId];
var fieldsToDirty_1 = new Set();
if (fieldName) {
var cleaned_1 = this.data[dataId] = __assign({}, storeObject);
storeNamesToDelete.forEach(function (storeFieldName) {
remove_1(cleaned_1, storeFieldName);
});
fieldsToDirty_1.add(fieldName);
}
else {
remove_1(this.data, dataId);
storeNamesToDelete.forEach(function (storeFieldName) {
fieldsToDirty_1.add(fieldNameFromStoreName(storeFieldName));
});
fieldsToDirty_1.add("__exists");
this.data[dataId] = new DeepMerger(storeObjectReconciler)
.merge(storeObject, changedFields_1);
}
delete this.refs[dataId];
if (this.group.caching) {
fieldsToDirty_1.forEach(function (fieldName) {
_this.group.dirty(dataId, fieldName);
});
Object.keys(fieldsToDirty_2).forEach(function (fieldName) { return _this.group.dirty(dataId, fieldName); });
}

@@ -105,4 +140,13 @@ return true;

};
EntityStore.prototype.delete = function (dataId, fieldName) {
var _a;
return this.modify(dataId, fieldName ? (_a = {},
_a[fieldName] = delModifier,
_a) : delModifier);
};
EntityStore.prototype.evict = function (dataId, fieldName) {
var evicted = this.delete(dataId, fieldName);
var evicted = false;
if (hasOwn.call(this.data, dataId)) {
evicted = this.delete(dataId, fieldName);
}
if (this instanceof Layer) {

@@ -195,2 +239,9 @@ evicted = this.parent.evict(dataId, fieldName) || evicted;

}());
function makeFieldValueGetter(store) {
return function getFieldValue(objectOrReference, storeFieldName) {
return maybeDeepFreeze(isReference(objectOrReference)
? store.get(objectOrReference.__ref, storeFieldName)
: objectOrReference && objectOrReference[storeFieldName]);
};
}
var CacheGroup = (function () {

@@ -222,6 +273,5 @@ function CacheGroup(caching) {

function Root(_a) {
var _b = _a.resultCaching, resultCaching = _b === void 0 ? true : _b, seed = _a.seed;
var _this = _super.call(this) || this;
var policies = _a.policies, _b = _a.resultCaching, resultCaching = _b === void 0 ? true : _b, seed = _a.seed;
var _this = _super.call(this, policies, new CacheGroup(resultCaching)) || this;
_this.sharedLayerGroup = null;
_this.group = new CacheGroup(resultCaching);
_this.sharedLayerGroup = new CacheGroup(resultCaching);

@@ -245,3 +295,3 @@ if (seed)

function Layer(id, parent, replay, group) {
var _this = _super.call(this) || this;
var _this = _super.call(this, parent.policies, group) || this;
_this.id = id;

@@ -262,3 +312,7 @@ _this.parent = parent;

if (this.group.caching) {
Object.keys(this.data).forEach(function (dataId) { return _this.delete(dataId); });
Object.keys(this.data).forEach(function (dataId) {
if (_this.data[dataId] !== parent.lookup(dataId)) {
_this.delete(dataId);
}
});
}

@@ -280,22 +334,7 @@ return parent;

}(EntityStore));
var storeObjectReconciler = function (existingObject, incomingObject, property, store) {
var existing = existingObject[property];
var incoming = incomingObject[property];
if (existing !== incoming &&
this.isObject(existing) &&
this.isObject(incoming)) {
var eType = getTypenameFromStoreObject(store, existing);
var iType = getTypenameFromStoreObject(store, incoming);
if (typeof eType === 'string' &&
typeof iType === 'string' &&
eType !== iType) {
return incoming;
}
process.env.NODE_ENV === "production" ? invariant(!isReference(existing) || isReference(incoming), 56) : 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)) {
return existing;
}
}
return incoming;
};
function storeObjectReconciler(existingObject, incomingObject, property) {
var existingValue = existingObject[property];
var incomingValue = incomingObject[property];
return equal(existingValue, incomingValue) ? existingValue : incomingValue;
}
function supportsResultCaching(store) {

@@ -305,6 +344,10 @@ return !!(store instanceof EntityStore && store.group.caching);

function defaultNormalizedCacheFactory(seed) {
return new EntityStore.Root({ resultCaching: true, seed: seed });
return new EntityStore.Root({
policies: new Policies(),
resultCaching: true,
seed: seed,
});
}
export { EntityStore, defaultNormalizedCacheFactory, supportsResultCaching };
export { EntityStore, defaultNormalizedCacheFactory, makeFieldValueGetter, supportsResultCaching };
//# sourceMappingURL=entityStore.js.map

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

import { isReference, isField } from '../../utilities/graphql/storeUtils.js';
import { isField, isReference } from '../../utilities/graphql/storeUtils.js';
import { DeepMerger } from '../../utilities/common/mergeDeep.js';

@@ -3,0 +3,0 @@

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

import { ApolloReducerConfig, NormalizedCacheObject, StoreObject } from './types';
import { Modifiers } from './entityStore';
import { PossibleTypesMap, Policies, TypePolicies } from './policies';

@@ -29,2 +30,3 @@ export interface InMemoryCacheConfig extends ApolloReducerConfig {

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

@@ -31,0 +33,0 @@ watch(watch: Cache.WatchOptions): () => void;

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

import './fixPolyfills.js';
import { Policies, defaultDataIdFromObject } from './policies.js';
import { EntityStore, supportsResultCaching } from './entityStore.js';
import { StoreReader } from './readFromStore.js';
import { StoreWriter } from './writeToStore.js';
import { Policies, defaultDataIdFromObject } from './policies.js';

@@ -34,2 +34,3 @@ var defaultConfig = {

_this.data = new EntityStore.Root({
policies: _this.policies,
resultCaching: _this.config.resultCaching,

@@ -92,2 +93,11 @@ });

};
InMemoryCache.prototype.modify = function (dataId, modifiers, optimistic) {
if (optimistic === void 0) { optimistic = false; }
var store = optimistic ? this.optimisticData : this.data;
if (store.modify(dataId, modifiers)) {
this.broadcastWatches();
return true;
}
return false;
};
InMemoryCache.prototype.diff = function (options) {

@@ -94,0 +104,0 @@ return this.storeReader.diffQueryAgainstStore({

import { InlineFragmentNode, FragmentDefinitionNode, SelectionSetNode, FieldNode } from "graphql";
import { FragmentMap } from '../../utilities/graphql/fragments';
import { StoreValue, Reference, isReference } from '../../utilities/graphql/storeUtils';
import { IdGetter, StoreObject, NormalizedCache } from "./types";
import { IdGetter, StoreObject, SafeReadonly } from "./types";
import { FieldValueToBeMerged } from './helpers';
import { FieldValueGetter } from './entityStore';
export declare type TypePolicies = {

@@ -30,3 +31,2 @@ [__typename: string]: TypePolicy;

}) => ReturnType<IdGetter>;
declare type SafeReadonly<T> = T extends object ? Readonly<T> : T;
export declare type FieldPolicy<TExisting = any, TIncoming = TExisting, TReadResult = TExisting> = {

@@ -37,9 +37,9 @@ keyArgs?: KeySpecifier | KeyArgsFunction | false;

};
export declare type FieldValueGetter = ReturnType<Policies["makeFieldValueGetter"]>;
declare type StorageType = Record<string, any>;
interface FieldFunctionOptions {
args: Record<string, any> | null;
export interface FieldFunctionOptions<TArgs = Record<string, any>, TVars = Record<string, any>> {
args: TArgs | null;
fieldName: string;
storeFieldName: string;
field: FieldNode | null;
variables?: Record<string, any>;
variables?: TVars;
policies: Policies;

@@ -77,3 +77,2 @@ isReference: typeof isReference;

fragmentMatches(fragment: InlineFragmentNode | FragmentDefinitionNode, typename: string): boolean;
makeFieldValueGetter(store: NormalizedCache): <T = StoreValue>(objectOrReference: Reference | StoreObject, storeFieldName: string) => SafeReadonly<T>;
getStoreFieldName(typename: string | undefined, field: FieldNode, variables: Record<string, any>): string;

@@ -80,0 +79,0 @@ private storageTrie;

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

@@ -177,19 +176,2 @@

};
Policies.prototype.makeFieldValueGetter = function (store) {
var policies = this;
return function getFieldValue(objectOrReference, storeFieldName) {
var fieldValue;
if (isReference(objectOrReference)) {
var dataId = objectOrReference.__ref;
fieldValue = store.get(dataId, storeFieldName);
if (fieldValue === void 0 && storeFieldName === "__typename") {
return policies.rootTypenamesById[dataId];
}
}
else {
fieldValue = objectOrReference && objectOrReference[storeFieldName];
}
return maybeDeepFreeze(fieldValue);
};
};
Policies.prototype.getStoreFieldName = function (typename, field, variables) {

@@ -278,2 +260,3 @@ var fieldName = field.name.value;

fieldName: fieldName,
storeFieldName: storeFieldName,
variables: variables,

@@ -280,0 +263,0 @@ policies: policies,

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

import { getTypenameFromStoreObject } from './helpers.js';
import { supportsResultCaching } from './entityStore.js';
import { supportsResultCaching, makeFieldValueGetter } from './entityStore.js';

@@ -59,3 +59,3 @@ var StoreReader = (function () {

fragmentMap: createFragmentMap(getFragmentDefinitions(query)),
getFieldValue: policies.makeFieldValueGetter(store),
getFieldValue: makeFieldValueGetter(store),
},

@@ -62,0 +62,0 @@ });

import { DocumentNode } from 'graphql';
import { Transaction } from '../core/cache';
import { StoreValue } from '../../utilities/graphql/storeUtils';
import { Modifiers } from './entityStore';
export { StoreValue };

@@ -15,2 +16,3 @@ export interface IdGetterObj extends Object {

merge(dataId: string, incoming: StoreObject): void;
modify(dataId: string, modifiers: Modifiers | Modifiers[string]): boolean;
delete(dataId: string, fieldName?: string): boolean;

@@ -30,2 +32,3 @@ clear(): void;

}
export declare type SafeReadonly<T> = T extends object ? Readonly<T> : T;
export declare type OptimisticStoreItem = {

@@ -32,0 +35,0 @@ id: string;

import { SelectionSetNode, DocumentNode } from 'graphql';
import { FragmentMap } from '../../utilities/graphql/fragments';
import { Policies, FieldValueGetter } from './policies';
import { Policies } from './policies';
import { FieldValueGetter } from './entityStore';
import { NormalizedCache } from './types';

@@ -5,0 +6,0 @@ export declare type WriteContext = {

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

import { makeProcessedFieldsMerger } from './helpers.js';
import { defaultNormalizedCacheFactory } from './entityStore.js';
import { defaultNormalizedCacheFactory, makeFieldValueGetter } from './entityStore.js';

@@ -33,3 +33,3 @@ var StoreWriter = (function () {

fragmentMap: createFragmentMap(getFragmentDefinitions(query)),
getFieldValue: this.policies.makeFieldValueGetter(store),
getFieldValue: makeFieldValueGetter(store),
},

@@ -36,0 +36,0 @@ });

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

else {
process.env.NODE_ENV === "production" ? invariant(false, 26) : invariant(false, 'To use context.getCacheKey, you need to use a cache that has ' +
process.env.NODE_ENV === "production" ? invariant(false, 15) : invariant(false, 'To use context.getCacheKey, you need to use a cache that has ' +
'a configurable dataIdFromObject, like apollo-cache-inmemory.');

@@ -194,3 +194,3 @@ }

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

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

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

this.fetchQueryRejectFns.forEach(function (reject) {
reject(process.env.NODE_ENV === "production" ? new InvariantError(15) : new InvariantError('QueryManager stopped while query was in flight'));
reject(process.env.NODE_ENV === "production" ? new InvariantError(17) : new InvariantError('QueryManager stopped while query was in flight'));
});

@@ -61,4 +61,4 @@ };

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, 18) : 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', 19) : invariant(!fetchPolicy || fetchPolicy === 'no-cache', "Mutations only support a 'no-cache' fetchPolicy. If you don't want to disable the cache, remove your fetchPolicy setting to proceed with the default mutation behavior.");
mutationId = this.generateQueryId();

@@ -458,3 +458,3 @@ mutation = this.transform(mutation).document;

if (shouldSubscribe === void 0) { shouldSubscribe = true; }
process.env.NODE_ENV === "production" ? invariant(options.fetchPolicy !== 'standby', 18) : invariant(options.fetchPolicy !== 'standby', 'client.watchQuery cannot be called with fetchPolicy set to "standby"');
process.env.NODE_ENV === "production" ? invariant(options.fetchPolicy !== 'standby', 20) : invariant(options.fetchPolicy !== 'standby', 'client.watchQuery cannot be called with fetchPolicy set to "standby"');
options.variables = this.getVariables(options.query, options.variables);

@@ -484,7 +484,7 @@ if (typeof options.notifyOnNetworkStatusChange === 'undefined') {

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

@@ -557,3 +557,3 @@ var watchedQuery = _this.watchQuery(options, false);

this.fetchQueryRejectFns.forEach(function (reject) {
reject(process.env.NODE_ENV === "production" ? new InvariantError(23) : new InvariantError('Store reset while query was in flight (not completed in link chain)'));
reject(process.env.NODE_ENV === "production" ? new InvariantError(25) : new InvariantError('Store reset while query was in flight (not completed in link chain)'));
});

@@ -677,3 +677,3 @@ var resetIds = [];

var foundObservableQuery = this.getQuery(queryIdOrObservable).observableQuery;
process.env.NODE_ENV === "production" ? invariant(foundObservableQuery, 24) : invariant(foundObservableQuery, "ObservableQuery with this id doesn't exist: " + queryIdOrObservable);
process.env.NODE_ENV === "production" ? invariant(foundObservableQuery, 26) : invariant(foundObservableQuery, "ObservableQuery with this id doesn't exist: " + queryIdOrObservable);
observableQuery = foundObservableQuery;

@@ -867,3 +867,3 @@ }

var pollInterval = options.pollInterval;
process.env.NODE_ENV === "production" ? invariant(pollInterval, 25) : invariant(pollInterval, 'Attempted to start a polling query without a polling interval.');
process.env.NODE_ENV === "production" ? invariant(pollInterval, 27) : invariant(pollInterval, 'Attempted to start a polling query without a polling interval.');
if (!this.ssrMode) {

@@ -870,0 +870,0 @@ var info = this.pollingInfoByQueryId.get(queryId);

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

previousQuery.document === query.document ||
equal(previousQuery.document, query.document), 42) : invariant(!previousQuery ||
equal(previousQuery.document, query.document), 49) : 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');

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

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 ' +
throw process.env.NODE_ENV === "production" ? new InvariantError(14) : new InvariantError('"fetch" has not been found globally and no fetcher has been ' +
'configured. To fix this, install a fetch package ' +

@@ -11,0 +11,0 @@ ("(like https://www.npmjs.com/package/" + library + "), instantiate the ") +

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

catch (e) {
var parseError = process.env.NODE_ENV === "production" ? new InvariantError(14) : 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-beta.32",
"version": "3.0.0-beta.32-james",
"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, 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 };

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

if (definition.kind === 'OperationDefinition') {
throw process.env.NODE_ENV === "production" ? new InvariantError(47) : new InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " +
throw process.env.NODE_ENV === "production" ? new InvariantError(46) : 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, 48) : 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, 47) : 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, 49) : invariant(fragment, "No fragment named " + selection.name.value + ".");
process.env.NODE_ENV === "production" ? invariant(fragment, 48) : invariant(fragment, "No fragment named " + selection.name.value + ".");
return fragment;

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

@@ -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.");

@@ -70,3 +70,3 @@ return { directive: directive, ifArgument: ifArgument };

if (definition.kind === 'OperationDefinition') {
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(47) : new tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " +
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(46) : new tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " +
'No operations are allowed when using a fragment as a query. Only fragments are allowed.');

@@ -79,3 +79,3 @@ }

if (typeof actualFragmentName === 'undefined') {
process.env.NODE_ENV === "production" ? tsInvariant.invariant(fragments.length === 1, 48) : 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, 47) : tsInvariant.invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.");
actualFragmentName = fragments[0].name.value;

@@ -117,3 +117,3 @@ }

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

@@ -120,0 +120,0 @@ }

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