@todoist/sdk 0.0.0-stage → 18.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +308 -2
- package/dist/esm/authentication.js +307 -0
- package/dist/esm/clients/activity-client.js +60 -0
- package/dist/esm/clients/app-client.js +366 -0
- package/dist/esm/clients/backup-client.js +47 -0
- package/dist/esm/clients/base-client.js +29 -0
- package/dist/esm/clients/billing-client.js +160 -0
- package/dist/esm/clients/comment-client.js +92 -0
- package/dist/esm/clients/email-client.js +41 -0
- package/dist/esm/clients/filter-client.js +26 -0
- package/dist/esm/clients/folder-client.js +80 -0
- package/dist/esm/clients/id-mapping-client.js +37 -0
- package/dist/esm/clients/insights-client.js +89 -0
- package/dist/esm/clients/label-client.js +131 -0
- package/dist/esm/clients/productivity-client.js +24 -0
- package/dist/esm/clients/project-client.js +284 -0
- package/dist/esm/clients/reminder-client.js +204 -0
- package/dist/esm/clients/section-client.js +121 -0
- package/dist/esm/clients/task-client.js +264 -0
- package/dist/esm/clients/template-client.js +89 -0
- package/dist/esm/clients/ui-extension-client.js +110 -0
- package/dist/esm/clients/upload-client.js +153 -0
- package/dist/esm/clients/view-options-client.js +21 -0
- package/dist/esm/clients/workspace-client.js +384 -0
- package/dist/esm/consts/endpoints.js +193 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/test-utils/asserts.js +8 -0
- package/dist/esm/test-utils/msw-setup.js +88 -0
- package/dist/esm/test-utils/obsidian-fetch-adapter.js +51 -0
- package/dist/esm/test-utils/test-defaults.js +367 -0
- package/dist/esm/test-utils/transport-seam.js +15 -0
- package/dist/esm/test-utils/webhook-fixtures.js +26 -0
- package/dist/esm/todoist-api.js +1757 -0
- package/dist/esm/transport/fetch-with-retry.js +216 -0
- package/dist/esm/transport/http-client.js +140 -0
- package/dist/esm/transport/http-dispatcher.js +158 -0
- package/dist/esm/transport/sync-request.js +106 -0
- package/dist/esm/types/activity/index.js +2 -0
- package/dist/esm/types/activity/requests.js +1 -0
- package/dist/esm/types/activity/types.js +45 -0
- package/dist/esm/types/apps/index.js +2 -0
- package/dist/esm/types/apps/requests.js +1 -0
- package/dist/esm/types/apps/types.js +249 -0
- package/dist/esm/types/backups/index.js +2 -0
- package/dist/esm/types/backups/requests.js +1 -0
- package/dist/esm/types/backups/types.js +5 -0
- package/dist/esm/types/billing/index.js +2 -0
- package/dist/esm/types/billing/requests.js +1 -0
- package/dist/esm/types/billing/types.js +89 -0
- package/dist/esm/types/comments/index.js +2 -0
- package/dist/esm/types/comments/requests.js +1 -0
- package/dist/esm/types/comments/types.js +57 -0
- package/dist/esm/types/common.js +7 -0
- package/dist/esm/types/emails/index.js +1 -0
- package/dist/esm/types/emails/requests.js +2 -0
- package/dist/esm/types/errors.js +41 -0
- package/dist/esm/types/folders/index.js +1 -0
- package/dist/esm/types/folders/requests.js +1 -0
- package/dist/esm/types/http.js +20 -0
- package/dist/esm/types/id-mappings/index.js +2 -0
- package/dist/esm/types/id-mappings/requests.js +17 -0
- package/dist/esm/types/id-mappings/types.js +9 -0
- package/dist/esm/types/index.js +24 -0
- package/dist/esm/types/insights/index.js +2 -0
- package/dist/esm/types/insights/requests.js +1 -0
- package/dist/esm/types/insights/types.js +77 -0
- package/dist/esm/types/labels/index.js +2 -0
- package/dist/esm/types/labels/requests.js +1 -0
- package/dist/esm/types/labels/types.js +8 -0
- package/dist/esm/types/productivity/index.js +1 -0
- package/dist/esm/types/productivity/types.js +65 -0
- package/dist/esm/types/projects/index.js +2 -0
- package/dist/esm/types/projects/requests.js +1 -0
- package/dist/esm/types/projects/types.js +65 -0
- package/dist/esm/types/reminders/index.js +1 -0
- package/dist/esm/types/reminders/requests.js +92 -0
- package/dist/esm/types/sections/index.js +2 -0
- package/dist/esm/types/sections/requests.js +1 -0
- package/dist/esm/types/sections/types.js +23 -0
- package/dist/esm/types/sync/commands/calendars.js +1 -0
- package/dist/esm/types/sync/commands/filters.js +1 -0
- package/dist/esm/types/sync/commands/folders.js +1 -0
- package/dist/esm/types/sync/commands/index.js +18 -0
- package/dist/esm/types/sync/commands/labels.js +2 -0
- package/dist/esm/types/sync/commands/notes.js +1 -0
- package/dist/esm/types/sync/commands/notifications.js +1 -0
- package/dist/esm/types/sync/commands/others.js +1 -0
- package/dist/esm/types/sync/commands/project-view-options.js +1 -0
- package/dist/esm/types/sync/commands/projects.js +1 -0
- package/dist/esm/types/sync/commands/reminders.js +1 -0
- package/dist/esm/types/sync/commands/sections.js +1 -0
- package/dist/esm/types/sync/commands/shared.js +16 -0
- package/dist/esm/types/sync/commands/sharing.js +1 -0
- package/dist/esm/types/sync/commands/tasks.js +1 -0
- package/dist/esm/types/sync/commands/view-options.js +1 -0
- package/dist/esm/types/sync/commands/workspace-filters.js +1 -0
- package/dist/esm/types/sync/commands/workspaces.js +1 -0
- package/dist/esm/types/sync/index.js +6 -0
- package/dist/esm/types/sync/request.js +1 -0
- package/dist/esm/types/sync/resource-types.js +36 -0
- package/dist/esm/types/sync/resources/calendars.js +24 -0
- package/dist/esm/types/sync/resources/collaborators.js +21 -0
- package/dist/esm/types/sync/resources/completed-info.js +21 -0
- package/dist/esm/types/sync/resources/filters.js +12 -0
- package/dist/esm/types/sync/resources/folders.js +10 -0
- package/dist/esm/types/sync/resources/index.js +18 -0
- package/dist/esm/types/sync/resources/labels.js +7 -0
- package/dist/esm/types/sync/resources/live-notifications.js +35 -0
- package/dist/esm/types/sync/resources/notes.js +18 -0
- package/dist/esm/types/sync/resources/reminders.js +58 -0
- package/dist/esm/types/sync/resources/suggestions.js +33 -0
- package/dist/esm/types/sync/resources/tooltips.js +5 -0
- package/dist/esm/types/sync/resources/user-plan-limits.js +21 -0
- package/dist/esm/types/sync/resources/user-settings.js +41 -0
- package/dist/esm/types/sync/resources/user-status.js +22 -0
- package/dist/esm/types/sync/resources/user.js +109 -0
- package/dist/esm/types/sync/resources/view-options.js +128 -0
- package/dist/esm/types/sync/resources/workspace-filters.js +17 -0
- package/dist/esm/types/sync/resources/workspaces.js +69 -0
- package/dist/esm/types/sync/response.js +57 -0
- package/dist/esm/types/sync/user-preferences.js +68 -0
- package/dist/esm/types/tasks/index.js +2 -0
- package/dist/esm/types/tasks/requests.js +1 -0
- package/dist/esm/types/tasks/types.js +56 -0
- package/dist/esm/types/templates/index.js +1 -0
- package/dist/esm/types/templates/requests.js +1 -0
- package/dist/esm/types/ui-extensions/index.js +2 -0
- package/dist/esm/types/ui-extensions/requests.js +1 -0
- package/dist/esm/types/ui-extensions/types.js +74 -0
- package/dist/esm/types/uploads/index.js +1 -0
- package/dist/esm/types/uploads/requests.js +1 -0
- package/dist/esm/types/users/index.js +1 -0
- package/dist/esm/types/users/types.js +49 -0
- package/dist/esm/types/webhooks/comments.js +93 -0
- package/dist/esm/types/webhooks/envelope.js +23 -0
- package/dist/esm/types/webhooks/filters.js +27 -0
- package/dist/esm/types/webhooks/index.js +9 -0
- package/dist/esm/types/webhooks/labels.js +51 -0
- package/dist/esm/types/webhooks/projects.js +33 -0
- package/dist/esm/types/webhooks/reminders.js +32 -0
- package/dist/esm/types/webhooks/sections.js +50 -0
- package/dist/esm/types/webhooks/tasks.js +65 -0
- package/dist/esm/types/webhooks/types.js +52 -0
- package/dist/esm/types/workspaces/index.js +2 -0
- package/dist/esm/types/workspaces/requests.js +1 -0
- package/dist/esm/types/workspaces/types.js +151 -0
- package/dist/esm/utils/activity-helpers.js +53 -0
- package/dist/esm/utils/case-conversion.js +84 -0
- package/dist/esm/utils/colors.js +145 -0
- package/dist/esm/utils/file-response.js +29 -0
- package/dist/esm/utils/filter-queries.js +231 -0
- package/dist/esm/utils/filter-query-definitions.js +2789 -0
- package/dist/esm/utils/headers.js +42 -0
- package/dist/esm/utils/index.js +11 -0
- package/dist/esm/utils/multipart-upload.js +267 -0
- package/dist/esm/utils/person-names.js +61 -0
- package/dist/esm/utils/processing-helpers.js +12 -0
- package/dist/esm/utils/project-helpers.js +29 -0
- package/dist/esm/utils/request-helpers.js +43 -0
- package/dist/esm/utils/sanitization.js +131 -0
- package/dist/esm/utils/sync-helpers.js +19 -0
- package/dist/esm/utils/task-sorting.js +280 -0
- package/dist/esm/utils/uncompletable-helpers.js +54 -0
- package/dist/esm/utils/url-helpers.js +196 -0
- package/dist/esm/utils/validators.js +102 -0
- package/dist/esm/utils/view-options.js +15 -0
- package/dist/esm/utils/webhook-parser.js +56 -0
- package/dist/types/authentication.d.ts +262 -0
- package/dist/types/clients/activity-client.d.ts +12 -0
- package/dist/types/clients/app-client.d.ts +37 -0
- package/dist/types/clients/backup-client.d.ts +14 -0
- package/dist/types/clients/base-client.d.ts +23 -0
- package/dist/types/clients/billing-client.d.ts +22 -0
- package/dist/types/clients/comment-client.d.ts +15 -0
- package/dist/types/clients/email-client.d.ts +13 -0
- package/dist/types/clients/filter-client.d.ts +10 -0
- package/dist/types/clients/folder-client.d.ts +16 -0
- package/dist/types/clients/id-mapping-client.d.ts +13 -0
- package/dist/types/clients/insights-client.d.ts +18 -0
- package/dist/types/clients/label-client.d.ts +19 -0
- package/dist/types/clients/productivity-client.d.ts +12 -0
- package/dist/types/clients/project-client.d.ts +22 -0
- package/dist/types/clients/reminder-client.d.ts +25 -0
- package/dist/types/clients/section-client.d.ts +18 -0
- package/dist/types/clients/task-client.d.ts +25 -0
- package/dist/types/clients/template-client.d.ts +17 -0
- package/dist/types/clients/ui-extension-client.d.ts +18 -0
- package/dist/types/clients/upload-client.d.ts +17 -0
- package/dist/types/clients/view-options-client.d.ts +8 -0
- package/dist/types/clients/workspace-client.d.ts +43 -0
- package/dist/types/consts/endpoints.d.ts +120 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/test-utils/asserts.d.ts +1 -0
- package/dist/types/test-utils/msw-setup.d.ts +33 -0
- package/dist/types/test-utils/obsidian-fetch-adapter.d.ts +29 -0
- package/dist/types/test-utils/test-defaults.d.ts +286 -0
- package/dist/types/test-utils/transport-seam.d.ts +1 -0
- package/dist/types/test-utils/webhook-fixtures.d.ts +13 -0
- package/dist/types/todoist-api.d.ts +1437 -0
- package/dist/types/transport/fetch-with-retry.d.ts +12 -0
- package/dist/types/transport/http-client.d.ts +25 -0
- package/dist/types/transport/http-dispatcher.d.ts +65 -0
- package/dist/types/transport/sync-request.d.ts +31 -0
- package/dist/types/types/activity/index.d.ts +2 -0
- package/dist/types/types/activity/requests.d.ts +85 -0
- package/dist/types/types/activity/types.d.ts +56 -0
- package/dist/types/types/apps/index.d.ts +2 -0
- package/dist/types/types/apps/requests.d.ts +89 -0
- package/dist/types/types/apps/types.d.ts +418 -0
- package/dist/types/types/backups/index.d.ts +2 -0
- package/dist/types/types/backups/requests.d.ts +16 -0
- package/dist/types/types/backups/types.d.ts +7 -0
- package/dist/types/types/billing/index.d.ts +2 -0
- package/dist/types/types/billing/requests.d.ts +62 -0
- package/dist/types/types/billing/types.d.ts +207 -0
- package/dist/types/types/comments/index.d.ts +2 -0
- package/dist/types/types/comments/requests.d.ts +64 -0
- package/dist/types/types/comments/types.d.ts +141 -0
- package/dist/types/types/common.d.ts +13 -0
- package/dist/types/types/emails/index.d.ts +1 -0
- package/dist/types/types/emails/requests.d.ts +30 -0
- package/dist/types/types/errors.d.ts +29 -0
- package/dist/types/types/folders/index.d.ts +1 -0
- package/dist/types/types/folders/requests.d.ts +20 -0
- package/dist/types/types/http.d.ts +104 -0
- package/dist/types/types/id-mappings/index.d.ts +2 -0
- package/dist/types/types/id-mappings/requests.d.ts +28 -0
- package/dist/types/types/id-mappings/types.d.ts +13 -0
- package/dist/types/types/index.d.ts +24 -0
- package/dist/types/types/insights/index.d.ts +2 -0
- package/dist/types/types/insights/requests.d.ts +26 -0
- package/dist/types/types/insights/types.d.ts +167 -0
- package/dist/types/types/labels/index.d.ts +2 -0
- package/dist/types/types/labels/requests.d.ts +75 -0
- package/dist/types/types/labels/types.d.ts +13 -0
- package/dist/types/types/productivity/index.d.ts +1 -0
- package/dist/types/types/productivity/types.d.ts +115 -0
- package/dist/types/types/projects/index.d.ts +2 -0
- package/dist/types/types/projects/requests.d.ts +206 -0
- package/dist/types/types/projects/types.d.ts +286 -0
- package/dist/types/types/reminders/index.d.ts +1 -0
- package/dist/types/types/reminders/requests.d.ts +205 -0
- package/dist/types/types/sections/index.d.ts +2 -0
- package/dist/types/types/sections/requests.d.ts +49 -0
- package/dist/types/types/sections/types.d.ts +70 -0
- package/dist/types/types/sync/commands/calendars.d.ts +14 -0
- package/dist/types/types/sync/commands/filters.d.ts +24 -0
- package/dist/types/types/sync/commands/folders.d.ts +20 -0
- package/dist/types/types/sync/commands/index.d.ts +167 -0
- package/dist/types/types/sync/commands/labels.d.ts +32 -0
- package/dist/types/types/sync/commands/notes.d.ts +27 -0
- package/dist/types/types/sync/commands/notifications.d.ts +10 -0
- package/dist/types/types/sync/commands/others.d.ts +61 -0
- package/dist/types/types/sync/commands/project-view-options.d.ts +13 -0
- package/dist/types/types/sync/commands/projects.d.ts +96 -0
- package/dist/types/types/sync/commands/reminders.d.ts +51 -0
- package/dist/types/types/sync/commands/sections.d.ts +36 -0
- package/dist/types/types/sync/commands/shared.d.ts +51 -0
- package/dist/types/types/sync/commands/sharing.d.ts +16 -0
- package/dist/types/types/sync/commands/tasks.d.ts +78 -0
- package/dist/types/types/sync/commands/view-options.d.ts +18 -0
- package/dist/types/types/sync/commands/workspace-filters.d.ts +25 -0
- package/dist/types/types/sync/commands/workspaces.d.ts +82 -0
- package/dist/types/types/sync/index.d.ts +6 -0
- package/dist/types/types/sync/request.d.ts +7 -0
- package/dist/types/types/sync/resource-types.d.ts +5 -0
- package/dist/types/types/sync/resources/calendars.d.ts +38 -0
- package/dist/types/types/sync/resources/collaborators.d.ts +45 -0
- package/dist/types/types/sync/resources/completed-info.d.ts +33 -0
- package/dist/types/types/sync/resources/filters.d.ts +13 -0
- package/dist/types/types/sync/resources/folders.d.ts +11 -0
- package/dist/types/types/sync/resources/index.d.ts +18 -0
- package/dist/types/types/sync/resources/labels.d.ts +12 -0
- package/dist/types/types/sync/resources/live-notifications.d.ts +32 -0
- package/dist/types/types/sync/resources/notes.d.ts +34 -0
- package/dist/types/types/sync/resources/reminders.d.ts +213 -0
- package/dist/types/types/sync/resources/suggestions.d.ts +96 -0
- package/dist/types/types/sync/resources/tooltips.d.ts +6 -0
- package/dist/types/types/sync/resources/user-plan-limits.d.ts +47 -0
- package/dist/types/types/sync/resources/user-settings.d.ts +40 -0
- package/dist/types/types/sync/resources/user-status.d.ts +46 -0
- package/dist/types/types/sync/resources/user.d.ts +151 -0
- package/dist/types/types/sync/resources/view-options.d.ts +157 -0
- package/dist/types/types/sync/resources/workspace-filters.d.ts +18 -0
- package/dist/types/types/sync/resources/workspaces.d.ts +142 -0
- package/dist/types/types/sync/response.d.ts +930 -0
- package/dist/types/types/sync/user-preferences.d.ts +39 -0
- package/dist/types/types/tasks/index.d.ts +2 -0
- package/dist/types/types/tasks/requests.d.ts +197 -0
- package/dist/types/types/tasks/types.d.ts +162 -0
- package/dist/types/types/templates/index.d.ts +1 -0
- package/dist/types/types/templates/requests.d.ts +92 -0
- package/dist/types/types/ui-extensions/index.d.ts +2 -0
- package/dist/types/types/ui-extensions/requests.d.ts +108 -0
- package/dist/types/types/ui-extensions/types.d.ts +185 -0
- package/dist/types/types/uploads/index.d.ts +1 -0
- package/dist/types/types/uploads/requests.d.ts +32 -0
- package/dist/types/types/users/index.d.ts +1 -0
- package/dist/types/types/users/types.d.ts +67 -0
- package/dist/types/types/webhooks/comments.d.ts +1600 -0
- package/dist/types/types/webhooks/envelope.d.ts +34 -0
- package/dist/types/types/webhooks/filters.d.ts +99 -0
- package/dist/types/types/webhooks/index.d.ts +9 -0
- package/dist/types/types/webhooks/labels.d.ts +160 -0
- package/dist/types/types/webhooks/projects.d.ts +365 -0
- package/dist/types/types/webhooks/reminders.d.ts +82 -0
- package/dist/types/types/webhooks/sections.d.ts +372 -0
- package/dist/types/types/webhooks/tasks.d.ts +981 -0
- package/dist/types/types/webhooks/types.d.ts +2606 -0
- package/dist/types/types/workspaces/index.d.ts +2 -0
- package/dist/types/types/workspaces/requests.d.ts +260 -0
- package/dist/types/types/workspaces/types.d.ts +266 -0
- package/dist/types/utils/activity-helpers.d.ts +28 -0
- package/dist/types/utils/case-conversion.d.ts +20 -0
- package/dist/types/utils/colors.d.ts +201 -0
- package/dist/types/utils/file-response.d.ts +15 -0
- package/dist/types/utils/filter-queries.d.ts +42 -0
- package/dist/types/utils/filter-query-definitions.d.ts +27 -0
- package/dist/types/utils/headers.d.ts +20 -0
- package/dist/types/utils/index.d.ts +15 -0
- package/dist/types/utils/multipart-upload.d.ts +58 -0
- package/dist/types/utils/person-names.d.ts +52 -0
- package/dist/types/utils/processing-helpers.d.ts +1 -0
- package/dist/types/utils/project-helpers.d.ts +21 -0
- package/dist/types/utils/request-helpers.d.ts +33 -0
- package/dist/types/utils/sanitization.d.ts +52 -0
- package/dist/types/utils/sync-helpers.d.ts +17 -0
- package/dist/types/utils/task-sorting.d.ts +46 -0
- package/dist/types/utils/uncompletable-helpers.d.ts +30 -0
- package/dist/types/utils/url-helpers.d.ts +120 -0
- package/dist/types/utils/validators.d.ts +1917 -0
- package/dist/types/utils/view-options.d.ts +11 -0
- package/dist/types/utils/webhook-parser.d.ts +48 -0
- package/package.json +88 -5
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import type { Color } from '../types/productivity/types.js';
|
|
2
|
+
export declare const berryRed: {
|
|
3
|
+
readonly key: "berry_red";
|
|
4
|
+
readonly displayName: "Berry Red";
|
|
5
|
+
readonly hexValue: "#b8255f";
|
|
6
|
+
};
|
|
7
|
+
export declare const red: {
|
|
8
|
+
readonly key: "red";
|
|
9
|
+
readonly displayName: "Red";
|
|
10
|
+
readonly hexValue: "#db4035";
|
|
11
|
+
};
|
|
12
|
+
export declare const orange: {
|
|
13
|
+
readonly key: "orange";
|
|
14
|
+
readonly displayName: "Orange";
|
|
15
|
+
readonly hexValue: "#ff9933";
|
|
16
|
+
};
|
|
17
|
+
export declare const yellow: {
|
|
18
|
+
readonly key: "yellow";
|
|
19
|
+
readonly displayName: "Yellow";
|
|
20
|
+
readonly hexValue: "#fad000";
|
|
21
|
+
};
|
|
22
|
+
export declare const oliveGreen: {
|
|
23
|
+
readonly key: "olive_green";
|
|
24
|
+
readonly displayName: "Olive Green";
|
|
25
|
+
readonly hexValue: "#afb83b";
|
|
26
|
+
};
|
|
27
|
+
export declare const limeGreen: {
|
|
28
|
+
readonly key: "lime_green";
|
|
29
|
+
readonly displayName: "Lime Green";
|
|
30
|
+
readonly hexValue: "#7ecc49";
|
|
31
|
+
};
|
|
32
|
+
export declare const green: {
|
|
33
|
+
readonly key: "green";
|
|
34
|
+
readonly displayName: "Green";
|
|
35
|
+
readonly hexValue: "#299438";
|
|
36
|
+
};
|
|
37
|
+
export declare const mintGreen: {
|
|
38
|
+
readonly key: "mint_green";
|
|
39
|
+
readonly displayName: "Mint Green";
|
|
40
|
+
readonly hexValue: "#6accbc";
|
|
41
|
+
};
|
|
42
|
+
export declare const teal: {
|
|
43
|
+
readonly key: "teal";
|
|
44
|
+
readonly displayName: "Teal";
|
|
45
|
+
readonly hexValue: "#158fad";
|
|
46
|
+
};
|
|
47
|
+
export declare const skyBlue: {
|
|
48
|
+
readonly key: "sky_blue";
|
|
49
|
+
readonly displayName: "Sky Blue";
|
|
50
|
+
readonly hexValue: "#14aaf5";
|
|
51
|
+
};
|
|
52
|
+
export declare const lightBlue: {
|
|
53
|
+
readonly key: "light_blue";
|
|
54
|
+
readonly displayName: "Light Blue";
|
|
55
|
+
readonly hexValue: "#96c3eb";
|
|
56
|
+
};
|
|
57
|
+
export declare const blue: {
|
|
58
|
+
readonly key: "blue";
|
|
59
|
+
readonly displayName: "Blue";
|
|
60
|
+
readonly hexValue: "#4073ff";
|
|
61
|
+
};
|
|
62
|
+
export declare const grape: {
|
|
63
|
+
readonly key: "grape";
|
|
64
|
+
readonly displayName: "Grape";
|
|
65
|
+
readonly hexValue: "#884dff";
|
|
66
|
+
};
|
|
67
|
+
export declare const violet: {
|
|
68
|
+
readonly key: "violet";
|
|
69
|
+
readonly displayName: "Violet";
|
|
70
|
+
readonly hexValue: "#af38eb";
|
|
71
|
+
};
|
|
72
|
+
export declare const lavender: {
|
|
73
|
+
readonly key: "lavender";
|
|
74
|
+
readonly displayName: "Lavender";
|
|
75
|
+
readonly hexValue: "#eb96eb";
|
|
76
|
+
};
|
|
77
|
+
export declare const magenta: {
|
|
78
|
+
readonly key: "magenta";
|
|
79
|
+
readonly displayName: "Magenta";
|
|
80
|
+
readonly hexValue: "#e05194";
|
|
81
|
+
};
|
|
82
|
+
export declare const salmon: {
|
|
83
|
+
readonly key: "salmon";
|
|
84
|
+
readonly displayName: "Salmon";
|
|
85
|
+
readonly hexValue: "#ff8d85";
|
|
86
|
+
};
|
|
87
|
+
export declare const charcoal: {
|
|
88
|
+
readonly key: "charcoal";
|
|
89
|
+
readonly displayName: "Charcoal";
|
|
90
|
+
readonly hexValue: "#808080";
|
|
91
|
+
};
|
|
92
|
+
export declare const grey: {
|
|
93
|
+
readonly key: "grey";
|
|
94
|
+
readonly displayName: "Grey";
|
|
95
|
+
readonly hexValue: "#b8b8b8";
|
|
96
|
+
};
|
|
97
|
+
export declare const taupe: {
|
|
98
|
+
readonly key: "taupe";
|
|
99
|
+
readonly displayName: "Taupe";
|
|
100
|
+
readonly hexValue: "#ccac93";
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Every color, in the order the apps show them. The keys mirror `TodoistColor` from
|
|
104
|
+
* `@doist/sdk-kmp/shared-todoist-all`; the display names and hex values are the SDK's own.
|
|
105
|
+
*/
|
|
106
|
+
export declare const colors: readonly [{
|
|
107
|
+
readonly key: "berry_red";
|
|
108
|
+
readonly displayName: "Berry Red";
|
|
109
|
+
readonly hexValue: "#b8255f";
|
|
110
|
+
}, {
|
|
111
|
+
readonly key: "red";
|
|
112
|
+
readonly displayName: "Red";
|
|
113
|
+
readonly hexValue: "#db4035";
|
|
114
|
+
}, {
|
|
115
|
+
readonly key: "orange";
|
|
116
|
+
readonly displayName: "Orange";
|
|
117
|
+
readonly hexValue: "#ff9933";
|
|
118
|
+
}, {
|
|
119
|
+
readonly key: "yellow";
|
|
120
|
+
readonly displayName: "Yellow";
|
|
121
|
+
readonly hexValue: "#fad000";
|
|
122
|
+
}, {
|
|
123
|
+
readonly key: "olive_green";
|
|
124
|
+
readonly displayName: "Olive Green";
|
|
125
|
+
readonly hexValue: "#afb83b";
|
|
126
|
+
}, {
|
|
127
|
+
readonly key: "lime_green";
|
|
128
|
+
readonly displayName: "Lime Green";
|
|
129
|
+
readonly hexValue: "#7ecc49";
|
|
130
|
+
}, {
|
|
131
|
+
readonly key: "green";
|
|
132
|
+
readonly displayName: "Green";
|
|
133
|
+
readonly hexValue: "#299438";
|
|
134
|
+
}, {
|
|
135
|
+
readonly key: "mint_green";
|
|
136
|
+
readonly displayName: "Mint Green";
|
|
137
|
+
readonly hexValue: "#6accbc";
|
|
138
|
+
}, {
|
|
139
|
+
readonly key: "teal";
|
|
140
|
+
readonly displayName: "Teal";
|
|
141
|
+
readonly hexValue: "#158fad";
|
|
142
|
+
}, {
|
|
143
|
+
readonly key: "sky_blue";
|
|
144
|
+
readonly displayName: "Sky Blue";
|
|
145
|
+
readonly hexValue: "#14aaf5";
|
|
146
|
+
}, {
|
|
147
|
+
readonly key: "light_blue";
|
|
148
|
+
readonly displayName: "Light Blue";
|
|
149
|
+
readonly hexValue: "#96c3eb";
|
|
150
|
+
}, {
|
|
151
|
+
readonly key: "blue";
|
|
152
|
+
readonly displayName: "Blue";
|
|
153
|
+
readonly hexValue: "#4073ff";
|
|
154
|
+
}, {
|
|
155
|
+
readonly key: "grape";
|
|
156
|
+
readonly displayName: "Grape";
|
|
157
|
+
readonly hexValue: "#884dff";
|
|
158
|
+
}, {
|
|
159
|
+
readonly key: "violet";
|
|
160
|
+
readonly displayName: "Violet";
|
|
161
|
+
readonly hexValue: "#af38eb";
|
|
162
|
+
}, {
|
|
163
|
+
readonly key: "lavender";
|
|
164
|
+
readonly displayName: "Lavender";
|
|
165
|
+
readonly hexValue: "#eb96eb";
|
|
166
|
+
}, {
|
|
167
|
+
readonly key: "magenta";
|
|
168
|
+
readonly displayName: "Magenta";
|
|
169
|
+
readonly hexValue: "#e05194";
|
|
170
|
+
}, {
|
|
171
|
+
readonly key: "salmon";
|
|
172
|
+
readonly displayName: "Salmon";
|
|
173
|
+
readonly hexValue: "#ff8d85";
|
|
174
|
+
}, {
|
|
175
|
+
readonly key: "charcoal";
|
|
176
|
+
readonly displayName: "Charcoal";
|
|
177
|
+
readonly hexValue: "#808080";
|
|
178
|
+
}, {
|
|
179
|
+
readonly key: "grey";
|
|
180
|
+
readonly displayName: "Grey";
|
|
181
|
+
readonly hexValue: "#b8b8b8";
|
|
182
|
+
}, {
|
|
183
|
+
readonly key: "taupe";
|
|
184
|
+
readonly displayName: "Taupe";
|
|
185
|
+
readonly hexValue: "#ccac93";
|
|
186
|
+
}];
|
|
187
|
+
export type ColorKey = (typeof colors)[number]['key'];
|
|
188
|
+
export declare const defaultColor: Color;
|
|
189
|
+
/**
|
|
190
|
+
* Retrieves a {@link Color} object by its key identifier.
|
|
191
|
+
*
|
|
192
|
+
* @param colorKey - The unique key identifier of the color to find (e.g., 'berry_red', 'sky_blue')
|
|
193
|
+
* @returns The matching Color object if found, otherwise returns the default color (charcoal)
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* const color = getColorByKey('berry_red');
|
|
198
|
+
* console.log(color.hexValue); // '#b8255f'
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
export declare function getColorByKey(colorKey: string): Color;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CustomFetchResponse, FileResponse } from '../types/http.js';
|
|
2
|
+
type AnyResponse = CustomFetchResponse | Response;
|
|
3
|
+
/**
|
|
4
|
+
* Wraps either a native `Response` or a `CustomFetchResponse` into the SDK's
|
|
5
|
+
* `FileResponse` shape (binary endpoints: `viewAttachment`, `downloadBackup`).
|
|
6
|
+
*
|
|
7
|
+
* `arrayBuffer()` is resolved lazily. A customFetch implementation that omits
|
|
8
|
+
* `arrayBuffer()` is still valid for callers that only read `text()`/`json()`;
|
|
9
|
+
* the descriptive error is thrown only if the caller actually requests binary
|
|
10
|
+
* bytes. This avoids the lossy `text()` → `TextEncoder` round-trip that
|
|
11
|
+
* corrupts non-UTF-8 bytes (every `0x80`-`0xFF` byte not part of a valid UTF-8
|
|
12
|
+
* sequence is replaced with `U+FFFD`).
|
|
13
|
+
*/
|
|
14
|
+
export declare function wrapAsFileResponse(response: AnyResponse, context: 'viewAttachment' | 'downloadBackup'): FileResponse;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type IsDateDrivenQueryOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Language the query is written in, as the account's `lang`. Unknown codes
|
|
4
|
+
* and regional variants fall back to their base language, then to English.
|
|
5
|
+
*/
|
|
6
|
+
lang?: string | null;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Returns whether a filter query leads with dates rather than with priority.
|
|
10
|
+
*
|
|
11
|
+
* Todoist gives every filter one of two default hierarchies, and a query that
|
|
12
|
+
* mentions dates gets the date-first one. Pass the answer to {@link sortTasks}
|
|
13
|
+
* as its `defaultOrder`:
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* sortTasks(tasks, {
|
|
17
|
+
* sortedBy: savedOptions?.sortedBy,
|
|
18
|
+
* sortOrder: savedOptions?.sortOrder,
|
|
19
|
+
* defaultOrder: isDateDrivenQuery(query, { lang }) ? 'DATE_FIRST' : 'PRIORITY_FIRST',
|
|
20
|
+
* })
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* The query is read in `lang`, the account language `getUser` returns, the way
|
|
24
|
+
* the API reads it. English keywords parse under every language, so `lang` only
|
|
25
|
+
* matters for a query written in the account's own: `sin fecha` is a keyword
|
|
26
|
+
* under `es` and an unreadable phrase under `en`.
|
|
27
|
+
*
|
|
28
|
+
* Commas divide a filter into subqueries and Todoist draws each one as its own
|
|
29
|
+
* list, with its own hierarchy. Classify them one at a time for exact results;
|
|
30
|
+
* a whole query answers true only when every subquery is date-driven.
|
|
31
|
+
*
|
|
32
|
+
* Two kinds of unreadable query part company here. One that breaks the grammar,
|
|
33
|
+
* such as `(today`, returns false. One that only breaks the vocabulary, such as
|
|
34
|
+
* `sin fecha` under `en`, returns true, because a word this package doesn't
|
|
35
|
+
* recognize is treated as a bare date. Pass the account's own `lang` and the
|
|
36
|
+
* question doesn't arise; get it wrong and a keyword can read as a date.
|
|
37
|
+
*
|
|
38
|
+
* The function performs no I/O.
|
|
39
|
+
*
|
|
40
|
+
* @see sortTasks
|
|
41
|
+
*/
|
|
42
|
+
export declare function isDateDrivenQuery(query: string, options?: IsDateDrivenQueryOptions): boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Languages the Todoist filter parser reads queries in.
|
|
3
|
+
*
|
|
4
|
+
* English keywords parse under every one of them, so only a query written in
|
|
5
|
+
* the account's own language needs the matching code.
|
|
6
|
+
*/
|
|
7
|
+
export declare const FILTER_QUERY_LANGUAGES: readonly ["cs", "da", "de", "en", "es", "fi", "fr", "it", "ja", "ko", "nb", "nl", "pl", "pt", "ru", "sv", "tr", "zh_cn", "zh_tw"];
|
|
8
|
+
/** A language the Todoist filter parser reads queries in. */
|
|
9
|
+
export type FilterQueryLanguage = (typeof FILTER_QUERY_LANGUAGES)[number];
|
|
10
|
+
/** Token kinds the Todoist filter lexer recognizes, in the order it tries them. */
|
|
11
|
+
export declare const FILTER_QUERY_TOKENS: readonly ["LEFT", "RIGHT", "NOT", "AND", "OR", "PRIORITY", "NO_PRIORITY", "PROJECT", "SECTION", "PROJECT_SINGLE", "LABEL", "NO_LABELS", "DUE", "DUE_BEFORE", "DUE_AFTER", "DEADLINE", "DEADLINE_BEFORE", "DEADLINE_AFTER", "DATE", "DATE_BEFORE", "DATE_AFTER", "DUE_RECURRING", "OVERDUE", "WITHIN_DAYS", "NO_DUE_DATE", "NO_DEADLINE", "NO_DATE", "NO_TIME", "CREATED", "CREATED_BEFORE", "CREATED_AFTER", "ADDED_BY", "SHARED", "ASSIGNED", "TO_ME", "TO_OTHERS", "ASSIGNED_TO", "ASSIGNED_BY", "SUBTASK", "VIEW_ALL", "ALL", "SEARCH", "WORKSPACE_SINGLE", "UNCOMPLETABLE"];
|
|
12
|
+
/** A token kind the Todoist filter lexer recognizes. */
|
|
13
|
+
export type FilterQueryToken = (typeof FILTER_QUERY_TOKENS)[number];
|
|
14
|
+
/**
|
|
15
|
+
* Tokens that make a subquery date-driven, from FilteristKt's `Grouper`.
|
|
16
|
+
*
|
|
17
|
+
* `recurring`, `no date` and `created:` are absent there too. Each says
|
|
18
|
+
* something about dates without giving the list one to lead with.
|
|
19
|
+
*/
|
|
20
|
+
export declare const FILTER_QUERY_DATE_TOKENS: readonly ["DUE", "DUE_BEFORE", "DUE_AFTER", "DEADLINE", "DEADLINE_BEFORE", "DEADLINE_AFTER", "DATE", "DATE_BEFORE", "DATE_AFTER", "OVERDUE", "WITHIN_DAYS"];
|
|
21
|
+
/** Tokens that join or negate operands rather than standing as one. */
|
|
22
|
+
export declare const FILTER_QUERY_OPERATOR_TOKENS: readonly ["LEFT", "RIGHT", "NOT", "AND", "OR"];
|
|
23
|
+
/**
|
|
24
|
+
* Localized patterns per token, each one the body of `^\s*<pattern>\s*` and
|
|
25
|
+
* matched case-insensitively at the cursor.
|
|
26
|
+
*/
|
|
27
|
+
export declare const FILTER_QUERY_PATTERNS: Record<FilterQueryLanguage, Record<FilterQueryToken, readonly string[]>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CustomHeaders } from '../types/http.js';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a native Fetch `Headers` object into a plain `Record<string, string>`.
|
|
4
|
+
* Used when wrapping a native `fetch` response into the SDK's `FileResponse`
|
|
5
|
+
* shape (which expects headers as a plain record for symmetry with
|
|
6
|
+
* `CustomFetchResponse`).
|
|
7
|
+
*/
|
|
8
|
+
export declare function headersToRecord(headers: Headers): Record<string, string>;
|
|
9
|
+
/**
|
|
10
|
+
* Merges header records left to right. HTTP header names are case-insensitive,
|
|
11
|
+
* so a later record replaces any earlier header with the same name whatever
|
|
12
|
+
* its case. Without this, a caller's `authorization` would sit alongside the
|
|
13
|
+
* SDK's `Authorization` and `fetch` would join the two into one value.
|
|
14
|
+
*/
|
|
15
|
+
export declare function mergeHeaders(...sources: (Record<string, string> | undefined)[]): Record<string, string>;
|
|
16
|
+
/**
|
|
17
|
+
* Turns the `headers` option into the record to send with one request, calling
|
|
18
|
+
* it when it is a function so per-request values are fresh.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveCustomHeaders(headers: CustomHeaders | undefined): Record<string, string> | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './colors.js';
|
|
2
|
+
export * from './sanitization.js';
|
|
3
|
+
export { getTaskUrl, getProjectUrl, getSectionUrl, getLabelUrl, getFilterUrl, getWorkspaceFilterUrl, getWorkspaceUrl, getTaskCommentsUrl, getProjectCommentsUrl, getTaskCommentUrl, getProjectCommentUrl, parseTodoistUrl, TODOIST_LINK_TYPES, } from './url-helpers.js';
|
|
4
|
+
export type { TodoistLinkType, TodoistUrlInfo } from './url-helpers.js';
|
|
5
|
+
export { createCommand } from './sync-helpers.js';
|
|
6
|
+
export * from './project-helpers.js';
|
|
7
|
+
export * from './person-names.js';
|
|
8
|
+
export { isDateDrivenQuery } from './filter-queries.js';
|
|
9
|
+
export type { IsDateDrivenQueryOptions } from './filter-queries.js';
|
|
10
|
+
export { FILTER_QUERY_LANGUAGES } from './filter-query-definitions.js';
|
|
11
|
+
export type { FilterQueryLanguage } from './filter-query-definitions.js';
|
|
12
|
+
export * from './task-sorting.js';
|
|
13
|
+
export * from './view-options.js';
|
|
14
|
+
export { parseWebhookPayload, verifyWebhookSignature } from './webhook-parser.js';
|
|
15
|
+
export type { VerifyWebhookSignatureArgs } from './webhook-parser.js';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { CustomFetch, CustomHeaders } from '../types/http.js';
|
|
2
|
+
type UploadMultipartFileArgs = {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
authToken: string;
|
|
5
|
+
endpoint: string;
|
|
6
|
+
file: Buffer | NodeJS.ReadableStream | string | Blob;
|
|
7
|
+
fileName?: string;
|
|
8
|
+
additionalFields: Record<string, string | number | boolean>;
|
|
9
|
+
requestId?: string;
|
|
10
|
+
/** Extra headers sent with the upload. Cannot replace `Authorization`, `X-Request-Id` or `Content-Type`. */
|
|
11
|
+
customHeaders?: CustomHeaders;
|
|
12
|
+
customFetch?: CustomFetch;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Uploads a file using multipart/form-data.
|
|
16
|
+
*
|
|
17
|
+
* This is a shared utility for uploading files to Todoist endpoints that require
|
|
18
|
+
* multipart/form-data content type (e.g., file uploads, workspace logo uploads).
|
|
19
|
+
*
|
|
20
|
+
* Supports both browser (Blob/File) and Node.js (Buffer/ReadableStream/path) environments.
|
|
21
|
+
*
|
|
22
|
+
* @param baseUrl - The base API URL (e.g., https://api.todoist.com/api/v1/)
|
|
23
|
+
* @param authToken - The authentication token
|
|
24
|
+
* @param endpoint - The relative endpoint path (e.g., 'uploads', 'workspaces/logo')
|
|
25
|
+
* @param file - The file content (Blob/File for browser, or Buffer/ReadableStream/path for Node)
|
|
26
|
+
* @param fileName - Optional file name (required for Buffer/Stream, optional for paths and File objects)
|
|
27
|
+
* @param additionalFields - Additional form fields to include (e.g., project_id, workspace_id)
|
|
28
|
+
* @param requestId - Optional request ID for idempotency
|
|
29
|
+
* @returns The response data from the server
|
|
30
|
+
* @throws TodoistRequestError if the upload fails, carrying the HTTP status and
|
|
31
|
+
* the server's error body like any other API request.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* // Upload from a file path
|
|
36
|
+
* const result = await uploadMultipartFile(
|
|
37
|
+
* 'https://api.todoist.com/api/v1/',
|
|
38
|
+
* 'my-token',
|
|
39
|
+
* 'uploads',
|
|
40
|
+
* '/path/to/file.pdf',
|
|
41
|
+
* undefined,
|
|
42
|
+
* { project_id: '12345' }
|
|
43
|
+
* )
|
|
44
|
+
*
|
|
45
|
+
* // Upload from a Buffer
|
|
46
|
+
* const buffer = Buffer.from('file content')
|
|
47
|
+
* const result = await uploadMultipartFile(
|
|
48
|
+
* 'https://api.todoist.com/api/v1/',
|
|
49
|
+
* 'my-token',
|
|
50
|
+
* 'uploads',
|
|
51
|
+
* buffer,
|
|
52
|
+
* 'document.pdf',
|
|
53
|
+
* { project_id: '12345' }
|
|
54
|
+
* )
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function uploadMultipartFile(args: UploadMultipartFileArgs): Promise<unknown>;
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the first word of a person's name, or an empty string if the name is blank.
|
|
3
|
+
*
|
|
4
|
+
* Status text people add to their display name isn't part of the name. Anything after a `|`, `@`
|
|
5
|
+
* or dash with spaces around it is left out, as is a trailing `OOO` or note in parentheses, so
|
|
6
|
+
* `Ada Lovelace (OOO Friday)` and `Ada Lovelace @ Paternity Leave` both read as `Ada Lovelace`.
|
|
7
|
+
*
|
|
8
|
+
* @param fullName - The person's full name, such as a user's `name` or `fullName`
|
|
9
|
+
* @returns The first name, or an empty string for a blank name
|
|
10
|
+
*/
|
|
11
|
+
export declare function getFirstName(fullName: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the last word of a person's name, or an empty string if the name is blank. A one-word
|
|
14
|
+
* name is its own last name.
|
|
15
|
+
*
|
|
16
|
+
* Status text is left out as it is for {@link getFirstName}, so `Ada Lovelace (OOO Friday)` gives
|
|
17
|
+
* `Lovelace`. A trailing emoji still counts as a word here, so `Ana Silva 🌴` gives `🌴`, while
|
|
18
|
+
* {@link getShortName} skips it when picking the initial.
|
|
19
|
+
*
|
|
20
|
+
* @param fullName - The person's full name, such as a user's `name` or `fullName`
|
|
21
|
+
* @returns The last name, or an empty string for a blank name
|
|
22
|
+
*/
|
|
23
|
+
export declare function getLastName(fullName: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Returns a person's first name and the initial of their last name, such as `Richard A.` for
|
|
26
|
+
* `Richard Dean Anderson`.
|
|
27
|
+
*
|
|
28
|
+
* - Status text is left out as it is for {@link getFirstName}, so `Ada Lovelace (OOO Friday)`
|
|
29
|
+
* gives `Ada L.`, not `Ada F.`.
|
|
30
|
+
* - The initial comes from the last word rather than the second, because in a name of three or
|
|
31
|
+
* more words the last one is usually the family name.
|
|
32
|
+
* - The initial is a whole character as the reader sees it, so an accent or an Indic conjunct
|
|
33
|
+
* stays with its letter: `Shreya श्रीवास्तव` gives `Shreya श्री.`.
|
|
34
|
+
* - A word that doesn't start with a letter, such as a trailing emoji, is skipped, so
|
|
35
|
+
* `Ana Silva 🌴` gives `Ana S.`. When no word after the first starts with a letter, as in
|
|
36
|
+
* `Robot 🤖` or a one-word name, the first name is returned alone.
|
|
37
|
+
*
|
|
38
|
+
* @param fullName - The person's full name, such as a user's `name` or `fullName`
|
|
39
|
+
* @returns The first name and last initial, the first name alone when there's no initial, or an
|
|
40
|
+
* empty string for a blank name
|
|
41
|
+
*/
|
|
42
|
+
export declare function getShortName(fullName: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Returns a person's first name and the initial of their last name.
|
|
45
|
+
*
|
|
46
|
+
* @deprecated Use {@link getShortName} instead, which this calls. It used to take the initial
|
|
47
|
+
* from the second word, which no longer matches the Todoist apps.
|
|
48
|
+
*
|
|
49
|
+
* @param fullName - The person's full name, such as a user's `name` or `fullName`
|
|
50
|
+
* @returns The same as {@link getShortName}
|
|
51
|
+
*/
|
|
52
|
+
export declare function formatUserShortName(fullName: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function customCamelCase(input: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PersonalProject, WorkspaceProject } from '../types/projects/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Type guard to check if a project is a workspace project.
|
|
4
|
+
* @param project The project to check
|
|
5
|
+
* @returns True if the project is a workspace project
|
|
6
|
+
*/
|
|
7
|
+
export declare function isWorkspaceProject(project: PersonalProject | WorkspaceProject): project is WorkspaceProject;
|
|
8
|
+
/**
|
|
9
|
+
* Type guard to check if a project is a personal project.
|
|
10
|
+
* @param project The project to check
|
|
11
|
+
* @returns True if the project is a personal project
|
|
12
|
+
*/
|
|
13
|
+
export declare function isPersonalProject(project: PersonalProject | WorkspaceProject): project is PersonalProject;
|
|
14
|
+
/**
|
|
15
|
+
* Whether a project counts towards the plan's limit on active personal projects:
|
|
16
|
+
* an active personal project other than the Inbox. Shared projects and sub-projects
|
|
17
|
+
* count; workspace projects do not.
|
|
18
|
+
* @param project The project to check
|
|
19
|
+
* @returns True if the project counts towards the limit
|
|
20
|
+
*/
|
|
21
|
+
export declare function countsTowardsPersonalProjectLimit(project: PersonalProject | WorkspaceProject): boolean;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encodes a caller-supplied value (an ID, a name) for use as one URL path segment.
|
|
3
|
+
*
|
|
4
|
+
* Without this, a value such as `../projects/123` would be joined into the path
|
|
5
|
+
* as-is and the URL would resolve to a different endpoint. `encodeURIComponent`
|
|
6
|
+
* escapes `/`, `?`, `#` and `%`, but leaves `.` alone, so the dot segments `.`
|
|
7
|
+
* and `..` (and the empty segment) are rejected outright. `,` is kept literal,
|
|
8
|
+
* as it is a valid path character and joins lists of IDs.
|
|
9
|
+
*
|
|
10
|
+
* @param segment The value to encode.
|
|
11
|
+
* @returns The encoded segment.
|
|
12
|
+
* @throws {TodoistArgumentError} When the value is empty, `.` or `..`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function encodePathSegment(segment: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Joins an endpoint with path segments using `/` separator.
|
|
17
|
+
*
|
|
18
|
+
* The endpoint is used as-is (it may contain `/`); every following segment is
|
|
19
|
+
* encoded with {@link encodePathSegment}, so an ID can never address another
|
|
20
|
+
* resource.
|
|
21
|
+
*
|
|
22
|
+
* @param endpoint The base endpoint, e.g. `tasks`.
|
|
23
|
+
* @param segments Path segments to append, e.g. an ID and an action.
|
|
24
|
+
* @returns A joined path.
|
|
25
|
+
*/
|
|
26
|
+
export declare function generatePath(endpoint: string, ...segments: string[]): string;
|
|
27
|
+
/**
|
|
28
|
+
* Returns `fn(value)` spread into an object if `value` is defined, otherwise an empty object.
|
|
29
|
+
*
|
|
30
|
+
* Used to conditionally include a property on a payload object without
|
|
31
|
+
* resorting to mutation or ternary-built object literals.
|
|
32
|
+
*/
|
|
33
|
+
export declare function spreadIfDefined<T, V extends Record<string, unknown>>(value: T | undefined, fn: (v: T) => V): V | Record<string, never>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Task } from '../types/index.js';
|
|
2
|
+
export type TaskWithSanitizedContent = Task & {
|
|
3
|
+
sanitizedContent: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Sanitizes a string by removing Todoist's formatting syntax (e.g. bold, italic, code blocks, links).
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // Removes bold/italic formatting
|
|
10
|
+
* getSanitizedContent('Some **bold** and *italic*') // 'Some bold and italic'
|
|
11
|
+
*
|
|
12
|
+
* // Removes markdown links
|
|
13
|
+
* getSanitizedContent('A [markdown](http://url.com) link') // 'A markdown link'
|
|
14
|
+
*
|
|
15
|
+
* // Removes app-specific links
|
|
16
|
+
* getSanitizedContent('A [[gmail=id, link from gmail]]') // 'A link from gmail'
|
|
17
|
+
*
|
|
18
|
+
* @param input - The string to sanitize
|
|
19
|
+
* @returns The sanitized string with all formatting removed
|
|
20
|
+
*/
|
|
21
|
+
export declare function getSanitizedContent(input: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Takes an array of tasks and returns a new array with sanitized content
|
|
24
|
+
* added as 'sanitizedContent' property to each task.
|
|
25
|
+
*
|
|
26
|
+
* @see {@link getSanitizedContent}
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* const tasks = [{ content: '**Bold** task', ... }]
|
|
30
|
+
* getSanitizedTasks(tasks) // [{ content: '**Bold** task', sanitizedContent: 'Bold task', ... }]
|
|
31
|
+
*
|
|
32
|
+
* @param tasks - Array of Task objects to sanitize
|
|
33
|
+
* @returns Array of tasks with added sanitizedContent property
|
|
34
|
+
*/
|
|
35
|
+
export declare function getSanitizedTasks(tasks: Task[]): TaskWithSanitizedContent[];
|
|
36
|
+
/**
|
|
37
|
+
* Escapes text for use as a token in a Todoist filter query.
|
|
38
|
+
*
|
|
39
|
+
* Prefixes parentheses, pipes, ampersands, exclamation marks, commas, and
|
|
40
|
+
* backslashes with a backslash. Quotes and asterisks are left unchanged.
|
|
41
|
+
* Whitespace validation and trimming are the caller's responsibility.
|
|
42
|
+
* Pass unescaped text to this function once, before inserting it into a query.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* const tasks = await api.getTasksByFilter({
|
|
46
|
+
* query: `search: ${escapeFilterToken(searchText)}`,
|
|
47
|
+
* })
|
|
48
|
+
*
|
|
49
|
+
* @param text - The text to escape, not a complete filter query
|
|
50
|
+
* @returns The escaped text, with whitespace preserved
|
|
51
|
+
*/
|
|
52
|
+
export declare function escapeFilterToken(text: string): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SyncCommandType, SyncCommandsMap, SyncCommand } from '../types/sync/commands/index.js';
|
|
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 declare function createCommand<T extends SyncCommandType>(type: T, args: SyncCommandsMap[T], tempId?: string): SyncCommand<T>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ViewOptions } from '../types/sync/index.js';
|
|
2
|
+
import type { Task } from '../types/tasks/index.js';
|
|
3
|
+
/** Todoist's default task-ordering hierarchies. */
|
|
4
|
+
export declare const DEFAULT_TASK_ORDERS: readonly ["PRIORITY_FIRST", "DATE_FIRST"];
|
|
5
|
+
/** Default hierarchy used when a view has no named sorting. */
|
|
6
|
+
export type DefaultTaskOrder = (typeof DEFAULT_TASK_ORDERS)[number];
|
|
7
|
+
export type TaskSortOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* Saved or requested sort field. Null, MANUAL, and fields this SDK can't sort by
|
|
10
|
+
* (such as LABEL) use defaultOrder.
|
|
11
|
+
*/
|
|
12
|
+
sortedBy?: ViewOptions['sortedBy'];
|
|
13
|
+
/** Saved or requested direction. Defaults by field when absent. */
|
|
14
|
+
sortOrder?: ViewOptions['sortOrder'];
|
|
15
|
+
/**
|
|
16
|
+
* Default hierarchy for this view or filter query. Today and Upcoming are
|
|
17
|
+
* date-first; for a filter, {@link isDateDrivenQuery} reads it off the query.
|
|
18
|
+
*/
|
|
19
|
+
defaultOrder: DefaultTaskOrder;
|
|
20
|
+
};
|
|
21
|
+
export type TaskSortContext = {
|
|
22
|
+
/** Project ID to its visible order. */
|
|
23
|
+
projectOrder?: ReadonlyMap<string, number>;
|
|
24
|
+
/** Project ID to the visible order of its workspace bucket. */
|
|
25
|
+
workspaceOrder?: ReadonlyMap<string, number>;
|
|
26
|
+
/** Resolves the display name used for assignee sorting. */
|
|
27
|
+
assigneeName?: (task: Task) => string | null | undefined;
|
|
28
|
+
/** Account IANA timezone. Defaults to UTC for deterministic behavior. */
|
|
29
|
+
timezone?: string;
|
|
30
|
+
/** Locale used for text comparisons. Defaults to English. */
|
|
31
|
+
locale?: string | readonly string[];
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Sorts the supplied tasks using Todoist view-ordering rules.
|
|
35
|
+
*
|
|
36
|
+
* The function performs no I/O and always returns a new array. Exact project,
|
|
37
|
+
* workspace, assignee, localized text, and due-time ordering requires the
|
|
38
|
+
* corresponding context. Callers must sort each independent view section or
|
|
39
|
+
* group separately and preserve any subtask structure they render.
|
|
40
|
+
*
|
|
41
|
+
* This function sorts only the tasks supplied to it. Fetch every page first
|
|
42
|
+
* when globally correct ordering is required for a paginated query.
|
|
43
|
+
*
|
|
44
|
+
* @see isDateDrivenQuery
|
|
45
|
+
*/
|
|
46
|
+
export declare function sortTasks(tasks: readonly Task[], options: TaskSortOptions, context?: TaskSortContext): Task[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds the uncompletable prefix (* ) to task content if not already present
|
|
3
|
+
* @param content - The task content
|
|
4
|
+
* @returns Content with uncompletable prefix added
|
|
5
|
+
*/
|
|
6
|
+
export declare function addUncompletablePrefix(content: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Removes the uncompletable prefix (* ) from task content if present
|
|
9
|
+
* @param content - The task content
|
|
10
|
+
* @returns Content with uncompletable prefix removed
|
|
11
|
+
*/
|
|
12
|
+
export declare function removeUncompletablePrefix(content: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Checks if task content has the uncompletable prefix (* )
|
|
15
|
+
* @param content - The task content
|
|
16
|
+
* @returns True if content starts with uncompletable prefix
|
|
17
|
+
*/
|
|
18
|
+
export declare function hasUncompletablePrefix(content: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Processes task content based on isUncompletable flag, with content prefix taking precedence
|
|
21
|
+
* @param content - The original task content
|
|
22
|
+
* @param isUncompletable - Optional flag to make task uncompletable
|
|
23
|
+
* @returns Processed content
|
|
24
|
+
*
|
|
25
|
+
* Logic:
|
|
26
|
+
* - If content already has * prefix, task is uncompletable regardless of flag
|
|
27
|
+
* - If content doesn't have * prefix and isUncompletable is true, add the prefix
|
|
28
|
+
* - If isUncompletable is undefined or false (and no prefix), leave content unchanged
|
|
29
|
+
*/
|
|
30
|
+
export declare function processTaskContent(content: string, isUncompletable?: boolean): string;
|