UNPKG

1.99 kBTypeScriptView Raw
1import { ActionResult } from "../../action/ActionResult";
2import { HandlerContext } from "../../HandlerContext";
3import { Project } from "../../project/Project";
4import { DirectoryManager } from "../../spi/clone/DirectoryManager";
5import { ProjectAction } from "../common/projectAction";
6import { ProjectOperationCredentials } from "../common/ProjectOperationCredentials";
7import { RepoId } from "../common/RepoId";
8import { AnyProjectEditor } from "../edit/projectEditor";
9/**
10 * Function that knows how to persist a project using the given credentials.
11 * Can take parameters and return a subclass of action result.
12 */
13export declare type ProjectPersister<P extends Project = Project, R extends ActionResult<P> = ActionResult<P>> = (p: Project, credentials: ProjectOperationCredentials, targetId: RepoId, params?: object) => Promise<R>;
14/**
15 * Generate a new project given the starting point project.
16 * Do not change the starting point. May perform additional
17 * action after persisting the project.
18 * @param {Promise<Project>} startingPoint
19 * @param {HandlerContext} ctx
20 * @param {ProjectOperationCredentials} credentials
21 * @param {ProjectEditor} editor editor that does the actual transformation
22 * @param persist persist function to persist the new project:
23 * for example, to GitHub
24 * @param targetId id of target repo for persistence
25 * @param params optional parameters to be passed to persister
26 * @param afterAction action to perform after project persistence.
27 * @param directoryManager finds a directory for the new project; defaults to tmp
28 */
29export declare function generate<P extends Project = Project, PARAMS = object>(startingPoint: Promise<Project> | Project, ctx: HandlerContext, credentials: ProjectOperationCredentials, editor: AnyProjectEditor, persist: ProjectPersister<P>, targetId: RepoId, params?: PARAMS, afterAction?: ProjectAction<PARAMS, P>, directoryManager?: DirectoryManager): Promise<ActionResult<P>>;
30//# sourceMappingURL=generatorUtils.d.ts.map
\No newline at end of file