@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.
- package/CHANGELOG.md +51 -0
- package/LICENSE +21 -0
- package/README.md +1377 -0
- package/dist/auth/AuthManager.d.ts +63 -0
- package/dist/auth/AuthManager.d.ts.map +1 -0
- package/dist/auth/AuthManager.js +137 -0
- package/dist/auth/AuthManager.js.map +1 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +14 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/permissions.d.ts +60 -0
- package/dist/auth/permissions.d.ts.map +1 -0
- package/dist/auth/permissions.js +173 -0
- package/dist/auth/permissions.js.map +1 -0
- package/dist/client/VikunjaClientFactory.d.ts +32 -0
- package/dist/client/VikunjaClientFactory.d.ts.map +1 -0
- package/dist/client/VikunjaClientFactory.js +66 -0
- package/dist/client/VikunjaClientFactory.js.map +1 -0
- package/dist/client.d.ts +57 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +128 -0
- package/dist/client.js.map +1 -0
- package/dist/config/ConfigurationManager.d.ts +63 -0
- package/dist/config/ConfigurationManager.d.ts.map +1 -0
- package/dist/config/ConfigurationManager.js +243 -0
- package/dist/config/ConfigurationManager.js.map +1 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +27 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/types.d.ts +434 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +93 -0
- package/dist/config/types.js.map +1 -0
- package/dist/formatters/BatchImportResponseFormatter.d.ts +89 -0
- package/dist/formatters/BatchImportResponseFormatter.d.ts.map +1 -0
- package/dist/formatters/BatchImportResponseFormatter.js +125 -0
- package/dist/formatters/BatchImportResponseFormatter.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +119 -0
- package/dist/index.js.map +1 -0
- package/dist/middleware/direct-middleware.d.ts +9 -0
- package/dist/middleware/direct-middleware.d.ts.map +1 -0
- package/dist/middleware/direct-middleware.js +49 -0
- package/dist/middleware/direct-middleware.js.map +1 -0
- package/dist/middleware/index.d.ts +8 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +21 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/simplified-rate-limit.d.ts +147 -0
- package/dist/middleware/simplified-rate-limit.d.ts.map +1 -0
- package/dist/middleware/simplified-rate-limit.js +542 -0
- package/dist/middleware/simplified-rate-limit.js.map +1 -0
- package/dist/parsers/CSVParser.d.ts +36 -0
- package/dist/parsers/CSVParser.d.ts.map +1 -0
- package/dist/parsers/CSVParser.js +69 -0
- package/dist/parsers/CSVParser.js.map +1 -0
- package/dist/parsers/InputParserFactory.d.ts +17 -0
- package/dist/parsers/InputParserFactory.d.ts.map +1 -0
- package/dist/parsers/InputParserFactory.js +137 -0
- package/dist/parsers/InputParserFactory.js.map +1 -0
- package/dist/parsers/JSONParser.d.ts +74 -0
- package/dist/parsers/JSONParser.d.ts.map +1 -0
- package/dist/parsers/JSONParser.js +69 -0
- package/dist/parsers/JSONParser.js.map +1 -0
- package/dist/services/EntityResolver.d.ts +75 -0
- package/dist/services/EntityResolver.d.ts.map +1 -0
- package/dist/services/EntityResolver.js +176 -0
- package/dist/services/EntityResolver.js.map +1 -0
- package/dist/services/TaskCreationService.d.ts +96 -0
- package/dist/services/TaskCreationService.d.ts.map +1 -0
- package/dist/services/TaskCreationService.js +361 -0
- package/dist/services/TaskCreationService.js.map +1 -0
- package/dist/storage/SimpleFilterStorage.d.ts +110 -0
- package/dist/storage/SimpleFilterStorage.d.ts.map +1 -0
- package/dist/storage/SimpleFilterStorage.js +358 -0
- package/dist/storage/SimpleFilterStorage.js.map +1 -0
- package/dist/storage/index.d.ts +59 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +117 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/tools/auth.d.ts +9 -0
- package/dist/tools/auth.d.ts.map +1 -0
- package/dist/tools/auth.js +80 -0
- package/dist/tools/auth.js.map +1 -0
- package/dist/tools/batch-import.d.ts +5 -0
- package/dist/tools/batch-import.d.ts.map +1 -0
- package/dist/tools/batch-import.js +150 -0
- package/dist/tools/batch-import.js.map +1 -0
- package/dist/tools/export.d.ts +14 -0
- package/dist/tools/export.d.ts.map +1 -0
- package/dist/tools/export.js +232 -0
- package/dist/tools/export.js.map +1 -0
- package/dist/tools/filters.d.ts +8 -0
- package/dist/tools/filters.d.ts.map +1 -0
- package/dist/tools/filters.js +419 -0
- package/dist/tools/filters.js.map +1 -0
- package/dist/tools/index.d.ts +36 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +87 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/labels.d.ts +9 -0
- package/dist/tools/labels.d.ts.map +1 -0
- package/dist/tools/labels.js +152 -0
- package/dist/tools/labels.js.map +1 -0
- package/dist/tools/projects/crud.d.ts +118 -0
- package/dist/tools/projects/crud.d.ts.map +1 -0
- package/dist/tools/projects/crud.js +389 -0
- package/dist/tools/projects/crud.js.map +1 -0
- package/dist/tools/projects/hierarchy.d.ts +68 -0
- package/dist/tools/projects/hierarchy.d.ts.map +1 -0
- package/dist/tools/projects/hierarchy.js +280 -0
- package/dist/tools/projects/hierarchy.js.map +1 -0
- package/dist/tools/projects/index.d.ts +17 -0
- package/dist/tools/projects/index.d.ts.map +1 -0
- package/dist/tools/projects/index.js +169 -0
- package/dist/tools/projects/index.js.map +1 -0
- package/dist/tools/projects/response-formatter.d.ts +46 -0
- package/dist/tools/projects/response-formatter.d.ts.map +1 -0
- package/dist/tools/projects/response-formatter.js +131 -0
- package/dist/tools/projects/response-formatter.js.map +1 -0
- package/dist/tools/projects/sharing.d.ts +89 -0
- package/dist/tools/projects/sharing.d.ts.map +1 -0
- package/dist/tools/projects/sharing.js +272 -0
- package/dist/tools/projects/sharing.js.map +1 -0
- package/dist/tools/projects/validation.d.ts +39 -0
- package/dist/tools/projects/validation.d.ts.map +1 -0
- package/dist/tools/projects/validation.js +129 -0
- package/dist/tools/projects/validation.js.map +1 -0
- package/dist/tools/projects.d.ts +10 -0
- package/dist/tools/projects.d.ts.map +1 -0
- package/dist/tools/projects.js +42 -0
- package/dist/tools/projects.js.map +1 -0
- package/dist/tools/task-assignees.d.ts +13 -0
- package/dist/tools/task-assignees.d.ts.map +1 -0
- package/dist/tools/task-assignees.js +62 -0
- package/dist/tools/task-assignees.js.map +1 -0
- package/dist/tools/task-bulk.d.ts +13 -0
- package/dist/tools/task-bulk.d.ts.map +1 -0
- package/dist/tools/task-bulk.js +113 -0
- package/dist/tools/task-bulk.js.map +1 -0
- package/dist/tools/task-comments.d.ts +13 -0
- package/dist/tools/task-comments.d.ts.map +1 -0
- package/dist/tools/task-comments.js +53 -0
- package/dist/tools/task-comments.js.map +1 -0
- package/dist/tools/task-crud.d.ts +13 -0
- package/dist/tools/task-crud.d.ts.map +1 -0
- package/dist/tools/task-crud.js +163 -0
- package/dist/tools/task-crud.js.map +1 -0
- package/dist/tools/task-labels.d.ts +13 -0
- package/dist/tools/task-labels.d.ts.map +1 -0
- package/dist/tools/task-labels.js +62 -0
- package/dist/tools/task-labels.js.map +1 -0
- package/dist/tools/task-relations.d.ts +13 -0
- package/dist/tools/task-relations.d.ts.map +1 -0
- package/dist/tools/task-relations.js +72 -0
- package/dist/tools/task-relations.js.map +1 -0
- package/dist/tools/task-reminders.d.ts +13 -0
- package/dist/tools/task-reminders.d.ts.map +1 -0
- package/dist/tools/task-reminders.js +63 -0
- package/dist/tools/task-reminders.js.map +1 -0
- package/dist/tools/tasks/assignees/AssigneeOperationsService.d.ts +31 -0
- package/dist/tools/tasks/assignees/AssigneeOperationsService.d.ts.map +1 -0
- package/dist/tools/tasks/assignees/AssigneeOperationsService.js +95 -0
- package/dist/tools/tasks/assignees/AssigneeOperationsService.js.map +1 -0
- package/dist/tools/tasks/assignees/AssigneeResponseFormatter.d.ts +32 -0
- package/dist/tools/tasks/assignees/AssigneeResponseFormatter.d.ts.map +1 -0
- package/dist/tools/tasks/assignees/AssigneeResponseFormatter.js +84 -0
- package/dist/tools/tasks/assignees/AssigneeResponseFormatter.js.map +1 -0
- package/dist/tools/tasks/assignees/AssigneeValidationService.d.ts +36 -0
- package/dist/tools/tasks/assignees/AssigneeValidationService.d.ts.map +1 -0
- package/dist/tools/tasks/assignees/AssigneeValidationService.js +63 -0
- package/dist/tools/tasks/assignees/AssigneeValidationService.js.map +1 -0
- package/dist/tools/tasks/assignees/index.d.ts +40 -0
- package/dist/tools/tasks/assignees/index.d.ts.map +1 -0
- package/dist/tools/tasks/assignees/index.js +72 -0
- package/dist/tools/tasks/assignees/index.js.map +1 -0
- package/dist/tools/tasks/bulk/BulkOperationValidator.d.ts +51 -0
- package/dist/tools/tasks/bulk/BulkOperationValidator.d.ts.map +1 -0
- package/dist/tools/tasks/bulk/BulkOperationValidator.js +149 -0
- package/dist/tools/tasks/bulk/BulkOperationValidator.js.map +1 -0
- package/dist/tools/tasks/bulk-operations-simplified.d.ts +39 -0
- package/dist/tools/tasks/bulk-operations-simplified.d.ts.map +1 -0
- package/dist/tools/tasks/bulk-operations-simplified.js +249 -0
- package/dist/tools/tasks/bulk-operations-simplified.js.map +1 -0
- package/dist/tools/tasks/bulk-operations.d.ts +8 -0
- package/dist/tools/tasks/bulk-operations.d.ts.map +1 -0
- package/dist/tools/tasks/bulk-operations.js +14 -0
- package/dist/tools/tasks/bulk-operations.js.map +1 -0
- package/dist/tools/tasks/comments/CommentOperationsService.d.ts +23 -0
- package/dist/tools/tasks/comments/CommentOperationsService.d.ts.map +1 -0
- package/dist/tools/tasks/comments/CommentOperationsService.js +37 -0
- package/dist/tools/tasks/comments/CommentOperationsService.js.map +1 -0
- package/dist/tools/tasks/comments/CommentResponseFormatter.d.ts +29 -0
- package/dist/tools/tasks/comments/CommentResponseFormatter.d.ts.map +1 -0
- package/dist/tools/tasks/comments/CommentResponseFormatter.js +69 -0
- package/dist/tools/tasks/comments/CommentResponseFormatter.js.map +1 -0
- package/dist/tools/tasks/comments/CommentValidationService.d.ts +33 -0
- package/dist/tools/tasks/comments/CommentValidationService.d.ts.map +1 -0
- package/dist/tools/tasks/comments/CommentValidationService.js +50 -0
- package/dist/tools/tasks/comments/CommentValidationService.js.map +1 -0
- package/dist/tools/tasks/comments/index.d.ts +38 -0
- package/dist/tools/tasks/comments/index.d.ts.map +1 -0
- package/dist/tools/tasks/comments/index.js +62 -0
- package/dist/tools/tasks/comments/index.js.map +1 -0
- package/dist/tools/tasks/constants.d.ts +17 -0
- package/dist/tools/tasks/constants.d.ts.map +1 -0
- package/dist/tools/tasks/constants.js +36 -0
- package/dist/tools/tasks/constants.js.map +1 -0
- package/dist/tools/tasks/crud/TaskCreationService.d.ts +26 -0
- package/dist/tools/tasks/crud/TaskCreationService.d.ts.map +1 -0
- package/dist/tools/tasks/crud/TaskCreationService.js +228 -0
- package/dist/tools/tasks/crud/TaskCreationService.js.map +1 -0
- package/dist/tools/tasks/crud/TaskDeletionService.d.ts +18 -0
- package/dist/tools/tasks/crud/TaskDeletionService.d.ts.map +1 -0
- package/dist/tools/tasks/crud/TaskDeletionService.js +89 -0
- package/dist/tools/tasks/crud/TaskDeletionService.js.map +1 -0
- package/dist/tools/tasks/crud/TaskReadService.d.ts +18 -0
- package/dist/tools/tasks/crud/TaskReadService.d.ts.map +1 -0
- package/dist/tools/tasks/crud/TaskReadService.js +58 -0
- package/dist/tools/tasks/crud/TaskReadService.js.map +1 -0
- package/dist/tools/tasks/crud/TaskResponseFormatter.d.ts +18 -0
- package/dist/tools/tasks/crud/TaskResponseFormatter.d.ts.map +1 -0
- package/dist/tools/tasks/crud/TaskResponseFormatter.js +244 -0
- package/dist/tools/tasks/crud/TaskResponseFormatter.js.map +1 -0
- package/dist/tools/tasks/crud/TaskUpdateService.d.ts +29 -0
- package/dist/tools/tasks/crud/TaskUpdateService.d.ts.map +1 -0
- package/dist/tools/tasks/crud/TaskUpdateService.js +231 -0
- package/dist/tools/tasks/crud/TaskUpdateService.js.map +1 -0
- package/dist/tools/tasks/crud/index.d.ts +16 -0
- package/dist/tools/tasks/crud/index.d.ts.map +1 -0
- package/dist/tools/tasks/crud/index.js +20 -0
- package/dist/tools/tasks/crud/index.js.map +1 -0
- package/dist/tools/tasks/filtering/FilterExecutor.d.ts +38 -0
- package/dist/tools/tasks/filtering/FilterExecutor.d.ts.map +1 -0
- package/dist/tools/tasks/filtering/FilterExecutor.js +200 -0
- package/dist/tools/tasks/filtering/FilterExecutor.js.map +1 -0
- package/dist/tools/tasks/filtering/FilterValidator.d.ts +56 -0
- package/dist/tools/tasks/filtering/FilterValidator.d.ts.map +1 -0
- package/dist/tools/tasks/filtering/FilterValidator.js +183 -0
- package/dist/tools/tasks/filtering/FilterValidator.js.map +1 -0
- package/dist/tools/tasks/filtering/TaskFilteringOrchestrator.d.ts +75 -0
- package/dist/tools/tasks/filtering/TaskFilteringOrchestrator.d.ts.map +1 -0
- package/dist/tools/tasks/filtering/TaskFilteringOrchestrator.js +193 -0
- package/dist/tools/tasks/filtering/TaskFilteringOrchestrator.js.map +1 -0
- package/dist/tools/tasks/filtering/evaluators.d.ts +38 -0
- package/dist/tools/tasks/filtering/evaluators.d.ts.map +1 -0
- package/dist/tools/tasks/filtering/evaluators.js +200 -0
- package/dist/tools/tasks/filtering/evaluators.js.map +1 -0
- package/dist/tools/tasks/filtering/index.d.ts +11 -0
- package/dist/tools/tasks/filtering/index.d.ts.map +1 -0
- package/dist/tools/tasks/filtering/index.js +26 -0
- package/dist/tools/tasks/filtering/index.js.map +1 -0
- package/dist/tools/tasks/index.d.ts +9 -0
- package/dist/tools/tasks/index.d.ts.map +1 -0
- package/dist/tools/tasks/index.js +245 -0
- package/dist/tools/tasks/index.js.map +1 -0
- package/dist/tools/tasks/labels.d.ts +39 -0
- package/dist/tools/tasks/labels.d.ts.map +1 -0
- package/dist/tools/tasks/labels.js +150 -0
- package/dist/tools/tasks/labels.js.map +1 -0
- package/dist/tools/tasks/reminders.d.ts +39 -0
- package/dist/tools/tasks/reminders.d.ts.map +1 -0
- package/dist/tools/tasks/reminders.js +147 -0
- package/dist/tools/tasks/reminders.js.map +1 -0
- package/dist/tools/tasks/types/filters.d.ts +121 -0
- package/dist/tools/tasks/types/filters.d.ts.map +1 -0
- package/dist/tools/tasks/types/filters.js +7 -0
- package/dist/tools/tasks/types/filters.js.map +1 -0
- package/dist/tools/tasks/validation.d.ts +44 -0
- package/dist/tools/tasks/validation.d.ts.map +1 -0
- package/dist/tools/tasks/validation.js +121 -0
- package/dist/tools/tasks/validation.js.map +1 -0
- package/dist/tools/tasks-relations.d.ts +24 -0
- package/dist/tools/tasks-relations.d.ts.map +1 -0
- package/dist/tools/tasks-relations.js +203 -0
- package/dist/tools/tasks-relations.js.map +1 -0
- package/dist/tools/tasks.d.ts +6 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/tools/tasks.js +10 -0
- package/dist/tools/tasks.js.map +1 -0
- package/dist/tools/teams.d.ts +9 -0
- package/dist/tools/teams.d.ts.map +1 -0
- package/dist/tools/teams.js +332 -0
- package/dist/tools/teams.js.map +1 -0
- package/dist/tools/templates.d.ts +9 -0
- package/dist/tools/templates.d.ts.map +1 -0
- package/dist/tools/templates.js +356 -0
- package/dist/tools/templates.js.map +1 -0
- package/dist/tools/users.d.ts +9 -0
- package/dist/tools/users.d.ts.map +1 -0
- package/dist/tools/users.js +239 -0
- package/dist/tools/users.js.map +1 -0
- package/dist/tools/webhooks.d.ts +11 -0
- package/dist/tools/webhooks.d.ts.map +1 -0
- package/dist/tools/webhooks.js +378 -0
- package/dist/tools/webhooks.js.map +1 -0
- package/dist/transforms/base.d.ts +178 -0
- package/dist/transforms/base.d.ts.map +1 -0
- package/dist/transforms/base.js +134 -0
- package/dist/transforms/base.js.map +1 -0
- package/dist/transforms/field-selector.d.ts +27 -0
- package/dist/transforms/field-selector.d.ts.map +1 -0
- package/dist/transforms/field-selector.js +91 -0
- package/dist/transforms/field-selector.js.map +1 -0
- package/dist/transforms/task.d.ts +207 -0
- package/dist/transforms/task.d.ts.map +1 -0
- package/dist/transforms/task.js +259 -0
- package/dist/transforms/task.js.map +1 -0
- package/dist/types/errors.d.ts +55 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +44 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/filters.d.ts +146 -0
- package/dist/types/filters.d.ts.map +1 -0
- package/dist/types/filters.js +22 -0
- package/dist/types/filters.js.map +1 -0
- package/dist/types/index.d.ts +151 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +24 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/node-vikunja-extended.d.ts +36 -0
- package/dist/types/node-vikunja-extended.d.ts.map +1 -0
- package/dist/types/node-vikunja-extended.js +25 -0
- package/dist/types/node-vikunja-extended.js.map +1 -0
- package/dist/types/responses.d.ts +118 -0
- package/dist/types/responses.d.ts.map +1 -0
- package/dist/types/responses.js +26 -0
- package/dist/types/responses.js.map +1 -0
- package/dist/types/vikunja.d.ts +315 -0
- package/dist/types/vikunja.d.ts.map +1 -0
- package/dist/types/vikunja.js +7 -0
- package/dist/types/vikunja.js.map +1 -0
- package/dist/utils/auth-error-handler.d.ts +23 -0
- package/dist/utils/auth-error-handler.d.ts.map +1 -0
- package/dist/utils/auth-error-handler.js +162 -0
- package/dist/utils/auth-error-handler.js.map +1 -0
- package/dist/utils/error-handler.d.ts +38 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +288 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/filtering/ClientSideFilteringStrategy.d.ts +13 -0
- package/dist/utils/filtering/ClientSideFilteringStrategy.d.ts.map +1 -0
- package/dist/utils/filtering/ClientSideFilteringStrategy.js +63 -0
- package/dist/utils/filtering/ClientSideFilteringStrategy.js.map +1 -0
- package/dist/utils/filtering/FilteringContext.d.ts +27 -0
- package/dist/utils/filtering/FilteringContext.d.ts.map +1 -0
- package/dist/utils/filtering/FilteringContext.js +43 -0
- package/dist/utils/filtering/FilteringContext.js.map +1 -0
- package/dist/utils/filtering/HybridFilteringStrategy.d.ts +15 -0
- package/dist/utils/filtering/HybridFilteringStrategy.d.ts.map +1 -0
- package/dist/utils/filtering/HybridFilteringStrategy.js +55 -0
- package/dist/utils/filtering/HybridFilteringStrategy.js.map +1 -0
- package/dist/utils/filtering/ServerSideFilteringStrategy.d.ts +13 -0
- package/dist/utils/filtering/ServerSideFilteringStrategy.d.ts.map +1 -0
- package/dist/utils/filtering/ServerSideFilteringStrategy.js +64 -0
- package/dist/utils/filtering/ServerSideFilteringStrategy.js.map +1 -0
- package/dist/utils/filtering/TaskFilteringStrategy.d.ts +19 -0
- package/dist/utils/filtering/TaskFilteringStrategy.d.ts.map +1 -0
- package/dist/utils/filtering/TaskFilteringStrategy.js +10 -0
- package/dist/utils/filtering/TaskFilteringStrategy.js.map +1 -0
- package/dist/utils/filtering/index.d.ts +13 -0
- package/dist/utils/filtering/index.d.ts.map +1 -0
- package/dist/utils/filtering/index.js +20 -0
- package/dist/utils/filtering/index.js.map +1 -0
- package/dist/utils/filtering/types.d.ts +62 -0
- package/dist/utils/filtering/types.d.ts.map +1 -0
- package/dist/utils/filtering/types.js +6 -0
- package/dist/utils/filtering/types.js.map +1 -0
- package/dist/utils/filters.d.ts +97 -0
- package/dist/utils/filters.d.ts.map +1 -0
- package/dist/utils/filters.js +939 -0
- package/dist/utils/filters.js.map +1 -0
- package/dist/utils/logger.d.ts +26 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +83 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/memory.d.ts +71 -0
- package/dist/utils/memory.d.ts.map +1 -0
- package/dist/utils/memory.js +194 -0
- package/dist/utils/memory.js.map +1 -0
- package/dist/utils/performance/batch-processor.d.ts +77 -0
- package/dist/utils/performance/batch-processor.d.ts.map +1 -0
- package/dist/utils/performance/batch-processor.js +218 -0
- package/dist/utils/performance/batch-processor.js.map +1 -0
- package/dist/utils/performance/index.d.ts +42 -0
- package/dist/utils/performance/index.d.ts.map +1 -0
- package/dist/utils/performance/index.js +49 -0
- package/dist/utils/performance/index.js.map +1 -0
- package/dist/utils/performance/performance-monitor.d.ts +116 -0
- package/dist/utils/performance/performance-monitor.d.ts.map +1 -0
- package/dist/utils/performance/performance-monitor.js +307 -0
- package/dist/utils/performance/performance-monitor.js.map +1 -0
- package/dist/utils/response-factory.d.ts +81 -0
- package/dist/utils/response-factory.d.ts.map +1 -0
- package/dist/utils/response-factory.js +86 -0
- package/dist/utils/response-factory.js.map +1 -0
- package/dist/utils/retry.d.ts +146 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +281 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/security.d.ts +70 -0
- package/dist/utils/security.d.ts.map +1 -0
- package/dist/utils/security.js +358 -0
- package/dist/utils/security.js.map +1 -0
- package/dist/utils/simple-response.d.ts +75 -0
- package/dist/utils/simple-response.d.ts.map +1 -0
- package/dist/utils/simple-response.js +208 -0
- package/dist/utils/simple-response.js.map +1 -0
- package/dist/utils/storage-errors.d.ts +9 -0
- package/dist/utils/storage-errors.d.ts.map +1 -0
- package/dist/utils/storage-errors.js +20 -0
- package/dist/utils/storage-errors.js.map +1 -0
- package/dist/utils/unicode-fix.d.ts +19 -0
- package/dist/utils/unicode-fix.d.ts.map +1 -0
- package/dist/utils/unicode-fix.js +70 -0
- package/dist/utils/unicode-fix.js.map +1 -0
- package/dist/utils/validation.d.ts +103 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +729 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +148 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CSV Parser utilities for parsing CSV formatted strings according to RFC 4180.
|
|
4
|
+
*
|
|
5
|
+
* This module provides functions to parse CSV lines with proper handling of:
|
|
6
|
+
* - Quoted fields containing commas
|
|
7
|
+
* - Escaped quotes within quoted fields (double quotes)
|
|
8
|
+
* - Empty fields
|
|
9
|
+
* - Whitespace trimming
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.parseCSVLine = parseCSVLine;
|
|
13
|
+
/**
|
|
14
|
+
* Parses a single CSV line into an array of fields.
|
|
15
|
+
*
|
|
16
|
+
* Implements RFC 4180 compliance:
|
|
17
|
+
* - Fields may be enclosed in double quotes
|
|
18
|
+
* - Fields containing commas, quotes, or newlines must be quoted
|
|
19
|
+
* - Quotes within fields are escaped by doubling them (""")
|
|
20
|
+
* - Empty fields are returned as empty strings
|
|
21
|
+
* - Leading/trailing whitespace is trimmed from unquoted fields
|
|
22
|
+
*
|
|
23
|
+
* @param line - The CSV line to parse
|
|
24
|
+
* @returns Array of parsed field values
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* parseCSVLine('title,description,done')
|
|
29
|
+
* // Returns: ['title', 'description', 'done']
|
|
30
|
+
*
|
|
31
|
+
* parseCSVLine('"Task with, comma","Description with ""quotes""",true')
|
|
32
|
+
* // Returns: ['Task with, comma', 'Description with "quotes"', 'true']
|
|
33
|
+
*
|
|
34
|
+
* parseCSVLine('simple,"quoted, with, commas",unquoted')
|
|
35
|
+
* // Returns: ['simple', 'quoted, with, commas', 'unquoted']
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
function parseCSVLine(line) {
|
|
39
|
+
const result = [];
|
|
40
|
+
let current = '';
|
|
41
|
+
let inQuotes = false;
|
|
42
|
+
for (let i = 0; i < line.length; i++) {
|
|
43
|
+
const char = line[i];
|
|
44
|
+
const nextChar = line[i + 1];
|
|
45
|
+
if (char === '"') {
|
|
46
|
+
if (inQuotes && nextChar === '"') {
|
|
47
|
+
// Escaped quote
|
|
48
|
+
current += '"';
|
|
49
|
+
i++; // Skip next quote
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// Toggle quote mode
|
|
53
|
+
inQuotes = !inQuotes;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else if (char === ',' && !inQuotes) {
|
|
57
|
+
// End of field
|
|
58
|
+
result.push(current.trim());
|
|
59
|
+
current = '';
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
current += char;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Don't forget the last field
|
|
66
|
+
result.push(current.trim());
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=CSVParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CSVParser.js","sourceRoot":"","sources":["../../src/parsers/CSVParser.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AA2BH,oCA8BC;AAvDD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,YAAY,CAAC,IAAY;IACvC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACrB,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAE7B,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACjB,IAAI,QAAQ,IAAI,QAAQ,KAAK,GAAG,EAAE,CAAC;gBACjC,gBAAgB;gBAChB,OAAO,IAAI,GAAG,CAAC;gBACf,CAAC,EAAE,CAAC,CAAC,kBAAkB;YACzB,CAAC;iBAAM,CAAC;gBACN,oBAAoB;gBACpB,QAAQ,GAAG,CAAC,QAAQ,CAAC;YACvB,CAAC;QACH,CAAC;aAAM,IAAI,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YACrC,eAAe;YACf,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;YAC5B,OAAO,GAAG,EAAE,CAAC;QACf,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,IAAI,CAAC;QAClB,CAAC;IACH,CAAC;IAED,8BAA8B;IAC9B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5B,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ImportedTask } from './JSONParser';
|
|
2
|
+
export interface ParseInputOptions {
|
|
3
|
+
format: 'csv' | 'json';
|
|
4
|
+
data: string;
|
|
5
|
+
skipErrors?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export type { ImportedTask } from './JSONParser';
|
|
8
|
+
/**
|
|
9
|
+
* Factory function to parse input data based on format.
|
|
10
|
+
* This centralizes format detection and parser orchestration logic.
|
|
11
|
+
*
|
|
12
|
+
* @param options - Parsing options including format, data, and error handling
|
|
13
|
+
* @returns Array of parsed and validated ImportedTask objects
|
|
14
|
+
* @throws MCPError if parsing fails or validation errors occur
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseInputData(options: ParseInputOptions): ImportedTask[];
|
|
17
|
+
//# sourceMappingURL=InputParserFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputParserFactory.d.ts","sourceRoot":"","sources":["../../src/parsers/InputParserFactory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsC,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAGrF,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAGD,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,YAAY,EAAE,CAuCzE"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseInputData = parseInputData;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const CSVParser_1 = require("./CSVParser");
|
|
6
|
+
const JSONParser_1 = require("./JSONParser");
|
|
7
|
+
const logger_1 = require("../utils/logger");
|
|
8
|
+
/**
|
|
9
|
+
* Factory function to parse input data based on format.
|
|
10
|
+
* This centralizes format detection and parser orchestration logic.
|
|
11
|
+
*
|
|
12
|
+
* @param options - Parsing options including format, data, and error handling
|
|
13
|
+
* @returns Array of parsed and validated ImportedTask objects
|
|
14
|
+
* @throws MCPError if parsing fails or validation errors occur
|
|
15
|
+
*/
|
|
16
|
+
function parseInputData(options) {
|
|
17
|
+
const { format, data, skipErrors = false } = options;
|
|
18
|
+
// Validate input parameters
|
|
19
|
+
if (!data || data.trim() === '') {
|
|
20
|
+
throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, 'Input data cannot be empty');
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
switch (format) {
|
|
24
|
+
case 'json':
|
|
25
|
+
return (0, JSONParser_1.parseJSONInput)(data);
|
|
26
|
+
case 'csv':
|
|
27
|
+
return parseCSVInput(data, skipErrors);
|
|
28
|
+
default: {
|
|
29
|
+
// Use format directly for error message
|
|
30
|
+
throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, `Unsupported format: ${String(format)}. Supported formats are: csv, json`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
// Re-throw MCP errors as-is
|
|
36
|
+
if (error instanceof types_1.MCPError) {
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
// Wrap other errors in MCPError
|
|
40
|
+
throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, `Failed to parse ${format} input: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Parse CSV input data and return array of ImportedTask objects.
|
|
45
|
+
* Extracted from batch-import.ts to improve modularity and testability.
|
|
46
|
+
*
|
|
47
|
+
* @param data - Raw CSV string data
|
|
48
|
+
* @param skipErrors - Whether to skip invalid rows or throw an error
|
|
49
|
+
* @returns Array of parsed and validated ImportedTask objects
|
|
50
|
+
* @throws MCPError if CSV structure is invalid or validation fails (when skipErrors=false)
|
|
51
|
+
*/
|
|
52
|
+
function parseCSVInput(data, skipErrors = false) {
|
|
53
|
+
const tasks = [];
|
|
54
|
+
// Split into lines and filter out empty lines
|
|
55
|
+
const lines = data.split('\n').filter((line) => line.trim());
|
|
56
|
+
if (lines.length < 2) {
|
|
57
|
+
throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, 'CSV must have at least a header row and one data row');
|
|
58
|
+
}
|
|
59
|
+
// Parse header
|
|
60
|
+
const headers = (0, CSVParser_1.parseCSVLine)(lines[0] || '');
|
|
61
|
+
const requiredHeaders = ['title'];
|
|
62
|
+
const missingHeaders = requiredHeaders.filter((h) => !headers.includes(h));
|
|
63
|
+
if (missingHeaders.length > 0) {
|
|
64
|
+
throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, `Missing required CSV headers: ${missingHeaders.join(', ')}`);
|
|
65
|
+
}
|
|
66
|
+
// Parse data rows
|
|
67
|
+
for (let i = 1; i < lines.length; i++) {
|
|
68
|
+
const values = (0, CSVParser_1.parseCSVLine)(lines[i] || '');
|
|
69
|
+
// Skip empty rows
|
|
70
|
+
if (values.every((value) => !value || value.trim() === '')) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const taskData = {};
|
|
74
|
+
headers.forEach((header, index) => {
|
|
75
|
+
const value = values[index];
|
|
76
|
+
if (value) {
|
|
77
|
+
switch (header) {
|
|
78
|
+
case 'title':
|
|
79
|
+
taskData.title = value;
|
|
80
|
+
break;
|
|
81
|
+
case 'description':
|
|
82
|
+
taskData.description = value;
|
|
83
|
+
break;
|
|
84
|
+
case 'done':
|
|
85
|
+
taskData.done = value.toLowerCase() === 'true';
|
|
86
|
+
break;
|
|
87
|
+
case 'dueDate':
|
|
88
|
+
taskData.dueDate = value;
|
|
89
|
+
break;
|
|
90
|
+
case 'priority':
|
|
91
|
+
taskData.priority = parseInt(value, 10);
|
|
92
|
+
break;
|
|
93
|
+
case 'labels':
|
|
94
|
+
taskData.labels = value ? value.split(';').map((l) => l.trim()).filter((l) => l.length > 0) : [];
|
|
95
|
+
logger_1.logger.debug('Parsed labels from CSV', {
|
|
96
|
+
rawValue: value,
|
|
97
|
+
parsedLabels: taskData.labels,
|
|
98
|
+
});
|
|
99
|
+
break;
|
|
100
|
+
case 'assignees':
|
|
101
|
+
taskData.assignees = value ? value.split(';').map((a) => a.trim()).filter((a) => a.length > 0) : [];
|
|
102
|
+
break;
|
|
103
|
+
case 'startDate':
|
|
104
|
+
taskData.startDate = value;
|
|
105
|
+
break;
|
|
106
|
+
case 'endDate':
|
|
107
|
+
taskData.endDate = value;
|
|
108
|
+
break;
|
|
109
|
+
case 'hexColor':
|
|
110
|
+
taskData.hexColor = value;
|
|
111
|
+
break;
|
|
112
|
+
case 'percentDone':
|
|
113
|
+
taskData.percentDone = parseInt(value, 10);
|
|
114
|
+
break;
|
|
115
|
+
case 'repeatAfter':
|
|
116
|
+
taskData.repeatAfter = parseInt(value, 10);
|
|
117
|
+
break;
|
|
118
|
+
case 'repeatMode':
|
|
119
|
+
taskData.repeatMode = parseInt(value, 10);
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
try {
|
|
125
|
+
const validatedTask = JSONParser_1.importedTaskSchema.parse(taskData);
|
|
126
|
+
tasks.push(validatedTask);
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
if (!skipErrors) {
|
|
130
|
+
throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, `Invalid task data at row ${i + 1}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
131
|
+
}
|
|
132
|
+
// If skipErrors is true, we skip this row and continue
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return tasks;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=InputParserFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputParserFactory.js","sourceRoot":"","sources":["../../src/parsers/InputParserFactory.ts"],"names":[],"mappings":";;AAsBA,wCAuCC;AA7DD,oCAA+C;AAC/C,2CAA2C;AAC3C,6CAAqF;AACrF,4CAAyC;AAWzC;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,OAA0B;IACvD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAErD,4BAA4B;IAC5B,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAChC,MAAM,IAAI,gBAAQ,CAChB,iBAAS,CAAC,gBAAgB,EAC1B,4BAA4B,CAC7B,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,MAAM;gBACT,OAAO,IAAA,2BAAc,EAAC,IAAI,CAAC,CAAC;YAE9B,KAAK,KAAK;gBACR,OAAO,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YAEzC,OAAO,CAAC,CAAC,CAAC;gBACR,wCAAwC;gBACxC,MAAM,IAAI,gBAAQ,CAChB,iBAAS,CAAC,gBAAgB,EAC1B,uBAAuB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AC;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,+BAAkB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACzD,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC5B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,MAAM,IAAI,gBAAQ,CAChB,iBAAS,CAAC,gBAAgB,EAC1B,4BAA4B,CAAC,GAAG,CAAC,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CACjG,CAAC;YACJ,CAAC;YACD,uDAAuD;QACzD,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema for validating imported task data from JSON
|
|
4
|
+
* Defines the structure and validation rules for task objects
|
|
5
|
+
*/
|
|
6
|
+
export declare const importedTaskSchema: z.ZodObject<{
|
|
7
|
+
title: z.ZodString;
|
|
8
|
+
description: z.ZodOptional<z.ZodString>;
|
|
9
|
+
done: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
dueDate: z.ZodOptional<z.ZodString>;
|
|
11
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
13
|
+
assignees: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
14
|
+
startDate: z.ZodOptional<z.ZodString>;
|
|
15
|
+
endDate: z.ZodOptional<z.ZodString>;
|
|
16
|
+
hexColor: z.ZodOptional<z.ZodString>;
|
|
17
|
+
percentDone: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
repeatAfter: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
repeatMode: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
reminders: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
21
|
+
}, "strict", z.ZodTypeAny, {
|
|
22
|
+
title: string;
|
|
23
|
+
done?: boolean | undefined;
|
|
24
|
+
priority?: number | undefined;
|
|
25
|
+
description?: string | undefined;
|
|
26
|
+
labels?: string[] | undefined;
|
|
27
|
+
percentDone?: number | undefined;
|
|
28
|
+
dueDate?: string | undefined;
|
|
29
|
+
assignees?: string[] | undefined;
|
|
30
|
+
reminders?: string[] | undefined;
|
|
31
|
+
repeatAfter?: number | undefined;
|
|
32
|
+
repeatMode?: number | undefined;
|
|
33
|
+
hexColor?: string | undefined;
|
|
34
|
+
startDate?: string | undefined;
|
|
35
|
+
endDate?: string | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
title: string;
|
|
38
|
+
done?: boolean | undefined;
|
|
39
|
+
priority?: number | undefined;
|
|
40
|
+
description?: string | undefined;
|
|
41
|
+
labels?: string[] | undefined;
|
|
42
|
+
percentDone?: number | undefined;
|
|
43
|
+
dueDate?: string | undefined;
|
|
44
|
+
assignees?: string[] | undefined;
|
|
45
|
+
reminders?: string[] | undefined;
|
|
46
|
+
repeatAfter?: number | undefined;
|
|
47
|
+
repeatMode?: number | undefined;
|
|
48
|
+
hexColor?: string | undefined;
|
|
49
|
+
startDate?: string | undefined;
|
|
50
|
+
endDate?: string | undefined;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* TypeScript type inferred from the importedTaskSchema
|
|
54
|
+
* Represents a valid task object that can be imported
|
|
55
|
+
*/
|
|
56
|
+
export type ImportedTask = z.infer<typeof importedTaskSchema>;
|
|
57
|
+
/**
|
|
58
|
+
* Parses JSON input and normalizes to array of ImportedTask objects.
|
|
59
|
+
* Handles both single task objects and arrays of tasks.
|
|
60
|
+
* Validates each task against importedTaskSchema.
|
|
61
|
+
*
|
|
62
|
+
* @param data - JSON string containing task data
|
|
63
|
+
* @returns Array of validated ImportedTask objects
|
|
64
|
+
* @throws {MCPError} If JSON is malformed or validation fails
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* parseJSONInput('{"title": "Task 1"}')
|
|
68
|
+
* // Returns: [{title: "Task 1"}]
|
|
69
|
+
*
|
|
70
|
+
* parseJSONInput('[{"title": "Task 1"}, {"title": "Task 2"}]')
|
|
71
|
+
* // Returns: [{title: "Task 1"}, {title: "Task 2"}]
|
|
72
|
+
*/
|
|
73
|
+
export declare function parseJSONInput(data: string): ImportedTask[];
|
|
74
|
+
//# sourceMappingURL=JSONParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSONParser.d.ts","sourceRoot":"","sources":["../../src/parsers/JSONParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBpB,CAAC;AAEZ;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAO9D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,CAiB3D"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.importedTaskSchema = void 0;
|
|
4
|
+
exports.parseJSONInput = parseJSONInput;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const types_1 = require("../types");
|
|
7
|
+
/* ===================================================================
|
|
8
|
+
* TYPE DEFINITIONS & SCHEMAS
|
|
9
|
+
* Zod schemas and TypeScript interfaces for imported tasks from JSON
|
|
10
|
+
* =================================================================== */
|
|
11
|
+
/**
|
|
12
|
+
* Zod schema for validating imported task data from JSON
|
|
13
|
+
* Defines the structure and validation rules for task objects
|
|
14
|
+
*/
|
|
15
|
+
exports.importedTaskSchema = zod_1.z.object({
|
|
16
|
+
title: zod_1.z.string().min(1),
|
|
17
|
+
description: zod_1.z.string().optional(),
|
|
18
|
+
done: zod_1.z.boolean().optional(),
|
|
19
|
+
dueDate: zod_1.z.string().optional(),
|
|
20
|
+
priority: zod_1.z.number().optional(),
|
|
21
|
+
labels: zod_1.z.array(zod_1.z.string()).optional(),
|
|
22
|
+
assignees: zod_1.z.array(zod_1.z.string()).optional(),
|
|
23
|
+
startDate: zod_1.z.string().optional(),
|
|
24
|
+
endDate: zod_1.z.string().optional(),
|
|
25
|
+
hexColor: zod_1.z
|
|
26
|
+
.string()
|
|
27
|
+
.regex(/^#[0-9A-Fa-f]{6}$/)
|
|
28
|
+
.optional(),
|
|
29
|
+
percentDone: zod_1.z.number().min(0).max(100).optional(),
|
|
30
|
+
repeatAfter: zod_1.z.number().optional(),
|
|
31
|
+
repeatMode: zod_1.z.number().optional(),
|
|
32
|
+
reminders: zod_1.z.array(zod_1.z.string()).optional(),
|
|
33
|
+
}).strict(); // Reject unknown properties
|
|
34
|
+
/* ===================================================================
|
|
35
|
+
* JSON PARSING FUNCTIONS
|
|
36
|
+
* Functions for parsing and validating JSON input data
|
|
37
|
+
* =================================================================== */
|
|
38
|
+
/**
|
|
39
|
+
* Parses JSON input and normalizes to array of ImportedTask objects.
|
|
40
|
+
* Handles both single task objects and arrays of tasks.
|
|
41
|
+
* Validates each task against importedTaskSchema.
|
|
42
|
+
*
|
|
43
|
+
* @param data - JSON string containing task data
|
|
44
|
+
* @returns Array of validated ImportedTask objects
|
|
45
|
+
* @throws {MCPError} If JSON is malformed or validation fails
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* parseJSONInput('{"title": "Task 1"}')
|
|
49
|
+
* // Returns: [{title: "Task 1"}]
|
|
50
|
+
*
|
|
51
|
+
* parseJSONInput('[{"title": "Task 1"}, {"title": "Task 2"}]')
|
|
52
|
+
* // Returns: [{title: "Task 1"}, {title: "Task 2"}]
|
|
53
|
+
*/
|
|
54
|
+
function parseJSONInput(data) {
|
|
55
|
+
try {
|
|
56
|
+
const parsed = JSON.parse(data);
|
|
57
|
+
const taskArray = Array.isArray(parsed) ? parsed : [parsed];
|
|
58
|
+
const tasks = [];
|
|
59
|
+
for (const task of taskArray) {
|
|
60
|
+
const validatedTask = exports.importedTaskSchema.parse(task);
|
|
61
|
+
tasks.push(validatedTask);
|
|
62
|
+
}
|
|
63
|
+
return tasks;
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, `Invalid JSON data: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=JSONParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSONParser.js","sourceRoot":"","sources":["../../src/parsers/JSONParser.ts"],"names":[],"mappings":";;;AA2DA,wCAiBC;AA5ED,6BAAwB;AACxB,oCAA+C;AAE/C;;;yEAGyE;AAEzE;;;GAGG;AACU,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,IAAI,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC5B,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACtC,SAAS,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE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iBAAS,CAAC,gBAAgB,EAC1B,sBAAsB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CACjF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entity Resolver Service
|
|
3
|
+
*
|
|
4
|
+
* Handles label and user resolution for batch import operations.
|
|
5
|
+
* This service encapsulates the complex logic for fetching entities from the Vikunja API,
|
|
6
|
+
* handling authentication errors, and creating name-to-ID mappings.
|
|
7
|
+
*/
|
|
8
|
+
import type { VikunjaClient, Label, User } from 'node-vikunja';
|
|
9
|
+
/**
|
|
10
|
+
* Result of entity resolution operations
|
|
11
|
+
*/
|
|
12
|
+
export interface EntityResolutionResult {
|
|
13
|
+
/** Map of lowercase label names to label IDs */
|
|
14
|
+
labelMap: Map<string, number>;
|
|
15
|
+
/** Map of lowercase usernames to user IDs */
|
|
16
|
+
userMap: Map<string, number>;
|
|
17
|
+
/** Whether user fetch failed due to known authentication issues */
|
|
18
|
+
userFetchFailedDueToAuth: boolean;
|
|
19
|
+
/** Raw labels array for reference */
|
|
20
|
+
projectLabels: Label[];
|
|
21
|
+
/** Raw users array for reference */
|
|
22
|
+
projectUsers: User[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Entity Resolver service for mapping label and user names to IDs
|
|
26
|
+
*/
|
|
27
|
+
export declare class EntityResolver {
|
|
28
|
+
/**
|
|
29
|
+
* Fetches labels and users from the Vikunja API and creates resolution maps
|
|
30
|
+
*
|
|
31
|
+
* This method handles the complex logic of:
|
|
32
|
+
* - Fetching labels with robust error handling for malformed responses
|
|
33
|
+
* - Fetching users with special handling for known Vikunja API authentication issues
|
|
34
|
+
* - Creating case-insensitive name-to-ID mappings
|
|
35
|
+
* - Providing comprehensive logging for debugging
|
|
36
|
+
*
|
|
37
|
+
* @param client - The Vikunja API client to use for fetching entities
|
|
38
|
+
* @returns Promise resolving to entity resolution results
|
|
39
|
+
*/
|
|
40
|
+
resolveEntities(client: VikunjaClient): Promise<EntityResolutionResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Fetch labels from the API with robust error handling
|
|
43
|
+
*
|
|
44
|
+
* Handles multiple edge cases:
|
|
45
|
+
* - null/undefined responses
|
|
46
|
+
* - Non-array responses
|
|
47
|
+
* - Network errors
|
|
48
|
+
* - Auth errors (less common for labels than users)
|
|
49
|
+
*
|
|
50
|
+
* @param client - The Vikunja API client
|
|
51
|
+
* @param result - The result object to update with fetched labels
|
|
52
|
+
*/
|
|
53
|
+
private fetchLabels;
|
|
54
|
+
/**
|
|
55
|
+
* Fetch users from the API with authentication error handling
|
|
56
|
+
*
|
|
57
|
+
* KNOWN VIKUNJA API ISSUE: Users endpoint often fails with API tokens.
|
|
58
|
+
* This is not a bug in our code - it's a documented Vikunja API limitation.
|
|
59
|
+
*
|
|
60
|
+
* @param client - The Vikunja API client
|
|
61
|
+
* @param result - The result object to update with fetched users
|
|
62
|
+
*/
|
|
63
|
+
private fetchUsers;
|
|
64
|
+
/**
|
|
65
|
+
* Create case-insensitive resolution maps from fetched entities
|
|
66
|
+
*
|
|
67
|
+
* This method is more defensive than the original batch-import.ts implementation.
|
|
68
|
+
* The original code would crash on undefined/null titles, but this implementation
|
|
69
|
+
* handles edge cases gracefully by converting them to unique string representations.
|
|
70
|
+
*
|
|
71
|
+
* @param result - The result object to update with resolution maps
|
|
72
|
+
*/
|
|
73
|
+
private createResolutionMaps;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=EntityResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityResolver.d.ts","sourceRoot":"","sources":["../../src/services/EntityResolver.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,gDAAgD;IAChD,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,6CAA6C;IAC7C,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,mEAAmE;IACnE,wBAAwB,EAAE,OAAO,CAAC;IAClC,qCAAqC;IACrC,aAAa,EAAE,KAAK,EAAE,CAAC;IACvB,oCAAoC;IACpC,YAAY,EAAE,IAAI,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,cAAc;IACzB;;;;;;;;;;;OAWG;IACG,eAAe,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAyB7E;;;;;;;;;;;OAWG;YACW,WAAW;IAwCzB;;;;;;;;OAQG;YACW,UAAU;IA2BxB;;;;;;;;OAQG;IACH,OAAO,CAAC,oBAAoB;CAuC7B"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Entity Resolver Service
|
|
4
|
+
*
|
|
5
|
+
* Handles label and user resolution for batch import operations.
|
|
6
|
+
* This service encapsulates the complex logic for fetching entities from the Vikunja API,
|
|
7
|
+
* handling authentication errors, and creating name-to-ID mappings.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.EntityResolver = void 0;
|
|
11
|
+
const logger_1 = require("../utils/logger");
|
|
12
|
+
const auth_error_handler_1 = require("../utils/auth-error-handler");
|
|
13
|
+
/**
|
|
14
|
+
* Entity Resolver service for mapping label and user names to IDs
|
|
15
|
+
*/
|
|
16
|
+
class EntityResolver {
|
|
17
|
+
/**
|
|
18
|
+
* Fetches labels and users from the Vikunja API and creates resolution maps
|
|
19
|
+
*
|
|
20
|
+
* This method handles the complex logic of:
|
|
21
|
+
* - Fetching labels with robust error handling for malformed responses
|
|
22
|
+
* - Fetching users with special handling for known Vikunja API authentication issues
|
|
23
|
+
* - Creating case-insensitive name-to-ID mappings
|
|
24
|
+
* - Providing comprehensive logging for debugging
|
|
25
|
+
*
|
|
26
|
+
* @param client - The Vikunja API client to use for fetching entities
|
|
27
|
+
* @returns Promise resolving to entity resolution results
|
|
28
|
+
*/
|
|
29
|
+
async resolveEntities(client) {
|
|
30
|
+
const result = {
|
|
31
|
+
labelMap: new Map(),
|
|
32
|
+
userMap: new Map(),
|
|
33
|
+
userFetchFailedDueToAuth: false,
|
|
34
|
+
projectLabels: [],
|
|
35
|
+
projectUsers: [],
|
|
36
|
+
};
|
|
37
|
+
await this.fetchLabels(client, result);
|
|
38
|
+
await this.fetchUsers(client, result);
|
|
39
|
+
this.createResolutionMaps(result);
|
|
40
|
+
// Log the final result for debugging
|
|
41
|
+
logger_1.logger.debug('Label and user maps created', {
|
|
42
|
+
labelMapSize: result.labelMap.size,
|
|
43
|
+
labelMapEntries: Array.from(result.labelMap.entries()),
|
|
44
|
+
userMapSize: result.userMap.size,
|
|
45
|
+
});
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Fetch labels from the API with robust error handling
|
|
50
|
+
*
|
|
51
|
+
* Handles multiple edge cases:
|
|
52
|
+
* - null/undefined responses
|
|
53
|
+
* - Non-array responses
|
|
54
|
+
* - Network errors
|
|
55
|
+
* - Auth errors (less common for labels than users)
|
|
56
|
+
*
|
|
57
|
+
* @param client - The Vikunja API client
|
|
58
|
+
* @param result - The result object to update with fetched labels
|
|
59
|
+
*/
|
|
60
|
+
async fetchLabels(client, result) {
|
|
61
|
+
try {
|
|
62
|
+
const labelsResponse = await client.labels.getLabels({});
|
|
63
|
+
// Handle potential null/undefined response
|
|
64
|
+
if (!labelsResponse) {
|
|
65
|
+
logger_1.logger.warn('Labels response is null/undefined');
|
|
66
|
+
result.projectLabels = [];
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
// Handle non-array responses
|
|
70
|
+
if (!Array.isArray(labelsResponse)) {
|
|
71
|
+
logger_1.logger.warn('Labels response is not an array', {
|
|
72
|
+
responseType: typeof labelsResponse,
|
|
73
|
+
response: labelsResponse,
|
|
74
|
+
});
|
|
75
|
+
result.projectLabels = [];
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
// Valid response
|
|
79
|
+
result.projectLabels = labelsResponse;
|
|
80
|
+
logger_1.logger.debug('Labels fetched', {
|
|
81
|
+
count: result.projectLabels.length,
|
|
82
|
+
labels: result.projectLabels.map((l) => ({ id: l.id ?? 0, title: l.title })),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
logger_1.logger.error('Failed to fetch labels', {
|
|
87
|
+
error: error instanceof Error ? error.message : String(error),
|
|
88
|
+
stack: error instanceof Error ? error.stack : undefined,
|
|
89
|
+
});
|
|
90
|
+
result.projectLabels = [];
|
|
91
|
+
// Continue without labels mapping
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Fetch users from the API with authentication error handling
|
|
96
|
+
*
|
|
97
|
+
* KNOWN VIKUNJA API ISSUE: Users endpoint often fails with API tokens.
|
|
98
|
+
* This is not a bug in our code - it's a documented Vikunja API limitation.
|
|
99
|
+
*
|
|
100
|
+
* @param client - The Vikunja API client
|
|
101
|
+
* @param result - The result object to update with fetched users
|
|
102
|
+
*/
|
|
103
|
+
async fetchUsers(client, result) {
|
|
104
|
+
try {
|
|
105
|
+
const usersResponse = await client.users.getUsers({});
|
|
106
|
+
result.projectUsers = usersResponse || [];
|
|
107
|
+
logger_1.logger.debug('Users fetched', { count: result.projectUsers.length });
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
// This is a known limitation with Vikunja API authentication
|
|
111
|
+
if ((0, auth_error_handler_1.isAuthenticationError)(error)) {
|
|
112
|
+
logger_1.logger.warn('Cannot fetch users due to known Vikunja API authentication issue. Assignees will be skipped.', {
|
|
113
|
+
error: error instanceof Error ? error.message : String(error),
|
|
114
|
+
});
|
|
115
|
+
result.userFetchFailedDueToAuth = true;
|
|
116
|
+
// Continue without user mapping - assignees will be ignored
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
// Some other error - log but continue
|
|
120
|
+
logger_1.logger.warn('Failed to fetch users', { error });
|
|
121
|
+
}
|
|
122
|
+
result.projectUsers = [];
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Create case-insensitive resolution maps from fetched entities
|
|
127
|
+
*
|
|
128
|
+
* This method is more defensive than the original batch-import.ts implementation.
|
|
129
|
+
* The original code would crash on undefined/null titles, but this implementation
|
|
130
|
+
* handles edge cases gracefully by converting them to unique string representations.
|
|
131
|
+
*
|
|
132
|
+
* @param result - The result object to update with resolution maps
|
|
133
|
+
*/
|
|
134
|
+
createResolutionMaps(result) {
|
|
135
|
+
// Create case-insensitive label name to ID map
|
|
136
|
+
result.labelMap = new Map((result.projectLabels || [])
|
|
137
|
+
.filter((label) => label !== null && label.id !== null)
|
|
138
|
+
.map((label) => {
|
|
139
|
+
let key;
|
|
140
|
+
if (!('title' in label)) {
|
|
141
|
+
key = '[missing]';
|
|
142
|
+
}
|
|
143
|
+
else if (label.title === null) {
|
|
144
|
+
key = '[null]';
|
|
145
|
+
}
|
|
146
|
+
else if (label.title === undefined) {
|
|
147
|
+
key = '[undefined]';
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
key = String(label.title).toLowerCase();
|
|
151
|
+
}
|
|
152
|
+
return [key, label.id];
|
|
153
|
+
}));
|
|
154
|
+
// Create case-insensitive username to ID map
|
|
155
|
+
result.userMap = new Map((result.projectUsers || [])
|
|
156
|
+
.filter((user) => user !== null && user.id !== null)
|
|
157
|
+
.map((user) => {
|
|
158
|
+
let key;
|
|
159
|
+
if (!('username' in user)) {
|
|
160
|
+
key = '[missing]';
|
|
161
|
+
}
|
|
162
|
+
else if (user.username === null) {
|
|
163
|
+
key = '[null]';
|
|
164
|
+
}
|
|
165
|
+
else if (user.username === undefined) {
|
|
166
|
+
key = '[undefined]';
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
key = String(user.username).toLowerCase();
|
|
170
|
+
}
|
|
171
|
+
return [key, user.id];
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
exports.EntityResolver = EntityResolver;
|
|
176
|
+
//# sourceMappingURL=EntityResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityResolver.js","sourceRoot":"","sources":["../../src/services/EntityResolver.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,4CAAyC;AACzC,oEAAoE;AAmBpE;;GAEG;AACH,MAAa,cAAc;IACzB;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,eAAe,CAAC,MAAqB;QACzC,MAAM,MAAM,GAA2B;YACrC,QAAQ,EAAE,IAAI,GAAG,EAAE;YACnB,OAAO,EAAE,IAAI,GAAG,EAAE;YAClB,wBAAwB,EAAE,KAAK;YAC/B,aAAa,EAAE,EAAE;YACjB,YAAY,EAAE,EAAE;SACjB,CAAC;QAEF,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAEvC,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAEtC,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;QAElC,qCAAqC;QACrC,eAAM,CAAC,KAAK,CAAC,6BAA6B,EAAE;YAC1C,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI;YAClC,eAAe,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACtD,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI;SACjC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;;;;;;;OAWG;IACK,KAAK,CAAC,WAAW,CACvB,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