@todoist/sdk 0.0.1 → 19.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 +293 -29
- 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 +368 -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 +255 -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 +99 -0
- package/dist/types/types/apps/types.d.ts +450 -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 +1922 -0
- package/dist/types/utils/view-options.d.ts +11 -0
- package/dist/types/utils/webhook-parser.d.ts +48 -0
- package/package.json +87 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types.js';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BooleanFromZeroOneSchema, DayOfWeekSchema } from '../sync/user-preferences.js';
|
|
3
|
+
export const StreakSchema = z.object({
|
|
4
|
+
count: z.number(),
|
|
5
|
+
start: z.string(),
|
|
6
|
+
end: z.string(),
|
|
7
|
+
});
|
|
8
|
+
export const CompletedItemSchema = z.object({
|
|
9
|
+
id: z.string(),
|
|
10
|
+
completed: z.number(),
|
|
11
|
+
});
|
|
12
|
+
export const ItemsWithDateSchema = z.object({
|
|
13
|
+
items: z.array(CompletedItemSchema),
|
|
14
|
+
totalCompleted: z.number(),
|
|
15
|
+
});
|
|
16
|
+
export const KarmaUpdateSchema = z.object({
|
|
17
|
+
time: z.string(),
|
|
18
|
+
newKarma: z.number(),
|
|
19
|
+
positiveKarma: z.number(),
|
|
20
|
+
negativeKarma: z.number(),
|
|
21
|
+
positiveKarmaReasons: z.array(z.any()),
|
|
22
|
+
negativeKarmaReasons: z.array(z.any()),
|
|
23
|
+
});
|
|
24
|
+
export const ProductivityStatsSchema = z.object({
|
|
25
|
+
completedCount: z.number(),
|
|
26
|
+
daysItems: z.array(ItemsWithDateSchema.extend({
|
|
27
|
+
date: z.string(),
|
|
28
|
+
})),
|
|
29
|
+
goals: z.object({
|
|
30
|
+
currentDailyStreak: StreakSchema,
|
|
31
|
+
currentWeeklyStreak: StreakSchema,
|
|
32
|
+
dailyGoal: z.number(),
|
|
33
|
+
ignoreDays: z.array(DayOfWeekSchema),
|
|
34
|
+
karmaDisabled: BooleanFromZeroOneSchema,
|
|
35
|
+
lastDailyStreak: StreakSchema,
|
|
36
|
+
lastWeeklyStreak: StreakSchema,
|
|
37
|
+
maxDailyStreak: StreakSchema,
|
|
38
|
+
maxWeeklyStreak: StreakSchema,
|
|
39
|
+
user: z.string(),
|
|
40
|
+
userId: z.string(),
|
|
41
|
+
vacationMode: BooleanFromZeroOneSchema,
|
|
42
|
+
weeklyGoal: z.number(),
|
|
43
|
+
}),
|
|
44
|
+
karma: z.number(),
|
|
45
|
+
karmaGraphData: z.array(z.object({
|
|
46
|
+
date: z.string(),
|
|
47
|
+
karmaAvg: z.number(),
|
|
48
|
+
})),
|
|
49
|
+
karmaLastUpdate: z.number(),
|
|
50
|
+
karmaTrend: z.string(),
|
|
51
|
+
karmaUpdateReasons: z.array(KarmaUpdateSchema),
|
|
52
|
+
projectColors: z.record(z.string(), z.string()),
|
|
53
|
+
weekItems: z.array(ItemsWithDateSchema.extend({
|
|
54
|
+
from: z.string(),
|
|
55
|
+
to: z.string(),
|
|
56
|
+
})),
|
|
57
|
+
});
|
|
58
|
+
export const ColorSchema = z.object({
|
|
59
|
+
/** The key of the color (i.e. 'berry_red') */
|
|
60
|
+
key: z.string(),
|
|
61
|
+
/** The display name of the color (i.e. 'Berry Red') */
|
|
62
|
+
displayName: z.string(),
|
|
63
|
+
/** The hex value of the color (i.e. '#b8255f') */
|
|
64
|
+
hexValue: z.string(),
|
|
65
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getProjectUrl } from '../../utils/url-helpers.js';
|
|
3
|
+
/**
|
|
4
|
+
* Base schema for all project types in Todoist.
|
|
5
|
+
* Contains common fields shared between personal and workspace projects.
|
|
6
|
+
*/
|
|
7
|
+
export const BaseProjectSchema = z.object({
|
|
8
|
+
id: z.string(),
|
|
9
|
+
canAssignTasks: z.boolean(),
|
|
10
|
+
childOrder: z.number().int(),
|
|
11
|
+
orderKey: z.string().nullable().optional(),
|
|
12
|
+
color: z.string(),
|
|
13
|
+
createdAt: z.coerce.date().nullable(),
|
|
14
|
+
isArchived: z.boolean(),
|
|
15
|
+
isDeleted: z.boolean(),
|
|
16
|
+
isFavorite: z.boolean(),
|
|
17
|
+
isFrozen: z.boolean(),
|
|
18
|
+
name: z.string(),
|
|
19
|
+
updatedAt: z.coerce.date().nullable(),
|
|
20
|
+
viewStyle: z.string(),
|
|
21
|
+
defaultOrder: z.number().int(),
|
|
22
|
+
defaultOrderKey: z.string().nullable().optional(),
|
|
23
|
+
description: z.string(),
|
|
24
|
+
isCollapsed: z.boolean(),
|
|
25
|
+
isShared: z.boolean(),
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Schema for personal projects in Todoist.
|
|
29
|
+
*/
|
|
30
|
+
export const PersonalProjectSchema = BaseProjectSchema.extend({
|
|
31
|
+
parentId: z.string().nullable(),
|
|
32
|
+
inboxProject: z.boolean().optional().default(false),
|
|
33
|
+
}).transform((data) => {
|
|
34
|
+
return Object.assign(Object.assign({}, data), { url: getProjectUrl(data.id, data.name) });
|
|
35
|
+
});
|
|
36
|
+
/** Available project visibility levels. */
|
|
37
|
+
export const PROJECT_VISIBILITIES = ['restricted', 'team', 'public'];
|
|
38
|
+
export const ProjectVisibilitySchema = z.enum(PROJECT_VISIBILITIES);
|
|
39
|
+
/**
|
|
40
|
+
* Schema for workspace projects in Todoist.
|
|
41
|
+
*/
|
|
42
|
+
export const WorkspaceProjectSchema = BaseProjectSchema.extend({
|
|
43
|
+
access: z.object({ visibility: ProjectVisibilitySchema }).optional(),
|
|
44
|
+
collaboratorRoleDefault: z.string(),
|
|
45
|
+
folderId: z.string().nullable(),
|
|
46
|
+
isInviteOnly: z.boolean().nullable(),
|
|
47
|
+
isLinkSharingEnabled: z.boolean(),
|
|
48
|
+
role: z.string().nullable(),
|
|
49
|
+
status: z.string(),
|
|
50
|
+
workspaceId: z.string(),
|
|
51
|
+
}).transform((data) => {
|
|
52
|
+
return Object.assign(Object.assign({}, data), { url: getProjectUrl(data.id, data.name) });
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Schema for any project type in Todoist (personal or workspace).
|
|
56
|
+
* Dispatches to WorkspaceProjectSchema when workspaceId is present, PersonalProjectSchema otherwise.
|
|
57
|
+
*/
|
|
58
|
+
export const ProjectSchema = z.unknown().transform((val) => {
|
|
59
|
+
if (typeof val === 'object' && val !== null && 'workspaceId' in val) {
|
|
60
|
+
return WorkspaceProjectSchema.parse(val);
|
|
61
|
+
}
|
|
62
|
+
return PersonalProjectSchema.parse(val);
|
|
63
|
+
});
|
|
64
|
+
/** Available project view styles. */
|
|
65
|
+
export const PROJECT_VIEW_STYLES = ['list', 'board', 'calendar', 'table'];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './requests.js';
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { LOCATION_TRIGGERS, ReminderTypeEnum } from '../sync/resources/reminders.js';
|
|
3
|
+
import { DueDateSchema } from '../tasks/types.js';
|
|
4
|
+
/** Available reminder delivery services. */
|
|
5
|
+
export const REMINDER_DELIVERY_SERVICES = ['email', 'push'];
|
|
6
|
+
export const ReminderDeliveryServiceSchema = z.enum(REMINDER_DELIVERY_SERVICES);
|
|
7
|
+
export const ReminderIdSchema = z.string();
|
|
8
|
+
export const ReminderDueDateSchema = DueDateSchema.pick({
|
|
9
|
+
date: true,
|
|
10
|
+
string: true,
|
|
11
|
+
timezone: true,
|
|
12
|
+
lang: true,
|
|
13
|
+
isRecurring: true,
|
|
14
|
+
})
|
|
15
|
+
.partial()
|
|
16
|
+
.strict();
|
|
17
|
+
// ── Add schemas ──────────────────────────────────────────────────────
|
|
18
|
+
export const AddRelativeReminderArgsSchema = z
|
|
19
|
+
.object({
|
|
20
|
+
taskId: z.string(),
|
|
21
|
+
reminderType: z.literal(ReminderTypeEnum.Relative).optional(),
|
|
22
|
+
minuteOffset: z.number().int(),
|
|
23
|
+
service: ReminderDeliveryServiceSchema.optional(),
|
|
24
|
+
notifyUid: z.string().optional(),
|
|
25
|
+
isUrgent: z.boolean().optional(),
|
|
26
|
+
})
|
|
27
|
+
.strict();
|
|
28
|
+
export const AddAbsoluteReminderArgsSchema = z
|
|
29
|
+
.object({
|
|
30
|
+
taskId: z.string(),
|
|
31
|
+
reminderType: z.literal(ReminderTypeEnum.Absolute),
|
|
32
|
+
due: ReminderDueDateSchema,
|
|
33
|
+
service: ReminderDeliveryServiceSchema.optional(),
|
|
34
|
+
notifyUid: z.string().optional(),
|
|
35
|
+
isUrgent: z.boolean().optional(),
|
|
36
|
+
})
|
|
37
|
+
.strict();
|
|
38
|
+
export const AddReminderArgsSchema = z.union([
|
|
39
|
+
AddRelativeReminderArgsSchema,
|
|
40
|
+
AddAbsoluteReminderArgsSchema,
|
|
41
|
+
]);
|
|
42
|
+
export const AddLocationReminderArgsSchema = z
|
|
43
|
+
.object({
|
|
44
|
+
taskId: z.string(),
|
|
45
|
+
notifyUid: z.string().optional(),
|
|
46
|
+
name: z.string(),
|
|
47
|
+
locLat: z.string(),
|
|
48
|
+
locLong: z.string(),
|
|
49
|
+
locTrigger: z.enum(LOCATION_TRIGGERS),
|
|
50
|
+
radius: z.number().int().optional(),
|
|
51
|
+
})
|
|
52
|
+
.strict();
|
|
53
|
+
// ── Update schemas ───────────────────────────────────────────────────
|
|
54
|
+
export const UpdateRelativeReminderArgsSchema = z
|
|
55
|
+
.object({
|
|
56
|
+
reminderType: z.literal(ReminderTypeEnum.Relative),
|
|
57
|
+
minuteOffset: z.number().int().optional(),
|
|
58
|
+
notifyUid: z.string().optional(),
|
|
59
|
+
service: ReminderDeliveryServiceSchema.optional(),
|
|
60
|
+
isUrgent: z.boolean().optional(),
|
|
61
|
+
})
|
|
62
|
+
.strict();
|
|
63
|
+
export const UpdateAbsoluteReminderArgsSchema = z
|
|
64
|
+
.object({
|
|
65
|
+
reminderType: z.literal(ReminderTypeEnum.Absolute),
|
|
66
|
+
due: ReminderDueDateSchema.optional(),
|
|
67
|
+
notifyUid: z.string().optional(),
|
|
68
|
+
service: ReminderDeliveryServiceSchema.optional(),
|
|
69
|
+
isUrgent: z.boolean().optional(),
|
|
70
|
+
})
|
|
71
|
+
.strict();
|
|
72
|
+
export const UpdateReminderArgsSchema = z
|
|
73
|
+
.discriminatedUnion('reminderType', [
|
|
74
|
+
UpdateRelativeReminderArgsSchema,
|
|
75
|
+
UpdateAbsoluteReminderArgsSchema,
|
|
76
|
+
])
|
|
77
|
+
.refine((args) => Object.entries(args).some(([key, value]) => key !== 'reminderType' && value !== undefined), {
|
|
78
|
+
message: 'At least one reminder field must be provided to updateReminder',
|
|
79
|
+
});
|
|
80
|
+
export const UpdateLocationReminderArgsSchema = z
|
|
81
|
+
.object({
|
|
82
|
+
notifyUid: z.string().optional(),
|
|
83
|
+
name: z.string().optional(),
|
|
84
|
+
locLat: z.string().optional(),
|
|
85
|
+
locLong: z.string().optional(),
|
|
86
|
+
locTrigger: z.enum(LOCATION_TRIGGERS).optional(),
|
|
87
|
+
radius: z.number().int().optional(),
|
|
88
|
+
})
|
|
89
|
+
.strict()
|
|
90
|
+
.refine((args) => Object.values(args).some((value) => value !== undefined), {
|
|
91
|
+
message: 'At least one reminder field must be provided to updateLocationReminder',
|
|
92
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getSectionUrl } from '../../utils/url-helpers.js';
|
|
3
|
+
/**
|
|
4
|
+
* Raw section fields (the persisted shape). Exposed so schemas that extend
|
|
5
|
+
* or override a field — notably the webhook variant — can reuse the base
|
|
6
|
+
* without duplicating every field.
|
|
7
|
+
*/
|
|
8
|
+
export const SectionBaseSchema = z.object({
|
|
9
|
+
id: z.string(),
|
|
10
|
+
userId: z.string(),
|
|
11
|
+
projectId: z.string(),
|
|
12
|
+
addedAt: z.coerce.date(),
|
|
13
|
+
updatedAt: z.coerce.date(),
|
|
14
|
+
archivedAt: z.coerce.date().nullable(),
|
|
15
|
+
name: z.string(),
|
|
16
|
+
description: z.string().nullable(),
|
|
17
|
+
sectionOrder: z.number().int(),
|
|
18
|
+
orderKey: z.string().nullable().optional(),
|
|
19
|
+
isArchived: z.boolean(),
|
|
20
|
+
isDeleted: z.boolean(),
|
|
21
|
+
isCollapsed: z.boolean(),
|
|
22
|
+
});
|
|
23
|
+
export const SectionSchema = SectionBaseSchema.transform((data) => (Object.assign(Object.assign({}, data), { url: getSectionUrl(data.id, data.name) })));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Re-export all domain types
|
|
2
|
+
export * from './shared.js';
|
|
3
|
+
export * from './tasks.js';
|
|
4
|
+
export * from './projects.js';
|
|
5
|
+
export * from './sections.js';
|
|
6
|
+
export * from './labels.js';
|
|
7
|
+
export * from './filters.js';
|
|
8
|
+
export * from './notes.js';
|
|
9
|
+
export * from './reminders.js';
|
|
10
|
+
export * from './workspaces.js';
|
|
11
|
+
export * from './folders.js';
|
|
12
|
+
export * from './workspace-filters.js';
|
|
13
|
+
export * from './notifications.js';
|
|
14
|
+
export * from './sharing.js';
|
|
15
|
+
export * from './view-options.js';
|
|
16
|
+
export * from './project-view-options.js';
|
|
17
|
+
export * from './calendars.js';
|
|
18
|
+
export * from './others.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types used across multiple Sync API command argument types.
|
|
3
|
+
*/
|
|
4
|
+
/** Available project workflow statuses. */
|
|
5
|
+
export const PROJECT_STATUSES = [
|
|
6
|
+
'PLANNED',
|
|
7
|
+
'IN_PROGRESS',
|
|
8
|
+
'PAUSED',
|
|
9
|
+
'COMPLETED',
|
|
10
|
+
'CANCELED',
|
|
11
|
+
];
|
|
12
|
+
export { COLLABORATOR_ROLES } from '../../workspaces/types.js';
|
|
13
|
+
/** Available reminder notification services. */
|
|
14
|
+
export const REMINDER_SERVICES = ['default', 'email', 'mobile', 'push', 'no_default'];
|
|
15
|
+
/** Available workspace project sort orders. */
|
|
16
|
+
export const WORKSPACE_PROJECT_SORT_ORDERS = ['MANUAL', 'A_TO_Z', 'Z_TO_A'];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All available Sync API resource types.
|
|
3
|
+
*/
|
|
4
|
+
export const SYNC_RESOURCE_TYPES = [
|
|
5
|
+
'labels',
|
|
6
|
+
'projects',
|
|
7
|
+
'items',
|
|
8
|
+
'notes',
|
|
9
|
+
'project_notes',
|
|
10
|
+
'sections',
|
|
11
|
+
'filters',
|
|
12
|
+
'reminders',
|
|
13
|
+
'reminders_location',
|
|
14
|
+
'locations',
|
|
15
|
+
'user',
|
|
16
|
+
'live_notifications',
|
|
17
|
+
'collaborators',
|
|
18
|
+
'collaborator_states',
|
|
19
|
+
'user_settings',
|
|
20
|
+
'notification_settings',
|
|
21
|
+
'user_plan_limits',
|
|
22
|
+
'completed_info',
|
|
23
|
+
'stats',
|
|
24
|
+
'workspaces',
|
|
25
|
+
'workspace_users',
|
|
26
|
+
'workspace_filters',
|
|
27
|
+
'view_options',
|
|
28
|
+
'project_view_options_defaults',
|
|
29
|
+
'role_actions',
|
|
30
|
+
'folders',
|
|
31
|
+
'day_orders',
|
|
32
|
+
'calendars',
|
|
33
|
+
'calendar_accounts',
|
|
34
|
+
'suggestions',
|
|
35
|
+
'tooltips',
|
|
36
|
+
];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const CalendarSchema = z.looseObject({
|
|
3
|
+
id: z.string(),
|
|
4
|
+
summary: z.string(),
|
|
5
|
+
color: z.string().nullable(),
|
|
6
|
+
accountId: z.string(),
|
|
7
|
+
isVisible: z.boolean(),
|
|
8
|
+
isTaskCalendar: z.boolean().optional(),
|
|
9
|
+
});
|
|
10
|
+
/** Available calendar account provider types. */
|
|
11
|
+
export const CALENDAR_ACCOUNT_TYPES = ['google', 'microsoft', 'apple'];
|
|
12
|
+
/** Available calendar sync states. */
|
|
13
|
+
export const CALENDAR_SYNC_STATES = ['synced', 'syncing', 'error'];
|
|
14
|
+
export const CalendarAccountSchema = z.looseObject({
|
|
15
|
+
id: z.string(),
|
|
16
|
+
name: z.string(),
|
|
17
|
+
type: z.enum(CALENDAR_ACCOUNT_TYPES),
|
|
18
|
+
isDeleted: z.boolean().optional(),
|
|
19
|
+
isEventsEnabled: z.boolean().optional(),
|
|
20
|
+
isTasksEnabled: z.boolean().optional(),
|
|
21
|
+
isAllDayTasksEnabled: z.boolean().optional(),
|
|
22
|
+
pendingOperationUntil: z.string().nullable().optional(),
|
|
23
|
+
calendarsSyncState: z.enum(CALENDAR_SYNC_STATES).optional(),
|
|
24
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { WorkspaceRoleSchema } from '../../workspaces/types.js';
|
|
3
|
+
import { UserStatusSchema } from './user-status.js';
|
|
4
|
+
export const CollaboratorSchema = z.looseObject({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
email: z.string(),
|
|
7
|
+
fullName: z.string(),
|
|
8
|
+
timezone: z.string(),
|
|
9
|
+
imageId: z.string().nullable(),
|
|
10
|
+
/** The collaborator's shared status. Not related to {@link CollaboratorStatus}. */
|
|
11
|
+
status: UserStatusSchema.nullish(),
|
|
12
|
+
});
|
|
13
|
+
/** Available collaborator statuses. */
|
|
14
|
+
export const COLLABORATOR_STATUSES = ['active', 'invited'];
|
|
15
|
+
export const CollaboratorStateSchema = z.looseObject({
|
|
16
|
+
userId: z.string(),
|
|
17
|
+
projectId: z.string(),
|
|
18
|
+
state: z.enum(COLLABORATOR_STATUSES),
|
|
19
|
+
isDeleted: z.boolean(),
|
|
20
|
+
workspaceRole: WorkspaceRoleSchema.optional(),
|
|
21
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const CompletedProjectMetadataSchema = z.looseObject({
|
|
3
|
+
projectId: z.string(),
|
|
4
|
+
archivedSections: z.number().int(),
|
|
5
|
+
completedItems: z.number().int(),
|
|
6
|
+
});
|
|
7
|
+
export const CompletedSectionMetadataSchema = z.looseObject({
|
|
8
|
+
sectionId: z.string(),
|
|
9
|
+
id: z.string(),
|
|
10
|
+
completedItems: z.number().int(),
|
|
11
|
+
});
|
|
12
|
+
export const CompletedTaskMetadataSchema = z.looseObject({
|
|
13
|
+
itemId: z.string(),
|
|
14
|
+
id: z.string().optional(),
|
|
15
|
+
completedItems: z.number().int(),
|
|
16
|
+
});
|
|
17
|
+
export const CompletedInfoSchema = z.union([
|
|
18
|
+
CompletedProjectMetadataSchema,
|
|
19
|
+
CompletedSectionMetadataSchema,
|
|
20
|
+
CompletedTaskMetadataSchema,
|
|
21
|
+
]);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const FilterSchema = z.looseObject({
|
|
3
|
+
id: z.string(),
|
|
4
|
+
name: z.string(),
|
|
5
|
+
query: z.string(),
|
|
6
|
+
description: z.string().nullish(),
|
|
7
|
+
color: z.string(),
|
|
8
|
+
isDeleted: z.boolean(),
|
|
9
|
+
isFavorite: z.boolean(),
|
|
10
|
+
isFrozen: z.boolean(),
|
|
11
|
+
itemOrder: z.number().int(),
|
|
12
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const FolderSchema = z.looseObject({
|
|
3
|
+
id: z.string(),
|
|
4
|
+
name: z.string(),
|
|
5
|
+
workspaceId: z.string(),
|
|
6
|
+
isDeleted: z.boolean(),
|
|
7
|
+
defaultOrder: z.number().int(),
|
|
8
|
+
defaultOrderKey: z.string().nullable().optional(),
|
|
9
|
+
childOrder: z.number().int(),
|
|
10
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './filters.js';
|
|
2
|
+
export * from './labels.js';
|
|
3
|
+
export * from './collaborators.js';
|
|
4
|
+
export * from './folders.js';
|
|
5
|
+
export * from './tooltips.js';
|
|
6
|
+
export * from './notes.js';
|
|
7
|
+
export * from './workspace-filters.js';
|
|
8
|
+
export * from './calendars.js';
|
|
9
|
+
export * from './reminders.js';
|
|
10
|
+
export * from './completed-info.js';
|
|
11
|
+
export * from './view-options.js';
|
|
12
|
+
export * from './user-plan-limits.js';
|
|
13
|
+
export * from './live-notifications.js';
|
|
14
|
+
export * from './workspaces.js';
|
|
15
|
+
export * from './user.js';
|
|
16
|
+
export * from './user-settings.js';
|
|
17
|
+
export * from './user-status.js';
|
|
18
|
+
export * from './suggestions.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { LabelSchema } from '../../labels/types.js';
|
|
3
|
+
/** A label returned by the Sync API. */
|
|
4
|
+
export const SyncLabelSchema = LabelSchema.extend({
|
|
5
|
+
order: z.number().int().nullable().optional(),
|
|
6
|
+
isDeleted: z.boolean().optional(),
|
|
7
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { StringOrNumberSchema } from '../../common.js';
|
|
3
|
+
/**
|
|
4
|
+
* Live notification resource from the Sync API.
|
|
5
|
+
*
|
|
6
|
+
* Uses a loose object schema with commonly-present fields for forward
|
|
7
|
+
* compatibility. The Sync API returns 20+ notification variants; fully typing
|
|
8
|
+
* each is too fragile for a library, so we validate the common shape and
|
|
9
|
+
* preserve all extra fields.
|
|
10
|
+
*/
|
|
11
|
+
export const LiveNotificationSchema = z.looseObject({
|
|
12
|
+
id: z.string(),
|
|
13
|
+
createdAt: z.coerce.date(),
|
|
14
|
+
fromUid: z.string().optional(),
|
|
15
|
+
notificationType: z.string(),
|
|
16
|
+
isUnread: z.boolean(),
|
|
17
|
+
// Commonly present optional fields
|
|
18
|
+
projectId: z.string().optional(),
|
|
19
|
+
invitationId: z.string().optional(),
|
|
20
|
+
itemId: z.string().optional(),
|
|
21
|
+
itemContent: z.string().optional(),
|
|
22
|
+
responsibleUid: z.string().nullable().optional(),
|
|
23
|
+
assignedByUid: z.string().nullable().optional(),
|
|
24
|
+
fromUser: z
|
|
25
|
+
.object({
|
|
26
|
+
email: z.string(),
|
|
27
|
+
fullName: z.string(),
|
|
28
|
+
id: StringOrNumberSchema,
|
|
29
|
+
imageId: z.string().nullable(),
|
|
30
|
+
})
|
|
31
|
+
.optional(),
|
|
32
|
+
projectName: z.string().optional(),
|
|
33
|
+
isDeleted: z.boolean().optional(),
|
|
34
|
+
invitationSecret: z.string().optional(),
|
|
35
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AttachmentSchema } from '../../comments/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Sync API note (comment) resource.
|
|
5
|
+
* Separate from the REST `CommentSchema` which transforms `itemId` to `taskId`.
|
|
6
|
+
*/
|
|
7
|
+
export const NoteSchema = z.looseObject({
|
|
8
|
+
id: z.string(),
|
|
9
|
+
itemId: z.string().optional(),
|
|
10
|
+
projectId: z.string().optional(),
|
|
11
|
+
content: z.string(),
|
|
12
|
+
postedAt: z.coerce.date(),
|
|
13
|
+
fileAttachment: AttachmentSchema.nullable(),
|
|
14
|
+
postedUid: z.string(),
|
|
15
|
+
uidsToNotify: z.array(z.string()).nullable(),
|
|
16
|
+
reactions: z.record(z.string(), z.array(z.string())).nullable(),
|
|
17
|
+
isDeleted: z.boolean(),
|
|
18
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DueDateSchema } from '../../tasks/types.js';
|
|
3
|
+
export const ReminderBaseSchema = z.looseObject({
|
|
4
|
+
id: z.string(),
|
|
5
|
+
notifyUid: z.string(),
|
|
6
|
+
itemId: z.string(),
|
|
7
|
+
projectId: z.string().optional(),
|
|
8
|
+
isDeleted: z.boolean(),
|
|
9
|
+
});
|
|
10
|
+
/** Enum-like object of reminder type values. */
|
|
11
|
+
export const ReminderTypeEnum = {
|
|
12
|
+
Relative: 'relative',
|
|
13
|
+
Absolute: 'absolute',
|
|
14
|
+
Location: 'location',
|
|
15
|
+
};
|
|
16
|
+
/** Available reminder types. */
|
|
17
|
+
export const REMINDER_TYPES = [
|
|
18
|
+
ReminderTypeEnum.Relative,
|
|
19
|
+
ReminderTypeEnum.Absolute,
|
|
20
|
+
ReminderTypeEnum.Location,
|
|
21
|
+
];
|
|
22
|
+
/** Available location reminder triggers. */
|
|
23
|
+
export const LOCATION_TRIGGERS = ['on_enter', 'on_leave'];
|
|
24
|
+
export const LocationReminderSchema = ReminderBaseSchema.extend({
|
|
25
|
+
type: z.literal(ReminderTypeEnum.Location),
|
|
26
|
+
name: z.string(),
|
|
27
|
+
locLat: z.string(),
|
|
28
|
+
locLong: z.string(),
|
|
29
|
+
locTrigger: z.enum(LOCATION_TRIGGERS),
|
|
30
|
+
radius: z.number().int(),
|
|
31
|
+
});
|
|
32
|
+
export const AbsoluteReminderSchema = ReminderBaseSchema.extend({
|
|
33
|
+
type: z.literal(ReminderTypeEnum.Absolute),
|
|
34
|
+
due: DueDateSchema,
|
|
35
|
+
isUrgent: z.boolean().optional(),
|
|
36
|
+
});
|
|
37
|
+
export const RelativeReminderSchema = ReminderBaseSchema.extend({
|
|
38
|
+
type: z.literal(ReminderTypeEnum.Relative),
|
|
39
|
+
minuteOffset: z.number().int(),
|
|
40
|
+
due: DueDateSchema.optional(),
|
|
41
|
+
isUrgent: z.boolean().optional(),
|
|
42
|
+
});
|
|
43
|
+
export const ReminderSchema = z.discriminatedUnion('type', [
|
|
44
|
+
LocationReminderSchema,
|
|
45
|
+
AbsoluteReminderSchema,
|
|
46
|
+
RelativeReminderSchema,
|
|
47
|
+
]);
|
|
48
|
+
export const SyncAbsoluteReminderSchema = AbsoluteReminderSchema.extend({
|
|
49
|
+
due: DueDateSchema.nullable(),
|
|
50
|
+
});
|
|
51
|
+
export const SyncRelativeReminderSchema = RelativeReminderSchema.extend({
|
|
52
|
+
due: DueDateSchema.nullable().optional(),
|
|
53
|
+
});
|
|
54
|
+
export const SyncReminderSchema = z.discriminatedUnion('type', [
|
|
55
|
+
LocationReminderSchema,
|
|
56
|
+
SyncAbsoluteReminderSchema,
|
|
57
|
+
SyncRelativeReminderSchema,
|
|
58
|
+
]);
|