greybel-mock-environment 2.4.34 → 2.4.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -46,6 +46,7 @@ export declare class Entity extends EventEmitter {
|
|
|
46
46
|
deleted?: boolean;
|
|
47
47
|
constructor(options: EntityOptions, parent?: Entity);
|
|
48
48
|
getSize(): number;
|
|
49
|
+
rename(newName: string): boolean;
|
|
49
50
|
getTraversalPath(): string[];
|
|
50
51
|
delete(): boolean;
|
|
51
52
|
getPath(): string;
|
|
@@ -62,6 +63,7 @@ export interface FileOptions extends Omit<EntityOptions, 'isFolder'> {
|
|
|
62
63
|
isExternalProgram?: boolean;
|
|
63
64
|
}
|
|
64
65
|
export declare class File extends Entity {
|
|
66
|
+
static isFile(entity: Entity): entity is File;
|
|
65
67
|
content: string;
|
|
66
68
|
type: FileType;
|
|
67
69
|
allowImport: boolean;
|
|
@@ -81,6 +83,7 @@ export interface FolderIndexResult {
|
|
|
81
83
|
index: number;
|
|
82
84
|
}
|
|
83
85
|
export declare class Folder extends Entity {
|
|
86
|
+
static isFolder(entity: Entity): entity is Folder;
|
|
84
87
|
files: Map<string, File>;
|
|
85
88
|
folders: Map<string, Folder>;
|
|
86
89
|
constructor(options: FolderOptions, parent?: Entity);
|
|
@@ -101,6 +101,23 @@ var Entity = /** @class */ (function (_super) {
|
|
|
101
101
|
Entity.prototype.getSize = function () {
|
|
102
102
|
return 0;
|
|
103
103
|
};
|
|
104
|
+
Entity.prototype.rename = function (newName) {
|
|
105
|
+
if (this.isProtected)
|
|
106
|
+
return false;
|
|
107
|
+
this.name = newName;
|
|
108
|
+
if (this.parent) {
|
|
109
|
+
var parent = this.parent;
|
|
110
|
+
if (Folder.isFolder(this)) {
|
|
111
|
+
parent.folders.delete(this.name);
|
|
112
|
+
parent.folders.set(newName, this);
|
|
113
|
+
}
|
|
114
|
+
else if (File.isFile(this)) {
|
|
115
|
+
parent.files.delete(this.name);
|
|
116
|
+
parent.files.set(newName, this);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return true;
|
|
120
|
+
};
|
|
104
121
|
Entity.prototype.getTraversalPath = function () {
|
|
105
122
|
var path = [this.name];
|
|
106
123
|
var current = this.parent;
|
|
@@ -178,6 +195,9 @@ var File = /** @class */ (function (_super) {
|
|
|
178
195
|
_this.isExternalProgram = (_c = options.isExternalProgram) !== null && _c !== void 0 ? _c : false;
|
|
179
196
|
return _this;
|
|
180
197
|
}
|
|
198
|
+
File.isFile = function (entity) {
|
|
199
|
+
return !entity.isFolder;
|
|
200
|
+
};
|
|
181
201
|
File.prototype.getSize = function () {
|
|
182
202
|
return Math.round(((100 * this.content.length) / exports.FILE_CONTENT_LIMIT) * 1000);
|
|
183
203
|
};
|
|
@@ -237,6 +257,9 @@ var Folder = /** @class */ (function (_super) {
|
|
|
237
257
|
_this.folders = options.folders || new Map();
|
|
238
258
|
return _this;
|
|
239
259
|
}
|
|
260
|
+
Folder.isFolder = function (entity) {
|
|
261
|
+
return entity.isFolder;
|
|
262
|
+
};
|
|
240
263
|
Folder.prototype.getEntity = function (path) {
|
|
241
264
|
if (!path) {
|
|
242
265
|
return null;
|