obsidian-mcp-server 2.0.6 → 3.0.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 (253) hide show
  1. package/CLAUDE.md +364 -0
  2. package/Dockerfile +99 -0
  3. package/LICENSE +4 -6
  4. package/README.md +246 -206
  5. package/changelog/3.0.x/3.0.0.md +102 -0
  6. package/changelog/template.md +51 -0
  7. package/dist/config/server-config.d.ts +19 -0
  8. package/dist/config/server-config.d.ts.map +1 -0
  9. package/dist/config/server-config.js +55 -0
  10. package/dist/config/server-config.js.map +1 -0
  11. package/dist/index.d.ts +7 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +23 -295
  14. package/dist/index.js.map +1 -0
  15. package/dist/mcp-server/prompts/definitions/index.d.ts +8 -0
  16. package/dist/mcp-server/prompts/definitions/index.d.ts.map +1 -0
  17. package/dist/mcp-server/prompts/definitions/index.js +8 -0
  18. package/dist/mcp-server/prompts/definitions/index.js.map +1 -0
  19. package/dist/mcp-server/resources/definitions/index.d.ts +36 -0
  20. package/dist/mcp-server/resources/definitions/index.d.ts.map +1 -0
  21. package/dist/mcp-server/resources/definitions/index.js +9 -0
  22. package/dist/mcp-server/resources/definitions/index.js.map +1 -0
  23. package/dist/mcp-server/resources/definitions/obsidian-status.resource.d.ts +23 -0
  24. package/dist/mcp-server/resources/definitions/obsidian-status.resource.d.ts.map +1 -0
  25. package/dist/mcp-server/resources/definitions/obsidian-status.resource.js +47 -0
  26. package/dist/mcp-server/resources/definitions/obsidian-status.resource.js.map +1 -0
  27. package/dist/mcp-server/resources/definitions/obsidian-tags.resource.d.ts +13 -0
  28. package/dist/mcp-server/resources/definitions/obsidian-tags.resource.d.ts.map +1 -0
  29. package/dist/mcp-server/resources/definitions/obsidian-tags.resource.js +30 -0
  30. package/dist/mcp-server/resources/definitions/obsidian-tags.resource.js.map +1 -0
  31. package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.d.ts +21 -0
  32. package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.d.ts.map +1 -0
  33. package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.js +38 -0
  34. package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.js.map +1 -0
  35. package/dist/mcp-server/tools/definitions/_shared/schemas.d.ts +45 -0
  36. package/dist/mcp-server/tools/definitions/_shared/schemas.d.ts.map +1 -0
  37. package/dist/mcp-server/tools/definitions/_shared/schemas.js +66 -0
  38. package/dist/mcp-server/tools/definitions/_shared/schemas.js.map +1 -0
  39. package/dist/mcp-server/tools/definitions/_shared/suggest-paths.d.ts +51 -0
  40. package/dist/mcp-server/tools/definitions/_shared/suggest-paths.d.ts.map +1 -0
  41. package/dist/mcp-server/tools/definitions/_shared/suggest-paths.js +120 -0
  42. package/dist/mcp-server/tools/definitions/_shared/suggest-paths.js.map +1 -0
  43. package/dist/mcp-server/tools/definitions/index.d.ts +531 -0
  44. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
  45. package/dist/mcp-server/tools/definitions/index.js +38 -0
  46. package/dist/mcp-server/tools/definitions/index.js.map +1 -0
  47. package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.d.ts +42 -0
  48. package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.d.ts.map +1 -0
  49. package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.js +58 -0
  50. package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.js.map +1 -0
  51. package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.d.ts +46 -0
  52. package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.d.ts.map +1 -0
  53. package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.js +66 -0
  54. package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.js.map +1 -0
  55. package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.d.ts +19 -0
  56. package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.d.ts.map +1 -0
  57. package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.js +43 -0
  58. package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.js.map +1 -0
  59. package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.d.ts +92 -0
  60. package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.d.ts.map +1 -0
  61. package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.js +245 -0
  62. package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.js.map +1 -0
  63. package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.d.ts +13 -0
  64. package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.d.ts.map +1 -0
  65. package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.js +38 -0
  66. package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.js.map +1 -0
  67. package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.d.ts +59 -0
  68. package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.d.ts.map +1 -0
  69. package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.js +273 -0
  70. package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.js.map +1 -0
  71. package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.d.ts +13 -0
  72. package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.d.ts.map +1 -0
  73. package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.js +38 -0
  74. package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.js.map +1 -0
  75. package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.d.ts +68 -0
  76. package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.d.ts.map +1 -0
  77. package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.js +178 -0
  78. package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.js.map +1 -0
  79. package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.d.ts +77 -0
  80. package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.d.ts.map +1 -0
  81. package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.js +172 -0
  82. package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.js.map +1 -0
  83. package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.d.ts +22 -0
  84. package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.d.ts.map +1 -0
  85. package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.js +88 -0
  86. package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.js.map +1 -0
  87. package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.d.ts +81 -0
  88. package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.d.ts.map +1 -0
  89. package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.js +83 -0
  90. package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.js.map +1 -0
  91. package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.d.ts +59 -0
  92. package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.d.ts.map +1 -0
  93. package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.js +167 -0
  94. package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.js.map +1 -0
  95. package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.d.ts +76 -0
  96. package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.d.ts.map +1 -0
  97. package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.js +244 -0
  98. package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.js.map +1 -0
  99. package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.d.ts +41 -0
  100. package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.d.ts.map +1 -0
  101. package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.js +76 -0
  102. package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.js.map +1 -0
  103. package/dist/services/obsidian/frontmatter-ops.d.ts +34 -0
  104. package/dist/services/obsidian/frontmatter-ops.d.ts.map +1 -0
  105. package/dist/services/obsidian/frontmatter-ops.js +230 -0
  106. package/dist/services/obsidian/frontmatter-ops.js.map +1 -0
  107. package/dist/services/obsidian/obsidian-service.d.ts +73 -0
  108. package/dist/services/obsidian/obsidian-service.d.ts.map +1 -0
  109. package/dist/services/obsidian/obsidian-service.js +399 -0
  110. package/dist/services/obsidian/obsidian-service.js.map +1 -0
  111. package/dist/services/obsidian/section-extractor.d.ts +13 -0
  112. package/dist/services/obsidian/section-extractor.d.ts.map +1 -0
  113. package/dist/services/obsidian/section-extractor.js +124 -0
  114. package/dist/services/obsidian/section-extractor.js.map +1 -0
  115. package/dist/services/obsidian/types.d.ts +91 -0
  116. package/dist/services/obsidian/types.d.ts.map +1 -0
  117. package/dist/services/obsidian/types.js +7 -0
  118. package/dist/services/obsidian/types.js.map +1 -0
  119. package/package.json +63 -69
  120. package/server.json +167 -0
  121. package/CHANGELOG.md +0 -118
  122. package/dist/config/index.d.ts +0 -41
  123. package/dist/config/index.js +0 -191
  124. package/dist/mcp-server/server.d.ts +0 -33
  125. package/dist/mcp-server/server.js +0 -211
  126. package/dist/mcp-server/tools/obsidianDeleteNoteTool/index.d.ts +0 -12
  127. package/dist/mcp-server/tools/obsidianDeleteNoteTool/index.js +0 -12
  128. package/dist/mcp-server/tools/obsidianDeleteNoteTool/logic.d.ts +0 -51
  129. package/dist/mcp-server/tools/obsidianDeleteNoteTool/logic.js +0 -168
  130. package/dist/mcp-server/tools/obsidianDeleteNoteTool/registration.d.ts +0 -19
  131. package/dist/mcp-server/tools/obsidianDeleteNoteTool/registration.js +0 -91
  132. package/dist/mcp-server/tools/obsidianGlobalSearchTool/index.d.ts +0 -12
  133. package/dist/mcp-server/tools/obsidianGlobalSearchTool/index.js +0 -12
  134. package/dist/mcp-server/tools/obsidianGlobalSearchTool/logic.d.ts +0 -77
  135. package/dist/mcp-server/tools/obsidianGlobalSearchTool/logic.js +0 -341
  136. package/dist/mcp-server/tools/obsidianGlobalSearchTool/registration.d.ts +0 -18
  137. package/dist/mcp-server/tools/obsidianGlobalSearchTool/registration.js +0 -69
  138. package/dist/mcp-server/tools/obsidianListNotesTool/index.d.ts +0 -12
  139. package/dist/mcp-server/tools/obsidianListNotesTool/index.js +0 -12
  140. package/dist/mcp-server/tools/obsidianListNotesTool/logic.d.ts +0 -68
  141. package/dist/mcp-server/tools/obsidianListNotesTool/logic.js +0 -215
  142. package/dist/mcp-server/tools/obsidianListNotesTool/registration.d.ts +0 -23
  143. package/dist/mcp-server/tools/obsidianListNotesTool/registration.js +0 -98
  144. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/index.d.ts +0 -3
  145. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/index.js +0 -2
  146. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/logic.d.ts +0 -42
  147. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/logic.js +0 -152
  148. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/registration.d.ts +0 -3
  149. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/registration.js +0 -52
  150. package/dist/mcp-server/tools/obsidianManageTagsTool/index.d.ts +0 -3
  151. package/dist/mcp-server/tools/obsidianManageTagsTool/index.js +0 -2
  152. package/dist/mcp-server/tools/obsidianManageTagsTool/logic.d.ts +0 -28
  153. package/dist/mcp-server/tools/obsidianManageTagsTool/logic.js +0 -161
  154. package/dist/mcp-server/tools/obsidianManageTagsTool/registration.d.ts +0 -3
  155. package/dist/mcp-server/tools/obsidianManageTagsTool/registration.js +0 -52
  156. package/dist/mcp-server/tools/obsidianReadNoteTool/index.d.ts +0 -12
  157. package/dist/mcp-server/tools/obsidianReadNoteTool/index.js +0 -12
  158. package/dist/mcp-server/tools/obsidianReadNoteTool/logic.d.ts +0 -87
  159. package/dist/mcp-server/tools/obsidianReadNoteTool/logic.js +0 -216
  160. package/dist/mcp-server/tools/obsidianReadNoteTool/registration.d.ts +0 -20
  161. package/dist/mcp-server/tools/obsidianReadNoteTool/registration.js +0 -101
  162. package/dist/mcp-server/tools/obsidianSearchReplaceTool/index.d.ts +0 -12
  163. package/dist/mcp-server/tools/obsidianSearchReplaceTool/index.js +0 -12
  164. package/dist/mcp-server/tools/obsidianSearchReplaceTool/logic.d.ts +0 -255
  165. package/dist/mcp-server/tools/obsidianSearchReplaceTool/logic.js +0 -583
  166. package/dist/mcp-server/tools/obsidianSearchReplaceTool/registration.d.ts +0 -22
  167. package/dist/mcp-server/tools/obsidianSearchReplaceTool/registration.js +0 -111
  168. package/dist/mcp-server/tools/obsidianUpdateNoteTool/index.d.ts +0 -12
  169. package/dist/mcp-server/tools/obsidianUpdateNoteTool/index.js +0 -12
  170. package/dist/mcp-server/tools/obsidianUpdateNoteTool/logic.d.ts +0 -183
  171. package/dist/mcp-server/tools/obsidianUpdateNoteTool/logic.js +0 -490
  172. package/dist/mcp-server/tools/obsidianUpdateNoteTool/registration.d.ts +0 -21
  173. package/dist/mcp-server/tools/obsidianUpdateNoteTool/registration.js +0 -108
  174. package/dist/mcp-server/transports/auth/core/authContext.d.ts +0 -33
  175. package/dist/mcp-server/transports/auth/core/authContext.js +0 -24
  176. package/dist/mcp-server/transports/auth/core/authTypes.d.ts +0 -17
  177. package/dist/mcp-server/transports/auth/core/authTypes.js +0 -5
  178. package/dist/mcp-server/transports/auth/core/authUtils.d.ts +0 -18
  179. package/dist/mcp-server/transports/auth/core/authUtils.js +0 -45
  180. package/dist/mcp-server/transports/auth/index.d.ts +0 -10
  181. package/dist/mcp-server/transports/auth/index.js +0 -9
  182. package/dist/mcp-server/transports/auth/strategies/jwt/jwtMiddleware.d.ts +0 -27
  183. package/dist/mcp-server/transports/auth/strategies/jwt/jwtMiddleware.js +0 -149
  184. package/dist/mcp-server/transports/auth/strategies/oauth/oauthMiddleware.d.ts +0 -20
  185. package/dist/mcp-server/transports/auth/strategies/oauth/oauthMiddleware.js +0 -124
  186. package/dist/mcp-server/transports/httpErrorHandler.d.ts +0 -26
  187. package/dist/mcp-server/transports/httpErrorHandler.js +0 -73
  188. package/dist/mcp-server/transports/httpTransport.d.ts +0 -21
  189. package/dist/mcp-server/transports/httpTransport.js +0 -208
  190. package/dist/mcp-server/transports/stdioTransport.d.ts +0 -42
  191. package/dist/mcp-server/transports/stdioTransport.js +0 -63
  192. package/dist/services/obsidianRestAPI/index.d.ts +0 -15
  193. package/dist/services/obsidianRestAPI/index.js +0 -17
  194. package/dist/services/obsidianRestAPI/methods/activeFileMethods.d.ts +0 -38
  195. package/dist/services/obsidianRestAPI/methods/activeFileMethods.js +0 -62
  196. package/dist/services/obsidianRestAPI/methods/commandMethods.d.ts +0 -22
  197. package/dist/services/obsidianRestAPI/methods/commandMethods.js +0 -31
  198. package/dist/services/obsidianRestAPI/methods/openMethods.d.ts +0 -16
  199. package/dist/services/obsidianRestAPI/methods/openMethods.js +0 -21
  200. package/dist/services/obsidianRestAPI/methods/patchMethods.d.ts +0 -37
  201. package/dist/services/obsidianRestAPI/methods/patchMethods.js +0 -94
  202. package/dist/services/obsidianRestAPI/methods/periodicNoteMethods.d.ts +0 -42
  203. package/dist/services/obsidianRestAPI/methods/periodicNoteMethods.js +0 -66
  204. package/dist/services/obsidianRestAPI/methods/searchMethods.d.ts +0 -25
  205. package/dist/services/obsidianRestAPI/methods/searchMethods.js +0 -36
  206. package/dist/services/obsidianRestAPI/methods/vaultMethods.d.ts +0 -58
  207. package/dist/services/obsidianRestAPI/methods/vaultMethods.js +0 -144
  208. package/dist/services/obsidianRestAPI/service.d.ts +0 -195
  209. package/dist/services/obsidianRestAPI/service.js +0 -379
  210. package/dist/services/obsidianRestAPI/types.d.ts +0 -127
  211. package/dist/services/obsidianRestAPI/types.js +0 -7
  212. package/dist/services/obsidianRestAPI/vaultCache/index.d.ts +0 -4
  213. package/dist/services/obsidianRestAPI/vaultCache/index.js +0 -4
  214. package/dist/services/obsidianRestAPI/vaultCache/service.d.ts +0 -88
  215. package/dist/services/obsidianRestAPI/vaultCache/service.js +0 -299
  216. package/dist/types-global/errors.d.ts +0 -73
  217. package/dist/types-global/errors.js +0 -71
  218. package/dist/utils/index.d.ts +0 -5
  219. package/dist/utils/index.js +0 -13
  220. package/dist/utils/internal/asyncUtils.d.ts +0 -54
  221. package/dist/utils/internal/asyncUtils.js +0 -101
  222. package/dist/utils/internal/errorHandler.d.ts +0 -176
  223. package/dist/utils/internal/errorHandler.js +0 -351
  224. package/dist/utils/internal/index.d.ts +0 -4
  225. package/dist/utils/internal/index.js +0 -4
  226. package/dist/utils/internal/logger.d.ts +0 -141
  227. package/dist/utils/internal/logger.js +0 -406
  228. package/dist/utils/internal/requestContext.d.ts +0 -83
  229. package/dist/utils/internal/requestContext.js +0 -72
  230. package/dist/utils/metrics/index.d.ts +0 -1
  231. package/dist/utils/metrics/index.js +0 -1
  232. package/dist/utils/metrics/tokenCounter.d.ts +0 -27
  233. package/dist/utils/metrics/tokenCounter.js +0 -128
  234. package/dist/utils/obsidian/index.d.ts +0 -5
  235. package/dist/utils/obsidian/index.js +0 -5
  236. package/dist/utils/obsidian/obsidianApiUtils.d.ts +0 -14
  237. package/dist/utils/obsidian/obsidianApiUtils.js +0 -29
  238. package/dist/utils/obsidian/obsidianStatUtils.d.ts +0 -68
  239. package/dist/utils/obsidian/obsidianStatUtils.js +0 -143
  240. package/dist/utils/parsing/dateParser.d.ts +0 -56
  241. package/dist/utils/parsing/dateParser.js +0 -104
  242. package/dist/utils/parsing/index.d.ts +0 -2
  243. package/dist/utils/parsing/index.js +0 -3
  244. package/dist/utils/parsing/jsonParser.d.ts +0 -80
  245. package/dist/utils/parsing/jsonParser.js +0 -133
  246. package/dist/utils/security/idGenerator.d.ts +0 -140
  247. package/dist/utils/security/idGenerator.js +0 -194
  248. package/dist/utils/security/index.d.ts +0 -3
  249. package/dist/utils/security/index.js +0 -3
  250. package/dist/utils/security/rateLimiter.d.ts +0 -156
  251. package/dist/utils/security/rateLimiter.js +0 -235
  252. package/dist/utils/security/sanitization.d.ts +0 -244
  253. package/dist/utils/security/sanitization.js +0 -599
