Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@envelop/validation-cache
Advanced tools
This plugins adds simple LRU caching to your `validate`, to improve performance by caching the validation result.
@envelop/validation-cache is a plugin for GraphQL that provides caching for validation results. This can significantly improve the performance of GraphQL servers by avoiding redundant validation of the same queries.
Validation Caching
This feature allows you to cache the results of GraphQL query validations. By using the `useValidationCache` plugin, you can avoid re-validating the same queries, thus improving performance.
const { envelop } = require('@envelop/core');
const { useValidationCache } = require('@envelop/validation-cache');
const getEnveloped = envelop({
plugins: [
useValidationCache(),
],
});
graphql-query-complexity is a package that helps in limiting the complexity of GraphQL queries to prevent abuse. While it doesn't cache validation results, it provides a way to control the resource usage of queries, which can complement the functionality of @envelop/validation-cache.
graphql-cost-analysis is another package that helps in analyzing and limiting the cost of GraphQL queries. It focuses on preventing expensive queries from being executed, which can be used alongside @envelop/validation-cache to ensure both performance and security.
graphql-depth-limit is a package that restricts the depth of GraphQL queries to prevent overly complex queries. This can be used in conjunction with @envelop/validation-cache to ensure that only queries of acceptable complexity are cached and executed.
@envelop/validation-cache
This plugins adds simple LRU caching to your validate
, to improve performance by caching the
validation result.
This plugins improves performance of validating by ~50% (based on benchmarks).
yarn add @envelop/validation-cache
import { execute, parse, specifiedRules, subscribe, validate } from 'graphql'
import { envelop, useEngine } from '@envelop/core'
import { useValidationCache } from '@envelop/validation-cache'
const getEnveloped = envelop({
plugins: [
useEngine({ parse, validate, specifiedRules, execute, subscribe }),
// ... other plugins ...
useValidationCache({
// options goes here
})
]
})
cache
Set this to pass in a cache instance. By default a new LRU cache is created using default max
and
ttl
.
FAQs
This plugins adds simple LRU caching to your `validate`, to improve performance by caching the validation result.
We found that @envelop/validation-cache demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.