@real1ty-obsidian-plugins/utils 2.29.0 → 2.30.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 (237) hide show
  1. package/package.json +1 -1
  2. package/dist/async/async.d.ts +0 -69
  3. package/dist/async/async.d.ts.map +0 -1
  4. package/dist/async/async.js +0 -108
  5. package/dist/async/async.js.map +0 -1
  6. package/dist/async/batch-operations.d.ts +0 -21
  7. package/dist/async/batch-operations.d.ts.map +0 -1
  8. package/dist/async/batch-operations.js +0 -60
  9. package/dist/async/batch-operations.js.map +0 -1
  10. package/dist/async/change-notifier.d.ts +0 -13
  11. package/dist/async/change-notifier.d.ts.map +0 -1
  12. package/dist/async/change-notifier.js +0 -26
  13. package/dist/async/change-notifier.js.map +0 -1
  14. package/dist/async/debounced-notifier.d.ts +0 -26
  15. package/dist/async/debounced-notifier.d.ts.map +0 -1
  16. package/dist/async/debounced-notifier.js +0 -50
  17. package/dist/async/debounced-notifier.js.map +0 -1
  18. package/dist/async/index.d.ts +0 -5
  19. package/dist/async/index.d.ts.map +0 -1
  20. package/dist/async/index.js +0 -5
  21. package/dist/async/index.js.map +0 -1
  22. package/dist/components/frontmatter-propagation-modal.d.ts +0 -17
  23. package/dist/components/frontmatter-propagation-modal.d.ts.map +0 -1
  24. package/dist/components/frontmatter-propagation-modal.js +0 -85
  25. package/dist/components/frontmatter-propagation-modal.js.map +0 -1
  26. package/dist/components/index.d.ts +0 -5
  27. package/dist/components/index.d.ts.map +0 -1
  28. package/dist/components/index.js +0 -5
  29. package/dist/components/index.js.map +0 -1
  30. package/dist/components/input-managers/base.d.ts +0 -30
  31. package/dist/components/input-managers/base.d.ts.map +0 -1
  32. package/dist/components/input-managers/base.js +0 -115
  33. package/dist/components/input-managers/base.js.map +0 -1
  34. package/dist/components/input-managers/expression.d.ts +0 -12
  35. package/dist/components/input-managers/expression.d.ts.map +0 -1
  36. package/dist/components/input-managers/expression.js +0 -56
  37. package/dist/components/input-managers/expression.js.map +0 -1
  38. package/dist/components/input-managers/index.d.ts +0 -4
  39. package/dist/components/input-managers/index.d.ts.map +0 -1
  40. package/dist/components/input-managers/index.js +0 -4
  41. package/dist/components/input-managers/index.js.map +0 -1
  42. package/dist/components/input-managers/search.d.ts +0 -6
  43. package/dist/components/input-managers/search.d.ts.map +0 -1
  44. package/dist/components/input-managers/search.js +0 -16
  45. package/dist/components/input-managers/search.js.map +0 -1
  46. package/dist/components/registered-events-component.d.ts +0 -30
  47. package/dist/components/registered-events-component.d.ts.map +0 -1
  48. package/dist/components/registered-events-component.js +0 -43
  49. package/dist/components/registered-events-component.js.map +0 -1
  50. package/dist/components/whats-new-modal.d.ts +0 -64
  51. package/dist/components/whats-new-modal.d.ts.map +0 -1
  52. package/dist/components/whats-new-modal.js +0 -139
  53. package/dist/components/whats-new-modal.js.map +0 -1
  54. package/dist/core/color-utils.d.ts +0 -17
  55. package/dist/core/color-utils.d.ts.map +0 -1
  56. package/dist/core/color-utils.js +0 -29
  57. package/dist/core/color-utils.js.map +0 -1
  58. package/dist/core/css-utils.d.ts +0 -39
  59. package/dist/core/css-utils.d.ts.map +0 -1
  60. package/dist/core/css-utils.js +0 -60
  61. package/dist/core/css-utils.js.map +0 -1
  62. package/dist/core/evaluator/base.d.ts +0 -22
  63. package/dist/core/evaluator/base.d.ts.map +0 -1
  64. package/dist/core/evaluator/base.js +0 -67
  65. package/dist/core/evaluator/base.js.map +0 -1
  66. package/dist/core/evaluator/color.d.ts +0 -19
  67. package/dist/core/evaluator/color.d.ts.map +0 -1
  68. package/dist/core/evaluator/color.js +0 -25
  69. package/dist/core/evaluator/color.js.map +0 -1
  70. package/dist/core/evaluator/excluded.d.ts +0 -32
  71. package/dist/core/evaluator/excluded.d.ts.map +0 -1
  72. package/dist/core/evaluator/excluded.js +0 -41
  73. package/dist/core/evaluator/excluded.js.map +0 -1
  74. package/dist/core/evaluator/filter.d.ts +0 -15
  75. package/dist/core/evaluator/filter.d.ts.map +0 -1
  76. package/dist/core/evaluator/filter.js +0 -27
  77. package/dist/core/evaluator/filter.js.map +0 -1
  78. package/dist/core/evaluator/included.d.ts +0 -36
  79. package/dist/core/evaluator/included.d.ts.map +0 -1
  80. package/dist/core/evaluator/included.js +0 -51
  81. package/dist/core/evaluator/included.js.map +0 -1
  82. package/dist/core/evaluator/index.d.ts +0 -6
  83. package/dist/core/evaluator/index.d.ts.map +0 -1
  84. package/dist/core/evaluator/index.js +0 -6
  85. package/dist/core/evaluator/index.js.map +0 -1
  86. package/dist/core/expression-utils.d.ts +0 -17
  87. package/dist/core/expression-utils.d.ts.map +0 -1
  88. package/dist/core/expression-utils.js +0 -40
  89. package/dist/core/expression-utils.js.map +0 -1
  90. package/dist/core/frontmatter-value.d.ts +0 -157
  91. package/dist/core/frontmatter-value.d.ts.map +0 -1
  92. package/dist/core/frontmatter-value.js +0 -417
  93. package/dist/core/frontmatter-value.js.map +0 -1
  94. package/dist/core/generate.d.ts +0 -7
  95. package/dist/core/generate.d.ts.map +0 -1
  96. package/dist/core/generate.js +0 -13
  97. package/dist/core/generate.js.map +0 -1
  98. package/dist/core/history.d.ts +0 -12
  99. package/dist/core/history.d.ts.map +0 -1
  100. package/dist/core/history.js +0 -39
  101. package/dist/core/history.js.map +0 -1
  102. package/dist/core/index.d.ts +0 -11
  103. package/dist/core/index.d.ts.map +0 -1
  104. package/dist/core/index.js +0 -11
  105. package/dist/core/index.js.map +0 -1
  106. package/dist/core/indexer.d.ts +0 -109
  107. package/dist/core/indexer.d.ts.map +0 -1
  108. package/dist/core/indexer.js +0 -185
  109. package/dist/core/indexer.js.map +0 -1
  110. package/dist/core/property-renderer.d.ts +0 -9
  111. package/dist/core/property-renderer.d.ts.map +0 -1
  112. package/dist/core/property-renderer.js +0 -42
  113. package/dist/core/property-renderer.js.map +0 -1
  114. package/dist/core/validation.d.ts +0 -13
  115. package/dist/core/validation.d.ts.map +0 -1
  116. package/dist/core/validation.js +0 -27
  117. package/dist/core/validation.js.map +0 -1
  118. package/dist/date/date-recurrence.d.ts +0 -30
  119. package/dist/date/date-recurrence.d.ts.map +0 -1
  120. package/dist/date/date-recurrence.js +0 -188
  121. package/dist/date/date-recurrence.js.map +0 -1
  122. package/dist/date/date.d.ts +0 -21
  123. package/dist/date/date.d.ts.map +0 -1
  124. package/dist/date/date.js +0 -105
  125. package/dist/date/date.js.map +0 -1
  126. package/dist/date/index.d.ts +0 -3
  127. package/dist/date/index.d.ts.map +0 -1
  128. package/dist/date/index.js +0 -3
  129. package/dist/date/index.js.map +0 -1
  130. package/dist/file/child-reference.d.ts +0 -9
  131. package/dist/file/child-reference.d.ts.map +0 -1
  132. package/dist/file/child-reference.js +0 -57
  133. package/dist/file/child-reference.js.map +0 -1
  134. package/dist/file/file-operations.d.ts +0 -31
  135. package/dist/file/file-operations.d.ts.map +0 -1
  136. package/dist/file/file-operations.js +0 -160
  137. package/dist/file/file-operations.js.map +0 -1
  138. package/dist/file/file-utils.d.ts +0 -33
  139. package/dist/file/file-utils.d.ts.map +0 -1
  140. package/dist/file/file-utils.js +0 -76
  141. package/dist/file/file-utils.js.map +0 -1
  142. package/dist/file/file.d.ts +0 -332
  143. package/dist/file/file.d.ts.map +0 -1
  144. package/dist/file/file.js +0 -559
  145. package/dist/file/file.js.map +0 -1
  146. package/dist/file/frontmatter-diff.d.ts +0 -38
  147. package/dist/file/frontmatter-diff.d.ts.map +0 -1
  148. package/dist/file/frontmatter-diff.js +0 -162
  149. package/dist/file/frontmatter-diff.js.map +0 -1
  150. package/dist/file/frontmatter-propagation.d.ts +0 -4
  151. package/dist/file/frontmatter-propagation.d.ts.map +0 -1
  152. package/dist/file/frontmatter-propagation.js +0 -28
  153. package/dist/file/frontmatter-propagation.js.map +0 -1
  154. package/dist/file/frontmatter-serialization.d.ts +0 -21
  155. package/dist/file/frontmatter-serialization.d.ts.map +0 -1
  156. package/dist/file/frontmatter-serialization.js +0 -57
  157. package/dist/file/frontmatter-serialization.js.map +0 -1
  158. package/dist/file/frontmatter.d.ts +0 -15
  159. package/dist/file/frontmatter.d.ts.map +0 -1
  160. package/dist/file/frontmatter.js +0 -68
  161. package/dist/file/frontmatter.js.map +0 -1
  162. package/dist/file/index.d.ts +0 -13
  163. package/dist/file/index.d.ts.map +0 -1
  164. package/dist/file/index.js +0 -13
  165. package/dist/file/index.js.map +0 -1
  166. package/dist/file/link-parser.d.ts +0 -63
  167. package/dist/file/link-parser.d.ts.map +0 -1
  168. package/dist/file/link-parser.js +0 -137
  169. package/dist/file/link-parser.js.map +0 -1
  170. package/dist/file/property-utils.d.ts +0 -55
  171. package/dist/file/property-utils.d.ts.map +0 -1
  172. package/dist/file/property-utils.js +0 -90
  173. package/dist/file/property-utils.js.map +0 -1
  174. package/dist/file/templater-service.d.ts +0 -16
  175. package/dist/file/templater-service.d.ts.map +0 -1
  176. package/dist/file/templater-service.js +0 -37
  177. package/dist/file/templater-service.js.map +0 -1
  178. package/dist/file/templater.d.ts +0 -28
  179. package/dist/file/templater.d.ts.map +0 -1
  180. package/dist/file/templater.js +0 -126
  181. package/dist/file/templater.js.map +0 -1
  182. package/dist/index.d.ts +0 -9
  183. package/dist/index.d.ts.map +0 -1
  184. package/dist/index.js +0 -17
  185. package/dist/index.js.map +0 -1
  186. package/dist/inputs/index.d.ts +0 -2
  187. package/dist/inputs/index.d.ts.map +0 -1
  188. package/dist/inputs/index.js +0 -2
  189. package/dist/inputs/index.js.map +0 -1
  190. package/dist/inputs/input-filter-manager.d.ts +0 -72
  191. package/dist/inputs/input-filter-manager.d.ts.map +0 -1
  192. package/dist/inputs/input-filter-manager.js +0 -140
  193. package/dist/inputs/input-filter-manager.js.map +0 -1
  194. package/dist/settings/index.d.ts +0 -3
  195. package/dist/settings/index.d.ts.map +0 -1
  196. package/dist/settings/index.js +0 -3
  197. package/dist/settings/index.js.map +0 -1
  198. package/dist/settings/settings-store.d.ts +0 -20
  199. package/dist/settings/settings-store.d.ts.map +0 -1
  200. package/dist/settings/settings-store.js +0 -82
  201. package/dist/settings/settings-store.js.map +0 -1
  202. package/dist/settings/settings-ui-builder.d.ts +0 -74
  203. package/dist/settings/settings-ui-builder.d.ts.map +0 -1
  204. package/dist/settings/settings-ui-builder.js +0 -436
  205. package/dist/settings/settings-ui-builder.js.map +0 -1
  206. package/dist/string/changelog-parser.d.ts +0 -17
  207. package/dist/string/changelog-parser.d.ts.map +0 -1
  208. package/dist/string/changelog-parser.js +0 -77
  209. package/dist/string/changelog-parser.js.map +0 -1
  210. package/dist/string/filename-utils.d.ts +0 -46
  211. package/dist/string/filename-utils.d.ts.map +0 -1
  212. package/dist/string/filename-utils.js +0 -65
  213. package/dist/string/filename-utils.js.map +0 -1
  214. package/dist/string/index.d.ts +0 -4
  215. package/dist/string/index.d.ts.map +0 -1
  216. package/dist/string/index.js +0 -4
  217. package/dist/string/index.js.map +0 -1
  218. package/dist/string/string.d.ts +0 -5
  219. package/dist/string/string.d.ts.map +0 -1
  220. package/dist/string/string.js +0 -25
  221. package/dist/string/string.js.map +0 -1
  222. package/dist/testing/index.d.ts +0 -5
  223. package/dist/testing/index.d.ts.map +0 -1
  224. package/dist/testing/index.js +0 -6
  225. package/dist/testing/index.js.map +0 -1
  226. package/dist/testing/mocks/obsidian.d.ts +0 -150
  227. package/dist/testing/mocks/obsidian.d.ts.map +0 -1
  228. package/dist/testing/mocks/obsidian.js +0 -226
  229. package/dist/testing/mocks/obsidian.js.map +0 -1
  230. package/dist/testing/mocks/utils.d.ts +0 -14
  231. package/dist/testing/mocks/utils.d.ts.map +0 -1
  232. package/dist/testing/mocks/utils.js +0 -85
  233. package/dist/testing/mocks/utils.js.map +0 -1
  234. package/dist/testing/setup.d.ts +0 -2
  235. package/dist/testing/setup.d.ts.map +0 -1
  236. package/dist/testing/setup.js +0 -18
  237. package/dist/testing/setup.js.map +0 -1