@@ -1,94 +0,0 @@
1
- /**
2
- * @module PatchMethods
3
- * @description
4
- * Methods for performing granular PATCH operations within notes via the Obsidian REST API.
5
- */
6
- import { encodeVaultPath } from "../../../utils/obsidian/obsidianApiUtils.js";
7
- /**
8
- * Helper to construct headers for PATCH requests.
9
- */
10
- function buildPatchHeaders(options) {
11
- const headers = {
12
- Operation: options.operation,
13
- "Target-Type": options.targetType,
14
- // Spec requires URL encoding for non-ASCII characters in Target header
15
- Target: encodeURIComponent(options.target),
16
- };
17
- if (options.targetDelimiter) {
18
- headers["Target-Delimiter"] = options.targetDelimiter;
19
- }
20
- if (options.trimTargetWhitespace !== undefined) {
21
- headers["Trim-Target-Whitespace"] = String(options.trimTargetWhitespace);
22
- }
23
- // Add Create-Target-If-Missing header if provided in options
24
- if (options.createTargetIfMissing !== undefined) {
25
- headers["Create-Target-If-Missing"] = String(options.createTargetIfMissing);
26
- }
27
- if (options.contentType) {
28
- headers["Content-Type"] = options.contentType;
29
- }
30
- else {
31
- // Default to markdown if not specified, especially for non-JSON content
32
- headers["Content-Type"] = "text/markdown";
33
- }
34
- return headers;
35
- }
36
- /**
37
- * Patches a specific file in the vault.
38
- * @param _request - The internal request function from the service instance.
39
- * @param filePath - Vault-relative path to the file.
40
- * @param content - The content to insert/replace (string or JSON for tables/frontmatter).
41
- * @param options - Patch operation details (operation, targetType, target, etc.).
42
- * @param context - Request context.
43
- * @returns {Promise<void>} Resolves on success (200 OK).
44
- */
45
- export async function patchFile(_request, filePath, content, // Allow object for JSON content type
46
- options, context) {
47
- const headers = buildPatchHeaders(options);
48
- const requestData = typeof content === "object" ? JSON.stringify(content) : content;
49
- const encodedPath = encodeVaultPath(filePath);
50
- // PATCH returns 200 OK according to spec
51
- await _request({
52
- method: "PATCH",
53
- url: `/vault${encodedPath}`, // Use the encoded path
54
- headers: headers,
55
- data: requestData,
56
- }, context, "patchFile");
57
- }
58
- /**
59
- * Patches the currently active file in Obsidian.
60
- * @param _request - The internal request function from the service instance.
61
- * @param content - The content to insert/replace.
62
- * @param options - Patch operation details.
63
- * @param context - Request context.
64
- * @returns {Promise<void>} Resolves on success (200 OK).
65
- */
66
- export async function patchActiveFile(_request, content, options, context) {
67
- const headers = buildPatchHeaders(options);
68
- const requestData = typeof content === "object" ? JSON.stringify(content) : content;
69
- await _request({
70
- method: "PATCH",
71
- url: `/active/`,
72
- headers: headers,
73
- data: requestData,
74
- }, context, "patchActiveFile");
75
- }
76
- /**
77
- * Patches a periodic note.
78
- * @param _request - The internal request function from the service instance.
79
- * @param period - The period type ('daily', 'weekly', etc.).
80
- * @param content - The content to insert/replace.
81
- * @param options - Patch operation details.
82
- * @param context - Request context.
83
- * @returns {Promise<void>} Resolves on success (200 OK).
84
- */
85
- export async function patchPeriodicNote(_request, period, content, options, context) {
86
- const headers = buildPatchHeaders(options);
87
- const requestData = typeof content === "object" ? JSON.stringify(content) : content;
88
- await _request({
89
- method: "PATCH",
90
- url: `/periodic/${period}/`,
91
- headers: headers,
92
- data: requestData,
93
- }, context, "patchPeriodicNote");
94
- }
@@ -1,42 +0,0 @@
1
- /**
2
- * @module PeriodicNoteMethods
3
- * @description
4
- * Methods for interacting with periodic notes (daily, weekly, etc.) via the Obsidian REST API.
5
- */
6
- import { RequestContext } from "../../../utils/index.js";
7
- import { NoteJson, Period, RequestFunction } from "../types.js";
8
- /**
9
- * Gets the content of a periodic note (daily, weekly, etc.).
10
- * @param _request - The internal request function from the service instance.
11
- * @param period - The period type ('daily', 'weekly', 'monthly', 'quarterly', 'yearly').
12
- * @param format - 'markdown' or 'json'.
13
- * @param context - Request context.
14
- * @returns The note content or NoteJson.
15
- */
16
- export declare function getPeriodicNote(_request: RequestFunction, period: Period, format: "markdown" | "json" | undefined, context: RequestContext): Promise<string | NoteJson>;
17
- /**
18
- * Updates (overwrites) the content of a periodic note. Creates if needed.
19
- * @param _request - The internal request function from the service instance.
20
- * @param period - The period type.
21
- * @param content - The new content.
22
- * @param context - Request context.
23
- * @returns {Promise<void>} Resolves on success (204 No Content).
24
- */
25
- export declare function updatePeriodicNote(_request: RequestFunction, period: Period, content: string, context: RequestContext): Promise<void>;
26
- /**
27
- * Appends content to a periodic note. Creates if needed.
28
- * @param _request - The internal request function from the service instance.
29
- * @param period - The period type.
30
- * @param content - The content to append.
31
- * @param context - Request context.
32
- * @returns {Promise<void>} Resolves on success (204 No Content).
33
- */
34
- export declare function appendPeriodicNote(_request: RequestFunction, period: Period, content: string, context: RequestContext): Promise<void>;
35
- /**
36
- * Deletes a periodic note.
37
- * @param _request - The internal request function from the service instance.
38
- * @param period - The period type.
39
- * @param context - Request context.
40
- * @returns {Promise<void>} Resolves on success (204 No Content).
41
- */
42
- export declare function deletePeriodicNote(_request: RequestFunction, period: Period, context: RequestContext): Promise<void>;
@@ -1,66 +0,0 @@
1
- /**
2
- * @module PeriodicNoteMethods
3
- * @description
4
- * Methods for interacting with periodic notes (daily, weekly, etc.) via the Obsidian REST API.
5
- */
6
- /**
7
- * Gets the content of a periodic note (daily, weekly, etc.).
8
- * @param _request - The internal request function from the service instance.
9
- * @param period - The period type ('daily', 'weekly', 'monthly', 'quarterly', 'yearly').
10
- * @param format - 'markdown' or 'json'.
11
- * @param context - Request context.
12
- * @returns The note content or NoteJson.
13
- */
14
- export async function getPeriodicNote(_request, period, format = "markdown", context) {
15
- const acceptHeader = format === "json" ? "application/vnd.olrapi.note+json" : "text/markdown";
16
- return _request({
17
- method: "GET",
18
- url: `/periodic/${period}/`,
19
- headers: { Accept: acceptHeader },
20
- }, context, "getPeriodicNote");
21
- }
22
- /**
23
- * Updates (overwrites) the content of a periodic note. Creates if needed.
24
- * @param _request - The internal request function from the service instance.
25
- * @param period - The period type.
26
- * @param content - The new content.
27
- * @param context - Request context.
28
- * @returns {Promise<void>} Resolves on success (204 No Content).
29
- */
30
- export async function updatePeriodicNote(_request, period, content, context) {
31
- await _request({
32
- method: "PUT",
33
- url: `/periodic/${period}/`,
34
- headers: { "Content-Type": "text/markdown" },
35
- data: content,
36
- }, context, "updatePeriodicNote");
37
- }
38
- /**
39
- * Appends content to a periodic note. Creates if needed.
40
- * @param _request - The internal request function from the service instance.
41
- * @param period - The period type.
42
- * @param content - The content to append.
43
- * @param context - Request context.
44
- * @returns {Promise<void>} Resolves on success (204 No Content).
45
- */
46
- export async function appendPeriodicNote(_request, period, content, context) {
47
- await _request({
48
- method: "POST",
49
- url: `/periodic/${period}/`,
50
- headers: { "Content-Type": "text/markdown" },
51
- data: content,
52
- }, context, "appendPeriodicNote");
53
- }
54
- /**
55
- * Deletes a periodic note.
56
- * @param _request - The internal request function from the service instance.
57
- * @param period - The period type.
58
- * @param context - Request context.
59
- * @returns {Promise<void>} Resolves on success (204 No Content).
60
- */
61
- export async function deletePeriodicNote(_request, period, context) {
62
- await _request({
63
- method: "DELETE",
64
- url: `/periodic/${period}/`,
65
- }, context, "deletePeriodicNote");
66
- }
@@ -1,25 +0,0 @@
1
- /**
2
- * @module SearchMethods
3
- * @description
4
- * Methods for performing searches via the Obsidian REST API.
5
- */
6
- import { RequestContext } from "../../../utils/index.js";
7
- import { SimpleSearchResult, ComplexSearchResult, RequestFunction } from "../types.js";
8
- /**
9
- * Performs a simple text search across the vault.
10
- * @param _request - The internal request function from the service instance.
11
- * @param query - The text query string.
12
- * @param contextLength - Number of characters surrounding each match (default 100).
13
- * @param context - Request context.
14
- * @returns An array of search results.
15
- */
16
- export declare function searchSimple(_request: RequestFunction, query: string, contextLength: number | undefined, context: RequestContext): Promise<SimpleSearchResult[]>;
17
- /**
18
- * Performs a complex search using Dataview DQL or JsonLogic.
19
- * @param _request - The internal request function from the service instance.
20
- * @param query - The query string (DQL) or JSON object (JsonLogic).
21
- * @param contentType - The content type header indicating the query format.
22
- * @param context - Request context.
23
- * @returns An array of search results.
24
- */
25
- export declare function searchComplex(_request: RequestFunction, query: string | object, contentType: "application/vnd.olrapi.dataview.dql+txt" | "application/vnd.olrapi.jsonlogic+json", context: RequestContext): Promise<ComplexSearchResult[]>;
@@ -1,36 +0,0 @@
1
- /**
2
- * @module SearchMethods
3
- * @description
4
- * Methods for performing searches via the Obsidian REST API.
5
- */
6
- /**
7
- * Performs a simple text search across the vault.
8
- * @param _request - The internal request function from the service instance.
9
- * @param query - The text query string.
10
- * @param contextLength - Number of characters surrounding each match (default 100).
11
- * @param context - Request context.
12
- * @returns An array of search results.
13
- */
14
- export async function searchSimple(_request, query, contextLength = 100, context) {
15
- return _request({
16
- method: "POST",
17
- url: "/search/simple/",
18
- params: { query, contextLength }, // Send as query parameters
19
- }, context, "searchSimple");
20
- }
21
- /**
22
- * Performs a complex search using Dataview DQL or JsonLogic.
23
- * @param _request - The internal request function from the service instance.
24
- * @param query - The query string (DQL) or JSON object (JsonLogic).
25
- * @param contentType - The content type header indicating the query format.
26
- * @param context - Request context.
27
- * @returns An array of search results.
28
- */
29
- export async function searchComplex(_request, query, contentType, context) {
30
- return _request({
31
- method: "POST",
32
- url: "/search/",
33
- headers: { "Content-Type": contentType },
34
- data: query,
35
- }, context, "searchComplex");
36
- }
@@ -1,58 +0,0 @@
1
- /**
2
- * @module VaultMethods
3
- * @description
4
- * Methods for interacting with vault files and directories via the Obsidian REST API.
5
- */
6
- import { RequestContext } from "../../../utils/index.js";
7
- import { NoteJson, NoteStat, RequestFunction } from "../types.js";
8
- /**
9
- * Gets the content of a specific file in the vault.
10
- * @param _request - The internal request function from the service instance.
11
- * @param filePath - Vault-relative path to the file.
12
- * @param format - 'markdown' or 'json' (for NoteJson).
13
- * @param context - Request context.
14
- * @returns The file content (string) or NoteJson object.
15
- */
16
- export declare function getFileContent(_request: RequestFunction, filePath: string, format: "markdown" | "json" | undefined, context: RequestContext): Promise<string | NoteJson>;
17
- /**
18
- * Updates (overwrites) the content of a file or creates it if it doesn't exist.
19
- * @param _request - The internal request function from the service instance.
20
- * @param filePath - Vault-relative path to the file.
21
- * @param content - The new content for the file.
22
- * @param context - Request context.
23
- * @returns {Promise<void>} Resolves on success (204 No Content).
24
- */
25
- export declare function updateFileContent(_request: RequestFunction, filePath: string, content: string, context: RequestContext): Promise<void>;
26
- /**
27
- * Appends content to the end of a file. Creates the file if it doesn't exist.
28
- * @param _request - The internal request function from the service instance.
29
- * @param filePath - Vault-relative path to the file.
30
- * @param content - The content to append.
31
- * @param context - Request context.
32
- * @returns {Promise<void>} Resolves on success (204 No Content).
33
- */
34
- export declare function appendFileContent(_request: RequestFunction, filePath: string, content: string, context: RequestContext): Promise<void>;
35
- /**
36
- * Deletes a specific file in the vault.
37
- * @param _request - The internal request function from the service instance.
38
- * @param filePath - Vault-relative path to the file.
39
- * @param context - Request context.
40
- * @returns {Promise<void>} Resolves on success (204 No Content).
41
- */
42
- export declare function deleteFile(_request: RequestFunction, filePath: string, context: RequestContext): Promise<void>;
43
- /**
44
- * Lists files within a specified directory in the vault.
45
- * @param _request - The internal request function from the service instance.
46
- * @param dirPath - Vault-relative path to the directory. Use empty string "" or "/" for the root.
47
- * @param context - Request context.
48
- * @returns A list of file and directory names.
49
- */
50
- export declare function listFiles(_request: RequestFunction, dirPath: string, context: RequestContext): Promise<string[]>;
51
- /**
52
- * Gets the metadata (stat) of a specific file using a lightweight HEAD request.
53
- * @param _request - The internal request function from the service instance.
54
- * @param filePath - Vault-relative path to the file.
55
- * @param context - Request context.
56
- * @returns The file's metadata.
57
- */
58
- export declare function getFileMetadata(_request: RequestFunction, filePath: string, context: RequestContext): Promise<NoteStat | null>;
@@ -1,144 +0,0 @@
1
- /**
2
- * @module VaultMethods
3
- * @description
4
- * Methods for interacting with vault files and directories via the Obsidian REST API.
5
- */
6
- import { encodeVaultPath } from "../../../utils/obsidian/obsidianApiUtils.js";
7
- /**
8
- * Gets the content of a specific file in the vault.
9
- * @param _request - The internal request function from the service instance.
10
- * @param filePath - Vault-relative path to the file.
11
- * @param format - 'markdown' or 'json' (for NoteJson).
12
- * @param context - Request context.
13
- * @returns The file content (string) or NoteJson object.
14
- */
15
- export async function getFileContent(_request, filePath, format = "markdown", context) {
16
- const acceptHeader = format === "json" ? "application/vnd.olrapi.note+json" : "text/markdown";
17
- const encodedPath = encodeVaultPath(filePath); // Use the new encoding function
18
- return _request({
19
- method: "GET",
20
- url: `/vault${encodedPath}`,
21
- headers: { Accept: acceptHeader },
22
- }, context, "getFileContent");
23
- }
24
- /**
25
- * Updates (overwrites) the content of a file or creates it if it doesn't exist.
26
- * @param _request - The internal request function from the service instance.
27
- * @param filePath - Vault-relative path to the file.
28
- * @param content - The new content for the file.
29
- * @param context - Request context.
30
- * @returns {Promise<void>} Resolves on success (204 No Content).
31
- */
32
- export async function updateFileContent(_request, filePath, content, context) {
33
- const encodedPath = encodeVaultPath(filePath); // Use the new encoding function
34
- // PUT returns 204 No Content, so the expected type is void
35
- await _request({
36
- method: "PUT",
37
- url: `/vault${encodedPath}`, // Construct URL correctly
38
- headers: { "Content-Type": "text/markdown" },
39
- data: content,
40
- }, context, "updateFileContent");
41
- }
42
- /**
43
- * Appends content to the end of a file. Creates the file if it doesn't exist.
44
- * @param _request - The internal request function from the service instance.
45
- * @param filePath - Vault-relative path to the file.
46
- * @param content - The content to append.
47
- * @param context - Request context.
48
- * @returns {Promise<void>} Resolves on success (204 No Content).
49
- */
50
- export async function appendFileContent(_request, filePath, content, context) {
51
- const encodedPath = encodeVaultPath(filePath); // Use the new encoding function
52
- await _request({
53
- method: "POST",
54
- url: `/vault${encodedPath}`, // Construct URL correctly
55
- headers: { "Content-Type": "text/markdown" },
56
- data: content,
57
- }, context, "appendFileContent");
58
- }
59
- /**
60
- * Deletes a specific file in the vault.
61
- * @param _request - The internal request function from the service instance.
62
- * @param filePath - Vault-relative path to the file.
63
- * @param context - Request context.
64
- * @returns {Promise<void>} Resolves on success (204 No Content).
65
- */
66
- export async function deleteFile(_request, filePath, context) {
67
- const encodedPath = encodeVaultPath(filePath); // Use the new encoding function
68
- await _request({
69
- method: "DELETE",
70
- url: `/vault${encodedPath}`, // Construct URL correctly
71
- }, context, "deleteFile");
72
- }
73
- /**
74
- * Lists files within a specified directory in the vault.
75
- * @param _request - The internal request function from the service instance.
76
- * @param dirPath - Vault-relative path to the directory. Use empty string "" or "/" for the root.
77
- * @param context - Request context.
78
- * @returns A list of file and directory names.
79
- */
80
- export async function listFiles(_request, dirPath, context) {
81
- // Normalize path: remove leading/trailing slashes for consistency, except for root
82
- let pathSegment = dirPath.trim();
83
- // Explicitly handle root path variations ('', '/') by setting pathSegment to empty.
84
- // This ensures that the final URL constructed later will be '/vault/', which the API
85
- // uses to list the root directory contents.
86
- if (pathSegment === "" || pathSegment === "/") {
87
- pathSegment = ""; // Use empty string to signify root for URL construction
88
- }
89
- else {
90
- // For non-root paths:
91
- // 1. Remove any leading/trailing slashes to prevent issues like '/vault//path/' or '/vault/path//'.
92
- // 2. URI-encode *each component* of the remaining path segment to handle special characters safely.
93
- pathSegment = pathSegment
94
- .replace(/^\/+|\/+$/g, "")
95
- .split("/")
96
- .map(encodeURIComponent)
97
- .join("/");
98
- }
99
- // Construct the final URL for the API request:
100
- // - If pathSegment is not empty (i.e., it's a specific directory), format as '/vault/{encoded_path}/'.
101
- // - If pathSegment IS empty (signifying the root), format as '/vault/'.
102
- // The trailing slash is important for directory listing endpoints in this API.
103
- const url = pathSegment ? `/vault/${pathSegment}/` : "/vault/";
104
- const response = await _request({
105
- method: "GET",
106
- url: url, // Use the correctly constructed URL
107
- }, context, "listFiles");
108
- return response.files;
109
- }
110
- /**
111
- * Gets the metadata (stat) of a specific file using a lightweight HEAD request.
112
- * @param _request - The internal request function from the service instance.
113
- * @param filePath - Vault-relative path to the file.
114
- * @param context - Request context.
115
- * @returns The file's metadata.
116
- */
117
- export async function getFileMetadata(_request, filePath, context) {
118
- const encodedPath = encodeVaultPath(filePath);
119
- try {
120
- const response = await _request({
121
- method: "HEAD",
122
- url: `/vault${encodedPath}`,
123
- }, context, "getFileMetadata");
124
- if (response && response.headers) {
125
- const headers = response.headers;
126
- return {
127
- mtime: headers["x-obsidian-mtime"]
128
- ? parseFloat(headers["x-obsidian-mtime"]) * 1000
129
- : 0,
130
- ctime: headers["x-obsidian-ctime"]
131
- ? parseFloat(headers["x-obsidian-ctime"]) * 1000
132
- : 0,
133
- size: headers["content-length"]
134
- ? parseInt(headers["content-length"], 10)
135
- : 0,
136
- };
137
- }
138
- return null;
139
- }
140
- catch (error) {
141
- // Errors are already logged by the _request function, so we can just return null
142
- return null;
143
- }
144
- }
@@ -1,195 +0,0 @@
1
- /**
2
- * @module ObsidianRestApiService
3
- * @description
4
- * This module provides the core implementation for the Obsidian REST API service.
5
- * It encapsulates the logic for making authenticated requests to the API endpoints.
6
- */
7
- import { RequestContext } from "../../utils/index.js";
8
- import { ApiStatusResponse, // Import PatchOptions type
9
- ComplexSearchResult, NoteJson, NoteStat, ObsidianCommand, PatchOptions, Period, SimpleSearchResult } from "./types.js";
10
- export declare class ObsidianRestApiService {
11
- private axiosInstance;
12
- private apiKey;
13
- constructor();
14
- /**
15
- * Private helper to make requests and handle common errors.
16
- * @param config - Axios request configuration.
17
- * @param context - Request context for logging.
18
- * @param operationName - Name of the operation for logging context.
19
- * @returns The response data.
20
- * @throws {McpError} If the request fails.
21
- */
22
- private _request;
23
- /**
24
- * Checks the status and authentication of the Obsidian Local REST API.
25
- * @param context - The request context for logging and correlation.
26
- * @returns {Promise<ApiStatusResponse>} - The status object from the API.
27
- */
28
- checkStatus(context: RequestContext): Promise<ApiStatusResponse>;
29
- /**
30
- * Gets the content of a specific file in the vault.
31
- * @param filePath - Vault-relative path to the file.
32
- * @param format - 'markdown' or 'json' (for NoteJson).
33
- * @param context - Request context.
34
- * @returns The file content (string) or NoteJson object.
35
- */
36
- getFileContent(filePath: string, format: "markdown" | "json" | undefined, context: RequestContext): Promise<string | NoteJson>;
37
- /**
38
- * Updates (overwrites) the content of a file or creates it if it doesn't exist.
39
- * @param filePath - Vault-relative path to the file.
40
- * @param content - The new content for the file.
41
- * @param context - Request context.
42
- * @returns {Promise<void>} Resolves on success (204 No Content).
43
- */
44
- updateFileContent(filePath: string, content: string, context: RequestContext): Promise<void>;
45
- /**
46
- * Appends content to the end of a file. Creates the file if it doesn't exist.
47
- * @param filePath - Vault-relative path to the file.
48
- * @param content - The content to append.
49
- * @param context - Request context.
50
- * @returns {Promise<void>} Resolves on success (204 No Content).
51
- */
52
- appendFileContent(filePath: string, content: string, context: RequestContext): Promise<void>;
53
- /**
54
- * Deletes a specific file in the vault.
55
- * @param filePath - Vault-relative path to the file.
56
- * @param context - Request context.
57
- * @returns {Promise<void>} Resolves on success (204 No Content).
58
- */
59
- deleteFile(filePath: string, context: RequestContext): Promise<void>;
60
- /**
61
- * Lists files within a specified directory in the vault.
62
- * @param dirPath - Vault-relative path to the directory. Use empty string "" or "/" for the root.
63
- * @param context - Request context.
64
- * @returns A list of file and directory names.
65
- */
66
- listFiles(dirPath: string, context: RequestContext): Promise<string[]>;
67
- /**
68
- * Gets the metadata (stat) of a specific file using a lightweight HEAD request.
69
- * @param filePath - Vault-relative path to the file.
70
- * @param context - Request context.
71
- * @returns The file's metadata.
72
- */
73
- getFileMetadata(filePath: string, context: RequestContext): Promise<NoteStat | null>;
74
- /**
75
- * Performs a simple text search across the vault.
76
- * @param query - The text query string.
77
- * @param contextLength - Number of characters surrounding each match (default 100).
78
- * @param context - Request context.
79
- * @returns An array of search results.
80
- */
81
- searchSimple(query: string, contextLength: number | undefined, context: RequestContext): Promise<SimpleSearchResult[]>;
82
- /**
83
- * Performs a complex search using Dataview DQL or JsonLogic.
84
- * @param query - The query string (DQL) or JSON object (JsonLogic).
85
- * @param contentType - The content type header indicating the query format.
86
- * @param context - Request context.
87
- * @returns An array of search results.
88
- */
89
- searchComplex(query: string | object, contentType: "application/vnd.olrapi.dataview.dql+txt" | "application/vnd.olrapi.jsonlogic+json", context: RequestContext): Promise<ComplexSearchResult[]>;
90
- /**
91
- * Executes a registered Obsidian command by its ID.
92
- * @param commandId - The ID of the command (e.g., "app:go-back").
93
- * @param context - Request context.
94
- * @returns {Promise<void>} Resolves on success (204 No Content).
95
- */
96
- executeCommand(commandId: string, context: RequestContext): Promise<void>;
97
- /**
98
- * Lists all available Obsidian commands.
99
- * @param context - Request context.
100
- * @returns A list of available commands.
101
- */
102
- listCommands(context: RequestContext): Promise<ObsidianCommand[]>;
103
- /**
104
- * Opens a specific file in Obsidian. Creates the file if it doesn't exist.
105
- * @param filePath - Vault-relative path to the file.
106
- * @param newLeaf - Whether to open the file in a new editor tab (leaf).
107
- * @param context - Request context.
108
- * @returns {Promise<void>} Resolves on success (200 OK, but no body expected).
109
- */
110
- openFile(filePath: string, newLeaf: boolean | undefined, context: RequestContext): Promise<void>;
111
- /**
112
- * Gets the content of the currently active file in Obsidian.
113
- * @param format - 'markdown' or 'json' (for NoteJson).
114
- * @param context - Request context.
115
- * @returns The file content (string) or NoteJson object.
116
- */
117
- getActiveFile(format: "markdown" | "json" | undefined, context: RequestContext): Promise<string | NoteJson>;
118
- /**
119
- * Updates (overwrites) the content of the currently active file.
120
- * @param content - The new content.
121
- * @param context - Request context.
122
- * @returns {Promise<void>} Resolves on success (204 No Content).
123
- */
124
- updateActiveFile(content: string, context: RequestContext): Promise<void>;
125
- /**
126
- * Appends content to the end of the currently active file.
127
- * @param content - The content to append.
128
- * @param context - Request context.
129
- * @returns {Promise<void>} Resolves on success (204 No Content).
130
- */
131
- appendActiveFile(content: string, context: RequestContext): Promise<void>;
132
- /**
133
- * Deletes the currently active file.
134
- * @param context - Request context.
135
- * @returns {Promise<void>} Resolves on success (204 No Content).
136
- */
137
- deleteActiveFile(context: RequestContext): Promise<void>;
138
- /**
139
- * Gets the content of a periodic note (daily, weekly, etc.).
140
- * @param period - The period type ('daily', 'weekly', 'monthly', 'quarterly', 'yearly').
141
- * @param format - 'markdown' or 'json'.
142
- * @param context - Request context.
143
- * @returns The note content or NoteJson.
144
- */
145
- getPeriodicNote(period: Period, format: "markdown" | "json" | undefined, context: RequestContext): Promise<string | NoteJson>;
146
- /**
147
- * Updates (overwrites) the content of a periodic note. Creates if needed.
148
- * @param period - The period type.
149
- * @param content - The new content.
150
- * @param context - Request context.
151
- * @returns {Promise<void>} Resolves on success (204 No Content).
152
- */
153
- updatePeriodicNote(period: Period, content: string, context: RequestContext): Promise<void>;
154
- /**
155
- * Appends content to a periodic note. Creates if needed.
156
- * @param period - The period type.
157
- * @param content - The content to append.
158
- * @param context - Request context.
159
- * @returns {Promise<void>} Resolves on success (204 No Content).
160
- */
161
- appendPeriodicNote(period: Period, content: string, context: RequestContext): Promise<void>;
162
- /**
163
- * Deletes a periodic note.
164
- * @param period - The period type.
165
- * @param context - Request context.
166
- * @returns {Promise<void>} Resolves on success (204 No Content).
167
- */
168
- deletePeriodicNote(period: Period, context: RequestContext): Promise<void>;
169
- /**
170
- * Patches a specific file in the vault using granular controls.
171
- * @param filePath - Vault-relative path to the file.
172
- * @param content - The content to insert/replace (string or JSON for tables/frontmatter).
173
- * @param options - Patch operation details (operation, targetType, target, etc.).
174
- * @param context - Request context.
175
- * @returns {Promise<void>} Resolves on success (200 OK).
176
- */
177
- patchFile(filePath: string, content: string | object, options: PatchOptions, context: RequestContext): Promise<void>;
178
- /**
179
- * Patches the currently active file in Obsidian using granular controls.
180
- * @param content - The content to insert/replace.
181
- * @param options - Patch operation details.
182
- * @param context - Request context.
183
- * @returns {Promise<void>} Resolves on success (200 OK).
184
- */
185
- patchActiveFile(content: string | object, options: PatchOptions, context: RequestContext): Promise<void>;
186
- /**
187
- * Patches a periodic note using granular controls.
188
- * @param period - The period type ('daily', 'weekly', etc.).
189
- * @param content - The content to insert/replace.
190
- * @param options - Patch operation details.
191
- * @param context - Request context.
192
- * @returns {Promise<void>} Resolves on success (200 OK).
193
- */
194
- patchPeriodicNote(period: Period, content: string | object, options: PatchOptions, context: RequestContext): Promise<void>;
195
- }