@interactive-inc/docs-client 1.0.20 → 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.
@@ -0,0 +1,205 @@
1
+ import { D as DocFileSystemInterface, a as DocPathSystem } from './doc-file-system.interface-C5vpYrOL.js';
2
+
3
+ /**
4
+ * Read-only file system interface for document operations
5
+ */
6
+ interface DocFileSystemReadInterface {
7
+ /**
8
+ * Read file content at the specified path
9
+ */
10
+ readFile(relativePath: string): Promise<string | null | Error>;
11
+ /**
12
+ * Get file name from path
13
+ */
14
+ readFileName(relativePath: string): string;
15
+ /**
16
+ * Get file extension from path
17
+ */
18
+ readFileExtension(relativePath: string): string;
19
+ /**
20
+ * Get directory path where the file exists
21
+ */
22
+ readFileDirectory(relativePath: string): string;
23
+ /**
24
+ * Get list of entries in directory
25
+ */
26
+ readDirectoryFileNames(relativePath?: string): Promise<string[] | Error>;
27
+ /**
28
+ * Get list of file paths in directory
29
+ */
30
+ readDirectoryFilePaths(relativePath: string): Promise<string[] | Error>;
31
+ /**
32
+ * Check if path is a directory
33
+ */
34
+ isDirectory(relativePath: string): Promise<boolean>;
35
+ /**
36
+ * Check if path is a file
37
+ */
38
+ isFile(relativePath: string): Promise<boolean>;
39
+ /**
40
+ * Check if file or directory exists
41
+ */
42
+ exists(relativePath: string): Promise<boolean>;
43
+ /**
44
+ * Check if directory exists
45
+ */
46
+ directoryExists(relativePath: string): Promise<boolean>;
47
+ /**
48
+ * Check if file exists
49
+ */
50
+ fileExists(relativePath: string): Promise<boolean>;
51
+ /**
52
+ * Get base path
53
+ */
54
+ getBasePath(): string;
55
+ /**
56
+ * Convert relative path to absolute path
57
+ */
58
+ resolve(relativePath: string): string;
59
+ /**
60
+ * Get file size in bytes
61
+ */
62
+ getFileSize(relativePath: string): Promise<number | Error>;
63
+ /**
64
+ * Get file last modified time
65
+ */
66
+ getFileUpdatedTime(relativePath: string): Promise<Date | Error>;
67
+ /**
68
+ * Get file creation time
69
+ */
70
+ getFileCreatedTime(relativePath: string): Promise<Date | Error>;
71
+ }
72
+
73
+ /**
74
+ * Write-only file system interface for document operations
75
+ */
76
+ interface DocFileSystemWriteInterface {
77
+ /**
78
+ * Write content to file at the specified path (creates directory if needed)
79
+ */
80
+ writeFile(relativePath: string, content: string): Promise<Error | null>;
81
+ /**
82
+ * Delete file at the specified path
83
+ */
84
+ deleteFile(relativePath: string): Promise<Error | null>;
85
+ /**
86
+ * Create directory
87
+ */
88
+ createEmptyDirectory(relativePath: string): Promise<Error | null>;
89
+ /**
90
+ * Create directory if it doesn't exist
91
+ */
92
+ createDirectory(relativePath: string): Promise<Error | null>;
93
+ /**
94
+ * Copy file
95
+ */
96
+ copyFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
97
+ /**
98
+ * Move file
99
+ */
100
+ moveFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
101
+ }
102
+
103
+ type Props = {
104
+ basePath: string;
105
+ pathSystem?: DocPathSystem;
106
+ reader: DocFileSystemReadInterface;
107
+ writer: DocFileSystemWriteInterface;
108
+ };
109
+ /**
110
+ * File system wrapper with dependency injection for read/write operations
111
+ */
112
+ declare class DocFileSystem implements DocFileSystemInterface {
113
+ protected readonly reader: DocFileSystemReadInterface;
114
+ protected readonly writer: DocFileSystemWriteInterface;
115
+ protected readonly basePath: string;
116
+ protected readonly pathSystem: DocPathSystem;
117
+ constructor(props: Props);
118
+ /**
119
+ * Read file content at the specified path
120
+ */
121
+ readFile(relativePath: string): Promise<string | null | Error>;
122
+ /**
123
+ * Write content to file at the specified path (creates directory if needed)
124
+ */
125
+ writeFile(relativePath: string, content: string): Promise<Error | null>;
126
+ /**
127
+ * Delete file at the specified path
128
+ */
129
+ deleteFile(relativePath: string): Promise<Error | null>;
130
+ /**
131
+ * Get file name from path
132
+ */
133
+ readFileName(relativePath: string): string;
134
+ /**
135
+ * Get file extension from path
136
+ */
137
+ readFileExtension(relativePath: string): string;
138
+ /**
139
+ * Get directory path where the file exists
140
+ */
141
+ readFileDirectory(relativePath: string): string;
142
+ /**
143
+ * Get list of entries in directory
144
+ */
145
+ readDirectoryFileNames(relativePath?: string): Promise<string[] | Error>;
146
+ readDirectoryFilePaths(relativePath: string): Promise<string[] | Error>;
147
+ /**
148
+ * Check if path is a directory
149
+ */
150
+ isDirectory(relativePath: string): Promise<boolean>;
151
+ /**
152
+ * Check if path is a file
153
+ */
154
+ isFile(relativePath: string): Promise<boolean>;
155
+ /**
156
+ * Check if file or directory exists
157
+ */
158
+ exists(relativePath: string): Promise<boolean>;
159
+ /**
160
+ * Check if directory exists
161
+ */
162
+ directoryExists(relativePath: string): Promise<boolean>;
163
+ /**
164
+ * Check if file exists
165
+ */
166
+ fileExists(relativePath: string): Promise<boolean>;
167
+ /**
168
+ * Get base path
169
+ */
170
+ getBasePath(): string;
171
+ /**
172
+ * Convert relative path to absolute path
173
+ */
174
+ resolve(relativePath: string): string;
175
+ /**
176
+ * Create directory
177
+ */
178
+ createEmptyDirectory(relativePath: string): Promise<Error | null>;
179
+ /**
180
+ * Get file size in bytes
181
+ */
182
+ getFileSize(relativePath: string): Promise<number | Error>;
183
+ /**
184
+ * Create directory if it doesn't exist
185
+ */
186
+ createDirectory(relativePath: string): Promise<Error | null>;
187
+ /**
188
+ * Copy file
189
+ */
190
+ copyFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
191
+ /**
192
+ * Move file
193
+ */
194
+ moveFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
195
+ /**
196
+ * Get file last modified time
197
+ */
198
+ getFileUpdatedTime(relativePath: string): Promise<Date | Error>;
199
+ /**
200
+ * Get file creation time
201
+ */
202
+ getFileCreatedTime(relativePath: string): Promise<Date | Error>;
203
+ }
204
+
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 };
@@ -0,0 +1,224 @@
1
+ import { z } from 'zod';
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';
4
+
5
+ declare const zJsonDocumentData$2: z.ZodRecord<z.ZodString, z.ZodString>;
6
+ type JsonDocumentData$2 = z.infer<typeof zJsonDocumentData$2>;
7
+ type JsonProps = {
8
+ data?: JsonDocumentData$2 | unknown;
9
+ basePath?: string;
10
+ pathSystem?: DocPathSystem;
11
+ onDataChange?: (data: JsonDocumentData$2) => void;
12
+ };
13
+ /**
14
+ * JSON-based file system with separate read/write components
15
+ */
16
+ declare class DocFileSystemJson extends DocFileSystem {
17
+ private readonly jsonReader;
18
+ private readonly jsonWriter;
19
+ constructor(props?: JsonProps);
20
+ /**
21
+ * Get the current JSON data
22
+ */
23
+ getData(): JsonDocumentData$2;
24
+ /**
25
+ * Update the entire JSON data
26
+ */
27
+ setData(data: JsonDocumentData$2 | unknown): Error | null;
28
+ /**
29
+ * Clear all data
30
+ */
31
+ clear(): void;
32
+ /**
33
+ * Get all file paths in the JSON data
34
+ */
35
+ getAllFilePaths(): string[];
36
+ /**
37
+ * Get the raw JSON data (read-only copy)
38
+ */
39
+ getRawData(): JsonDocumentData$2;
40
+ /**
41
+ * Create from docs-to-json format
42
+ */
43
+ static fromDocsToJson(data: Record<string, string> | unknown, options?: Omit<JsonProps, "data">): DocFileSystemJson;
44
+ /**
45
+ * Export to docs-to-json format
46
+ */
47
+ toDocsToJson(): Record<string, string>;
48
+ }
49
+
50
+ declare const zJsonDocumentData$1: z.ZodRecord<z.ZodString, z.ZodString>;
51
+ type JsonDocumentData$1 = z.infer<typeof zJsonDocumentData$1>;
52
+ type Props$1 = {
53
+ data: JsonDocumentData$1 | unknown;
54
+ basePath?: string;
55
+ pathSystem?: DocPathSystem;
56
+ };
57
+ /**
58
+ * JSON-based read-only file system implementation
59
+ */
60
+ declare class DocFileSystemJsonRead implements DocFileSystemReadInterface {
61
+ private readonly data;
62
+ private readonly basePath;
63
+ private readonly pathSystem;
64
+ constructor(props: Props$1);
65
+ /**
66
+ * Read file content from JSON data
67
+ */
68
+ readFile(relativePath: string): Promise<string | null | Error>;
69
+ /**
70
+ * Get file name from path
71
+ */
72
+ readFileName(relativePath: string): string;
73
+ /**
74
+ * Get file extension from path
75
+ */
76
+ readFileExtension(relativePath: string): string;
77
+ /**
78
+ * Get directory path where the file exists
79
+ */
80
+ readFileDirectory(relativePath: string): string;
81
+ /**
82
+ * Get list of file names in directory
83
+ */
84
+ readDirectoryFileNames(relativePath?: string): Promise<string[] | Error>;
85
+ /**
86
+ * Get list of file paths in directory
87
+ */
88
+ readDirectoryFilePaths(relativePath: string): Promise<string[] | Error>;
89
+ /**
90
+ * Check if path is a directory
91
+ */
92
+ isDirectory(relativePath: string): Promise<boolean>;
93
+ /**
94
+ * Check if path is a file
95
+ */
96
+ isFile(relativePath: string): Promise<boolean>;
97
+ /**
98
+ * Check if file or directory exists
99
+ */
100
+ exists(relativePath: string): Promise<boolean>;
101
+ /**
102
+ * Check if directory exists
103
+ */
104
+ directoryExists(relativePath: string): Promise<boolean>;
105
+ /**
106
+ * Check if file exists
107
+ */
108
+ fileExists(relativePath: string): Promise<boolean>;
109
+ /**
110
+ * Get base path
111
+ */
112
+ getBasePath(): string;
113
+ /**
114
+ * Convert relative path to absolute path
115
+ */
116
+ resolve(relativePath: string): string;
117
+ /**
118
+ * Get file size in bytes
119
+ */
120
+ getFileSize(relativePath: string): Promise<number | Error>;
121
+ /**
122
+ * Get file last modified time (not available for JSON data)
123
+ */
124
+ getFileUpdatedTime(_relativePath: string): Promise<Date | Error>;
125
+ /**
126
+ * Get file creation time (not available for JSON data)
127
+ */
128
+ getFileCreatedTime(_relativePath: string): Promise<Date | Error>;
129
+ /**
130
+ * Get all file paths in the JSON data
131
+ */
132
+ getAllFilePaths(): string[];
133
+ /**
134
+ * Get the raw JSON data
135
+ */
136
+ getRawData(): JsonDocumentData$1;
137
+ /**
138
+ * Normalize path by removing leading/trailing slashes
139
+ */
140
+ private normalizePath;
141
+ /**
142
+ * Check if a file path is within a directory
143
+ */
144
+ private isFileInDirectory;
145
+ /**
146
+ * Get the relative part of a file path from a directory
147
+ */
148
+ private getRelativePartFromDirectory;
149
+ }
150
+
151
+ declare const zJsonDocumentData: z.ZodRecord<z.ZodString, z.ZodString>;
152
+ type JsonDocumentData = z.infer<typeof zJsonDocumentData>;
153
+ type Props = {
154
+ data?: JsonDocumentData | unknown;
155
+ basePath?: string;
156
+ pathSystem?: DocPathSystem;
157
+ reader?: DocFileSystemReadInterface;
158
+ onDataChange?: (data: JsonDocumentData) => void;
159
+ };
160
+ /**
161
+ * JSON-based write-only file system implementation
162
+ */
163
+ declare class DocFileSystemJsonWrite implements DocFileSystemWriteInterface {
164
+ private data;
165
+ private readonly basePath;
166
+ private readonly pathSystem;
167
+ private readonly reader?;
168
+ private readonly onDataChange?;
169
+ constructor(props?: Props);
170
+ /**
171
+ * Write content to JSON data
172
+ */
173
+ writeFile(relativePath: string, content: string): Promise<Error | null>;
174
+ /**
175
+ * Delete file from JSON data
176
+ */
177
+ deleteFile(relativePath: string): Promise<Error | null>;
178
+ /**
179
+ * Create directory (creates a placeholder entry)
180
+ */
181
+ createEmptyDirectory(relativePath: string): Promise<Error | null>;
182
+ /**
183
+ * Create directory if it doesn't exist
184
+ */
185
+ createDirectory(relativePath: string): Promise<Error | null>;
186
+ /**
187
+ * Copy file within JSON data
188
+ */
189
+ copyFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
190
+ /**
191
+ * Move file within JSON data
192
+ */
193
+ moveFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
194
+ /**
195
+ * Get the current JSON data
196
+ */
197
+ getData(): JsonDocumentData;
198
+ /**
199
+ * Update the entire JSON data
200
+ */
201
+ setData(data: JsonDocumentData | unknown): Error | null;
202
+ /**
203
+ * Clear all data
204
+ */
205
+ clear(): void;
206
+ /**
207
+ * Get all file paths in the JSON data
208
+ */
209
+ getAllFilePaths(): string[];
210
+ /**
211
+ * Normalize path by removing leading/trailing slashes
212
+ */
213
+ private normalizePath;
214
+ /**
215
+ * Check if directory exists in data
216
+ */
217
+ private directoryExistsInData;
218
+ /**
219
+ * Notify data change callback
220
+ */
221
+ private notifyDataChange;
222
+ }
223
+
224
+ export { DocFileSystemJson, DocFileSystemJsonRead, DocFileSystemJsonWrite };