@doist/todoist-sdk 0.0.1 → 8.0.1
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 +194 -29
- package/dist/cjs/authentication.js +204 -0
- package/dist/cjs/consts/endpoints.js +141 -0
- package/dist/cjs/index.js +20 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/test-utils/asserts.js +11 -0
- package/dist/cjs/test-utils/msw-setup.js +97 -0
- package/dist/cjs/test-utils/obsidian-fetch-adapter.js +53 -0
- package/dist/cjs/test-utils/test-defaults.js +290 -0
- package/dist/cjs/todoist-api.js +2636 -0
- package/dist/cjs/transport/fetch-with-retry.js +206 -0
- package/dist/cjs/transport/http-client.js +133 -0
- package/dist/cjs/transport/http-dispatcher.js +72 -0
- package/dist/cjs/types/activity/index.js +18 -0
- package/dist/cjs/types/activity/requests.js +2 -0
- package/dist/cjs/types/activity/types.js +28 -0
- package/dist/cjs/types/backups/index.js +18 -0
- package/dist/cjs/types/backups/requests.js +2 -0
- package/dist/cjs/types/backups/types.js +8 -0
- package/dist/cjs/types/comments/index.js +18 -0
- package/dist/cjs/types/comments/requests.js +2 -0
- package/dist/cjs/types/comments/types.js +60 -0
- package/dist/cjs/types/common.js +10 -0
- package/dist/cjs/types/emails/index.js +17 -0
- package/dist/cjs/types/emails/requests.js +5 -0
- package/dist/cjs/types/errors.js +29 -0
- package/dist/cjs/types/folders/index.js +17 -0
- package/dist/cjs/types/folders/requests.js +2 -0
- package/dist/cjs/types/http.js +24 -0
- package/dist/cjs/types/id-mappings/index.js +18 -0
- package/dist/cjs/types/id-mappings/requests.js +20 -0
- package/dist/cjs/types/id-mappings/types.js +12 -0
- package/dist/cjs/types/index.js +36 -0
- package/dist/cjs/types/insights/index.js +18 -0
- package/dist/cjs/types/insights/requests.js +2 -0
- package/dist/cjs/types/insights/types.js +84 -0
- package/dist/cjs/types/labels/index.js +18 -0
- package/dist/cjs/types/labels/requests.js +2 -0
- package/dist/cjs/types/labels/types.js +11 -0
- package/dist/cjs/types/productivity/index.js +17 -0
- package/dist/cjs/types/productivity/types.js +67 -0
- package/dist/cjs/types/projects/index.js +18 -0
- package/dist/cjs/types/projects/requests.js +2 -0
- package/dist/cjs/types/projects/types.js +56 -0
- package/dist/cjs/types/reminders/index.js +17 -0
- package/dist/cjs/types/reminders/requests.js +95 -0
- package/dist/cjs/types/sections/index.js +18 -0
- package/dist/cjs/types/sections/requests.js +2 -0
- package/dist/cjs/types/sections/types.js +22 -0
- package/dist/cjs/types/sync/commands/calendars.js +2 -0
- package/dist/cjs/types/sync/commands/filters.js +2 -0
- package/dist/cjs/types/sync/commands/folders.js +2 -0
- package/dist/cjs/types/sync/commands/index.js +35 -0
- package/dist/cjs/types/sync/commands/labels.js +5 -0
- package/dist/cjs/types/sync/commands/notes.js +2 -0
- package/dist/cjs/types/sync/commands/notifications.js +2 -0
- package/dist/cjs/types/sync/commands/others.js +2 -0
- package/dist/cjs/types/sync/commands/project-view-options.js +2 -0
- package/dist/cjs/types/sync/commands/projects.js +2 -0
- package/dist/cjs/types/sync/commands/reminders.js +2 -0
- package/dist/cjs/types/sync/commands/sections.js +2 -0
- package/dist/cjs/types/sync/commands/shared.js +20 -0
- package/dist/cjs/types/sync/commands/sharing.js +2 -0
- package/dist/cjs/types/sync/commands/tasks.js +2 -0
- package/dist/cjs/types/sync/commands/view-options.js +2 -0
- package/dist/cjs/types/sync/commands/workspace-filters.js +2 -0
- package/dist/cjs/types/sync/commands/workspace-goals.js +2 -0
- package/dist/cjs/types/sync/commands/workspaces.js +2 -0
- package/dist/cjs/types/sync/index.js +22 -0
- package/dist/cjs/types/sync/request.js +2 -0
- package/dist/cjs/types/sync/resource-types.js +40 -0
- package/dist/cjs/types/sync/resources/calendars.js +31 -0
- package/dist/cjs/types/sync/resources/collaborators.js +25 -0
- package/dist/cjs/types/sync/resources/completed-info.js +30 -0
- package/dist/cjs/types/sync/resources/filters.js +16 -0
- package/dist/cjs/types/sync/resources/folders.js +14 -0
- package/dist/cjs/types/sync/resources/index.js +33 -0
- package/dist/cjs/types/sync/resources/live-notifications.js +39 -0
- package/dist/cjs/types/sync/resources/notes.js +23 -0
- package/dist/cjs/types/sync/resources/reminders.js +50 -0
- package/dist/cjs/types/sync/resources/suggestions.js +42 -0
- package/dist/cjs/types/sync/resources/tooltips.js +10 -0
- package/dist/cjs/types/sync/resources/user-plan-limits.js +24 -0
- package/dist/cjs/types/sync/resources/user-settings.js +42 -0
- package/dist/cjs/types/sync/resources/user.js +120 -0
- package/dist/cjs/types/sync/resources/view-options.js +83 -0
- package/dist/cjs/types/sync/resources/workspace-filters.js +21 -0
- package/dist/cjs/types/sync/resources/workspace-goals.js +32 -0
- package/dist/cjs/types/sync/resources/workspaces.js +73 -0
- package/dist/cjs/types/sync/response.js +2 -0
- package/dist/cjs/types/sync/user-preferences.js +71 -0
- package/dist/cjs/types/tasks/index.js +18 -0
- package/dist/cjs/types/tasks/requests.js +2 -0
- package/dist/cjs/types/tasks/types.js +59 -0
- package/dist/cjs/types/templates/index.js +17 -0
- package/dist/cjs/types/templates/requests.js +2 -0
- package/dist/cjs/types/uploads/index.js +17 -0
- package/dist/cjs/types/uploads/requests.js +2 -0
- package/dist/cjs/types/users/index.js +17 -0
- package/dist/cjs/types/users/types.js +51 -0
- package/dist/cjs/types/workspaces/index.js +18 -0
- package/dist/cjs/types/workspaces/requests.js +2 -0
- package/dist/cjs/types/workspaces/types.js +155 -0
- package/dist/cjs/utils/activity-helpers.js +58 -0
- package/dist/cjs/utils/case-conversion.js +69 -0
- package/dist/cjs/utils/colors.js +143 -0
- package/dist/cjs/utils/index.js +25 -0
- package/dist/cjs/utils/multipart-upload.js +178 -0
- package/dist/cjs/utils/processing-helpers.js +18 -0
- package/dist/cjs/utils/sanitization.js +116 -0
- package/dist/cjs/utils/sync-helpers.js +22 -0
- package/dist/cjs/utils/uncompletable-helpers.js +60 -0
- package/dist/cjs/utils/url-helpers.js +74 -0
- package/dist/cjs/utils/validators.js +141 -0
- package/dist/esm/authentication.js +196 -0
- package/dist/esm/consts/endpoints.js +122 -0
- package/dist/esm/index.js +4 -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 +50 -0
- package/dist/esm/test-utils/test-defaults.js +287 -0
- package/dist/esm/todoist-api.js +2632 -0
- package/dist/esm/transport/fetch-with-retry.js +203 -0
- package/dist/esm/transport/http-client.js +128 -0
- package/dist/esm/transport/http-dispatcher.js +35 -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 +25 -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/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 +24 -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 +20 -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 +81 -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 +64 -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 +53 -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 +19 -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 +19 -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/workspace-goals.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 +37 -0
- package/dist/esm/types/sync/resources/calendars.js +28 -0
- package/dist/esm/types/sync/resources/collaborators.js +22 -0
- package/dist/esm/types/sync/resources/completed-info.js +27 -0
- package/dist/esm/types/sync/resources/filters.js +13 -0
- package/dist/esm/types/sync/resources/folders.js +11 -0
- package/dist/esm/types/sync/resources/index.js +17 -0
- package/dist/esm/types/sync/resources/live-notifications.js +36 -0
- package/dist/esm/types/sync/resources/notes.js +20 -0
- package/dist/esm/types/sync/resources/reminders.js +47 -0
- package/dist/esm/types/sync/resources/suggestions.js +39 -0
- package/dist/esm/types/sync/resources/tooltips.js +7 -0
- package/dist/esm/types/sync/resources/user-plan-limits.js +21 -0
- package/dist/esm/types/sync/resources/user-settings.js +39 -0
- package/dist/esm/types/sync/resources/user.js +117 -0
- package/dist/esm/types/sync/resources/view-options.js +80 -0
- package/dist/esm/types/sync/resources/workspace-filters.js +18 -0
- package/dist/esm/types/sync/resources/workspace-goals.js +29 -0
- package/dist/esm/types/sync/resources/workspaces.js +70 -0
- package/dist/esm/types/sync/response.js +1 -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/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 +48 -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 +152 -0
- package/dist/esm/utils/activity-helpers.js +53 -0
- package/dist/esm/utils/case-conversion.js +61 -0
- package/dist/esm/utils/colors.js +139 -0
- package/dist/esm/utils/index.js +4 -0
- package/dist/esm/utils/multipart-upload.js +142 -0
- package/dist/esm/utils/processing-helpers.js +12 -0
- package/dist/esm/utils/sanitization.js +112 -0
- package/dist/esm/utils/sync-helpers.js +19 -0
- package/dist/esm/utils/uncompletable-helpers.js +54 -0
- package/dist/esm/utils/url-helpers.js +68 -0
- package/dist/esm/utils/validators.js +132 -0
- package/dist/types/authentication.d.ts +158 -0
- package/dist/types/consts/endpoints.d.ts +81 -0
- package/dist/types/index.d.ts +4 -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 +267 -0
- package/dist/types/todoist-api.d.ts +1021 -0
- package/dist/types/transport/fetch-with-retry.d.ts +12 -0
- package/dist/types/transport/http-client.d.ts +16 -0
- package/dist/types/transport/http-dispatcher.d.ts +3 -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 +49 -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/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 +12 -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 +85 -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 +20 -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 +186 -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 +190 -0
- package/dist/types/types/projects/types.d.ts +201 -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 +41 -0
- package/dist/types/types/sections/types.d.ts +44 -0
- package/dist/types/types/sync/commands/calendars.d.ts +14 -0
- package/dist/types/types/sync/commands/filters.d.ts +22 -0
- package/dist/types/types/sync/commands/folders.d.ts +18 -0
- package/dist/types/types/sync/commands/index.d.ts +171 -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 +39 -0
- package/dist/types/types/sync/commands/project-view-options.d.ts +14 -0
- package/dist/types/types/sync/commands/projects.d.ts +90 -0
- package/dist/types/types/sync/commands/reminders.d.ts +51 -0
- package/dist/types/types/sync/commands/sections.d.ts +31 -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 +15 -0
- package/dist/types/types/sync/commands/workspace-filters.d.ts +23 -0
- package/dist/types/types/sync/commands/workspace-goals.d.ts +24 -0
- package/dist/types/types/sync/commands/workspaces.d.ts +79 -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 +28 -0
- package/dist/types/types/sync/resources/completed-info.d.ts +33 -0
- package/dist/types/types/sync/resources/filters.d.ts +12 -0
- package/dist/types/types/sync/resources/folders.d.ts +10 -0
- package/dist/types/types/sync/resources/index.d.ts +17 -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 +126 -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 +41 -0
- package/dist/types/types/sync/resources/user-settings.d.ts +40 -0
- package/dist/types/types/sync/resources/user.d.ts +134 -0
- package/dist/types/types/sync/resources/view-options.d.ts +169 -0
- package/dist/types/types/sync/resources/workspace-filters.d.ts +17 -0
- package/dist/types/types/sync/resources/workspace-goals.d.ts +29 -0
- package/dist/types/types/sync/resources/workspaces.d.ts +142 -0
- package/dist/types/types/sync/response.d.ts +51 -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/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 +66 -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 +267 -0
- package/dist/types/utils/activity-helpers.d.ts +28 -0
- package/dist/types/utils/case-conversion.d.ts +12 -0
- package/dist/types/utils/colors.d.ts +197 -0
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/multipart-upload.d.ts +54 -0
- package/dist/types/utils/processing-helpers.d.ts +1 -0
- package/dist/types/utils/sanitization.d.ts +35 -0
- package/dist/types/utils/sync-helpers.d.ts +17 -0
- package/dist/types/utils/uncompletable-helpers.d.ts +30 -0
- package/dist/types/utils/url-helpers.d.ts +32 -0
- package/dist/types/utils/validators.d.ts +1404 -0
- package/package.json +99 -8
|
@@ -0,0 +1,20 @@
|
|
|
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
|
|
8
|
+
.object({
|
|
9
|
+
id: z.string(),
|
|
10
|
+
itemId: z.string().optional(),
|
|
11
|
+
projectId: z.string().optional(),
|
|
12
|
+
content: z.string(),
|
|
13
|
+
postedAt: z.string(),
|
|
14
|
+
fileAttachment: AttachmentSchema.nullable(),
|
|
15
|
+
postedUid: z.string(),
|
|
16
|
+
uidsToNotify: z.array(z.string()).nullable(),
|
|
17
|
+
reactions: z.record(z.string(), z.array(z.string())).nullable(),
|
|
18
|
+
isDeleted: z.boolean(),
|
|
19
|
+
})
|
|
20
|
+
.passthrough();
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DueDateSchema } from '../../tasks/types.js';
|
|
3
|
+
export const ReminderBaseSchema = z.object({
|
|
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
|
+
}).passthrough();
|
|
32
|
+
export const AbsoluteReminderSchema = ReminderBaseSchema.extend({
|
|
33
|
+
type: z.literal(ReminderTypeEnum.Absolute),
|
|
34
|
+
due: DueDateSchema,
|
|
35
|
+
isUrgent: z.boolean().optional(),
|
|
36
|
+
}).passthrough();
|
|
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
|
+
}).passthrough();
|
|
43
|
+
export const ReminderSchema = z.discriminatedUnion('type', [
|
|
44
|
+
LocationReminderSchema,
|
|
45
|
+
AbsoluteReminderSchema,
|
|
46
|
+
RelativeReminderSchema,
|
|
47
|
+
]);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Available template types. */
|
|
3
|
+
export const TEMPLATE_TYPES = ['project', 'setup'];
|
|
4
|
+
export const TemplateSuggestionSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
id: z.string(),
|
|
7
|
+
name: z.string(),
|
|
8
|
+
templateType: z.enum(TEMPLATE_TYPES),
|
|
9
|
+
})
|
|
10
|
+
.passthrough();
|
|
11
|
+
export const WorkspaceTemplateSuggestionSchema = TemplateSuggestionSchema.extend({
|
|
12
|
+
workspaceId: z.string().nullable(),
|
|
13
|
+
});
|
|
14
|
+
/** Available suggestion section types. */
|
|
15
|
+
export const SUGGESTION_SECTION_TYPES = ['templates', 'most_used_user_templates'];
|
|
16
|
+
export const SyncTemplateSuggestionsSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
type: z.enum(SUGGESTION_SECTION_TYPES),
|
|
19
|
+
content: z.object({
|
|
20
|
+
templates: z.array(TemplateSuggestionSchema),
|
|
21
|
+
locale: z.string(),
|
|
22
|
+
}),
|
|
23
|
+
isDeleted: z.boolean(),
|
|
24
|
+
})
|
|
25
|
+
.passthrough();
|
|
26
|
+
export const SyncWorkspaceTemplateSuggestionsSchema = z
|
|
27
|
+
.object({
|
|
28
|
+
type: z.literal('most_used_workspace_templates'),
|
|
29
|
+
content: z.object({
|
|
30
|
+
templates: z.array(WorkspaceTemplateSuggestionSchema),
|
|
31
|
+
locale: z.string(),
|
|
32
|
+
}),
|
|
33
|
+
isDeleted: z.boolean(),
|
|
34
|
+
})
|
|
35
|
+
.passthrough();
|
|
36
|
+
export const SuggestionSchema = z.union([
|
|
37
|
+
SyncWorkspaceTemplateSuggestionsSchema,
|
|
38
|
+
SyncTemplateSuggestionsSchema,
|
|
39
|
+
]);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const PlanLimitsSchema = z
|
|
3
|
+
.object({
|
|
4
|
+
activeProjects: z.number().int().optional(),
|
|
5
|
+
activityLog: z.number().int().optional(),
|
|
6
|
+
collaboratorsPerProject: z.number().int().optional(),
|
|
7
|
+
commentsPerTask: z.number().int().optional(),
|
|
8
|
+
fileUploadsPerComment: z.number().int().optional(),
|
|
9
|
+
filtersPerUser: z.number().int().optional(),
|
|
10
|
+
labelsPerTask: z.number().int().optional(),
|
|
11
|
+
remindersPerUser: z.number().int().optional(),
|
|
12
|
+
sectionsPerProject: z.number().int().optional(),
|
|
13
|
+
tasksPerProject: z.number().int().optional(),
|
|
14
|
+
})
|
|
15
|
+
.passthrough();
|
|
16
|
+
export const UserPlanLimitsSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
current: PlanLimitsSchema,
|
|
19
|
+
next: PlanLimitsSchema.nullable(),
|
|
20
|
+
})
|
|
21
|
+
.passthrough();
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const NavigationFeatureSchema = z.object({
|
|
3
|
+
name: z.string(),
|
|
4
|
+
shown: z.boolean(),
|
|
5
|
+
});
|
|
6
|
+
export const QuickAddFeatureSchema = z.object({
|
|
7
|
+
name: z.string(),
|
|
8
|
+
shown: z.boolean(),
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* Sync API user settings resource.
|
|
12
|
+
*/
|
|
13
|
+
export const UserSettingsSchema = z
|
|
14
|
+
.object({
|
|
15
|
+
completedSoundDesktop: z.boolean(),
|
|
16
|
+
completedSoundMobile: z.boolean(),
|
|
17
|
+
debugLogSendingEnabledUntil: z.string().nullable(),
|
|
18
|
+
legacyPricing: z.boolean(),
|
|
19
|
+
navigation: z
|
|
20
|
+
.object({
|
|
21
|
+
countsShown: z.boolean(),
|
|
22
|
+
features: z.array(NavigationFeatureSchema),
|
|
23
|
+
})
|
|
24
|
+
.passthrough(),
|
|
25
|
+
reminderDesktop: z.boolean(),
|
|
26
|
+
reminderEmail: z.boolean(),
|
|
27
|
+
reminderPush: z.boolean(),
|
|
28
|
+
resetRecurringSubtasks: z.boolean(),
|
|
29
|
+
aiEmailAssist: z.boolean(),
|
|
30
|
+
theme: z.string().nullable().optional(),
|
|
31
|
+
syncTheme: z.boolean().optional(),
|
|
32
|
+
quickAdd: z
|
|
33
|
+
.object({
|
|
34
|
+
labelsShown: z.boolean(),
|
|
35
|
+
features: z.array(QuickAddFeatureSchema),
|
|
36
|
+
})
|
|
37
|
+
.passthrough(),
|
|
38
|
+
})
|
|
39
|
+
.passthrough();
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PREMIUM_STATUSES } from '../../users/types.js';
|
|
3
|
+
import { BooleanFromZeroOneSchema, DateFormatSchema, DayOfWeekSchema, TimeFormatSchema, } from '../user-preferences.js';
|
|
4
|
+
export const FeaturesSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
karmaDisabled: z.boolean(),
|
|
7
|
+
restriction: z.number().int(),
|
|
8
|
+
karmaVacation: z.boolean(),
|
|
9
|
+
dateistLang: z.any(),
|
|
10
|
+
beta: BooleanFromZeroOneSchema,
|
|
11
|
+
hasPushReminders: z.boolean(),
|
|
12
|
+
dateistInlineDisabled: z.boolean(),
|
|
13
|
+
autoInviteDisabled: z.boolean().optional(),
|
|
14
|
+
goldTheme: z.boolean().optional(),
|
|
15
|
+
migratedFromTdb: z.boolean().optional(),
|
|
16
|
+
})
|
|
17
|
+
.passthrough();
|
|
18
|
+
export const TzInfoSchema = z
|
|
19
|
+
.object({
|
|
20
|
+
timezone: z.string(),
|
|
21
|
+
hours: z.number().int(),
|
|
22
|
+
minutes: z.number().int(),
|
|
23
|
+
isDst: BooleanFromZeroOneSchema,
|
|
24
|
+
gmtString: z.string(),
|
|
25
|
+
})
|
|
26
|
+
.passthrough();
|
|
27
|
+
export const JoinableWorkspaceSchema = z
|
|
28
|
+
.object({
|
|
29
|
+
workspaceId: z.string(),
|
|
30
|
+
workspaceName: z.string(),
|
|
31
|
+
memberCount: z.number().int(),
|
|
32
|
+
})
|
|
33
|
+
.passthrough();
|
|
34
|
+
export const GettingStartedGuideProjectSchema = z
|
|
35
|
+
.object({
|
|
36
|
+
onboardingUseCase: z.string(),
|
|
37
|
+
projectId: z.string(),
|
|
38
|
+
completed: z.boolean(),
|
|
39
|
+
closed: z.boolean(),
|
|
40
|
+
})
|
|
41
|
+
.passthrough();
|
|
42
|
+
/**
|
|
43
|
+
* Sync API user resource.
|
|
44
|
+
*
|
|
45
|
+
* This is a superset of the REST `CurrentUserSchema` — the Sync API returns
|
|
46
|
+
* many additional fields for features, onboarding state, and account details.
|
|
47
|
+
*/
|
|
48
|
+
export const SyncUserSchema = z
|
|
49
|
+
.object({
|
|
50
|
+
id: z.string(),
|
|
51
|
+
email: z.string(),
|
|
52
|
+
fullName: z.string(),
|
|
53
|
+
activatedUser: z.boolean(),
|
|
54
|
+
autoReminder: z.number().int(),
|
|
55
|
+
avatarBig: z.string().optional(),
|
|
56
|
+
avatarMedium: z.string().optional(),
|
|
57
|
+
avatarS640: z.string().optional(),
|
|
58
|
+
avatarSmall: z.string().optional(),
|
|
59
|
+
businessAccountId: z.string().nullable(),
|
|
60
|
+
dailyGoal: z.number().int(),
|
|
61
|
+
dateFormat: DateFormatSchema,
|
|
62
|
+
dateistLang: z.string().nullable(),
|
|
63
|
+
daysOff: z.array(z.number().int()),
|
|
64
|
+
featureIdentifier: z.string(),
|
|
65
|
+
features: FeaturesSchema,
|
|
66
|
+
freeTrailExpires: z.string().optional(),
|
|
67
|
+
hasMagicNumber: z.boolean(),
|
|
68
|
+
hasPassword: z.boolean(),
|
|
69
|
+
hasStartedATrial: z.boolean().optional(),
|
|
70
|
+
imageId: z.string().nullable(),
|
|
71
|
+
inboxProjectId: z.string(),
|
|
72
|
+
isCelebrationsEnabled: z.boolean(),
|
|
73
|
+
isPremium: z.boolean(),
|
|
74
|
+
joinableWorkspace: JoinableWorkspaceSchema.nullable(),
|
|
75
|
+
joinedAt: z.string(),
|
|
76
|
+
gettingStartedGuideProjects: z.array(GettingStartedGuideProjectSchema).nullable(),
|
|
77
|
+
karma: z.number(),
|
|
78
|
+
karmaTrend: z.string(),
|
|
79
|
+
lang: z.string(),
|
|
80
|
+
mfaEnabled: z.boolean().optional(),
|
|
81
|
+
mobileHost: z.string().nullable(),
|
|
82
|
+
mobileNumber: z.string().nullable(),
|
|
83
|
+
nextWeek: DayOfWeekSchema,
|
|
84
|
+
onboardingLevel: z.string().nullable().optional(),
|
|
85
|
+
onboardingRole: z.string().nullable().optional(),
|
|
86
|
+
onboardingPersona: z.string().nullable().optional(),
|
|
87
|
+
onboardingInitiated: z.boolean().nullable().optional(),
|
|
88
|
+
onboardingCompleted: z.boolean().nullable().optional(),
|
|
89
|
+
onboardingSkipped: z.boolean().optional(),
|
|
90
|
+
onboardingTeamMode: z.boolean().nullable().optional(),
|
|
91
|
+
onboardingUseCases: z.array(z.string()).nullable().optional(),
|
|
92
|
+
premiumStatus: z.enum(PREMIUM_STATUSES),
|
|
93
|
+
premiumUntil: z.string().nullable(),
|
|
94
|
+
rambleSessionsUsage: z
|
|
95
|
+
.object({
|
|
96
|
+
currentCount: z.number().int(),
|
|
97
|
+
limit: z.number().int(),
|
|
98
|
+
remaining: z.number().int(),
|
|
99
|
+
resetDate: z.string(),
|
|
100
|
+
})
|
|
101
|
+
.nullable()
|
|
102
|
+
.optional(),
|
|
103
|
+
shareLimit: z.number().int(),
|
|
104
|
+
sortOrder: z.number().int(),
|
|
105
|
+
startDay: DayOfWeekSchema,
|
|
106
|
+
startPage: z.string(),
|
|
107
|
+
themeId: z.string(),
|
|
108
|
+
timeFormat: TimeFormatSchema,
|
|
109
|
+
token: z.string(),
|
|
110
|
+
tzInfo: TzInfoSchema,
|
|
111
|
+
uniquePrefix: z.number().int(),
|
|
112
|
+
verificationStatus: z.string(),
|
|
113
|
+
websocketUrl: z.string(),
|
|
114
|
+
weekendStartDay: z.number().int(),
|
|
115
|
+
weeklyGoal: z.number().int(),
|
|
116
|
+
})
|
|
117
|
+
.passthrough();
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Available view types. */
|
|
3
|
+
export const VIEW_TYPES = [
|
|
4
|
+
'TODAY',
|
|
5
|
+
'UPCOMING',
|
|
6
|
+
'PROJECT',
|
|
7
|
+
'LABEL',
|
|
8
|
+
'FILTER',
|
|
9
|
+
'WORKSPACE_FILTER',
|
|
10
|
+
'SEARCH',
|
|
11
|
+
'TEMPLATE_PREVIEW',
|
|
12
|
+
'TASK_DETAIL',
|
|
13
|
+
'AUTOMATION',
|
|
14
|
+
'ASSIGNED',
|
|
15
|
+
'OVERDUE',
|
|
16
|
+
'WORKSPACE_OVERVIEW',
|
|
17
|
+
];
|
|
18
|
+
export const ViewTypeSchema = z.enum(VIEW_TYPES);
|
|
19
|
+
/** Available view modes. */
|
|
20
|
+
export const VIEW_MODES = ['LIST', 'BOARD', 'CALENDAR'];
|
|
21
|
+
export const ViewModeSchema = z.enum(VIEW_MODES);
|
|
22
|
+
/** Available grouping options. */
|
|
23
|
+
export const GROUPED_BY_OPTIONS = [
|
|
24
|
+
'ASSIGNEE',
|
|
25
|
+
'ADDED_DATE',
|
|
26
|
+
'DUE_DATE',
|
|
27
|
+
'DEADLINE',
|
|
28
|
+
'LABEL',
|
|
29
|
+
'PRIORITY',
|
|
30
|
+
'PROJECT',
|
|
31
|
+
'WORKSPACE',
|
|
32
|
+
];
|
|
33
|
+
export const GroupedBySchema = z.enum(GROUPED_BY_OPTIONS).nullable();
|
|
34
|
+
/** Available sorting options. */
|
|
35
|
+
export const SORTED_BY_OPTIONS = [
|
|
36
|
+
'MANUAL',
|
|
37
|
+
'ALPHABETICALLY',
|
|
38
|
+
'ASSIGNEE',
|
|
39
|
+
'DUE_DATE',
|
|
40
|
+
'DEADLINE',
|
|
41
|
+
'ADDED_DATE',
|
|
42
|
+
'PRIORITY',
|
|
43
|
+
'PROJECT',
|
|
44
|
+
'WORKSPACE',
|
|
45
|
+
];
|
|
46
|
+
export const SortedBySchema = z.enum(SORTED_BY_OPTIONS).nullable();
|
|
47
|
+
/** Available sort directions. */
|
|
48
|
+
export const SORT_ORDERS = ['ASC', 'DESC'];
|
|
49
|
+
export const SortOrderSchema = z.enum(SORT_ORDERS).nullable();
|
|
50
|
+
/** Available calendar layout modes. */
|
|
51
|
+
export const CALENDAR_LAYOUTS = ['WEEK', 'MONTH'];
|
|
52
|
+
export const CalendarSettingsSchema = z
|
|
53
|
+
.object({
|
|
54
|
+
layout: z.enum(CALENDAR_LAYOUTS).optional(),
|
|
55
|
+
})
|
|
56
|
+
.passthrough();
|
|
57
|
+
export const ViewOptionsSchema = z
|
|
58
|
+
.object({
|
|
59
|
+
viewType: ViewTypeSchema,
|
|
60
|
+
objectId: z.string().optional(),
|
|
61
|
+
groupedBy: GroupedBySchema.optional(),
|
|
62
|
+
filteredBy: z.string().nullable().optional(),
|
|
63
|
+
viewMode: ViewModeSchema.optional(),
|
|
64
|
+
showCompletedTasks: z.boolean().optional(),
|
|
65
|
+
sortedBy: SortedBySchema.optional(),
|
|
66
|
+
sortOrder: SortOrderSchema.optional(),
|
|
67
|
+
})
|
|
68
|
+
.passthrough();
|
|
69
|
+
export const ProjectViewOptionsDefaultsSchema = z
|
|
70
|
+
.object({
|
|
71
|
+
projectId: z.string(),
|
|
72
|
+
viewMode: ViewModeSchema.nullable().optional(),
|
|
73
|
+
groupedBy: GroupedBySchema.optional(),
|
|
74
|
+
sortedBy: SortedBySchema.optional(),
|
|
75
|
+
sortOrder: SortOrderSchema.optional(),
|
|
76
|
+
showCompletedTasks: z.boolean().optional(),
|
|
77
|
+
filteredBy: z.string().nullable().optional(),
|
|
78
|
+
calendarSettings: CalendarSettingsSchema.nullable().optional(),
|
|
79
|
+
})
|
|
80
|
+
.passthrough();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const WorkspaceFilterSchema = z
|
|
3
|
+
.object({
|
|
4
|
+
id: z.string(),
|
|
5
|
+
workspaceId: z.string(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
query: z.string(),
|
|
8
|
+
color: z.string(),
|
|
9
|
+
itemOrder: z.number().int(),
|
|
10
|
+
isDeleted: z.boolean(),
|
|
11
|
+
isFavorite: z.boolean(),
|
|
12
|
+
isFrozen: z.boolean(),
|
|
13
|
+
creatorUid: z.string(),
|
|
14
|
+
updaterUid: z.string(),
|
|
15
|
+
createdAt: z.string(),
|
|
16
|
+
updatedAt: z.string(),
|
|
17
|
+
})
|
|
18
|
+
.passthrough();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const WorkspaceGoalMilestoneSchema = z
|
|
3
|
+
.object({
|
|
4
|
+
id: z.string(),
|
|
5
|
+
title: z.string(),
|
|
6
|
+
isCompleted: z.boolean(),
|
|
7
|
+
})
|
|
8
|
+
.passthrough();
|
|
9
|
+
export const WorkspaceGoalProgressSchema = z
|
|
10
|
+
.object({
|
|
11
|
+
completedItems: z.number().int(),
|
|
12
|
+
totalItems: z.number().int(),
|
|
13
|
+
})
|
|
14
|
+
.passthrough();
|
|
15
|
+
export const WorkspaceGoalSchema = z
|
|
16
|
+
.object({
|
|
17
|
+
id: z.string(),
|
|
18
|
+
workspaceId: z.string(),
|
|
19
|
+
title: z.string(),
|
|
20
|
+
description: z.string().nullable(),
|
|
21
|
+
deadline: z.string().nullable(),
|
|
22
|
+
isDeleted: z.boolean(),
|
|
23
|
+
projectIds: z.array(z.string()),
|
|
24
|
+
progress: WorkspaceGoalProgressSchema.nullable(),
|
|
25
|
+
creatorUid: z.string(),
|
|
26
|
+
createdAt: z.string(),
|
|
27
|
+
updatedAt: z.string(),
|
|
28
|
+
})
|
|
29
|
+
.passthrough();
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
import { StringOrNumberSchema } from '../../common.js';
|
|
14
|
+
import { WorkspaceRoleSchema, WorkspacePlanSchema, WorkspaceLimitsSchema, WorkspacePropertiesSchema, } from '../../workspaces/types.js';
|
|
15
|
+
/**
|
|
16
|
+
* Sync API workspace resource.
|
|
17
|
+
*
|
|
18
|
+
* This is a superset of the REST `WorkspaceSchema` — the Sync API returns
|
|
19
|
+
* additional fields like description, isDeleted, isCollapsed, member counts,
|
|
20
|
+
* domain settings, and sorting preferences.
|
|
21
|
+
*/
|
|
22
|
+
export const SyncWorkspaceSchema = z
|
|
23
|
+
.object({
|
|
24
|
+
id: StringOrNumberSchema,
|
|
25
|
+
name: z.string(),
|
|
26
|
+
description: z.string(),
|
|
27
|
+
logoBig: z.string().optional(),
|
|
28
|
+
logoMedium: z.string().optional(),
|
|
29
|
+
logoSmall: z.string().optional(),
|
|
30
|
+
logoS640: z.string().optional(),
|
|
31
|
+
creatorId: StringOrNumberSchema,
|
|
32
|
+
createdAt: z.string().optional(),
|
|
33
|
+
dateCreated: z.string().optional(),
|
|
34
|
+
isDeleted: z.boolean(),
|
|
35
|
+
isCollapsed: z.boolean(),
|
|
36
|
+
role: WorkspaceRoleSchema.optional(),
|
|
37
|
+
plan: WorkspacePlanSchema,
|
|
38
|
+
limits: WorkspaceLimitsSchema.optional(),
|
|
39
|
+
inviteCode: z.string().nullable().optional(),
|
|
40
|
+
isLinkSharingEnabled: z.boolean().nullable().optional(),
|
|
41
|
+
isGuestAllowed: z.boolean().nullable().optional(),
|
|
42
|
+
currentActiveProjects: z.number().nullable(),
|
|
43
|
+
currentMemberCount: z.number().nullable(),
|
|
44
|
+
memberCountByType: z
|
|
45
|
+
.object({
|
|
46
|
+
adminCount: z.number().int(),
|
|
47
|
+
guestCount: z.number().int(),
|
|
48
|
+
memberCount: z.number().int(),
|
|
49
|
+
})
|
|
50
|
+
.optional(),
|
|
51
|
+
currentTemplateCount: z.number().nullable(),
|
|
52
|
+
pendingInvitations: z.array(z.string()).nullable().optional(),
|
|
53
|
+
domainName: z.string().optional(),
|
|
54
|
+
domainDiscovery: z.boolean().optional(),
|
|
55
|
+
restrictEmailDomains: z.boolean().optional(),
|
|
56
|
+
adminSortingApplied: z.boolean(),
|
|
57
|
+
projectSortPreference: z.string().optional(),
|
|
58
|
+
defaultCollaborators: z
|
|
59
|
+
.object({
|
|
60
|
+
predefinedGroupIds: z.array(z.string()),
|
|
61
|
+
userIds: z.array(z.number()),
|
|
62
|
+
})
|
|
63
|
+
.optional(),
|
|
64
|
+
properties: WorkspacePropertiesSchema.optional(),
|
|
65
|
+
})
|
|
66
|
+
.passthrough()
|
|
67
|
+
.transform((_a) => {
|
|
68
|
+
var { dateCreated, createdAt } = _a, rest = __rest(_a, ["dateCreated", "createdAt"]);
|
|
69
|
+
return (Object.assign(Object.assign({}, rest), { createdAt: createdAt !== null && createdAt !== void 0 ? createdAt : dateCreated }));
|
|
70
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Available date format options. */
|
|
3
|
+
export const DATE_FORMATS = ['DD/MM/YYYY', 'MM/DD/YYYY'];
|
|
4
|
+
/** Available time format options. */
|
|
5
|
+
export const TIME_FORMATS = ['24h', '12h'];
|
|
6
|
+
/** Available days of the week. */
|
|
7
|
+
export const DAYS_OF_WEEK = [
|
|
8
|
+
'Monday',
|
|
9
|
+
'Tuesday',
|
|
10
|
+
'Wednesday',
|
|
11
|
+
'Thursday',
|
|
12
|
+
'Friday',
|
|
13
|
+
'Saturday',
|
|
14
|
+
'Sunday',
|
|
15
|
+
];
|
|
16
|
+
export const DATE_FORMAT_FROM_API = {
|
|
17
|
+
0: 'DD/MM/YYYY',
|
|
18
|
+
1: 'MM/DD/YYYY',
|
|
19
|
+
};
|
|
20
|
+
export const TIME_FORMAT_FROM_API = {
|
|
21
|
+
0: '24h',
|
|
22
|
+
1: '12h',
|
|
23
|
+
};
|
|
24
|
+
export const DAY_OF_WEEK_FROM_API = {
|
|
25
|
+
1: 'Monday',
|
|
26
|
+
2: 'Tuesday',
|
|
27
|
+
3: 'Wednesday',
|
|
28
|
+
4: 'Thursday',
|
|
29
|
+
5: 'Friday',
|
|
30
|
+
6: 'Saturday',
|
|
31
|
+
7: 'Sunday',
|
|
32
|
+
};
|
|
33
|
+
export const DATE_FORMAT_TO_API = {
|
|
34
|
+
'DD/MM/YYYY': 0,
|
|
35
|
+
'MM/DD/YYYY': 1,
|
|
36
|
+
};
|
|
37
|
+
export const TIME_FORMAT_TO_API = { '24h': 0, '12h': 1 };
|
|
38
|
+
export const DAY_OF_WEEK_TO_API = {
|
|
39
|
+
Monday: 1,
|
|
40
|
+
Tuesday: 2,
|
|
41
|
+
Wednesday: 3,
|
|
42
|
+
Thursday: 4,
|
|
43
|
+
Friday: 5,
|
|
44
|
+
Saturday: 6,
|
|
45
|
+
Sunday: 7,
|
|
46
|
+
};
|
|
47
|
+
/** Zod read-schema: parse API 0/1 integer, emit boolean */
|
|
48
|
+
export const BooleanFromZeroOneSchema = z
|
|
49
|
+
.union([z.literal(0), z.literal(1)])
|
|
50
|
+
.transform((v) => v === 1);
|
|
51
|
+
/** Zod read-schemas: parse API numbers, emit descriptive strings */
|
|
52
|
+
export const DateFormatSchema = z
|
|
53
|
+
.union([z.literal(0), z.literal(1)])
|
|
54
|
+
.transform((v) => DATE_FORMAT_FROM_API[v]);
|
|
55
|
+
export const TimeFormatSchema = z
|
|
56
|
+
.union([z.literal(0), z.literal(1)])
|
|
57
|
+
.transform((v) => TIME_FORMAT_FROM_API[v]);
|
|
58
|
+
export const DayOfWeekSchema = z
|
|
59
|
+
.union([
|
|
60
|
+
z.literal(1),
|
|
61
|
+
z.literal(2),
|
|
62
|
+
z.literal(3),
|
|
63
|
+
z.literal(4),
|
|
64
|
+
z.literal(5),
|
|
65
|
+
z.literal(6),
|
|
66
|
+
z.literal(7),
|
|
67
|
+
])
|
|
68
|
+
.transform((v) => DAY_OF_WEEK_FROM_API[v]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getTaskUrl } from '../../utils/url-helpers.js';
|
|
3
|
+
import { hasUncompletablePrefix } from '../../utils/uncompletable-helpers.js';
|
|
4
|
+
export const DueDateSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
isRecurring: z.boolean(),
|
|
7
|
+
string: z.string(),
|
|
8
|
+
date: z.string(),
|
|
9
|
+
})
|
|
10
|
+
.extend({
|
|
11
|
+
datetime: z.string().nullable().optional(),
|
|
12
|
+
timezone: z.string().nullable().optional(),
|
|
13
|
+
lang: z.string().nullable().optional(),
|
|
14
|
+
});
|
|
15
|
+
/** Available duration units for task deadlines. */
|
|
16
|
+
export const DURATION_UNITS = ['minute', 'day'];
|
|
17
|
+
export const DurationSchema = z.object({
|
|
18
|
+
amount: z.number().positive('Value should be greater than zero'),
|
|
19
|
+
unit: z.enum(DURATION_UNITS),
|
|
20
|
+
});
|
|
21
|
+
export const DeadlineSchema = z.object({
|
|
22
|
+
date: z.string(),
|
|
23
|
+
lang: z.string(),
|
|
24
|
+
});
|
|
25
|
+
export const TaskSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
id: z.string(),
|
|
28
|
+
userId: z.string(),
|
|
29
|
+
projectId: z.string(),
|
|
30
|
+
sectionId: z.string().nullable(),
|
|
31
|
+
parentId: z.string().nullable(),
|
|
32
|
+
addedByUid: z.string().nullable(),
|
|
33
|
+
assignedByUid: z.string().nullable(),
|
|
34
|
+
responsibleUid: z.string().nullable(),
|
|
35
|
+
labels: z.array(z.string()),
|
|
36
|
+
deadline: DeadlineSchema.nullable(),
|
|
37
|
+
duration: DurationSchema.nullable(),
|
|
38
|
+
checked: z.boolean(),
|
|
39
|
+
isDeleted: z.boolean(),
|
|
40
|
+
addedAt: z.string().nullable(),
|
|
41
|
+
completedAt: z.string().nullable(),
|
|
42
|
+
updatedAt: z.string().nullable(),
|
|
43
|
+
due: DueDateSchema.nullable(),
|
|
44
|
+
priority: z.number().int(),
|
|
45
|
+
childOrder: z.number().int(),
|
|
46
|
+
content: z.string(),
|
|
47
|
+
description: z.string(),
|
|
48
|
+
dayOrder: z.number().int(),
|
|
49
|
+
isCollapsed: z.boolean(),
|
|
50
|
+
isUncompletable: z.boolean().default(false),
|
|
51
|
+
})
|
|
52
|
+
.transform((data) => {
|
|
53
|
+
// Auto-detect uncompletable status from content prefix
|
|
54
|
+
const isUncompletable = hasUncompletablePrefix(data.content);
|
|
55
|
+
return Object.assign(Object.assign({}, data), { isUncompletable, url: getTaskUrl(data.id, data.content) });
|
|
56
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './requests.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './requests.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types.js';
|