@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,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SyncUserSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const FeaturesSchema = zod_1.z
6
+ .object({
7
+ karmaDisabled: zod_1.z.boolean(),
8
+ restriction: zod_1.z.number().int(),
9
+ karmaVacation: zod_1.z.boolean(),
10
+ dateistLang: zod_1.z.any(),
11
+ beta: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
12
+ hasPushReminders: zod_1.z.boolean(),
13
+ dateistInlineDisabled: zod_1.z.boolean(),
14
+ autoInviteDisabled: zod_1.z.boolean().optional(),
15
+ goldTheme: zod_1.z.boolean().optional(),
16
+ migratedFromTdb: zod_1.z.boolean().optional(),
17
+ })
18
+ .passthrough();
19
+ const TzInfoSchema = zod_1.z
20
+ .object({
21
+ timezone: zod_1.z.string(),
22
+ hours: zod_1.z.number().int(),
23
+ minutes: zod_1.z.number().int(),
24
+ isDst: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
25
+ gmtString: zod_1.z.string(),
26
+ })
27
+ .passthrough();
28
+ const JoinableWorkspaceSchema = zod_1.z
29
+ .object({
30
+ workspaceId: zod_1.z.string(),
31
+ workspaceName: zod_1.z.string(),
32
+ memberCount: zod_1.z.number().int(),
33
+ })
34
+ .passthrough();
35
+ const GettingStartedGuideProjectSchema = zod_1.z
36
+ .object({
37
+ onboardingUseCase: zod_1.z.string(),
38
+ projectId: zod_1.z.string(),
39
+ completed: zod_1.z.boolean(),
40
+ closed: zod_1.z.boolean(),
41
+ })
42
+ .passthrough();
43
+ /**
44
+ * Sync API user resource.
45
+ *
46
+ * This is a superset of the REST `CurrentUserSchema` — the Sync API returns
47
+ * many additional fields for features, onboarding state, and account details.
48
+ */
49
+ exports.SyncUserSchema = zod_1.z
50
+ .object({
51
+ id: zod_1.z.string(),
52
+ email: zod_1.z.string(),
53
+ fullName: zod_1.z.string(),
54
+ activatedUser: zod_1.z.boolean(),
55
+ autoReminder: zod_1.z.number().int(),
56
+ avatarBig: zod_1.z.string().optional(),
57
+ avatarMedium: zod_1.z.string().optional(),
58
+ avatarS640: zod_1.z.string().optional(),
59
+ avatarSmall: zod_1.z.string().optional(),
60
+ businessAccountId: zod_1.z.string().nullable(),
61
+ dailyGoal: zod_1.z.number().int(),
62
+ dateFormat: zod_1.z.number().int(),
63
+ dateistLang: zod_1.z.string().nullable(),
64
+ daysOff: zod_1.z.array(zod_1.z.number().int()),
65
+ featureIdentifier: zod_1.z.string(),
66
+ features: FeaturesSchema,
67
+ freeTrailExpires: zod_1.z.string().optional(),
68
+ hasMagicNumber: zod_1.z.boolean(),
69
+ hasPassword: zod_1.z.boolean(),
70
+ hasStartedATrial: zod_1.z.boolean().optional(),
71
+ imageId: zod_1.z.string().nullable(),
72
+ inboxProjectId: zod_1.z.string(),
73
+ isCelebrationsEnabled: zod_1.z.boolean(),
74
+ isPremium: zod_1.z.boolean(),
75
+ joinableWorkspace: JoinableWorkspaceSchema.nullable(),
76
+ joinedAt: zod_1.z.string(),
77
+ gettingStartedGuideProjects: zod_1.z.array(GettingStartedGuideProjectSchema).nullable(),
78
+ karma: zod_1.z.number(),
79
+ karmaTrend: zod_1.z.string(),
80
+ lang: zod_1.z.string(),
81
+ mfaEnabled: zod_1.z.boolean().optional(),
82
+ mobileHost: zod_1.z.string().nullable(),
83
+ mobileNumber: zod_1.z.string().nullable(),
84
+ nextWeek: zod_1.z.number().int(),
85
+ onboardingLevel: zod_1.z.string().nullable().optional(),
86
+ onboardingRole: zod_1.z.string().nullable().optional(),
87
+ onboardingPersona: zod_1.z.string().nullable().optional(),
88
+ onboardingInitiated: zod_1.z.boolean().nullable().optional(),
89
+ onboardingCompleted: zod_1.z.boolean().nullable().optional(),
90
+ onboardingSkipped: zod_1.z.boolean().optional(),
91
+ onboardingTeamMode: zod_1.z.boolean().nullable().optional(),
92
+ onboardingUseCases: zod_1.z.array(zod_1.z.string()).nullable().optional(),
93
+ premiumStatus: zod_1.z.enum([
94
+ 'not_premium',
95
+ 'current_personal_plan',
96
+ 'legacy_personal_plan',
97
+ 'teams_business_member',
98
+ ]),
99
+ premiumUntil: zod_1.z.string().nullable(),
100
+ rambleSessionsUsage: zod_1.z
101
+ .object({
102
+ currentCount: zod_1.z.number().int(),
103
+ limit: zod_1.z.number().int(),
104
+ remaining: zod_1.z.number().int(),
105
+ resetDate: zod_1.z.string(),
106
+ })
107
+ .nullable()
108
+ .optional(),
109
+ shareLimit: zod_1.z.number().int(),
110
+ sortOrder: zod_1.z.number().int(),
111
+ startDay: zod_1.z.number().int(),
112
+ startPage: zod_1.z.string(),
113
+ themeId: zod_1.z.string(),
114
+ timeFormat: zod_1.z.number().int(),
115
+ token: zod_1.z.string(),
116
+ tzInfo: TzInfoSchema,
117
+ uniquePrefix: zod_1.z.number().int(),
118
+ verificationStatus: zod_1.z.string(),
119
+ websocketUrl: zod_1.z.string(),
120
+ weekendStartDay: zod_1.z.number().int(),
121
+ weeklyGoal: zod_1.z.number().int(),
122
+ })
123
+ .passthrough();
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProjectViewOptionsDefaultsSchema = exports.ViewOptionsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const ViewTypeSchema = zod_1.z.enum([
6
+ 'TODAY',
7
+ 'UPCOMING',
8
+ 'PROJECT',
9
+ 'LABEL',
10
+ 'FILTER',
11
+ 'WORKSPACE_FILTER',
12
+ 'SEARCH',
13
+ 'TEMPLATE_PREVIEW',
14
+ 'TASK_DETAIL',
15
+ 'AUTOMATION',
16
+ 'ASSIGNED',
17
+ 'OVERDUE',
18
+ 'WORKSPACE_OVERVIEW',
19
+ ]);
20
+ const ViewModeSchema = zod_1.z.enum(['LIST', 'BOARD', 'CALENDAR']);
21
+ const GroupedBySchema = zod_1.z
22
+ .enum([
23
+ 'ASSIGNEE',
24
+ 'ADDED_DATE',
25
+ 'DUE_DATE',
26
+ 'DEADLINE',
27
+ 'LABEL',
28
+ 'PRIORITY',
29
+ 'PROJECT',
30
+ 'WORKSPACE',
31
+ ])
32
+ .nullable();
33
+ const SortedBySchema = zod_1.z
34
+ .enum([
35
+ 'MANUAL',
36
+ 'ALPHABETICALLY',
37
+ 'ASSIGNEE',
38
+ 'DUE_DATE',
39
+ 'DEADLINE',
40
+ 'ADDED_DATE',
41
+ 'PRIORITY',
42
+ 'PROJECT',
43
+ 'WORKSPACE',
44
+ ])
45
+ .nullable();
46
+ const SortOrderSchema = zod_1.z.enum(['ASC', 'DESC']).nullable();
47
+ const CalendarSettingsSchema = zod_1.z
48
+ .object({
49
+ layout: zod_1.z.enum(['WEEK', 'MONTH']).optional(),
50
+ })
51
+ .passthrough();
52
+ exports.ViewOptionsSchema = zod_1.z
53
+ .object({
54
+ viewType: ViewTypeSchema,
55
+ objectId: zod_1.z.string().optional(),
56
+ groupedBy: GroupedBySchema.optional(),
57
+ filteredBy: zod_1.z.string().nullable().optional(),
58
+ viewMode: ViewModeSchema.optional(),
59
+ showCompletedTasks: zod_1.z.boolean().optional(),
60
+ sortedBy: SortedBySchema.optional(),
61
+ sortOrder: SortOrderSchema.optional(),
62
+ })
63
+ .passthrough();
64
+ exports.ProjectViewOptionsDefaultsSchema = zod_1.z
65
+ .object({
66
+ projectId: zod_1.z.string(),
67
+ viewMode: ViewModeSchema.nullable().optional(),
68
+ groupedBy: GroupedBySchema.optional(),
69
+ sortedBy: SortedBySchema.optional(),
70
+ sortOrder: SortOrderSchema.optional(),
71
+ showCompletedTasks: zod_1.z.boolean().optional(),
72
+ filteredBy: zod_1.z.string().nullable().optional(),
73
+ calendarSettings: CalendarSettingsSchema.nullable().optional(),
74
+ })
75
+ .passthrough();
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WorkspaceFilterSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.WorkspaceFilterSchema = zod_1.z
6
+ .object({
7
+ id: zod_1.z.string(),
8
+ workspaceId: zod_1.z.string(),
9
+ name: zod_1.z.string(),
10
+ query: zod_1.z.string(),
11
+ color: zod_1.z.string(),
12
+ itemOrder: zod_1.z.number().int(),
13
+ isDeleted: zod_1.z.boolean(),
14
+ isFavorite: zod_1.z.boolean(),
15
+ isFrozen: zod_1.z.boolean(),
16
+ creatorUid: zod_1.z.string(),
17
+ updaterUid: zod_1.z.string(),
18
+ createdAt: zod_1.z.string(),
19
+ updatedAt: zod_1.z.string(),
20
+ })
21
+ .passthrough();
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WorkspaceGoalSchema = exports.WorkspaceGoalProgressSchema = exports.WorkspaceGoalMilestoneSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.WorkspaceGoalMilestoneSchema = zod_1.z
6
+ .object({
7
+ id: zod_1.z.string(),
8
+ title: zod_1.z.string(),
9
+ isCompleted: zod_1.z.boolean(),
10
+ })
11
+ .passthrough();
12
+ exports.WorkspaceGoalProgressSchema = zod_1.z
13
+ .object({
14
+ completedItems: zod_1.z.number().int(),
15
+ totalItems: zod_1.z.number().int(),
16
+ })
17
+ .passthrough();
18
+ exports.WorkspaceGoalSchema = zod_1.z
19
+ .object({
20
+ id: zod_1.z.string(),
21
+ workspaceId: zod_1.z.string(),
22
+ title: zod_1.z.string(),
23
+ description: zod_1.z.string().nullable(),
24
+ deadline: zod_1.z.string().nullable(),
25
+ isDeleted: zod_1.z.boolean(),
26
+ projectIds: zod_1.z.array(zod_1.z.string()),
27
+ progress: exports.WorkspaceGoalProgressSchema.nullable(),
28
+ creatorUid: zod_1.z.string(),
29
+ createdAt: zod_1.z.string(),
30
+ updatedAt: zod_1.z.string(),
31
+ })
32
+ .passthrough();
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SyncWorkspaceSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const entities_1 = require("../../entities");
6
+ /**
7
+ * Sync API workspace resource.
8
+ *
9
+ * This is a superset of the REST `WorkspaceSchema` — the Sync API returns
10
+ * additional fields like description, isDeleted, isCollapsed, member counts,
11
+ * domain settings, and sorting preferences.
12
+ */
13
+ exports.SyncWorkspaceSchema = zod_1.z
14
+ .object({
15
+ id: zod_1.z.string(),
16
+ name: zod_1.z.string(),
17
+ description: zod_1.z.string(),
18
+ logoBig: zod_1.z.string().optional(),
19
+ logoMedium: zod_1.z.string().optional(),
20
+ logoSmall: zod_1.z.string().optional(),
21
+ logoS640: zod_1.z.string().optional(),
22
+ creatorId: zod_1.z.string(),
23
+ createdAt: zod_1.z.string(),
24
+ isDeleted: zod_1.z.boolean(),
25
+ isCollapsed: zod_1.z.boolean(),
26
+ role: entities_1.WorkspaceRoleSchema,
27
+ plan: entities_1.WorkspacePlanSchema,
28
+ limits: entities_1.WorkspaceLimitsSchema,
29
+ inviteCode: zod_1.z.string().nullable().optional(),
30
+ isLinkSharingEnabled: zod_1.z.boolean().nullable().optional(),
31
+ isGuestAllowed: zod_1.z.boolean().nullable().optional(),
32
+ currentActiveProjects: zod_1.z.number().nullable(),
33
+ currentMemberCount: zod_1.z.number().nullable(),
34
+ currentTemplateCount: zod_1.z.number().nullable(),
35
+ pendingInvitations: zod_1.z.array(zod_1.z.string()).nullable().optional(),
36
+ domainName: zod_1.z.string().optional(),
37
+ domainDiscovery: zod_1.z.boolean().optional(),
38
+ restrictEmailDomains: zod_1.z.boolean().optional(),
39
+ adminSortingApplied: zod_1.z.boolean(),
40
+ projectSortPreference: zod_1.z.string().optional(),
41
+ defaultCollaborators: zod_1.z
42
+ .object({
43
+ predefinedGroupIds: zod_1.z.array(zod_1.z.string()),
44
+ userIds: zod_1.z.array(zod_1.z.number()),
45
+ })
46
+ .optional(),
47
+ properties: entities_1.WorkspacePropertiesSchema.optional(),
48
+ })
49
+ .passthrough();
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -14,10 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.getSectionUrl = exports.getProjectUrl = exports.getTaskUrl = void 0;
17
+ exports.createCommand = exports.getSectionUrl = exports.getProjectUrl = exports.getTaskUrl = void 0;
18
18
  __exportStar(require("./colors"), exports);
