@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
41 lines • 1.82 kB
TypeScript
import { z } from 'zod';
import type { ConfigOf } from '../../vfs/secrets.ts';
export declare const CacheType: Readonly<{
readonly RAM: "ram";
readonly REDIS: "redis";
}>;
export type CacheType = (typeof CacheType)[keyof typeof CacheType];
declare const CacheConfig: z.ZodObject<{
type: z.ZodOptional<z.ZodCustom<CacheType, CacheType>>;
limit: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
maxDrainBytes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
}, z.core.$strip>;
declare const RedisCacheConfig: z.ZodObject<{
type: z.ZodOptional<z.ZodCustom<CacheType, CacheType>>;
limit: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
maxDrainBytes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
url: z.ZodOptional<z.ZodString>;
keyPrefix: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
/**
* Declarative description of the workspace's file cache, the twin of
* {@link IndexConfig} for the byte cache. Mirrors Python `CacheConfig`.
*/
export type CacheConfig = ConfigOf<typeof CacheConfig>;
export type RedisCacheConfig = ConfigOf<typeof RedisCacheConfig>;
/**
* Check a cache config the way python's `CacheConfig` checks one on
* construction, and camelize its keys.
*
* The fields are picked by `type`, where python picks them by class: a
* RAM cache takes no connection fields, and any other type takes the
* redis set its registered factory receives. One field named in both
* spellings is refused, as python refuses the camelCase one.
*
* @param config the cache config as the caller passed it.
* @throws Error when `limit` is not a size.
* @returns the checked config with every key in its camelCase spelling.
*/
export declare function normalizeCacheConfig(config: CacheConfig): CacheConfig;
export {};
//# sourceMappingURL=config.d.ts.map