@doist/todoist-api-typescript 6.5.1 → 6.7.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.
Files changed (140) hide show
  1. package/dist/cjs/todoist-api.js +32 -4
  2. package/dist/cjs/types/index.js +1 -0
  3. package/dist/cjs/types/sync/commands/calendars.js +2 -0
  4. package/dist/cjs/types/sync/commands/filters.js +2 -0
  5. package/dist/cjs/types/sync/commands/folders.js +2 -0
  6. package/dist/cjs/types/sync/commands/index.js +35 -0
  7. package/dist/cjs/types/sync/commands/labels.js +2 -0
  8. package/dist/cjs/types/sync/commands/notes.js +2 -0
  9. package/dist/cjs/types/sync/commands/notifications.js +2 -0
  10. package/dist/cjs/types/sync/commands/others.js +2 -0
  11. package/dist/cjs/types/sync/commands/project-view-options.js +2 -0
  12. package/dist/cjs/types/sync/commands/projects.js +2 -0
  13. package/dist/cjs/types/sync/commands/reminders.js +2 -0
  14. package/dist/cjs/types/sync/commands/sections.js +2 -0
  15. package/dist/cjs/types/sync/commands/shared.js +5 -0
  16. package/dist/cjs/types/sync/commands/sharing.js +2 -0
  17. package/dist/cjs/types/sync/commands/tasks.js +2 -0
  18. package/dist/cjs/types/sync/commands/view-options.js +2 -0
  19. package/dist/cjs/types/sync/commands/workspace-filters.js +2 -0
  20. package/dist/cjs/types/sync/commands/workspace-goals.js +2 -0
  21. package/dist/cjs/types/sync/commands/workspaces.js +2 -0
  22. package/dist/cjs/types/sync/index.js +21 -0
  23. package/dist/cjs/types/sync/request.js +2 -0
  24. package/dist/cjs/types/{sync.js → sync/resource-types.js} +9 -0
  25. package/dist/cjs/types/sync/resources/calendars.js +27 -0
  26. package/dist/cjs/types/sync/resources/collaborators.js +23 -0
  27. package/dist/cjs/types/sync/resources/completed-info.js +30 -0
  28. package/dist/cjs/types/sync/resources/filters.js +16 -0
  29. package/dist/cjs/types/sync/resources/folders.js +14 -0
  30. package/dist/cjs/types/sync/resources/index.js +33 -0
  31. package/dist/cjs/types/sync/resources/live-notifications.js +28 -0
  32. package/dist/cjs/types/sync/resources/notes.js +23 -0
  33. package/dist/cjs/types/sync/resources/reminders.js +34 -0
  34. package/dist/cjs/types/sync/resources/suggestions.js +38 -0
  35. package/dist/cjs/types/sync/resources/tooltips.js +10 -0
  36. package/dist/cjs/types/sync/resources/user-plan-limits.js +24 -0
  37. package/dist/cjs/types/sync/resources/user-settings.js +42 -0
  38. package/dist/cjs/types/sync/resources/user.js +123 -0
  39. package/dist/cjs/types/sync/resources/view-options.js +75 -0
  40. package/dist/cjs/types/sync/resources/workspace-filters.js +21 -0
  41. package/dist/cjs/types/sync/resources/workspace-goals.js +32 -0
  42. package/dist/cjs/types/sync/resources/workspaces.js +49 -0
  43. package/dist/cjs/types/sync/response.js +2 -0
  44. package/dist/cjs/utils/index.js +3 -1
  45. package/dist/cjs/utils/sync-helpers.js +22 -0
  46. package/dist/cjs/utils/validators.js +69 -88
  47. package/dist/esm/todoist-api.js +32 -4
  48. package/dist/esm/types/index.js +1 -0
  49. package/dist/esm/types/sync/commands/calendars.js +1 -0
  50. package/dist/esm/types/sync/commands/filters.js +1 -0
  51. package/dist/esm/types/sync/commands/folders.js +1 -0
  52. package/dist/esm/types/sync/commands/index.js +19 -0
  53. package/dist/esm/types/sync/commands/labels.js +1 -0
  54. package/dist/esm/types/sync/commands/notes.js +1 -0
  55. package/dist/esm/types/sync/commands/notifications.js +1 -0
  56. package/dist/esm/types/sync/commands/others.js +1 -0
  57. package/dist/esm/types/sync/commands/project-view-options.js +1 -0
  58. package/dist/esm/types/sync/commands/projects.js +1 -0
  59. package/dist/esm/types/sync/commands/reminders.js +1 -0
  60. package/dist/esm/types/sync/commands/sections.js +1 -0
  61. package/dist/esm/types/sync/commands/shared.js +4 -0
  62. package/dist/esm/types/sync/commands/sharing.js +1 -0
  63. package/dist/esm/types/sync/commands/tasks.js +1 -0
  64. package/dist/esm/types/sync/commands/view-options.js +1 -0
  65. package/dist/esm/types/sync/commands/workspace-filters.js +1 -0
  66. package/dist/esm/types/sync/commands/workspace-goals.js +1 -0
  67. package/dist/esm/types/sync/commands/workspaces.js +1 -0
  68. package/dist/esm/types/sync/index.js +5 -0
  69. package/dist/esm/types/sync/request.js +1 -0
  70. package/dist/esm/types/{sync.js → sync/resource-types.js} +9 -0
  71. package/dist/esm/types/sync/resources/calendars.js +24 -0
  72. package/dist/esm/types/sync/resources/collaborators.js +20 -0
  73. package/dist/esm/types/sync/resources/completed-info.js +27 -0
  74. package/dist/esm/types/sync/resources/filters.js +13 -0
  75. package/dist/esm/types/sync/resources/folders.js +11 -0
  76. package/dist/esm/types/sync/resources/index.js +17 -0
  77. package/dist/esm/types/sync/resources/live-notifications.js +25 -0
  78. package/dist/esm/types/sync/resources/notes.js +20 -0
  79. package/dist/esm/types/sync/resources/reminders.js +31 -0
  80. package/dist/esm/types/sync/resources/suggestions.js +35 -0
  81. package/dist/esm/types/sync/resources/tooltips.js +7 -0
  82. package/dist/esm/types/sync/resources/user-plan-limits.js +21 -0
  83. package/dist/esm/types/sync/resources/user-settings.js +39 -0
  84. package/dist/esm/types/sync/resources/user.js +120 -0
  85. package/dist/esm/types/sync/resources/view-options.js +72 -0
  86. package/dist/esm/types/sync/resources/workspace-filters.js +18 -0
  87. package/dist/esm/types/sync/resources/workspace-goals.js +29 -0
  88. package/dist/esm/types/sync/resources/workspaces.js +46 -0
  89. package/dist/esm/types/sync/response.js +1 -0
  90. package/dist/esm/utils/index.js +1 -0
  91. package/dist/esm/utils/sync-helpers.js +19 -0
  92. package/dist/esm/utils/validators.js +65 -64
  93. package/dist/types/todoist-api.d.ts +26 -0
  94. package/dist/types/types/index.d.ts +1 -0
  95. package/dist/types/types/sync/commands/calendars.d.ts +14 -0
  96. package/dist/types/types/sync/commands/filters.d.ts +21 -0
  97. package/dist/types/types/sync/commands/folders.d.ts +18 -0
  98. package/dist/types/types/sync/commands/index.d.ts +175 -0
  99. package/dist/types/types/sync/commands/labels.d.ts +27 -0
  100. package/dist/types/types/sync/commands/notes.d.ts +27 -0
  101. package/dist/types/types/sync/commands/notifications.d.ts +10 -0
  102. package/dist/types/types/sync/commands/others.d.ts +28 -0
  103. package/dist/types/types/sync/commands/project-view-options.d.ts +14 -0
  104. package/dist/types/types/sync/commands/projects.d.ts +88 -0
  105. package/dist/types/types/sync/commands/reminders.d.ts +40 -0
  106. package/dist/types/types/sync/commands/sections.d.ts +31 -0
  107. package/dist/types/types/sync/commands/shared.d.ts +46 -0
  108. package/dist/types/types/sync/commands/sharing.d.ts +16 -0
  109. package/dist/types/types/sync/commands/tasks.d.ts +78 -0
  110. package/dist/types/types/sync/commands/view-options.d.ts +19 -0
  111. package/dist/types/types/sync/commands/workspace-filters.d.ts +22 -0
  112. package/dist/types/types/sync/commands/workspace-goals.d.ts +24 -0
  113. package/dist/types/types/sync/commands/workspaces.d.ts +79 -0
  114. package/dist/types/types/sync/index.d.ts +5 -0
  115. package/dist/types/types/sync/request.d.ts +7 -0
  116. package/dist/types/types/sync/resource-types.d.ts +5 -0
  117. package/dist/types/types/sync/resources/calendars.d.ts +30 -0
  118. package/dist/types/types/sync/resources/collaborators.d.ts +24 -0
  119. package/dist/types/types/sync/resources/completed-info.d.ts +33 -0
  120. package/dist/types/types/sync/resources/filters.d.ts +12 -0
  121. package/dist/types/types/sync/resources/folders.d.ts +10 -0
  122. package/dist/types/types/sync/resources/index.d.ts +17 -0
  123. package/dist/types/types/sync/resources/live-notifications.d.ts +23 -0
  124. package/dist/types/types/sync/resources/notes.d.ts +34 -0
  125. package/dist/types/types/sync/resources/reminders.d.ts +101 -0
  126. package/dist/types/types/sync/resources/suggestions.d.ts +54 -0
  127. package/dist/types/types/sync/resources/tooltips.d.ts +6 -0
  128. package/dist/types/types/sync/resources/user-plan-limits.d.ts +41 -0
  129. package/dist/types/types/sync/resources/user-settings.d.ts +32 -0
  130. package/dist/types/types/sync/resources/user.d.ts +104 -0
  131. package/dist/types/types/sync/resources/view-options.d.ts +94 -0
  132. package/dist/types/types/sync/resources/workspace-filters.d.ts +17 -0
  133. package/dist/types/types/sync/resources/workspace-goals.d.ts +29 -0
  134. package/dist/types/types/sync/resources/workspaces.d.ts +52 -0
  135. package/dist/types/types/sync/response.d.ts +47 -0
  136. package/dist/types/utils/index.d.ts +1 -0
  137. package/dist/types/utils/sync-helpers.d.ts +17 -0
  138. package/dist/types/utils/validators.d.ts +1163 -23
  139. package/package.json +1 -1
  140. package/dist/types/types/sync.d.ts +0 -30
