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

mercurius-cache

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mercurius-cache - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

examples/invalidation.js

6

index.d.ts

@@ -13,3 +13,3 @@ import { FastifyPluginAsync } from "fastify";

export type PolicyFieldName = string;
export type PolicyField = Record<PolicyFieldName, PolicyFieldOptions | object>;
export type PolicyField = Record<PolicyFieldName, PolicyFieldOptions | object | boolean>;
export type PolicyName = string;

@@ -21,3 +21,3 @@ export type MercuriusCachePolicy = Record<PolicyName, PolicyField>;

log?: object;
invalidate?: boolean;
invalidation?: boolean;
}

@@ -28,3 +28,3 @@

log?: object;
invalidate?: boolean | { invalidate: boolean; referencesTTL?: number };
invalidation?: boolean | { invalidate: boolean; referencesTTL?: number };
}

@@ -31,0 +31,0 @@

@@ -152,8 +152,8 @@ 'use strict'

if (_storage.type === 'redis' && maxTTL && _storage.options.invalidate &&
(typeof _storage.options.invalidate === 'boolean' || (_storage.options.invalidate && !_storage.options.invalidate.referencesTTL))) {
if (_storage.type === 'redis' && maxTTL && _storage.options.invalidation &&
(typeof _storage.options.invalidation === 'boolean' || (_storage.options.invalidation && !_storage.options.invalidation.referencesTTL))) {
_storage.options = {
..._storage.options,
invalidate: {
..._storage.options.invalidate,
invalidation: {
..._storage.options.invalidation,
referencesTTL: maxTTL + 1

@@ -160,0 +160,0 @@ }

{
"name": "mercurius-cache",
"version": "1.2.0",
"version": "1.3.0",
"description": "Cache the results of your GraphQL resolvers, for Mercurius",

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

@@ -76,6 +76,6 @@ 'use strict'

test('should get default storage.options.invalidate.referencesTTL as max of policies and main ttl / invalidation as boolean true', async (t) => {
test('should get default storage.options.invalidation.referencesTTL as max of policies and main ttl / invalidation as boolean true', async (t) => {
const options = {
ttl: 1,
storage: { type: 'redis', options: { client: {}, invalidate: true } },
storage: { type: 'redis', options: { client: {}, invalidation: true } },
policy: {

@@ -93,9 +93,9 @@ Query: {

t.equal(storage.options.invalidate.referencesTTL, 6)
t.equal(storage.options.invalidation.referencesTTL, 6)
})
test('should get default storage.options.invalidate.referencesTTL as max of policies and main ttl / invalidation as empty object', async (t) => {
test('should get default storage.options.invalidation.referencesTTL as max of policies and main ttl / invalidation as empty object', async (t) => {
const options = {
ttl: 1,
storage: { type: 'redis', options: { client: {}, invalidate: {} } },
storage: { type: 'redis', options: { client: {}, invalidation: {} } },
policy: {

@@ -113,3 +113,3 @@ Query: {

t.equal(storage.options.invalidate.referencesTTL, 6)
t.equal(storage.options.invalidation.referencesTTL, 6)
})

@@ -120,3 +120,3 @@

ttl: 1,
storage: { type: 'redis', options: { client: {}, invalidate: true } },
storage: { type: 'redis', options: { client: {}, invalidation: true } },
all: true

@@ -123,0 +123,0 @@ }

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