New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@nerdwallet/apollo-cache-policies

Package Overview
Dependencies
Maintainers
7
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nerdwallet/apollo-cache-policies - npm Package Compare versions

Comparing version 2.7.0 to 2.8.0

dist/hooks/types.d.ts

5

CHANGELOG.md

@@ -0,1 +1,6 @@

2.8.0 (Dan Reynolds)
* Add support for reactive filter changes in `useFragmentWhere`.
* Adds `writeFragmentWhere` API.
2.7.0 (Dan Reynolds)

@@ -2,0 +7,0 @@

4

dist/cache/InvalidationPolicyCache.d.ts

@@ -52,3 +52,7 @@ import { InMemoryCache, Cache, NormalizedCacheObject, Reference, StoreObject } from "@apollo/client/core";

}): readonly Reference[];
writeFragmentWhere<FragmentType, TVariables = any>(options: Cache.ReadFragmentOptions<FragmentType, TVariables> & {
filter?: FragmentWhereFilter<FragmentType>;
update: (entity: FragmentType) => FragmentType;
}): void;
}
//# sourceMappingURL=InvalidationPolicyCache.d.ts.map

@@ -419,4 +419,17 @@ "use strict";

}
writeFragmentWhere(options) {
const { update } = options, readOptions = __rest(options, ["update"]);
this.readFragmentWhere(readOptions).forEach((entity) => {
this.writeFragment({
// @ts-ignore This
id: this.identify(entity),
fragment: options.fragment,
data: update(entity),
broadcast: false,
});
});
this.broadcastWatches();
}
}
exports.default = InvalidationPolicyCache;
//# sourceMappingURL=InvalidationPolicyCache.js.map

2

dist/client/ApolloExtensionsClient.d.ts

@@ -8,5 +8,5 @@ import { ApolloClient, ApolloClientOptions, ObservableQuery } from '@apollo/client/core';

private watchQueryForField;
watchFragment(options: WatchFragmentOptions): ObservableQuery;
watchFragment(options: WatchFragmentOptions): ObservableQuery<any, import("@apollo/client/core").OperationVariables>;
watchFragmentWhere<FragmentType>(options: WatchFragmentWhereOptions<FragmentType>): ObservableQuery<any, import("@apollo/client/core").OperationVariables>;
}
//# sourceMappingURL=ApolloExtensionsClient.d.ts.map

@@ -63,3 +63,5 @@ "use strict";

const fieldName = helpers_1.generateFragmentFieldName();
const query = utils_1.buildWatchFragmentWhereQuery(Object.assign(Object.assign({}, options), { fieldName, cache: this.cache, policies: this.policies }));
const filterVar = core_1.makeVar(options.filter);
const query = utils_1.buildWatchFragmentWhereQuery(Object.assign(Object.assign({}, options), { fieldName,
filterVar, cache: this.cache, policies: this.policies }));
return this.watchQueryForField(query, fieldName);

@@ -66,0 +68,0 @@ }

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

import { Policies } from '@apollo/client/cache/inmemory/policies';
import { ReactiveVar } from '@apollo/client/core';
import { FragmentWhereFilter } from '../cache/types';
export declare function buildWatchFragmentQuery(options: WatchFragmentOptions & {

@@ -13,4 +15,5 @@ fieldName: string;

policies: Policies;
filterVar: ReactiveVar<FragmentWhereFilter<FragmentType> | undefined>;
fieldName: string;
}): DocumentNode;
//# sourceMappingURL=utils.d.ts.map

@@ -67,3 +67,3 @@ "use strict";

function buildWatchFragmentWhereQuery(options) {
const { fragment, filter, policies, cache, fieldName, } = options;
const { fragment, filterVar, policies, cache, fieldName, } = options;
const fragmentDefinition = fragment.definitions[0];

@@ -86,3 +86,3 @@ const __typename = fragmentDefinition.typeCondition.name.value;

__typename,
filter,
filter: filterVar(),
});

@@ -89,0 +89,0 @@ }

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

const useGetQueryDataByFieldName_1 = require("./useGetQueryDataByFieldName");
const client_2 = require("@apollo/client");
const useDeepMemo_1 = require("@apollo/client/react/hooks/utils/useDeepMemo");
// A hook for subscribing to a fragment for entities in the Apollo cache matching a given filter from a React component.

@@ -16,4 +18,8 @@ function useFragmentWhere(fragment, filter) {

const fieldName = useFragmentTypePolicyFieldName_1.useFragmentTypePolicyFieldName();
const filterVarRef = react_1.useRef(client_2.makeVar(filter));
const filterVar = filterVarRef.current;
useDeepMemo_1.useDeepMemo(() => filterVar(filter), filter);
const query = utils_2.useOnce(() => utils_1.buildWatchFragmentWhereQuery({
filter,
filterVar,
fragment,

@@ -20,0 +26,0 @@ fieldName,

{
"name": "@nerdwallet/apollo-cache-policies",
"version": "2.7.0",
"version": "2.8.0",
"description": "An extension to the InMemoryCache from Apollo that adds additional cache policies.",

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

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