@doist/todoist-api-typescript 7.9.1 → 7.10.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/README.md +5 -204
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.mjs +1 -0
- package/package.json +12 -92
- package/LICENSE +0 -21
- package/dist/cjs/authentication.js +0 -204
- package/dist/cjs/consts/endpoints.js +0 -141
- package/dist/cjs/index.js +0 -20
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/test-utils/asserts.js +0 -11
- package/dist/cjs/test-utils/msw-setup.js +0 -97
- package/dist/cjs/test-utils/obsidian-fetch-adapter.js +0 -53
- package/dist/cjs/test-utils/test-defaults.js +0 -240
- package/dist/cjs/todoist-api.js +0 -2623
- package/dist/cjs/transport/fetch-with-retry.js +0 -206
- package/dist/cjs/transport/http-client.js +0 -133
- package/dist/cjs/transport/http-dispatcher.js +0 -72
- package/dist/cjs/types/activity/index.js +0 -18
- package/dist/cjs/types/activity/requests.js +0 -2
- package/dist/cjs/types/activity/types.js +0 -28
- package/dist/cjs/types/backups/index.js +0 -18
- package/dist/cjs/types/backups/requests.js +0 -2
- package/dist/cjs/types/backups/types.js +0 -8
- package/dist/cjs/types/comments/index.js +0 -18
- package/dist/cjs/types/comments/requests.js +0 -2
- package/dist/cjs/types/comments/types.js +0 -60
- package/dist/cjs/types/common.js +0 -10
- package/dist/cjs/types/emails/index.js +0 -17
- package/dist/cjs/types/emails/requests.js +0 -5
- package/dist/cjs/types/errors.js +0 -29
- package/dist/cjs/types/folders/index.js +0 -17
- package/dist/cjs/types/folders/requests.js +0 -2
- package/dist/cjs/types/http.js +0 -24
- package/dist/cjs/types/id-mappings/index.js +0 -18
- package/dist/cjs/types/id-mappings/requests.js +0 -20
- package/dist/cjs/types/id-mappings/types.js +0 -12
- package/dist/cjs/types/index.js +0 -36
- package/dist/cjs/types/insights/index.js +0 -18
- package/dist/cjs/types/insights/requests.js +0 -2
- package/dist/cjs/types/insights/types.js +0 -84
- package/dist/cjs/types/labels/index.js +0 -18
- package/dist/cjs/types/labels/requests.js +0 -2
- package/dist/cjs/types/labels/types.js +0 -11
- package/dist/cjs/types/productivity/index.js +0 -17
- package/dist/cjs/types/productivity/types.js +0 -67
- package/dist/cjs/types/projects/index.js +0 -18
- package/dist/cjs/types/projects/requests.js +0 -2
- package/dist/cjs/types/projects/types.js +0 -56
- package/dist/cjs/types/reminders/index.js +0 -17
- package/dist/cjs/types/reminders/requests.js +0 -95
- package/dist/cjs/types/sections/index.js +0 -18
- package/dist/cjs/types/sections/requests.js +0 -2
- package/dist/cjs/types/sections/types.js +0 -22
- package/dist/cjs/types/sync/commands/calendars.js +0 -2
- package/dist/cjs/types/sync/commands/filters.js +0 -2
- package/dist/cjs/types/sync/commands/folders.js +0 -2
- package/dist/cjs/types/sync/commands/index.js +0 -35
- package/dist/cjs/types/sync/commands/labels.js +0 -5
- package/dist/cjs/types/sync/commands/notes.js +0 -2
- package/dist/cjs/types/sync/commands/notifications.js +0 -2
- package/dist/cjs/types/sync/commands/others.js +0 -2
- package/dist/cjs/types/sync/commands/project-view-options.js +0 -2
- package/dist/cjs/types/sync/commands/projects.js +0 -2
- package/dist/cjs/types/sync/commands/reminders.js +0 -2
- package/dist/cjs/types/sync/commands/sections.js +0 -2
- package/dist/cjs/types/sync/commands/shared.js +0 -20
- package/dist/cjs/types/sync/commands/sharing.js +0 -2
- package/dist/cjs/types/sync/commands/tasks.js +0 -2
- package/dist/cjs/types/sync/commands/view-options.js +0 -2
- package/dist/cjs/types/sync/commands/workspace-filters.js +0 -2
- package/dist/cjs/types/sync/commands/workspace-goals.js +0 -2
- package/dist/cjs/types/sync/commands/workspaces.js +0 -2
- package/dist/cjs/types/sync/index.js +0 -22
- package/dist/cjs/types/sync/request.js +0 -2
- package/dist/cjs/types/sync/resource-types.js +0 -40
- package/dist/cjs/types/sync/resources/calendars.js +0 -31
- package/dist/cjs/types/sync/resources/collaborators.js +0 -25
- package/dist/cjs/types/sync/resources/completed-info.js +0 -30
- package/dist/cjs/types/sync/resources/filters.js +0 -16
- package/dist/cjs/types/sync/resources/folders.js +0 -14
- package/dist/cjs/types/sync/resources/index.js +0 -33
- package/dist/cjs/types/sync/resources/live-notifications.js +0 -39
- package/dist/cjs/types/sync/resources/notes.js +0 -23
- package/dist/cjs/types/sync/resources/reminders.js +0 -50
- package/dist/cjs/types/sync/resources/suggestions.js +0 -42
- package/dist/cjs/types/sync/resources/tooltips.js +0 -10
- package/dist/cjs/types/sync/resources/user-plan-limits.js +0 -24
- package/dist/cjs/types/sync/resources/user-settings.js +0 -42
- package/dist/cjs/types/sync/resources/user.js +0 -120
- package/dist/cjs/types/sync/resources/view-options.js +0 -83
- package/dist/cjs/types/sync/resources/workspace-filters.js +0 -21
- package/dist/cjs/types/sync/resources/workspace-goals.js +0 -32
- package/dist/cjs/types/sync/resources/workspaces.js +0 -73
- package/dist/cjs/types/sync/response.js +0 -2
- package/dist/cjs/types/sync/user-preferences.js +0 -71
- package/dist/cjs/types/tasks/index.js +0 -18
- package/dist/cjs/types/tasks/requests.js +0 -2
- package/dist/cjs/types/tasks/types.js +0 -59
- package/dist/cjs/types/templates/index.js +0 -17
- package/dist/cjs/types/templates/requests.js +0 -2
- package/dist/cjs/types/uploads/index.js +0 -17
- package/dist/cjs/types/uploads/requests.js +0 -2
- package/dist/cjs/types/users/index.js +0 -17
- package/dist/cjs/types/users/types.js +0 -51
- package/dist/cjs/types/workspaces/index.js +0 -18
- package/dist/cjs/types/workspaces/requests.js +0 -2
- package/dist/cjs/types/workspaces/types.js +0 -155
- package/dist/cjs/utils/activity-helpers.js +0 -58
- package/dist/cjs/utils/case-conversion.js +0 -69
- package/dist/cjs/utils/colors.js +0 -143
- package/dist/cjs/utils/index.js +0 -25
- package/dist/cjs/utils/multipart-upload.js +0 -178
- package/dist/cjs/utils/processing-helpers.js +0 -18
- package/dist/cjs/utils/sanitization.js +0 -116
- package/dist/cjs/utils/sync-helpers.js +0 -22
- package/dist/cjs/utils/uncompletable-helpers.js +0 -60
- package/dist/cjs/utils/url-helpers.js +0 -74
- package/dist/cjs/utils/validators.js +0 -141
- package/dist/esm/authentication.js +0 -196
- package/dist/esm/consts/endpoints.js +0 -122
- package/dist/esm/index.js +0 -4
- package/dist/esm/test-utils/asserts.js +0 -8
- package/dist/esm/test-utils/msw-setup.js +0 -88
- package/dist/esm/test-utils/obsidian-fetch-adapter.js +0 -50
- package/dist/esm/test-utils/test-defaults.js +0 -237
- package/dist/esm/todoist-api.js +0 -2619
- package/dist/esm/transport/fetch-with-retry.js +0 -203
- package/dist/esm/transport/http-client.js +0 -128
- package/dist/esm/transport/http-dispatcher.js +0 -35
- package/dist/esm/types/activity/index.js +0 -2
- package/dist/esm/types/activity/requests.js +0 -1
- package/dist/esm/types/activity/types.js +0 -25
- package/dist/esm/types/backups/index.js +0 -2
- package/dist/esm/types/backups/requests.js +0 -1
- package/dist/esm/types/backups/types.js +0 -5
- package/dist/esm/types/comments/index.js +0 -2
- package/dist/esm/types/comments/requests.js +0 -1
- package/dist/esm/types/comments/types.js +0 -57
- package/dist/esm/types/common.js +0 -7
- package/dist/esm/types/emails/index.js +0 -1
- package/dist/esm/types/emails/requests.js +0 -2
- package/dist/esm/types/errors.js +0 -24
- package/dist/esm/types/folders/index.js +0 -1
- package/dist/esm/types/folders/requests.js +0 -1
- package/dist/esm/types/http.js +0 -20
- package/dist/esm/types/id-mappings/index.js +0 -2
- package/dist/esm/types/id-mappings/requests.js +0 -17
- package/dist/esm/types/id-mappings/types.js +0 -9
- package/dist/esm/types/index.js +0 -20
- package/dist/esm/types/insights/index.js +0 -2
- package/dist/esm/types/insights/requests.js +0 -1
- package/dist/esm/types/insights/types.js +0 -81
- package/dist/esm/types/labels/index.js +0 -2
- package/dist/esm/types/labels/requests.js +0 -1
- package/dist/esm/types/labels/types.js +0 -8
- package/dist/esm/types/productivity/index.js +0 -1
- package/dist/esm/types/productivity/types.js +0 -64
- package/dist/esm/types/projects/index.js +0 -2
- package/dist/esm/types/projects/requests.js +0 -1
- package/dist/esm/types/projects/types.js +0 -53
- package/dist/esm/types/reminders/index.js +0 -1
- package/dist/esm/types/reminders/requests.js +0 -92
- package/dist/esm/types/sections/index.js +0 -2
- package/dist/esm/types/sections/requests.js +0 -1
- package/dist/esm/types/sections/types.js +0 -19
- package/dist/esm/types/sync/commands/calendars.js +0 -1
- package/dist/esm/types/sync/commands/filters.js +0 -1
- package/dist/esm/types/sync/commands/folders.js +0 -1
- package/dist/esm/types/sync/commands/index.js +0 -19
- package/dist/esm/types/sync/commands/labels.js +0 -2
- package/dist/esm/types/sync/commands/notes.js +0 -1
- package/dist/esm/types/sync/commands/notifications.js +0 -1
- package/dist/esm/types/sync/commands/others.js +0 -1
- package/dist/esm/types/sync/commands/project-view-options.js +0 -1
- package/dist/esm/types/sync/commands/projects.js +0 -1
- package/dist/esm/types/sync/commands/reminders.js +0 -1
- package/dist/esm/types/sync/commands/sections.js +0 -1
- package/dist/esm/types/sync/commands/shared.js +0 -16
- package/dist/esm/types/sync/commands/sharing.js +0 -1
- package/dist/esm/types/sync/commands/tasks.js +0 -1
- package/dist/esm/types/sync/commands/view-options.js +0 -1
- package/dist/esm/types/sync/commands/workspace-filters.js +0 -1
- package/dist/esm/types/sync/commands/workspace-goals.js +0 -1
- package/dist/esm/types/sync/commands/workspaces.js +0 -1
- package/dist/esm/types/sync/index.js +0 -6
- package/dist/esm/types/sync/request.js +0 -1
- package/dist/esm/types/sync/resource-types.js +0 -37
- package/dist/esm/types/sync/resources/calendars.js +0 -28
- package/dist/esm/types/sync/resources/collaborators.js +0 -22
- package/dist/esm/types/sync/resources/completed-info.js +0 -27
- package/dist/esm/types/sync/resources/filters.js +0 -13
- package/dist/esm/types/sync/resources/folders.js +0 -11
- package/dist/esm/types/sync/resources/index.js +0 -17
- package/dist/esm/types/sync/resources/live-notifications.js +0 -36
- package/dist/esm/types/sync/resources/notes.js +0 -20
- package/dist/esm/types/sync/resources/reminders.js +0 -47
- package/dist/esm/types/sync/resources/suggestions.js +0 -39
- package/dist/esm/types/sync/resources/tooltips.js +0 -7
- package/dist/esm/types/sync/resources/user-plan-limits.js +0 -21
- package/dist/esm/types/sync/resources/user-settings.js +0 -39
- package/dist/esm/types/sync/resources/user.js +0 -117
- package/dist/esm/types/sync/resources/view-options.js +0 -80
- package/dist/esm/types/sync/resources/workspace-filters.js +0 -18
- package/dist/esm/types/sync/resources/workspace-goals.js +0 -29
- package/dist/esm/types/sync/resources/workspaces.js +0 -70
- package/dist/esm/types/sync/response.js +0 -1
- package/dist/esm/types/sync/user-preferences.js +0 -68
- package/dist/esm/types/tasks/index.js +0 -2
- package/dist/esm/types/tasks/requests.js +0 -1
- package/dist/esm/types/tasks/types.js +0 -56
- package/dist/esm/types/templates/index.js +0 -1
- package/dist/esm/types/templates/requests.js +0 -1
- package/dist/esm/types/uploads/index.js +0 -1
- package/dist/esm/types/uploads/requests.js +0 -1
- package/dist/esm/types/users/index.js +0 -1
- package/dist/esm/types/users/types.js +0 -48
- package/dist/esm/types/workspaces/index.js +0 -2
- package/dist/esm/types/workspaces/requests.js +0 -1
- package/dist/esm/types/workspaces/types.js +0 -152
- package/dist/esm/utils/activity-helpers.js +0 -53
- package/dist/esm/utils/case-conversion.js +0 -61
- package/dist/esm/utils/colors.js +0 -139
- package/dist/esm/utils/index.js +0 -4
- package/dist/esm/utils/multipart-upload.js +0 -142
- package/dist/esm/utils/processing-helpers.js +0 -12
- package/dist/esm/utils/sanitization.js +0 -112
- package/dist/esm/utils/sync-helpers.js +0 -19
- package/dist/esm/utils/uncompletable-helpers.js +0 -54
- package/dist/esm/utils/url-helpers.js +0 -68
- package/dist/esm/utils/validators.js +0 -132
- package/dist/types/authentication.d.ts +0 -158
- package/dist/types/consts/endpoints.d.ts +0 -81
- package/dist/types/index.d.ts +0 -4
- package/dist/types/test-utils/asserts.d.ts +0 -1
- package/dist/types/test-utils/msw-setup.d.ts +0 -33
- package/dist/types/test-utils/obsidian-fetch-adapter.d.ts +0 -29
- package/dist/types/test-utils/test-defaults.d.ts +0 -261
- package/dist/types/todoist-api.d.ts +0 -1018
- package/dist/types/transport/fetch-with-retry.d.ts +0 -12
- package/dist/types/transport/http-client.d.ts +0 -16
- package/dist/types/transport/http-dispatcher.d.ts +0 -3
- package/dist/types/types/activity/index.d.ts +0 -2
- package/dist/types/types/activity/requests.d.ts +0 -85
- package/dist/types/types/activity/types.d.ts +0 -49
- package/dist/types/types/backups/index.d.ts +0 -2
- package/dist/types/types/backups/requests.d.ts +0 -16
- package/dist/types/types/backups/types.d.ts +0 -7
- package/dist/types/types/comments/index.d.ts +0 -2
- package/dist/types/types/comments/requests.d.ts +0 -64
- package/dist/types/types/comments/types.d.ts +0 -141
- package/dist/types/types/common.d.ts +0 -13
- package/dist/types/types/emails/index.d.ts +0 -1
- package/dist/types/types/emails/requests.d.ts +0 -30
- package/dist/types/types/errors.d.ts +0 -12
- package/dist/types/types/folders/index.d.ts +0 -1
- package/dist/types/types/folders/requests.d.ts +0 -20
- package/dist/types/types/http.d.ts +0 -85
- package/dist/types/types/id-mappings/index.d.ts +0 -2
- package/dist/types/types/id-mappings/requests.d.ts +0 -28
- package/dist/types/types/id-mappings/types.d.ts +0 -13
- package/dist/types/types/index.d.ts +0 -20
- package/dist/types/types/insights/index.d.ts +0 -2
- package/dist/types/types/insights/requests.d.ts +0 -26
- package/dist/types/types/insights/types.d.ts +0 -186
- package/dist/types/types/labels/index.d.ts +0 -2
- package/dist/types/types/labels/requests.d.ts +0 -75
- package/dist/types/types/labels/types.d.ts +0 -13
- package/dist/types/types/productivity/index.d.ts +0 -1
- package/dist/types/types/productivity/types.d.ts +0 -115
- package/dist/types/types/projects/index.d.ts +0 -2
- package/dist/types/types/projects/requests.d.ts +0 -169
- package/dist/types/types/projects/types.d.ts +0 -201
- package/dist/types/types/reminders/index.d.ts +0 -1
- package/dist/types/types/reminders/requests.d.ts +0 -205
- package/dist/types/types/sections/index.d.ts +0 -2
- package/dist/types/types/sections/requests.d.ts +0 -41
- package/dist/types/types/sections/types.d.ts +0 -44
- package/dist/types/types/sync/commands/calendars.d.ts +0 -14
- package/dist/types/types/sync/commands/filters.d.ts +0 -22
- package/dist/types/types/sync/commands/folders.d.ts +0 -18
- package/dist/types/types/sync/commands/index.d.ts +0 -171
- package/dist/types/types/sync/commands/labels.d.ts +0 -32
- package/dist/types/types/sync/commands/notes.d.ts +0 -27
- package/dist/types/types/sync/commands/notifications.d.ts +0 -10
- package/dist/types/types/sync/commands/others.d.ts +0 -39
- package/dist/types/types/sync/commands/project-view-options.d.ts +0 -14
- package/dist/types/types/sync/commands/projects.d.ts +0 -90
- package/dist/types/types/sync/commands/reminders.d.ts +0 -51
- package/dist/types/types/sync/commands/sections.d.ts +0 -31
- package/dist/types/types/sync/commands/shared.d.ts +0 -51
- package/dist/types/types/sync/commands/sharing.d.ts +0 -16
- package/dist/types/types/sync/commands/tasks.d.ts +0 -78
- package/dist/types/types/sync/commands/view-options.d.ts +0 -15
- package/dist/types/types/sync/commands/workspace-filters.d.ts +0 -23
- package/dist/types/types/sync/commands/workspace-goals.d.ts +0 -24
- package/dist/types/types/sync/commands/workspaces.d.ts +0 -79
- package/dist/types/types/sync/index.d.ts +0 -6
- package/dist/types/types/sync/request.d.ts +0 -7
- package/dist/types/types/sync/resource-types.d.ts +0 -5
- package/dist/types/types/sync/resources/calendars.d.ts +0 -38
- package/dist/types/types/sync/resources/collaborators.d.ts +0 -28
- package/dist/types/types/sync/resources/completed-info.d.ts +0 -33
- package/dist/types/types/sync/resources/filters.d.ts +0 -12
- package/dist/types/types/sync/resources/folders.d.ts +0 -10
- package/dist/types/types/sync/resources/index.d.ts +0 -17
- package/dist/types/types/sync/resources/live-notifications.d.ts +0 -32
- package/dist/types/types/sync/resources/notes.d.ts +0 -34
- package/dist/types/types/sync/resources/reminders.d.ts +0 -126
- package/dist/types/types/sync/resources/suggestions.d.ts +0 -96
- package/dist/types/types/sync/resources/tooltips.d.ts +0 -6
- package/dist/types/types/sync/resources/user-plan-limits.d.ts +0 -41
- package/dist/types/types/sync/resources/user-settings.d.ts +0 -40
- package/dist/types/types/sync/resources/user.d.ts +0 -134
- package/dist/types/types/sync/resources/view-options.d.ts +0 -169
- package/dist/types/types/sync/resources/workspace-filters.d.ts +0 -17
- package/dist/types/types/sync/resources/workspace-goals.d.ts +0 -29
- package/dist/types/types/sync/resources/workspaces.d.ts +0 -142
- package/dist/types/types/sync/response.d.ts +0 -51
- package/dist/types/types/sync/user-preferences.d.ts +0 -39
- package/dist/types/types/tasks/index.d.ts +0 -2
- package/dist/types/types/tasks/requests.d.ts +0 -197
- package/dist/types/types/tasks/types.d.ts +0 -162
- package/dist/types/types/templates/index.d.ts +0 -1
- package/dist/types/types/templates/requests.d.ts +0 -92
- package/dist/types/types/uploads/index.d.ts +0 -1
- package/dist/types/types/uploads/requests.d.ts +0 -32
- package/dist/types/types/users/index.d.ts +0 -1
- package/dist/types/types/users/types.d.ts +0 -66
- package/dist/types/types/workspaces/index.d.ts +0 -2
- package/dist/types/types/workspaces/requests.d.ts +0 -260
- package/dist/types/types/workspaces/types.d.ts +0 -267
- package/dist/types/utils/activity-helpers.d.ts +0 -28
- package/dist/types/utils/case-conversion.d.ts +0 -12
- package/dist/types/utils/colors.d.ts +0 -197
- package/dist/types/utils/index.d.ts +0 -4
- package/dist/types/utils/multipart-upload.d.ts +0 -54
- package/dist/types/utils/processing-helpers.d.ts +0 -1
- package/dist/types/utils/sanitization.d.ts +0 -35
- package/dist/types/utils/sync-helpers.d.ts +0 -17
- package/dist/types/utils/uncompletable-helpers.d.ts +0 -30
- package/dist/types/utils/url-helpers.d.ts +0 -32
- package/dist/types/utils/validators.d.ts +0 -1404
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
const BOLD_FORMAT = /(^|[\s!?,;>:]+)(?:\*\*|__|!!)(.+?)(\*\*|__|!!)(?=$|[\s!?,;><:]+)/gi;
|
|
2
|
-
const ITALIC_FORMAT = /(^|[\s!?,;>:]+)(?:\*|_|!)(.+?)(\*|_|!)(?=$|[\s!?,;><:]+)/gi;
|
|
3
|
-
const BOLD_ITALIC_FORMAT = /(^|[\s!?,;>:]+)(?:\*\*\*|___|!!!)(.+?)(\*\*\*|___|!!!)(?=$|[\s!?,;><:]+)/gi;
|
|
4
|
-
const CODE_BLOCK_FORMAT = /```([\s\S]*?)```/gi;
|
|
5
|
-
const CODE_INLINE_FORMAT = /`([^`]+)`/gi;
|
|
6
|
-
const TODOIST_LINK = /((?:(?:onenote:)?[\w-]+):\/\/[^\s]+)\s+[[(]([^)]+)[\])]/gi;
|
|
7
|
-
const MARKDOWN_LINK = /\[(.+?)\]\((.+?)\)/gi;
|
|
8
|
-
const GMAIL_LINK = /\[\[gmail=(.+?),\s*(.+?)\]\]/gi;
|
|
9
|
-
const OUTLOOK_LINK = /\[\[outlook=(.+?),\s*(.+?)\]\]/gi;
|
|
10
|
-
const THUNDERBIRD_LINK = /\[\[thunderbird\n(.+)\n(.+)\n\s*\]\]/gi;
|
|
11
|
-
const FAKE_SECTION_PREFIX = '* ';
|
|
12
|
-
const FAKE_SECTION_SUFFIX = ':';
|
|
13
|
-
function removeStyleFormatting(input) {
|
|
14
|
-
if (!input.includes('!') && !input.includes('*') && !input.includes('_')) {
|
|
15
|
-
return input;
|
|
16
|
-
}
|
|
17
|
-
function removeMarkdown(_match, prefix, text) {
|
|
18
|
-
return `${prefix}${text}`;
|
|
19
|
-
}
|
|
20
|
-
input = input.replace(BOLD_ITALIC_FORMAT, removeMarkdown);
|
|
21
|
-
input = input.replace(BOLD_FORMAT, removeMarkdown);
|
|
22
|
-
input = input.replace(ITALIC_FORMAT, removeMarkdown);
|
|
23
|
-
return input;
|
|
24
|
-
}
|
|
25
|
-
function removeCodeFormatting(input) {
|
|
26
|
-
function removeMarkdown(_match, text) {
|
|
27
|
-
return text;
|
|
28
|
-
}
|
|
29
|
-
input = input.replace(CODE_BLOCK_FORMAT, removeMarkdown);
|
|
30
|
-
input = input.replace(CODE_INLINE_FORMAT, removeMarkdown);
|
|
31
|
-
return input;
|
|
32
|
-
}
|
|
33
|
-
function removeFakeSectionFormatting(input) {
|
|
34
|
-
if (input.startsWith(FAKE_SECTION_PREFIX)) {
|
|
35
|
-
input = input.slice(FAKE_SECTION_PREFIX.length);
|
|
36
|
-
}
|
|
37
|
-
if (input.endsWith(FAKE_SECTION_SUFFIX)) {
|
|
38
|
-
input = input.slice(0, input.length - FAKE_SECTION_SUFFIX.length);
|
|
39
|
-
}
|
|
40
|
-
return input;
|
|
41
|
-
}
|
|
42
|
-
function removeMarkdownLinks(input) {
|
|
43
|
-
if (!input.includes('[') || !input.includes(']')) {
|
|
44
|
-
return input;
|
|
45
|
-
}
|
|
46
|
-
function removeMarkdown(_match, text) {
|
|
47
|
-
return text;
|
|
48
|
-
}
|
|
49
|
-
return input.replace(MARKDOWN_LINK, removeMarkdown);
|
|
50
|
-
}
|
|
51
|
-
function removeTodoistLinks(input) {
|
|
52
|
-
if (!input.includes('(') || !input.includes(')')) {
|
|
53
|
-
return input;
|
|
54
|
-
}
|
|
55
|
-
function removeMarkdown(_match, _url, text) {
|
|
56
|
-
return text;
|
|
57
|
-
}
|
|
58
|
-
return input.replace(TODOIST_LINK, removeMarkdown);
|
|
59
|
-
}
|
|
60
|
-
function removeAppLinks(input) {
|
|
61
|
-
if (input.includes('gmail')) {
|
|
62
|
-
input = input.replace(GMAIL_LINK, (_match, _id, text) => text);
|
|
63
|
-
}
|
|
64
|
-
if (input.includes('outlook')) {
|
|
65
|
-
input = input.replace(OUTLOOK_LINK, (_match, _id, text) => text);
|
|
66
|
-
}
|
|
67
|
-
if (input.includes('thunderbird')) {
|
|
68
|
-
input = input.replace(THUNDERBIRD_LINK, (_match, text) => text);
|
|
69
|
-
}
|
|
70
|
-
return input;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Sanitizes a string by removing Todoist's formatting syntax (e.g. bold, italic, code blocks, links).
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* // Removes bold/italic formatting
|
|
77
|
-
* getSanitizedContent('Some **bold** and *italic*') // 'Some bold and italic'
|
|
78
|
-
*
|
|
79
|
-
* // Removes markdown links
|
|
80
|
-
* getSanitizedContent('A [markdown](http://url.com) link') // 'A markdown link'
|
|
81
|
-
*
|
|
82
|
-
* // Removes app-specific links
|
|
83
|
-
* getSanitizedContent('A [[gmail=id, link from gmail]]') // 'A link from gmail'
|
|
84
|
-
*
|
|
85
|
-
* @param input - The string to sanitize
|
|
86
|
-
* @returns The sanitized string with all formatting removed
|
|
87
|
-
*/
|
|
88
|
-
export function getSanitizedContent(input) {
|
|
89
|
-
input = removeStyleFormatting(input);
|
|
90
|
-
input = removeCodeFormatting(input);
|
|
91
|
-
input = removeFakeSectionFormatting(input);
|
|
92
|
-
input = removeMarkdownLinks(input);
|
|
93
|
-
input = removeTodoistLinks(input);
|
|
94
|
-
input = removeAppLinks(input);
|
|
95
|
-
return input;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Takes an array of tasks and returns a new array with sanitized content
|
|
99
|
-
* added as 'sanitizedContent' property to each task.
|
|
100
|
-
*
|
|
101
|
-
* @see {@link getSanitizedContent}
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* const tasks = [{ content: '**Bold** task', ... }]
|
|
105
|
-
* getSanitizedTasks(tasks) // [{ content: '**Bold** task', sanitizedContent: 'Bold task', ... }]
|
|
106
|
-
*
|
|
107
|
-
* @param tasks - Array of Task objects to sanitize
|
|
108
|
-
* @returns Array of tasks with added sanitizedContent property
|
|
109
|
-
*/
|
|
110
|
-
export function getSanitizedTasks(tasks) {
|
|
111
|
-
return tasks.map((task) => (Object.assign(Object.assign({}, task), { sanitizedContent: getSanitizedContent(task.content) })));
|
|
112
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
-
/**
|
|
3
|
-
* Creates a strongly-typed Sync API command with an auto-generated UUID.
|
|
4
|
-
*
|
|
5
|
-
* @param type - The command type (e.g. `'item_add'`, `'project_update'`).
|
|
6
|
-
* @param args - The command arguments, constrained by the command type.
|
|
7
|
-
* @param tempId - Optional temporary ID for referencing the created resource in subsequent commands.
|
|
8
|
-
* @returns A fully formed `SyncCommand` ready to include in a sync request.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* const cmd = createCommand('item_add', { content: 'Buy milk', priority: 2 })
|
|
13
|
-
* // cmd.type === 'item_add'
|
|
14
|
-
* // cmd.args is typed as TaskAddArgs
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export function createCommand(type, args, tempId) {
|
|
18
|
-
return Object.assign({ type, uuid: uuidv4(), args: args }, (tempId !== undefined ? { tempId } : {}));
|
|
19
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
const UNCOMPLETABLE_PREFIX = '* ';
|
|
2
|
-
/**
|
|
3
|
-
* Adds the uncompletable prefix (* ) to task content if not already present
|
|
4
|
-
* @param content - The task content
|
|
5
|
-
* @returns Content with uncompletable prefix added
|
|
6
|
-
*/
|
|
7
|
-
export function addUncompletablePrefix(content) {
|
|
8
|
-
if (content.startsWith(UNCOMPLETABLE_PREFIX)) {
|
|
9
|
-
return content;
|
|
10
|
-
}
|
|
11
|
-
return UNCOMPLETABLE_PREFIX + content;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Removes the uncompletable prefix (* ) from task content if present
|
|
15
|
-
* @param content - The task content
|
|
16
|
-
* @returns Content with uncompletable prefix removed
|
|
17
|
-
*/
|
|
18
|
-
export function removeUncompletablePrefix(content) {
|
|
19
|
-
if (content.startsWith(UNCOMPLETABLE_PREFIX)) {
|
|
20
|
-
return content.slice(UNCOMPLETABLE_PREFIX.length);
|
|
21
|
-
}
|
|
22
|
-
return content;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Checks if task content has the uncompletable prefix (* )
|
|
26
|
-
* @param content - The task content
|
|
27
|
-
* @returns True if content starts with uncompletable prefix
|
|
28
|
-
*/
|
|
29
|
-
export function hasUncompletablePrefix(content) {
|
|
30
|
-
return content.startsWith(UNCOMPLETABLE_PREFIX);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Processes task content based on isUncompletable flag, with content prefix taking precedence
|
|
34
|
-
* @param content - The original task content
|
|
35
|
-
* @param isUncompletable - Optional flag to make task uncompletable
|
|
36
|
-
* @returns Processed content
|
|
37
|
-
*
|
|
38
|
-
* Logic:
|
|
39
|
-
* - If content already has * prefix, task is uncompletable regardless of flag
|
|
40
|
-
* - If content doesn't have * prefix and isUncompletable is true, add the prefix
|
|
41
|
-
* - If isUncompletable is undefined or false (and no prefix), leave content unchanged
|
|
42
|
-
*/
|
|
43
|
-
export function processTaskContent(content, isUncompletable) {
|
|
44
|
-
// Content prefix takes precedence - if already has prefix, keep it
|
|
45
|
-
if (hasUncompletablePrefix(content)) {
|
|
46
|
-
return content;
|
|
47
|
-
}
|
|
48
|
-
// If content doesn't have prefix and user wants uncompletable, add it
|
|
49
|
-
if (isUncompletable === true) {
|
|
50
|
-
return addUncompletablePrefix(content);
|
|
51
|
-
}
|
|
52
|
-
// Otherwise, leave content unchanged
|
|
53
|
-
return content;
|
|
54
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { TODOIST_WEB_URI } from '../consts/endpoints.js';
|
|
2
|
-
/**
|
|
3
|
-
* Formats a Date object to YYYY-MM-DD string format.
|
|
4
|
-
*
|
|
5
|
-
* @internal
|
|
6
|
-
* @param date The Date object to format.
|
|
7
|
-
* @returns The formatted date string in YYYY-MM-DD format.
|
|
8
|
-
*/
|
|
9
|
-
export function formatDateToYYYYMMDD(date) {
|
|
10
|
-
const year = date.getFullYear();
|
|
11
|
-
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
12
|
-
const day = String(date.getDate()).padStart(2, '0');
|
|
13
|
-
return `${year}-${month}-${day}`;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Generate the URL for a given task.
|
|
17
|
-
*
|
|
18
|
-
* @param taskId The ID of the task.
|
|
19
|
-
* @param content The content of the task.
|
|
20
|
-
* @returns The URL string for the task view.
|
|
21
|
-
*/
|
|
22
|
-
export function getTaskUrl(taskId, content) {
|
|
23
|
-
const slug = content ? slugify(content) : undefined;
|
|
24
|
-
const path = slug ? `${slug}-${taskId}` : taskId;
|
|
25
|
-
return `${TODOIST_WEB_URI}/task/${path}`;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Generate the URL for a given project.
|
|
29
|
-
*
|
|
30
|
-
* @param projectId The ID of the project.
|
|
31
|
-
* @param name The name of the project.
|
|
32
|
-
* @returns The URL string for the project view.
|
|
33
|
-
*/
|
|
34
|
-
export function getProjectUrl(projectId, name) {
|
|
35
|
-
const slug = name ? slugify(name) : undefined;
|
|
36
|
-
const path = slug ? `${slug}-${projectId}` : projectId;
|
|
37
|
-
return `${TODOIST_WEB_URI}/project/${path}`;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Generate the URL for a given section.
|
|
41
|
-
*
|
|
42
|
-
* @param sectionId The ID of the section.
|
|
43
|
-
* @param name The name of the section.
|
|
44
|
-
* @returns The URL string for the section view.
|
|
45
|
-
*/
|
|
46
|
-
export function getSectionUrl(sectionId, name) {
|
|
47
|
-
const slug = name ? slugify(name) : undefined;
|
|
48
|
-
const path = slug ? `${slug}-${sectionId}` : sectionId;
|
|
49
|
-
return `${TODOIST_WEB_URI}/section/${path}`;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Slugify function borrowed from Django.
|
|
53
|
-
*
|
|
54
|
-
* @param value The string to slugify.
|
|
55
|
-
* @returns The slugified string.
|
|
56
|
-
*/
|
|
57
|
-
function slugify(value) {
|
|
58
|
-
// Convert to ASCII
|
|
59
|
-
let result = value.normalize('NFKD').replace(/[\u0300-\u036f]/g, '');
|
|
60
|
-
// Remove non-ASCII characters
|
|
61
|
-
result = result.replace(/[^\x20-\x7E]/g, '');
|
|
62
|
-
// Convert to lowercase and replace non-alphanumeric characters with dashes
|
|
63
|
-
result = result.toLowerCase().replace(/[^\w\s-]/g, '');
|
|
64
|
-
// Replace spaces and repeated dashes with single dashes
|
|
65
|
-
result = result.replace(/[-\s]+/g, '-');
|
|
66
|
-
// Strip dashes from the beginning and end
|
|
67
|
-
return result.replace(/^-+|-+$/g, '');
|
|
68
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { TaskSchema } from '../types/tasks/types.js';
|
|
2
|
-
import { PersonalProjectSchema, WorkspaceProjectSchema, } from '../types/projects/types.js';
|
|
3
|
-
import { SectionSchema } from '../types/sections/types.js';
|
|
4
|
-
import { LabelSchema } from '../types/labels/types.js';
|
|
5
|
-
import { AttachmentSchema, CommentSchema } from '../types/comments/types.js';
|
|
6
|
-
import { UserSchema, CurrentUserSchema } from '../types/users/types.js';
|
|
7
|
-
import { ProductivityStatsSchema } from '../types/productivity/types.js';
|
|
8
|
-
import { ActivityEventSchema } from '../types/activity/types.js';
|
|
9
|
-
import { WorkspaceUserSchema, WorkspaceInvitationSchema, WorkspacePlanDetailsSchema, JoinWorkspaceResultSchema, WorkspaceSchema, MemberActivityInfoSchema, WorkspaceUserTaskSchema, } from '../types/workspaces/types.js';
|
|
10
|
-
import { ProjectActivityStatsSchema, ProjectHealthSchema, ProjectHealthContextSchema, ProjectProgressSchema, WorkspaceInsightsSchema, } from '../types/insights/types.js';
|
|
11
|
-
import { BackupSchema } from '../types/backups/types.js';
|
|
12
|
-
import { IdMappingSchema, MovedIdSchema } from '../types/id-mappings/types.js';
|
|
13
|
-
import { FilterSchema, CollaboratorSchema, CollaboratorStateSchema, FolderSchema, NoteSchema, TooltipsSchema, WorkspaceFilterSchema, WorkspaceGoalSchema, CalendarSchema, CalendarAccountSchema, ReminderSchema, LocationReminderSchema, CompletedInfoSchema, ViewOptionsSchema, ProjectViewOptionsDefaultsSchema, UserPlanLimitsSchema, LiveNotificationSchema, SyncWorkspaceSchema, SyncUserSchema, UserSettingsSchema, SuggestionSchema, } from '../types/sync/resources/index.js';
|
|
14
|
-
function createValidator(schema) {
|
|
15
|
-
return (input) => schema.parse(input);
|
|
16
|
-
}
|
|
17
|
-
function createArrayValidator(validateItem) {
|
|
18
|
-
return (input) => input.map(validateItem);
|
|
19
|
-
}
|
|
20
|
-
// Entity validators
|
|
21
|
-
export const validateTask = createValidator(TaskSchema);
|
|
22
|
-
export const validateTaskArray = createArrayValidator(validateTask);
|
|
23
|
-
/**
|
|
24
|
-
* Type guard to check if a project is a workspace project.
|
|
25
|
-
* @param project The project to check
|
|
26
|
-
* @returns True if the project is a workspace project
|
|
27
|
-
*/
|
|
28
|
-
export function isWorkspaceProject(project) {
|
|
29
|
-
return 'workspaceId' in project;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Type guard to check if a project is a personal project.
|
|
33
|
-
* @param project The project to check
|
|
34
|
-
* @returns True if the project is a personal project
|
|
35
|
-
*/
|
|
36
|
-
export function isPersonalProject(project) {
|
|
37
|
-
return !isWorkspaceProject(project);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Validates and parses a project input.
|
|
41
|
-
* @param input The input to validate
|
|
42
|
-
* @returns A validated project (either PersonalProject or WorkspaceProject)
|
|
43
|
-
*/
|
|
44
|
-
export function validateProject(input) {
|
|
45
|
-
if ('workspaceId' in input) {
|
|
46
|
-
return WorkspaceProjectSchema.parse(input);
|
|
47
|
-
}
|
|
48
|
-
return PersonalProjectSchema.parse(input);
|
|
49
|
-
}
|
|
50
|
-
export function validateProjectArray(input) {
|
|
51
|
-
return input.map(validateProject);
|
|
52
|
-
}
|
|
53
|
-
export const validateSection = createValidator(SectionSchema);
|
|
54
|
-
export const validateSectionArray = createArrayValidator(validateSection);
|
|
55
|
-
export const validateLabel = createValidator(LabelSchema);
|
|
56
|
-
export const validateLabelArray = createArrayValidator(validateLabel);
|
|
57
|
-
export const validateComment = createValidator(CommentSchema);
|
|
58
|
-
export const validateCommentArray = createArrayValidator(validateComment);
|
|
59
|
-
export const validateUser = createValidator(UserSchema);
|
|
60
|
-
export const validateUserArray = createArrayValidator(validateUser);
|
|
61
|
-
export const validateProductivityStats = createValidator(ProductivityStatsSchema);
|
|
62
|
-
export const validateCurrentUser = createValidator(CurrentUserSchema);
|
|
63
|
-
export const validateActivityEvent = createValidator(ActivityEventSchema);
|
|
64
|
-
export const validateActivityEventArray = createArrayValidator(validateActivityEvent);
|
|
65
|
-
export const validateAttachment = createValidator(AttachmentSchema);
|
|
66
|
-
export const validateWorkspaceUser = createValidator(WorkspaceUserSchema);
|
|
67
|
-
export function validateWorkspaceUserArray(input) {
|
|
68
|
-
if (!Array.isArray(input)) {
|
|
69
|
-
throw new Error(`Expected array for workspace users, got ${typeof input}`);
|
|
70
|
-
}
|
|
71
|
-
return input.map(validateWorkspaceUser);
|
|
72
|
-
}
|
|
73
|
-
export const validateWorkspaceInvitation = createValidator(WorkspaceInvitationSchema);
|
|
74
|
-
export const validateWorkspaceInvitationArray = createArrayValidator(validateWorkspaceInvitation);
|
|
75
|
-
export const validateWorkspacePlanDetails = createValidator(WorkspacePlanDetailsSchema);
|
|
76
|
-
export const validateJoinWorkspaceResult = createValidator(JoinWorkspaceResultSchema);
|
|
77
|
-
export const validateWorkspace = createValidator(WorkspaceSchema);
|
|
78
|
-
export const validateWorkspaceArray = createArrayValidator(validateWorkspace);
|
|
79
|
-
export const validateMemberActivityInfo = createValidator(MemberActivityInfoSchema);
|
|
80
|
-
export const validateMemberActivityInfoArray = createArrayValidator(validateMemberActivityInfo);
|
|
81
|
-
export const validateWorkspaceUserTask = createValidator(WorkspaceUserTaskSchema);
|
|
82
|
-
export const validateWorkspaceUserTaskArray = createArrayValidator(validateWorkspaceUserTask);
|
|
83
|
-
export const validateProjectActivityStats = createValidator(ProjectActivityStatsSchema);
|
|
84
|
-
export const validateProjectHealth = createValidator(ProjectHealthSchema);
|
|
85
|
-
export const validateProjectHealthContext = createValidator(ProjectHealthContextSchema);
|
|
86
|
-
export const validateProjectProgress = createValidator(ProjectProgressSchema);
|
|
87
|
-
export const validateWorkspaceInsights = createValidator(WorkspaceInsightsSchema);
|
|
88
|
-
export const validateBackup = createValidator(BackupSchema);
|
|
89
|
-
export const validateBackupArray = createArrayValidator(validateBackup);
|
|
90
|
-
export const validateIdMapping = createValidator(IdMappingSchema);
|
|
91
|
-
export const validateIdMappingArray = createArrayValidator(validateIdMapping);
|
|
92
|
-
export const validateMovedId = createValidator(MovedIdSchema);
|
|
93
|
-
export const validateMovedIdArray = createArrayValidator(validateMovedId);
|
|
94
|
-
// Sync resource validators
|
|
95
|
-
export const validateFilter = createValidator(FilterSchema);
|
|
96
|
-
export const validateFilterArray = createArrayValidator(validateFilter);
|
|
97
|
-
export const validateCollaborator = createValidator(CollaboratorSchema);
|
|
98
|
-
export const validateCollaboratorArray = createArrayValidator(validateCollaborator);
|
|
99
|
-
export const validateCollaboratorState = createValidator(CollaboratorStateSchema);
|
|
100
|
-
export const validateCollaboratorStateArray = createArrayValidator(validateCollaboratorState);
|
|
101
|
-
export const validateFolder = createValidator(FolderSchema);
|
|
102
|
-
export const validateFolderArray = createArrayValidator(validateFolder);
|
|
103
|
-
export const validateNote = createValidator(NoteSchema);
|
|
104
|
-
export const validateNoteArray = createArrayValidator(validateNote);
|
|
105
|
-
export const validateTooltips = createValidator(TooltipsSchema);
|
|
106
|
-
export const validateWorkspaceFilter = createValidator(WorkspaceFilterSchema);
|
|
107
|
-
export const validateWorkspaceFilterArray = createArrayValidator(validateWorkspaceFilter);
|
|
108
|
-
export const validateWorkspaceGoal = createValidator(WorkspaceGoalSchema);
|
|
109
|
-
export const validateWorkspaceGoalArray = createArrayValidator(validateWorkspaceGoal);
|
|
110
|
-
export const validateCalendar = createValidator(CalendarSchema);
|
|
111
|
-
export const validateCalendarArray = createArrayValidator(validateCalendar);
|
|
112
|
-
export const validateCalendarAccount = createValidator(CalendarAccountSchema);
|
|
113
|
-
export const validateCalendarAccountArray = createArrayValidator(validateCalendarAccount);
|
|
114
|
-
export const validateReminder = createValidator(ReminderSchema);
|
|
115
|
-
export const validateReminderArray = createArrayValidator(validateReminder);
|
|
116
|
-
export const validateLocationReminder = createValidator(LocationReminderSchema);
|
|
117
|
-
export const validateLocationReminderArray = createArrayValidator(validateLocationReminder);
|
|
118
|
-
export const validateCompletedInfo = createValidator(CompletedInfoSchema);
|
|
119
|
-
export const validateCompletedInfoArray = createArrayValidator(validateCompletedInfo);
|
|
120
|
-
export const validateViewOptions = createValidator(ViewOptionsSchema);
|
|
121
|
-
export const validateViewOptionsArray = createArrayValidator(validateViewOptions);
|
|
122
|
-
export const validateProjectViewOptionsDefaults = createValidator(ProjectViewOptionsDefaultsSchema);
|
|
123
|
-
export const validateProjectViewOptionsDefaultsArray = createArrayValidator(validateProjectViewOptionsDefaults);
|
|
124
|
-
export const validateUserPlanLimits = createValidator(UserPlanLimitsSchema);
|
|
125
|
-
export const validateLiveNotification = createValidator(LiveNotificationSchema);
|
|
126
|
-
export const validateLiveNotificationArray = createArrayValidator(validateLiveNotification);
|
|
127
|
-
export const validateSyncWorkspace = createValidator(SyncWorkspaceSchema);
|
|
128
|
-
export const validateSyncWorkspaceArray = createArrayValidator(validateSyncWorkspace);
|
|
129
|
-
export const validateSyncUser = createValidator(SyncUserSchema);
|
|
130
|
-
export const validateUserSettings = createValidator(UserSettingsSchema);
|
|
131
|
-
export const validateSuggestion = createValidator(SuggestionSchema);
|
|
132
|
-
export const validateSuggestionArray = createArrayValidator(validateSuggestion);
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { CustomFetch } from './types/http.js';
|
|
2
|
-
/**
|
|
3
|
-
* Options for authentication functions
|
|
4
|
-
*/
|
|
5
|
-
export type AuthOptions = {
|
|
6
|
-
baseUrl?: string;
|
|
7
|
-
customFetch?: CustomFetch;
|
|
8
|
-
};
|
|
9
|
-
/** Available OAuth2 permission scopes. */
|
|
10
|
-
export declare const PERMISSIONS: readonly ["task:add", "data:read", "data:read_write", "data:delete", "project:delete", "backups:read"];
|
|
11
|
-
/**
|
|
12
|
-
* Permission scope that can be requested during OAuth2 authorization.
|
|
13
|
-
* @see {@link https://developer.todoist.com/api/v1/#tag/Authorization}
|
|
14
|
-
*/
|
|
15
|
-
export type Permission = (typeof PERMISSIONS)[number];
|
|
16
|
-
/**
|
|
17
|
-
* Parameters required to exchange an authorization code for an access token.
|
|
18
|
-
* @see https://developer.todoist.com/api/v1/#tag/Authorization/OAuth
|
|
19
|
-
*/
|
|
20
|
-
export type AuthTokenRequestArgs = {
|
|
21
|
-
clientId: string;
|
|
22
|
-
clientSecret: string;
|
|
23
|
-
code: string;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Response from a successful OAuth2 token exchange.
|
|
27
|
-
* @see https://developer.todoist.com/api/v1/#tag/Authorization/OAuth
|
|
28
|
-
*/
|
|
29
|
-
export type AuthTokenResponse = {
|
|
30
|
-
accessToken: string;
|
|
31
|
-
tokenType: string;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Parameters required to revoke a token using RFC 7009 compliant endpoint.
|
|
35
|
-
* @see https://developer.todoist.com/api/v1/#tag/Authorization
|
|
36
|
-
*/
|
|
37
|
-
export type RevokeTokenRequestArgs = {
|
|
38
|
-
clientId: string;
|
|
39
|
-
clientSecret: string;
|
|
40
|
-
token: string;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Parameters required to migrate a personal API token to an OAuth token.
|
|
44
|
-
*/
|
|
45
|
-
export type MigratePersonalTokenArgs = {
|
|
46
|
-
/** The unique Client ID of the registered Todoist application. */
|
|
47
|
-
clientId: string;
|
|
48
|
-
/** The unique Client Secret of the registered Todoist application. */
|
|
49
|
-
clientSecret: string;
|
|
50
|
-
/** The personal API token obtained from email/password authentication. */
|
|
51
|
-
personalToken: string;
|
|
52
|
-
/** Scopes for the new OAuth token. */
|
|
53
|
-
scope: readonly Permission[];
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Response from a successful personal token migration.
|
|
57
|
-
*/
|
|
58
|
-
export type MigratePersonalTokenResponse = {
|
|
59
|
-
/** The new OAuth access token, or null if migration failed. */
|
|
60
|
-
accessToken: string | null;
|
|
61
|
-
/** The token type (always 'Bearer'). */
|
|
62
|
-
tokenType: string;
|
|
63
|
-
/** Token expiration time in seconds. */
|
|
64
|
-
expiresIn: number;
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* Generates a random state parameter for OAuth2 authorization.
|
|
68
|
-
* The state parameter helps prevent CSRF attacks.
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
* ```typescript
|
|
72
|
-
* const state = getAuthStateParameter()
|
|
73
|
-
* // Store state in session
|
|
74
|
-
* const authUrl = getAuthorizationUrl(clientId, ['data:read'], state)
|
|
75
|
-
* ```
|
|
76
|
-
*
|
|
77
|
-
* @returns A random UUID v4 string
|
|
78
|
-
*/
|
|
79
|
-
export declare function getAuthStateParameter(): string;
|
|
80
|
-
/**
|
|
81
|
-
* Generates the authorization URL for the OAuth2 flow.
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* ```typescript
|
|
85
|
-
* const url = getAuthorizationUrl(
|
|
86
|
-
* 'your-client-id',
|
|
87
|
-
* ['data:read', 'task:add'],
|
|
88
|
-
* state
|
|
89
|
-
* )
|
|
90
|
-
* // Redirect user to url
|
|
91
|
-
* ```
|
|
92
|
-
*
|
|
93
|
-
* @returns The full authorization URL to redirect users to
|
|
94
|
-
* @see https://developer.todoist.com/api/v1/#tag/Authorization/OAuth
|
|
95
|
-
*/
|
|
96
|
-
export declare function getAuthorizationUrl({ clientId, permissions, state, baseUrl, }: {
|
|
97
|
-
clientId: string;
|
|
98
|
-
permissions: readonly Permission[];
|
|
99
|
-
state: string;
|
|
100
|
-
baseUrl?: string;
|
|
101
|
-
}): string;
|
|
102
|
-
/**
|
|
103
|
-
* Exchanges an authorization code for an access token.
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```typescript
|
|
107
|
-
* const { accessToken } = await getAuthToken({
|
|
108
|
-
* clientId: 'your-client-id',
|
|
109
|
-
* clientSecret: 'your-client-secret',
|
|
110
|
-
* code: authCode
|
|
111
|
-
* })
|
|
112
|
-
* ```
|
|
113
|
-
*
|
|
114
|
-
* @returns The access token response
|
|
115
|
-
* @throws {@link TodoistRequestError} If the token exchange fails
|
|
116
|
-
*/
|
|
117
|
-
export declare function getAuthToken(args: AuthTokenRequestArgs, options?: AuthOptions): Promise<AuthTokenResponse>;
|
|
118
|
-
/**
|
|
119
|
-
* Revokes a token using the RFC 7009 OAuth 2.0 Token Revocation standard.
|
|
120
|
-
*
|
|
121
|
-
* This function uses HTTP Basic Authentication with client credentials and follows
|
|
122
|
-
* the RFC 7009 specification for token revocation.
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* ```typescript
|
|
126
|
-
* await revokeToken({
|
|
127
|
-
* clientId: 'your-client-id',
|
|
128
|
-
* clientSecret: 'your-client-secret',
|
|
129
|
-
* token: 'access-token-to-revoke'
|
|
130
|
-
* })
|
|
131
|
-
* ```
|
|
132
|
-
*
|
|
133
|
-
* @returns True if revocation was successful
|
|
134
|
-
* @see https://datatracker.ietf.org/doc/html/rfc7009
|
|
135
|
-
* @see https://developer.todoist.com/api/v1/#tag/Authorization
|
|
136
|
-
*/
|
|
137
|
-
export declare function revokeToken(args: RevokeTokenRequestArgs, options?: AuthOptions): Promise<boolean>;
|
|
138
|
-
/**
|
|
139
|
-
* Migrates a personal API token to an OAuth access token.
|
|
140
|
-
*
|
|
141
|
-
* This allows applications to transition users from personal API tokens
|
|
142
|
-
* to proper OAuth tokens without requiring the user to go through the
|
|
143
|
-
* full OAuth authorization flow.
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* ```typescript
|
|
147
|
-
* const { accessToken } = await migratePersonalToken({
|
|
148
|
-
* clientId: 'your-client-id',
|
|
149
|
-
* clientSecret: 'your-client-secret',
|
|
150
|
-
* personalToken: 'user-personal-token',
|
|
151
|
-
* scope: 'data:read_write,data:delete'
|
|
152
|
-
* })
|
|
153
|
-
* ```
|
|
154
|
-
*
|
|
155
|
-
* @returns The new OAuth token response
|
|
156
|
-
* @throws {@link TodoistRequestError} If the migration fails
|
|
157
|
-
*/
|
|
158
|
-
export declare function migratePersonalToken(args: MigratePersonalTokenArgs, options?: AuthOptions): Promise<MigratePersonalTokenResponse>;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
export declare const TODOIST_WEB_URI = "https://app.todoist.com/app";
|
|
2
|
-
export declare const API_VERSION = "v1";
|
|
3
|
-
export declare const API_BASE_URI = "/api/v1/";
|
|
4
|
-
export declare function getSyncBaseUri(domainBase?: string): string;
|
|
5
|
-
export declare function getAuthBaseUri(domainBase?: string): string;
|
|
6
|
-
export declare const ENDPOINT_REST_TASKS = "tasks";
|
|
7
|
-
export declare const ENDPOINT_REST_TASKS_FILTER: string;
|
|
8
|
-
export declare const ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE: string;
|
|
9
|
-
export declare const ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE: string;
|
|
10
|
-
export declare const ENDPOINT_REST_TASKS_COMPLETED_SEARCH = "completed/search";
|
|
11
|
-
export declare const ENDPOINT_REST_SECTIONS = "sections";
|
|
12
|
-
export declare const ENDPOINT_REST_SECTIONS_SEARCH: string;
|
|
13
|
-
export declare const ENDPOINT_REST_LABELS = "labels";
|
|
14
|
-
export declare const ENDPOINT_REST_LABELS_SEARCH: string;
|
|
15
|
-
export declare const ENDPOINT_REST_LABELS_SHARED: string;
|
|
16
|
-
export declare const ENDPOINT_REST_LABELS_SHARED_RENAME: string;
|
|
17
|
-
export declare const ENDPOINT_REST_LABELS_SHARED_REMOVE: string;
|
|
18
|
-
export declare const ENDPOINT_REST_COMMENTS = "comments";
|
|
19
|
-
export declare const ENDPOINT_REST_REMINDERS = "reminders";
|
|
20
|
-
export declare const ENDPOINT_REST_LOCATION_REMINDERS = "location_reminders";
|
|
21
|
-
export declare const ENDPOINT_REST_TASK_CLOSE = "close";
|
|
22
|
-
export declare const ENDPOINT_REST_TASK_REOPEN = "reopen";
|
|
23
|
-
export declare const ENDPOINT_REST_TASK_MOVE = "move";
|
|
24
|
-
export declare const ENDPOINT_REST_PROJECTS = "projects";
|
|
25
|
-
export declare const ENDPOINT_REST_PROJECTS_SEARCH: string;
|
|
26
|
-
export declare const ENDPOINT_REST_PROJECTS_ARCHIVED: string;
|
|
27
|
-
export declare const ENDPOINT_REST_PROJECT_COLLABORATORS = "collaborators";
|
|
28
|
-
export declare const ENDPOINT_REST_USER = "user";
|
|
29
|
-
export declare const ENDPOINT_REST_PRODUCTIVITY: string;
|
|
30
|
-
export declare const ENDPOINT_REST_ACTIVITIES = "activities";
|
|
31
|
-
export declare const ENDPOINT_REST_UPLOADS = "uploads";
|
|
32
|
-
export declare const PROJECT_ARCHIVE = "archive";
|
|
33
|
-
export declare const PROJECT_UNARCHIVE = "unarchive";
|
|
34
|
-
export declare const ENDPOINT_REST_PROJECTS_ARCHIVED_COUNT: string;
|
|
35
|
-
export declare const ENDPOINT_REST_PROJECTS_PERMISSIONS: string;
|
|
36
|
-
export declare const ENDPOINT_REST_PROJECT_FULL = "full";
|
|
37
|
-
export declare const ENDPOINT_REST_PROJECT_JOIN = "join";
|
|
38
|
-
export declare const SECTION_ARCHIVE = "archive";
|
|
39
|
-
export declare const SECTION_UNARCHIVE = "unarchive";
|
|
40
|
-
export declare const ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE: string;
|
|
41
|
-
export declare const ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL: string;
|
|
42
|
-
export declare const ENDPOINT_REST_TASKS_COMPLETED: string;
|
|
43
|
-
export declare const ENDPOINT_REST_TEMPLATES_FILE = "templates/file";
|
|
44
|
-
export declare const ENDPOINT_REST_TEMPLATES_URL = "templates/url";
|
|
45
|
-
export declare const ENDPOINT_REST_TEMPLATES_CREATE_FROM_FILE = "templates/create_project_from_file";
|
|
46
|
-
export declare const ENDPOINT_REST_TEMPLATES_IMPORT_FROM_FILE = "templates/import_into_project_from_file";
|
|
47
|
-
export declare const ENDPOINT_REST_TEMPLATES_IMPORT_FROM_ID = "templates/import_into_project_from_template_id";
|
|
48
|
-
export declare const ENDPOINT_REST_ACCESS_TOKENS_MIGRATE = "access_tokens/migrate_personal_token";
|
|
49
|
-
export declare const ENDPOINT_REST_BACKUPS = "backups";
|
|
50
|
-
export declare const ENDPOINT_REST_BACKUPS_DOWNLOAD = "backups/download";
|
|
51
|
-
export declare const ENDPOINT_REST_EMAILS = "emails";
|
|
52
|
-
export declare const ENDPOINT_REST_ID_MAPPINGS = "id_mappings";
|
|
53
|
-
export declare const ENDPOINT_REST_MOVED_IDS = "moved_ids";
|
|
54
|
-
export declare const ENDPOINT_SYNC_QUICK_ADD: string;
|
|
55
|
-
export declare const ENDPOINT_SYNC = "sync";
|
|
56
|
-
export declare const ENDPOINT_AUTHORIZATION = "authorize";
|
|
57
|
-
export declare const ENDPOINT_GET_TOKEN = "access_token";
|
|
58
|
-
export declare const ENDPOINT_REVOKE = "revoke";
|
|
59
|
-
export declare const ENDPOINT_REST_FOLDERS = "folders";
|
|
60
|
-
export declare const ENDPOINT_REST_WORKSPACES = "workspaces";
|
|
61
|
-
export declare const ENDPOINT_WORKSPACE_INVITATIONS = "workspaces/invitations";
|
|
62
|
-
export declare const ENDPOINT_WORKSPACE_INVITATIONS_ALL = "workspaces/invitations/all";
|
|
63
|
-
export declare const ENDPOINT_WORKSPACE_INVITATIONS_DELETE = "workspaces/invitations/delete";
|
|
64
|
-
export declare const ENDPOINT_WORKSPACE_JOIN = "workspaces/join";
|
|
65
|
-
export declare const ENDPOINT_WORKSPACE_LOGO = "workspaces/logo";
|
|
66
|
-
export declare const ENDPOINT_WORKSPACE_PLAN_DETAILS = "workspaces/plan_details";
|
|
67
|
-
export declare const ENDPOINT_WORKSPACE_USERS = "workspaces/users";
|
|
68
|
-
export declare function getWorkspaceInvitationAcceptEndpoint(inviteCode: string): string;
|
|
69
|
-
export declare function getWorkspaceInvitationRejectEndpoint(inviteCode: string): string;
|
|
70
|
-
export declare function getProjectInsightsActivityStatsEndpoint(projectId: string): string;
|
|
71
|
-
export declare function getProjectInsightsHealthEndpoint(projectId: string): string;
|
|
72
|
-
export declare function getProjectInsightsHealthContextEndpoint(projectId: string): string;
|
|
73
|
-
export declare function getProjectInsightsProgressEndpoint(projectId: string): string;
|
|
74
|
-
export declare function getProjectInsightsHealthAnalyzeEndpoint(projectId: string): string;
|
|
75
|
-
export declare function getWorkspaceInsightsEndpoint(workspaceId: string): string;
|
|
76
|
-
export declare const ENDPOINT_WORKSPACE_MEMBERS = "workspaces/members";
|
|
77
|
-
export declare function getWorkspaceUserTasksEndpoint(workspaceId: string, userId: string): string;
|
|
78
|
-
export declare function getWorkspaceInviteUsersEndpoint(workspaceId: string): string;
|
|
79
|
-
export declare function getWorkspaceUserEndpoint(workspaceId: string, userId: string): string;
|
|
80
|
-
export declare function getWorkspaceActiveProjectsEndpoint(workspaceId: number): string;
|
|
81
|
-
export declare function getWorkspaceArchivedProjectsEndpoint(workspaceId: number): string;
|
package/dist/types/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function assertInstance<T extends new (...args: any) => any>(value: unknown, type: T): asserts value is InstanceType<T>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { http, HttpResponse, type DefaultBodyType } from 'msw';
|
|
2
|
-
export type MockApiOptions = {
|
|
3
|
-
status?: number;
|
|
4
|
-
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
5
|
-
headers?: Record<string, string>;
|
|
6
|
-
};
|
|
7
|
-
export type CapturedRequest = {
|
|
8
|
-
url: string;
|
|
9
|
-
method: string;
|
|
10
|
-
headers: Record<string, string>;
|
|
11
|
-
body: unknown;
|
|
12
|
-
};
|
|
13
|
-
export declare function captureRequest({ request, body }: {
|
|
14
|
-
request: Request;
|
|
15
|
-
body: unknown;
|
|
16
|
-
}): void;
|
|
17
|
-
export declare function getLastRequest(): CapturedRequest | undefined;
|
|
18
|
-
export declare function getAllRequests(): CapturedRequest[];
|
|
19
|
-
export declare function clearCapturedRequests(): void;
|
|
20
|
-
export declare const handlers: never[];
|
|
21
|
-
export declare const server: import("msw/node").SetupServerApi;
|
|
22
|
-
export declare function mockApiResponse<T extends DefaultBodyType>({ endpoint, data, options, }: {
|
|
23
|
-
endpoint: string;
|
|
24
|
-
data: T;
|
|
25
|
-
options?: MockApiOptions;
|
|
26
|
-
}): void;
|
|
27
|
-
export declare function mockApiError<T extends DefaultBodyType>({ endpoint, data, status, options, }: {
|
|
28
|
-
endpoint: string;
|
|
29
|
-
data: T;
|
|
30
|
-
status: number;
|
|
31
|
-
options?: Omit<MockApiOptions, 'status'>;
|
|
32
|
-
}): void;
|
|
33
|
-
export { http, HttpResponse };
|