19
19
  __exportStar(require("./sanitization"), exports);
20
20
  var url_helpers_1 = require("./url-helpers");
21
21
  Object.defineProperty(exports, "getTaskUrl", { enumerable: true, get: function () { return url_helpers_1.getTaskUrl; } });
22
22
  Object.defineProperty(exports, "getProjectUrl", { enumerable: true, get: function () { return url_helpers_1.getProjectUrl; } });
23
23
  Object.defineProperty(exports, "getSectionUrl", { enumerable: true, get: function () { return url_helpers_1.getSectionUrl; } });
24
+ var sync_helpers_1 = require("./sync-helpers");
25
+ Object.defineProperty(exports, "createCommand", { enumerable: true, get: function () { return sync_helpers_1.createCommand; } });
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCommand = createCommand;
4
+ const uuid_1 = require("uuid");
5
+ /**
6
+ * Creates a strongly-typed Sync API command with an auto-generated UUID.
7
+ *
8
+ * @param type - The command type (e.g. `'item_add'`, `'project_update'`).
9
+ * @param args - The command arguments, constrained by the command type.
10
+ * @param tempId - Optional temporary ID for referencing the created resource in subsequent commands.
11
+ * @returns A fully formed `SyncCommand` ready to include in a sync request.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const cmd = createCommand('item_add', { content: 'Buy milk', priority: 2 })
16
+ * // cmd.type === 'item_add'
17
+ * // cmd.args is typed as TaskAddArgs
18
+ * ```
19
+ */
20
+ function createCommand(type, args, tempId) {
21
+ return Object.assign({ type, uuid: (0, uuid_1.v4)(), args: args }, (tempId !== undefined ? { tempId } : {}));
22
+ }
@@ -1,39 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateTask = validateTask;
4
- exports.validateTaskArray = validateTaskArray;
3
+ exports.validateUserPlanLimits = exports.validateProjectViewOptionsDefaultsArray = exports.validateProjectViewOptionsDefaults = exports.validateViewOptionsArray = exports.validateViewOptions = exports.validateCompletedInfoArray = exports.validateCompletedInfo = exports.validateReminderArray = exports.validateReminder = exports.validateCalendarAccountArray = exports.validateCalendarAccount = exports.validateCalendarArray = exports.validateCalendar = exports.validateWorkspaceGoalArray = exports.validateWorkspaceGoal = exports.validateWorkspaceFilterArray = exports.validateWorkspaceFilter = exports.validateTooltips = exports.validateNoteArray = exports.validateNote = exports.validateFolderArray = exports.validateFolder = exports.validateCollaboratorStateArray = exports.validateCollaboratorState = exports.validateCollaboratorArray = exports.validateCollaborator = exports.validateFilterArray = exports.validateFilter = exports.validateWorkspaceArray = exports.validateWorkspace = exports.validateJoinWorkspaceResult = exports.validateWorkspacePlanDetails = exports.validateWorkspaceInvitationArray = exports.validateWorkspaceInvitation = exports.validateWorkspaceUser = exports.validateAttachment = exports.validateActivityEventArray = exports.validateActivityEvent = exports.validateCurrentUser = exports.validateProductivityStats = exports.validateUserArray = exports.validateUser = exports.validateCommentArray = exports.validateComment = exports.validateLabelArray = exports.validateLabel = exports.validateSectionArray = exports.validateSection = exports.validateTaskArray = exports.validateTask = void 0;
4
+ exports.validateSuggestionArray = exports.validateSuggestion = exports.validateUserSettings = exports.validateSyncUser = exports.validateSyncWorkspaceArray = exports.validateSyncWorkspace = exports.validateLiveNotificationArray = exports.validateLiveNotification = void 0;
5
5
  exports.isWorkspaceProject = isWorkspaceProject;
