tw5-typed 0.3.1 → 0.3.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 +1 -1
- package/src/boot/index.d.ts +4 -1
- package/src/core.d.ts +1 -6
- package/src/modules/index.d.ts +1 -0
- package/src/modules/syncer/syncAdaptor.d.ts +28 -1
- package/src/modules/syncer/syncer.d.ts +9 -0
- package/src/modules/utils/filesystem.d.ts +6 -0
- package/src/modules/utils/index.d.ts +1 -0
- package/src/modules/utils/logger.d.ts +23 -0
- package/src/modules/widgets/index.d.ts +0 -0
- package/src/tiddler/index.d.ts +11 -3
- package/src/wiki/index.d.ts +51 -7
package/package.json
CHANGED
package/src/boot/index.d.ts
CHANGED
|
@@ -4,10 +4,13 @@ declare module 'tiddlywiki' {
|
|
|
4
4
|
export interface IBootFilesIndexItem {
|
|
5
5
|
filepath: string;
|
|
6
6
|
hasMetaFile: boolean;
|
|
7
|
-
|
|
7
|
+
isEditableFile: boolean;
|
|
8
8
|
type: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Key is `tiddlerTitle: string;`
|
|
13
|
+
*/
|
|
11
14
|
export type IBootFilesIndex = Record<string, IBootFilesIndexItem>;
|
|
12
15
|
|
|
13
16
|
export interface IStartUpOption {
|
package/src/core.d.ts
CHANGED
|
@@ -82,12 +82,7 @@ declare module 'tiddlywiki' {
|
|
|
82
82
|
loadTiddlersFromFile(
|
|
83
83
|
filepath: string,
|
|
84
84
|
defaultFields?: Record<string, unknown>,
|
|
85
|
-
):
|
|
86
|
-
filepath: string;
|
|
87
|
-
type: string;
|
|
88
|
-
tiddlers: ITiddlerFields[];
|
|
89
|
-
hasMetaFile: boolean;
|
|
90
|
-
};
|
|
85
|
+
): ITiddlersInFile;
|
|
91
86
|
loadMetadataForFile(filepath: string): ITiddlerFields | null;
|
|
92
87
|
loadTiddlersFromPath(
|
|
93
88
|
filepath: string,
|
package/src/modules/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
declare module 'tiddlywiki' {
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* SyncAdaptorModules
|
|
4
|
+
* @url https://tiddlywiki.com/dev/#SyncAdaptorModules
|
|
5
|
+
*/
|
|
6
|
+
export interface SyncAdaptor {
|
|
3
7
|
name: string;
|
|
4
8
|
supportsLazyLoading: boolean;
|
|
5
9
|
isReady(): boolean;
|
|
@@ -8,6 +12,29 @@ declare module 'tiddlywiki' {
|
|
|
8
12
|
title: string,
|
|
9
13
|
callback: (error: null, fileInfo: IFileInfo) => void,
|
|
10
14
|
): void;
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves the titles of tiddlers that need to be updated from the server.
|
|
17
|
+
|
|
18
|
+
This method is optional. If an adaptor doesn't implement it then synchronisation will be unidirectional from the TiddlyWiki store to the adaptor, but not the other way.
|
|
19
|
+
|
|
20
|
+
The syncer will use the `getUpdatedTiddlers()` method in preference to the `getSkinnyTiddlers()` method.
|
|
21
|
+
|
|
22
|
+
|!Parameter |!Description |
|
|
23
|
+
|syncer |Reference to the syncer object making the call |
|
|
24
|
+
|callback |Callback function invoked with parameter `err,data` -- see below |
|
|
25
|
+
|
|
26
|
+
The data provided by the callback is as follows:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
{
|
|
30
|
+
modifications: [<array of title>],
|
|
31
|
+
deletions: [<array of title>],
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
* @param syncer
|
|
35
|
+
* @param callback
|
|
36
|
+
*/
|
|
37
|
+
getUpdatedTiddlers(syncer: Syncer,callback: (error: Error | null | undefined, changes: { modifications: string[]; deletions: string[] }) => void): void;
|
|
11
38
|
wiki: Wiki;
|
|
12
39
|
}
|
|
13
40
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare module 'tiddlywiki' {
|
|
2
|
+
export class Syncer {
|
|
3
|
+
syncadaptor?: SyncAdaptor;
|
|
4
|
+
/**
|
|
5
|
+
Synchronise from the server by reading the skinny tiddler list and queuing up loads for any tiddlers that we don't already have up to date
|
|
6
|
+
*/
|
|
7
|
+
syncFromServer(): void;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -37,6 +37,12 @@ declare module 'tiddlywiki' {
|
|
|
37
37
|
encoding: string;
|
|
38
38
|
filepath: string;
|
|
39
39
|
}
|
|
40
|
+
export interface ITiddlersInFile {
|
|
41
|
+
filepath: string;
|
|
42
|
+
type: string;
|
|
43
|
+
tiddlers: ITiddlerFields[];
|
|
44
|
+
hasMetaFile: boolean;
|
|
45
|
+
}
|
|
40
46
|
interface IUtils {
|
|
41
47
|
/**
|
|
42
48
|
* Generate the filepath for saving a tiddler
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare module 'tiddlywiki' {
|
|
2
|
+
export class Logger {
|
|
3
|
+
new (): Logger;
|
|
4
|
+
setSaveBuffer(logger: Logger): void;
|
|
5
|
+
/**
|
|
6
|
+
Log a message
|
|
7
|
+
*/
|
|
8
|
+
log: typeof console.log;
|
|
9
|
+
clearAlerts(): void;
|
|
10
|
+
getBuffer(): string;
|
|
11
|
+
table: typeof console.table;
|
|
12
|
+
/**
|
|
13
|
+
Alert a message
|
|
14
|
+
*/
|
|
15
|
+
alert(...args: any[]): void;
|
|
16
|
+
}
|
|
17
|
+
interface IUtils {
|
|
18
|
+
/**
|
|
19
|
+
* A basic logging implementation
|
|
20
|
+
*/
|
|
21
|
+
Logger: Logger;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
File without changes
|
package/src/tiddler/index.d.ts
CHANGED
|
@@ -30,12 +30,20 @@ declare module 'tiddlywiki' {
|
|
|
30
30
|
hasField(): boolean;
|
|
31
31
|
isPlugin(): boolean;
|
|
32
32
|
isDraft(): boolean;
|
|
33
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Stringify the field with the associated tiddler field module (if any)
|
|
35
|
+
*/
|
|
36
|
+
getFieldString(field: string, defaultValue?: string): string;
|
|
37
|
+
/**
|
|
38
|
+
Get all the fields as a hashmap of strings. Options:
|
|
39
|
+
exclude: an array of field names to exclude
|
|
40
|
+
*/
|
|
41
|
+
getFieldStrings(field: string, defaultValue?: string): string;
|
|
34
42
|
getFieldDay(field: string): string;
|
|
35
43
|
/**
|
|
36
44
|
Get the value of a field as a list
|
|
37
45
|
*/
|
|
38
|
-
getFieldList(field: string, defaultValue
|
|
46
|
+
getFieldList(field: string, defaultValue?: string): string[];
|
|
39
47
|
/**
|
|
40
48
|
Get all the fields as a name:value block.
|
|
41
49
|
@param options:
|
|
@@ -43,6 +51,6 @@ declare module 'tiddlywiki' {
|
|
|
43
51
|
*/
|
|
44
52
|
getFieldStringBlock(options: { exclude?: string[] }): string;
|
|
45
53
|
|
|
46
|
-
isEqual(tiddler: Tiddler, excludeFields
|
|
54
|
+
isEqual(tiddler: Tiddler, excludeFields?: string[]): boolean;
|
|
47
55
|
}
|
|
48
56
|
}
|
package/src/wiki/index.d.ts
CHANGED
|
@@ -67,7 +67,10 @@ declare module 'tiddlywiki' {
|
|
|
67
67
|
*/
|
|
68
68
|
compileFilter(
|
|
69
69
|
filterString: string,
|
|
70
|
-
): (
|
|
70
|
+
): (
|
|
71
|
+
source?: SourceIterator | string[] | Record<string, unknown>,
|
|
72
|
+
widget?: Widget,
|
|
73
|
+
) => string[];
|
|
71
74
|
/**
|
|
72
75
|
*
|
|
73
76
|
* @param filterString
|
|
@@ -80,15 +83,15 @@ declare module 'tiddlywiki' {
|
|
|
80
83
|
makeTiddlerIterator(titles: string[]): SourceIterator;
|
|
81
84
|
/**
|
|
82
85
|
* You can use this with `makeTiddlerIterator`:
|
|
83
|
-
*
|
|
86
|
+
*
|
|
84
87
|
* ```js
|
|
85
88
|
* $tw.wiki.filterTiddlers(filter, undefined, $tw.wiki.makeTiddlerIterator(['title']))
|
|
86
89
|
* ```
|
|
87
|
-
*
|
|
90
|
+
*
|
|
88
91
|
* This calls `compileFilter`
|
|
89
|
-
* @param filterString
|
|
90
|
-
* @param widget
|
|
91
|
-
* @param source
|
|
92
|
+
* @param filterString
|
|
93
|
+
* @param widget
|
|
94
|
+
* @param source
|
|
92
95
|
*/
|
|
93
96
|
filterTiddlers(
|
|
94
97
|
filterString: string,
|
|
@@ -221,7 +224,7 @@ declare module 'tiddlywiki' {
|
|
|
221
224
|
outputType: OutputMimeTypes,
|
|
222
225
|
textType: TextMimeTypes,
|
|
223
226
|
text: string,
|
|
224
|
-
options?: Partial<IMakeWidgetOptions> &
|
|
227
|
+
options?: Partial<IMakeWidgetOptions> & IParseOptions,
|
|
225
228
|
): string;
|
|
226
229
|
/**
|
|
227
230
|
Make a widget tree for a parse tree
|
|
@@ -271,10 +274,51 @@ declare module 'tiddlywiki' {
|
|
|
271
274
|
isShadowTiddler(title: string): boolean;
|
|
272
275
|
isBinaryTiddler(title: string): boolean;
|
|
273
276
|
isImageTiddler(title: string): boolean;
|
|
277
|
+
isSystemTiddler(title: string): boolean;
|
|
278
|
+
isTemporaryTiddler(title: string): boolean;
|
|
279
|
+
isVolatileTiddler(title: string): boolean;
|
|
280
|
+
/**
|
|
281
|
+
* Like addTiddler() except it will silently reject any plugin tiddlers that are older than the currently loaded version. Returns true if the tiddler was imported
|
|
282
|
+
*/
|
|
283
|
+
importTiddler(title: string): boolean;
|
|
274
284
|
/** return shadowTiddlers[title].source; */
|
|
275
285
|
getShadowSource(title: string): string | null;
|
|
276
286
|
getTiddlerBacklinks(targetTitle: string): string[];
|
|
277
287
|
getTiddlerLinks(title: string): string[];
|
|
278
288
|
getPluginInfo(title: string): { tiddlers: Record<string, ITiddlerFields> };
|
|
289
|
+
getChangeCount(title: string): number;
|
|
290
|
+
getCreationFields(): {
|
|
291
|
+
created: Date;
|
|
292
|
+
creator?: string;
|
|
293
|
+
[x: string]: unknown;
|
|
294
|
+
};
|
|
295
|
+
getModificationFields(): {
|
|
296
|
+
modified: Date;
|
|
297
|
+
modifier?: string;
|
|
298
|
+
[x: string]: unknown;
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
Generate an unused title from the specified base
|
|
302
|
+
options.prefix must be a string
|
|
303
|
+
*/
|
|
304
|
+
generateNewTitle(baseTitle: string, options: { prefix?: string }): string;
|
|
305
|
+
|
|
306
|
+
addEventListener(
|
|
307
|
+
type: string,
|
|
308
|
+
handler: (event: unknown) => void | Promise<void>,
|
|
309
|
+
): void;
|
|
310
|
+
addEventListener(
|
|
311
|
+
type: "change",
|
|
312
|
+
handler: (change: IChangedTiddlers) => void | Promise<void>,
|
|
313
|
+
): void;
|
|
314
|
+
|
|
315
|
+
dispatchEvent(
|
|
316
|
+
type: string,
|
|
317
|
+
dataOrEvent: unknown,
|
|
318
|
+
): void;
|
|
319
|
+
dispatchEvent(
|
|
320
|
+
type: "change",
|
|
321
|
+
change: IChangedTiddlers,
|
|
322
|
+
): void;
|
|
279
323
|
}
|
|
280
324
|
}
|