prisma-cache-nosql
Version:
<div> <a href="https://www.npmjs.com/package/prisma-cache-nosql"> <img alt="npm" src="https://img.shields.io/npm/v/prisma-cache-nosql?logo=npm&logoColor=white"> </a> <a href="https://github.com/BearToCode/prisma-cache-nosql/blob/master/LICENSE"> <i
58 lines (55 loc) • 1.72 kB
TypeScript
import { Prisma } from '@prisma/client';
import { Adapter } from './storage/index.js';
import { LogLevel } from './utils/logger.js';
/**
* Options for `prisma-cache-nosql` extension.
*/
type CacheOptions = {
/**
* The adapter to use for caching.
*/
adapter: Adapter;
logLevel?: LogLevel;
/**
* Default cache options for all queries.
*/
default?: CacheConfig;
/**
* Cache options for specific models.
*/
models?: {
[model: string]: CacheConfig;
};
};
type CacheConfig = {
set?: {
/**
* Time to live of the cached value in milliseconds.
*/
ttl: number;
} | boolean;
get?: boolean | {
/**
* Maximum age of the cached value in milliseconds.
*/
max: number;
};
};
/**
* Cache options for specific queries.
*/
type CacheQueryArgs = {
cache: CacheConfig;
};
/**
* Default cache options for all queries.
*/
declare const DefaultCacheConfig: CacheConfig;
type ClientMethodWithCache<Type, Operation extends SupportedOperation, Args> = (this: Type, args?: Prisma.Exact<Args, Prisma.Args<Type, Operation> & Partial<CacheQueryArgs>>) => Promise<Prisma.Result<Type, Omit<Args, 'cache'>, Operation>>;
/**
* Supported operations for caching.
*/
declare const SupportedOperations: readonly ["findUnique", "findUniqueOrThrow", "findFirst", "findFirstOrThrow", "findMany", "count", "aggregate", "groupBy"];
type SupportedOperation = (typeof SupportedOperations)[number];
export { type CacheConfig, type CacheOptions, type CacheQueryArgs, type ClientMethodWithCache, DefaultCacheConfig, type SupportedOperation, SupportedOperations };
//# sourceMappingURL=types.d.ts.map