New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.3.14 to 0.3.15

queries/directives.d.ts

9

data/diffAgainstStore.js

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

var getFromAST_1 = require('../queries/getFromAST');
var directives_1 = require('../queries/directives');
function diffQueryAgainstStore(_a) {

@@ -53,2 +54,3 @@ var store = _a.store, query = _a.query, variables = _a.variables;

if (storeUtils_1.isField(selection)) {
var includeField = directives_1.shouldInclude(selection, variables);
var _a = diffFieldAgainstStore({

@@ -61,2 +63,3 @@ field: selection,

fragmentMap: fragmentMap,
included: includeField,
}), fieldResult = _a.result, fieldIsMissing = _a.isMissing;

@@ -66,3 +69,3 @@ if (fieldIsMissing) {

}
else {
else if (includeField) {
var resultFieldKey = storeUtils_1.resultKeyNameFromField(selection);

@@ -137,7 +140,7 @@ result[resultFieldKey] = fieldResult;

function diffFieldAgainstStore(_a) {
var field = _a.field, throwOnMissingField = _a.throwOnMissingField, variables = _a.variables, rootId = _a.rootId, store = _a.store, fragmentMap = _a.fragmentMap;
var field = _a.field, throwOnMissingField = _a.throwOnMissingField, variables = _a.variables, rootId = _a.rootId, store = _a.store, fragmentMap = _a.fragmentMap, _b = _a.included, included = _b === void 0 ? true : _b;
var storeObj = store[rootId] || {};
var storeFieldKey = storeUtils_1.storeKeyNameFromField(field, variables);
if (!has(storeObj, storeFieldKey)) {
if (throwOnMissingField) {
if (throwOnMissingField && included) {
throw new Error("Can't find field " + storeFieldKey + " on object " + storeObj + ".");

@@ -144,0 +147,0 @@ }

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

var storeUtils_1 = require('./storeUtils');
var directives_1 = require('../queries/directives');
function writeFragmentToStore(_a) {

@@ -51,14 +52,20 @@ var result = _a.result, fragment = _a.fragment, _b = _a.store, store = _b === void 0 ? {} : _b, variables = _a.variables, _c = _a.dataIdFromObject, dataIdFromObject = _c === void 0 ? null : _c;

var value = result[resultFieldKey];
if (isUndefined(value)) {
var included = directives_1.shouldInclude(selection, variables);
if (isUndefined(value) && included) {
throw new Error("Can't find field " + resultFieldKey + " on result object " + dataId + ".");
}
writeFieldToStore({
dataId: dataId,
value: value,
variables: variables,
store: store,
field: selection,
dataIdFromObject: dataIdFromObject,
fragmentMap: fragmentMap,
});
if (!isUndefined(value) && !included) {
throw new Error("Found extra field " + resultFieldKey + " on result object " + dataId + ".");
}
if (!isUndefined(value)) {
writeFieldToStore({
dataId: dataId,
value: value,
variables: variables,
store: store,
field: selection,
dataIdFromObject: dataIdFromObject,
fragmentMap: fragmentMap,
});
}
}

@@ -65,0 +72,0 @@ else if (storeUtils_1.isInlineFragment(selection)) {

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

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -16,6 +16,7 @@ import { NormalizedCache } from './data/store';

export declare function createApolloReducer(config: ApolloReducerConfig): Function;
export declare function createApolloStore({reduxRootKey, initialState, config}?: {
export declare function createApolloStore({reduxRootKey, initialState, config, reportCrashes}?: {
reduxRootKey?: string;
initialState?: any;
config?: ApolloReducerConfig;
reportCrashes?: boolean;
}): ApolloStore;

@@ -22,0 +23,0 @@ export interface ApolloReducerConfig {

@@ -29,4 +29,7 @@ "use strict";

function createApolloStore(_a) {
var _b = _a === void 0 ? {} : _a, _c = _b.reduxRootKey, reduxRootKey = _c === void 0 ? 'apollo' : _c, initialState = _b.initialState, _d = _b.config, config = _d === void 0 ? {} : _d;
var _b = _a === void 0 ? {} : _a, _c = _b.reduxRootKey, reduxRootKey = _c === void 0 ? 'apollo' : _c, initialState = _b.initialState, _d = _b.config, config = _d === void 0 ? {} : _d, reportCrashes = _b.reportCrashes;
var enhancers = [];
if (reportCrashes === undefined) {
reportCrashes = true;
}
if (typeof window !== 'undefined') {

@@ -38,3 +41,5 @@ var anyWindow = window;

}
enhancers.push(redux_1.applyMiddleware(crashReporter));
if (reportCrashes) {
enhancers.push(redux_1.applyMiddleware(crashReporter));
}
return redux_1.createStore(redux_1.combineReducers((_e = {}, _e[reduxRootKey] = createApolloReducer(config), _e)), initialState, redux_1.compose.apply(void 0, enhancers));

@@ -41,0 +46,0 @@ var _e;

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