fix: API compatibility with latest TaskNotes plugin (fixes #2) #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2 - HTTP 400 error when using CLI commands with the latest TaskNotes plugin.
Problem
The current TaskNotes plugin API has different behavior than expected by the CLI:
GET /api/taskswith query parameters returns HTTP 400POST /api/tasks/queryexists but returns 0 tasks regardless of filtersSolution
Implemented client-side filtering as a workaround:
Changes to
lib/api.js:listTasks(): Now usesGET /api/taskswithout params and filters client-sidequeryTasks(): Handles FilterParser AST format for advanced filtering client-sidesearchTasks(): Implements client-side title searchgetAllTasks(),evaluateGroup(),evaluateNode(),evaluateCondition()Changes to
commands/projects.js:[[wikilink]]format in project namesshowProject()andshowProjectStats()now properly match tasks to projectsTesting
Tested with TaskNotes plugin v4.2.1. All CLI commands now work correctly:
tn list(with all filter options:--today,--completed,--overdue,--filter)tn searchtn projects list/show/stats