@interactive-inc/docs-client 1.0.19 → 1.1.0
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/.env.local +3 -0
- package/build/doc-file-system-BQAOBIO-.d.ts +337 -0
- package/build/file-system-json.d.ts +223 -0
- package/build/file-system-json.js +1043 -0
- package/build/file-system-mock.d.ts +92 -0
- package/build/file-system-mock.js +901 -0
- package/build/file-system-octokit.d.ts +173 -0
- package/build/file-system-octokit.js +1002 -0
- package/build/file-system.d.ts +117 -0
- package/build/file-system.js +537 -0
- package/build/index.d.ts +1006 -1292
- package/build/index.js +3032 -3722
- package/package.json +8 -3
package/.env.local
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
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
|
+
* Read-only file system interface for document operations
|
|
42
|
+
*/
|
|
43
|
+
interface DocFileSystemReadInterface {
|
|
44
|
+
/**
|
|
45
|
+
* Read file content at the specified path
|
|
46
|
+
*/
|
|
47
|
+
readFile(relativePath: string): Promise<string | null | Error>;
|
|
48
|
+
/**
|
|
49
|
+
* Get file name from path
|
|
50
|
+
*/
|
|
51
|
+
readFileName(relativePath: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Get file extension from path
|
|
54
|
+
*/
|
|
55
|
+
readFileExtension(relativePath: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Get directory path where the file exists
|
|
58
|
+
*/
|
|
59
|
+
readFileDirectory(relativePath: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Get list of entries in directory
|
|
62
|
+
*/
|
|
63
|
+
readDirectoryFileNames(relativePath?: string): Promise<string[] | Error>;
|
|
64
|
+
/**
|
|
65
|
+
* Get list of file paths in directory
|
|
66
|
+
*/
|
|
67
|
+
readDirectoryFilePaths(relativePath: string): Promise<string[] | Error>;
|
|
68
|
+
/**
|
|
69
|
+
* Check if path is a directory
|
|
70
|
+
*/
|
|
71
|
+
isDirectory(relativePath: string): Promise<boolean>;
|
|
72
|
+
/**
|
|
73
|
+
* Check if path is a file
|
|
74
|
+
*/
|
|
75
|
+
isFile(relativePath: string): Promise<boolean>;
|
|
76
|
+
/**
|
|
77
|
+
* Check if file or directory exists
|
|
78
|
+
*/
|
|
79
|
+
exists(relativePath: string): Promise<boolean>;
|
|
80
|
+
/**
|
|
81
|
+
* Check if directory exists
|
|
82
|
+
*/
|
|
83
|
+
directoryExists(relativePath: string): Promise<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* Check if file exists
|
|
86
|
+
*/
|
|
87
|
+
fileExists(relativePath: string): Promise<boolean>;
|
|
88
|
+
/**
|
|
89
|
+
* Get base path
|
|
90
|
+
*/
|
|
91
|
+
getBasePath(): string;
|
|
92
|
+
/**
|
|
93
|
+
* Convert relative path to absolute path
|
|
94
|
+
*/
|
|
95
|
+
resolve(relativePath: string): string;
|
|
96
|
+
/**
|
|
97
|
+
* Get file size in bytes
|
|
98
|
+
*/
|
|
99
|
+
getFileSize(relativePath: string): Promise<number | Error>;
|
|
100
|
+
/**
|
|
101
|
+
* Get file last modified time
|
|
102
|
+
*/
|
|
103
|
+
getFileModifiedTime(relativePath: string): Promise<Date | Error>;
|
|
104
|
+
/**
|
|
105
|
+
* Get file creation time
|
|
106
|
+
*/
|
|
107
|
+
getFileCreatedTime(relativePath: string): Promise<Date | Error>;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Write-only file system interface for document operations
|
|
112
|
+
*/
|
|
113
|
+
interface DocFileSystemWriteInterface {
|
|
114
|
+
/**
|
|
115
|
+
* Write content to file at the specified path (creates directory if needed)
|
|
116
|
+
*/
|
|
117
|
+
writeFile(relativePath: string, content: string): Promise<Error | null>;
|
|
118
|
+
/**
|
|
119
|
+
* Delete file at the specified path
|
|
120
|
+
*/
|
|
121
|
+
deleteFile(relativePath: string): Promise<Error | null>;
|
|
122
|
+
/**
|
|
123
|
+
* Create directory
|
|
124
|
+
*/
|
|
125
|
+
createDirectory(relativePath: string): Promise<Error | null>;
|
|
126
|
+
/**
|
|
127
|
+
* Create directory if it doesn't exist
|
|
128
|
+
*/
|
|
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
|
+
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
|
+
/**
|
|
218
|
+
* Copy file
|
|
219
|
+
*/
|
|
220
|
+
copyFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
|
|
221
|
+
/**
|
|
222
|
+
* Move file
|
|
223
|
+
*/
|
|
224
|
+
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
|
+
}
|
|
234
|
+
|
|
235
|
+
type Props = {
|
|
236
|
+
basePath: string;
|
|
237
|
+
pathSystem?: DocPathSystem;
|
|
238
|
+
reader?: DocFileSystemReadInterface;
|
|
239
|
+
writer?: DocFileSystemWriteInterface;
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* File system wrapper with optional dependency injection for read/write operations
|
|
243
|
+
*/
|
|
244
|
+
declare class DocFileSystem implements DocFileSystemInterface {
|
|
245
|
+
protected readonly reader: DocFileSystemReadInterface;
|
|
246
|
+
protected readonly writer: DocFileSystemWriteInterface;
|
|
247
|
+
protected readonly basePath: string;
|
|
248
|
+
protected readonly pathSystem: DocPathSystem;
|
|
249
|
+
constructor(props: Props);
|
|
250
|
+
/**
|
|
251
|
+
* Read file content at the specified path
|
|
252
|
+
*/
|
|
253
|
+
readFile(relativePath: string): Promise<string | null | Error>;
|
|
254
|
+
/**
|
|
255
|
+
* Write content to file at the specified path (creates directory if needed)
|
|
256
|
+
*/
|
|
257
|
+
writeFile(relativePath: string, content: string): Promise<Error | null>;
|
|
258
|
+
/**
|
|
259
|
+
* Delete file at the specified path
|
|
260
|
+
*/
|
|
261
|
+
deleteFile(relativePath: string): Promise<Error | null>;
|
|
262
|
+
/**
|
|
263
|
+
* Get file name from path
|
|
264
|
+
*/
|
|
265
|
+
readFileName(relativePath: string): string;
|
|
266
|
+
/**
|
|
267
|
+
* Get file extension from path
|
|
268
|
+
*/
|
|
269
|
+
readFileExtension(relativePath: string): string;
|
|
270
|
+
/**
|
|
271
|
+
* Get directory path where the file exists
|
|
272
|
+
*/
|
|
273
|
+
readFileDirectory(relativePath: string): string;
|
|
274
|
+
/**
|
|
275
|
+
* Get list of entries in directory
|
|
276
|
+
*/
|
|
277
|
+
readDirectoryFileNames(relativePath?: string): Promise<string[] | Error>;
|
|
278
|
+
readDirectoryFilePaths(relativePath: string): Promise<string[] | Error>;
|
|
279
|
+
/**
|
|
280
|
+
* Check if path is a directory
|
|
281
|
+
*/
|
|
282
|
+
isDirectory(relativePath: string): Promise<boolean>;
|
|
283
|
+
/**
|
|
284
|
+
* Check if path is a file
|
|
285
|
+
*/
|
|
286
|
+
isFile(relativePath: string): Promise<boolean>;
|
|
287
|
+
/**
|
|
288
|
+
* Check if file or directory exists
|
|
289
|
+
*/
|
|
290
|
+
exists(relativePath: string): Promise<boolean>;
|
|
291
|
+
/**
|
|
292
|
+
* Check if directory exists
|
|
293
|
+
*/
|
|
294
|
+
directoryExists(relativePath: string): Promise<boolean>;
|
|
295
|
+
/**
|
|
296
|
+
* Check if file exists
|
|
297
|
+
*/
|
|
298
|
+
fileExists(relativePath: string): Promise<boolean>;
|
|
299
|
+
/**
|
|
300
|
+
* Get base path
|
|
301
|
+
*/
|
|
302
|
+
getBasePath(): string;
|
|
303
|
+
/**
|
|
304
|
+
* Convert relative path to absolute path
|
|
305
|
+
*/
|
|
306
|
+
resolve(relativePath: string): string;
|
|
307
|
+
/**
|
|
308
|
+
* Create directory
|
|
309
|
+
*/
|
|
310
|
+
createDirectory(relativePath: string): Promise<Error | null>;
|
|
311
|
+
/**
|
|
312
|
+
* Get file size in bytes
|
|
313
|
+
*/
|
|
314
|
+
getFileSize(relativePath: string): Promise<number | Error>;
|
|
315
|
+
/**
|
|
316
|
+
* Create directory if it doesn't exist
|
|
317
|
+
*/
|
|
318
|
+
ensureDirectoryExists(relativePath: string): Promise<Error | null>;
|
|
319
|
+
/**
|
|
320
|
+
* Copy file
|
|
321
|
+
*/
|
|
322
|
+
copyFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
|
|
323
|
+
/**
|
|
324
|
+
* Move file
|
|
325
|
+
*/
|
|
326
|
+
moveFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
|
|
327
|
+
/**
|
|
328
|
+
* Get file last modified time
|
|
329
|
+
*/
|
|
330
|
+
getFileModifiedTime(relativePath: string): Promise<Date | Error>;
|
|
331
|
+
/**
|
|
332
|
+
* Get file creation time
|
|
333
|
+
*/
|
|
334
|
+
getFileCreatedTime(relativePath: string): Promise<Date | Error>;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
export { DocFileSystem as D, DocPathSystem as a, type DocFileSystemReadInterface as b, type DocFileSystemWriteInterface as c, type DocFileSystemInterface as d };
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { D as DocFileSystem, a as DocPathSystem, b as DocFileSystemReadInterface, c as DocFileSystemWriteInterface } from './doc-file-system-BQAOBIO-.js';
|
|
3
|
+
|
|
4
|
+
declare const zJsonDocumentData$2: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
5
|
+
type JsonDocumentData$2 = z.infer<typeof zJsonDocumentData$2>;
|
|
6
|
+
type JsonProps = {
|
|
7
|
+
data?: JsonDocumentData$2 | unknown;
|
|
8
|
+
basePath?: string;
|
|
9
|
+
pathSystem?: DocPathSystem;
|
|
10
|
+
onDataChange?: (data: JsonDocumentData$2) => void;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* JSON-based file system with separate read/write components
|
|
14
|
+
*/
|
|
15
|
+
declare class DocFileSystemJson extends DocFileSystem {
|
|
16
|
+
private readonly jsonReader;
|
|
17
|
+
private readonly jsonWriter;
|
|
18
|
+
constructor(props?: JsonProps);
|
|
19
|
+
/**
|
|
20
|
+
* Get the current JSON data
|
|
21
|
+
*/
|
|
22
|
+
getData(): JsonDocumentData$2;
|
|
23
|
+
/**
|
|
24
|
+
* Update the entire JSON data
|
|
25
|
+
*/
|
|
26
|
+
setData(data: JsonDocumentData$2 | unknown): Error | null;
|
|
27
|
+
/**
|
|
28
|
+
* Clear all data
|
|
29
|
+
*/
|
|
30
|
+
clear(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Get all file paths in the JSON data
|
|
33
|
+
*/
|
|
34
|
+
getAllFilePaths(): string[];
|
|
35
|
+
/**
|
|
36
|
+
* Get the raw JSON data (read-only copy)
|
|
37
|
+
*/
|
|
38
|
+
getRawData(): JsonDocumentData$2;
|
|
39
|
+
/**
|
|
40
|
+
* Create from docs-to-json format
|
|
41
|
+
*/
|
|
42
|
+
static fromDocsToJson(data: Record<string, string> | unknown, options?: Omit<JsonProps, "data">): DocFileSystemJson;
|
|
43
|
+
/**
|
|
44
|
+
* Export to docs-to-json format
|
|
45
|
+
*/
|
|
46
|
+
toDocsToJson(): Record<string, string>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare const zJsonDocumentData$1: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
50
|
+
type JsonDocumentData$1 = z.infer<typeof zJsonDocumentData$1>;
|
|
51
|
+
type Props$1 = {
|
|
52
|
+
data: JsonDocumentData$1 | unknown;
|
|
53
|
+
basePath?: string;
|
|
54
|
+
pathSystem?: DocPathSystem;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* JSON-based read-only file system implementation
|
|
58
|
+
*/
|
|
59
|
+
declare class DocFileSystemJsonRead implements DocFileSystemReadInterface {
|
|
60
|
+
private readonly data;
|
|
61
|
+
private readonly basePath;
|
|
62
|
+
private readonly pathSystem;
|
|
63
|
+
constructor(props: Props$1);
|
|
64
|
+
/**
|
|
65
|
+
* Read file content from JSON data
|
|
66
|
+
*/
|
|
67
|
+
readFile(relativePath: string): Promise<string | null | Error>;
|
|
68
|
+
/**
|
|
69
|
+
* Get file name from path
|
|
70
|
+
*/
|
|
71
|
+
readFileName(relativePath: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* Get file extension from path
|
|
74
|
+
*/
|
|
75
|
+
readFileExtension(relativePath: string): string;
|
|
76
|
+
/**
|
|
77
|
+
* Get directory path where the file exists
|
|
78
|
+
*/
|
|
79
|
+
readFileDirectory(relativePath: string): string;
|
|
80
|
+
/**
|
|
81
|
+
* Get list of file names in directory
|
|
82
|
+
*/
|
|
83
|
+
readDirectoryFileNames(relativePath?: string): Promise<string[] | Error>;
|
|
84
|
+
/**
|
|
85
|
+
* Get list of file paths in directory
|
|
86
|
+
*/
|
|
87
|
+
readDirectoryFilePaths(relativePath: string): Promise<string[] | Error>;
|
|
88
|
+
/**
|
|
89
|
+
* Check if path is a directory
|
|
90
|
+
*/
|
|
91
|
+
isDirectory(relativePath: string): Promise<boolean>;
|
|
92
|
+
/**
|
|
93
|
+
* Check if path is a file
|
|
94
|
+
*/
|
|
95
|
+
isFile(relativePath: string): Promise<boolean>;
|
|
96
|
+
/**
|
|
97
|
+
* Check if file or directory exists
|
|
98
|
+
*/
|
|
99
|
+
exists(relativePath: string): Promise<boolean>;
|
|
100
|
+
/**
|
|
101
|
+
* Check if directory exists
|
|
102
|
+
*/
|
|
103
|
+
directoryExists(relativePath: string): Promise<boolean>;
|
|
104
|
+
/**
|
|
105
|
+
* Check if file exists
|
|
106
|
+
*/
|
|
107
|
+
fileExists(relativePath: string): Promise<boolean>;
|
|
108
|
+
/**
|
|
109
|
+
* Get base path
|
|
110
|
+
*/
|
|
111
|
+
getBasePath(): string;
|
|
112
|
+
/**
|
|
113
|
+
* Convert relative path to absolute path
|
|
114
|
+
*/
|
|
115
|
+
resolve(relativePath: string): string;
|
|
116
|
+
/**
|
|
117
|
+
* Get file size in bytes
|
|
118
|
+
*/
|
|
119
|
+
getFileSize(relativePath: string): Promise<number | Error>;
|
|
120
|
+
/**
|
|
121
|
+
* Get file last modified time (not available for JSON data)
|
|
122
|
+
*/
|
|
123
|
+
getFileModifiedTime(_relativePath: string): Promise<Date | Error>;
|
|
124
|
+
/**
|
|
125
|
+
* Get file creation time (not available for JSON data)
|
|
126
|
+
*/
|
|
127
|
+
getFileCreatedTime(_relativePath: string): Promise<Date | Error>;
|
|
128
|
+
/**
|
|
129
|
+
* Get all file paths in the JSON data
|
|
130
|
+
*/
|
|
131
|
+
getAllFilePaths(): string[];
|
|
132
|
+
/**
|
|
133
|
+
* Get the raw JSON data
|
|
134
|
+
*/
|
|
135
|
+
getRawData(): JsonDocumentData$1;
|
|
136
|
+
/**
|
|
137
|
+
* Normalize path by removing leading/trailing slashes
|
|
138
|
+
*/
|
|
139
|
+
private normalizePath;
|
|
140
|
+
/**
|
|
141
|
+
* Check if a file path is within a directory
|
|
142
|
+
*/
|
|
143
|
+
private isFileInDirectory;
|
|
144
|
+
/**
|
|
145
|
+
* Get the relative part of a file path from a directory
|
|
146
|
+
*/
|
|
147
|
+
private getRelativePartFromDirectory;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
declare const zJsonDocumentData: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
151
|
+
type JsonDocumentData = z.infer<typeof zJsonDocumentData>;
|
|
152
|
+
type Props = {
|
|
153
|
+
data?: JsonDocumentData | unknown;
|
|
154
|
+
basePath?: string;
|
|
155
|
+
pathSystem?: DocPathSystem;
|
|
156
|
+
reader?: DocFileSystemReadInterface;
|
|
157
|
+
onDataChange?: (data: JsonDocumentData) => void;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* JSON-based write-only file system implementation
|
|
161
|
+
*/
|
|
162
|
+
declare class DocFileSystemJsonWrite implements DocFileSystemWriteInterface {
|
|
163
|
+
private data;
|
|
164
|
+
private readonly basePath;
|
|
165
|
+
private readonly pathSystem;
|
|
166
|
+
private readonly reader?;
|
|
167
|
+
private readonly onDataChange?;
|
|
168
|
+
constructor(props?: Props);
|
|
169
|
+
/**
|
|
170
|
+
* Write content to JSON data
|
|
171
|
+
*/
|
|
172
|
+
writeFile(relativePath: string, content: string): Promise<Error | null>;
|
|
173
|
+
/**
|
|
174
|
+
* Delete file from JSON data
|
|
175
|
+
*/
|
|
176
|
+
deleteFile(relativePath: string): Promise<Error | null>;
|
|
177
|
+
/**
|
|
178
|
+
* Create directory (creates a placeholder entry)
|
|
179
|
+
*/
|
|
180
|
+
createDirectory(relativePath: string): Promise<Error | null>;
|
|
181
|
+
/**
|
|
182
|
+
* Create directory if it doesn't exist
|
|
183
|
+
*/
|
|
184
|
+
ensureDirectoryExists(relativePath: string): Promise<Error | null>;
|
|
185
|
+
/**
|
|
186
|
+
* Copy file within JSON data
|
|
187
|
+
*/
|
|
188
|
+
copyFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
|
|
189
|
+
/**
|
|
190
|
+
* Move file within JSON data
|
|
191
|
+
*/
|
|
192
|
+
moveFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
|
|
193
|
+
/**
|
|
194
|
+
* Get the current JSON data
|
|
195
|
+
*/
|
|
196
|
+
getData(): JsonDocumentData;
|
|
197
|
+
/**
|
|
198
|
+
* Update the entire JSON data
|
|
199
|
+
*/
|
|
200
|
+
setData(data: JsonDocumentData | unknown): Error | null;
|
|
201
|
+
/**
|
|
202
|
+
* Clear all data
|
|
203
|
+
*/
|
|
204
|
+
clear(): void;
|
|
205
|
+
/**
|
|
206
|
+
* Get all file paths in the JSON data
|
|
207
|
+
*/
|
|
208
|
+
getAllFilePaths(): string[];
|
|
209
|
+
/**
|
|
210
|
+
* Normalize path by removing leading/trailing slashes
|
|
211
|
+
*/
|
|
212
|
+
private normalizePath;
|
|
213
|
+
/**
|
|
214
|
+
* Check if directory exists in data
|
|
215
|
+
*/
|
|
216
|
+
private directoryExistsInData;
|
|
217
|
+
/**
|
|
218
|
+
* Notify data change callback
|
|
219
|
+
*/
|
|
220
|
+
private notifyDataChange;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export { DocFileSystemJson, DocFileSystemJsonRead, DocFileSystemJsonWrite };
|