@@ -1,160 +0,0 @@
1
- import { __awaiter } from "tslib";
2
- import * as fs from "node:fs/promises";
3
- import * as path from "node:path";
4
- import { Notice, TFile } from "obsidian";
5
- import { generateZettelId } from "../core";
6
- import { generateUniqueFilePath } from "./file";
7
- import { extractFilePathFromLink } from "./link-parser";
8
- export const fromRoot = (relativePath) => {
9
- return path.resolve(__dirname, `../../../${relativePath}`);
10
- };
11
- export const getActiveFileOrThrow = (app) => {
12
- const activeFile = app.workspace.getActiveFile();
13
- if (!activeFile) {
14
- new Notice(`⚠️ Open a note first.`);
15
- throw new Error(`Open a note first.`);
16
- }
17
- return activeFile;
18
- };
19
- export const getTemplateContent = (app, templatePath) => __awaiter(void 0, void 0, void 0, function* () {
20
- const templateFile = app.vault.getAbstractFileByPath(templatePath);
21
- if (!templateFile) {
22
- new Notice(`❌ Template not found: ${templatePath}`);
23
- throw new Error(`Template not found: ${templatePath}`);
24
- }
25
- return yield app.vault.read(templateFile);
26
- });
27
- export const ensureFolderExists = (app, folderPath) => __awaiter(void 0, void 0, void 0, function* () {
28
- if (!app.vault.getAbstractFileByPath(folderPath)) {
29
- yield app.vault.createFolder(folderPath).catch(() => { });
30
- }
31
- });
32
- export const openFileInNewLeaf = (app, file) => __awaiter(void 0, void 0, void 0, function* () {
33
- yield app.workspace.getLeaf(true).openFile(file);
34
- });
35
- export const getNoteFilesFromDir = (directoryPath) => __awaiter(void 0, void 0, void 0, function* () {
36
- const files = yield fs.readdir(directoryPath);
37
- const directoryName = path.basename(directoryPath);
38
- return files.filter((file) => {
39
- if (!file.endsWith(".md"))
40
- return false;
41
- const fileNameWithoutExt = path.parse(file).name;
42
- if (fileNameWithoutExt === directoryName) {
43
- console.log(`⏭️ Skipping directory-level file: ${file}`);
44
- return false;
45
- }
46
- return true;
47
- });
48
- });
49
- export const getTargetFileFromLink = (app, relationshipLink) => {
50
- const targetFilePath = extractFilePathFromLink(relationshipLink);
51
- if (!targetFilePath) {
52
- console.warn(`Failed to extract file path from link: ${relationshipLink}`);
53
- return null;
54
- }
55
- const targetFile = app.vault.getAbstractFileByPath(targetFilePath);
56
- if (!targetFile) {
57
- console.warn(`Target file not found for link: ${relationshipLink}`);
58
- return null;
59
- }
60
- return targetFile;
61
- };
62
- export const createFileLink = (file) => {
63
- var _a;
64
- const folder = ((_a = file.parent) === null || _a === void 0 ? void 0 : _a.path) && file.parent.path !== "/" ? file.parent.path : "";
65
- return folder ? `[[${folder}/${file.basename}|${file.basename}]]` : `[[${file.basename}]]`;
66
- };
67
- export const normalizeArray = (value) => {
68
- if (!value) {
69
- return [];
70
- }
71
- if (typeof value === "string") {
72
- return [value];
73
- }
74
- if (Array.isArray(value)) {
75
- return value;
76
- }
77
- return [];
78
- };
79
- export const arraysEqual = (a, b) => {
80
- return a.length === b.length && a.every((val, index) => val === b[index]);
81
- };
82
- /**
83
- * Normalizes frontmatter content by converting quoted numeric _ZettelIDs to numbers.
84
- * This handles edge cases where YAML parsers treat numeric strings inconsistently.
85
- */
86
- export const normalizeContent = (content) => {
87
- let normalized = content;
88
- let hasChanges = false;
89
- // Normalize _ZettelID: "string" → number (remove quotes)
90
- const zettelIdMatch = normalized.match(/^_ZettelID:\s*"(\d+)"/m);
91
- if (zettelIdMatch) {
92
- const [fullMatch, numericId] = zettelIdMatch;
93
- const replacement = `_ZettelID: ${numericId}`;
94
- normalized = normalized.replace(fullMatch, replacement);
95
- hasChanges = true;
96
- console.log(` ✅ _ZettelID: "${numericId}" → ${numericId}`);
97
- }
98
- return hasChanges ? normalized : content;
99
- };
100
- /**
101
- * Safely performs a file operation with error handling and file validation.
102
- * Reduces boilerplate for common file operations.
103
- */
104
- export const withFileOperation = (app_1, event_1, operation_1, ...args_1) => __awaiter(void 0, [app_1, event_1, operation_1, ...args_1], void 0, function* (app, event, operation, errorMessage = "Operation failed") {
105
- try {
106
- const filePath = event.extendedProps.filePath;
107
- const file = app.vault.getAbstractFileByPath(filePath);
108
- if (!(file instanceof TFile)) {
109
- new Notice("Could not find the file");
110
- return null;
111
- }
112
- return yield operation(file);
113
- }
114
- catch (error) {
115
- console.error(`Error in file operation:`, error);
116
- new Notice(errorMessage);
117
- return null;
118
- }
119
- });
120
- /**
121
- * Safely performs a file operation by file path with error handling and file validation.
122
- */
123
- export const withFile = (app_1, filePath_1, operation_1, ...args_1) => __awaiter(void 0, [app_1, filePath_1, operation_1, ...args_1], void 0, function* (app, filePath, operation, errorMessage = "Operation failed") {
124
- try {
125
- const file = app.vault.getAbstractFileByPath(filePath);
126
- if (!(file instanceof TFile)) {
127
- new Notice("Could not find the file");
128
- return null;
129
- }
130
- return yield operation(file);
131
- }
132
- catch (error) {
133
- console.error(`Error in file operation:`, error);
134
- new Notice(errorMessage);
135
- return null;
136
- }
137
- });
138
- /**
139
- * Duplicates a file with a new ZettelID, preserving the original content
140
- * but updating the ZettelID in frontmatter if configured.
141
- */
142
- export const duplicateFileWithNewZettelId = (app, file, zettelIdProp) => __awaiter(void 0, void 0, void 0, function* () {
143
- var _a;
144
- const content = yield app.vault.read(file);
145
- const parentPath = ((_a = file.parent) === null || _a === void 0 ? void 0 : _a.path) || "";
146
- const baseNameWithoutZettel = file.basename.replace(/-\d{14}$/, "");
147
- const zettelId = generateZettelId();
148
- const newBasename = `${baseNameWithoutZettel}-${zettelId}`;
149
- const newFilePath = generateUniqueFilePath(app, parentPath, newBasename);
150
- // Create the new file with original content
151
- const newFile = yield app.vault.create(newFilePath, content);
152
- // Update the ZettelID in frontmatter if configured
153
- if (zettelIdProp) {
154
- yield app.fileManager.processFrontMatter(newFile, (fm) => {
155
- fm[zettelIdProp] = zettelId;
156
- });
157
- }
158
- return newFile;
159
- });
160
- //# sourceMappingURL=file-operations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-operations.js","sourceRoot":"","sources":["../../src/file/file-operations.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAY,MAAM,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,sBAA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CAAC;IAC3D,MAAM,WAAW,GAAG,sBAAsB,CAAC,GAAG,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;IAEzE,4CAA4C;IAC5C,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAE7D,mDAAmD;IACnD,IAAI,YAAY,EAAE,CAAC;QAClB,MAAM,GAAG,CAAC,WAAW,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE;YACxD,EAAE,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAC;QAC7B,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC,CAAA,CAAC","sourcesContent":["import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { type App, Notice, TFile } from \"obsidian\";\nimport { generateZettelId } from \"../core\";\nimport { generateUniqueFilePath } from \"./file\";\nimport { extractFilePathFromLink } from \"./link-parser\";\n\nexport const fromRoot = (relativePath: string): string => {\n\treturn path.resolve(__dirname, `../../../${relativePath}`);\n};\n\nexport const getActiveFileOrThrow = (app: App): TFile => {\n\tconst activeFile: TFile | null = app.workspace.getActiveFile();\n\tif (!activeFile) {\n\t\tnew Notice(`⚠️ Open a note first.`);\n\t\tthrow new Error(`Open a note first.`);\n\t}\n\treturn activeFile;\n};\n\nexport const getTemplateContent = async (app: App, templatePath: string): Promise<string> => {\n\tconst templateFile = app.vault.getAbstractFileByPath(templatePath);\n\tif (!templateFile) {\n\t\tnew Notice(`❌ Template not found: ${templatePath}`);\n\t\tthrow new Error(`Template not found: ${templatePath}`);\n\t}\n\n\treturn await app.vault.read(templateFile as TFile);\n};\n\nexport const ensureFolderExists = async (app: App, folderPath: string): Promise<void> => {\n\tif (!app.vault.getAbstractFileByPath(folderPath)) {\n\t\tawait app.vault.createFolder(folderPath).catch(() => {});\n\t}\n};\n\nexport const openFileInNewLeaf = async (app: App, file: TFile): Promise<void> => {\n\tawait app.workspace.getLeaf(true).openFile(file);\n};\n\nexport const getNoteFilesFromDir = async (directoryPath: string): Promise<string[]> => {\n\tconst files = await fs.readdir(directoryPath);\n\tconst directoryName = path.basename(directoryPath);\n\n\treturn files.filter((file) => {\n\t\tif (!file.endsWith(\".md\")) return false;\n\n\t\tconst fileNameWithoutExt = path.parse(file).name;\n\t\tif (fileNameWithoutExt === directoryName) {\n\t\t\tconsole.log(`⏭️ Skipping directory-level file: ${file}`);\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t});\n};\n\nexport const getTargetFileFromLink = (app: App, relationshipLink: string): TFile | null => {\n\tconst targetFilePath = extractFilePathFromLink(relationshipLink);\n\tif (!targetFilePath) {\n\t\tconsole.warn(`Failed to extract file path from link: ${relationshipLink}`);\n\t\treturn null;\n\t}\n\n\tconst targetFile = app.vault.getAbstractFileByPath(targetFilePath) as TFile;\n\tif (!targetFile) {\n\t\tconsole.warn(`Target file not found for link: ${relationshipLink}`);\n\t\treturn null;\n\t}\n\n\treturn targetFile;\n};\n\nexport const createFileLink = (file: TFile): string => {\n\tconst folder = file.parent?.path && file.parent.path !== \"/\" ? file.parent.path : \"\";\n\treturn folder ? `[[${folder}/${file.basename}|${file.basename}]]` : `[[${file.basename}]]`;\n};\n\nexport const normalizeArray = (value: string | string[] | undefined): string[] => {\n\tif (!value) {\n\t\treturn [];\n\t}\n\tif (typeof value === \"string\") {\n\t\treturn [value];\n\t}\n\tif (Array.isArray(value)) {\n\t\treturn value;\n\t}\n\treturn [];\n};\n\nexport const arraysEqual = (a: string[], b: string[]): boolean => {\n\treturn a.length === b.length && a.every((val, index) => val === b[index]);\n};\n\n/**\n * Normalizes frontmatter content by converting quoted numeric _ZettelIDs to numbers.\n * This handles edge cases where YAML parsers treat numeric strings inconsistently.\n */\nexport const normalizeContent = (content: string): string => {\n\tlet normalized = content;\n\tlet hasChanges = false;\n\n\t// Normalize _ZettelID: \"string\" → number (remove quotes)\n\tconst zettelIdMatch = normalized.match(/^_ZettelID:\\s*\"(\\d+)\"/m);\n\tif (zettelIdMatch) {\n\t\tconst [fullMatch, numericId] = zettelIdMatch;\n\t\tconst replacement = `_ZettelID: ${numericId}`;\n\t\tnormalized = normalized.replace(fullMatch, replacement);\n\t\thasChanges = true;\n\t\tconsole.log(` ✅ _ZettelID: \"${numericId}\" → ${numericId}`);\n\t}\n\n\treturn hasChanges ? normalized : content;\n};\n\n/**\n * Safely performs a file operation with error handling and file validation.\n * Reduces boilerplate for common file operations.\n */\nexport const withFileOperation = async <T>(\n\tapp: App,\n\tevent: any,\n\toperation: (file: TFile) => Promise<T>,\n\terrorMessage: string = \"Operation failed\"\n): Promise<T | null> => {\n\ttry {\n\t\tconst filePath = event.extendedProps.filePath;\n\t\tconst file = app.vault.getAbstractFileByPath(filePath);\n\n\t\tif (!(file instanceof TFile)) {\n\t\t\tnew Notice(\"Could not find the file\");\n\t\t\treturn null;\n\t\t}\n\n\t\treturn await operation(file);\n\t} catch (error) {\n\t\tconsole.error(`Error in file operation:`, error);\n\t\tnew Notice(errorMessage);\n\t\treturn null;\n\t}\n};\n\n/**\n * Safely performs a file operation by file path with error handling and file validation.\n */\nexport const withFile = async <T>(\n\tapp: App,\n\tfilePath: string,\n\toperation: (file: TFile) => Promise<T>,\n\terrorMessage: string = \"Operation failed\"\n): Promise<T | null> => {\n\ttry {\n\t\tconst file = app.vault.getAbstractFileByPath(filePath);\n\n\t\tif (!(file instanceof TFile)) {\n\t\t\tnew Notice(\"Could not find the file\");\n\t\t\treturn null;\n\t\t}\n\n\t\treturn await operation(file);\n\t} catch (error) {\n\t\tconsole.error(`Error in file operation:`, error);\n\t\tnew Notice(errorMessage);\n\t\treturn null;\n\t}\n};\n\n/**\n * Duplicates a file with a new ZettelID, preserving the original content\n * but updating the ZettelID in frontmatter if configured.\n */\nexport const duplicateFileWithNewZettelId = async (\n\tapp: App,\n\tfile: TFile,\n\tzettelIdProp?: string\n): Promise<TFile> => {\n\tconst content = await app.vault.read(file);\n\n\tconst parentPath = file.parent?.path || \"\";\n\tconst baseNameWithoutZettel = file.basename.replace(/-\\d{14}$/, \"\");\n\tconst zettelId = generateZettelId();\n\tconst newBasename = `${baseNameWithoutZettel}-${zettelId}`;\n\tconst newFilePath = generateUniqueFilePath(app, parentPath, newBasename);\n\n\t// Create the new file with original content\n\tconst newFile = await app.vault.create(newFilePath, content);\n\n\t// Update the ZettelID in frontmatter if configured\n\tif (zettelIdProp) {\n\t\tawait app.fileManager.processFrontMatter(newFile, (fm) => {\n\t\t\tfm[zettelIdProp] = zettelId;\n\t\t});\n\t}\n\n\treturn newFile;\n};\n"]}
@@ -1,33 +0,0 @@
1
- import type { App } from "obsidian";
2
- import { TFile } from "obsidian";
3
- /**
4
- * Waits for a file to be accessible and readable by Obsidian's cache.
5
- * This is necessary because Templater creates files asynchronously.
6
- */
7
- export declare function waitForFileReady(app: App, filePath: string, timeoutMs?: number): Promise<TFile | null>;
8
- /**
9
- * Gets a TFile by path or throws an error if not found.
10
- * Useful when you need to ensure a file exists before proceeding.
11
- */
12
- export declare const getTFileOrThrow: (app: App, path: string) => TFile;
13
- /**
14
- * Executes an operation on a file's frontmatter.
15
- * Wrapper around Obsidian's processFrontMatter for more concise usage.
16
- */
17
- export declare const withFrontmatter: (app: App, file: TFile, update: (fm: Record<string, unknown>) => void) => Promise<void>;
18
- /**
19
- * Creates a backup copy of a file's frontmatter.
20
- * Useful for undo/redo operations or temporary modifications.
21
- */
22
- export declare const backupFrontmatter: (app: App, file: TFile) => Promise<Record<string, unknown>>;
23
- /**
24
- * Restores a file's frontmatter from a backup.
25
- * Clears existing frontmatter and replaces with the backup.
26
- */
27
- export declare const restoreFrontmatter: (app: App, file: TFile, original: Record<string, unknown>) => Promise<void>;
28
- /**
29
- * Extracts the content that appears after the frontmatter section.
30
- * Returns the entire content if no frontmatter is found.
31
- */
32
- export declare const extractContentAfterFrontmatter: (fullContent: string) => string;
33
- //# sourceMappingURL=file-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-utils.d.ts","sourceRoot":"","sources":["../../src/file/file-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC;;;GAGG;AACH,wBAAsB,gBAAgB,CACrC,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,MAAM,EAChB,SAAS,SAAO,GACd,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAgBvB;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,GAAG,EAAE,MAAM,MAAM,KAAG,KAIxD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAC3B,KAAK,GAAG,EACR,MAAM,KAAK,EACX,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,kBACO,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAU,KAAK,GAAG,EAAE,MAAM,KAAK,qCAM5D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC9B,KAAK,GAAG,EACR,MAAM,KAAK,EACX,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,kBAO/B,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,8BAA8B,GAAI,aAAa,MAAM,KAAG,MAWpE,CAAC"}
@@ -1,76 +0,0 @@
1
- import { __awaiter } from "tslib";
2
- import { TFile } from "obsidian";
3
- /**
4
- * Waits for a file to be accessible and readable by Obsidian's cache.
5
- * This is necessary because Templater creates files asynchronously.
6
- */
7
- export function waitForFileReady(app_1, filePath_1) {
8
- return __awaiter(this, arguments, void 0, function* (app, filePath, timeoutMs = 5000) {
9
- const started = Date.now();
10
- while (Date.now() - started < timeoutMs) {
11
- const file = app.vault.getAbstractFileByPath(filePath);
12
- if (file instanceof TFile) {
13
- // Check if file is readable by trying to get its metadata
14
- const metadata = app.metadataCache.getFileCache(file);
15
- if (metadata !== null && metadata !== undefined) {
16
- return file;
17
- }
18
- }
19
- yield new Promise((r) => setTimeout(r, 50));
20
- }
21
- return null;
22
- });
23
- }
24
- /**
25
- * Gets a TFile by path or throws an error if not found.
26
- * Useful when you need to ensure a file exists before proceeding.
27
- */
28
- export const getTFileOrThrow = (app, path) => {
29
- const f = app.vault.getAbstractFileByPath(path);
30
- if (!(f instanceof TFile))
31
- throw new Error(`File not found: ${path}`);
32
- return f;
33
- };
34
- /**
35
- * Executes an operation on a file's frontmatter.
36
- * Wrapper around Obsidian's processFrontMatter for more concise usage.
37
- */
38
- export const withFrontmatter = (app, file, update) => __awaiter(void 0, void 0, void 0, function* () { return app.fileManager.processFrontMatter(file, update); });
39
- /**
40
- * Creates a backup copy of a file's frontmatter.
41
- * Useful for undo/redo operations or temporary modifications.
42
- */
43
- export const backupFrontmatter = (app, file) => __awaiter(void 0, void 0, void 0, function* () {
44
- let copy = {};
45
- yield withFrontmatter(app, file, (fm) => {
46
- copy = Object.assign({}, fm);
47
- });
48
- return copy;
49
- });
50
- /**
51
- * Restores a file's frontmatter from a backup.
52
- * Clears existing frontmatter and replaces with the backup.
53
- */
54
- export const restoreFrontmatter = (app, file, original) => __awaiter(void 0, void 0, void 0, function* () {
55
- return withFrontmatter(app, file, (fm) => {
56
- for (const k of Object.keys(fm)) {
57
- delete fm[k];
58
- }
59
- Object.assign(fm, original);
60
- });
61
- });
62
- /**
63
- * Extracts the content that appears after the frontmatter section.
64
- * Returns the entire content if no frontmatter is found.
65
- */
66
- export const extractContentAfterFrontmatter = (fullContent) => {
67
- const frontmatterRegex = /^---\s*\n([\s\S]*?)\n---\s*\n/;
68
- const match = fullContent.match(frontmatterRegex);
69
- if (match) {
70
- // Return content after frontmatter
71
- return fullContent.substring(match.index + match[0].length);
72
- }
73
- // If no frontmatter found, return the entire content
74
- return fullContent;
75
- };
76
- //# sourceMappingURL=file-utils.js.map
@@ -1 +0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AAC,CAAC","sourcesContent":["import type { App } from \"obsidian\";\nimport { TFile } from \"obsidian\";\n\n/**\n * Waits for a file to be accessible and readable by Obsidian's cache.\n * This is necessary because Templater creates files asynchronously.\n */\nexport async function waitForFileReady(\n\tapp: App,\n\tfilePath: string,\n\ttimeoutMs = 5000\n): Promise<TFile | null> {\n\tconst started = Date.now();\n\n\twhile (Date.now() - started < timeoutMs) {\n\t\tconst file = app.vault.getAbstractFileByPath(filePath);\n\t\tif (file instanceof TFile) {\n\t\t\t// Check if file is readable by trying to get its metadata\n\t\t\tconst metadata = app.metadataCache.getFileCache(file);\n\t\t\tif (metadata !== null && metadata !== undefined) {\n\t\t\t\treturn file;\n\t\t\t}\n\t\t}\n\t\tawait new Promise((r) => setTimeout(r, 50));\n\t}\n\n\treturn null;\n}\n\n/**\n * Gets a TFile by path or throws an error if not found.\n * Useful when you need to ensure a file exists before proceeding.\n */\nexport const getTFileOrThrow = (app: App, path: string): TFile => {\n\tconst f = app.vault.getAbstractFileByPath(path);\n\tif (!(f instanceof TFile)) throw new Error(`File not found: ${path}`);\n\treturn f;\n};\n\n/**\n * Executes an operation on a file's frontmatter.\n * Wrapper around Obsidian's processFrontMatter for more concise usage.\n */\nexport const withFrontmatter = async (\n\tapp: App,\n\tfile: TFile,\n\tupdate: (fm: Record<string, unknown>) => void\n) => app.fileManager.processFrontMatter(file, update);\n\n/**\n * Creates a backup copy of a file's frontmatter.\n * Useful for undo/redo operations or temporary modifications.\n */\nexport const backupFrontmatter = async (app: App, file: TFile) => {\n\tlet copy: Record<string, unknown> = {};\n\tawait withFrontmatter(app, file, (fm) => {\n\t\tcopy = { ...fm };\n\t});\n\treturn copy;\n};\n\n/**\n * Restores a file's frontmatter from a backup.\n * Clears existing frontmatter and replaces with the backup.\n */\nexport const restoreFrontmatter = async (\n\tapp: App,\n\tfile: TFile,\n\toriginal: Record<string, unknown>\n) =>\n\twithFrontmatter(app, file, (fm) => {\n\t\tfor (const k of Object.keys(fm)) {\n\t\t\tdelete fm[k];\n\t\t}\n\t\tObject.assign(fm, original);\n\t});\n\n/**\n * Extracts the content that appears after the frontmatter section.\n * Returns the entire content if no frontmatter is found.\n */\nexport const extractContentAfterFrontmatter = (fullContent: string): string => {\n\tconst frontmatterRegex = /^---\\s*\\n([\\s\\S]*?)\\n---\\s*\\n/;\n\tconst match = fullContent.match(frontmatterRegex);\n\n\tif (match) {\n\t\t// Return content after frontmatter\n\t\treturn fullContent.substring(match.index! + match[0].length);\n\t}\n\n\t// If no frontmatter found, return the entire content\n\treturn fullContent;\n};\n"]}
@@ -1,332 +0,0 @@
1
- import type { App, CachedMetadata } from "obsidian";
2
- import { TFile } from "obsidian";
3
- /**
4
- * Retrieves a TFile object from the vault by its path.
5
- * Handles path normalization using Obsidian's normalizePath utility.
6
- *
7
- * **Important**: Obsidian file paths ALWAYS include the `.md` extension.
8
- * The TFile.path property returns paths like "folder/file.md", not "folder/file".
9
- *
10
- * @param app - The Obsidian App instance
11
- * @param filePath - Path to the file (will be normalized, should include .md extension)
12
- * @returns TFile if found, null otherwise
13
- *
14
- * @example
15
- * ```ts
16
- * // Correct: Include .md extension
17
- * const file = getFileByPath(app, "folder/note.md");
18
- *
19
- * // For wikilinks without extension, add .md
20
- * const linkPath = "MyNote";
21
- * const file = getFileByPath(app, `${linkPath}.md`);
22
- * ```
23
- */
24
- export declare function getFileByPath(app: App, filePath: string): TFile | null;
25
- /**
26
- * Ensures a file path includes the .md extension.
27
- * Use this when working with wikilinks or user input that may omit extensions.
28
- *
29
- * @param path - File path that may or may not include .md extension
30
- * @returns Path guaranteed to end with .md
31
- *
32
- * @example
33
- * ```ts
34
- * ensureMarkdownExtension("MyNote") // "MyNote.md"
35
- * ensureMarkdownExtension("MyNote.md") // "MyNote.md"
36
- * ensureMarkdownExtension("folder/note") // "folder/note.md"
37
- * ```
38
- */
39
- export declare function ensureMarkdownExtension(path: string): string;
40
- /**
41
- * Removes the .md extension from a file path if present.
42
- * Useful for displaying file names or creating wikilinks.
43
- *
44
- * @param path - File path that may include .md extension
45
- * @returns Path without .md extension
46
- *
47
- * @example
48
- * ```ts
49
- * removeMarkdownExtension("folder/note.md") // "folder/note"
50
- * removeMarkdownExtension("folder/note") // "folder/note"
51
- * ```
52
- */
53
- export declare function removeMarkdownExtension(path: string): string;
54
- /**
55
- * Extracts the display name from a file path or wiki link.
56
- *
57
- * Handles various formats:
58
- * - `[[path/to/file|Alias]]` -> returns "Alias"
59
- * - `[[path/to/file]]` -> returns "file"
60
- * - `path/to/file.md` -> returns "file"
61
- * - `file.md` -> returns "file"
62
- *
63
- * @param input - File path or wiki link string
64
- * @returns The display name to show in the UI
65
- */
66
- export declare function extractDisplayName(input: string): string;
67
- /**
68
- * Extracts the actual file path from a wiki link or returns the path as-is.
69
- *
70
- * Handles:
71
- * - `[[path/to/file|Alias]]` -> returns "path/to/file.md"
72
- * - `[[path/to/file]]` -> returns "path/to/file.md"
73
- * - `path/to/file.md` -> returns "path/to/file.md"
74
- *
75
- * @param input - File path or wiki link string
76
- * @returns The actual file path (with .md extension)
77
- */
78
- export declare function extractFilePath(input: string): string;
79
- export interface FileContext {
80
- path: string;
81
- pathWithExt: string;
82
- baseName: string;
83
- file: TFile | null;
84
- frontmatter: Record<string, any> | undefined;
85
- cache: CachedMetadata | null;
86
- }
87
- /**
88
- * Creates a comprehensive file context object containing all relevant file information.
89
- * Handles path normalization, file lookup, and metadata caching.
90
- */
91
- export declare function getFileContext(app: App, path: string): FileContext;
92
- /**
93
- * Helper function to work with file context that automatically handles file not found cases.
94
- * Returns null if the file doesn't exist, otherwise executes the callback with the context.
95
- */
96
- export declare function withFileContext<T>(app: App, path: string, callback: (context: FileContext) => Promise<T> | T): Promise<T | null>;
97
- /**
98
- * Generates a unique file path by appending a counter if the file already exists.
99
- * Automatically adds .md extension if not present.
100
- *
101
- * @param app - The Obsidian App instance
102
- * @param folder - Folder path (empty string for root, no trailing slash needed)
103
- * @param baseName - Base file name without extension
104
- * @returns Unique file path that doesn't exist in the vault
105
- *
106
- * @example
107
- * ```ts
108
- * // If "MyNote.md" exists, returns "MyNote 1.md"
109
- * const path = getUniqueFilePath(app, "", "MyNote");
110
- *
111
- * // With folder: "Projects/Task.md" -> "Projects/Task 1.md"
112
- * const path = getUniqueFilePath(app, "Projects", "Task");
113
- *
114
- * // Root folder handling
115
- * const path = getUniqueFilePath(app, "/", "Note"); // -> "Note.md"
116
- * ```
117
- */
118
- export declare function getUniqueFilePath(app: App, folder: string, baseName: string): string;
119
- /**
120
- * Generates a unique file path by appending a counter if the file already exists.
121
- * Accepts a complete file path and iterates with a counter suffix.
122
- *
123
- * @param app - The Obsidian App instance
124
- * @param filePath - Complete file path including folder, name, and extension
125
- * @returns Unique file path that doesn't exist in the vault
126
- *
127
- * @example
128
- * ```ts
129
- * // If "folder/note.md" exists, returns "folder/note 1.md"
130
- * const path = getUniqueFilePathFromFull(app, "folder/note.md");
131
- *
132
- * // Works with any extension
133
- * const path = getUniqueFilePathFromFull(app, "assets/image.png");
134
- * // -> "assets/image 1.png" if image.png exists
135
- * ```
136
- */
137
- export declare const getUniqueFilePathFromFull: (app: App, filePath: string) => string;
138
- /**
139
- * Generates a unique file path by appending a counter if the file already exists.
140
- * Supports custom file extensions.
141
- *
142
- * @param app - The Obsidian App instance
143
- * @param folder - Folder path (empty string for root)
144
- * @param baseName - Base file name without extension
145
- * @param extension - File extension (defaults to "md")
146
- * @returns Unique file path that doesn't exist in the vault
147
- */
148
- export declare const generateUniqueFilePath: (app: App, folder: string, baseName: string, extension?: string) => string;
149
- /**
150
- * Checks if a file is a folder note.
151
- * A folder note is a file whose name matches its parent folder name.
152
- *
153
- * @param filePath - Path to the file (e.g., "tasks/tasks.md")
154
- * @returns true if the file is a folder note, false otherwise
155
- *
156
- * @example
157
- * ```ts
158
- * isFolderNote("tasks/tasks.md") // true
159
- * isFolderNote("tasks/subtask.md") // false
160
- * isFolderNote("note.md") // false (no parent folder)
161
- * isFolderNote("projects/docs/docs.md") // true
162
- * ```
163
- */
164
- export declare function isFolderNote(filePath: string): boolean;
165
- /**
166
- * Gets the folder path for a file.
167
- *
168
- * @param filePath - Path to the file (e.g., "tasks/subtask.md")
169
- * @returns Folder path without trailing slash, or empty string if file is in root
170
- *
171
- * @example
172
- * ```ts
173
- * getFolderPath("tasks/subtask.md") // "tasks"
174
- * getFolderPath("projects/docs/notes.md") // "projects/docs"
175
- * getFolderPath("note.md") // ""
176
- * ```
177
- */
178
- export declare function getFolderPath(filePath: string): string;
179
- /**
180
- * Gets all markdown files in a specific folder (non-recursive).
181
- *
182
- * @param app - The Obsidian App instance
183
- * @param folderPath - Path to the folder (e.g., "tasks")
184
- * @returns Array of TFile objects in the folder
185
- *
186
- * @example
187
- * ```ts
188
- * const files = getFilesInFolder(app, "tasks");
189
- * // Returns [task1.md, task2.md, tasks.md] but not tasks/subtasks/file.md
190
- * ```
191
- */
192
- export declare function getFilesInFolder(app: App, folderPath: string): TFile[];
193
- /**
194
- * Gets all markdown files in a folder and its subfolders recursively.
195
- *
196
- * @param app - The Obsidian App instance
197
- * @param folderPath - Path to the folder (e.g., "tasks")
198
- * @returns Array of TFile objects in the folder tree
199
- *
200
- * @example
201
- * ```ts
202
- * const files = getAllFilesInFolderTree(app, "tasks");
203
- * // Returns all .md files in tasks/ and all its subdirectories
204
- * ```
205
- */
206
- export declare function getAllFilesInFolderTree(app: App, folderPath: string): TFile[];
207
- /**
208
- * Gets the parent file path based on folder structure.
209
- * For a file in a folder, the parent is the folder note if it exists.
210
- *
211
- * @param app - The Obsidian App instance
212
- * @param filePath - Path to the file
213
- * @returns Path to parent file, or null if no parent exists
214
- *
215
- * @example
216
- * ```ts
217
- * // If tasks/tasks.md exists
218
- * getParentByFolder(app, "tasks/subtask.md") // "tasks/tasks.md"
219
- *
220
- * // If parent folder note doesn't exist
221
- * getParentByFolder(app, "tasks/subtask.md") // null
222
- *
223
- * // Root level file
224
- * getParentByFolder(app, "note.md") // null
225
- * ```
226
- */
227
- export declare function getParentByFolder(app: App, filePath: string): string | null;
228
- /**
229
- * Gets all child file paths based on folder structure.
230
- * Works for both folder notes and regular files.
231
- *
232
- * For folder notes (e.g., "tasks/tasks.md"):
233
- * - Returns all files directly in the folder (excluding the folder note)
234
- * - Includes subfolder notes one level down
235
- *
236
- * For regular files (e.g., "tasks/task1.md"):
237
- * - Returns the folder note from matching subfolder if it exists (e.g., "tasks/task1/task1.md")
238
- *
239
- * @param app - The Obsidian App instance
240
- * @param filePath - Path to the file
241
- * @returns Array of child file paths
242
- *
243
- * @example
244
- * ```ts
245
- * // For tasks/tasks.md (folder note)
246
- * getChildrenByFolder(app, "tasks/tasks.md")
247
- * // Returns ["tasks/task1.md", "tasks/task2.md", "tasks/subtasks/subtasks.md"]
248
- *
249
- * // For tasks/task1.md (regular file with matching subfolder)
250
- * getChildrenByFolder(app, "tasks/task1.md")
251
- * // Returns ["tasks/task1/task1.md"] if it exists
252
- * ```
253
- */
254
- export declare function getChildrenByFolder(app: App, filePath: string): string[];
255
- /**
256
- * Finds all root nodes in a folder tree.
257
- * Root nodes are files at the top level of the folder (directly in the folder, not in subfolders).
258
- *
259
- * @param app - The Obsidian App instance
260
- * @param folderPath - Path to the folder
261
- * @returns Array of root file paths
262
- *
263
- * @example
264
- * ```ts
265
- * // For folder structure:
266
- * // tasks/
267
- * // tasks.md (folder note)
268
- * // task1.md
269
- * // subtasks/
270
- * // subtasks.md
271
- * // subtask1.md
272
- *
273
- * findRootNodesInFolder(app, "tasks")
274
- * // Returns ["tasks/tasks.md", "tasks/task1.md"]
275
- * // Excludes subtasks/subtasks.md and subtasks/subtask1.md (they're in subfolder)
276
- * ```
277
- */
278
- export declare function findRootNodesInFolder(app: App, folderPath: string): string[];
279
- export interface SanitizeFilenameOptions {
280
- /**
281
- * Style of sanitization to apply.
282
- * - "kebab": Convert to lowercase, replace spaces with hyphens (default, backwards compatible)
283
- * - "preserve": Preserve spaces and case, only remove invalid characters
284
- */
285
- style?: "kebab" | "preserve";
286
- }
287
- /**
288
- * Sanitizes a string for use as a filename.
289
- * Defaults to kebab-case style for backwards compatibility.
290
- *
291
- * @param input - String to sanitize
292
- * @param options - Sanitization options
293
- * @returns Sanitized filename string
294
- *
295
- * @example
296
- * // Default kebab-case style (backwards compatible)
297
- * sanitizeForFilename("My File Name") // "my-file-name"
298
- *
299
- * // Preserve spaces and case
300
- * sanitizeForFilename("My File Name", { style: "preserve" }) // "My File Name"
301
- */
302
- export declare const sanitizeForFilename: (input: string, options?: SanitizeFilenameOptions) => string;
303
- /**
304
- * Sanitizes filename using kebab-case style.
305
- * - Removes invalid characters
306
- * - Converts to lowercase
307
- * - Replaces spaces with hyphens
308
- *
309
- * Best for: CLI tools, URLs, slugs, technical files
310
- *
311
- * @example
312
- * sanitizeFilenameKebabCase("My File Name") // "my-file-name"
313
- * sanitizeFilenameKebabCase("Travel Around The World") // "travel-around-the-world"
314
- */
315
- export declare const sanitizeFilenameKebabCase: (input: string) => string;
316
- /**
317
- * Sanitizes filename while preserving spaces and case.
318
- * - Removes invalid characters only
319
- * - Preserves spaces and original casing
320
- * - Removes trailing dots (Windows compatibility)
321
- *
322
- * Best for: Note titles, human-readable filenames, Obsidian notes
323
- *
324
- * @example
325
- * sanitizeFilenamePreserveSpaces("My File Name") // "My File Name"
326
- * sanitizeFilenamePreserveSpaces("Travel Around The World") // "Travel Around The World"
327
- * sanitizeFilenamePreserveSpaces("File<Invalid>Chars") // "FileInvalidChars"
328
- */
329
- export declare const sanitizeFilenamePreserveSpaces: (input: string) => string;
330
- export declare const getFilenameFromPath: (filePath: string) => string;
331
- export declare const isFileInConfiguredDirectory: (filePath: string, directory: string) => boolean;
332
- //# sourceMappingURL=file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/file/file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAiB,KAAK,EAAE,MAAM,UAAU,CAAC;AAM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