
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
query-client
Advanced tools
A lightweight and efficient query client for managing server state in JavaScript/TypeScript applications. Features include automatic caching, garbage collection, retry logic, and subscription-based updates.
Una ligera y poderosa biblioteca en TypeScript para la gestión de datos asíncronos y el almacenamiento en caché. QueryClient simplifica la lógica de manejo de peticiones, reintentos, cacheo y recolección de basura, permitiendo a los desarrolladores centrarse en la lógica de negocio.
staleTime): Define cuándo los datos en caché deben considerarse caducados y ser refrescados.gcTime): Elimina automáticamente las queries inactivas del caché para optimizar la memoria.Instala el paquete usando npm o yarn:
npm install query-client
# o
yarn add query-client
import { QueryClient } from 'query-client';
// Obtener la instancia singleton
const client = QueryClient.getInstance();
// Configurar el cliente (opcional)
client.setConfig({
retry: 2,
staleTime: 1000 * 60, // 1 minuto
});
const myQueryFn = async () => {
const response = await fetch('https://api.example.com/data');
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
};
async function fetchData() {
try {
// La primera vez, hará la petición. La segunda, usará el caché.
const response = await client.fetchQuery({
queryKey: ['my-data'],
queryFn: myQueryFn,
});
console.log('Datos obtenidos:', response.data.data);
} catch (error) {
console.error('Error al obtener los datos:', error);
}
}
// Forzar una nueva petición invalidando la caché
client.invalidateQueryData({ queryKey: ['my-data'] });
// La próxima llamada a fetchQuery hará una nueva petición
client.fetchQuery({
queryKey: ['my-data'],
queryFn: myQueryFn,
});
¡Las contribuciones son bienvenidas! Si encuentras un bug o tienes una sugerencia, por favor, abre un issue o un pull request.
Este proyecto está bajo la Licencia MIT. Para más detalles, consulta el archivo LICENSE.
Ivan - @ElJijuna
FAQs
A lightweight and efficient query client for managing server state in JavaScript/TypeScript applications. Features include automatic caching, garbage collection, retry logic, and subscription-based updates.
We found that query-client demonstrated a healthy version release cadence and project activity because the last version was released less than 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.