@@ -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,5 @@
1
+ export * from './commands/index.js';
2
+ export * from './resources/index.js';
3
+ export * from './resource-types.js';
4
+ export * from './request.js';
5
+ export * from './response.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -6,6 +6,7 @@ export const SYNC_RESOURCE_TYPES = [
6
6
  'projects',
7
7
  'items',
8
8
  'notes',
9
+ 'project_notes',
9
10
  'sections',
10
11
  'filters',
11
12
  'reminders',
@@ -14,6 +15,7 @@ export const SYNC_RESOURCE_TYPES = [
14
15
  'user',
15
16
  'live_notifications',
16
17
  'collaborators',
18
+ 'collaborator_states',
17
19
  'user_settings',
18
20
  'notification_settings',
19
21
  'user_plan_limits',
@@ -25,4 +27,11 @@ export const SYNC_RESOURCE_TYPES = [
25
27
  'view_options',
26
28
  'project_view_options_defaults',
27
29
  'role_actions',
30
+ 'folders',
31
+ 'workspace_goals',
32
+ 'day_orders',
33
+ 'calendars',
34
+ 'calendar_accounts',
35
+ 'suggestions',
36
+ 'tooltips',
28
37
  ];
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ export const CalendarSchema = z
3
+ .object({
4
+ id: z.string(),
5
+ summary: z.string(),
6
+ color: z.string().nullable(),
7
+ accountId: z.string(),
8
+ isVisible: z.boolean(),
9
+ isTaskCalendar: z.boolean().optional(),
10
+ })
11
+ .passthrough();
12
+ export const CalendarAccountSchema = z
13
+ .object({
14
+ id: z.string(),
15
+ name: z.string(),
16
+ type: z.enum(['google', 'microsoft', 'apple']),
17
+ isDeleted: z.boolean().optional(),
18
+ isEventsEnabled: z.boolean().optional(),
19
+ isTasksEnabled: z.boolean().optional(),
20
+ isAllDayTasksEnabled: z.boolean().optional(),
21
+ pendingOperationUntil: z.string().nullable().optional(),
22
+ calendarsSyncState: z.enum(['synced', 'syncing', 'error']).optional(),
23
+ })
24
+ .passthrough();
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { WorkspaceRoleSchema } from '../../entities.js';
3
+ export const CollaboratorSchema = z
4
+ .object({
5
+ id: z.string(),
6
+ email: z.string(),
7
+ fullName: z.string(),
8
+ timezone: z.string(),
9
+ imageId: z.string().nullable(),
10
+ })
11
+ .passthrough();
12
+ export const CollaboratorStateSchema = z
13
+ .object({
14
+ userId: z.string(),
15
+ projectId: z.string(),
16
+ state: z.enum(['active', 'invited']),
17
+ isDeleted: z.boolean(),
18
+ workspaceRole: WorkspaceRoleSchema.optional(),
19
+ })
20
+ .passthrough();
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+ export const CompletedProjectMetadataSchema = z
3
+ .object({
4
+ projectId: z.string(),
5
+ archivedSections: z.number().int(),
6
+ completedItems: z.number().int(),
7
+ })
8
+ .passthrough();
9
+ export const CompletedSectionMetadataSchema = z
10
+ .object({
11
+ sectionId: z.string(),
12
+ id: z.string(),
13
+ completedItems: z.number().int(),
14
+ })
15
+ .passthrough();
16
+ export const CompletedTaskMetadataSchema = z
17
+ .object({
18
+ itemId: z.string(),
19
+ id: z.string().optional(),
20
+ completedItems: z.number().int(),
21
+ })
22
+ .passthrough();
23
+ export const CompletedInfoSchema = z.union([
24
+ CompletedProjectMetadataSchema,
25
+ CompletedSectionMetadataSchema,
26
+ CompletedTaskMetadataSchema,
27
+ ]);
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ export const FilterSchema = z
3
+ .object({
4
+ id: z.string(),
5
+ name: z.string(),
6
+ query: z.string(),
7
+ color: z.string(),
8
+ isDeleted: z.boolean(),
9
+ isFavorite: z.boolean(),
10
+ isFrozen: z.boolean(),
11
+ itemOrder: z.number().int(),
12
+ })
13
+ .passthrough();
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ export const FolderSchema = z
3
+ .object({
4
+ id: z.string(),
5
+ name: z.string(),
6
+ workspaceId: z.string(),
7
+ isDeleted: z.boolean(),
8
+ defaultOrder: z.number().int(),
9
+ childOrder: z.number().int(),
10
+ })
11
+ .passthrough();
@@ -0,0 +1,17 @@
1
+ export * from './filters.js';
2
+ export * from './collaborators.js';
3
+ export * from './folders.js';
4
+ export * from './tooltips.js';
5
+ export * from './notes.js';
6
+ export * from './workspace-filters.js';
7
+ export * from './workspace-goals.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 './suggestions.js';
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Live notification resource from the Sync API.
4
+ *
5
+ * Uses a base schema with commonly-present fields plus `.passthrough()` for
6
+ * forward compatibility. The Sync API returns 20+ notification variants;
7
+ * fully typing each is too fragile for a library, so we validate the common
8
+ * shape and preserve all extra fields.
9
+ */
10
+ export const LiveNotificationSchema = z
11
+ .object({
12
+ id: z.string(),
13
+ createdAt: z.string(),
14
+ fromUid: z.string(),
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().optional(),
23
+ assignedByUid: z.string().optional(),
24
+ })
25
+ .passthrough();
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { AttachmentSchema } from '../../entities.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,31 @@
1
+ import { z } from 'zod';
2
+ import { DueDateSchema } from '../../entities.js';
3
+ 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
+ export const LocationReminderSchema = ReminderBaseSchema.extend({
11
+ type: z.literal('location'),
12
+ name: z.string(),
13
+ locLat: z.string(),
14
+ locLong: z.string(),
15
+ locTrigger: z.enum(['on_enter', 'on_leave']),
16
+ radius: z.number().int(),
17
+ }).passthrough();
18
+ export const AbsoluteReminderSchema = ReminderBaseSchema.extend({
19
+ type: z.literal('absolute'),
20
+ due: DueDateSchema,
21
+ }).passthrough();
22
+ export const RelativeReminderSchema = ReminderBaseSchema.extend({
23
+ type: z.literal('relative'),
24
+ minuteOffset: z.number().int(),
25
+ due: DueDateSchema.optional(),
26
+ }).passthrough();
27
+ export const ReminderSchema = z.discriminatedUnion('type', [
28
+ LocationReminderSchema,
29
+ AbsoluteReminderSchema,
30
+ RelativeReminderSchema,
31
+ ]);
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+ export const TemplateSuggestionSchema = z
3
+ .object({
4
+ id: z.string(),
5
+ name: z.string(),
6
+ templateType: z.enum(['project', 'setup']),
7
+ })
8
+ .passthrough();
9
+ export const WorkspaceTemplateSuggestionSchema = TemplateSuggestionSchema.extend({
10
+ workspaceId: z.string().nullable(),
11
+ });
12
+ const SyncTemplateSuggestionsSchema = z
13
+ .object({
14
+ type: z.enum(['templates', 'most_used_user_templates']),
15
+ content: z.object({
16
+ templates: z.array(TemplateSuggestionSchema),
17
+ locale: z.string(),
18
+ }),
19
+ isDeleted: z.boolean(),
20
+ })
21
+ .passthrough();
22
+ const SyncWorkspaceTemplateSuggestionsSchema = z
23
+ .object({
24
+ type: z.literal('most_used_workspace_templates'),
25
+ content: z.object({
26
+ templates: z.array(WorkspaceTemplateSuggestionSchema),
27
+ locale: z.string(),
28
+ }),
29
+ isDeleted: z.boolean(),
30
+ })
31
+ .passthrough();
32
+ export const SuggestionSchema = z.union([
33
+ SyncWorkspaceTemplateSuggestionsSchema,
34
+ SyncTemplateSuggestionsSchema,
35
+ ]);
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ export const TooltipsSchema = z
3
+ .object({
4
+ seen: z.array(z.string()).optional(),
5
+ scheduled: z.array(z.string()).optional(),
6
+ })
7
+ .passthrough();
@@ -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
+ const NavigationFeatureSchema = z.object({
3
+ name: z.string(),
4
+ shown: z.boolean(),
5
+ });
6
+ 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,120 @@
1
+ import { z } from 'zod';
2
+ const FeaturesSchema = z
3
+ .object({
4
+ karmaDisabled: z.boolean(),
5
+ restriction: z.number().int(),
6
+ karmaVacation: z.boolean(),
7
+ dateistLang: z.any(),
8
+ beta: z.union([z.literal(0), z.literal(1)]),
9
+ hasPushReminders: z.boolean(),
10
+ dateistInlineDisabled: z.boolean(),
11
+ autoInviteDisabled: z.boolean().optional(),
12
+ goldTheme: z.boolean().optional(),
13
+ migratedFromTdb: z.boolean().optional(),
14
+ })
15
+ .passthrough();
16
+ const TzInfoSchema = z
17
+ .object({
18
+ timezone: z.string(),
19
+ hours: z.number().int(),
20
+ minutes: z.number().int(),
21
+ isDst: z.union([z.literal(0), z.literal(1)]),
22
+ gmtString: z.string(),
23
+ })
24
+ .passthrough();
25
+ const JoinableWorkspaceSchema = z
26
+ .object({
27
+ workspaceId: z.string(),
28
+ workspaceName: z.string(),
29
+ memberCount: z.number().int(),
30
+ })
31
+ .passthrough();
32
+ const GettingStartedGuideProjectSchema = z
33
+ .object({
34
+ onboardingUseCase: z.string(),
35
+ projectId: z.string(),
36
+ completed: z.boolean(),
37
+ closed: z.boolean(),
38
+ })
39
+ .passthrough();
40
+ /**
41
+ * Sync API user resource.
42
+ *
43
+ * This is a superset of the REST `CurrentUserSchema` — the Sync API returns
44
+ * many additional fields for features, onboarding state, and account details.
45
+ */
46
+ export const SyncUserSchema = z
47
+ .object({
48
+ id: z.string(),
49
+ email: z.string(),
50
+ fullName: z.string(),
51
+ activatedUser: z.boolean(),
52
+ autoReminder: z.number().int(),
53
+ avatarBig: z.string().optional(),
54
+ avatarMedium: z.string().optional(),
55
+ avatarS640: z.string().optional(),
56
+ avatarSmall: z.string().optional(),
57
+ businessAccountId: z.string().nullable(),
58
+ dailyGoal: z.number().int(),
59
+ dateFormat: z.number().int(),
60
+ dateistLang: z.string().nullable(),
61
+ daysOff: z.array(z.number().int()),
62
+ featureIdentifier: z.string(),
63
+ features: FeaturesSchema,
64
+ freeTrailExpires: z.string().optional(),
65
+ hasMagicNumber: z.boolean(),
66
+ hasPassword: z.boolean(),
67
+ hasStartedATrial: z.boolean().optional(),
68
+ imageId: z.string().nullable(),
69
+ inboxProjectId: z.string(),
70
+ isCelebrationsEnabled: z.boolean(),
71
+ isPremium: z.boolean(),
72
+ joinableWorkspace: JoinableWorkspaceSchema.nullable(),
73
+ joinedAt: z.string(),
74
+ gettingStartedGuideProjects: z.array(GettingStartedGuideProjectSchema).nullable(),
75
+ karma: z.number(),
76
+ karmaTrend: z.string(),
77
+ lang: z.string(),
78
+ mfaEnabled: z.boolean().optional(),
79
+ mobileHost: z.string().nullable(),
80
+ mobileNumber: z.string().nullable(),
81
+ nextWeek: z.number().int(),
82
+ onboardingLevel: z.string().nullable().optional(),
83
+ onboardingRole: z.string().nullable().optional(),
84
+ onboardingPersona: z.string().nullable().optional(),
85
+ onboardingInitiated: z.boolean().nullable().optional(),
86
+ onboardingCompleted: z.boolean().nullable().optional(),
87
+ onboardingSkipped: z.boolean().optional(),
88
+ onboardingTeamMode: z.boolean().nullable().optional(),
89
+ onboardingUseCases: z.array(z.string()).nullable().optional(),
90
+ premiumStatus: z.enum([
91
+ 'not_premium',
92
+ 'current_personal_plan',
93
+ 'legacy_personal_plan',
94
+ 'teams_business_member',
95
+ ]),
96
+ premiumUntil: z.string().nullable(),
97
+ rambleSessionsUsage: z
98
+ .object({
99
+ currentCount: z.number().int(),
100
+ limit: z.number().int(),
101
+ remaining: z.number().int(),
102
+ resetDate: z.string(),
103
+ })
104
+ .nullable()
105
+ .optional(),
106
+ shareLimit: z.number().int(),
107
+ sortOrder: z.number().int(),
108
+ startDay: z.number().int(),
109
+ startPage: z.string(),
110
+ themeId: z.string(),
111
+ timeFormat: z.number().int(),
112
+ token: z.string(),
113
+ tzInfo: TzInfoSchema,
114
+ uniquePrefix: z.number().int(),
115
+ verificationStatus: z.string(),
116
+ websocketUrl: z.string(),
117
+ weekendStartDay: z.number().int(),
118
+ weeklyGoal: z.number().int(),
119
+ })
120
+ .passthrough();
@@ -0,0 +1,72 @@
1
+ import { z } from 'zod';
2
+ const ViewTypeSchema = z.enum([
3
+ 'TODAY',
4
+ 'UPCOMING',
5
+ 'PROJECT',
6
+ 'LABEL',
7
+ 'FILTER',
8
+ 'WORKSPACE_FILTER',
9
+ 'SEARCH',
10
+ 'TEMPLATE_PREVIEW',
11
+ 'TASK_DETAIL',
12
+ 'AUTOMATION',
13
+ 'ASSIGNED',
14
+ 'OVERDUE',
15
+ 'WORKSPACE_OVERVIEW',
16
+ ]);
17
+ const ViewModeSchema = z.enum(['LIST', 'BOARD', 'CALENDAR']);
18
+ const GroupedBySchema = z
19
+ .enum([
20
+ 'ASSIGNEE',
21
+ 'ADDED_DATE',
22
+ 'DUE_DATE',
23
+ 'DEADLINE',
24
+ 'LABEL',
25
+ 'PRIORITY',
26
+ 'PROJECT',
27
+ 'WORKSPACE',
28
+ ])
29
+ .nullable();
30
+ const SortedBySchema = z
31
+ .enum([
32
+ 'MANUAL',
33
+ 'ALPHABETICALLY',
34
+ 'ASSIGNEE',
35
+ 'DUE_DATE',
36
+ 'DEADLINE',
37
+ 'ADDED_DATE',
38
+ 'PRIORITY',
39
+ 'PROJECT',
40
+ 'WORKSPACE',
41
+ ])
42
+ .nullable();
43
+ const SortOrderSchema = z.enum(['ASC', 'DESC']).nullable();
44
+ const CalendarSettingsSchema = z
45
+ .object({
46
+ layout: z.enum(['WEEK', 'MONTH']).optional(),
47
+ })
48
+ .passthrough();
49
+ export const ViewOptionsSchema = z
50
+ .object({
51
+ viewType: ViewTypeSchema,
52
+ objectId: z.string().optional(),
53
+ groupedBy: GroupedBySchema.optional(),
54
+ filteredBy: z.string().nullable().optional(),
55
+ viewMode: ViewModeSchema.optional(),
56
+ showCompletedTasks: z.boolean().optional(),
57
+ sortedBy: SortedBySchema.optional(),
58
+ sortOrder: SortOrderSchema.optional(),
59
+ })
60
+ .passthrough();
61
+ export const ProjectViewOptionsDefaultsSchema = z
62
+ .object({
63
+ projectId: z.string(),
64
+ viewMode: ViewModeSchema.nullable().optional(),
65
+ groupedBy: GroupedBySchema.optional(),
66
+ sortedBy: SortedBySchema.optional(),
67
+ sortOrder: SortOrderSchema.optional(),
68
+ showCompletedTasks: z.boolean().optional(),
69
+ filteredBy: z.string().nullable().optional(),
70
+ calendarSettings: CalendarSettingsSchema.nullable().optional(),
71
+ })
72
+ .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,46 @@
1
+ import { z } from 'zod';
2
+ import { WorkspaceRoleSchema, WorkspacePlanSchema, WorkspaceLimitsSchema, WorkspacePropertiesSchema, } from '../../entities.js';
3
+ /**
4
+ * Sync API workspace resource.
5
+ *
6
+ * This is a superset of the REST `WorkspaceSchema` — the Sync API returns
7
+ * additional fields like description, isDeleted, isCollapsed, member counts,
8
+ * domain settings, and sorting preferences.
9
+ */
10
+ export const SyncWorkspaceSchema = z
11
+ .object({
12
+ id: z.string(),
13
+ name: z.string(),
14
+ description: z.string(),
15
+ logoBig: z.string().optional(),
16
+ logoMedium: z.string().optional(),
17
+ logoSmall: z.string().optional(),
18
+ logoS640: z.string().optional(),
19
+ creatorId: z.string(),
20
+ createdAt: z.string(),
21
+ isDeleted: z.boolean(),
22
+ isCollapsed: z.boolean(),
23
+ role: WorkspaceRoleSchema,
24
+ plan: WorkspacePlanSchema,
25
+ limits: WorkspaceLimitsSchema,
26
+ inviteCode: z.string().nullable().optional(),
27
+ isLinkSharingEnabled: z.boolean().nullable().optional(),
28
+ isGuestAllowed: z.boolean().nullable().optional(),
29
+ currentActiveProjects: z.number().nullable(),
30
+ currentMemberCount: z.number().nullable(),
31
+ currentTemplateCount: z.number().nullable(),
32
+ pendingInvitations: z.array(z.string()).nullable().optional(),
33
+ domainName: z.string().optional(),
34
+ domainDiscovery: z.boolean().optional(),
35
+ restrictEmailDomains: z.boolean().optional(),
36
+ adminSortingApplied: z.boolean(),
37
+ projectSortPreference: z.string().optional(),
38
+ defaultCollaborators: z
39
+ .object({
40
+ predefinedGroupIds: z.array(z.string()),
41
+ userIds: z.array(z.number()),
42
+ })
43
+ .optional(),
44
+ properties: WorkspacePropertiesSchema.optional(),
45
+ })
46
+ .passthrough();
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
1
  export * from './colors.js';
2
2
  export * from './sanitization.js';
3
3
  export { getTaskUrl, getProjectUrl, getSectionUrl } from './url-helpers.js';
4
+ export { createCommand } from './sync-helpers.js';
@@ -0,0 +1,19 @@
1
+ import { v4 as uuidv4 } from 'uuid';
2
+ /**
3
+ * Creates a strongly-typed Sync API command with an auto-generated UUID.
4
+ *
5
+ * @param type - The command type (e.g. `'item_add'`, `'project_update'`).
6
+ * @param args - The command arguments, constrained by the command type.
7
+ * @param tempId - Optional temporary ID for referencing the created resource in subsequent commands.
8
+ * @returns A fully formed `SyncCommand` ready to include in a sync request.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const cmd = createCommand('item_add', { content: 'Buy milk', priority: 2 })
13
+ * // cmd.type === 'item_add'
14
+ * // cmd.args is typed as TaskAddArgs
15
+ * ```
16
+ */
17
+ export function createCommand(type, args, tempId) {
18
+ return Object.assign({ type, uuid: uuidv4(), args: args }, (tempId !== undefined ? { tempId } : {}));
19
+ }