6
6
  exports.isPersonalProject = isPersonalProject;
7
7
  exports.validateProject = validateProject;
8
8
  exports.validateProjectArray = validateProjectArray;
9
- exports.validateSection = validateSection;
10
- exports.validateSectionArray = validateSectionArray;
11
- exports.validateLabel = validateLabel;
12
- exports.validateLabelArray = validateLabelArray;
13
- exports.validateComment = validateComment;
14
- exports.validateCommentArray = validateCommentArray;
15
- exports.validateUser = validateUser;
16
- exports.validateUserArray = validateUserArray;
17
- exports.validateProductivityStats = validateProductivityStats;
18
- exports.validateCurrentUser = validateCurrentUser;
19
- exports.validateActivityEvent = validateActivityEvent;
20
- exports.validateActivityEventArray = validateActivityEventArray;
21
- exports.validateAttachment = validateAttachment;
22
- exports.validateWorkspaceUser = validateWorkspaceUser;
23
9
  exports.validateWorkspaceUserArray = validateWorkspaceUserArray;
24
- exports.validateWorkspaceInvitation = validateWorkspaceInvitation;
25
- exports.validateWorkspaceInvitationArray = validateWorkspaceInvitationArray;
26
- exports.validateWorkspacePlanDetails = validateWorkspacePlanDetails;
27
- exports.validateJoinWorkspaceResult = validateJoinWorkspaceResult;
28
- exports.validateWorkspace = validateWorkspace;
29
- exports.validateWorkspaceArray = validateWorkspaceArray;
30
10
  const entities_1 = require("../types/entities");
