@interactive-inc/docs-client 1.0.1 → 1.0.3
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 +72 -66
- package/build/index.js +391 -128
- 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
|
*/
|
|
@@ -1718,14 +1718,20 @@ declare class DocClient {
|
|
|
1718
1718
|
declare class DocFileSystemMock extends DocFileSystem {
|
|
1719
1719
|
private files;
|
|
1720
1720
|
private readonly _pathSystem;
|
|
1721
|
+
private readonly _basePath;
|
|
1721
1722
|
constructor(props: {
|
|
1722
1723
|
basePath: string;
|
|
1723
1724
|
pathSystem: DocPathSystem;
|
|
1725
|
+
skipDefaultFiles?: boolean;
|
|
1724
1726
|
});
|
|
1725
1727
|
/**
|
|
1726
1728
|
* PathSystem accessor (for testing)
|
|
1727
1729
|
*/
|
|
1728
1730
|
getPathSystem(): DocPathSystem;
|
|
1731
|
+
/**
|
|
1732
|
+
* Normalize path using basePath
|
|
1733
|
+
*/
|
|
1734
|
+
private normalizePath;
|
|
1729
1735
|
/**
|
|
1730
1736
|
* Create instance (mock data is automatically loaded)
|
|
1731
1737
|
*/
|
|
@@ -1737,26 +1743,26 @@ declare class DocFileSystemMock extends DocFileSystem {
|
|
|
1737
1743
|
basePath?: string;
|
|
1738
1744
|
fileContents?: Record<string, string>;
|
|
1739
1745
|
}): DocFileSystemMock;
|
|
1740
|
-
readFile(filePath: string): Promise<string | null>;
|
|
1741
|
-
writeFile(filePath: string, content: string): Promise<
|
|
1746
|
+
readFile(filePath: string): Promise<string | null | Error>;
|
|
1747
|
+
writeFile(filePath: string, content: string): Promise<Error | null>;
|
|
1742
1748
|
deleteFile(filePath: string): Promise<Error | null>;
|
|
1743
1749
|
exists(filePath: string): Promise<boolean>;
|
|
1744
|
-
copyFile(source: string, destination: string): Promise<
|
|
1745
|
-
moveFile(source: string, destination: string): Promise<
|
|
1750
|
+
copyFile(source: string, destination: string): Promise<Error | null>;
|
|
1751
|
+
moveFile(source: string, destination: string): Promise<Error | null>;
|
|
1746
1752
|
readDirectory(directoryPath: string): Promise<string[]>;
|
|
1747
1753
|
readDirectoryRecursive(directoryPath: string): Promise<string[]>;
|
|
1748
|
-
readDirectoryFilePaths(directoryPath: string): Promise<string[]>;
|
|
1749
|
-
createDirectory(_directoryPath: string): Promise<
|
|
1754
|
+
readDirectoryFilePaths(directoryPath: string): Promise<string[] | Error>;
|
|
1755
|
+
createDirectory(_directoryPath: string): Promise<Error | null>;
|
|
1750
1756
|
deleteDirectory(directoryPath: string): Promise<void>;
|
|
1751
|
-
getFileSize(filePath: string): Promise<number>;
|
|
1752
|
-
getFileModifiedTime(filePath: string): Promise<Date>;
|
|
1753
|
-
getFileCreatedTime(filePath: string): Promise<Date>;
|
|
1757
|
+
getFileSize(filePath: string): Promise<number | Error>;
|
|
1758
|
+
getFileModifiedTime(filePath: string): Promise<Date | Error>;
|
|
1759
|
+
getFileCreatedTime(filePath: string): Promise<Date | Error>;
|
|
1754
1760
|
isDirectory(relativePath: string): Promise<boolean>;
|
|
1755
1761
|
isFile(relativePath: string): Promise<boolean>;
|
|
1756
1762
|
/**
|
|
1757
1763
|
* Get list of entries in directory
|
|
1758
1764
|
*/
|
|
1759
|
-
readDirectoryFileNames(directoryPath?: string): Promise<string[]>;
|
|
1765
|
+
readDirectoryFileNames(directoryPath?: string): Promise<string[] | Error>;
|
|
1760
1766
|
/**
|
|
1761
1767
|
* Check if directory exists
|
|
1762
1768
|
*/
|
|
@@ -1768,7 +1774,7 @@ declare class DocFileSystemMock extends DocFileSystem {
|
|
|
1768
1774
|
/**
|
|
1769
1775
|
* Create directory if it doesn't exist
|
|
1770
1776
|
*/
|
|
1771
|
-
ensureDirectoryExists(_relativePath: string): Promise<
|
|
1777
|
+
ensureDirectoryExists(_relativePath: string): Promise<Error | null>;
|
|
1772
1778
|
/**
|
|
1773
1779
|
* Clear all files
|
|
1774
1780
|
*/
|