UNPKG

1.85 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.dev/license
7 */
8import { Observable } from 'rxjs';
9import { Action, CreateFileAction, DeleteFileAction, OverwriteFileAction, RenameFileAction } from '../tree/action';
10import { Tree } from '../tree/interface';
11export interface Sink {
12 commit(tree: Tree): Observable<void>;
13}
14export declare abstract class SimpleSinkBase implements Sink {
15 preCommitAction: (action: Action) => void | Action | PromiseLike<Action> | Observable<Action>;
16 postCommitAction: (action: Action) => void | Observable<void>;
17 preCommit: () => void | Observable<void>;
18 postCommit: () => void | Observable<void>;
19 protected abstract _validateFileExists(p: string): Observable<boolean>;
20 protected abstract _overwriteFile(path: string, content: Buffer): Observable<void>;
21 protected abstract _createFile(path: string, content: Buffer): Observable<void>;
22 protected abstract _renameFile(path: string, to: string): Observable<void>;
23 protected abstract _deleteFile(path: string): Observable<void>;
24 protected abstract _done(): Observable<void>;
25 protected _fileAlreadyExistException(path: string): void;
26 protected _fileDoesNotExistException(path: string): void;
27 protected _validateOverwriteAction(action: OverwriteFileAction): Observable<void>;
28 protected _validateCreateAction(action: CreateFileAction): Observable<void>;
29 protected _validateRenameAction(action: RenameFileAction): Observable<void>;
30 protected _validateDeleteAction(action: DeleteFileAction): Observable<void>;
31 validateSingleAction(action: Action): Observable<void>;
32 commitSingleAction(action: Action): Observable<void>;
33 commit(tree: Tree): Observable<void>;
34}