UNPKG

@atomist/automation-client

Version:

Atomist API for software low-level client

66 lines 2.82 kB
import { Options } from "fast-glob"; import * as micromatch from "micromatch"; import { AbstractScriptedFlushable } from "../../internal/common/AbstractScriptedFlushable"; import { RepoRef } from "../../operations/common/RepoId"; import { File, FileNonBlocking } from "../File"; import { FileStream, Project } from "../Project"; /** * Support for implementations of Project interface */ export declare abstract class AbstractProject extends AbstractScriptedFlushable<Project> implements Project { id: RepoRef; shouldCache: boolean; /** * Cached paths */ private cachedFiles; readonly cache: Record<string, object>; get name(): string; protected constructor(id: RepoRef, shouldCache?: boolean); /** * Return the file, or reject with error * @param {string} path * @return {Promise<File>} */ abstract findFile(path: string): Promise<File>; abstract getFile(path: string): Promise<File | undefined>; hasFile(path: string): Promise<boolean>; abstract hasDirectory(path: string): Promise<boolean>; abstract findFileSync(path: string): File; streamFiles(...globPatterns: string[]): FileStream; abstract streamFilesRaw(globPatterns: string[], opts: Options): FileStream; /** * Get files matching these patterns * @param {string[]} globPatterns * @return {Promise<File[]>} */ getFiles(globPatterns?: string | string[]): Promise<File[]>; /** * Subclasses can override this to optimize if they wish * @return {Promise<File[]>} */ protected getFilesInternal(globPatterns: string[]): Promise<File[]>; totalFileCount(): Promise<number>; trackFile(f: FileNonBlocking): this; moveFile(oldPath: string, newPath: string): Promise<this>; abstract makeExecutable(path: string): Promise<this>; recordAddFile(path: string, content: string): this; recordDeleteFile(path: string): this; abstract addFileSync(path: string, content: string): void; abstract deleteDirectorySync(path: string): void; abstract deleteDirectory(path: string): Promise<this>; add(f: File): Promise<this>; abstract addFile(path: string, content: string): Promise<this>; abstract addDirectory(path: string): Promise<this>; abstract deleteFile(path: string): Promise<this>; abstract deleteFileSync(path: string): void; abstract makeExecutableSync(path: string): void; abstract directoryExistsSync(path: string): boolean; abstract fileExistsSync(path: string): boolean; protected invalidateCache(): void; } /** * Return the files that match these glob patterns, including negative globs */ export declare function globMatchesWithin(files: File[], globPatterns?: string[], opts?: micromatch.Options): File[]; //# sourceMappingURL=AbstractProject.d.ts.map