@interactive-inc/docs-client 1.1.0 → 1.1.1
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/{doc-file-system-BQAOBIO-.d.ts → doc-file-system-DEmPPJPE.d.ts} +10 -142
- package/build/doc-file-system.interface-C5vpYrOL.d.ts +135 -0
- package/build/file-system-json.d.ts +5 -4
- package/build/file-system-json.js +18 -296
- package/build/file-system-mock.d.ts +28 -8
- package/build/file-system-mock.js +47 -435
- package/build/file-system-node.d.ts +16 -0
- package/build/file-system-node.js +544 -0
- package/build/file-system-octokit.d.ts +8 -15
- package/build/file-system-octokit.js +17 -304
- package/build/file-system.d.ts +10 -8
- package/build/file-system.js +157 -171
- package/build/index.d.ts +23 -18
- package/build/index.js +29 -132
- package/build/models.js +4 -75
- package/package.json +3 -2
- package/tmp/docs-studio/files/a.md +9 -0
- package/tmp/docs-studio/pages/delete-document.md +7 -0
- package/tmp/docs-studio/pages/document-editor.md +9 -0
- package/tmp/docs-studio/pages/edit-document-content.md +7 -0
- package/tmp/docs-studio/pages/index.md +14 -0
|
@@ -1,41 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Path operations system
|
|
3
|
-
*/
|
|
4
|
-
declare class DocPathSystem {
|
|
5
|
-
readonly separator = "/";
|
|
6
|
-
/**
|
|
7
|
-
* Join paths
|
|
8
|
-
*/
|
|
9
|
-
join(...paths: string[]): string;
|
|
10
|
-
/**
|
|
11
|
-
* Get filename with extension
|
|
12
|
-
*/
|
|
13
|
-
basename(path: string, ext?: string): string;
|
|
14
|
-
/**
|
|
15
|
-
* Get directory name
|
|
16
|
-
*/
|
|
17
|
-
dirname(path: string): string;
|
|
18
|
-
/**
|
|
19
|
-
* Get extension
|
|
20
|
-
*/
|
|
21
|
-
extname(path: string): string;
|
|
22
|
-
/**
|
|
23
|
-
* Calculate relative path
|
|
24
|
-
*/
|
|
25
|
-
relative(from: string, to: string): string;
|
|
26
|
-
/**
|
|
27
|
-
* Convert to absolute path
|
|
28
|
-
*/
|
|
29
|
-
resolve(...paths: string[]): string;
|
|
30
|
-
/**
|
|
31
|
-
* Normalize path
|
|
32
|
-
*/
|
|
33
|
-
normalize(path: string): string;
|
|
34
|
-
/**
|
|
35
|
-
* Check if path is absolute
|
|
36
|
-
*/
|
|
37
|
-
isAbsolute(path: string): boolean;
|
|
38
|
-
}
|
|
1
|
+
import { D as DocFileSystemInterface, a as DocPathSystem } from './doc-file-system.interface-C5vpYrOL.js';
|
|
39
2
|
|
|
40
3
|
/**
|
|
41
4
|
* Read-only file system interface for document operations
|
|
@@ -100,7 +63,7 @@ interface DocFileSystemReadInterface {
|
|
|
100
63
|
/**
|
|
101
64
|
* Get file last modified time
|
|
102
65
|
*/
|
|
103
|
-
|
|
66
|
+
getFileUpdatedTime(relativePath: string): Promise<Date | Error>;
|
|
104
67
|
/**
|
|
105
68
|
* Get file creation time
|
|
106
69
|
*/
|
|
@@ -122,98 +85,11 @@ interface DocFileSystemWriteInterface {
|
|
|
122
85
|
/**
|
|
123
86
|
* Create directory
|
|
124
87
|
*/
|
|
125
|
-
|
|
88
|
+
createEmptyDirectory(relativePath: string): Promise<Error | null>;
|
|
126
89
|
/**
|
|
127
90
|
* Create directory if it doesn't exist
|
|
128
91
|
*/
|
|
129
|
-
ensureDirectoryExists(relativePath: string): Promise<Error | null>;
|
|
130
|
-
/**
|
|
131
|
-
* Copy file
|
|
132
|
-
*/
|
|
133
|
-
copyFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
|
|
134
|
-
/**
|
|
135
|
-
* Move file
|
|
136
|
-
*/
|
|
137
|
-
moveFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Interface for DocFileSystem class
|
|
142
|
-
* Defines all public methods available in DocFileSystem
|
|
143
|
-
*/
|
|
144
|
-
interface DocFileSystemInterface {
|
|
145
|
-
/**
|
|
146
|
-
* Read file content at the specified path
|
|
147
|
-
*/
|
|
148
|
-
readFile(relativePath: string): Promise<string | null | Error>;
|
|
149
|
-
/**
|
|
150
|
-
* Write content to file at the specified path (creates directory if needed)
|
|
151
|
-
*/
|
|
152
|
-
writeFile(relativePath: string, content: string): Promise<Error | null>;
|
|
153
|
-
/**
|
|
154
|
-
* Delete file at the specified path
|
|
155
|
-
*/
|
|
156
|
-
deleteFile(relativePath: string): Promise<Error | null>;
|
|
157
|
-
/**
|
|
158
|
-
* Get file name from path
|
|
159
|
-
*/
|
|
160
|
-
readFileName(relativePath: string): string;
|
|
161
|
-
/**
|
|
162
|
-
* Get file extension from path
|
|
163
|
-
*/
|
|
164
|
-
readFileExtension(relativePath: string): string;
|
|
165
|
-
/**
|
|
166
|
-
* Get directory path where the file exists
|
|
167
|
-
*/
|
|
168
|
-
readFileDirectory(relativePath: string): string;
|
|
169
|
-
/**
|
|
170
|
-
* Get list of entries in directory
|
|
171
|
-
*/
|
|
172
|
-
readDirectoryFileNames(relativePath?: string): Promise<string[] | Error>;
|
|
173
|
-
/**
|
|
174
|
-
* Get list of file paths in directory
|
|
175
|
-
*/
|
|
176
|
-
readDirectoryFilePaths(relativePath: string): Promise<string[] | Error>;
|
|
177
|
-
/**
|
|
178
|
-
* Check if path is a directory
|
|
179
|
-
*/
|
|
180
|
-
isDirectory(relativePath: string): Promise<boolean>;
|
|
181
|
-
/**
|
|
182
|
-
* Check if path is a file
|
|
183
|
-
*/
|
|
184
|
-
isFile(relativePath: string): Promise<boolean>;
|
|
185
|
-
/**
|
|
186
|
-
* Check if file or directory exists
|
|
187
|
-
*/
|
|
188
|
-
exists(relativePath: string): Promise<boolean>;
|
|
189
|
-
/**
|
|
190
|
-
* Check if directory exists
|
|
191
|
-
*/
|
|
192
|
-
directoryExists(relativePath: string): Promise<boolean>;
|
|
193
|
-
/**
|
|
194
|
-
* Check if file exists
|
|
195
|
-
*/
|
|
196
|
-
fileExists(relativePath: string): Promise<boolean>;
|
|
197
|
-
/**
|
|
198
|
-
* Get base path
|
|
199
|
-
*/
|
|
200
|
-
getBasePath(): string;
|
|
201
|
-
/**
|
|
202
|
-
* Convert relative path to absolute path
|
|
203
|
-
*/
|
|
204
|
-
resolve(relativePath: string): string;
|
|
205
|
-
/**
|
|
206
|
-
* Create directory
|
|
207
|
-
*/
|
|
208
92
|
createDirectory(relativePath: string): Promise<Error | null>;
|
|
209
|
-
/**
|
|
210
|
-
* Get file size in bytes
|
|
211
|
-
*/
|
|
212
|
-
getFileSize(relativePath: string): Promise<number | Error>;
|
|
213
|
-
/**
|
|
214
|
-
* Create directory if it doesn't exist
|
|
215
|
-
*/
|
|
216
|
-
ensureDirectoryExists(relativePath: string): Promise<Error | null>;
|
|
217
93
|
/**
|
|
218
94
|
* Copy file
|
|
219
95
|
*/
|
|
@@ -222,24 +98,16 @@ interface DocFileSystemInterface {
|
|
|
222
98
|
* Move file
|
|
223
99
|
*/
|
|
224
100
|
moveFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
|
|
225
|
-
/**
|
|
226
|
-
* Get file last modified time
|
|
227
|
-
*/
|
|
228
|
-
getFileModifiedTime(relativePath: string): Promise<Date | Error>;
|
|
229
|
-
/**
|
|
230
|
-
* Get file creation time
|
|
231
|
-
*/
|
|
232
|
-
getFileCreatedTime(relativePath: string): Promise<Date | Error>;
|
|
233
101
|
}
|
|
234
102
|
|
|
235
103
|
type Props = {
|
|
236
104
|
basePath: string;
|
|
237
105
|
pathSystem?: DocPathSystem;
|
|
238
|
-
reader
|
|
239
|
-
writer
|
|
106
|
+
reader: DocFileSystemReadInterface;
|
|
107
|
+
writer: DocFileSystemWriteInterface;
|
|
240
108
|
};
|
|
241
109
|
/**
|
|
242
|
-
* File system wrapper with
|
|
110
|
+
* File system wrapper with dependency injection for read/write operations
|
|
243
111
|
*/
|
|
244
112
|
declare class DocFileSystem implements DocFileSystemInterface {
|
|
245
113
|
protected readonly reader: DocFileSystemReadInterface;
|
|
@@ -307,7 +175,7 @@ declare class DocFileSystem implements DocFileSystemInterface {
|
|
|
307
175
|
/**
|
|
308
176
|
* Create directory
|
|
309
177
|
*/
|
|
310
|
-
|
|
178
|
+
createEmptyDirectory(relativePath: string): Promise<Error | null>;
|
|
311
179
|
/**
|
|
312
180
|
* Get file size in bytes
|
|
313
181
|
*/
|
|
@@ -315,7 +183,7 @@ declare class DocFileSystem implements DocFileSystemInterface {
|
|
|
315
183
|
/**
|
|
316
184
|
* Create directory if it doesn't exist
|
|
317
185
|
*/
|
|
318
|
-
|
|
186
|
+
createDirectory(relativePath: string): Promise<Error | null>;
|
|
319
187
|
/**
|
|
320
188
|
* Copy file
|
|
321
189
|
*/
|
|
@@ -327,11 +195,11 @@ declare class DocFileSystem implements DocFileSystemInterface {
|
|
|
327
195
|
/**
|
|
328
196
|
* Get file last modified time
|
|
329
197
|
*/
|
|
330
|
-
|
|
198
|
+
getFileUpdatedTime(relativePath: string): Promise<Date | Error>;
|
|
331
199
|
/**
|
|
332
200
|
* Get file creation time
|
|
333
201
|
*/
|
|
334
202
|
getFileCreatedTime(relativePath: string): Promise<Date | Error>;
|
|
335
203
|
}
|
|
336
204
|
|
|
337
|
-
export { DocFileSystem as D,
|
|
205
|
+
export { DocFileSystem as D, type DocFileSystemReadInterface as a, type DocFileSystemWriteInterface as b };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path operations system
|
|
3
|
+
*/
|
|
4
|
+
declare class DocPathSystem {
|
|
5
|
+
readonly separator = "/";
|
|
6
|
+
/**
|
|
7
|
+
* Join paths
|
|
8
|
+
*/
|
|
9
|
+
join(...paths: string[]): string;
|
|
10
|
+
/**
|
|
11
|
+
* Get filename with extension
|
|
12
|
+
*/
|
|
13
|
+
basename(path: string, ext?: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Get directory name
|
|
16
|
+
*/
|
|
17
|
+
dirname(path: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Get extension
|
|
20
|
+
*/
|
|
21
|
+
extname(path: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Calculate relative path
|
|
24
|
+
*/
|
|
25
|
+
relative(from: string, to: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Convert to absolute path
|
|
28
|
+
*/
|
|
29
|
+
resolve(...paths: string[]): string;
|
|
30
|
+
/**
|
|
31
|
+
* Normalize path
|
|
32
|
+
*/
|
|
33
|
+
normalize(path: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Check if path is absolute
|
|
36
|
+
*/
|
|
37
|
+
isAbsolute(path: string): boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Interface for DocFileSystem class
|
|
42
|
+
* Defines all public methods available in DocFileSystem
|
|
43
|
+
*/
|
|
44
|
+
interface DocFileSystemInterface {
|
|
45
|
+
/**
|
|
46
|
+
* Read file content at the specified path
|
|
47
|
+
*/
|
|
48
|
+
readFile(relativePath: string): Promise<string | null | Error>;
|
|
49
|
+
/**
|
|
50
|
+
* Write content to file at the specified path (creates directory if needed)
|
|
51
|
+
*/
|
|
52
|
+
writeFile(relativePath: string, content: string): Promise<Error | null>;
|
|
53
|
+
/**
|
|
54
|
+
* Delete file at the specified path
|
|
55
|
+
*/
|
|
56
|
+
deleteFile(relativePath: string): Promise<Error | null>;
|
|
57
|
+
/**
|
|
58
|
+
* Get file name from path
|
|
59
|
+
*/
|
|
60
|
+
readFileName(relativePath: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* Get file extension from path
|
|
63
|
+
*/
|
|
64
|
+
readFileExtension(relativePath: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Get directory path where the file exists
|
|
67
|
+
*/
|
|
68
|
+
readFileDirectory(relativePath: string): string;
|
|
69
|
+
/**
|
|
70
|
+
* Get list of entries in directory
|
|
71
|
+
*/
|
|
72
|
+
readDirectoryFileNames(relativePath?: string): Promise<string[] | Error>;
|
|
73
|
+
/**
|
|
74
|
+
* Get list of file paths in directory
|
|
75
|
+
*/
|
|
76
|
+
readDirectoryFilePaths(relativePath: string): Promise<string[] | Error>;
|
|
77
|
+
/**
|
|
78
|
+
* Check if path is a directory
|
|
79
|
+
*/
|
|
80
|
+
isDirectory(relativePath: string): Promise<boolean>;
|
|
81
|
+
/**
|
|
82
|
+
* Check if path is a file
|
|
83
|
+
*/
|
|
84
|
+
isFile(relativePath: string): Promise<boolean>;
|
|
85
|
+
/**
|
|
86
|
+
* Check if file or directory exists
|
|
87
|
+
*/
|
|
88
|
+
exists(relativePath: string): Promise<boolean>;
|
|
89
|
+
/**
|
|
90
|
+
* Check if directory exists
|
|
91
|
+
*/
|
|
92
|
+
directoryExists(relativePath: string): Promise<boolean>;
|
|
93
|
+
/**
|
|
94
|
+
* Check if file exists
|
|
95
|
+
*/
|
|
96
|
+
fileExists(relativePath: string): Promise<boolean>;
|
|
97
|
+
/**
|
|
98
|
+
* Get base path
|
|
99
|
+
*/
|
|
100
|
+
getBasePath(): string;
|
|
101
|
+
/**
|
|
102
|
+
* Convert relative path to absolute path
|
|
103
|
+
*/
|
|
104
|
+
resolve(relativePath: string): string;
|
|
105
|
+
/**
|
|
106
|
+
* Create directory
|
|
107
|
+
*/
|
|
108
|
+
createEmptyDirectory(relativePath: string): Promise<Error | null>;
|
|
109
|
+
/**
|
|
110
|
+
* Get file size in bytes
|
|
111
|
+
*/
|
|
112
|
+
getFileSize(relativePath: string): Promise<number | Error>;
|
|
113
|
+
/**
|
|
114
|
+
* Create directory if it doesn't exist
|
|
115
|
+
*/
|
|
116
|
+
createDirectory(relativePath: string): Promise<Error | null>;
|
|
117
|
+
/**
|
|
118
|
+
* Copy file
|
|
119
|
+
*/
|
|
120
|
+
copyFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
|
|
121
|
+
/**
|
|
122
|
+
* Move file
|
|
123
|
+
*/
|
|
124
|
+
moveFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
|
|
125
|
+
/**
|
|
126
|
+
* Get file last modified time
|
|
127
|
+
*/
|
|
128
|
+
getFileUpdatedTime(relativePath: string): Promise<Date | Error>;
|
|
129
|
+
/**
|
|
130
|
+
* Get file creation time
|
|
131
|
+
*/
|
|
132
|
+
getFileCreatedTime(relativePath: string): Promise<Date | Error>;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export { type DocFileSystemInterface as D, DocPathSystem as a };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { a as DocPathSystem } from './doc-file-system.interface-C5vpYrOL.js';
|
|
3
|
+
import { D as DocFileSystem, a as DocFileSystemReadInterface, b as DocFileSystemWriteInterface } from './doc-file-system-DEmPPJPE.js';
|
|
3
4
|
|
|
4
5
|
declare const zJsonDocumentData$2: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
5
6
|
type JsonDocumentData$2 = z.infer<typeof zJsonDocumentData$2>;
|
|
@@ -120,7 +121,7 @@ declare class DocFileSystemJsonRead implements DocFileSystemReadInterface {
|
|
|
120
121
|
/**
|
|
121
122
|
* Get file last modified time (not available for JSON data)
|
|
122
123
|
*/
|
|
123
|
-
|
|
124
|
+
getFileUpdatedTime(_relativePath: string): Promise<Date | Error>;
|
|
124
125
|
/**
|
|
125
126
|
* Get file creation time (not available for JSON data)
|
|
126
127
|
*/
|
|
@@ -177,11 +178,11 @@ declare class DocFileSystemJsonWrite implements DocFileSystemWriteInterface {
|
|
|
177
178
|
/**
|
|
178
179
|
* Create directory (creates a placeholder entry)
|
|
179
180
|
*/
|
|
180
|
-
|
|
181
|
+
createEmptyDirectory(relativePath: string): Promise<Error | null>;
|
|
181
182
|
/**
|
|
182
183
|
* Create directory if it doesn't exist
|
|
183
184
|
*/
|
|
184
|
-
|
|
185
|
+
createDirectory(relativePath: string): Promise<Error | null>;
|
|
185
186
|
/**
|
|
186
187
|
* Copy file within JSON data
|
|
187
188
|
*/
|