31
- function validateTask(input) {
32
- return entities_1.TaskSchema.parse(input);
11
+ const resources_1 = require("../types/sync/resources");
12
+ function createValidator(schema) {
13
+ return (input) => schema.parse(input);
33
14
  }
34
- function validateTaskArray(input) {
35
- return input.map(validateTask);
15
+ function createArrayValidator(validateItem) {
16
+ return (input) => input.map(validateItem);
36
17
  }
18
+ // Entity validators
19
+ exports.validateTask = createValidator(entities_1.TaskSchema);
20
+ exports.validateTaskArray = createArrayValidator(exports.validateTask);
37
21
  /**
38
22
  * Type guard to check if a project is a workspace project.
39
23
  * @param project The project to check
@@ -64,69 +48,66 @@ function validateProject(input) {
64
48
  function validateProjectArray(input) {
65
49
  return input.map(validateProject);
66
50
  }
67
- function validateSection(input) {
68
- return entities_1.SectionSchema.parse(input);
69
- }
70
- function validateSectionArray(input) {
71
- return input.map(validateSection);
72
- }
73
- function validateLabel(input) {
74
- return entities_1.LabelSchema.parse(input);
75
- }
76
- function validateLabelArray(input) {
77
- return input.map(validateLabel);
78
- }
79
- function validateComment(input) {
80
- return entities_1.CommentSchema.parse(input);
81
- }
82
- function validateCommentArray(input) {
83
- return input.map(validateComment);
84
- }
85
- function validateUser(input) {
86
- return entities_1.UserSchema.parse(input);
87
- }
88
- function validateUserArray(input) {
89
- return input.map(validateUser);
90
- }
91
- function validateProductivityStats(input) {
92
- return entities_1.ProductivityStatsSchema.parse(input);
93
- }
94
- function validateCurrentUser(input) {
95
- return entities_1.CurrentUserSchema.parse(input);
96
- }
97
- function validateActivityEvent(input) {
98
- return entities_1.ActivityEventSchema.parse(input);
99
- }
100
- function validateActivityEventArray(input) {
101
- return input.map(validateActivityEvent);
102
- }
103
- function validateAttachment(input) {
104
- return entities_1.AttachmentSchema.parse(input);
105
- }
106
- function validateWorkspaceUser(input) {
107
- return entities_1.WorkspaceUserSchema.parse(input);
108
- }
51
+ exports.validateSection = createValidator(entities_1.SectionSchema);
52
+ exports.validateSectionArray = createArrayValidator(exports.validateSection);
53
+ exports.validateLabel = createValidator(entities_1.LabelSchema);
54
+ exports.validateLabelArray = createArrayValidator(exports.validateLabel);
55
+ exports.validateComment = createValidator(entities_1.CommentSchema);
56
+ exports.validateCommentArray = createArrayValidator(exports.validateComment);
57
+ exports.validateUser = createValidator(entities_1.UserSchema);
58
+ exports.validateUserArray = createArrayValidator(exports.validateUser);
59
+ exports.validateProductivityStats = createValidator(entities_1.ProductivityStatsSchema);
60
+ exports.validateCurrentUser = createValidator(entities_1.CurrentUserSchema);
61
+ exports.validateActivityEvent = createValidator(entities_1.ActivityEventSchema);
62
+ exports.validateActivityEventArray = createArrayValidator(exports.validateActivityEvent);
63
+ exports.validateAttachment = createValidator(entities_1.AttachmentSchema);
64
+ exports.validateWorkspaceUser = createValidator(entities_1.WorkspaceUserSchema);
109
65
  function validateWorkspaceUserArray(input) {
110
66
  if (!Array.isArray(input)) {
111
67
  throw new Error(`Expected array for workspace users, got ${typeof input}`);
112
68
  }
113
- return input.map(validateWorkspaceUser);
114
- }
115
- function validateWorkspaceInvitation(input) {
116
- return entities_1.WorkspaceInvitationSchema.parse(input);
117
- }
118
- function validateWorkspaceInvitationArray(input) {
119
- return input.map(validateWorkspaceInvitation);
120
- }
121
- function validateWorkspacePlanDetails(input) {
122
- return entities_1.WorkspacePlanDetailsSchema.parse(input);
123
- }
124
- function validateJoinWorkspaceResult(input) {
125
- return entities_1.JoinWorkspaceResultSchema.parse(input);
126
- }
127
- function validateWorkspace(input) {
128
- return entities_1.WorkspaceSchema.parse(input);
129
- }
130
- function validateWorkspaceArray(input) {
131
- return input.map(validateWorkspace);
132
- }
69
+ return input.map(exports.validateWorkspaceUser);
70
+ }
71
+ exports.validateWorkspaceInvitation = createValidator(entities_1.WorkspaceInvitationSchema);
72
+ exports.validateWorkspaceInvitationArray = createArrayValidator(exports.validateWorkspaceInvitation);
73
+ exports.validateWorkspacePlanDetails = createValidator(entities_1.WorkspacePlanDetailsSchema);
74
+ exports.validateJoinWorkspaceResult = createValidator(entities_1.JoinWorkspaceResultSchema);
75
+ exports.validateWorkspace = createValidator(entities_1.WorkspaceSchema);
76
+ exports.validateWorkspaceArray = createArrayValidator(exports.validateWorkspace);
77
+ // Sync resource validators
78
+ exports.validateFilter = createValidator(resources_1.FilterSchema);
79
+ exports.validateFilterArray = createArrayValidator(exports.validateFilter);
80
+ exports.validateCollaborator = createValidator(resources_1.CollaboratorSchema);
81
+ exports.validateCollaboratorArray = createArrayValidator(exports.validateCollaborator);
82
+ exports.validateCollaboratorState = createValidator(resources_1.CollaboratorStateSchema);
83
+ exports.validateCollaboratorStateArray = createArrayValidator(exports.validateCollaboratorState);
84
+ exports.validateFolder = createValidator(resources_1.FolderSchema);
85
+ exports.validateFolderArray = createArrayValidator(exports.validateFolder);
86
+ exports.validateNote = createValidator(resources_1.NoteSchema);
87
+ exports.validateNoteArray = createArrayValidator(exports.validateNote);
88
+ exports.validateTooltips = createValidator(resources_1.TooltipsSchema);
89
+ exports.validateWorkspaceFilter = createValidator(resources_1.WorkspaceFilterSchema);
90
+ exports.validateWorkspaceFilterArray = createArrayValidator(exports.validateWorkspaceFilter);
91
+ exports.validateWorkspaceGoal = createValidator(resources_1.WorkspaceGoalSchema);
92
+ exports.validateWorkspaceGoalArray = createArrayValidator(exports.validateWorkspaceGoal);
93
+ exports.validateCalendar = createValidator(resources_1.CalendarSchema);
94
+ exports.validateCalendarArray = createArrayValidator(exports.validateCalendar);
95
+ exports.validateCalendarAccount = createValidator(resources_1.CalendarAccountSchema);
96
+ exports.validateCalendarAccountArray = createArrayValidator(exports.validateCalendarAccount);
97
+ exports.validateReminder = createValidator(resources_1.ReminderSchema);
98
+ exports.validateReminderArray = createArrayValidator(exports.validateReminder);
99
+ exports.validateCompletedInfo = createValidator(resources_1.CompletedInfoSchema);
100
+ exports.validateCompletedInfoArray = createArrayValidator(exports.validateCompletedInfo);
101
+ exports.validateViewOptions = createValidator(resources_1.ViewOptionsSchema);
102
+ exports.validateViewOptionsArray = createArrayValidator(exports.validateViewOptions);
103
+ exports.validateProjectViewOptionsDefaults = createValidator(resources_1.ProjectViewOptionsDefaultsSchema);
104
+ exports.validateProjectViewOptionsDefaultsArray = createArrayValidator(exports.validateProjectViewOptionsDefaults);
105
+ exports.validateUserPlanLimits = createValidator(resources_1.UserPlanLimitsSchema);
106
+ exports.validateLiveNotification = createValidator(resources_1.LiveNotificationSchema);
107
+ exports.validateLiveNotificationArray = createArrayValidator(exports.validateLiveNotification);
108
+ exports.validateSyncWorkspace = createValidator(resources_1.SyncWorkspaceSchema);
109
+ exports.validateSyncWorkspaceArray = createArrayValidator(exports.validateSyncWorkspace);
110
+ exports.validateSyncUser = createValidator(resources_1.SyncUserSchema);
111
+ exports.validateUserSettings = createValidator(resources_1.UserSettingsSchema);
112
+ exports.validateSuggestion = createValidator(resources_1.SuggestionSchema);
113
+ exports.validateSuggestionArray = createArrayValidator(exports.validateSuggestion);
@@ -73,6 +73,34 @@ export class TodoistApi {
73
73
  }
74
74
  return response.data;
75
75
  }
76
+ /**
77
+ * Executes a raw Sync API request.
78
+ *
79
+ * This method provides direct access to the Sync API, allowing you to send
80
+ * strongly-typed commands and request specific resource types.
81
+ *
82
+ * @param request - The sync request payload containing commands and/or resource types.
83
+ * @param requestId - Optional custom identifier for the request.
84
+ * @returns A promise that resolves to the sync response.
85
+ * @throws TodoistRequestError if the sync status contains errors.
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * import { createCommand } from '@doist/todoist-api-typescript'
90
+ *
91
+ * const response = await api.sync({
92
+ * commands: [
93
+ * createCommand('item_add', { content: 'Buy milk' }),
94
+ * ],
95
+ * resourceTypes: ['items'],
96
+ * syncToken: '*',
97
+ * })
98
+ * ```
99
+ */
100
+ async sync(syncRequest, requestId) {
101
+ var _a;
102
+ return this.requestSync(syncRequest, requestId, Boolean((_a = syncRequest.commands) === null || _a === void 0 ? void 0 : _a.length));
103
+ }
76
104
  /**
77
105
  * Retrieves information about the authenticated user.
78
106
  *
@@ -286,11 +314,11 @@ export class TodoistApi {
286
314
  const commands = ids.map((id) => ({
287
315
  type: 'item_move',
288
316
  uuid: uuidv4(),
289
- args: Object.assign(Object.assign(Object.assign({ id }, (args.projectId && { project_id: args.projectId })), (args.sectionId && { section_id: args.sectionId })), (args.parentId && { parent_id: args.parentId })),
317
+ args: Object.assign(Object.assign(Object.assign({ id }, (args.projectId ? { projectId: args.projectId } : {})), (args.sectionId ? { sectionId: args.sectionId } : {})), (args.parentId ? { parentId: args.parentId } : {})),
290
318
  }));
291
319
  const syncRequest = {
292
320
  commands,
293
- resource_types: ['items'],
321
+ resourceTypes: ['items'],
294
322
  };
295
323
  const syncResponse = await this.requestSync(syncRequest, requestId, true);
296
324
  if (!((_a = syncResponse.items) === null || _a === void 0 ? void 0 : _a.length)) {
@@ -1355,8 +1383,8 @@ export class TodoistApi {
1355
1383
  */
1356
1384
  async getWorkspaces(requestId) {
1357
1385
  const syncRequest = {
1358
- sync_token: '*',
1359
- resource_types: ['workspaces'],
1386
+ syncToken: '*',
1387
+ resourceTypes: ['workspaces'],
1360
1388
  };
1361
1389
  const syncResponse = await this.requestSync(syncRequest, requestId, false);
1362
1390
  const workspacesData = syncResponse.workspaces;
@@ -2,3 +2,4 @@ export * from './entities.js';
2
2
  export * from './errors.js';
3
3
  export * from './requests.js';
4
4
  export * from './http.js';
5
+ export * from './sync/index.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
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 './workspace-goals.js';
14
+ export * from './notifications.js';
15
+ export * from './sharing.js';
16
+ export * from './view-options.js';
17
+ export * from './project-view-options.js';
18
+ export * from './calendars.js';
19
+ 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,4 @@
1
+ /**
2
+ * Shared types used across multiple Sync API command argument types.
3
+ */
4
+ export {};
@@ -0,0 +1 @@
1
+ export {};