tw5-typed 1.0.2 → 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/package.json
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
declare module 'tiddlywiki' {
|
|
2
|
+
/**
|
|
3
|
+
* File information for a tiddler stored in the filesystem
|
|
4
|
+
*/
|
|
5
|
+
export interface FileInfo {
|
|
6
|
+
filepath: string;
|
|
7
|
+
hasMetaFile?: boolean;
|
|
8
|
+
type: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
2
11
|
/**
|
|
3
12
|
* SyncAdaptorModules
|
|
4
13
|
* @url https://tiddlywiki.com/dev/#SyncAdaptorModules
|
|
@@ -6,7 +15,7 @@ declare module 'tiddlywiki' {
|
|
|
6
15
|
export interface SyncAdaptor {
|
|
7
16
|
getTiddlerFileInfo(
|
|
8
17
|
title: string,
|
|
9
|
-
callback: (error: null, fileInfo:
|
|
18
|
+
callback: (error: Error | null | string, fileInfo: FileInfo) => void,
|
|
10
19
|
): void;
|
|
11
20
|
getTiddlerInfo(title: string): IBootFilesIndexItem;
|
|
12
21
|
/**
|
|
@@ -2,7 +2,7 @@ declare module 'tiddlywiki' {
|
|
|
2
2
|
/**
|
|
3
3
|
* File information for saving a tiddler
|
|
4
4
|
*/
|
|
5
|
-
export interface
|
|
5
|
+
export interface IFileInfo {
|
|
6
6
|
filepath: string;
|
|
7
7
|
type: string;
|
|
8
8
|
hasMetaFile: boolean;
|
|
@@ -15,7 +15,7 @@ declare module 'tiddlywiki' {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
declare module '$:/core/modules/utils/filesystem.js' {
|
|
18
|
-
import type {
|
|
18
|
+
import type { IFileInfo, Tiddler, Wiki } from 'tiddlywiki';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Return the subdirectories of a path
|
|
@@ -114,11 +114,11 @@ declare module '$:/core/modules/utils/filesystem.js' {
|
|
|
114
114
|
options: {
|
|
115
115
|
directory: string;
|
|
116
116
|
extFilters?: string[];
|
|
117
|
-
fileInfo?:
|
|
117
|
+
fileInfo?: IFileInfo;
|
|
118
118
|
pathFilters?: string[];
|
|
119
119
|
wiki?: Wiki;
|
|
120
120
|
},
|
|
121
|
-
):
|
|
121
|
+
): IFileInfo;
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
124
|
* Generate the file extension for saving a tiddler
|
|
@@ -153,7 +153,7 @@ declare module '$:/core/modules/utils/filesystem.js' {
|
|
|
153
153
|
directory?: string;
|
|
154
154
|
extension?: string;
|
|
155
155
|
extFilters?: string[];
|
|
156
|
-
fileInfo?:
|
|
156
|
+
fileInfo?: IFileInfo;
|
|
157
157
|
pathFilters?: string[];
|
|
158
158
|
wiki?: Wiki;
|
|
159
159
|
},
|
|
@@ -168,8 +168,8 @@ declare module '$:/core/modules/utils/filesystem.js' {
|
|
|
168
168
|
*/
|
|
169
169
|
export function saveTiddlerToFile(
|
|
170
170
|
tiddler: Tiddler,
|
|
171
|
-
fileInfo:
|
|
172
|
-
callback: (error: Error | null, fileInfo?:
|
|
171
|
+
fileInfo: IFileInfo,
|
|
172
|
+
callback: (error: Error | null, fileInfo?: IFileInfo) => void,
|
|
173
173
|
): void;
|
|
174
174
|
|
|
175
175
|
/**
|
|
@@ -179,7 +179,7 @@ declare module '$:/core/modules/utils/filesystem.js' {
|
|
|
179
179
|
* @returns The fileInfo object
|
|
180
180
|
* @description 同步地将 tiddler 保存到由 fileInfo 描述的文件
|
|
181
181
|
*/
|
|
182
|
-
export function saveTiddlerToFileSync(tiddler: Tiddler, fileInfo:
|
|
182
|
+
export function saveTiddlerToFileSync(tiddler: Tiddler, fileInfo: IFileInfo): IFileInfo;
|
|
183
183
|
|
|
184
184
|
/**
|
|
185
185
|
* Delete a file described by the fileInfo if it exists
|
|
@@ -188,8 +188,8 @@ declare module '$:/core/modules/utils/filesystem.js' {
|
|
|
188
188
|
* @description 删除由 fileInfo 描述的文件(如果存在)
|
|
189
189
|
*/
|
|
190
190
|
export function deleteTiddlerFile(
|
|
191
|
-
fileInfo:
|
|
192
|
-
callback: (error: Error | null, fileInfo?:
|
|
191
|
+
fileInfo: IFileInfo,
|
|
192
|
+
callback: (error: Error | null, fileInfo?: IFileInfo) => void,
|
|
193
193
|
): void;
|
|
194
194
|
|
|
195
195
|
/**
|
|
@@ -200,10 +200,10 @@ declare module '$:/core/modules/utils/filesystem.js' {
|
|
|
200
200
|
*/
|
|
201
201
|
export function cleanupTiddlerFiles(
|
|
202
202
|
options: {
|
|
203
|
-
adaptorInfo?:
|
|
204
|
-
bootInfo?:
|
|
203
|
+
adaptorInfo?: IFileInfo;
|
|
204
|
+
bootInfo?: IFileInfo;
|
|
205
205
|
title?: string;
|
|
206
206
|
},
|
|
207
|
-
callback: (error: Error | null, fileInfo?:
|
|
207
|
+
callback: (error: Error | null, fileInfo?: IFileInfo) => void,
|
|
208
208
|
): void;
|
|
209
209
|
}
|
package/src/utils/index.d.ts
CHANGED
|
@@ -476,24 +476,24 @@ declare module 'tiddlywiki' {
|
|
|
476
476
|
pathFilters?: string[];
|
|
477
477
|
extFilters?: string[];
|
|
478
478
|
wiki: Wiki;
|
|
479
|
-
fileInfo?: Partial<
|
|
479
|
+
fileInfo?: Partial<IFileInfo>;
|
|
480
480
|
},
|
|
481
|
-
) =>
|
|
481
|
+
) => IFileInfo;
|
|
482
482
|
/**
|
|
483
483
|
* Save tiddler to file
|
|
484
484
|
*/
|
|
485
|
-
saveTiddlerToFile: (tiddler: Tiddler, fileInfo:
|
|
485
|
+
saveTiddlerToFile: (tiddler: Tiddler, fileInfo: IFileInfo, callback?: (error: Error | null) => void) => void;
|
|
486
486
|
/**
|
|
487
487
|
* Cleanup tiddler files (delete old files when tiddler is moved)
|
|
488
488
|
*/
|
|
489
489
|
cleanupTiddlerFiles: (
|
|
490
|
-
fileInfo:
|
|
491
|
-
callback?: (error: Error | null, cleanedFileInfo?:
|
|
490
|
+
fileInfo: IFileInfo | Record<string, unknown>,
|
|
491
|
+
callback?: (error: Error | null, cleanedFileInfo?: IFileInfo) => void,
|
|
492
492
|
) => void;
|
|
493
493
|
/**
|
|
494
494
|
* Delete tiddler file
|
|
495
495
|
*/
|
|
496
|
-
deleteTiddlerFile: (fileInfo:
|
|
496
|
+
deleteTiddlerFile: (fileInfo: IFileInfo, callback?: (error: Error | null, deletedFileInfo?: IFileInfo) => void) => void;
|
|
497
497
|
/**
|
|
498
498
|
* Format date string
|
|
499
499
|
*/
|