1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | exports.SafeReadonlyHost = void 0;
|
11 | const rxjs_1 = require("rxjs");
|
12 | const operators_1 = require("rxjs/operators");
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | class SafeReadonlyHost {
|
18 | constructor(_delegate) {
|
19 | this._delegate = _delegate;
|
20 | }
|
21 | get capabilities() {
|
22 | return this._delegate.capabilities;
|
23 | }
|
24 | read(path) {
|
25 | return this._delegate.read(path);
|
26 | }
|
27 | list(path) {
|
28 | return this._delegate.list(path).pipe((0, operators_1.catchError)(() => (0, rxjs_1.of)([])));
|
29 | }
|
30 | exists(path) {
|
31 | return this._delegate.exists(path);
|
32 | }
|
33 | isDirectory(path) {
|
34 | return this._delegate.isDirectory(path).pipe((0, operators_1.catchError)(() => (0, rxjs_1.of)(false)));
|
35 | }
|
36 | isFile(path) {
|
37 | return this._delegate.isFile(path).pipe((0, operators_1.catchError)(() => (0, rxjs_1.of)(false)));
|
38 | }
|
39 |
|
40 | stat(path) {
|
41 | const maybeStat = this._delegate.stat(path);
|
42 | return maybeStat && maybeStat.pipe((0, operators_1.catchError)(() => (0, rxjs_1.of)(null)));
|
43 | }
|
44 | }
|
45 | exports.SafeReadonlyHost = SafeReadonlyHost;
|