@interactive-inc/docs-client 1.0.1 → 1.0.2
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.
- package/build/index.d.ts +66 -66
- package/build/index.js +352 -116
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -55,11 +55,11 @@ declare class DocFileSystem {
|
|
|
55
55
|
/**
|
|
56
56
|
* Read file content at the specified path
|
|
57
57
|
*/
|
|
58
|
-
readFile(relativePath: string): Promise<string | null>;
|
|
58
|
+
readFile(relativePath: string): Promise<string | null | Error>;
|
|
59
59
|
/**
|
|
60
60
|
* Write content to file at the specified path (creates directory if needed)
|
|
61
61
|
*/
|
|
62
|
-
writeFile(relativePath: string, content: string): Promise<
|
|
62
|
+
writeFile(relativePath: string, content: string): Promise<Error | null>;
|
|
63
63
|
/**
|
|
64
64
|
* Delete file at the specified path
|
|
65
65
|
*/
|
|
@@ -79,8 +79,8 @@ declare class DocFileSystem {
|
|
|
79
79
|
/**
|
|
80
80
|
* Get list of entries in directory
|
|
81
81
|
*/
|
|
82
|
-
readDirectoryFileNames(relativePath?: string): Promise<string[]>;
|
|
83
|
-
readDirectoryFilePaths(relativePath: string): Promise<string[]>;
|
|
82
|
+
readDirectoryFileNames(relativePath?: string): Promise<string[] | Error>;
|
|
83
|
+
readDirectoryFilePaths(relativePath: string): Promise<string[] | Error>;
|
|
84
84
|
/**
|
|
85
85
|
* Check if path is a directory
|
|
86
86
|
*/
|
|
@@ -112,31 +112,31 @@ declare class DocFileSystem {
|
|
|
112
112
|
/**
|
|
113
113
|
* Create directory
|
|
114
114
|
*/
|
|
115
|
-
createDirectory(relativePath: string): Promise<
|
|
115
|
+
createDirectory(relativePath: string): Promise<Error | null>;
|
|
116
116
|
/**
|
|
117
117
|
* Get file size in bytes
|
|
118
118
|
*/
|
|
119
|
-
getFileSize(relativePath: string): Promise<number>;
|
|
119
|
+
getFileSize(relativePath: string): Promise<number | Error>;
|
|
120
120
|
/**
|
|
121
121
|
* Create directory if it doesn't exist
|
|
122
122
|
*/
|
|
123
|
-
ensureDirectoryExists(relativePath: string): Promise<
|
|
123
|
+
ensureDirectoryExists(relativePath: string): Promise<Error | null>;
|
|
124
124
|
/**
|
|
125
125
|
* Copy file
|
|
126
126
|
*/
|
|
127
|
-
copyFile(sourcePath: string, destinationPath: string): Promise<
|
|
127
|
+
copyFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
|
|
128
128
|
/**
|
|
129
129
|
* Move file
|
|
130
130
|
*/
|
|
131
|
-
moveFile(sourcePath: string, destinationPath: string): Promise<
|
|
131
|
+
moveFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
|
|
132
132
|
/**
|
|
133
133
|
* Get file last modified time
|
|
134
134
|
*/
|
|
135
|
-
getFileModifiedTime(relativePath: string): Promise<Date>;
|
|
135
|
+
getFileModifiedTime(relativePath: string): Promise<Date | Error>;
|
|
136
136
|
/**
|
|
137
137
|
* Get file creation time
|
|
138
138
|
*/
|
|
139
|
-
getFileCreatedTime(relativePath: string): Promise<Date>;
|
|
139
|
+
getFileCreatedTime(relativePath: string): Promise<Date | Error>;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
/**
|
|
@@ -307,12 +307,12 @@ declare class DocFileMdReference<T extends DocCustomSchema> {
|
|
|
307
307
|
/**
|
|
308
308
|
* Write entity
|
|
309
309
|
*/
|
|
310
|
-
write(entity: DocFileMdEntity<T>): Promise<null>;
|
|
311
|
-
writeText(text: string): Promise<
|
|
310
|
+
write(entity: DocFileMdEntity<T>): Promise<Error | null>;
|
|
311
|
+
writeText(text: string): Promise<Error | null>;
|
|
312
312
|
/**
|
|
313
313
|
* Create new file with default content
|
|
314
314
|
*/
|
|
315
|
-
writeDefault(): Promise<
|
|
315
|
+
writeDefault(): Promise<Error | null>;
|
|
316
316
|
/**
|
|
317
317
|
* Delete file
|
|
318
318
|
*/
|
|
@@ -320,11 +320,11 @@ declare class DocFileMdReference<T extends DocCustomSchema> {
|
|
|
320
320
|
/**
|
|
321
321
|
* Copy file
|
|
322
322
|
*/
|
|
323
|
-
copyTo(destinationPath: string): Promise<
|
|
323
|
+
copyTo(destinationPath: string): Promise<Error | null>;
|
|
324
324
|
/**
|
|
325
325
|
* Move file
|
|
326
326
|
*/
|
|
327
|
-
moveTo(destinationPath: string): Promise<
|
|
327
|
+
moveTo(destinationPath: string): Promise<Error | null>;
|
|
328
328
|
/**
|
|
329
329
|
* Move file to archive and return new reference
|
|
330
330
|
*/
|
|
@@ -336,15 +336,15 @@ declare class DocFileMdReference<T extends DocCustomSchema> {
|
|
|
336
336
|
/**
|
|
337
337
|
* Get file size in bytes
|
|
338
338
|
*/
|
|
339
|
-
size(): Promise<number>;
|
|
339
|
+
size(): Promise<number | Error>;
|
|
340
340
|
/**
|
|
341
341
|
* Get file last modified time
|
|
342
342
|
*/
|
|
343
|
-
lastModified(): Promise<Date>;
|
|
343
|
+
lastModified(): Promise<Date | Error>;
|
|
344
344
|
/**
|
|
345
345
|
* Get file creation time
|
|
346
346
|
*/
|
|
347
|
-
createdAt(): Promise<Date>;
|
|
347
|
+
createdAt(): Promise<Date | Error>;
|
|
348
348
|
directory(): DocDirectoryReference<T>;
|
|
349
349
|
/**
|
|
350
350
|
* Get relation based on schema
|
|
@@ -422,15 +422,15 @@ declare class DocFileUnknownReference {
|
|
|
422
422
|
/**
|
|
423
423
|
* Write content to file
|
|
424
424
|
*/
|
|
425
|
-
writeContent(content: string): Promise<
|
|
425
|
+
writeContent(content: string): Promise<Error | null>;
|
|
426
426
|
/**
|
|
427
427
|
* Write entity
|
|
428
428
|
*/
|
|
429
|
-
write(entity: DocFileUnknownEntity): Promise<
|
|
429
|
+
write(entity: DocFileUnknownEntity): Promise<Error | null>;
|
|
430
430
|
/**
|
|
431
431
|
* Write raw content
|
|
432
432
|
*/
|
|
433
|
-
writeRaw(content: string): Promise<
|
|
433
|
+
writeRaw(content: string): Promise<Error | null>;
|
|
434
434
|
/**
|
|
435
435
|
* Delete file
|
|
436
436
|
*/
|
|
@@ -442,23 +442,23 @@ declare class DocFileUnknownReference {
|
|
|
442
442
|
/**
|
|
443
443
|
* Copy file
|
|
444
444
|
*/
|
|
445
|
-
copyTo(destinationPath: string): Promise<
|
|
445
|
+
copyTo(destinationPath: string): Promise<Error | null>;
|
|
446
446
|
/**
|
|
447
447
|
* Move file
|
|
448
448
|
*/
|
|
449
|
-
moveTo(destinationPath: string): Promise<
|
|
449
|
+
moveTo(destinationPath: string): Promise<Error | null>;
|
|
450
450
|
/**
|
|
451
451
|
* Get file size in bytes
|
|
452
452
|
*/
|
|
453
|
-
size(): Promise<number>;
|
|
453
|
+
size(): Promise<number | Error>;
|
|
454
454
|
/**
|
|
455
455
|
* Get file last modified time
|
|
456
456
|
*/
|
|
457
|
-
lastModified(): Promise<Date>;
|
|
457
|
+
lastModified(): Promise<Date | Error>;
|
|
458
458
|
/**
|
|
459
459
|
* Get file creation time
|
|
460
460
|
*/
|
|
461
|
-
createdAt(): Promise<Date>;
|
|
461
|
+
createdAt(): Promise<Date | Error>;
|
|
462
462
|
/**
|
|
463
463
|
* Move file to archive and return new reference
|
|
464
464
|
*/
|
|
@@ -1172,15 +1172,15 @@ declare class DocFileRelationReference {
|
|
|
1172
1172
|
* Full path
|
|
1173
1173
|
*/
|
|
1174
1174
|
get fullPath(): string;
|
|
1175
|
-
read(): Promise<DocRelationValue | null>;
|
|
1175
|
+
read(): Promise<DocRelationValue | Error | null>;
|
|
1176
1176
|
/**
|
|
1177
1177
|
* Read list of relation files
|
|
1178
1178
|
*/
|
|
1179
|
-
readFiles(): Promise<DocRelationFileValue[]>;
|
|
1179
|
+
readFiles(): Promise<DocRelationFileValue[] | Error>;
|
|
1180
1180
|
/**
|
|
1181
1181
|
* Read single relation file
|
|
1182
1182
|
*/
|
|
1183
|
-
readFile(filePath: string): Promise<DocRelationFileValue | null>;
|
|
1183
|
+
readFile(filePath: string): Promise<DocRelationFileValue | Error | null>;
|
|
1184
1184
|
/**
|
|
1185
1185
|
* Check if file exists
|
|
1186
1186
|
*/
|
|
@@ -1188,15 +1188,15 @@ declare class DocFileRelationReference {
|
|
|
1188
1188
|
/**
|
|
1189
1189
|
* Get list of file names (without extension)
|
|
1190
1190
|
*/
|
|
1191
|
-
readSlugs(): Promise<string[]>;
|
|
1191
|
+
readSlugs(): Promise<string[] | Error>;
|
|
1192
1192
|
/**
|
|
1193
1193
|
* Get file count
|
|
1194
1194
|
*/
|
|
1195
|
-
count(): Promise<number>;
|
|
1195
|
+
count(): Promise<number | Error>;
|
|
1196
1196
|
/**
|
|
1197
1197
|
* Check if empty
|
|
1198
1198
|
*/
|
|
1199
|
-
isEmpty(): Promise<boolean>;
|
|
1199
|
+
isEmpty(): Promise<boolean | Error>;
|
|
1200
1200
|
}
|
|
1201
1201
|
|
|
1202
1202
|
/**
|
|
@@ -1416,7 +1416,7 @@ declare class DocFileIndexReference<T extends DocCustomSchema> {
|
|
|
1416
1416
|
get filePath(): string;
|
|
1417
1417
|
get fileFullPath(): string;
|
|
1418
1418
|
get durectoryPath(): string;
|
|
1419
|
-
read(): Promise<DocFileIndexEntity<T
|
|
1419
|
+
read(): Promise<DocFileIndexEntity<T> | Error>;
|
|
1420
1420
|
/**
|
|
1421
1421
|
* Read file content
|
|
1422
1422
|
*/
|
|
@@ -1424,15 +1424,15 @@ declare class DocFileIndexReference<T extends DocCustomSchema> {
|
|
|
1424
1424
|
/**
|
|
1425
1425
|
* Write content to file
|
|
1426
1426
|
*/
|
|
1427
|
-
writeContent(content: string): Promise<
|
|
1427
|
+
writeContent(content: string): Promise<Error | null>;
|
|
1428
1428
|
/**
|
|
1429
1429
|
* Write entity
|
|
1430
1430
|
*/
|
|
1431
|
-
write(entity: DocFileIndexEntity<T>): Promise<
|
|
1431
|
+
write(entity: DocFileIndexEntity<T>): Promise<Error | null>;
|
|
1432
1432
|
/**
|
|
1433
1433
|
* Create new file with default content
|
|
1434
1434
|
*/
|
|
1435
|
-
writeDefault(): Promise<null>;
|
|
1435
|
+
writeDefault(): Promise<Error | null>;
|
|
1436
1436
|
/**
|
|
1437
1437
|
* Delete file
|
|
1438
1438
|
*/
|
|
@@ -1441,20 +1441,20 @@ declare class DocFileIndexReference<T extends DocCustomSchema> {
|
|
|
1441
1441
|
* Check if file exists
|
|
1442
1442
|
*/
|
|
1443
1443
|
exists(): Promise<boolean>;
|
|
1444
|
-
relations(): Promise<DocFileRelationReference[]>;
|
|
1445
|
-
readRelations(): Promise<DocRelationValue[]>;
|
|
1444
|
+
relations(): Promise<DocFileRelationReference[] | Error>;
|
|
1445
|
+
readRelations(): Promise<DocRelationValue[] | Error>;
|
|
1446
1446
|
/**
|
|
1447
1447
|
* Get file size in bytes
|
|
1448
1448
|
*/
|
|
1449
|
-
size(): Promise<number>;
|
|
1449
|
+
size(): Promise<number | Error>;
|
|
1450
1450
|
/**
|
|
1451
1451
|
* Get last modified date
|
|
1452
1452
|
*/
|
|
1453
|
-
lastModified(): Promise<Date>;
|
|
1453
|
+
lastModified(): Promise<Date | Error>;
|
|
1454
1454
|
/**
|
|
1455
1455
|
* Get file creation date
|
|
1456
1456
|
*/
|
|
1457
|
-
createdAt(): Promise<Date>;
|
|
1457
|
+
createdAt(): Promise<Date | Error>;
|
|
1458
1458
|
/**
|
|
1459
1459
|
* Move file to archive and return new reference
|
|
1460
1460
|
*/
|
|
@@ -1490,25 +1490,25 @@ declare class DocDirectoryReference<T extends DocCustomSchema> {
|
|
|
1490
1490
|
get indexFileName(): string;
|
|
1491
1491
|
get indexFilePath(): string;
|
|
1492
1492
|
get archiveDirectoryName(): string;
|
|
1493
|
-
fileNames(): Promise<string[]>;
|
|
1494
|
-
archivedFileNames(): Promise<string[]>;
|
|
1495
|
-
filesGenerator(): AsyncGenerator<DocFileMdReference<T> | DocFileUnknownReference, void, unknown>;
|
|
1496
|
-
mdFilesGenerator(): AsyncGenerator<DocFileMdReference<T
|
|
1497
|
-
files(): Promise<(DocFileMdReference<T> | DocFileUnknownReference)[]>;
|
|
1498
|
-
mdFiles(): Promise<DocFileMdReference<T>[]>;
|
|
1493
|
+
fileNames(): Promise<string[] | Error>;
|
|
1494
|
+
archivedFileNames(): Promise<string[] | Error>;
|
|
1495
|
+
filesGenerator(): AsyncGenerator<DocFileMdReference<T> | DocFileUnknownReference | Error, void, unknown>;
|
|
1496
|
+
mdFilesGenerator(): AsyncGenerator<DocFileMdReference<T> | Error, void, unknown>;
|
|
1497
|
+
files(): Promise<(DocFileMdReference<T> | DocFileUnknownReference)[] | Error>;
|
|
1498
|
+
mdFiles(): Promise<DocFileMdReference<T>[] | Error>;
|
|
1499
1499
|
file<FileName extends string>(fileName: FileName): InferReference<FileName, T>;
|
|
1500
1500
|
mdFile(fileName: string): DocFileMdReference<T>;
|
|
1501
|
-
readFiles(): Promise<(DocFileMdEntity<T> | DocFileUnknownEntity)[]>;
|
|
1502
|
-
readMdFiles(): Promise<DocFileMdEntity<T>[]>;
|
|
1503
|
-
readUnknownFiles(): Promise<DocFileUnknownEntity[]>;
|
|
1501
|
+
readFiles(): Promise<(DocFileMdEntity<T> | DocFileUnknownEntity)[] | Error>;
|
|
1502
|
+
readMdFiles(): Promise<DocFileMdEntity<T>[] | Error>;
|
|
1503
|
+
readUnknownFiles(): Promise<DocFileUnknownEntity[] | Error>;
|
|
1504
1504
|
/**
|
|
1505
1505
|
* Get list of subdirectory names
|
|
1506
1506
|
*/
|
|
1507
|
-
directoryNames(): Promise<string[]>;
|
|
1507
|
+
directoryNames(): Promise<string[] | Error>;
|
|
1508
1508
|
/**
|
|
1509
1509
|
* Get subdirectory references
|
|
1510
1510
|
*/
|
|
1511
|
-
directories(): Promise<DocDirectoryReference<T>[]>;
|
|
1511
|
+
directories(): Promise<DocDirectoryReference<T>[] | Error>;
|
|
1512
1512
|
/**
|
|
1513
1513
|
* Get single subdirectory reference
|
|
1514
1514
|
*/
|
|
@@ -1611,7 +1611,7 @@ declare class DocFileTreeSystem {
|
|
|
1611
1611
|
/**
|
|
1612
1612
|
* Build file tree recursively
|
|
1613
1613
|
*/
|
|
1614
|
-
buildFileTree(directoryPath?: string): Promise<DocTreeNodeValue[]>;
|
|
1614
|
+
buildFileTree(directoryPath?: string): Promise<DocTreeNodeValue[] | Error>;
|
|
1615
1615
|
/**
|
|
1616
1616
|
* Create file node
|
|
1617
1617
|
*/
|
|
@@ -1631,7 +1631,7 @@ declare class DocFileTreeSystem {
|
|
|
1631
1631
|
/**
|
|
1632
1632
|
* Build directory tree recursively (directories only)
|
|
1633
1633
|
*/
|
|
1634
|
-
buildDirectoryTree(directoryPath?: string): Promise<DocTreeDirectoryNodeValue[]>;
|
|
1634
|
+
buildDirectoryTree(directoryPath?: string): Promise<DocTreeDirectoryNodeValue[] | Error>;
|
|
1635
1635
|
/**
|
|
1636
1636
|
* Create directory node for directory tree
|
|
1637
1637
|
*/
|
|
@@ -1737,26 +1737,26 @@ declare class DocFileSystemMock extends DocFileSystem {
|
|
|
1737
1737
|
basePath?: string;
|
|
1738
1738
|
fileContents?: Record<string, string>;
|
|
1739
1739
|
}): DocFileSystemMock;
|
|
1740
|
-
readFile(filePath: string): Promise<string | null>;
|
|
1741
|
-
writeFile(filePath: string, content: string): Promise<
|
|
1740
|
+
readFile(filePath: string): Promise<string | null | Error>;
|
|
1741
|
+
writeFile(filePath: string, content: string): Promise<Error | null>;
|
|
1742
1742
|
deleteFile(filePath: string): Promise<Error | null>;
|
|
1743
1743
|
exists(filePath: string): Promise<boolean>;
|
|
1744
|
-
copyFile(source: string, destination: string): Promise<
|
|
1745
|
-
moveFile(source: string, destination: string): Promise<
|
|
1744
|
+
copyFile(source: string, destination: string): Promise<Error | null>;
|
|
1745
|
+
moveFile(source: string, destination: string): Promise<Error | null>;
|
|
1746
1746
|
readDirectory(directoryPath: string): Promise<string[]>;
|
|
1747
1747
|
readDirectoryRecursive(directoryPath: string): Promise<string[]>;
|
|
1748
|
-
readDirectoryFilePaths(directoryPath: string): Promise<string[]>;
|
|
1749
|
-
createDirectory(_directoryPath: string): Promise<
|
|
1748
|
+
readDirectoryFilePaths(directoryPath: string): Promise<string[] | Error>;
|
|
1749
|
+
createDirectory(_directoryPath: string): Promise<Error | null>;
|
|
1750
1750
|
deleteDirectory(directoryPath: string): Promise<void>;
|
|
1751
|
-
getFileSize(filePath: string): Promise<number>;
|
|
1752
|
-
getFileModifiedTime(filePath: string): Promise<Date>;
|
|
1753
|
-
getFileCreatedTime(filePath: string): Promise<Date>;
|
|
1751
|
+
getFileSize(filePath: string): Promise<number | Error>;
|
|
1752
|
+
getFileModifiedTime(filePath: string): Promise<Date | Error>;
|
|
1753
|
+
getFileCreatedTime(filePath: string): Promise<Date | Error>;
|
|
1754
1754
|
isDirectory(relativePath: string): Promise<boolean>;
|
|
1755
1755
|
isFile(relativePath: string): Promise<boolean>;
|
|
1756
1756
|
/**
|
|
1757
1757
|
* Get list of entries in directory
|
|
1758
1758
|
*/
|
|
1759
|
-
readDirectoryFileNames(directoryPath?: string): Promise<string[]>;
|
|
1759
|
+
readDirectoryFileNames(directoryPath?: string): Promise<string[] | Error>;
|
|
1760
1760
|
/**
|
|
1761
1761
|
* Check if directory exists
|
|
1762
1762
|
*/
|
|
@@ -1768,7 +1768,7 @@ declare class DocFileSystemMock extends DocFileSystem {
|
|
|
1768
1768
|
/**
|
|
1769
1769
|
* Create directory if it doesn't exist
|
|
1770
1770
|
*/
|
|
1771
|
-
ensureDirectoryExists(_relativePath: string): Promise<
|
|
1771
|
+
ensureDirectoryExists(_relativePath: string): Promise<Error | null>;
|
|
1772
1772
|
/**
|
|
1773
1773
|
* Clear all files
|
|
1774
1774
|
*/
|
package/build/index.js
CHANGED
|
@@ -1878,6 +1878,9 @@ var DocFileRelationReference = class {
|
|
|
1878
1878
|
}
|
|
1879
1879
|
async read() {
|
|
1880
1880
|
const files = await this.readFiles();
|
|
1881
|
+
if (files instanceof Error) {
|
|
1882
|
+
return files;
|
|
1883
|
+
}
|
|
1881
1884
|
return new DocRelationValue({
|
|
1882
1885
|
path: this.path,
|
|
1883
1886
|
files: files.map((value) => value.toJson())
|
|
@@ -1892,9 +1895,15 @@ var DocFileRelationReference = class {
|
|
|
1892
1895
|
return [];
|
|
1893
1896
|
}
|
|
1894
1897
|
const filePaths = await this.fileSystem.readDirectoryFilePaths(this.path);
|
|
1898
|
+
if (filePaths instanceof Error) {
|
|
1899
|
+
return filePaths;
|
|
1900
|
+
}
|
|
1895
1901
|
const files = [];
|
|
1896
1902
|
for (const filePath of filePaths) {
|
|
1897
1903
|
const file = await this.readFile(filePath);
|
|
1904
|
+
if (file instanceof Error) {
|
|
1905
|
+
return file;
|
|
1906
|
+
}
|
|
1898
1907
|
if (file === null) continue;
|
|
1899
1908
|
files.push(file);
|
|
1900
1909
|
}
|
|
@@ -1908,6 +1917,9 @@ var DocFileRelationReference = class {
|
|
|
1908
1917
|
return null;
|
|
1909
1918
|
}
|
|
1910
1919
|
const content = await this.fileSystem.readFile(filePath);
|
|
1920
|
+
if (content instanceof Error) {
|
|
1921
|
+
return content;
|
|
1922
|
+
}
|
|
1911
1923
|
if (content === null) {
|
|
1912
1924
|
return null;
|
|
1913
1925
|
}
|
|
@@ -1940,6 +1952,9 @@ var DocFileRelationReference = class {
|
|
|
1940
1952
|
*/
|
|
1941
1953
|
async readSlugs() {
|
|
1942
1954
|
const files = await this.readFiles();
|
|
1955
|
+
if (files instanceof Error) {
|
|
1956
|
+
return files;
|
|
1957
|
+
}
|
|
1943
1958
|
return files.map((file) => file.id);
|
|
1944
1959
|
}
|
|
1945
1960
|
/**
|
|
@@ -1947,6 +1962,9 @@ var DocFileRelationReference = class {
|
|
|
1947
1962
|
*/
|
|
1948
1963
|
async count() {
|
|
1949
1964
|
const files = await this.readFiles();
|
|
1965
|
+
if (files instanceof Error) {
|
|
1966
|
+
return files;
|
|
1967
|
+
}
|
|
1950
1968
|
return files.length;
|
|
1951
1969
|
}
|
|
1952
1970
|
/**
|
|
@@ -1954,6 +1972,9 @@ var DocFileRelationReference = class {
|
|
|
1954
1972
|
*/
|
|
1955
1973
|
async isEmpty() {
|
|
1956
1974
|
const count = await this.count();
|
|
1975
|
+
if (count instanceof Error) {
|
|
1976
|
+
return count;
|
|
1977
|
+
}
|
|
1957
1978
|
return count === 0;
|
|
1958
1979
|
}
|
|
1959
1980
|
};
|
|
@@ -3273,6 +3294,9 @@ var DocFileIndexReference = class _DocFileIndexReference {
|
|
|
3273
3294
|
}
|
|
3274
3295
|
async read() {
|
|
3275
3296
|
const content = await this.fileSystem.readFile(this.filePath);
|
|
3297
|
+
if (content instanceof Error) {
|
|
3298
|
+
return content;
|
|
3299
|
+
}
|
|
3276
3300
|
if (content === null) {
|
|
3277
3301
|
const dirPath = this.pathSystem.dirname(this.filePath);
|
|
3278
3302
|
const dirName = this.pathSystem.basename(dirPath);
|
|
@@ -3330,14 +3354,14 @@ var DocFileIndexReference = class _DocFileIndexReference {
|
|
|
3330
3354
|
* Write content to file
|
|
3331
3355
|
*/
|
|
3332
3356
|
async writeContent(content) {
|
|
3333
|
-
await this.fileSystem.writeFile(this.filePath, content);
|
|
3357
|
+
return await this.fileSystem.writeFile(this.filePath, content);
|
|
3334
3358
|
}
|
|
3335
3359
|
/**
|
|
3336
3360
|
* Write entity
|
|
3337
3361
|
*/
|
|
3338
3362
|
async write(entity) {
|
|
3339
3363
|
const content = entity.content.toText();
|
|
3340
|
-
await this.fileSystem.writeFile(this.filePath, content);
|
|
3364
|
+
return await this.fileSystem.writeFile(this.filePath, content);
|
|
3341
3365
|
}
|
|
3342
3366
|
/**
|
|
3343
3367
|
* Create new file with default content
|
|
@@ -3350,7 +3374,13 @@ var DocFileIndexReference = class _DocFileIndexReference {
|
|
|
3350
3374
|
"",
|
|
3351
3375
|
`Please describe the overview of ${dirName} here.`
|
|
3352
3376
|
].join("\n");
|
|
3353
|
-
await this.fileSystem.writeFile(
|
|
3377
|
+
const writeResult = await this.fileSystem.writeFile(
|
|
3378
|
+
this.filePath,
|
|
3379
|
+
defaultContent
|
|
3380
|
+
);
|
|
3381
|
+
if (writeResult instanceof Error) {
|
|
3382
|
+
return writeResult;
|
|
3383
|
+
}
|
|
3354
3384
|
return null;
|
|
3355
3385
|
}
|
|
3356
3386
|
/**
|
|
@@ -3367,6 +3397,9 @@ var DocFileIndexReference = class _DocFileIndexReference {
|
|
|
3367
3397
|
}
|
|
3368
3398
|
async relations() {
|
|
3369
3399
|
const indexFile = await this.read();
|
|
3400
|
+
if (indexFile instanceof Error) {
|
|
3401
|
+
return indexFile;
|
|
3402
|
+
}
|
|
3370
3403
|
const schema = indexFile.content.meta().schema();
|
|
3371
3404
|
if (!schema) {
|
|
3372
3405
|
return [];
|
|
@@ -3391,10 +3424,14 @@ var DocFileIndexReference = class _DocFileIndexReference {
|
|
|
3391
3424
|
}
|
|
3392
3425
|
async readRelations() {
|
|
3393
3426
|
const relations = await this.relations();
|
|
3427
|
+
if (relations instanceof Error) {
|
|
3428
|
+
return relations;
|
|
3429
|
+
}
|
|
3394
3430
|
const files = [];
|
|
3395
3431
|
for (const relation of relations) {
|
|
3396
3432
|
const entity = await relation.read();
|
|
3397
3433
|
if (entity === null) continue;
|
|
3434
|
+
if (entity instanceof Error) continue;
|
|
3398
3435
|
files.push(entity);
|
|
3399
3436
|
}
|
|
3400
3437
|
return files;
|
|
@@ -3428,7 +3465,13 @@ var DocFileIndexReference = class _DocFileIndexReference {
|
|
|
3428
3465
|
archiveDirectoryName,
|
|
3429
3466
|
fileName
|
|
3430
3467
|
);
|
|
3431
|
-
await this.fileSystem.moveFile(
|
|
3468
|
+
const moveResult = await this.fileSystem.moveFile(
|
|
3469
|
+
this.filePath,
|
|
3470
|
+
archivePath
|
|
3471
|
+
);
|
|
3472
|
+
if (moveResult instanceof Error) {
|
|
3473
|
+
throw moveResult;
|
|
3474
|
+
}
|
|
3432
3475
|
return new _DocFileIndexReference({
|
|
3433
3476
|
path: archivePath,
|
|
3434
3477
|
fileSystem: this.fileSystem,
|
|
@@ -3451,7 +3494,13 @@ var DocFileIndexReference = class _DocFileIndexReference {
|
|
|
3451
3494
|
this.pathSystem.dirname(dirPath),
|
|
3452
3495
|
fileName
|
|
3453
3496
|
);
|
|
3454
|
-
await this.fileSystem.moveFile(
|
|
3497
|
+
const moveResult = await this.fileSystem.moveFile(
|
|
3498
|
+
this.filePath,
|
|
3499
|
+
restorePath
|
|
3500
|
+
);
|
|
3501
|
+
if (moveResult instanceof Error) {
|
|
3502
|
+
throw moveResult;
|
|
3503
|
+
}
|
|
3455
3504
|
return new _DocFileIndexReference({
|
|
3456
3505
|
path: restorePath,
|
|
3457
3506
|
fileSystem: this.fileSystem,
|
|
@@ -3507,9 +3556,15 @@ var DocFileMdReference = class _DocFileMdReference {
|
|
|
3507
3556
|
}
|
|
3508
3557
|
async read() {
|
|
3509
3558
|
const content = await this.fileSystem.readFile(this.path);
|
|
3559
|
+
if (content instanceof Error) {
|
|
3560
|
+
return content;
|
|
3561
|
+
}
|
|
3510
3562
|
const actualPath = this.path;
|
|
3511
3563
|
if (content === null) {
|
|
3512
3564
|
const archivedContent = await this.fileSystem.readFile(this.archivedPath);
|
|
3565
|
+
if (archivedContent instanceof Error) {
|
|
3566
|
+
return archivedContent;
|
|
3567
|
+
}
|
|
3513
3568
|
if (archivedContent !== null) {
|
|
3514
3569
|
const contentValue2 = DocFileMdContentValue.fromMarkdown(
|
|
3515
3570
|
archivedContent,
|
|
@@ -3569,7 +3624,10 @@ var DocFileMdReference = class _DocFileMdReference {
|
|
|
3569
3624
|
*/
|
|
3570
3625
|
async write(entity) {
|
|
3571
3626
|
const content = entity.content.toText();
|
|
3572
|
-
await this.fileSystem.writeFile(this.path, content);
|
|
3627
|
+
const writeResult = await this.fileSystem.writeFile(this.path, content);
|
|
3628
|
+
if (writeResult instanceof Error) {
|
|
3629
|
+
return writeResult;
|
|
3630
|
+
}
|
|
3573
3631
|
return null;
|
|
3574
3632
|
}
|
|
3575
3633
|
async writeText(text) {
|
|
@@ -3597,13 +3655,13 @@ var DocFileMdReference = class _DocFileMdReference {
|
|
|
3597
3655
|
* Copy file
|
|
3598
3656
|
*/
|
|
3599
3657
|
async copyTo(destinationPath) {
|
|
3600
|
-
await this.fileSystem.copyFile(this.path, destinationPath);
|
|
3658
|
+
return await this.fileSystem.copyFile(this.path, destinationPath);
|
|
3601
3659
|
}
|
|
3602
3660
|
/**
|
|
3603
3661
|
* Move file
|
|
3604
3662
|
*/
|
|
3605
3663
|
async moveTo(destinationPath) {
|
|
3606
|
-
await this.fileSystem.moveFile(this.path, destinationPath);
|
|
3664
|
+
return await this.fileSystem.moveFile(this.path, destinationPath);
|
|
3607
3665
|
}
|
|
3608
3666
|
/**
|
|
3609
3667
|
* Move file to archive and return new reference
|
|
@@ -3616,7 +3674,10 @@ var DocFileMdReference = class _DocFileMdReference {
|
|
|
3616
3674
|
archiveDirectoryName,
|
|
3617
3675
|
fileName
|
|
3618
3676
|
);
|
|
3619
|
-
await this.moveTo(archivePath);
|
|
3677
|
+
const moveResult = await this.moveTo(archivePath);
|
|
3678
|
+
if (moveResult instanceof Error) {
|
|
3679
|
+
throw moveResult;
|
|
3680
|
+
}
|
|
3620
3681
|
return new _DocFileMdReference({
|
|
3621
3682
|
path: archivePath,
|
|
3622
3683
|
fileSystem: this.fileSystem,
|
|
@@ -3639,7 +3700,10 @@ var DocFileMdReference = class _DocFileMdReference {
|
|
|
3639
3700
|
this.pathSystem.dirname(dirPath),
|
|
3640
3701
|
fileName
|
|
3641
3702
|
);
|
|
3642
|
-
await this.moveTo(restorePath);
|
|
3703
|
+
const moveResult = await this.moveTo(restorePath);
|
|
3704
|
+
if (moveResult instanceof Error) {
|
|
3705
|
+
throw moveResult;
|
|
3706
|
+
}
|
|
3643
3707
|
return new _DocFileMdReference({
|
|
3644
3708
|
path: restorePath,
|
|
3645
3709
|
fileSystem: this.fileSystem,
|
|
@@ -3902,6 +3966,9 @@ var DocFileUnknownReference = class _DocFileUnknownReference {
|
|
|
3902
3966
|
}
|
|
3903
3967
|
async read() {
|
|
3904
3968
|
const content = await this.fileSystem.readFile(this.path);
|
|
3969
|
+
if (content instanceof Error) {
|
|
3970
|
+
return content;
|
|
3971
|
+
}
|
|
3905
3972
|
if (content === null) {
|
|
3906
3973
|
return new Error(`File not found at ${this.path}.`);
|
|
3907
3974
|
}
|
|
@@ -3937,19 +4004,19 @@ var DocFileUnknownReference = class _DocFileUnknownReference {
|
|
|
3937
4004
|
* Write content to file
|
|
3938
4005
|
*/
|
|
3939
4006
|
async writeContent(content) {
|
|
3940
|
-
await this.fileSystem.writeFile(this.path, content);
|
|
4007
|
+
return await this.fileSystem.writeFile(this.path, content);
|
|
3941
4008
|
}
|
|
3942
4009
|
/**
|
|
3943
4010
|
* Write entity
|
|
3944
4011
|
*/
|
|
3945
4012
|
async write(entity) {
|
|
3946
|
-
await this.fileSystem.writeFile(this.path, entity.value.content);
|
|
4013
|
+
return await this.fileSystem.writeFile(this.path, entity.value.content);
|
|
3947
4014
|
}
|
|
3948
4015
|
/**
|
|
3949
4016
|
* Write raw content
|
|
3950
4017
|
*/
|
|
3951
4018
|
async writeRaw(content) {
|
|
3952
|
-
await this.fileSystem.writeFile(this.path, content);
|
|
4019
|
+
return await this.fileSystem.writeFile(this.path, content);
|
|
3953
4020
|
}
|
|
3954
4021
|
/**
|
|
3955
4022
|
* Delete file
|
|
@@ -3967,13 +4034,13 @@ var DocFileUnknownReference = class _DocFileUnknownReference {
|
|
|
3967
4034
|
* Copy file
|
|
3968
4035
|
*/
|
|
3969
4036
|
async copyTo(destinationPath) {
|
|
3970
|
-
await this.fileSystem.copyFile(this.path, destinationPath);
|
|
4037
|
+
return await this.fileSystem.copyFile(this.path, destinationPath);
|
|
3971
4038
|
}
|
|
3972
4039
|
/**
|
|
3973
4040
|
* Move file
|
|
3974
4041
|
*/
|
|
3975
4042
|
async moveTo(destinationPath) {
|
|
3976
|
-
await this.fileSystem.moveFile(this.path, destinationPath);
|
|
4043
|
+
return await this.fileSystem.moveFile(this.path, destinationPath);
|
|
3977
4044
|
}
|
|
3978
4045
|
/**
|
|
3979
4046
|
* Get file size in bytes
|
|
@@ -4004,7 +4071,10 @@ var DocFileUnknownReference = class _DocFileUnknownReference {
|
|
|
4004
4071
|
archiveDirectoryName,
|
|
4005
4072
|
fileName
|
|
4006
4073
|
);
|
|
4007
|
-
await this.moveTo(archivePath);
|
|
4074
|
+
const moveResult = await this.moveTo(archivePath);
|
|
4075
|
+
if (moveResult instanceof Error) {
|
|
4076
|
+
throw moveResult;
|
|
4077
|
+
}
|
|
4008
4078
|
return new _DocFileUnknownReference({
|
|
4009
4079
|
path: archivePath,
|
|
4010
4080
|
fileSystem: this.fileSystem,
|
|
@@ -4026,7 +4096,10 @@ var DocFileUnknownReference = class _DocFileUnknownReference {
|
|
|
4026
4096
|
this.pathSystem.dirname(dirPath),
|
|
4027
4097
|
fileName
|
|
4028
4098
|
);
|
|
4029
|
-
await this.moveTo(restorePath);
|
|
4099
|
+
const moveResult = await this.moveTo(restorePath);
|
|
4100
|
+
if (moveResult instanceof Error) {
|
|
4101
|
+
throw moveResult;
|
|
4102
|
+
}
|
|
4030
4103
|
return new _DocFileUnknownReference({
|
|
4031
4104
|
path: restorePath,
|
|
4032
4105
|
fileSystem: this.fileSystem,
|
|
@@ -4078,6 +4151,9 @@ var DocDirectoryReference = class _DocDirectoryReference {
|
|
|
4078
4151
|
const filePaths = await this.fileSystem.readDirectoryFilePaths(
|
|
4079
4152
|
this.relativePath
|
|
4080
4153
|
);
|
|
4154
|
+
if (filePaths instanceof Error) {
|
|
4155
|
+
return filePaths;
|
|
4156
|
+
}
|
|
4081
4157
|
return filePaths.map((p) => this.pathSystem.basename(p)).filter((name) => name.includes("."));
|
|
4082
4158
|
}
|
|
4083
4159
|
async archivedFileNames() {
|
|
@@ -4086,10 +4162,17 @@ var DocDirectoryReference = class _DocDirectoryReference {
|
|
|
4086
4162
|
this.archiveDirectoryName
|
|
4087
4163
|
);
|
|
4088
4164
|
const filePaths = await this.fileSystem.readDirectoryFilePaths(archivePath);
|
|
4165
|
+
if (filePaths instanceof Error) {
|
|
4166
|
+
return filePaths;
|
|
4167
|
+
}
|
|
4089
4168
|
return filePaths.map((p) => this.pathSystem.basename(p)).filter((name) => name.includes("."));
|
|
4090
4169
|
}
|
|
4091
4170
|
async *filesGenerator() {
|
|
4092
4171
|
const fileNames = await this.fileNames();
|
|
4172
|
+
if (fileNames instanceof Error) {
|
|
4173
|
+
yield fileNames;
|
|
4174
|
+
return;
|
|
4175
|
+
}
|
|
4093
4176
|
for (const fileName of fileNames) {
|
|
4094
4177
|
if (fileName === "index.md") continue;
|
|
4095
4178
|
if (fileName.endsWith(".md")) {
|
|
@@ -4110,6 +4193,10 @@ var DocDirectoryReference = class _DocDirectoryReference {
|
|
|
4110
4193
|
});
|
|
4111
4194
|
}
|
|
4112
4195
|
const archivedFileNames = await this.archivedFileNames();
|
|
4196
|
+
if (archivedFileNames instanceof Error) {
|
|
4197
|
+
yield archivedFileNames;
|
|
4198
|
+
return;
|
|
4199
|
+
}
|
|
4113
4200
|
for (const fileName of archivedFileNames) {
|
|
4114
4201
|
if (fileName === this.indexFileName) continue;
|
|
4115
4202
|
if (fileName.endsWith(".md")) {
|
|
@@ -4141,6 +4228,10 @@ var DocDirectoryReference = class _DocDirectoryReference {
|
|
|
4141
4228
|
async *mdFilesGenerator() {
|
|
4142
4229
|
const generator = this.filesGenerator();
|
|
4143
4230
|
for await (const file of generator) {
|
|
4231
|
+
if (file instanceof Error) {
|
|
4232
|
+
yield file;
|
|
4233
|
+
return;
|
|
4234
|
+
}
|
|
4144
4235
|
if (file instanceof DocFileMdReference) {
|
|
4145
4236
|
yield file;
|
|
4146
4237
|
}
|
|
@@ -4149,6 +4240,9 @@ var DocDirectoryReference = class _DocDirectoryReference {
|
|
|
4149
4240
|
async files() {
|
|
4150
4241
|
const files = [];
|
|
4151
4242
|
for await (const ref of this.filesGenerator()) {
|
|
4243
|
+
if (ref instanceof Error) {
|
|
4244
|
+
return ref;
|
|
4245
|
+
}
|
|
4152
4246
|
files.push(ref);
|
|
4153
4247
|
}
|
|
4154
4248
|
return files;
|
|
@@ -4156,6 +4250,9 @@ var DocDirectoryReference = class _DocDirectoryReference {
|
|
|
4156
4250
|
async mdFiles() {
|
|
4157
4251
|
const refs = [];
|
|
4158
4252
|
for await (const file of this.mdFilesGenerator()) {
|
|
4253
|
+
if (file instanceof Error) {
|
|
4254
|
+
return file;
|
|
4255
|
+
}
|
|
4159
4256
|
refs.push(file);
|
|
4160
4257
|
}
|
|
4161
4258
|
return refs;
|
|
@@ -4190,6 +4287,9 @@ var DocDirectoryReference = class _DocDirectoryReference {
|
|
|
4190
4287
|
async readFiles() {
|
|
4191
4288
|
const entities = [];
|
|
4192
4289
|
for await (const file of this.filesGenerator()) {
|
|
4290
|
+
if (file instanceof Error) {
|
|
4291
|
+
return file;
|
|
4292
|
+
}
|
|
4193
4293
|
const entity = await file.read();
|
|
4194
4294
|
if (entity instanceof Error) continue;
|
|
4195
4295
|
entities.push(entity);
|
|
@@ -4199,6 +4299,9 @@ var DocDirectoryReference = class _DocDirectoryReference {
|
|
|
4199
4299
|
async readMdFiles() {
|
|
4200
4300
|
const entities = [];
|
|
4201
4301
|
for await (const file of this.filesGenerator()) {
|
|
4302
|
+
if (file instanceof Error) {
|
|
4303
|
+
return file;
|
|
4304
|
+
}
|
|
4202
4305
|
const entity = await file.read();
|
|
4203
4306
|
if (entity instanceof Error) continue;
|
|
4204
4307
|
if (entity instanceof DocFileUnknownEntity) continue;
|
|
@@ -4209,6 +4312,9 @@ var DocDirectoryReference = class _DocDirectoryReference {
|
|
|
4209
4312
|
async readUnknownFiles() {
|
|
4210
4313
|
const entities = [];
|
|
4211
4314
|
for await (const file of this.filesGenerator()) {
|
|
4315
|
+
if (file instanceof Error) {
|
|
4316
|
+
return file;
|
|
4317
|
+
}
|
|
4212
4318
|
const entity = await file.read();
|
|
4213
4319
|
if (entity instanceof Error) continue;
|
|
4214
4320
|
if (entity instanceof DocFileMdEntity) continue;
|
|
@@ -4223,6 +4329,9 @@ var DocDirectoryReference = class _DocDirectoryReference {
|
|
|
4223
4329
|
const allFileNames = await this.fileSystem.readDirectoryFileNames(
|
|
4224
4330
|
this.relativePath
|
|
4225
4331
|
);
|
|
4332
|
+
if (allFileNames instanceof Error) {
|
|
4333
|
+
return allFileNames;
|
|
4334
|
+
}
|
|
4226
4335
|
const directoryNames = [];
|
|
4227
4336
|
for (const fileName of allFileNames) {
|
|
4228
4337
|
if (fileName.startsWith(this.archiveDirectoryName)) continue;
|
|
@@ -4240,6 +4349,9 @@ var DocDirectoryReference = class _DocDirectoryReference {
|
|
|
4240
4349
|
*/
|
|
4241
4350
|
async directories() {
|
|
4242
4351
|
const directoryNames = await this.directoryNames();
|
|
4352
|
+
if (directoryNames instanceof Error) {
|
|
4353
|
+
return directoryNames;
|
|
4354
|
+
}
|
|
4243
4355
|
return directoryNames.map((dirName) => {
|
|
4244
4356
|
const dirPath = this.pathSystem.join(this.relativePath, dirName);
|
|
4245
4357
|
return new _DocDirectoryReference({
|
|
@@ -4306,7 +4418,10 @@ var DocDirectoryReference = class _DocDirectoryReference {
|
|
|
4306
4418
|
if (content === null) {
|
|
4307
4419
|
return new Error("Entity content is undefined");
|
|
4308
4420
|
}
|
|
4309
|
-
await this.fileSystem.writeFile(filePath, content);
|
|
4421
|
+
const writeResult = await this.fileSystem.writeFile(filePath, content);
|
|
4422
|
+
if (writeResult instanceof Error) {
|
|
4423
|
+
return writeResult;
|
|
4424
|
+
}
|
|
4310
4425
|
return null;
|
|
4311
4426
|
}
|
|
4312
4427
|
async exists() {
|
|
@@ -4333,7 +4448,10 @@ var DocDirectoryReference = class _DocDirectoryReference {
|
|
|
4333
4448
|
pathSystem: this.pathSystem,
|
|
4334
4449
|
config: this.props.config
|
|
4335
4450
|
});
|
|
4336
|
-
await fileRef.writeDefault();
|
|
4451
|
+
const writeResult = await fileRef.writeDefault();
|
|
4452
|
+
if (writeResult instanceof Error) {
|
|
4453
|
+
throw writeResult;
|
|
4454
|
+
}
|
|
4337
4455
|
return fileRef;
|
|
4338
4456
|
}
|
|
4339
4457
|
};
|
|
@@ -4470,6 +4588,9 @@ var DocFileTreeSystem = class {
|
|
|
4470
4588
|
*/
|
|
4471
4589
|
async buildFileTree(directoryPath = "") {
|
|
4472
4590
|
const fileNames = await this.props.fileSystem.readDirectoryFileNames(directoryPath);
|
|
4591
|
+
if (fileNames instanceof Error) {
|
|
4592
|
+
return fileNames;
|
|
4593
|
+
}
|
|
4473
4594
|
const results = [];
|
|
4474
4595
|
for (const fileName of fileNames) {
|
|
4475
4596
|
if (fileName === this.props.archiveDirectoryName) continue;
|
|
@@ -4478,10 +4599,16 @@ var DocFileTreeSystem = class {
|
|
|
4478
4599
|
const isDirectory = await this.props.fileSystem.isDirectory(filePath);
|
|
4479
4600
|
if (!isDirectory) {
|
|
4480
4601
|
const fileNode = await this.createFileNode(fileName, filePath);
|
|
4602
|
+
if (fileNode instanceof Error) {
|
|
4603
|
+
return fileNode;
|
|
4604
|
+
}
|
|
4481
4605
|
results.push(fileNode);
|
|
4482
4606
|
continue;
|
|
4483
4607
|
}
|
|
4484
4608
|
const directoryNode = await this.createDirectoryNode(fileName, filePath);
|
|
4609
|
+
if (directoryNode instanceof Error) {
|
|
4610
|
+
return directoryNode;
|
|
4611
|
+
}
|
|
4485
4612
|
results.push(directoryNode);
|
|
4486
4613
|
}
|
|
4487
4614
|
return results;
|
|
@@ -4520,6 +4647,9 @@ var DocFileTreeSystem = class {
|
|
|
4520
4647
|
const indexFile = this.createIndexFileReference(filePath);
|
|
4521
4648
|
if (await indexFile.exists()) {
|
|
4522
4649
|
const entity = await indexFile.read();
|
|
4650
|
+
if (entity instanceof Error) {
|
|
4651
|
+
return entity;
|
|
4652
|
+
}
|
|
4523
4653
|
title = entity.value.content.title || fileName;
|
|
4524
4654
|
const content = entity.content;
|
|
4525
4655
|
const frontMatter = content.meta();
|
|
@@ -4528,6 +4658,9 @@ var DocFileTreeSystem = class {
|
|
|
4528
4658
|
}
|
|
4529
4659
|
}
|
|
4530
4660
|
const children = await this.buildFileTree(filePath);
|
|
4661
|
+
if (children instanceof Error) {
|
|
4662
|
+
return children;
|
|
4663
|
+
}
|
|
4531
4664
|
return DocTreeDirectoryNodeValue.from({
|
|
4532
4665
|
name: fileName,
|
|
4533
4666
|
path: filePath,
|
|
@@ -4566,6 +4699,9 @@ var DocFileTreeSystem = class {
|
|
|
4566
4699
|
*/
|
|
4567
4700
|
async buildDirectoryTree(directoryPath = "") {
|
|
4568
4701
|
const fileNames = await this.props.fileSystem.readDirectoryFileNames(directoryPath);
|
|
4702
|
+
if (fileNames instanceof Error) {
|
|
4703
|
+
return fileNames;
|
|
4704
|
+
}
|
|
4569
4705
|
const results = [];
|
|
4570
4706
|
for (const fileName of fileNames) {
|
|
4571
4707
|
if (fileName === this.props.archiveDirectoryName) continue;
|
|
@@ -4577,6 +4713,9 @@ var DocFileTreeSystem = class {
|
|
|
4577
4713
|
fileName,
|
|
4578
4714
|
filePath
|
|
4579
4715
|
);
|
|
4716
|
+
if (directoryNode instanceof Error) {
|
|
4717
|
+
return directoryNode;
|
|
4718
|
+
}
|
|
4580
4719
|
results.push(directoryNode);
|
|
4581
4720
|
}
|
|
4582
4721
|
return results;
|
|
@@ -4590,6 +4729,9 @@ var DocFileTreeSystem = class {
|
|
|
4590
4729
|
const indexFile = this.createIndexFileReference(filePath);
|
|
4591
4730
|
if (await indexFile.exists()) {
|
|
4592
4731
|
const entity = await indexFile.read();
|
|
4732
|
+
if (entity instanceof Error) {
|
|
4733
|
+
return entity;
|
|
4734
|
+
}
|
|
4593
4735
|
title = entity.value.content.title || fileName;
|
|
4594
4736
|
const content = entity.content;
|
|
4595
4737
|
const frontMatter = content.meta();
|
|
@@ -4598,6 +4740,9 @@ var DocFileTreeSystem = class {
|
|
|
4598
4740
|
}
|
|
4599
4741
|
}
|
|
4600
4742
|
const children = await this.buildDirectoryTree(filePath);
|
|
4743
|
+
if (children instanceof Error) {
|
|
4744
|
+
return children;
|
|
4745
|
+
}
|
|
4601
4746
|
return DocTreeDirectoryNodeValue.from({
|
|
4602
4747
|
name: fileName,
|
|
4603
4748
|
path: filePath,
|
|
@@ -4852,10 +4997,16 @@ var DocClient = class {
|
|
|
4852
4997
|
}
|
|
4853
4998
|
async fileTree(directoryPath = "") {
|
|
4854
4999
|
const results = await this.fileTreeSystem.buildFileTree(directoryPath);
|
|
5000
|
+
if (results instanceof Error) {
|
|
5001
|
+
throw results;
|
|
5002
|
+
}
|
|
4855
5003
|
return results.map((node) => node.toJson());
|
|
4856
5004
|
}
|
|
4857
5005
|
async directoryTree(directoryPath = "") {
|
|
4858
5006
|
const results = await this.fileTreeSystem.buildDirectoryTree(directoryPath);
|
|
5007
|
+
if (results instanceof Error) {
|
|
5008
|
+
throw results;
|
|
5009
|
+
}
|
|
4859
5010
|
return results.map((node) => node.toJson());
|
|
4860
5011
|
}
|
|
4861
5012
|
};
|
|
@@ -4873,29 +5024,27 @@ var DocFileSystem = class {
|
|
|
4873
5024
|
* Read file content at the specified path
|
|
4874
5025
|
*/
|
|
4875
5026
|
async readFile(relativePath) {
|
|
4876
|
-
const exists = await this.exists(relativePath);
|
|
4877
|
-
if (!exists) return null;
|
|
4878
|
-
const fullPath = this.pathSystem.join(this.basePath, relativePath);
|
|
4879
5027
|
try {
|
|
5028
|
+
const exists = await this.exists(relativePath);
|
|
5029
|
+
if (!exists) return null;
|
|
5030
|
+
const fullPath = this.pathSystem.join(this.basePath, relativePath);
|
|
4880
5031
|
return await fs.readFile(fullPath, "utf-8");
|
|
4881
|
-
} catch {
|
|
4882
|
-
return
|
|
5032
|
+
} catch (error) {
|
|
5033
|
+
return error instanceof Error ? error : new Error(`Failed to read file at ${relativePath}`);
|
|
4883
5034
|
}
|
|
4884
5035
|
}
|
|
4885
5036
|
/**
|
|
4886
5037
|
* Write content to file at the specified path (creates directory if needed)
|
|
4887
5038
|
*/
|
|
4888
5039
|
async writeFile(relativePath, content) {
|
|
4889
|
-
const fullPath = this.pathSystem.join(this.basePath, relativePath);
|
|
4890
|
-
const dirPath = this.pathSystem.dirname(fullPath);
|
|
4891
5040
|
try {
|
|
5041
|
+
const fullPath = this.pathSystem.join(this.basePath, relativePath);
|
|
5042
|
+
const dirPath = this.pathSystem.dirname(fullPath);
|
|
4892
5043
|
await fs.mkdir(dirPath, { recursive: true });
|
|
4893
5044
|
await fs.writeFile(fullPath, content, "utf-8");
|
|
5045
|
+
return null;
|
|
4894
5046
|
} catch (error) {
|
|
4895
|
-
|
|
4896
|
-
throw error;
|
|
4897
|
-
}
|
|
4898
|
-
throw new Error(`Failed to write file at ${fullPath}`);
|
|
5047
|
+
return error instanceof Error ? error : new Error(`Failed to write file at ${relativePath}`);
|
|
4899
5048
|
}
|
|
4900
5049
|
}
|
|
4901
5050
|
/**
|
|
@@ -4932,18 +5081,25 @@ var DocFileSystem = class {
|
|
|
4932
5081
|
* Get list of entries in directory
|
|
4933
5082
|
*/
|
|
4934
5083
|
async readDirectoryFileNames(relativePath = "") {
|
|
4935
|
-
const fullPath = this.pathSystem.join(this.basePath, relativePath);
|
|
4936
5084
|
try {
|
|
5085
|
+
const fullPath = this.pathSystem.join(this.basePath, relativePath);
|
|
4937
5086
|
return await fs.readdir(fullPath);
|
|
4938
|
-
} catch {
|
|
4939
|
-
return
|
|
5087
|
+
} catch (error) {
|
|
5088
|
+
return error instanceof Error ? error : new Error(`Failed to read directory at ${relativePath}`);
|
|
4940
5089
|
}
|
|
4941
5090
|
}
|
|
4942
5091
|
async readDirectoryFilePaths(relativePath) {
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
(
|
|
4946
|
-
|
|
5092
|
+
try {
|
|
5093
|
+
const fileNames = await this.readDirectoryFileNames(relativePath);
|
|
5094
|
+
if (fileNames instanceof Error) {
|
|
5095
|
+
return fileNames;
|
|
5096
|
+
}
|
|
5097
|
+
return fileNames.map(
|
|
5098
|
+
(fileName) => this.pathSystem.join(relativePath, fileName)
|
|
5099
|
+
);
|
|
5100
|
+
} catch (error) {
|
|
5101
|
+
return error instanceof Error ? error : new Error(`Failed to read directory file paths at ${relativePath}`);
|
|
5102
|
+
}
|
|
4947
5103
|
}
|
|
4948
5104
|
/**
|
|
4949
5105
|
* Check if path is a directory
|
|
@@ -5009,56 +5165,95 @@ var DocFileSystem = class {
|
|
|
5009
5165
|
* Create directory
|
|
5010
5166
|
*/
|
|
5011
5167
|
async createDirectory(relativePath) {
|
|
5012
|
-
|
|
5013
|
-
|
|
5168
|
+
try {
|
|
5169
|
+
const fullPath = this.pathSystem.join(this.basePath, relativePath);
|
|
5170
|
+
await fs.mkdir(fullPath, { recursive: true });
|
|
5171
|
+
return null;
|
|
5172
|
+
} catch (error) {
|
|
5173
|
+
return error instanceof Error ? error : new Error(`Failed to create directory at ${relativePath}`);
|
|
5174
|
+
}
|
|
5014
5175
|
}
|
|
5015
5176
|
/**
|
|
5016
5177
|
* Get file size in bytes
|
|
5017
5178
|
*/
|
|
5018
5179
|
async getFileSize(relativePath) {
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5180
|
+
try {
|
|
5181
|
+
const fullPath = this.pathSystem.join(this.basePath, relativePath);
|
|
5182
|
+
const stats = await fs.stat(fullPath);
|
|
5183
|
+
return stats.size;
|
|
5184
|
+
} catch (error) {
|
|
5185
|
+
return error instanceof Error ? error : new Error(`Failed to get file size at ${relativePath}`);
|
|
5186
|
+
}
|
|
5022
5187
|
}
|
|
5023
5188
|
/**
|
|
5024
5189
|
* Create directory if it doesn't exist
|
|
5025
5190
|
*/
|
|
5026
5191
|
async ensureDirectoryExists(relativePath) {
|
|
5027
|
-
|
|
5028
|
-
await this.
|
|
5192
|
+
try {
|
|
5193
|
+
if (!await this.exists(relativePath)) {
|
|
5194
|
+
const result = await this.createDirectory(relativePath);
|
|
5195
|
+
if (result instanceof Error) {
|
|
5196
|
+
return result;
|
|
5197
|
+
}
|
|
5198
|
+
}
|
|
5199
|
+
return null;
|
|
5200
|
+
} catch (error) {
|
|
5201
|
+
return error instanceof Error ? error : new Error(`Failed to ensure directory exists at ${relativePath}`);
|
|
5029
5202
|
}
|
|
5030
5203
|
}
|
|
5031
5204
|
/**
|
|
5032
5205
|
* Copy file
|
|
5033
5206
|
*/
|
|
5034
5207
|
async copyFile(sourcePath, destinationPath) {
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5208
|
+
try {
|
|
5209
|
+
const sourceFullPath = this.pathSystem.join(this.basePath, sourcePath);
|
|
5210
|
+
const destFullPath = this.pathSystem.join(this.basePath, destinationPath);
|
|
5211
|
+
await fs.copyFile(sourceFullPath, destFullPath);
|
|
5212
|
+
return null;
|
|
5213
|
+
} catch (error) {
|
|
5214
|
+
return error instanceof Error ? error : new Error(
|
|
5215
|
+
`Failed to copy file from ${sourcePath} to ${destinationPath}`
|
|
5216
|
+
);
|
|
5217
|
+
}
|
|
5038
5218
|
}
|
|
5039
5219
|
/**
|
|
5040
5220
|
* Move file
|
|
5041
5221
|
*/
|
|
5042
5222
|
async moveFile(sourcePath, destinationPath) {
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5223
|
+
try {
|
|
5224
|
+
const sourceFullPath = this.pathSystem.join(this.basePath, sourcePath);
|
|
5225
|
+
const destFullPath = this.pathSystem.join(this.basePath, destinationPath);
|
|
5226
|
+
await fs.rename(sourceFullPath, destFullPath);
|
|
5227
|
+
return null;
|
|
5228
|
+
} catch (error) {
|
|
5229
|
+
return error instanceof Error ? error : new Error(
|
|
5230
|
+
`Failed to move file from ${sourcePath} to ${destinationPath}`
|
|
5231
|
+
);
|
|
5232
|
+
}
|
|
5046
5233
|
}
|
|
5047
5234
|
/**
|
|
5048
5235
|
* Get file last modified time
|
|
5049
5236
|
*/
|
|
5050
5237
|
async getFileModifiedTime(relativePath) {
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5238
|
+
try {
|
|
5239
|
+
const fullPath = this.pathSystem.join(this.basePath, relativePath);
|
|
5240
|
+
const stats = await fs.stat(fullPath);
|
|
5241
|
+
return stats.mtime;
|
|
5242
|
+
} catch (error) {
|
|
5243
|
+
return error instanceof Error ? error : new Error(`Failed to get file modified time at ${relativePath}`);
|
|
5244
|
+
}
|
|
5054
5245
|
}
|
|
5055
5246
|
/**
|
|
5056
5247
|
* Get file creation time
|
|
5057
5248
|
*/
|
|
5058
5249
|
async getFileCreatedTime(relativePath) {
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5250
|
+
try {
|
|
5251
|
+
const fullPath = this.pathSystem.join(this.basePath, relativePath);
|
|
5252
|
+
const stats = await fs.stat(fullPath);
|
|
5253
|
+
return stats.birthtime;
|
|
5254
|
+
} catch (error) {
|
|
5255
|
+
return error instanceof Error ? error : new Error(`Failed to get file created time at ${relativePath}`);
|
|
5256
|
+
}
|
|
5062
5257
|
}
|
|
5063
5258
|
};
|
|
5064
5259
|
|
|
@@ -5138,20 +5333,29 @@ var DocFileSystemMock = class _DocFileSystemMock extends DocFileSystem {
|
|
|
5138
5333
|
return fileSystem;
|
|
5139
5334
|
}
|
|
5140
5335
|
async readFile(filePath) {
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5336
|
+
try {
|
|
5337
|
+
const normalizedPath = filePath.startsWith("docs/") ? filePath : `docs/${filePath}`;
|
|
5338
|
+
const file = this.files.get(normalizedPath);
|
|
5339
|
+
return file ? file.content : null;
|
|
5340
|
+
} catch (error) {
|
|
5341
|
+
return error instanceof Error ? error : new Error(`Failed to read file at ${filePath}`);
|
|
5342
|
+
}
|
|
5144
5343
|
}
|
|
5145
5344
|
async writeFile(filePath, content) {
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5345
|
+
try {
|
|
5346
|
+
const normalizedPath = filePath.startsWith("docs/") ? filePath : `docs/${filePath}`;
|
|
5347
|
+
const now = /* @__PURE__ */ new Date();
|
|
5348
|
+
const existing = this.files.get(normalizedPath);
|
|
5349
|
+
this.files.set(normalizedPath, {
|
|
5350
|
+
content,
|
|
5351
|
+
modifiedTime: now,
|
|
5352
|
+
createdTime: existing?.createdTime ?? now,
|
|
5353
|
+
size: new TextEncoder().encode(content).length
|
|
5354
|
+
});
|
|
5355
|
+
return null;
|
|
5356
|
+
} catch (error) {
|
|
5357
|
+
return error instanceof Error ? error : new Error(`Failed to write file at ${filePath}`);
|
|
5358
|
+
}
|
|
5155
5359
|
}
|
|
5156
5360
|
async deleteFile(filePath) {
|
|
5157
5361
|
const normalizedPath = filePath.startsWith("docs/") ? filePath : `docs/${filePath}`;
|
|
@@ -5176,26 +5380,36 @@ var DocFileSystemMock = class _DocFileSystemMock extends DocFileSystem {
|
|
|
5176
5380
|
return false;
|
|
5177
5381
|
}
|
|
5178
5382
|
async copyFile(source, destination) {
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5383
|
+
try {
|
|
5384
|
+
const normalizedSource = source.startsWith("docs/") ? source : `docs/${source}`;
|
|
5385
|
+
const normalizedDest = destination.startsWith("docs/") ? destination : `docs/${destination}`;
|
|
5386
|
+
const file = this.files.get(normalizedSource);
|
|
5387
|
+
if (!file) {
|
|
5388
|
+
return new Error(`Source file not found: ${normalizedSource}`);
|
|
5389
|
+
}
|
|
5390
|
+
this.files.set(normalizedDest, {
|
|
5391
|
+
...file,
|
|
5392
|
+
createdTime: /* @__PURE__ */ new Date()
|
|
5393
|
+
});
|
|
5394
|
+
return null;
|
|
5395
|
+
} catch (error) {
|
|
5396
|
+
return error instanceof Error ? error : new Error(`Failed to copy file from ${source} to ${destination}`);
|
|
5397
|
+
}
|
|
5189
5398
|
}
|
|
5190
5399
|
async moveFile(source, destination) {
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5400
|
+
try {
|
|
5401
|
+
const normalizedSource = source.startsWith("docs/") ? source : `docs/${source}`;
|
|
5402
|
+
const normalizedDest = destination.startsWith("docs/") ? destination : `docs/${destination}`;
|
|
5403
|
+
const file = this.files.get(normalizedSource);
|
|
5404
|
+
if (!file) {
|
|
5405
|
+
return new Error(`Source file not found: ${normalizedSource}`);
|
|
5406
|
+
}
|
|
5407
|
+
this.files.set(normalizedDest, file);
|
|
5408
|
+
this.files.delete(normalizedSource);
|
|
5409
|
+
return null;
|
|
5410
|
+
} catch (error) {
|
|
5411
|
+
return error instanceof Error ? error : new Error(`Failed to move file from ${source} to ${destination}`);
|
|
5196
5412
|
}
|
|
5197
|
-
this.files.set(normalizedDest, file);
|
|
5198
|
-
this.files.delete(normalizedSource);
|
|
5199
5413
|
}
|
|
5200
5414
|
async readDirectory(directoryPath) {
|
|
5201
5415
|
const dirPath = directoryPath.endsWith("/") ? directoryPath : `${directoryPath}/`;
|
|
@@ -5222,16 +5436,21 @@ var DocFileSystemMock = class _DocFileSystemMock extends DocFileSystem {
|
|
|
5222
5436
|
return files.sort();
|
|
5223
5437
|
}
|
|
5224
5438
|
async readDirectoryFilePaths(directoryPath) {
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5439
|
+
try {
|
|
5440
|
+
const dirPath = directoryPath.endsWith("/") ? directoryPath : `${directoryPath}/`;
|
|
5441
|
+
const files = [];
|
|
5442
|
+
for (const path of this.files.keys()) {
|
|
5443
|
+
if (path.startsWith(dirPath) && !path.slice(dirPath.length).includes("/")) {
|
|
5444
|
+
files.push(path);
|
|
5445
|
+
}
|
|
5230
5446
|
}
|
|
5447
|
+
return files.sort();
|
|
5448
|
+
} catch (error) {
|
|
5449
|
+
return error instanceof Error ? error : new Error(`Failed to read directory file paths at ${directoryPath}`);
|
|
5231
5450
|
}
|
|
5232
|
-
return files.sort();
|
|
5233
5451
|
}
|
|
5234
5452
|
async createDirectory(_directoryPath) {
|
|
5453
|
+
return null;
|
|
5235
5454
|
}
|
|
5236
5455
|
async deleteDirectory(directoryPath) {
|
|
5237
5456
|
const dirPath = directoryPath.endsWith("/") ? directoryPath : `${directoryPath}/`;
|
|
@@ -5242,28 +5461,40 @@ var DocFileSystemMock = class _DocFileSystemMock extends DocFileSystem {
|
|
|
5242
5461
|
}
|
|
5243
5462
|
}
|
|
5244
5463
|
async getFileSize(filePath) {
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5464
|
+
try {
|
|
5465
|
+
const normalizedPath = filePath.startsWith("docs/") ? filePath : `docs/${filePath}`;
|
|
5466
|
+
const file = this.files.get(normalizedPath);
|
|
5467
|
+
if (!file) {
|
|
5468
|
+
return new Error(`File not found: ${normalizedPath}`);
|
|
5469
|
+
}
|
|
5470
|
+
return file.size;
|
|
5471
|
+
} catch (error) {
|
|
5472
|
+
return error instanceof Error ? error : new Error(`Failed to get file size at ${filePath}`);
|
|
5249
5473
|
}
|
|
5250
|
-
return file.size;
|
|
5251
5474
|
}
|
|
5252
5475
|
async getFileModifiedTime(filePath) {
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5476
|
+
try {
|
|
5477
|
+
const normalizedPath = filePath.startsWith("docs/") ? filePath : `docs/${filePath}`;
|
|
5478
|
+
const file = this.files.get(normalizedPath);
|
|
5479
|
+
if (!file) {
|
|
5480
|
+
return new Error(`File not found: ${normalizedPath}`);
|
|
5481
|
+
}
|
|
5482
|
+
return file.modifiedTime;
|
|
5483
|
+
} catch (error) {
|
|
5484
|
+
return error instanceof Error ? error : new Error(`Failed to get file modified time at ${filePath}`);
|
|
5257
5485
|
}
|
|
5258
|
-
return file.modifiedTime;
|
|
5259
5486
|
}
|
|
5260
5487
|
async getFileCreatedTime(filePath) {
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5488
|
+
try {
|
|
5489
|
+
const normalizedPath = filePath.startsWith("docs/") ? filePath : `docs/${filePath}`;
|
|
5490
|
+
const file = this.files.get(normalizedPath);
|
|
5491
|
+
if (!file) {
|
|
5492
|
+
return new Error(`File not found: ${normalizedPath}`);
|
|
5493
|
+
}
|
|
5494
|
+
return file.createdTime;
|
|
5495
|
+
} catch (error) {
|
|
5496
|
+
return error instanceof Error ? error : new Error(`Failed to get file created time at ${filePath}`);
|
|
5265
5497
|
}
|
|
5266
|
-
return file.createdTime;
|
|
5267
5498
|
}
|
|
5268
5499
|
async isDirectory(relativePath) {
|
|
5269
5500
|
const normalizedPath = relativePath.startsWith("docs/") ? relativePath : `docs/${relativePath}`;
|
|
@@ -5283,19 +5514,23 @@ var DocFileSystemMock = class _DocFileSystemMock extends DocFileSystem {
|
|
|
5283
5514
|
* Get list of entries in directory
|
|
5284
5515
|
*/
|
|
5285
5516
|
async readDirectoryFileNames(directoryPath = "") {
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5517
|
+
try {
|
|
5518
|
+
const normalizedDir = directoryPath === "" ? "docs" : directoryPath === "docs" ? "docs" : directoryPath.startsWith("docs/") ? directoryPath : `docs/${directoryPath}`;
|
|
5519
|
+
const dirPath = normalizedDir.endsWith("/") ? normalizedDir : `${normalizedDir}/`;
|
|
5520
|
+
const entries = /* @__PURE__ */ new Set();
|
|
5521
|
+
for (const path of this.files.keys()) {
|
|
5522
|
+
if (path.startsWith(dirPath)) {
|
|
5523
|
+
const relativePath = path.slice(dirPath.length);
|
|
5524
|
+
const firstSegment = relativePath.split("/")[0];
|
|
5525
|
+
if (firstSegment) {
|
|
5526
|
+
entries.add(firstSegment);
|
|
5527
|
+
}
|
|
5295
5528
|
}
|
|
5296
5529
|
}
|
|
5530
|
+
return Array.from(entries).sort();
|
|
5531
|
+
} catch (error) {
|
|
5532
|
+
return error instanceof Error ? error : new Error(`Failed to read directory at ${directoryPath}`);
|
|
5297
5533
|
}
|
|
5298
|
-
return Array.from(entries).sort();
|
|
5299
5534
|
}
|
|
5300
5535
|
/**
|
|
5301
5536
|
* Check if directory exists
|
|
@@ -5313,6 +5548,7 @@ var DocFileSystemMock = class _DocFileSystemMock extends DocFileSystem {
|
|
|
5313
5548
|
* Create directory if it doesn't exist
|
|
5314
5549
|
*/
|
|
5315
5550
|
async ensureDirectoryExists(_relativePath) {
|
|
5551
|
+
return null;
|
|
5316
5552
|
}
|
|
5317
5553
|
/**
|
|
5318
5554
|
* Clear all files
|