@quo0/stiletto
Version:
With stiletto library you will be able to mock requests and choose between preconfigured responses right on the fly via UI
41 lines (40 loc) • 1.47 kB
TypeScript
import { FileExtension } from "../../../app/constants";
import { cosmiconfig } from "cosmiconfig";
export declare type Explorer = ReturnType<typeof cosmiconfig>;
interface CommonStructureEntityProps {
name: string;
privateName: string;
defaultPath: string;
}
export interface FileStructureEntityProps extends CommonStructureEntityProps {
defaultExtension: FileExtension;
}
export declare type FolderStructureEntityProps = CommonStructureEntityProps;
interface IAbstractStructureEntity {
readonly privateName: string;
readonly name: string;
readonly defaultPath: string;
create(): Promise<void>;
read(): Promise<unknown>;
update(data: unknown): Promise<void>;
delete(): Promise<void>;
}
export interface IAbstractFileStructureEntity<FileDataInterface> extends IAbstractStructureEntity {
data: FileDataInterface | null;
path: string | null;
extension: FileExtension | null;
explorer: Explorer | null;
find(): Promise<null | {
data: FileDataInterface;
path: string;
extension: FileExtension;
explorer: Explorer;
}>;
create(fileData?: FileDataInterface, fileExtension?: FileExtension): Promise<void>;
read(): Promise<FileDataInterface | null>;
update(data: FileDataInterface): Promise<void>;
}
export interface IAbstractFolderStructureEntity extends IAbstractStructureEntity {
read(): Promise<Array<string>>;
}
export {};