@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
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { D as DocFileSystem, a as DocPathSystem, b as DocFileSystemReadInterface, c as DocFileSystemWriteInterface } from './doc-file-system-BQAOBIO-.js';
|
|
2
|
+
import { Octokit } from '@octokit/rest';
|
|
3
|
+
|
|
4
|
+
type GitHubProps = {
|
|
5
|
+
owner: string;
|
|
6
|
+
repo: string;
|
|
7
|
+
basePath: string;
|
|
8
|
+
branch?: string;
|
|
9
|
+
token: string;
|
|
10
|
+
pathSystem?: DocPathSystem;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* GitHub repository file system using Octokit with separate read/write components
|
|
14
|
+
*/
|
|
15
|
+
declare class DocFileSystemOctokit extends DocFileSystem {
|
|
16
|
+
private readonly owner;
|
|
17
|
+
private readonly repo;
|
|
18
|
+
private readonly branch;
|
|
19
|
+
constructor(props: GitHubProps);
|
|
20
|
+
/**
|
|
21
|
+
* Get repository information
|
|
22
|
+
*/
|
|
23
|
+
getRepositoryInfo(): {
|
|
24
|
+
owner: string;
|
|
25
|
+
repo: string;
|
|
26
|
+
branch: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type Props$1 = {
|
|
31
|
+
owner: string;
|
|
32
|
+
repo: string;
|
|
33
|
+
basePath: string;
|
|
34
|
+
branch?: string;
|
|
35
|
+
token: string;
|
|
36
|
+
pathSystem?: DocPathSystem;
|
|
37
|
+
};
|
|
38
|
+
type FileCache = {
|
|
39
|
+
sha: string;
|
|
40
|
+
content: string;
|
|
41
|
+
size: number;
|
|
42
|
+
modifiedTime?: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* GitHub repository read-only file system using Octokit
|
|
46
|
+
*/
|
|
47
|
+
declare class DocFileSystemOctokitRead implements DocFileSystemReadInterface {
|
|
48
|
+
protected readonly octokit: Octokit;
|
|
49
|
+
protected readonly owner: string;
|
|
50
|
+
protected readonly repo: string;
|
|
51
|
+
protected readonly branch: string;
|
|
52
|
+
protected readonly pathSystem: DocPathSystem;
|
|
53
|
+
protected readonly basePath: string;
|
|
54
|
+
protected fileCache: Map<string, FileCache>;
|
|
55
|
+
constructor(props: Props$1);
|
|
56
|
+
/**
|
|
57
|
+
* Read file content from GitHub repository
|
|
58
|
+
*/
|
|
59
|
+
readFile(relativePath: string): Promise<string | null | Error>;
|
|
60
|
+
/**
|
|
61
|
+
* Get file name from path
|
|
62
|
+
*/
|
|
63
|
+
readFileName(relativePath: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Get file extension from path
|
|
66
|
+
*/
|
|
67
|
+
readFileExtension(relativePath: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* Get directory path where the file exists
|
|
70
|
+
*/
|
|
71
|
+
readFileDirectory(relativePath: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* Get list of file names in directory
|
|
74
|
+
*/
|
|
75
|
+
readDirectoryFileNames(relativePath?: string): Promise<string[] | Error>;
|
|
76
|
+
/**
|
|
77
|
+
* Get list of file paths in directory
|
|
78
|
+
*/
|
|
79
|
+
readDirectoryFilePaths(relativePath: string): Promise<string[] | Error>;
|
|
80
|
+
/**
|
|
81
|
+
* Check if path is a directory
|
|
82
|
+
*/
|
|
83
|
+
isDirectory(relativePath: string): Promise<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* Check if path is a file
|
|
86
|
+
*/
|
|
87
|
+
isFile(relativePath: string): Promise<boolean>;
|
|
88
|
+
/**
|
|
89
|
+
* Check if file or directory exists
|
|
90
|
+
*/
|
|
91
|
+
exists(relativePath: string): Promise<boolean>;
|
|
92
|
+
/**
|
|
93
|
+
* Check if directory exists
|
|
94
|
+
*/
|
|
95
|
+
directoryExists(relativePath: string): Promise<boolean>;
|
|
96
|
+
/**
|
|
97
|
+
* Check if file exists
|
|
98
|
+
*/
|
|
99
|
+
fileExists(relativePath: string): Promise<boolean>;
|
|
100
|
+
/**
|
|
101
|
+
* Get base path
|
|
102
|
+
*/
|
|
103
|
+
getBasePath(): string;
|
|
104
|
+
/**
|
|
105
|
+
* Convert relative path to absolute path
|
|
106
|
+
*/
|
|
107
|
+
resolve(relativePath: string): string;
|
|
108
|
+
/**
|
|
109
|
+
* Get file size in bytes
|
|
110
|
+
*/
|
|
111
|
+
getFileSize(relativePath: string): Promise<number | Error>;
|
|
112
|
+
/**
|
|
113
|
+
* Get file last modified time
|
|
114
|
+
*/
|
|
115
|
+
getFileModifiedTime(relativePath: string): Promise<Date | Error>;
|
|
116
|
+
/**
|
|
117
|
+
* Get file creation time (first commit)
|
|
118
|
+
*/
|
|
119
|
+
getFileCreatedTime(relativePath: string): Promise<Date | Error>;
|
|
120
|
+
/**
|
|
121
|
+
* Get cached SHA for a file
|
|
122
|
+
*/
|
|
123
|
+
getCachedSha(relativePath: string): string | undefined;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
type Props = {
|
|
127
|
+
owner: string;
|
|
128
|
+
repo: string;
|
|
129
|
+
basePath: string;
|
|
130
|
+
branch?: string;
|
|
131
|
+
token: string;
|
|
132
|
+
pathSystem?: DocPathSystem;
|
|
133
|
+
reader?: DocFileSystemReadInterface;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* GitHub repository write-only file system using Octokit
|
|
137
|
+
*/
|
|
138
|
+
declare class DocFileSystemOctokitWrite implements DocFileSystemWriteInterface {
|
|
139
|
+
private readonly octokit;
|
|
140
|
+
private readonly owner;
|
|
141
|
+
private readonly repo;
|
|
142
|
+
private readonly basePath;
|
|
143
|
+
private readonly branch;
|
|
144
|
+
private readonly pathSystem;
|
|
145
|
+
private readonly reader?;
|
|
146
|
+
constructor(props: Props);
|
|
147
|
+
/**
|
|
148
|
+
* Write content to file in GitHub repository
|
|
149
|
+
*/
|
|
150
|
+
writeFile(relativePath: string, content: string): Promise<Error | null>;
|
|
151
|
+
/**
|
|
152
|
+
* Delete file from GitHub repository
|
|
153
|
+
*/
|
|
154
|
+
deleteFile(relativePath: string): Promise<Error | null>;
|
|
155
|
+
/**
|
|
156
|
+
* Create directory by creating a .gitkeep file
|
|
157
|
+
*/
|
|
158
|
+
createDirectory(relativePath: string): Promise<Error | null>;
|
|
159
|
+
/**
|
|
160
|
+
* Create directory if it doesn't exist
|
|
161
|
+
*/
|
|
162
|
+
ensureDirectoryExists(relativePath: string): Promise<Error | null>;
|
|
163
|
+
/**
|
|
164
|
+
* Copy file to new location
|
|
165
|
+
*/
|
|
166
|
+
copyFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
|
|
167
|
+
/**
|
|
168
|
+
* Move file to new location
|
|
169
|
+
*/
|
|
170
|
+
moveFile(sourcePath: string, destinationPath: string): Promise<Error | null>;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export { DocFileSystemOctokit, DocFileSystemOctokitRead, DocFileSystemOctokitWrite };
|