@joyjit/vikunja-mcp 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (424) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1377 -0
  4. package/dist/auth/AuthManager.d.ts +63 -0
  5. package/dist/auth/AuthManager.d.ts.map +1 -0
  6. package/dist/auth/AuthManager.js +137 -0
  7. package/dist/auth/AuthManager.js.map +1 -0
  8. package/dist/auth/index.d.ts +7 -0
  9. package/dist/auth/index.d.ts.map +1 -0
  10. package/dist/auth/index.js +14 -0
  11. package/dist/auth/index.js.map +1 -0
  12. package/dist/auth/permissions.d.ts +60 -0
  13. package/dist/auth/permissions.d.ts.map +1 -0
  14. package/dist/auth/permissions.js +173 -0
  15. package/dist/auth/permissions.js.map +1 -0
  16. package/dist/client/VikunjaClientFactory.d.ts +32 -0
  17. package/dist/client/VikunjaClientFactory.d.ts.map +1 -0
  18. package/dist/client/VikunjaClientFactory.js +66 -0
  19. package/dist/client/VikunjaClientFactory.js.map +1 -0
  20. package/dist/client.d.ts +57 -0
  21. package/dist/client.d.ts.map +1 -0
  22. package/dist/client.js +128 -0
  23. package/dist/client.js.map +1 -0
  24. package/dist/config/ConfigurationManager.d.ts +63 -0
  25. package/dist/config/ConfigurationManager.d.ts.map +1 -0
  26. package/dist/config/ConfigurationManager.js +243 -0
  27. package/dist/config/ConfigurationManager.js.map +1 -0
  28. package/dist/config/index.d.ts +8 -0
  29. package/dist/config/index.d.ts.map +1 -0
  30. package/dist/config/index.js +27 -0
  31. package/dist/config/index.js.map +1 -0
  32. package/dist/config/types.d.ts +434 -0
  33. package/dist/config/types.d.ts.map +1 -0
  34. package/dist/config/types.js +93 -0
  35. package/dist/config/types.js.map +1 -0
  36. package/dist/formatters/BatchImportResponseFormatter.d.ts +89 -0
  37. package/dist/formatters/BatchImportResponseFormatter.d.ts.map +1 -0
  38. package/dist/formatters/BatchImportResponseFormatter.js +125 -0
  39. package/dist/formatters/BatchImportResponseFormatter.js.map +1 -0
  40. package/dist/index.d.ts +20 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +119 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/middleware/direct-middleware.d.ts +9 -0
  45. package/dist/middleware/direct-middleware.d.ts.map +1 -0
  46. package/dist/middleware/direct-middleware.js +49 -0
  47. package/dist/middleware/direct-middleware.js.map +1 -0
  48. package/dist/middleware/index.d.ts +8 -0
  49. package/dist/middleware/index.d.ts.map +1 -0
  50. package/dist/middleware/index.js +21 -0
  51. package/dist/middleware/index.js.map +1 -0
  52. package/dist/middleware/simplified-rate-limit.d.ts +147 -0
  53. package/dist/middleware/simplified-rate-limit.d.ts.map +1 -0
  54. package/dist/middleware/simplified-rate-limit.js +542 -0
  55. package/dist/middleware/simplified-rate-limit.js.map +1 -0
  56. package/dist/parsers/CSVParser.d.ts +36 -0
  57. package/dist/parsers/CSVParser.d.ts.map +1 -0
  58. package/dist/parsers/CSVParser.js +69 -0
  59. package/dist/parsers/CSVParser.js.map +1 -0
  60. package/dist/parsers/InputParserFactory.d.ts +17 -0
  61. package/dist/parsers/InputParserFactory.d.ts.map +1 -0
  62. package/dist/parsers/InputParserFactory.js +137 -0
  63. package/dist/parsers/InputParserFactory.js.map +1 -0
  64. package/dist/parsers/JSONParser.d.ts +74 -0
  65. package/dist/parsers/JSONParser.d.ts.map +1 -0
  66. package/dist/parsers/JSONParser.js +69 -0
  67. package/dist/parsers/JSONParser.js.map +1 -0
  68. package/dist/services/EntityResolver.d.ts +75 -0
  69. package/dist/services/EntityResolver.d.ts.map +1 -0
  70. package/dist/services/EntityResolver.js +176 -0
  71. package/dist/services/EntityResolver.js.map +1 -0
  72. package/dist/services/TaskCreationService.d.ts +96 -0
  73. package/dist/services/TaskCreationService.d.ts.map +1 -0
  74. package/dist/services/TaskCreationService.js +361 -0
  75. package/dist/services/TaskCreationService.js.map +1 -0
  76. package/dist/storage/SimpleFilterStorage.d.ts +110 -0
  77. package/dist/storage/SimpleFilterStorage.d.ts.map +1 -0
  78. package/dist/storage/SimpleFilterStorage.js +358 -0
  79. package/dist/storage/SimpleFilterStorage.js.map +1 -0
  80. package/dist/storage/index.d.ts +59 -0
  81. package/dist/storage/index.d.ts.map +1 -0
  82. package/dist/storage/index.js +117 -0
  83. package/dist/storage/index.js.map +1 -0
  84. package/dist/tools/auth.d.ts +9 -0
  85. package/dist/tools/auth.d.ts.map +1 -0
  86. package/dist/tools/auth.js +80 -0
  87. package/dist/tools/auth.js.map +1 -0
  88. package/dist/tools/batch-import.d.ts +5 -0
  89. package/dist/tools/batch-import.d.ts.map +1 -0
  90. package/dist/tools/batch-import.js +150 -0
  91. package/dist/tools/batch-import.js.map +1 -0
  92. package/dist/tools/export.d.ts +14 -0
  93. package/dist/tools/export.d.ts.map +1 -0
  94. package/dist/tools/export.js +232 -0
  95. package/dist/tools/export.js.map +1 -0
  96. package/dist/tools/filters.d.ts +8 -0
  97. package/dist/tools/filters.d.ts.map +1 -0
  98. package/dist/tools/filters.js +419 -0
  99. package/dist/tools/filters.js.map +1 -0
  100. package/dist/tools/index.d.ts +36 -0
  101. package/dist/tools/index.d.ts.map +1 -0
  102. package/dist/tools/index.js +87 -0
  103. package/dist/tools/index.js.map +1 -0
  104. package/dist/tools/labels.d.ts +9 -0
  105. package/dist/tools/labels.d.ts.map +1 -0
  106. package/dist/tools/labels.js +152 -0
  107. package/dist/tools/labels.js.map +1 -0
  108. package/dist/tools/projects/crud.d.ts +118 -0
  109. package/dist/tools/projects/crud.d.ts.map +1 -0
  110. package/dist/tools/projects/crud.js +389 -0
  111. package/dist/tools/projects/crud.js.map +1 -0
  112. package/dist/tools/projects/hierarchy.d.ts +68 -0
  113. package/dist/tools/projects/hierarchy.d.ts.map +1 -0
  114. package/dist/tools/projects/hierarchy.js +280 -0
  115. package/dist/tools/projects/hierarchy.js.map +1 -0
  116. package/dist/tools/projects/index.d.ts +17 -0
  117. package/dist/tools/projects/index.d.ts.map +1 -0
  118. package/dist/tools/projects/index.js +169 -0
  119. package/dist/tools/projects/index.js.map +1 -0
  120. package/dist/tools/projects/response-formatter.d.ts +46 -0
  121. package/dist/tools/projects/response-formatter.d.ts.map +1 -0
  122. package/dist/tools/projects/response-formatter.js +131 -0
  123. package/dist/tools/projects/response-formatter.js.map +1 -0
  124. package/dist/tools/projects/sharing.d.ts +89 -0
  125. package/dist/tools/projects/sharing.d.ts.map +1 -0
  126. package/dist/tools/projects/sharing.js +272 -0
  127. package/dist/tools/projects/sharing.js.map +1 -0
  128. package/dist/tools/projects/validation.d.ts +39 -0
  129. package/dist/tools/projects/validation.d.ts.map +1 -0
  130. package/dist/tools/projects/validation.js +129 -0
  131. package/dist/tools/projects/validation.js.map +1 -0
  132. package/dist/tools/projects.d.ts +10 -0
  133. package/dist/tools/projects.d.ts.map +1 -0
  134. package/dist/tools/projects.js +42 -0
  135. package/dist/tools/projects.js.map +1 -0
  136. package/dist/tools/task-assignees.d.ts +13 -0
  137. package/dist/tools/task-assignees.d.ts.map +1 -0
  138. package/dist/tools/task-assignees.js +62 -0
  139. package/dist/tools/task-assignees.js.map +1 -0
  140. package/dist/tools/task-bulk.d.ts +13 -0
  141. package/dist/tools/task-bulk.d.ts.map +1 -0
  142. package/dist/tools/task-bulk.js +113 -0
  143. package/dist/tools/task-bulk.js.map +1 -0
  144. package/dist/tools/task-comments.d.ts +13 -0
  145. package/dist/tools/task-comments.d.ts.map +1 -0
  146. package/dist/tools/task-comments.js +53 -0
  147. package/dist/tools/task-comments.js.map +1 -0
  148. package/dist/tools/task-crud.d.ts +13 -0
  149. package/dist/tools/task-crud.d.ts.map +1 -0
  150. package/dist/tools/task-crud.js +163 -0
  151. package/dist/tools/task-crud.js.map +1 -0
  152. package/dist/tools/task-labels.d.ts +13 -0
  153. package/dist/tools/task-labels.d.ts.map +1 -0
  154. package/dist/tools/task-labels.js +62 -0
  155. package/dist/tools/task-labels.js.map +1 -0
  156. package/dist/tools/task-relations.d.ts +13 -0
  157. package/dist/tools/task-relations.d.ts.map +1 -0
  158. package/dist/tools/task-relations.js +72 -0
  159. package/dist/tools/task-relations.js.map +1 -0
  160. package/dist/tools/task-reminders.d.ts +13 -0
  161. package/dist/tools/task-reminders.d.ts.map +1 -0
  162. package/dist/tools/task-reminders.js +63 -0
  163. package/dist/tools/task-reminders.js.map +1 -0
  164. package/dist/tools/tasks/assignees/AssigneeOperationsService.d.ts +31 -0
  165. package/dist/tools/tasks/assignees/AssigneeOperationsService.d.ts.map +1 -0
  166. package/dist/tools/tasks/assignees/AssigneeOperationsService.js +95 -0
  167. package/dist/tools/tasks/assignees/AssigneeOperationsService.js.map +1 -0
  168. package/dist/tools/tasks/assignees/AssigneeResponseFormatter.d.ts +32 -0
  169. package/dist/tools/tasks/assignees/AssigneeResponseFormatter.d.ts.map +1 -0
  170. package/dist/tools/tasks/assignees/AssigneeResponseFormatter.js +84 -0
  171. package/dist/tools/tasks/assignees/AssigneeResponseFormatter.js.map +1 -0
  172. package/dist/tools/tasks/assignees/AssigneeValidationService.d.ts +36 -0
  173. package/dist/tools/tasks/assignees/AssigneeValidationService.d.ts.map +1 -0
  174. package/dist/tools/tasks/assignees/AssigneeValidationService.js +63 -0
  175. package/dist/tools/tasks/assignees/AssigneeValidationService.js.map +1 -0
  176. package/dist/tools/tasks/assignees/index.d.ts +40 -0
  177. package/dist/tools/tasks/assignees/index.d.ts.map +1 -0
  178. package/dist/tools/tasks/assignees/index.js +72 -0
  179. package/dist/tools/tasks/assignees/index.js.map +1 -0
  180. package/dist/tools/tasks/bulk/BulkOperationValidator.d.ts +51 -0
  181. package/dist/tools/tasks/bulk/BulkOperationValidator.d.ts.map +1 -0
  182. package/dist/tools/tasks/bulk/BulkOperationValidator.js +149 -0
  183. package/dist/tools/tasks/bulk/BulkOperationValidator.js.map +1 -0
  184. package/dist/tools/tasks/bulk-operations-simplified.d.ts +39 -0
  185. package/dist/tools/tasks/bulk-operations-simplified.d.ts.map +1 -0
  186. package/dist/tools/tasks/bulk-operations-simplified.js +249 -0
  187. package/dist/tools/tasks/bulk-operations-simplified.js.map +1 -0
  188. package/dist/tools/tasks/bulk-operations.d.ts +8 -0
  189. package/dist/tools/tasks/bulk-operations.d.ts.map +1 -0
  190. package/dist/tools/tasks/bulk-operations.js +14 -0
  191. package/dist/tools/tasks/bulk-operations.js.map +1 -0
  192. package/dist/tools/tasks/comments/CommentOperationsService.d.ts +23 -0
  193. package/dist/tools/tasks/comments/CommentOperationsService.d.ts.map +1 -0
  194. package/dist/tools/tasks/comments/CommentOperationsService.js +37 -0
  195. package/dist/tools/tasks/comments/CommentOperationsService.js.map +1 -0
  196. package/dist/tools/tasks/comments/CommentResponseFormatter.d.ts +29 -0
  197. package/dist/tools/tasks/comments/CommentResponseFormatter.d.ts.map +1 -0
  198. package/dist/tools/tasks/comments/CommentResponseFormatter.js +69 -0
  199. package/dist/tools/tasks/comments/CommentResponseFormatter.js.map +1 -0
  200. package/dist/tools/tasks/comments/CommentValidationService.d.ts +33 -0
  201. package/dist/tools/tasks/comments/CommentValidationService.d.ts.map +1 -0
  202. package/dist/tools/tasks/comments/CommentValidationService.js +50 -0
  203. package/dist/tools/tasks/comments/CommentValidationService.js.map +1 -0
  204. package/dist/tools/tasks/comments/index.d.ts +38 -0
  205. package/dist/tools/tasks/comments/index.d.ts.map +1 -0
  206. package/dist/tools/tasks/comments/index.js +62 -0
  207. package/dist/tools/tasks/comments/index.js.map +1 -0
  208. package/dist/tools/tasks/constants.d.ts +17 -0
  209. package/dist/tools/tasks/constants.d.ts.map +1 -0
  210. package/dist/tools/tasks/constants.js +36 -0
  211. package/dist/tools/tasks/constants.js.map +1 -0
  212. package/dist/tools/tasks/crud/TaskCreationService.d.ts +26 -0
  213. package/dist/tools/tasks/crud/TaskCreationService.d.ts.map +1 -0
  214. package/dist/tools/tasks/crud/TaskCreationService.js +228 -0
  215. package/dist/tools/tasks/crud/TaskCreationService.js.map +1 -0
  216. package/dist/tools/tasks/crud/TaskDeletionService.d.ts +18 -0
  217. package/dist/tools/tasks/crud/TaskDeletionService.d.ts.map +1 -0
  218. package/dist/tools/tasks/crud/TaskDeletionService.js +89 -0
  219. package/dist/tools/tasks/crud/TaskDeletionService.js.map +1 -0
  220. package/dist/tools/tasks/crud/TaskReadService.d.ts +18 -0
  221. package/dist/tools/tasks/crud/TaskReadService.d.ts.map +1 -0
  222. package/dist/tools/tasks/crud/TaskReadService.js +58 -0
  223. package/dist/tools/tasks/crud/TaskReadService.js.map +1 -0
  224. package/dist/tools/tasks/crud/TaskResponseFormatter.d.ts +18 -0
  225. package/dist/tools/tasks/crud/TaskResponseFormatter.d.ts.map +1 -0
  226. package/dist/tools/tasks/crud/TaskResponseFormatter.js +244 -0
  227. package/dist/tools/tasks/crud/TaskResponseFormatter.js.map +1 -0
  228. package/dist/tools/tasks/crud/TaskUpdateService.d.ts +29 -0
  229. package/dist/tools/tasks/crud/TaskUpdateService.d.ts.map +1 -0
  230. package/dist/tools/tasks/crud/TaskUpdateService.js +231 -0
  231. package/dist/tools/tasks/crud/TaskUpdateService.js.map +1 -0
  232. package/dist/tools/tasks/crud/index.d.ts +16 -0
  233. package/dist/tools/tasks/crud/index.d.ts.map +1 -0
  234. package/dist/tools/tasks/crud/index.js +20 -0
  235. package/dist/tools/tasks/crud/index.js.map +1 -0
  236. package/dist/tools/tasks/filtering/FilterExecutor.d.ts +38 -0
  237. package/dist/tools/tasks/filtering/FilterExecutor.d.ts.map +1 -0
  238. package/dist/tools/tasks/filtering/FilterExecutor.js +200 -0
  239. package/dist/tools/tasks/filtering/FilterExecutor.js.map +1 -0
  240. package/dist/tools/tasks/filtering/FilterValidator.d.ts +56 -0
  241. package/dist/tools/tasks/filtering/FilterValidator.d.ts.map +1 -0
  242. package/dist/tools/tasks/filtering/FilterValidator.js +183 -0
  243. package/dist/tools/tasks/filtering/FilterValidator.js.map +1 -0
  244. package/dist/tools/tasks/filtering/TaskFilteringOrchestrator.d.ts +75 -0
  245. package/dist/tools/tasks/filtering/TaskFilteringOrchestrator.d.ts.map +1 -0
  246. package/dist/tools/tasks/filtering/TaskFilteringOrchestrator.js +193 -0
  247. package/dist/tools/tasks/filtering/TaskFilteringOrchestrator.js.map +1 -0
  248. package/dist/tools/tasks/filtering/evaluators.d.ts +38 -0
  249. package/dist/tools/tasks/filtering/evaluators.d.ts.map +1 -0
  250. package/dist/tools/tasks/filtering/evaluators.js +200 -0
  251. package/dist/tools/tasks/filtering/evaluators.js.map +1 -0
  252. package/dist/tools/tasks/filtering/index.d.ts +11 -0
  253. package/dist/tools/tasks/filtering/index.d.ts.map +1 -0
  254. package/dist/tools/tasks/filtering/index.js +26 -0
  255. package/dist/tools/tasks/filtering/index.js.map +1 -0
  256. package/dist/tools/tasks/index.d.ts +9 -0
  257. package/dist/tools/tasks/index.d.ts.map +1 -0
  258. package/dist/tools/tasks/index.js +245 -0
  259. package/dist/tools/tasks/index.js.map +1 -0
  260. package/dist/tools/tasks/labels.d.ts +39 -0
  261. package/dist/tools/tasks/labels.d.ts.map +1 -0
  262. package/dist/tools/tasks/labels.js +150 -0
  263. package/dist/tools/tasks/labels.js.map +1 -0
  264. package/dist/tools/tasks/reminders.d.ts +39 -0
  265. package/dist/tools/tasks/reminders.d.ts.map +1 -0
  266. package/dist/tools/tasks/reminders.js +147 -0
  267. package/dist/tools/tasks/reminders.js.map +1 -0
  268. package/dist/tools/tasks/types/filters.d.ts +121 -0
  269. package/dist/tools/tasks/types/filters.d.ts.map +1 -0
  270. package/dist/tools/tasks/types/filters.js +7 -0
  271. package/dist/tools/tasks/types/filters.js.map +1 -0
  272. package/dist/tools/tasks/validation.d.ts +44 -0
  273. package/dist/tools/tasks/validation.d.ts.map +1 -0
  274. package/dist/tools/tasks/validation.js +121 -0
  275. package/dist/tools/tasks/validation.js.map +1 -0
  276. package/dist/tools/tasks-relations.d.ts +24 -0
  277. package/dist/tools/tasks-relations.d.ts.map +1 -0
  278. package/dist/tools/tasks-relations.js +203 -0
  279. package/dist/tools/tasks-relations.js.map +1 -0
  280. package/dist/tools/tasks.d.ts +6 -0
  281. package/dist/tools/tasks.d.ts.map +1 -0
  282. package/dist/tools/tasks.js +10 -0
  283. package/dist/tools/tasks.js.map +1 -0
  284. package/dist/tools/teams.d.ts +9 -0
  285. package/dist/tools/teams.d.ts.map +1 -0
  286. package/dist/tools/teams.js +332 -0
  287. package/dist/tools/teams.js.map +1 -0
  288. package/dist/tools/templates.d.ts +9 -0
  289. package/dist/tools/templates.d.ts.map +1 -0
  290. package/dist/tools/templates.js +356 -0
  291. package/dist/tools/templates.js.map +1 -0
  292. package/dist/tools/users.d.ts +9 -0
  293. package/dist/tools/users.d.ts.map +1 -0
  294. package/dist/tools/users.js +239 -0
  295. package/dist/tools/users.js.map +1 -0
  296. package/dist/tools/webhooks.d.ts +11 -0
  297. package/dist/tools/webhooks.d.ts.map +1 -0
  298. package/dist/tools/webhooks.js +378 -0
  299. package/dist/tools/webhooks.js.map +1 -0
  300. package/dist/transforms/base.d.ts +178 -0
  301. package/dist/transforms/base.d.ts.map +1 -0
  302. package/dist/transforms/base.js +134 -0
  303. package/dist/transforms/base.js.map +1 -0
  304. package/dist/transforms/field-selector.d.ts +27 -0
  305. package/dist/transforms/field-selector.d.ts.map +1 -0
  306. package/dist/transforms/field-selector.js +91 -0
  307. package/dist/transforms/field-selector.js.map +1 -0
  308. package/dist/transforms/task.d.ts +207 -0
  309. package/dist/transforms/task.d.ts.map +1 -0
  310. package/dist/transforms/task.js +259 -0
  311. package/dist/transforms/task.js.map +1 -0
  312. package/dist/types/errors.d.ts +55 -0
  313. package/dist/types/errors.d.ts.map +1 -0
  314. package/dist/types/errors.js +44 -0
  315. package/dist/types/errors.js.map +1 -0
  316. package/dist/types/filters.d.ts +146 -0
  317. package/dist/types/filters.d.ts.map +1 -0
  318. package/dist/types/filters.js +22 -0
  319. package/dist/types/filters.js.map +1 -0
  320. package/dist/types/index.d.ts +151 -0
  321. package/dist/types/index.d.ts.map +1 -0
  322. package/dist/types/index.js +24 -0
  323. package/dist/types/index.js.map +1 -0
  324. package/dist/types/node-vikunja-extended.d.ts +36 -0
  325. package/dist/types/node-vikunja-extended.d.ts.map +1 -0
  326. package/dist/types/node-vikunja-extended.js +25 -0
  327. package/dist/types/node-vikunja-extended.js.map +1 -0
  328. package/dist/types/responses.d.ts +118 -0
  329. package/dist/types/responses.d.ts.map +1 -0
  330. package/dist/types/responses.js +26 -0
  331. package/dist/types/responses.js.map +1 -0
  332. package/dist/types/vikunja.d.ts +315 -0
  333. package/dist/types/vikunja.d.ts.map +1 -0
  334. package/dist/types/vikunja.js +7 -0
  335. package/dist/types/vikunja.js.map +1 -0
  336. package/dist/utils/auth-error-handler.d.ts +23 -0
  337. package/dist/utils/auth-error-handler.d.ts.map +1 -0
  338. package/dist/utils/auth-error-handler.js +162 -0
  339. package/dist/utils/auth-error-handler.js.map +1 -0
  340. package/dist/utils/error-handler.d.ts +38 -0
  341. package/dist/utils/error-handler.d.ts.map +1 -0
  342. package/dist/utils/error-handler.js +288 -0
  343. package/dist/utils/error-handler.js.map +1 -0
  344. package/dist/utils/filtering/ClientSideFilteringStrategy.d.ts +13 -0
  345. package/dist/utils/filtering/ClientSideFilteringStrategy.d.ts.map +1 -0
  346. package/dist/utils/filtering/ClientSideFilteringStrategy.js +63 -0
  347. package/dist/utils/filtering/ClientSideFilteringStrategy.js.map +1 -0
  348. package/dist/utils/filtering/FilteringContext.d.ts +27 -0
  349. package/dist/utils/filtering/FilteringContext.d.ts.map +1 -0
  350. package/dist/utils/filtering/FilteringContext.js +43 -0
  351. package/dist/utils/filtering/FilteringContext.js.map +1 -0
  352. package/dist/utils/filtering/HybridFilteringStrategy.d.ts +15 -0
  353. package/dist/utils/filtering/HybridFilteringStrategy.d.ts.map +1 -0
  354. package/dist/utils/filtering/HybridFilteringStrategy.js +55 -0
  355. package/dist/utils/filtering/HybridFilteringStrategy.js.map +1 -0
  356. package/dist/utils/filtering/ServerSideFilteringStrategy.d.ts +13 -0
  357. package/dist/utils/filtering/ServerSideFilteringStrategy.d.ts.map +1 -0
  358. package/dist/utils/filtering/ServerSideFilteringStrategy.js +64 -0
  359. package/dist/utils/filtering/ServerSideFilteringStrategy.js.map +1 -0
  360. package/dist/utils/filtering/TaskFilteringStrategy.d.ts +19 -0
  361. package/dist/utils/filtering/TaskFilteringStrategy.d.ts.map +1 -0
  362. package/dist/utils/filtering/TaskFilteringStrategy.js +10 -0
  363. package/dist/utils/filtering/TaskFilteringStrategy.js.map +1 -0
  364. package/dist/utils/filtering/index.d.ts +13 -0
  365. package/dist/utils/filtering/index.d.ts.map +1 -0
  366. package/dist/utils/filtering/index.js +20 -0
  367. package/dist/utils/filtering/index.js.map +1 -0
  368. package/dist/utils/filtering/types.d.ts +62 -0
  369. package/dist/utils/filtering/types.d.ts.map +1 -0
  370. package/dist/utils/filtering/types.js +6 -0
  371. package/dist/utils/filtering/types.js.map +1 -0
  372. package/dist/utils/filters.d.ts +97 -0
  373. package/dist/utils/filters.d.ts.map +1 -0
  374. package/dist/utils/filters.js +939 -0
  375. package/dist/utils/filters.js.map +1 -0
  376. package/dist/utils/logger.d.ts +26 -0
  377. package/dist/utils/logger.d.ts.map +1 -0
  378. package/dist/utils/logger.js +83 -0
  379. package/dist/utils/logger.js.map +1 -0
  380. package/dist/utils/memory.d.ts +71 -0
  381. package/dist/utils/memory.d.ts.map +1 -0
  382. package/dist/utils/memory.js +194 -0
  383. package/dist/utils/memory.js.map +1 -0
  384. package/dist/utils/performance/batch-processor.d.ts +77 -0
  385. package/dist/utils/performance/batch-processor.d.ts.map +1 -0
  386. package/dist/utils/performance/batch-processor.js +218 -0
  387. package/dist/utils/performance/batch-processor.js.map +1 -0
  388. package/dist/utils/performance/index.d.ts +42 -0
  389. package/dist/utils/performance/index.d.ts.map +1 -0
  390. package/dist/utils/performance/index.js +49 -0
  391. package/dist/utils/performance/index.js.map +1 -0
  392. package/dist/utils/performance/performance-monitor.d.ts +116 -0
  393. package/dist/utils/performance/performance-monitor.d.ts.map +1 -0
  394. package/dist/utils/performance/performance-monitor.js +307 -0
  395. package/dist/utils/performance/performance-monitor.js.map +1 -0
  396. package/dist/utils/response-factory.d.ts +81 -0
  397. package/dist/utils/response-factory.d.ts.map +1 -0
  398. package/dist/utils/response-factory.js +86 -0
  399. package/dist/utils/response-factory.js.map +1 -0
  400. package/dist/utils/retry.d.ts +146 -0
  401. package/dist/utils/retry.d.ts.map +1 -0
  402. package/dist/utils/retry.js +281 -0
  403. package/dist/utils/retry.js.map +1 -0
  404. package/dist/utils/security.d.ts +70 -0
  405. package/dist/utils/security.d.ts.map +1 -0
  406. package/dist/utils/security.js +358 -0
  407. package/dist/utils/security.js.map +1 -0
  408. package/dist/utils/simple-response.d.ts +75 -0
  409. package/dist/utils/simple-response.d.ts.map +1 -0
  410. package/dist/utils/simple-response.js +208 -0
  411. package/dist/utils/simple-response.js.map +1 -0
  412. package/dist/utils/storage-errors.d.ts +9 -0
  413. package/dist/utils/storage-errors.d.ts.map +1 -0
  414. package/dist/utils/storage-errors.js +20 -0
  415. package/dist/utils/storage-errors.js.map +1 -0
  416. package/dist/utils/unicode-fix.d.ts +19 -0
  417. package/dist/utils/unicode-fix.d.ts.map +1 -0
  418. package/dist/utils/unicode-fix.js +70 -0
  419. package/dist/utils/unicode-fix.js.map +1 -0
  420. package/dist/utils/validation.d.ts +103 -0
  421. package/dist/utils/validation.d.ts.map +1 -0
  422. package/dist/utils/validation.js +729 -0
  423. package/dist/utils/validation.js.map +1 -0
  424. package/package.json +148 -0
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ /**
3
+ * Comment operations for tasks
4
+ * Refactored to use modular service architecture
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.handleComment = handleComment;
8
+ exports.removeComment = removeComment;
9
+ exports.listComments = listComments;
10
+ const types_1 = require("../../../types");
11
+ const CommentOperationsService_1 = require("./CommentOperationsService");
12
+ const CommentValidationService_1 = require("./CommentValidationService");
13
+ const CommentResponseFormatter_1 = require("./CommentResponseFormatter");
14
+ /**
15
+ * Add a comment to a task or list task comments
16
+ */
17
+ async function handleComment(args) {
18
+ try {
19
+ const { taskId, commentText } = CommentValidationService_1.commentValidationService.validateCommentInput(args);
20
+ // If no comment text provided, list comments
21
+ if (!CommentValidationService_1.commentValidationService.shouldCreateComment(commentText)) {
22
+ const comments = await CommentOperationsService_1.CommentOperationsService.fetchTaskComments(taskId);
23
+ // Format and return response
24
+ const response = CommentResponseFormatter_1.commentResponseFormatter.formatListCommentsResponse(comments);
25
+ return CommentResponseFormatter_1.commentResponseFormatter.formatMcpResponse(response);
26
+ }
27
+ // Create a new comment
28
+ if (!commentText) {
29
+ throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, 'Comment text is required for comment creation');
30
+ }
31
+ const newComment = await CommentOperationsService_1.CommentOperationsService.createComment(taskId, commentText);
32
+ // Format and return response
33
+ const response = CommentResponseFormatter_1.commentResponseFormatter.formatCreateCommentResponse(newComment);
34
+ return CommentResponseFormatter_1.commentResponseFormatter.formatMcpResponse(response);
35
+ }
36
+ catch (error) {
37
+ throw new types_1.MCPError(types_1.ErrorCode.API_ERROR, `Failed to handle comment: ${error instanceof Error ? error.message : String(error)}`);
38
+ }
39
+ }
40
+ /**
41
+ * Remove a comment from a task
42
+ * Note: This functionality is not available in the current node-vikunja API
43
+ */
44
+ function removeComment() {
45
+ throw new types_1.MCPError(types_1.ErrorCode.NOT_IMPLEMENTED, 'Comment deletion is not currently supported by the node-vikunja API');
46
+ }
47
+ /**
48
+ * List all comments for a task
49
+ */
50
+ async function listComments(args) {
51
+ try {
52
+ const { taskId } = CommentValidationService_1.commentValidationService.validateListInput(args);
53
+ const comments = await CommentOperationsService_1.CommentOperationsService.fetchTaskComments(taskId);
54
+ // Format and return response
55
+ const response = CommentResponseFormatter_1.commentResponseFormatter.formatListCommentsResponse(comments);
56
+ return CommentResponseFormatter_1.commentResponseFormatter.formatMcpResponse(response);
57
+ }
58
+ catch (error) {
59
+ throw new types_1.MCPError(types_1.ErrorCode.API_ERROR, `Failed to list comments: ${error instanceof Error ? error.message : String(error)}`);
60
+ }
61
+ }
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tools/tasks/comments/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAUH,sCAgCC;AAMD,sCAKC;AAKD,oCAkBC;AA1ED,0CAAqD;AACrD,yEAAsE;AACtE,yEAAsE;AACtE,yEAAsE;AAEtE;;GAEG;AACI,KAAK,UAAU,aAAa,CAAC,IAGnC;IACC,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,mDAAwB,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;QAEpF,6CAA6C;QAC7C,IAAI,CAAC,mDAAwB,CAAC,mBAAmB,CAAC,WAAW,CAAC,EAAE,CAAC;YAC/D,MAAM,QAAQ,GAAG,MAAM,mDAAwB,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;YAE1E,6BAA6B;YAC7B,MAAM,QAAQ,GAAG,mDAAwB,CAAC,0BAA0B,CAAC,QAAQ,CAAC,CAAC;YAC/E,OAAO,mDAAwB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAC9D,CAAC;QAED,uBAAuB;QACvB,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,gBAAQ,CAAC,iBAAS,CAAC,gBAAgB,EAAE,+CAA+C,CAAC,CAAC;QAClG,CAAC;QACD,MAAM,UAAU,GAAG,MAAM,mDAAwB,CAAC,aAAa,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAErF,6BAA6B;QAC7B,MAAM,QAAQ,GAAG,mDAAwB,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC;QAClF,OAAO,mDAAwB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAE9D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,gBAAQ,CAChB,iBAAS,CAAC,SAAS,EACnB,6BAA6B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACtF,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,aAAa;IAC3B,MAAM,IAAI,gBAAQ,CAChB,iBAAS,CAAC,eAAe,EACzB,qEAAqE,CACtE,CAAC;AACJ,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,YAAY,CAAC,IAElC;IACC,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,mDAAwB,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAEpE,MAAM,QAAQ,GAAG,MAAM,mDAAwB,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAE1E,6BAA6B;QAC7B,MAAM,QAAQ,GAAG,mDAAwB,CAAC,0BAA0B,CAAC,QAAQ,CAAC,CAAC;QAC/E,OAAO,mDAAwB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAE9D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,gBAAQ,CAChB,iBAAS,CAAC,SAAS,EACnB,4BAA4B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACrF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Constants for task operations
3
+ */
4
+ export declare const AUTH_ERROR_MESSAGES: {
5
+ ASSIGNEE_CREATE: string;
6
+ ASSIGNEE_UPDATE: string;
7
+ ASSIGNEE_ASSIGN: string;
8
+ ASSIGNEE_REMOVE: string;
9
+ ASSIGNEE_REMOVE_PARTIAL: string;
10
+ ASSIGNEE_BULK_UPDATE: string;
11
+ LABEL_CREATE: string;
12
+ LABEL_UPDATE: string;
13
+ };
14
+ export declare const BULK_OPERATION_BATCH_SIZE = 10;
15
+ export declare const MAX_BULK_OPERATION_TASKS = 100;
16
+ export declare const REPEAT_MODE_MAP: Record<string, number>;
17
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/tools/tasks/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,mBAAmB;;;;;;;;;CAyB/B,CAAC;AAGF,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAC5C,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAI5C,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAIzC,CAAC"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /**
3
+ * Constants for task operations
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.REPEAT_MODE_MAP = exports.MAX_BULK_OPERATION_TASKS = exports.BULK_OPERATION_BATCH_SIZE = exports.AUTH_ERROR_MESSAGES = void 0;
7
+ // Error message constants
8
+ exports.AUTH_ERROR_MESSAGES = {
9
+ ASSIGNEE_CREATE: 'Assignee operations may have authentication issues with certain Vikunja API versions. ' +
10
+ 'This is a known limitation. The task was created but assignees could not be added.',
11
+ ASSIGNEE_UPDATE: 'Assignee operations may have authentication issues with certain Vikunja API versions. ' +
12
+ 'This is a known limitation. Other task fields were updated but assignees could not be changed.',
13
+ ASSIGNEE_ASSIGN: 'Assignee operations may have authentication issues with certain Vikunja API versions. ' +
14
+ 'This is a known limitation that prevents assigning users to tasks.',
15
+ ASSIGNEE_REMOVE: 'Assignee removal operations may have authentication issues with certain Vikunja API versions. ' +
16
+ 'This is a known limitation that prevents removing users from tasks.',
17
+ ASSIGNEE_REMOVE_PARTIAL: 'Assignee removal operations may have authentication issues with certain Vikunja API versions. ' +
18
+ 'This is a known limitation. New assignees were added but old assignees could not be removed.',
19
+ ASSIGNEE_BULK_UPDATE: 'Assignee operations may have authentication issues with certain Vikunja API versions. ' +
20
+ 'This is a known limitation that prevents bulk updating assignees.',
21
+ LABEL_CREATE: 'Label operations may have authentication issues with certain Vikunja API versions. ' +
22
+ 'This is a known limitation. The task was created but labels could not be added.',
23
+ LABEL_UPDATE: 'Label operations may have authentication issues with certain Vikunja API versions. ' +
24
+ 'This is a known limitation. Other task fields were updated but labels could not be changed.',
25
+ };
26
+ // Bulk operation constants
27
+ exports.BULK_OPERATION_BATCH_SIZE = 10;
28
+ exports.MAX_BULK_OPERATION_TASKS = 100;
29
+ // Repeat mode mapping for bulk update API
30
+ // Maps user-friendly string values to Vikunja API numeric codes
31
+ exports.REPEAT_MODE_MAP = {
32
+ default: 0,
33
+ month: 1,
34
+ from_current: 2,
35
+ };
36
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/tools/tasks/constants.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,0BAA0B;AACb,QAAA,mBAAmB,GAAG;IACjC,eAAe,EACb,wFAAwF;QACxF,oFAAoF;IACtF,eAAe,EACb,wFAAwF;QACxF,gGAAgG;IAClG,eAAe,EACb,wFAAwF;QACxF,oEAAoE;IACtE,eAAe,EACb,gGAAgG;QAChG,qEAAqE;IACvE,uBAAuB,EACrB,gGAAgG;QAChG,8FAA8F;IAChG,oBAAoB,EAClB,wFAAwF;QACxF,mEAAmE;IACrE,YAAY,EACV,qFAAqF;QACrF,iFAAiF;IACnF,YAAY,EACV,qFAAqF;QACrF,6FAA6F;CAChG,CAAC;AAEF,2BAA2B;AACd,QAAA,yBAAyB,GAAG,EAAE,CAAC;AAC/B,QAAA,wBAAwB,GAAG,GAAG,CAAC;AAE5C,0CAA0C;AAC1C,gEAAgE;AACnD,QAAA,eAAe,GAA2B;IACrD,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,YAAY,EAAE,CAAC;CACP,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Task Creation Service
3
+ * Handles task creation with label/assignee management and rollback logic
4
+ */
5
+ export interface CreateTaskArgs {
6
+ projectId?: number;
7
+ title?: string;
8
+ description?: string;
9
+ dueDate?: string;
10
+ priority?: number;
11
+ labels?: number[];
12
+ assignees?: number[];
13
+ repeatAfter?: number;
14
+ repeatMode?: 'day' | 'week' | 'month' | 'year';
15
+ sessionId?: string;
16
+ }
17
+ /**
18
+ * Creates a new task with comprehensive error handling and rollback support
19
+ */
20
+ export declare function createTask(args: CreateTaskArgs): Promise<{
21
+ content: Array<{
22
+ type: 'text';
23
+ text: string;
24
+ }>;
25
+ }>;
26
+ //# sourceMappingURL=TaskCreationService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskCreationService.d.ts","sourceRoot":"","sources":["../../../../src/tools/tasks/crud/TaskCreationService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAE/C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAWD;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAqKlH"}
@@ -0,0 +1,228 @@
1
+ "use strict";
2
+ /**
3
+ * Task Creation Service
4
+ * Handles task creation with label/assignee management and rollback logic
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.createTask = createTask;
8
+ const types_1 = require("../../../types");
9
+ const client_1 = require("../../../client");
10
+ const logger_1 = require("../../../utils/logger");
11
+ const auth_error_handler_1 = require("../../../utils/auth-error-handler");
12
+ const retry_1 = require("../../../utils/retry");
13
+ const error_handler_1 = require("../../../utils/error-handler");
14
+ const validation_1 = require("../../../utils/validation");
15
+ const constants_1 = require("../constants");
16
+ const validation_2 = require("../validation");
17
+ const TaskResponseFormatter_1 = require("./TaskResponseFormatter");
18
+ const response_factory_1 = require("../../../utils/response-factory");
19
+ /**
20
+ * Creates a new task with comprehensive error handling and rollback support
21
+ */
22
+ async function createTask(args) {
23
+ try {
24
+ // Validate required fields
25
+ if (!args.projectId) {
26
+ throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, 'projectId is required to create a task');
27
+ }
28
+ (0, validation_2.validateId)(args.projectId, 'projectId');
29
+ if (!args.title) {
30
+ throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, 'title is required to create a task');
31
+ }
32
+ // Sanitize and validate user inputs for comprehensive security
33
+ const sanitizedTitle = (0, validation_1.sanitizeString)(args.title);
34
+ // Preserve empty strings as they are valid descriptions
35
+ const sanitizedDescription = args.description !== undefined ? (0, validation_1.sanitizeString)(args.description) : undefined;
36
+ // Validate optional date fields
37
+ if (args.dueDate) {
38
+ (0, validation_2.validateDateString)(args.dueDate, 'dueDate');
39
+ }
40
+ // Validate assignee IDs upfront
41
+ if (args.assignees && args.assignees.length > 0) {
42
+ args.assignees.forEach((id) => (0, validation_2.validateId)(id, 'assignee ID'));
43
+ }
44
+ // Validate label IDs upfront
45
+ if (args.labels && args.labels.length > 0) {
46
+ args.labels.forEach((id) => (0, validation_2.validateId)(id, 'label ID'));
47
+ }
48
+ const client = await (0, client_1.getClientFromContext)();
49
+ // Build the initial task object with sanitized values
50
+ const newTask = {
51
+ title: sanitizedTitle,
52
+ project_id: args.projectId,
53
+ };
54
+ // Add optional fields with sanitized values
55
+ if (sanitizedDescription !== undefined)
56
+ newTask.description = sanitizedDescription;
57
+ if (args.dueDate !== undefined)
58
+ newTask.due_date = args.dueDate;
59
+ if (args.priority !== undefined)
60
+ newTask.priority = args.priority;
61
+ // Handle repeat configuration
62
+ if (args.repeatAfter !== undefined || args.repeatMode !== undefined) {
63
+ const repeatConfig = (0, validation_2.convertRepeatConfiguration)(args.repeatAfter, args.repeatMode);
64
+ if (repeatConfig.repeat_after !== undefined)
65
+ newTask.repeat_after = repeatConfig.repeat_after;
66
+ if (repeatConfig.repeat_mode !== undefined) {
67
+ // Use index signature to bypass type mismatch - API expects number but node-vikunja types expect string
68
+ newTask.repeat_mode = repeatConfig.repeat_mode;
69
+ }
70
+ }
71
+ // Create the base task
72
+ const createdTask = await client.tasks.createTask(args.projectId, newTask);
73
+ // Labels/assignees require a task id — fail loudly instead of reporting success without them
74
+ const needsPostCreate = (args.labels !== undefined && args.labels.length > 0) ||
75
+ (args.assignees !== undefined && args.assignees.length > 0);
76
+ if (needsPostCreate && !createdTask.id) {
77
+ throw new types_1.MCPError(types_1.ErrorCode.API_ERROR, 'Task was created but Vikunja did not return a task id, so labels/assignees could not be applied');
78
+ }
79
+ // Track creation state for potential rollback
80
+ const creationState = {
81
+ createdTask,
82
+ labelsAdded: false,
83
+ assigneesAdded: false
84
+ };
85
+ try {
86
+ // Add labels if provided
87
+ if (args.labels && args.labels.length > 0 && createdTask.id) {
88
+ await addLabelsToTask(client, createdTask.id, args.labels);
89
+ creationState.labelsAdded = true;
90
+ }
91
+ // Add assignees if provided
92
+ if (args.assignees && args.assignees.length > 0 && createdTask.id) {
93
+ await addAssigneesToTask(client, createdTask.id, args.assignees);
94
+ creationState.assigneesAdded = true;
95
+ }
96
+ }
97
+ catch (updateError) {
98
+ // Attempt to clean up the partially created task
99
+ await rollbackTaskCreation(client, creationState, updateError);
100
+ // The rollback function will re-throw the original error with context
101
+ }
102
+ // Fetch the complete task with labels and assignees
103
+ const completeTask = createdTask.id ? await client.tasks.getTask(createdTask.id) : createdTask;
104
+ // Verify labels actually stuck — avoid silent success when the API no-ops
105
+ if (args.labels && args.labels.length > 0) {
106
+ const attachedIds = new Set((completeTask.labels || [])
107
+ .map((label) => label.id)
108
+ .filter((id) => typeof id === 'number'));
109
+ const missing = args.labels.filter((id) => !attachedIds.has(id));
110
+ if (missing.length > 0) {
111
+ await rollbackTaskCreation(client, creationState, new Error(`Labels were requested but not attached after create (missing label ids: ${missing.join(', ')})`));
112
+ }
113
+ }
114
+ const response = (0, TaskResponseFormatter_1.createTaskResponse)('create-task', 'Task created successfully', { task: completeTask }, {
115
+ timestamp: new Date().toISOString(),
116
+ projectId: args.projectId,
117
+ labelsAdded: creationState.labelsAdded,
118
+ assigneesAdded: creationState.assigneesAdded,
119
+ }, undefined, // verbosity (ignored - using standard AORP)
120
+ undefined, // useOptimizedFormat (ignored - using standard AORP)
121
+ undefined, // useAorp (ignored - always using AORP)
122
+ undefined, // aorpConfig (using auto-generated)
123
+ args.sessionId);
124
+ logger_1.logger.debug('Tasks tool response', {
125
+ subcommand: 'create',
126
+ taskId: completeTask.id,
127
+ });
128
+ return {
129
+ content: [
130
+ {
131
+ type: 'text',
132
+ text: (0, response_factory_1.formatAorpAsMarkdown)(response.response),
133
+ },
134
+ ],
135
+ };
136
+ }
137
+ catch (error) {
138
+ // Re-throw MCPError instances without modification
139
+ if (error instanceof types_1.MCPError) {
140
+ throw error;
141
+ }
142
+ // Handle fetch/connection errors with helpful guidance
143
+ if (error instanceof Error && (error.message.includes('fetch failed') ||
144
+ error.message.includes('ECONNREFUSED') ||
145
+ error.message.includes('ENOTFOUND'))) {
146
+ throw (0, error_handler_1.handleFetchError)(error, 'create task');
147
+ }
148
+ // Use standardized error transformation for all other errors
149
+ throw (0, error_handler_1.transformApiError)(error, 'Failed to create task');
150
+ }
151
+ }
152
+ /**
153
+ * Adds labels to a task.
154
+ * Uses addLabelToTask (same as apply-label) — updateTaskLabels can silently
155
+ * no-op on some Vikunja versions (GitHub #37).
156
+ *
157
+ * Intentionally does not use withRetry: that helper shares an "anonymous"
158
+ * circuit breaker across calls, so a later create would re-fire the first
159
+ * call's label set against the wrong task.
160
+ */
161
+ async function addLabelsToTask(client, taskId, labelIds) {
162
+ try {
163
+ for (const labelId of labelIds) {
164
+ await client.tasks.addLabelToTask(taskId, {
165
+ task_id: taskId,
166
+ label_id: labelId,
167
+ });
168
+ }
169
+ }
170
+ catch (labelError) {
171
+ // Check if it's an auth error
172
+ if ((0, auth_error_handler_1.isAuthenticationError)(labelError)) {
173
+ throw new types_1.MCPError(types_1.ErrorCode.API_ERROR, `${constants_1.AUTH_ERROR_MESSAGES.LABEL_CREATE} Task ID: ${taskId}`);
174
+ }
175
+ throw labelError;
176
+ }
177
+ }
178
+ /**
179
+ * Adds assignees to a task with retry logic for authentication errors
180
+ */
181
+ async function addAssigneesToTask(client, taskId, assigneeIds) {
182
+ try {
183
+ await (0, retry_1.withRetry)(() => client.tasks.bulkAssignUsersToTask(taskId, {
184
+ user_ids: assigneeIds,
185
+ }), {
186
+ ...retry_1.RETRY_CONFIG.AUTH_ERRORS,
187
+ shouldRetry: (error) => (0, auth_error_handler_1.isAuthenticationError)(error)
188
+ });
189
+ }
190
+ catch (assigneeError) {
191
+ // Check if it's an auth error after retries
192
+ if ((0, auth_error_handler_1.isAuthenticationError)(assigneeError)) {
193
+ throw new types_1.MCPError(types_1.ErrorCode.API_ERROR, `${constants_1.AUTH_ERROR_MESSAGES.ASSIGNEE_CREATE} (Retried ${retry_1.RETRY_CONFIG.AUTH_ERRORS.maxRetries} times). Task ID: ${taskId}`);
194
+ }
195
+ throw assigneeError;
196
+ }
197
+ }
198
+ /**
199
+ * Attempts to roll back a partially created task and throws enhanced error context
200
+ */
201
+ async function rollbackTaskCreation(client, creationState, originalError) {
202
+ // Attempt to clean up the partially created task
203
+ let rollbackSucceeded = false;
204
+ if (creationState.createdTask.id) {
205
+ try {
206
+ await client.tasks.deleteTask(creationState.createdTask.id);
207
+ rollbackSucceeded = true;
208
+ }
209
+ catch (deleteError) {
210
+ // Log the cleanup failure but throw the original error
211
+ logger_1.logger.error('Failed to clean up partially created task:', deleteError);
212
+ }
213
+ }
214
+ // Re-throw the original error with context
215
+ const errorMessage = `Failed to complete task creation: ${originalError instanceof Error ? originalError.message : String(originalError)}. ${rollbackSucceeded
216
+ ? 'Task was successfully rolled back.'
217
+ : 'Task rollback also failed - manual cleanup may be required.'}`;
218
+ throw new types_1.MCPError(types_1.ErrorCode.API_ERROR, errorMessage, {
219
+ vikunjaError: {
220
+ taskId: creationState.createdTask.id,
221
+ partiallyCreated: true,
222
+ labelsAdded: creationState.labelsAdded,
223
+ assigneesAdded: creationState.assigneesAdded,
224
+ rollbackSucceeded,
225
+ },
226
+ });
227
+ }
228
+ //# sourceMappingURL=TaskCreationService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskCreationService.js","sourceRoot":"","sources":["../../../../src/tools/tasks/crud/TaskCreationService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAyCH,gCAqKC;AA5MD,0CAAqD;AACrD,4CAAuD;AAEvD,kDAA+C;AAC/C,0EAA0E;AAC1E,gDAA+D;AAC/D,gEAAmF;AACnF,0DAA2D;AAC3D,4CAAmD;AACnD,8CAA2F;AAC3F,mEAA6D;AAC7D,sEAAuE;AAyBvE;;GAEG;AACI,KAAK,UAAU,UAAU,CAAC,IAAoB;IACnD,IAAI,CAAC;QACH,2BAA2B;QAC3B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,IAAI,gBAAQ,CAAC,iBAAS,CAAC,gBAAgB,EAAE,wCAAwC,CAAC,CAAC;QAC3F,CAAC;QACD,IAAA,uBAAU,EAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAExC,IA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AS,EAAE,YAAY,EAAE;QACpD,YAAY,EAAE;YACZ,MAAM,EAAE,aAAa,CAAC,WAAW,CAAC,EAAE;YACpC,gBAAgB,EAAE,IAAI;YACtB,WAAW,EAAE,aAAa,CAAC,WAAW;YACtC,cAAc,EAAE,aAAa,CAAC,cAAc;YAC5C,iBAAiB;SAClB;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Task Deletion Service
3
+ * Handles task deletion with graceful error handling and response formatting
4
+ */
5
+ export interface DeleteTaskArgs {
6
+ id?: number;
7
+ sessionId?: string;
8
+ }
9
+ /**
10
+ * Deletes a task with graceful error handling and informative response
11
+ */
12
+ export declare function deleteTask(args: DeleteTaskArgs): Promise<{
13
+ content: Array<{
14
+ type: 'text';
15
+ text: string;
16
+ }>;
17
+ }>;
18
+ //# sourceMappingURL=TaskDeletionService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskDeletionService.d.ts","sourceRoot":"","sources":["../../../../src/tools/tasks/crud/TaskDeletionService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA8DlH"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ /**
3
+ * Task Deletion Service
4
+ * Handles task deletion with graceful error handling and response formatting
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.deleteTask = deleteTask;
8
+ const types_1 = require("../../../types");
9
+ const client_1 = require("../../../client");
10
+ const validation_1 = require("../validation");
11
+ const error_handler_1 = require("../../../utils/error-handler");
12
+ const TaskResponseFormatter_1 = require("./TaskResponseFormatter");
13
+ const response_factory_1 = require("../../../utils/response-factory");
14
+ /**
15
+ * Deletes a task with graceful error handling and informative response
16
+ */
17
+ async function deleteTask(args) {
18
+ try {
19
+ if (!args.id) {
20
+ throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, 'Task id is required for delete operation');
21
+ }
22
+ (0, validation_1.validateId)(args.id, 'id');
23
+ const client = await (0, client_1.getClientFromContext)();
24
+ // Try to get task before deletion for response, but handle failure gracefully
25
+ const deletionContext = await gatherDeletionContext(client, args.id);
26
+ // Perform the deletion
27
+ await client.tasks.deleteTask(args.id);
28
+ const response = (0, TaskResponseFormatter_1.createTaskResponse)('delete-task', deletionContext.taskToDelete
29
+ ? `Task "${deletionContext.taskToDelete.title}" deleted successfully`
30
+ : `Task ${args.id} deleted successfully`, deletionContext.taskToDelete ? { task: deletionContext.taskToDelete } : { deletedTaskId: args.id }, {
31
+ timestamp: new Date().toISOString(),
32
+ taskId: args.id,
33
+ ...(deletionContext.taskToDelete?.title && { taskTitle: deletionContext.taskToDelete.title }),
34
+ }, undefined, // verbosity (ignored)
35
+ undefined, // useOptimizedFormat (ignored)
36
+ undefined, // useAorp (ignored)
37
+ undefined, // aorpConfig (using auto-generated)
38
+ args.sessionId);
39
+ return {
40
+ content: [
41
+ {
42
+ type: 'text',
43
+ text: (0, response_factory_1.formatAorpAsMarkdown)(response.response),
44
+ },
45
+ ],
46
+ };
47
+ }
48
+ catch (error) {
49
+ // Re-throw MCPError instances without modification
50
+ if (error instanceof types_1.MCPError) {
51
+ throw error;
52
+ }
53
+ // Handle fetch/connection errors with helpful guidance
54
+ if (error instanceof Error && (error.message.includes('fetch failed') ||
55
+ error.message.includes('ECONNREFUSED') ||
56
+ error.message.includes('ENOTFOUND'))) {
57
+ throw (0, error_handler_1.handleFetchError)(error, 'delete task');
58
+ }
59
+ // Use standardized error transformation for all other errors
60
+ if (args.id) {
61
+ throw (0, error_handler_1.handleStatusCodeError)(error, 'delete task', args.id, `Task with ID ${args.id} not found`);
62
+ }
63
+ throw (0, error_handler_1.transformApiError)(error, 'Failed to delete task');
64
+ }
65
+ }
66
+ /**
67
+ * Gathers information about the task before deletion for better response messaging
68
+ * Handles cases where the task might not exist or be accessible
69
+ */
70
+ async function gatherDeletionContext(client, taskId) {
71
+ let taskToDelete;
72
+ let retrievalSuccess = false;
73
+ try {
74
+ taskToDelete = await client.tasks.getTask(taskId);
75
+ retrievalSuccess = true;
76
+ }
77
+ catch {
78
+ // If we can't get the task, proceed with deletion anyway
79
+ // This handles cases where the task exists but isn't accessible due to permissions
80
+ // or the task is already deleted/inconsistent state
81
+ taskToDelete = undefined;
82
+ retrievalSuccess = false;
83
+ }
84
+ return {
85
+ taskToDelete,
86
+ retrievalSuccess
87
+ };
88
+ }
89
+ //# sourceMappingURL=TaskDeletionService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskDeletionService.js","sourceRoot":"","sources":["../../../../src/tools/tasks/crud/TaskDeletionService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAkBH,gCA8DC;AA9ED,0CAAqD;AACrD,4CAAuD;AAEvD,8CAA2C;AAC3C,gEAA0G;AAC1G,mEAA6D;AAC7D,sEAAuE;AAOvE;;GAEG;AACI,KAAK,UAAU,UAAU,CAAC,IAAoB;IACnD,IAAI,CAAC;QACH,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;YACb,MAAM,IAAI,gBAAQ,CAAC,iBAAS,CAAC,gBAAgB,EAAE,0CAA0C,CAAC,CAAC;QAC7F,CAAC;QACD,IAAA,uBAAU,EAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QAE1B,MAAM,MAAM,GAAG,MAAM,IAAA,6BAAoB,GAAE,CAAC;QAE5C,8EAA8E;QAC9E,MAAM,eAAe,GAAG,MAAM,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAErE,uBAAuB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,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CACpC,EAAE,CAAC;YACF,MAAM,IAAA,gCAAgB,EAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QAC/C,CAAC;QAED,6DAA6D;QAC7D,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAA,qCAAqB,EAAC,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,EAAE,gBAAgB,IAAI,CAAC,EAAE,YAAY,CAAC,CAAC;QAClG,CAAC;QACD,MAAM,IAAA,iCAAiB,EAAC,KAAK,EAAE,uBAAuB,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC;AAUD;;;GAGG;AACH,KAAK,UAAU,qBAAqB,CAAC,MAAqB,EAAE,MAAc;IACxE,IAAI,YAA8B,CAAC;IACnC,IAAI,gBAAgB,GAAG,KAAK,CAAC;IAE7B,IAAI,CAAC;QACH,YAAY,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAClD,gBAAgB,GAAG,IAAI,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,yDAAyD;QACzD,mFAAmF;QACnF,oDAAoD;QACpD,YAAY,GAAG,SAAS,CAAC;QACzB,gBAAgB,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED,OAAO;QACL,YAAY;QACZ,gBAAgB;KACjB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Task Read Service
3
+ * Handles task retrieval operations with comprehensive error handling
4
+ */
5
+ export interface GetTaskArgs {
6
+ id?: number;
7
+ sessionId?: string;
8
+ }
9
+ /**
10
+ * Retrieves a task by ID with comprehensive error handling
11
+ */
12
+ export declare function getTask(args: GetTaskArgs): Promise<{
13
+ content: Array<{
14
+ type: 'text';
15
+ text: string;
16
+ }>;
17
+ }>;
18
+ //# sourceMappingURL=TaskReadService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskReadService.d.ts","sourceRoot":"","sources":["../../../../src/tools/tasks/crud/TaskReadService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,WAAW,WAAW;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAsD5G"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ /**
3
+ * Task Read Service
4
+ * Handles task retrieval operations with comprehensive error handling
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.getTask = getTask;
8
+ const index_1 = require("../../../index");
9
+ const validation_1 = require("../validation");
10
+ const TaskResponseFormatter_1 = require("./TaskResponseFormatter");
11
+ const response_factory_1 = require("../../../utils/response-factory");
12
+ /**
13
+ * Retrieves a task by ID with comprehensive error handling
14
+ */
15
+ async function getTask(args) {
16
+ try {
17
+ if (!args.id) {
18
+ throw new index_1.MCPError(index_1.ErrorCode.VALIDATION_ERROR, 'Task id is required for get operation');
19
+ }
20
+ (0, validation_1.validateId)(args.id, 'id');
21
+ const client = await (0, index_1.getClientFromContext)();
22
+ const task = await client.tasks.getTask(args.id);
23
+ const response = (0, TaskResponseFormatter_1.createTaskResponse)('get-task', `Retrieved task "${task.title}"`, { task }, {
24
+ timestamp: new Date().toISOString(),
25
+ taskId: args.id,
26
+ }, undefined, // verbosity (ignored)
27
+ undefined, // useOptimizedFormat (ignored)
28
+ undefined, // useAorp (ignored)
29
+ undefined, // aorpConfig (using auto-generated)
30
+ args.sessionId);
31
+ return {
32
+ content: [
33
+ {
34
+ type: 'text',
35
+ text: (0, response_factory_1.formatAorpAsMarkdown)(response.response),
36
+ },
37
+ ],
38
+ };
39
+ }
40
+ catch (error) {
41
+ // Re-throw MCPError instances without modification
42
+ if (error instanceof index_1.MCPError) {
43
+ throw error;
44
+ }
45
+ // Handle fetch/connection errors with helpful guidance
46
+ if (error instanceof Error && (error.message.includes('fetch failed') ||
47
+ error.message.includes('ECONNREFUSED') ||
48
+ error.message.includes('ENOTFOUND'))) {
49
+ throw (0, index_1.handleFetchError)(error, 'get task');
50
+ }
51
+ // Use standardized error transformation for all other errors
52
+ if (args.id) {
53
+ throw (0, index_1.handleStatusCodeError)(error, 'get task', args.id, `Task with ID ${args.id} not found`);
54
+ }
55
+ throw (0, index_1.transformApiError)(error, 'Failed to get task');
56
+ }
57
+ }
58
+ //# sourceMappingURL=TaskReadService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskReadService.js","sourceRoot":"","sources":["../../../../src/tools/tasks/crud/TaskReadService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAeH,0BAsDC;AAnED,0CAAuI;AACvI,8CAA2C;AAC3C,mEAA6D;AAC7D,sEAAuE;AAOvE;;GAEG;AACI,KAAK,UAAU,OAAO,CAAC,IAAiB;IAC7C,IAAI,CAAC;QACH,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;YACb,MAAM,IAAI,gBAAQ,CAAC,iBAAS,CAAC,gBAAgB,EAAE,uCAAuC,CAAC,CAAC;QAC1F,CAAC;QACD,IAAA,uBAAU,EAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QAE1B,MAAM,MAAM,GAAG,MAAM,IAAA,4BAAoB,GAAE,CAAC;QAC5C,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEjD,MAAM,QAAQ,GAAG,IAAA,0CAAkB,EACjC,UAAU,EACV,mBAAmB,IAAI,CAAC,KAAK,GAAG,EAChC,EAAE,IAAI,EAAE,EACR;YACE,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,MAAM,EAAE,IAAI,CAAC,EAAE;SAChB,EACD,SAAS,EAAE,sBAAsB;QACjC,SAAS,EAAE,+BAA+B;QAC1C,SAAS,EAAE,oBAAoB;QAC/B,SAAS,EAAE,oCAAoC;QAC/C,IAAI,CAAC,SAAS,CACf,CAAC;QAEF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAA,uCAAoB,EAAC,QAAQ,CAAC,QAAQ,CAAC;iBAC9C;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,mDAAmD;QACnD,IAAI,KAAK,YAAY,gBAAQ,EAAE,CAAC;YAC9B,MAAM,KAAK,CAAC;QACd,CAAC;QAED,uDAAuD;QACvD,IAAI,KAAK,YAAY,KAAK,IAAI,CAC5B,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;YACtC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;YACtC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CACpC,EAAE,CAAC;YACF,MAAM,IAAA,wBAAgB,EAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QAC5C,CAAC;QAED,6DAA6D;QAC7D,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAA,6BAAqB,EAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE,gBAAgB,IAAI,CAAC,EAAE,YAAY,CAAC,CAAC;QAC/F,CAAC;QACD,MAAM,IAAA,yBAAiB,EAAC,KAAK,EAAE,oBAAoB,CAAC,CAAC;IACvD,CAAC;AACH,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Task Response Formatter
3
+ * Centralizes AORP response formatting logic for task operations
4
+ */
5
+ import { type TaskResponseData, type TaskResponseMetadata, type AorpBuilderConfig } from '../../../types';
6
+ import type { AorpFactoryResult } from '../../../types';
7
+ /**
8
+ * Creates an AORP response for task operations with optimized configuration
9
+ */
10
+ export declare function createTaskResponse(operation: string, message: string, _data: TaskResponseData, _metadata?: TaskResponseMetadata, _verbosity?: string, // Parameter kept for backward compatibility but ignored
11
+ _useOptimizedFormat?: boolean, // Parameter kept for backward compatibility but ignored
12
+ _useAorp?: boolean, // Parameter kept for backward compatibility but ignored
13
+ _aorpConfig?: AorpBuilderConfig, _sessionId?: string): AorpFactoryResult;
14
+ /**
15
+ * Creates an AORP error response for task operations
16
+ */
17
+ export declare function createTaskErrorResponse(operation: string, error: Error | Record<string, unknown>, metadata?: TaskResponseMetadata): AorpFactoryResult;
18
+ //# sourceMappingURL=TaskResponseFormatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskResponseFormatter.d.ts","sourceRoot":"","sources":["../../../../src/tools/tasks/crud/TaskResponseFormatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,KAAK,iBAAiB,EAA2B,MAAM,gBAAgB,CAAC;AAEnI,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAoExD;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,gBAAgB,EACvB,SAAS,GAAE,oBAEV,EACD,UAAU,CAAC,EAAE,MAAM,EAAE,wDAAwD;AAC7E,mBAAmB,CAAC,EAAE,OAAO,EAAE,wDAAwD;AACvF,QAAQ,CAAC,EAAE,OAAO,EAAE,wDAAwD;AAC5E,WAAW,CAAC,EAAE,iBAAiB,EAC/B,UAAU,CAAC,EAAE,MAAM,GAClB,iBAAiB,CA0GnB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtC,QAAQ,GAAE,oBAET,GACA,iBAAiB,CAuEnB"}