UNPKG

@promptbook/remote-client

Version:

It's time for a paradigm shift. The future of software in plain English, French or Latin

34 lines (33 loc) 1.46 kB
import type { ExecutionTools } from '../../execution/ExecutionTools'; import type { PromptbookStorage } from '../_common/PromptbookStorage'; import type { FileCacheStorageOptions } from './FileCacheStorageOptions'; /** * @@@ * * @public exported from `@promptbook/node` */ export declare class FileCacheStorage<TItem> implements PromptbookStorage<TItem> { protected readonly tools: Required<Pick<ExecutionTools, 'fs'>>; private readonly options; constructor(tools: Required<Pick<ExecutionTools, 'fs'>>, options: FileCacheStorageOptions); /** * @@@ */ private getFilenameForKey; /** * @@@ Returns the current value associated with the given key, or null if the given key does not exist in the list associated with the object. */ getItem(key: string): Promise<TItem | null>; /** * @@@ Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously. */ setItem(key: string, value: TItem): Promise<void>; /** * @@@ Removes the key/value pair with the given key from the list associated with the object, if a key/value pair with the given key exists. */ removeItem(key: string): Promise<void>; } /** * TODO: [🌗] Maybe some checkers, not all valid JSONs are desired and valid values * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment */