obsidian-dev-utils 44.2.3 → 44.3.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/lib/cjs/Library.cjs +1 -1
  3. package/dist/lib/cjs/obsidian/Backlink.cjs +2 -3
  4. package/dist/lib/cjs/obsidian/Commands/AbstractFileCommandBase.cjs +56 -41
  5. package/dist/lib/cjs/obsidian/Commands/AbstractFileCommandBase.d.cts +45 -12
  6. package/dist/lib/cjs/obsidian/Commands/CommandBase.cjs +13 -1
  7. package/dist/lib/cjs/obsidian/Commands/CommandBase.d.cts +7 -0
  8. package/dist/lib/cjs/obsidian/Commands/EditorCommandBase.cjs +3 -9
  9. package/dist/lib/cjs/obsidian/Commands/EditorCommandBase.d.cts +7 -7
  10. package/dist/lib/cjs/obsidian/Commands/FileCommandBase.cjs +123 -26
  11. package/dist/lib/cjs/obsidian/Commands/FileCommandBase.d.cts +100 -9
  12. package/dist/lib/cjs/obsidian/Commands/FolderCommandBase.cjs +115 -26
  13. package/dist/lib/cjs/obsidian/Commands/FolderCommandBase.d.cts +94 -10
  14. package/dist/lib/cjs/obsidian/FileSystem.cjs +44 -1
  15. package/dist/lib/cjs/obsidian/FileSystem.d.cts +81 -33
  16. package/dist/lib/esm/Library.mjs +1 -1
  17. package/dist/lib/esm/obsidian/Backlink.mjs +4 -4
  18. package/dist/lib/esm/obsidian/Commands/AbstractFileCommandBase.d.mts +45 -12
  19. package/dist/lib/esm/obsidian/Commands/AbstractFileCommandBase.mjs +54 -40
  20. package/dist/lib/esm/obsidian/Commands/CommandBase.d.mts +7 -0
  21. package/dist/lib/esm/obsidian/Commands/CommandBase.mjs +13 -1
  22. package/dist/lib/esm/obsidian/Commands/EditorCommandBase.d.mts +7 -7
  23. package/dist/lib/esm/obsidian/Commands/EditorCommandBase.mjs +3 -9
  24. package/dist/lib/esm/obsidian/Commands/FileCommandBase.d.mts +100 -9
  25. package/dist/lib/esm/obsidian/Commands/FileCommandBase.mjs +127 -26
  26. package/dist/lib/esm/obsidian/Commands/FolderCommandBase.d.mts +94 -10
  27. package/dist/lib/esm/obsidian/Commands/FolderCommandBase.mjs +119 -26
  28. package/dist/lib/esm/obsidian/FileSystem.d.mts +81 -33
  29. package/dist/lib/esm/obsidian/FileSystem.mjs +38 -1
  30. package/package.json +5 -5
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import type { Plugin, TAbstractFile, WorkspaceLeaf } from 'obsidian';
7
7
  import { TFolder } from 'obsidian';
8
- import { AbstractFileCommandBase, AbstractFileCommandInvocationBase } from './AbstractFileCommandBase.mjs';
8
+ import { AbstractFileCommandBase, AbstractFileCommandInvocationBase, AbstractFilesCommandInvocationBase } from './AbstractFileCommandBase.mjs';
9
9
  /**
10
10
  * Base class for folder commands.
11
11
  *
@@ -13,20 +13,58 @@ import { AbstractFileCommandBase, AbstractFileCommandInvocationBase } from './Ab
13
13
  */
14
14
  export declare abstract class FolderCommandBase<TPlugin extends Plugin = Plugin> extends AbstractFileCommandBase<TPlugin> {
15
15
  /**
16
- * Creates a new file command invocation.
16
+ * Creates a new abstract file command invocation.
17
17
  *
18
- * @returns The command invocation.
18
+ * @param abstractFile - The abstract file to invoke the command for.
19
+ * @returns A new abstract file command invocation.
19
20
  */
20
- protected abstract createCommandInvocation(): FolderCommandInvocationBase<TPlugin>;
21
+ protected createCommandInvocation(abstractFile?: TAbstractFile): AbstractFileCommandInvocationBase<TPlugin>;
22
+ /**
23
+ * Creates a new abstract file command invocation for an abstract file.
24
+ *
25
+ * @param abstractFile - The abstract file to invoke the command for.
26
+ * @returns A new abstract file command invocation.
27
+ */
28
+ protected createCommandInvocationForAbstractFile(abstractFile: null | TAbstractFile): AbstractFileCommandInvocationBase<TPlugin>;
29
+ /**
30
+ * Creates a new abstract files command invocation for abstract files.
31
+ *
32
+ * @param abstractFiles - The abstract files to invoke the command for.
33
+ * @returns A new abstract files command invocation.
34
+ */
35
+ protected createCommandInvocationForAbstractFiles(abstractFiles: TAbstractFile[]): AbstractFilesCommandInvocationBase<TPlugin>;
36
+ /**
37
+ * Creates a new abstract file command invocation for a folder.
38
+ *
39
+ * @param folder - The folder to invoke the command for.
40
+ * @returns A new folder command invocation.
41
+ */
42
+ protected abstract createCommandInvocationForFolder(folder: null | TFolder): FolderCommandInvocationBase<TPlugin>;
43
+ /**
44
+ * Creates a new folders command invocation for folders.
45
+ *
46
+ * @param folders - The folders to invoke the command for.
47
+ * @returns A new folders command invocation.
48
+ */
49
+ protected createCommandInvocationForFolders(folders: TFolder[]): FoldersCommandInvocationBase<TPlugin>;
21
50
  /**
22
51
  * Checks if the command should be added to the abstract file menu.
23
52
  *
24
53
  * @param abstractFile - The abstract file to check.
25
- * @param _source - The source of the abstract file.
26
- * @param _leaf - The leaf to check.
54
+ * @param source - The source of the abstract file.
55
+ * @param leaf - The leaf to check.
27
56
  * @returns Whether the command should be added to the abstract file menu.
28
57
  */
29
- protected shouldAddToAbstractFileMenu(abstractFile: TAbstractFile, _source: string, _leaf?: WorkspaceLeaf): boolean;
58
+ protected shouldAddToAbstractFileMenu(abstractFile: TAbstractFile, source: string, leaf?: WorkspaceLeaf): boolean;
59
+ /**
60
+ * Checks if the command should be added to the abstract files menu.
61
+ *
62
+ * @param abstractFiles - The abstract files to check.
63
+ * @param source - The source of the abstract files.
64
+ * @param leaf - The leaf to check.
65
+ * @returns Whether the command should be added to the abstract files menu.
66
+ */
67
+ protected shouldAddToAbstractFilesMenu(abstractFiles: TAbstractFile[], source: string, leaf?: WorkspaceLeaf): boolean;
30
68
  /**
31
69
  * Checks if the command should be added to the folder menu.
32
70
  *
@@ -36,6 +74,15 @@ export declare abstract class FolderCommandBase<TPlugin extends Plugin = Plugin>
36
74
  * @returns Whether the command should be added to the folder menu.
37
75
  */
38
76
  protected shouldAddToFolderMenu(_folder: TFolder, _source: string, _leaf?: WorkspaceLeaf): boolean;
77
+ /**
78
+ * Checks if the command should be added to the folders menu.
79
+ *
80
+ * @param _folders - The folders to check.
81
+ * @param _source - The source of the folders.
82
+ * @param _leaf - The leaf to check.
83
+ * @returns Whether the command should be added to the folders menu.
84
+ */
85
+ protected shouldAddToFoldersMenu(_folders: TFolder[], _source: string, _leaf?: WorkspaceLeaf): boolean;
39
86
  }
40
87
  /**
41
88
  * Base class for folder command invocations.
@@ -51,15 +98,52 @@ export declare abstract class FolderCommandInvocationBase<TPlugin extends Plugin
51
98
  */
52
99
  protected get folder(): TFolder;
53
100
  /**
54
- * Sets the folder that the command invocation belongs to.
101
+ * Checks if the command can execute.
102
+ *
103
+ * @returns Whether the command can execute.
104
+ */
105
+ protected canExecute(): boolean;
106
+ }
107
+ /**
108
+ * Base class for folders command invocations.
109
+ *
110
+ * @typeParam TPlugin - The type of the plugin that the command belongs to.
111
+ */
112
+ export declare abstract class FoldersCommandInvocationBase<TPlugin extends Plugin> extends AbstractFilesCommandInvocationBase<TPlugin> {
113
+ readonly folders: TFolder[];
114
+ /**
115
+ * Creates a new folders command invocation.
55
116
  *
56
- * @param folder - The folder that the command invocation belongs to.
117
+ * @param plugin - The plugin that the command invocation belongs to.
118
+ * @param folders - The folders to invoke the command for.
57
119
  */
58
- protected set folder(folder: TFolder);
120
+ constructor(plugin: TPlugin, folders: TFolder[]);
121
+ }
122
+ /**
123
+ * Base class for sequential folders command invocations.
124
+ *
125
+ * @typeParam TPlugin - The type of the plugin that the command belongs to.
126
+ */
127
+ export declare class SequentialFoldersCommandInvocationBase<TPlugin extends Plugin> extends FoldersCommandInvocationBase<TPlugin> {
128
+ private readonly createCommandInvocationForFolder;
129
+ /**
130
+ * Creates a new sequential folders command invocation.
131
+ *
132
+ * @param plugin - The plugin that the command invocation belongs to.
133
+ * @param folders - The folders to invoke the command for.
134
+ * @param createCommandInvocationForFolder - The function to create a command invocation for a folder.
135
+ */
136
+ constructor(plugin: TPlugin, folders: TFolder[], createCommandInvocationForFolder: (folder: TFolder) => FolderCommandInvocationBase<TPlugin>);
59
137
  /**
60
138
  * Checks if the command can execute.
61
139
  *
62
140
  * @returns Whether the command can execute.
63
141
  */
64
142
  protected canExecute(): boolean;
143
+ /**
144
+ * Executes the command.
145
+ *
146
+ * @returns A promise that resolves when the command has been executed.
147
+ */
148
+ protected execute(): Promise<void>;
65
149
  }
@@ -20,24 +20,82 @@ if you want to view the source, please visit the github repository of this plugi
20
20
  })();
21
21
 
22
22
  import { TFolder } from "obsidian";
23
+ import {
24
+ asArrayOfFolders,
25
+ asFolder,
26
+ asFolderOrNull,
27
+ isFolder
28
+ } from "../FileSystem.mjs";
23
29
  import {
24
30
  AbstractFileCommandBase,
25
- AbstractFileCommandInvocationBase
31
+ AbstractFileCommandInvocationBase,
32
+ AbstractFilesCommandInvocationBase
26
33
  } from "./AbstractFileCommandBase.mjs";
27
34
  class FolderCommandBase extends AbstractFileCommandBase {
35
+ /**
36
+ * Creates a new abstract file command invocation.
37
+ *
38
+ * @param abstractFile - The abstract file to invoke the command for.
39
+ * @returns A new abstract file command invocation.
40
+ */
41
+ createCommandInvocation(abstractFile) {
42
+ const folder = asFolderOrNull(abstractFile ?? null) ?? this.app.workspace.getActiveFile()?.parent ?? null;
43
+ return this.createCommandInvocationForFolder(folder);
44
+ }
45
+ /**
46
+ * Creates a new abstract file command invocation for an abstract file.
47
+ *
48
+ * @param abstractFile - The abstract file to invoke the command for.
49
+ * @returns A new abstract file command invocation.
50
+ */
51
+ createCommandInvocationForAbstractFile(abstractFile) {
52
+ return this.createCommandInvocationForFolder(asFolderOrNull(abstractFile));
53
+ }
54
+ /**
55
+ * Creates a new abstract files command invocation for abstract files.
56
+ *
57
+ * @param abstractFiles - The abstract files to invoke the command for.
58
+ * @returns A new abstract files command invocation.
59
+ */
60
+ createCommandInvocationForAbstractFiles(abstractFiles) {
61
+ return this.createCommandInvocationForFolders(asArrayOfFolders(abstractFiles));
62
+ }
63
+ /**
64
+ * Creates a new folders command invocation for folders.
65
+ *
66
+ * @param folders - The folders to invoke the command for.
67
+ * @returns A new folders command invocation.
68
+ */
69
+ createCommandInvocationForFolders(folders) {
70
+ return new SequentialFoldersCommandInvocationBase(this.plugin, folders, this.createCommandInvocationForFolder.bind(this));
71
+ }
28
72
  /**
29
73
  * Checks if the command should be added to the abstract file menu.
30
74
  *
31
75
  * @param abstractFile - The abstract file to check.
32
- * @param _source - The source of the abstract file.
33
- * @param _leaf - The leaf to check.
76
+ * @param source - The source of the abstract file.
77
+ * @param leaf - The leaf to check.
34
78
  * @returns Whether the command should be added to the abstract file menu.
35
79
  */
36
- shouldAddToAbstractFileMenu(abstractFile, _source, _leaf) {
37
- if (!(abstractFile instanceof TFolder)) {
80
+ shouldAddToAbstractFileMenu(abstractFile, source, leaf) {
81
+ if (!isFolder(abstractFile)) {
82
+ return false;
83
+ }
84
+ return this.shouldAddToFolderMenu(abstractFile, source, leaf);
85
+ }
86
+ /**
87
+ * Checks if the command should be added to the abstract files menu.
88
+ *
89
+ * @param abstractFiles - The abstract files to check.
90
+ * @param source - The source of the abstract files.
91
+ * @param leaf - The leaf to check.
92
+ * @returns Whether the command should be added to the abstract files menu.
93
+ */
94
+ shouldAddToAbstractFilesMenu(abstractFiles, source, leaf) {
95
+ if (!abstractFiles.every((abstractFile) => isFolder(abstractFile))) {
38
96
  return false;
39
97
  }
40
- return this.shouldAddToFolderMenu(abstractFile, _source, _leaf);
98
+ return this.shouldAddToFoldersMenu(asArrayOfFolders(abstractFiles), source, leaf);
41
99
  }
42
100
  /**
43
101
  * Checks if the command should be added to the folder menu.
@@ -50,6 +108,17 @@ class FolderCommandBase extends AbstractFileCommandBase {
50
108
  shouldAddToFolderMenu(_folder, _source, _leaf) {
51
109
  return false;
52
110
  }
111
+ /**
112
+ * Checks if the command should be added to the folders menu.
113
+ *
114
+ * @param _folders - The folders to check.
115
+ * @param _source - The source of the folders.
116
+ * @param _leaf - The leaf to check.
117
+ * @returns Whether the command should be added to the folders menu.
118
+ */
119
+ shouldAddToFoldersMenu(_folders, _source, _leaf) {
120
+ return false;
121
+ }
53
122
  }
54
123
  class FolderCommandInvocationBase extends AbstractFileCommandInvocationBase {
55
124
  /**
@@ -59,18 +128,40 @@ class FolderCommandInvocationBase extends AbstractFileCommandInvocationBase {
59
128
  * @throws If the abstract file is not a folder.
60
129
  */
61
130
  get folder() {
62
- if (!(this.abstractFile instanceof TFolder)) {
63
- throw new Error("Abstract file is not a folder");
64
- }
65
- return this.abstractFile;
131
+ return asFolder(this._abstractFile);
66
132
  }
67
133
  /**
68
- * Sets the folder that the command invocation belongs to.
134
+ * Checks if the command can execute.
69
135
  *
70
- * @param folder - The folder that the command invocation belongs to.
136
+ * @returns Whether the command can execute.
71
137
  */
72
- set folder(folder) {
73
- this.abstractFile = folder;
138
+ canExecute() {
139
+ return super.canExecute() && !!this.folder;
140
+ }
141
+ }
142
+ class FoldersCommandInvocationBase extends AbstractFilesCommandInvocationBase {
143
+ /**
144
+ * Creates a new folders command invocation.
145
+ *
146
+ * @param plugin - The plugin that the command invocation belongs to.
147
+ * @param folders - The folders to invoke the command for.
148
+ */
149
+ constructor(plugin, folders) {
150
+ super(plugin, folders);
151
+ this.folders = folders;
152
+ }
153
+ }
154
+ class SequentialFoldersCommandInvocationBase extends FoldersCommandInvocationBase {
155
+ /**
156
+ * Creates a new sequential folders command invocation.
157
+ *
158
+ * @param plugin - The plugin that the command invocation belongs to.
159
+ * @param folders - The folders to invoke the command for.
160
+ * @param createCommandInvocationForFolder - The function to create a command invocation for a folder.
161
+ */
162
+ constructor(plugin, folders, createCommandInvocationForFolder) {
163
+ super(plugin, folders);
164
+ this.createCommandInvocationForFolder = createCommandInvocationForFolder;
74
165
  }
75
166
  /**
76
167
  * Checks if the command can execute.
@@ -78,21 +169,23 @@ class FolderCommandInvocationBase extends AbstractFileCommandInvocationBase {
78
169
  * @returns Whether the command can execute.
79
170
  */
80
171
  canExecute() {
81
- if (!super.canExecute()) {
82
- return false;
83
- }
84
- if (!(this.abstractFile instanceof TFolder)) {
85
- const folder = this.app.workspace.getActiveFile()?.parent;
86
- if (!folder) {
87
- return false;
88
- }
89
- this.folder = folder;
172
+ return super.canExecute() && this.folders.every((folder) => this.createCommandInvocationForFolder(folder).invoke(true));
173
+ }
174
+ /**
175
+ * Executes the command.
176
+ *
177
+ * @returns A promise that resolves when the command has been executed.
178
+ */
179
+ async execute() {
180
+ for (const folder of this.folders) {
181
+ await this.createCommandInvocationForFolder(folder).invokeAsync(false);
90
182
  }
91
- return true;
92
183
  }
93
184
  }
94
185
  export {
95
186
  FolderCommandBase,
96
- FolderCommandInvocationBase
187
+ FolderCommandInvocationBase,
188
+ FoldersCommandInvocationBase,
189
+ SequentialFoldersCommandInvocationBase
97
190
  };
98
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vLi4vLi4vc3JjL29ic2lkaWFuL0NvbW1hbmRzL0ZvbGRlckNvbW1hbmRCYXNlLnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyIvKipcbiAqIEBwYWNrYWdlRG9jdW1lbnRhdGlvblxuICpcbiAqIEJhc2UgY2xhc3NlcyBmb3IgZm9sZGVyIGNvbW1hbmRzLlxuICovXG5cbmltcG9ydCB0eXBlIHtcbiAgUGx1Z2luLFxuICBUQWJzdHJhY3RGaWxlLFxuICBXb3Jrc3BhY2VMZWFmXG59IGZyb20gJ29ic2lkaWFuJztcblxuaW1wb3J0IHsgVEZvbGRlciB9IGZyb20gJ29ic2lkaWFuJztcblxuaW1wb3J0IHtcbiAgQWJzdHJhY3RGaWxlQ29tbWFuZEJhc2UsXG4gIEFic3RyYWN0RmlsZUNvbW1hbmRJbnZvY2F0aW9uQmFzZVxufSBmcm9tICcuL0Fic3RyYWN0RmlsZUNvbW1hbmRCYXNlLnRzJztcblxuLyoqXG4gKiBCYXNlIGNsYXNzIGZvciBmb2xkZXIgY29tbWFuZHMuXG4gKlxuICogQHR5cGVQYXJhbSBUUGx1Z2luIC0gVGhlIHR5cGUgb2YgdGh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- * This module provides utility functions for working with TAbstractFile, TFile, and TFolder instances in Obsidian.
4
+ * This module provides utility functions for working with {@link TAbstractFile}, {@link TFile}, and {@link TFolder} instances in Obsidian.
5
5
  */
6
6
  import type { App } from 'obsidian';
7
7
  import { TAbstractFile, TFile, TFolder } from 'obsidian';
@@ -18,17 +18,65 @@ export declare const CANVAS_FILE_EXTENSION = "canvas";
18
18
  */
19
19
  export declare const MARKDOWN_FILE_EXTENSION = "md";
20
20
  /**
21
- * A path or an instance of {@link TAbstractFile}.
21
+ * A path or an abstract file.
22
22
  */
23
23
  export type PathOrAbstractFile = string | TAbstractFile;
24
24
  /**
25
- * A path or a {@link TFile}.
25
+ * A path or a file.
26
26
  */
27
27
  export type PathOrFile = string | TFile;
28
28
  /**
29
- * A path or a {@link TFolder}.
29
+ * A path or a folder.
30
30
  */
31
31
  export type PathOrFolder = string | TFolder;
32
+ /**
33
+ * Converts an array of abstract files to an array of files.
34
+ *
35
+ * @param abstractFiles - The abstract files to convert.
36
+ * @returns The array of files.
37
+ * @throws Error if any of the abstract files are not files.
38
+ */
39
+ export declare function asArrayOfFiles(abstractFiles: TAbstractFile[]): TFile[];
40
+ /**
41
+ * Converts an array of abstract files to an array of folders.
42
+ *
43
+ * @param abstractFiles - The abstract files to convert.
44
+ * @returns The array of folders.
45
+ * @throws Error if any of the abstract files are not folders.
46
+ */
47
+ export declare function asArrayOfFolders(abstractFiles: TAbstractFile[]): TFolder[];
48
+ /**
49
+ * Converts an abstract file to a file.
50
+ *
51
+ * @param abstractFile - The abstract file to convert.
52
+ * @returns The file.
53
+ * @throws Error if the abstract file is not a file.
54
+ */
55
+ export declare function asFile(abstractFile: null | TAbstractFile): TFile;
56
+ /**
57
+ * Converts an abstract file to a file or `null`.
58
+ *
59
+ * @param abstractFile - The abstract file to convert.
60
+ * @returns The file or `null`.
61
+ * @throws Error if the abstract file is not a file.
62
+ */
63
+ export declare function asFileOrNull(abstractFile: null | TAbstractFile): null | TFile;
64
+ /**
65
+ * Converts an abstract file to a folder.
66
+ *
67
+ * @param abstractFile - The abstract file to convert.
68
+ * @returns The folder.
69
+ * @throws Error if the abstract file is not a folder.
70
+ */
71
+ export declare function asFolder(abstractFile: null | TAbstractFile): TFolder;
72
+ /**
73
+ * Converts an abstract file to a folder or `null`.
74
+ *
75
+ * @param abstractFile - The abstract file to convert.
76
+ * @returns The folder or `null`.
77
+ * @throws Error if the abstract file is not a folder.
78
+ */
79
+ export declare function asFolderOrNull(abstractFile: null | TAbstractFile): null | TFolder;
32
80
  /**
33
81
  * Checks if the given path or file has the specified extension.
34
82
  *
@@ -42,90 +90,90 @@ export declare function checkExtension(app: App, pathOrFile: null | PathOrAbstra
42
90
  * Retrieves the TAbstractFile object for the given path or abstract file.
43
91
  *
44
92
  * @param app - The App instance.
45
- * @param pathOrFile - The path or abstract file to retrieve the TAbstractFile for.
93
+ * @param pathOrFile - The path or abstract file to retrieve the abstract file for.
46
94
  * @param isCaseInsensitive - Specifies whether to perform a case-insensitive search. Default is `false`.
47
- * @returns The TAbstractFile object.
95
+ * @returns The abstract file.
48
96
  * @throws Error if the abstract file is not found.
49
97
  */
50
98
  export declare function getAbstractFile(app: App, pathOrFile: PathOrAbstractFile, isCaseInsensitive?: boolean): TAbstractFile;
51
99
  /**
52
- * Retrieves an instance of TAbstractFile or null based on the provided path or abstract file.
100
+ * Retrieves an abstract file or `null` based on the provided path or abstract file.
53
101
  *
54
102
  * @param app - The application instance.
55
103
  * @param pathOrFile - The path or abstract file to retrieve.
56
104
  * @param isCaseInsensitive - Specifies whether to perform a case-insensitive search. Default is `false`.
57
- * @returns The instance of TAbstractFile if found, otherwise null.
105
+ * @returns The abstract file if found, otherwise `null`.
58
106
  */
59
107
  export declare function getAbstractFileOrNull(app: App, pathOrFile: null | PathOrAbstractFile, isCaseInsensitive?: boolean): null | TAbstractFile;
60
108
  /**
61
- * Retrieves a TFile object based on the provided path or file.
109
+ * Retrieves a file based on the provided path or file.
62
110
  *
63
111
  * @param app - The Obsidian App instance.
64
- * @param pathOrFile - The path or file to retrieve the TFile object for.
112
+ * @param pathOrFile - The path or file to retrieve the file for.
65
113
  * @param shouldIncludeNonExisting - Whether to include a non-existing file.
66
- * If `true`, a new TFile object is created for the provided path.
114
+ * If `true`, a new file is created for the provided path.
67
115
  * If `false`, an error is thrown if the file is not found.
68
116
  * @param isCaseInsensitive - Specifies whether to perform a case-insensitive search. Default is `false`.
69
- * @returns The TFile object corresponding to the provided path or file.
117
+ * @returns The file corresponding to the provided path or file.
70
118
  * @throws Error if the file is not found.
71
119
  */
72
120
  export declare function getFile(app: App, pathOrFile: PathOrFile, shouldIncludeNonExisting?: boolean, isCaseInsensitive?: boolean): TFile;
73
121
  /**
74
- * Retrieves a TFile object based on the provided path or file.
75
- * If the provided argument is already a TFile object, it is returned as is.
76
- * Otherwise, the function uses the app's vault to retrieve the TFile object by its path.
122
+ * Retrieves a file or `null` based on the provided path or file.
123
+ * If the provided argument is already a file, it is returned as is.
124
+ * Otherwise, the function uses the app's vault to retrieve the file by its path.
77
125
  *
78
126
  * @param app - The Obsidian App instance.
79
- * @param pathOrFile - The path or TFile object.
127
+ * @param pathOrFile - The path or file.
80
128
  * @param isCaseInsensitive - Specifies whether to perform a case-insensitive search. Default is `false`.
81
- * @returns The TFile object if found, otherwise null.
129
+ * @returns The file if found, otherwise `null`.
82
130
  */
83
131
  export declare function getFileOrNull(app: App, pathOrFile: null | PathOrFile, isCaseInsensitive?: boolean): null | TFile;
84
132
  /**
85
- * Retrieves a TFolder object based on the provided app and pathOrFolder.
133
+ * Retrieves a folder based on the provided app and pathOrFolder.
86
134
  *
87
135
  * @param app - The Obsidian app instance.
88
136
  * @param pathOrFolder - The path or folder identifier.
89
137
  * @param shouldIncludeNonExisting - Whether to allow the folder to not exist.
90
- * If `true`, a new TFolder object is created for the provided path.
138
+ * If `true`, a new folder is created for the provided path.
91
139
  * If `false`, an error is thrown if the folder is not found.
92
140
  * @param isCaseInsensitive - Specifies whether to perform a case-insensitive search. Default is `false`.
93
- * @returns The retrieved TFolder object.
141
+ * @returns The retrieved folder.
94
142
  * @throws If the folder is not found.
95
143
  */
96
144
  export declare function getFolder(app: App, pathOrFolder: PathOrFolder, shouldIncludeNonExisting?: boolean, isCaseInsensitive?: boolean): TFolder;
97
145
  /**
98
- * Retrieves a TFolder object or null based on the provided path or folder.
146
+ * Retrieves a folder or `null` based on the provided path or folder.
99
147
  *
100
148
  * @param app - The Obsidian application instance.
101
- * @param pathOrFolder - The path or folder to retrieve the TFolder from.
149
+ * @param pathOrFolder - The path or folder to retrieve the folder from.
102
150
  * @param isCaseInsensitive - Specifies whether to perform a case-insensitive search. Default is `false`.
103
- * @returns The TFolder object if found, otherwise null.
151
+ * @returns The folder if found, otherwise `null`.
104
152
  */
105
153
  export declare function getFolderOrNull(app: App, pathOrFolder: null | PathOrFolder, isCaseInsensitive?: boolean): null | TFolder;
106
154
  /**
107
- * Retrieves an array of TFile objects representing the markdown files within a specified folder or path.
155
+ * Retrieves an array of files representing the markdown files within a specified folder or path.
108
156
  *
109
157
  * @param app - The Obsidian App instance.
110
158
  * @param pathOrFolder - The path or folder to retrieve the markdown files from.
111
159
  * @param isRecursive - Optional. Specifies whether to recursively search for markdown files within subfolders. Default is false.
112
- * @returns An array of TFile objects representing the markdown files.
160
+ * @returns An array of files representing the markdown files.
113
161
  */
114
162
  export declare function getMarkdownFiles(app: App, pathOrFolder: PathOrFolder, isRecursive?: boolean): TFile[];
115
163
  /**
116
- * Retrieves the TFile object for the given path or creates a new one if it does not exist.
164
+ * Retrieves the file for the given path or creates a new one if it does not exist.
117
165
  *
118
166
  * @param app - The Obsidian App instance.
119
167
  * @param path - The path of the file to retrieve or create.
120
- * @returns The TFile object representing the file
168
+ * @returns The file representing the file
121
169
  */
122
170
  export declare function getOrCreateFile(app: App, path: string): Promise<TFile>;
123
171
  /**
124
- * Retrieves the TFolder object for the given path or creates a new one if it does not exist.
172
+ * Retrieves the folder for the given path or creates a new one if it does not exist.
125
173
  *
126
174
  * @param app - The Obsidian App instance.
127
175
  * @param path - The path of the folder to retrieve or create.
128
- * @returns The TFolder object representing the folder.
176
+ * @returns The folder representing the folder.
129
177
  */
130
178
  export declare function getOrCreateFolder(app: App, path: string): Promise<TFolder>;
131
179
  /**
@@ -137,10 +185,10 @@ export declare function getOrCreateFolder(app: App, path: string): Promise<TFold
137
185
  */
138
186
  export declare function getPath(app: App, pathOrFile: PathOrAbstractFile): string;
139
187
  /**
140
- * Checks if the given file is an instance of TAbstractFile.
188
+ * Checks if the given file is an instance of abstract file.
141
189
  *
142
190
  * @param file - The file to check.
143
- * @returns A boolean indicating whether the file is an instance of TAbstractFile.
191
+ * @returns A boolean indicating whether the file is an instance of abstract file.
144
192
  */
145
193
  export declare function isAbstractFile(file: unknown): file is TAbstractFile;
146
194
  /**
@@ -160,10 +208,10 @@ export declare function isBaseFile(app: App, pathOrFile: null | PathOrAbstractFi
160
208
  */
161
209
  export declare function isCanvasFile(app: App, pathOrFile: null | PathOrAbstractFile): boolean;
162
210
  /**
163
- * Checks if the given file is an instance of TFile.
211
+ * Checks if the given file is an instance of file.
164
212
  *
165
213
  * @param file - The file to check.
166
- * @returns A boolean indicating whether the file is an instance of TFile.
214
+ * @returns A boolean indicating whether the file is an instance of file.
167
215
  */
168
216
  export declare function isFile(file: unknown): file is TFile;
169
217
  /**