-
Notifications
You must be signed in to change notification settings - Fork 12k
/
Copy pathdelegate.ts
83 lines (74 loc) · 1.87 KB
/
delegate.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { Action } from './action';
import {
DirEntry,
FileEntry,
FileVisitor,
MergeStrategy,
Tree,
TreeSymbol,
UpdateRecorder,
} from './interface';
export class DelegateTree implements Tree {
constructor(protected _other: Tree) {}
branch(): Tree {
return this._other.branch();
}
merge(other: Tree, strategy?: MergeStrategy): void {
this._other.merge(other, strategy);
}
get root(): DirEntry {
return this._other.root;
}
// Readonly.
read(path: string): Buffer | null {
return this._other.read(path);
}
exists(path: string): boolean {
return this._other.exists(path);
}
get(path: string): FileEntry | null {
return this._other.get(path);
}
getDir(path: string): DirEntry {
return this._other.getDir(path);
}
visit(visitor: FileVisitor): void {
return this._other.visit(visitor);
}
// Change content of host files.
overwrite(path: string, content: Buffer | string): void {
return this._other.overwrite(path, content);
}
beginUpdate(path: string): UpdateRecorder {
return this._other.beginUpdate(path);
}
commitUpdate(record: UpdateRecorder): void {
return this._other.commitUpdate(record);
}
// Structural methods.
create(path: string, content: Buffer | string): void {
return this._other.create(path, content);
}
delete(path: string): void {
return this._other.delete(path);
}
rename(from: string, to: string): void {
return this._other.rename(from, to);
}
apply(action: Action, strategy?: MergeStrategy): void {
return this._other.apply(action, strategy);
}
get actions(): Action[] {
return this._other.actions;
}
[TreeSymbol]() {
return this;
}
}