Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apollo-client

Package Overview
Dependencies
Maintainers
2
Versions
309
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 0.4.11 to 0.4.12

25

batching/queryMerging.d.ts

@@ -1,18 +0,19 @@

import { OperationDefinition, Field, FragmentDefinition, FragmentSpread, InlineFragment, Document, SelectionSet, VariableDefinition, Variable, GraphQLResult } from 'graphql';
import { OperationDefinition, Field, FragmentDefinition, FragmentSpread, Document, SelectionSet, VariableDefinition, Variable, GraphQLResult } from 'graphql';
import { FragmentMap } from '../queries/getFromAST';
import { Request } from '../networkInterface';
export declare function mergeRequests(requests: Request[]): Request;
export declare function unpackMergedResult(result: GraphQLResult, childRequests: Request[]): GraphQLResult[];
export declare function createFieldMapsForRequests(requests: Request[]): {
[index: number]: Field;
}[];
export declare function createFieldMap(selections: (Field | InlineFragment | FragmentSpread)[], startIndex?: number): {
fieldMap: {
[index: number]: Field;
};
export declare type UnpackOptions = {
request: Request;
data: Object;
selectionSet?: SelectionSet;
queryIndex: number;
startIndex: number;
fragmentMap: FragmentMap;
topLevel: boolean;
};
export declare function unpackDataForRequest({request, data, selectionSet, queryIndex, startIndex, fragmentMap, topLevel}: UnpackOptions): {
newIndex: number;
unpackedData: Object;
};
export declare function parseMergedKey(key: string): {
requestIndex: number;
fieldIndex: number;
};
export declare function mergeQueryDocuments(childQueryDocs: Document[]): Document;

@@ -19,0 +20,0 @@ export declare function addVariablesToRoot(rootVariables: {

@@ -6,2 +6,5 @@ "use strict";

var cloneDeep = require('lodash.clonedeep');
var isArray = require('lodash.isarray');
var isNull = require('lodash.isnull');
var isUndefined = require('lodash.isundefined');
function mergeRequests(requests) {

@@ -26,17 +29,13 @@ var rootQueryDoc = createEmptyRootQueryDoc();

function unpackMergedResult(result, childRequests) {
var resultArray = new Array(childRequests.length);
var fieldMaps = createFieldMapsForRequests(childRequests);
Object.keys(result.data).forEach(function (dataKey) {
var data = {};
var mergeInfo = parseMergedKey(dataKey);
var childRequestIndex = mergeInfo.requestIndex;
var fieldMap = fieldMaps[childRequestIndex];
var field = fieldMap[mergeInfo.fieldIndex];
data[storeUtils_1.resultKeyNameFromField(field)] = result.data[dataKey];
if (resultArray[childRequestIndex]) {
assign(resultArray[childRequestIndex].data, data);
}
else {
resultArray[childRequestIndex] = { data: data };
}
var resultArray = childRequests.map(function (request, index) {
var unpackedData = unpackDataForRequest({
request: request,
data: result.data,
selectionSet: getFromAST_1.getQueryDefinition(request.query).selectionSet,
queryIndex: index,
startIndex: 0,
fragmentMap: getFromAST_1.createFragmentMap(getFromAST_1.getFragmentDefinitions(request.query)),
topLevel: true,
}).unpackedData;
return { data: unpackedData };
});

@@ -46,50 +45,100 @@ return resultArray;

exports.unpackMergedResult = unpackMergedResult;
function createFieldMapsForRequests(requests) {
var res = new Array(requests.length);
requests.forEach(function (request, requestIndex) {
var operationDef = getFromAST_1.getQueryDefinition(request.query);
var fragmentDefs = getFromAST_1.getFragmentDefinitions(request.query);
var fieldMap = {};
[operationDef].concat(fragmentDefs).forEach(function (def) {
assign(fieldMap, createFieldMap(def.selectionSet.selections).fieldMap);
});
res[requestIndex] = fieldMap;
});
return res;
}
exports.createFieldMapsForRequests = createFieldMapsForRequests;
function createFieldMap(selections, startIndex) {
if (!startIndex) {
startIndex = 0;
function unpackDataForRequest(_a) {
var request = _a.request, data = _a.data, selectionSet = _a.selectionSet, queryIndex = _a.queryIndex, startIndex = _a.startIndex, fragmentMap = _a.fragmentMap, topLevel = _a.topLevel;
if (!selectionSet) {
return {
newIndex: startIndex,
unpackedData: {},
};
}
var fieldMap = {};
var unpackedData = {};
var currIndex = startIndex;
selections.forEach(function (selection) {
selectionSet.selections.forEach(function (selection) {
if (selection.kind === 'Field') {
fieldMap[currIndex] = selection;
currIndex += 1;
var field = selection;
var realName = storeUtils_1.resultKeyNameFromField(field);
var aliasName = getOperationDefinitionName(getFromAST_1.getQueryDefinition(request.query), queryIndex);
var stringKey = topLevel ? aliasName + "___fieldIndex_" + currIndex : realName;
if (topLevel) {
currIndex += 1;
}
var childData = isNull(data) ? null : data[stringKey];
var resData = childData;
if (field.selectionSet && field.selectionSet.selections.length > 0) {
var fieldOpts_1 = {
request: request,
data: childData,
selectionSet: field.selectionSet,
queryIndex: queryIndex,
fragmentMap: fragmentMap,
startIndex: currIndex,
topLevel: false,
};
if (isNull(childData)) {
var selectionRet = unpackDataForRequest(assign(fieldOpts_1, {
startIndex: currIndex,
}));
currIndex = selectionRet.newIndex;
resData = childData;
}
else if (isArray(childData)) {
var resUnpacked_1 = [];
var newIndex_1 = 0;
childData.forEach(function (dataObject) {
var selectionRet = unpackDataForRequest(assign(fieldOpts_1, {
data: dataObject,
startIndex: currIndex,
}));
newIndex_1 = selectionRet.newIndex;
resUnpacked_1.push(selectionRet.unpackedData);
});
currIndex = newIndex_1;
resData = resUnpacked_1;
}
else {
var selectionRet = unpackDataForRequest(assign(fieldOpts_1, { startIndex: currIndex }));
resData = selectionRet.unpackedData;
currIndex = selectionRet.newIndex;
}
}
if (!isUndefined(childData)) {
unpackedData[realName] = resData;
}
}
else if (selection.kind === 'InlineFragment') {
var inlineFragment = selection;
var ret = createFieldMap(inlineFragment.selectionSet.selections, currIndex);
assign(fieldMap, ret.fieldMap);
var ret = unpackDataForRequest({
request: request,
data: data,
selectionSet: inlineFragment.selectionSet,
queryIndex: queryIndex,
startIndex: currIndex,
fragmentMap: fragmentMap,
topLevel: topLevel,
});
assign(unpackedData, ret.unpackedData);
currIndex = ret.newIndex;
}
else if (selection.kind === 'FragmentSpread') {
var fragmentSpread = selection;
var fragment = fragmentMap[fragmentSpread.name.value];
var fragmentRet = unpackDataForRequest({
request: request,
data: data,
selectionSet: fragment.selectionSet,
queryIndex: queryIndex,
startIndex: currIndex,
fragmentMap: fragmentMap,
topLevel: true,
});
assign(unpackedData, fragmentRet.unpackedData);
currIndex = fragmentRet.newIndex;
}
});
return {
fieldMap: fieldMap,
newIndex: currIndex,
unpackedData: unpackedData,
};
}
exports.createFieldMap = createFieldMap;
function parseMergedKey(key) {
var pieces = key.split('___');
var requestIndexPiece = pieces[2].split('_');
var fieldIndexPiece = pieces[3].split('_');
return {
requestIndex: parseInt(requestIndexPiece[1], 10),
fieldIndex: parseInt(fieldIndexPiece[1], 10),
};
}
exports.parseMergedKey = parseMergedKey;
exports.unpackDataForRequest = unpackDataForRequest;
function mergeQueryDocuments(childQueryDocs) {

@@ -96,0 +145,0 @@ var rootQueryDoc = createEmptyRootQueryDoc();

@@ -32,1 +32,2 @@ import { NormalizedCache } from './store';

}): DiffResult;
export declare function removeUnusedVariablesFromQuery(query: Document): void;

@@ -11,2 +11,3 @@ "use strict";

var errors_1 = require('../errors');
var flatten = require('lodash.flatten');
function diffQueryAgainstStore(_a) {

@@ -266,2 +267,47 @@ var store = _a.store, query = _a.query, variables = _a.variables;

}
function collectUsedVariablesFromSelectionSet(selectionSet) {
return uniq(flatten(selectionSet.selections.map(function (selection) {
if (storeUtils_1.isField(selection)) {
return collectUsedVariablesFromField(selection);
}
else if (storeUtils_1.isInlineFragment(selection)) {
return collectUsedVariablesFromSelectionSet(selection.selectionSet);
}
else {
return [];
}
})));
}
function collectUsedVariablesFromField(field) {
var variables = [];
if (field.arguments) {
variables = flatten(field.arguments.map(function (arg) {
if (arg.value.kind === 'Variable') {
return [arg.value.name.value];
}
return [];
}));
}
if (field.selectionSet) {
variables = variables.concat(collectUsedVariablesFromSelectionSet(field.selectionSet));
}
return uniq(variables);
}
function removeUnusedVariablesFromQuery(query) {
var queryDef = getFromAST_1.getQueryDefinition(query);
var usedVariables = flatten(query.definitions.map(function (def) { return collectUsedVariablesFromSelectionSet(def.selectionSet); }));
if (!queryDef.variableDefinitions) {
return;
}
var diffedVariableDefinitions = queryDef.variableDefinitions.filter(function (variableDefinition) {
return usedVariables.indexOf(variableDefinition.variable.name.value) !== -1;
});
queryDef.variableDefinitions = diffedVariableDefinitions;
}
exports.removeUnusedVariablesFromQuery = removeUnusedVariablesFromQuery;
function uniq(array) {
return array.filter(function (item, index, arr) {
return arr.indexOf(item) === index;
});
}
//# sourceMappingURL=diffAgainstStore.js.map

@@ -21,2 +21,6 @@ import 'whatwg-fetch';

}
export interface SubscriptionNetworkInterface extends NetworkInterface {
subscribe(request: Request, handler: (error, result) => void): number;
unsubscribe(id: Number): void;
}
export interface BatchedNetworkInterface extends NetworkInterface {

@@ -23,0 +27,0 @@ batchQuery(requests: Request[]): Promise<GraphQLResult[]>;

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

import { WatchQueryOptions, FetchMoreQueryOptions } from './watchQueryOptions';
import { WatchQueryOptions, FetchMoreQueryOptions, GraphQLSubscriptionOptions } from './watchQueryOptions';
import { Observable } from './util/Observable';

@@ -11,5 +11,10 @@ import { QueryScheduler } from './scheduler';

}
export interface UpdateQueryOptions {
queryVariables: Object;
}
export declare class ObservableQuery extends Observable<ApolloQueryResult> {
refetch: (variables?: any) => Promise<ApolloQueryResult>;
fetchMore: (options: FetchMoreQueryOptions & FetchMoreOptions) => Promise<any>;
startGraphQLSubscription: (options: GraphQLSubscriptionOptions) => number;
updateQuery: (mapFn: (previousQueryResult: any, options: UpdateQueryOptions) => any) => void;
stopPolling: () => void;

@@ -16,0 +21,0 @@ startPolling: (p: number) => void;

@@ -78,18 +78,53 @@ "use strict";

var reducer = fetchMoreOptions.updateQuery;
var _a = _this.queryManager.getQueryWithPreviousResult(_this.queryId), previousResult = _a.previousResult, queryVariables = _a.queryVariables, querySelectionSet = _a.querySelectionSet, _b = _a.queryFragments, queryFragments = _b === void 0 ? [] : _b;
var newResult = errorHandling_1.tryFunctionOrLogError(function () { return reducer(previousResult, {
fetchMoreResult: fetchMoreResult,
queryVariables: queryVariables,
}); });
if (newResult) {
_this.queryManager.store.dispatch({
type: 'APOLLO_UPDATE_QUERY_RESULT',
newResult: newResult,
var mapFn = function (previousResult, _a) {
var queryVariables = _a.queryVariables;
return reducer(previousResult, {
fetchMoreResult: fetchMoreResult,
queryVariables: queryVariables,
querySelectionSet: querySelectionSet,
queryFragments: queryFragments,
});
}
};
_this.updateQuery(mapFn);
});
};
this.startGraphQLSubscription = function (graphQLSubscriptionOptions) {
var subOptions = {
query: graphQLSubscriptionOptions.subscription,
variables: graphQLSubscriptionOptions.variables,
fragments: graphQLSubscriptionOptions.fragments,
handler: function (error, result) {
var reducer = graphQLSubscriptionOptions.updateFunction;
if (error) {
throw new Error(JSON.stringify(error));
}
else {
var mapFn = function (previousResult, _a) {
var queryVariables = _a.queryVariables;
return reducer(previousResult, {
subscriptionResult: result,
queryVariables: queryVariables,
});
};
_this.updateQuery(mapFn);
}
},
};
if (graphQLSubscriptionOptions) {
return _this.queryManager.startSubscription(subOptions);
}
;
return null;
};
this.updateQuery = function (mapFn) {
var _a = _this.queryManager.getQueryWithPreviousResult(_this.queryId), previousResult = _a.previousResult, queryVariables = _a.queryVariables, querySelectionSet = _a.querySelectionSet, _b = _a.queryFragments, queryFragments = _b === void 0 ? [] : _b;
var newResult = errorHandling_1.tryFunctionOrLogError(function () { return mapFn(previousResult, { queryVariables: queryVariables }); });
if (newResult) {
_this.queryManager.store.dispatch({
type: 'APOLLO_UPDATE_QUERY_RESULT',
newResult: newResult,
queryVariables: queryVariables,
querySelectionSet: querySelectionSet,
queryFragments: queryFragments,
});
}
};
this.stopPolling = function () {

@@ -96,0 +131,0 @@ _this.queryManager.stopQuery(_this.queryId);

{
"name": "apollo-client",
"version": "0.4.11",
"version": "0.4.12",
"description": "A simple yet functional GraphQL client.",

@@ -58,3 +58,3 @@ "main": "index.js",

"grunt": "1.0.1",
"grunt-tslint": "3.1.0",
"grunt-tslint": "3.2.0",
"gzip-size": "^3.0.0",

@@ -61,0 +61,0 @@ "isomorphic-fetch": "^2.2.1",

@@ -14,2 +14,10 @@ import { NetworkInterface } from './networkInterface';

export declare type QueryListener = (queryStoreValue: QueryStoreValue) => void;
export interface SubscriptionOptions {
query: Document;
variables?: {
[key: string]: any;
};
fragments?: FragmentDefinition[];
handler: (error: Object, result: Object) => void;
}
export declare class QueryManager {

@@ -67,2 +75,3 @@ pollingTimers: {

startQuery(queryId: string, options: WatchQueryOptions, listener: QueryListener): string;
startSubscription(options: SubscriptionOptions): number;
stopQuery(queryId: string): void;

@@ -78,3 +87,6 @@ getQueryWithPreviousResult(queryId: string, isOptimistic?: boolean): {

private collectResultBehaviorsFromUpdateQueries(updateQueries, mutationResult, isOptimistic?);
private fetchQueryOverInterface(queryId, options, network);
private transformQueryDocument(options);
private handleDiffQuery({queryDef, rootId, variables, fragmentMap, noFetch});
private fetchRequest({requestId, queryId, query, querySS, options, fragmentMap, networkInterface});
private fetchQueryOverInterface(queryId, options, networkInterface);
private refetchQueryByName(queryName);

@@ -81,0 +93,0 @@ private isDifferentResult(queryId, result);

@@ -16,2 +16,3 @@ "use strict";

var ObservableQuery_1 = require('./ObservableQuery');
;
var QueryManager = (function () {

@@ -282,2 +283,16 @@ function QueryManager(_a) {

};
QueryManager.prototype.startSubscription = function (options) {
var query = options.query, variables = options.variables, _a = options.fragments, fragments = _a === void 0 ? [] : _a, handler = options.handler;
var queryDoc = getFromAST_1.addFragmentsToDocument(query, fragments);
if (this.queryTransformer) {
queryDoc = queryTransform_1.applyTransformers(queryDoc, [this.queryTransformer]);
}
var request = {
query: queryDoc,
variables: variables,
operationName: getFromAST_1.getOperationName(queryDoc),
};
return this.networkInterface.subscribe(request, handler);
};
;
QueryManager.prototype.stopQuery = function (queryId) {

@@ -355,5 +370,4 @@ delete this.queryListeners[queryId];

};
QueryManager.prototype.fetchQueryOverInterface = function (queryId, options, network) {
var _this = this;
var query = options.query, variables = options.variables, _a = options.forceFetch, forceFetch = _a === void 0 ? false : _a, _b = options.returnPartialData, returnPartialData = _b === void 0 ? false : _b, _c = options.noFetch, noFetch = _c === void 0 ? false : _c, _d = options.fragments, fragments = _d === void 0 ? [] : _d;
QueryManager.prototype.transformQueryDocument = function (options) {
var query = options.query, _a = options.fragments, fragments = _a === void 0 ? [] : _a;
var queryDoc = getFromAST_1.addFragmentsToDocument(query, fragments);

@@ -363,3 +377,89 @@ if (this.queryTransformer) {

}
var queryFragmentMap = getFromAST_1.createFragmentMap(getFromAST_1.getFragmentDefinitions(queryDoc));
return {
queryDoc: queryDoc,
fragmentMap: getFromAST_1.createFragmentMap(getFromAST_1.getFragmentDefinitions(queryDoc)),
};
};
QueryManager.prototype.handleDiffQuery = function (_a) {
var queryDef = _a.queryDef, rootId = _a.rootId, variables = _a.variables, fragmentMap = _a.fragmentMap, noFetch = _a.noFetch;
var _b = diffAgainstStore_1.diffSelectionSetAgainstStore({
selectionSet: queryDef.selectionSet,
store: this.store.getState()[this.reduxRootKey].data,
throwOnMissingField: false,
rootId: rootId,
variables: variables,
fragmentMap: fragmentMap,
}), missingSelectionSets = _b.missingSelectionSets, result = _b.result;
var initialResult = result;
var diffedQuery;
if (missingSelectionSets && missingSelectionSets.length && !noFetch) {
diffedQuery = queryPrinting_1.queryDocument({
missingSelectionSets: missingSelectionSets,
variableDefinitions: queryDef.variableDefinitions,
name: queryDef.name,
fragmentMap: fragmentMap,
});
diffAgainstStore_1.removeUnusedVariablesFromQuery(diffedQuery);
}
return {
diffedQuery: diffedQuery,
initialResult: initialResult,
};
};
QueryManager.prototype.fetchRequest = function (_a) {
var _this = this;
var requestId = _a.requestId, queryId = _a.queryId, query = _a.query, querySS = _a.querySS, options = _a.options, fragmentMap = _a.fragmentMap, networkInterface = _a.networkInterface;
var variables = options.variables, noFetch = options.noFetch, returnPartialData = options.returnPartialData;
var request = {
query: query,
variables: variables,
operationName: getFromAST_1.getOperationName(query),
};
var fetchRequest = {
options: { query: query, variables: variables },
queryId: queryId,
operationName: request.operationName,
};
var retPromise = new Promise(function (resolve, reject) {
_this.addFetchQueryPromise(requestId, retPromise, resolve, reject);
return _this.batcher.enqueueRequest(fetchRequest)
.then(function (result) {
_this.store.dispatch({
type: 'APOLLO_QUERY_RESULT',
result: result,
queryId: queryId,
requestId: requestId,
});
_this.removeFetchQueryPromise(requestId);
return result;
}).then(function () {
var resultFromStore;
try {
resultFromStore = readFromStore_1.readSelectionSetFromStore({
store: _this.getApolloState().data,
rootId: querySS.id,
selectionSet: querySS.selectionSet,
variables: variables,
returnPartialData: returnPartialData || noFetch,
fragmentMap: fragmentMap,
});
}
catch (e) { }
_this.removeFetchQueryPromise(requestId);
resolve({ data: resultFromStore, loading: false });
}).catch(function (error) {
_this.store.dispatch({
type: 'APOLLO_QUERY_ERROR',
error: error,
queryId: queryId,
requestId: requestId,
});
_this.removeFetchQueryPromise(requestId);
});
});
return retPromise;
};
QueryManager.prototype.fetchQueryOverInterface = function (queryId, options, networkInterface) {
var variables = options.variables, _a = options.forceFetch, forceFetch = _a === void 0 ? false : _a, _b = options.returnPartialData, returnPartialData = _b === void 0 ? false : _b, _c = options.noFetch, noFetch = _c === void 0 ? false : _c;
var _d = this.transformQueryDocument(options), queryDoc = _d.queryDoc, fragmentMap = _d.fragmentMap;
var queryDef = getFromAST_1.getQueryDefinition(queryDoc);

@@ -375,33 +475,25 @@ var queryString = printer_1.print(queryDoc);

var minimizedQueryDoc = queryDoc;
var initialResult;
var storeResult;
if (!forceFetch) {
var _e = diffAgainstStore_1.diffSelectionSetAgainstStore({
selectionSet: querySS.selectionSet,
store: this.store.getState()[this.reduxRootKey].data,
throwOnMissingField: false,
var _e = this.handleDiffQuery({
queryDef: queryDef,
rootId: querySS.id,
variables: variables,
fragmentMap: queryFragmentMap,
}), missingSelectionSets = _e.missingSelectionSets, result = _e.result;
initialResult = result;
if (missingSelectionSets && missingSelectionSets.length && !noFetch) {
var diffedQuery = queryPrinting_1.queryDocument({
missingSelectionSets: missingSelectionSets,
variableDefinitions: queryDef.variableDefinitions,
name: queryDef.name,
fragmentMap: queryFragmentMap,
});
var diffedQueryDef = getFromAST_1.getQueryDefinition(diffedQuery);
fragmentMap: fragmentMap,
noFetch: noFetch,
}), diffedQuery = _e.diffedQuery, initialResult = _e.initialResult;
storeResult = initialResult;
if (diffedQuery) {
minimizedQueryDoc = diffedQuery;
minimizedQueryString = printer_1.print(minimizedQueryDoc);
minimizedQuery = {
id: 'ROOT_QUERY',
id: querySS.id,
typeName: 'Query',
selectionSet: diffedQueryDef.selectionSet,
selectionSet: getFromAST_1.getQueryDefinition(diffedQuery).selectionSet,
};
minimizedQueryString = printer_1.print(diffedQuery);
minimizedQueryDoc = diffedQuery;
}
else {
minimizedQueryDoc = null;
minimizedQueryString = null;
minimizedQuery = null;
minimizedQueryString = null;
minimizedQueryDoc = null;
}

@@ -421,3 +513,3 @@ }

requestId: requestId,
fragmentMap: queryFragmentMap,
fragmentMap: fragmentMap,
});

@@ -427,5 +519,3 @@ if (!minimizedQuery || returnPartialData || noFetch) {

type: 'APOLLO_QUERY_RESULT_CLIENT',
result: {
data: initialResult,
},
result: { data: storeResult },
variables: variables,

@@ -437,55 +527,14 @@ query: querySS,

}
if (minimizedQuery) {
var request = {
if (minimizedQuery && !noFetch) {
return this.fetchRequest({
requestId: requestId,
queryId: queryId,
query: minimizedQueryDoc,
variables: variables,
operationName: getFromAST_1.getOperationName(minimizedQueryDoc),
};
var fetchRequest_1 = {
options: { query: minimizedQueryDoc, variables: variables },
queryId: queryId,
operationName: request.operationName,
};
var retPromise_1 = new Promise(function (resolve, reject) {
_this.addFetchQueryPromise(requestId, retPromise_1, resolve, reject);
return _this.batcher.enqueueRequest(fetchRequest_1)
.then(function (result) {
_this.store.dispatch({
type: 'APOLLO_QUERY_RESULT',
result: result,
queryId: queryId,
requestId: requestId,
});
_this.removeFetchQueryPromise(requestId);
return result;
}).then(function () {
var resultFromStore;
try {
resultFromStore = readFromStore_1.readSelectionSetFromStore({
store: _this.getApolloState().data,
rootId: querySS.id,
selectionSet: querySS.selectionSet,
variables: variables,
returnPartialData: returnPartialData || noFetch,
fragmentMap: queryFragmentMap,
});
}
catch (e) { }
_this.removeFetchQueryPromise(requestId);
resolve({ data: resultFromStore, loading: false });
}).catch(function (error) {
_this.store.dispatch({
type: 'APOLLO_QUERY_ERROR',
error: error,
queryId: queryId,
requestId: requestId,
});
_this.removeFetchQueryPromise(requestId);
});
querySS: minimizedQuery,
options: options,
fragmentMap: fragmentMap,
networkInterface: networkInterface,
});
return retPromise_1;
}
return new Promise(function (resolve) {
resolve({ data: initialResult });
});
return Promise.resolve({ data: storeResult });
};

@@ -492,0 +541,0 @@ QueryManager.prototype.refetchQueryByName = function (queryName) {

@@ -19,1 +19,12 @@ import { Document, FragmentDefinition } from 'graphql';

}
export interface GraphQLSubscriptionOptions {
subscription: Document;
variables?: {
[key: string]: any;
};
fragments?: FragmentDefinition[];
updateFunction: (previousQueryResult: Object, options: {
subscriptionResult: Object;
queryVariables: Object;
}) => Object;
}
"use strict";
;
//# sourceMappingURL=watchQueryOptions.js.map

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