tw5-typed 0.5.6 → 0.5.8

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,6 +1,6 @@
1
1
  {
2
2
  "name": "tw5-typed",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
4
4
  "scripts": {
5
5
  "check": "tsc --noEmit && eslint src/**/*.ts",
6
6
  "docs": "docs-ts",
@@ -4,6 +4,7 @@
4
4
  /// <reference path="server/index.d.ts" />
5
5
  /// <reference path="parsers/index.d.ts" />
6
6
  /// <reference path="widgets/index.d.ts" />
7
+ /// <reference path="indexers/index.d.ts" />
7
8
  /// <reference path="parsers/index.d.ts" />
8
9
  /// <reference path="syncer/syncAdaptor.d.ts" />
9
10
  /// <reference path="syncer/syncer.d.ts" />
@@ -0,0 +1,46 @@
1
+ declare module 'tiddlywiki' {
2
+ /**
3
+ * Abstract class representing an indexer in TiddlyWiki. Indexers maintain indexes of tiddlers organized efficiently for different types of access, improving the speed of certain filter operations.
4
+ * @url https://tiddlywiki.com/dev/#indexer%20modules
5
+ */
6
+ abstract class Indexer {
7
+ protected wiki: Wiki;
8
+ protected index: Record<string, Record<string, string[]>> | null;
9
+ protected maxIndexedValueLength: number;
10
+
11
+ /**
12
+ * Constructs an Indexer instance.
13
+ * @param {Wiki} wiki - The wiki object associated with this indexer.
14
+ */
15
+ constructor(wiki: Wiki) {
16
+ this.wiki = wiki;
17
+ }
18
+
19
+ /**
20
+ * Initializes the indexer, performing any necessary setup.
21
+ */
22
+ abstract init(): void;
23
+
24
+ /**
25
+ * Rebuilds the indexer's index from scratch. Typically used after a significant number of changes in the wiki.
26
+ */
27
+ abstract rebuild(): void;
28
+
29
+ /**
30
+ * Updates the index based on changes to a tiddler.
31
+ * @param {Object} updateDescriptor - Describes the changes to the tiddler.
32
+ * @param {Object} updateDescriptor.old - The state of the tiddler before the update.
33
+ * @param {boolean} updateDescriptor.old.exists - Indicates if the tiddler existed before the update.
34
+ * @param {boolean} updateDescriptor.old.shadow - Indicates if the tiddler was a shadow tiddler before the update.
35
+ * @param {Tiddler} updateDescriptor.old.tiddler - The tiddler before the update.
36
+ * @param {Object} updateDescriptor.new - The state of the tiddler after the update.
37
+ * @param {boolean} updateDescriptor.new.exists - Indicates if the tiddler exists after the update.
38
+ * @param {boolean} updateDescriptor.new.shadow - Indicates if the tiddler is a shadow tiddler after the update.
39
+ * @param {Tiddler} updateDescriptor.new.tiddler - The tiddler after the update.
40
+ */
41
+ abstract update(updateDescriptor: {
42
+ new: { exists: boolean; shadow: boolean; tiddler: Tiddler };
43
+ old: { exists: boolean; shadow: boolean; tiddler: Tiddler };
44
+ }): void;
45
+ }
46
+ }
@@ -193,7 +193,7 @@ declare module 'tiddlywiki' {
193
193
  */
194
194
  each: <T, K = T extends unknown[] ? number : keyof T>(
195
195
  object: T,
196
- callback: (element: T[K], index: K, object: T) => undefined | false | undefined,
196
+ callback: (element: T[K], index: K, object: T) => undefined | false | void,
197
197
  ) => void;
198
198
 
199
199
  /**