@doist/todoist-api-typescript 7.6.0 → 7.6.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/dist/cjs/todoist-api.js +6 -6
- 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 +2 -0
- package/dist/cjs/types/emails/index.js +17 -0
- package/dist/cjs/types/emails/requests.js +5 -0
- package/dist/cjs/types/id-mappings/index.js +18 -0
- package/dist/cjs/types/{requests.js → id-mappings/requests.js} +1 -7
- package/dist/cjs/types/id-mappings/types.js +12 -0
- package/dist/cjs/types/index.js +16 -2
- 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 +5 -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/shared.js +2 -2
- package/dist/cjs/types/sync/resources/collaborators.js +2 -2
- package/dist/cjs/types/sync/resources/notes.js +2 -2
- package/dist/cjs/types/sync/resources/reminders.js +3 -3
- package/dist/cjs/types/sync/resources/user.js +2 -2
- package/dist/cjs/types/sync/resources/workspaces.js +5 -5
- 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 +137 -0
- package/dist/cjs/utils/validators.js +38 -27
- package/dist/esm/todoist-api.js +2 -2
- 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 +1 -0
- package/dist/esm/types/emails/index.js +1 -0
- package/dist/esm/types/emails/requests.js +2 -0
- package/dist/esm/types/id-mappings/index.js +2 -0
- package/dist/esm/types/{requests.js → id-mappings/requests.js} +0 -6
- package/dist/esm/types/id-mappings/types.js +9 -0
- package/dist/esm/types/index.js +16 -2
- 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 +2 -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/shared.js +1 -1
- package/dist/esm/types/sync/resources/collaborators.js +1 -1
- package/dist/esm/types/sync/resources/notes.js +1 -1
- package/dist/esm/types/sync/resources/reminders.js +1 -1
- package/dist/esm/types/sync/resources/user.js +1 -1
- package/dist/esm/types/sync/resources/workspaces.js +1 -1
- 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 +134 -0
- package/dist/esm/utils/validators.js +12 -1
- package/dist/types/test-utils/test-defaults.d.ts +5 -5
- package/dist/types/todoist-api.d.ts +16 -2
- 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 +63 -0
- package/dist/types/types/comments/types.d.ts +141 -0
- package/dist/types/types/common.d.ts +6 -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/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 +16 -2
- 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 +169 -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 +91 -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/projects.d.ts +2 -1
- package/dist/types/types/sync/commands/shared.d.ts +2 -2
- package/dist/types/types/sync/commands/workspaces.d.ts +1 -1
- package/dist/types/types/sync/resources/notes.d.ts +1 -1
- package/dist/types/types/sync/response.d.ts +5 -1
- 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 +225 -0
- package/dist/types/utils/colors.d.ts +1 -1
- package/dist/types/utils/validators.d.ts +7 -6
- package/package.json +1 -1
- package/dist/cjs/types/entities.js +0 -552
- package/dist/esm/types/entities.js +0 -548
- package/dist/types/types/entities.d.ts +0 -1211
- package/dist/types/types/requests.d.ts +0 -1188
|
@@ -1,552 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.ProjectActivityStatsSchema = exports.WeekRollupSchema = exports.DayActivitySchema = exports.WorkspaceUserTaskSchema = exports.MemberActivityInfoSchema = exports.WorkspaceSchema = exports.WorkspacePropertiesSchema = exports.WorkspaceLimitsSchema = exports.WorkspacePlanSchema = exports.WORKSPACE_PLANS = exports.JoinWorkspaceResultSchema = exports.WorkspacePlanDetailsSchema = exports.WORKSPACE_PLAN_STATUSES = exports.WORKSPACE_CURRENT_PLANS = exports.FormattedPriceListingSchema = exports.PlanPriceSchema = exports.WorkspaceInvitationSchema = exports.WorkspaceUserSchema = exports.WorkspaceRoleSchema = exports.WORKSPACE_ROLES = exports.COLLABORATOR_ROLES = exports.ActivityEventSchema = exports.ActivityEventExtraDataSchema = exports.ColorSchema = exports.ProductivityStatsSchema = exports.KarmaUpdateSchema = exports.ItemsWithDateSchema = exports.CompletedItemSchema = exports.StreakSchema = exports.CurrentUserSchema = exports.PREMIUM_STATUSES = exports.TimezoneInfoSchema = exports.UserSchema = exports.CommentSchema = exports.RawCommentSchema = exports.AttachmentSchema = exports.UPLOAD_STATES = exports.LabelSchema = exports.SectionSchema = exports.PROJECT_VIEW_STYLES = exports.WorkspaceProjectSchema = exports.ProjectVisibilitySchema = exports.PROJECT_VISIBILITIES = exports.PersonalProjectSchema = exports.BaseProjectSchema = exports.TaskSchema = exports.DeadlineSchema = exports.DurationSchema = exports.DURATION_UNITS = exports.DueDateSchema = void 0;
|
|
15
|
-
exports.MovedIdSchema = exports.IdMappingSchema = exports.BackupSchema = exports.WorkspaceInsightsSchema = exports.ProjectInsightSchema = exports.ProjectProgressSchema = exports.ProjectHealthContextSchema = exports.TaskContextSchema = exports.ProjectMetricsSchema = exports.ProjectHealthSchema = exports.TaskRecommendationSchema = exports.HEALTH_STATUSES = void 0;
|
|
16
|
-
const zod_1 = require("zod");
|
|
17
|
-
const url_helpers_1 = require("../utils/url-helpers");
|
|
18
|
-
const uncompletable_helpers_1 = require("../utils/uncompletable-helpers");
|
|
19
|
-
exports.DueDateSchema = zod_1.z
|
|
20
|
-
.object({
|
|
21
|
-
isRecurring: zod_1.z.boolean(),
|
|
22
|
-
string: zod_1.z.string(),
|
|
23
|
-
date: zod_1.z.string(),
|
|
24
|
-
})
|
|
25
|
-
.extend({
|
|
26
|
-
datetime: zod_1.z.string().nullable().optional(),
|
|
27
|
-
timezone: zod_1.z.string().nullable().optional(),
|
|
28
|
-
lang: zod_1.z.string().nullable().optional(),
|
|
29
|
-
});
|
|
30
|
-
/** Available duration units for task deadlines. */
|
|
31
|
-
exports.DURATION_UNITS = ['minute', 'day'];
|
|
32
|
-
exports.DurationSchema = zod_1.z.object({
|
|
33
|
-
amount: zod_1.z.number().positive('Value should be greater than zero'),
|
|
34
|
-
unit: zod_1.z.enum(exports.DURATION_UNITS),
|
|
35
|
-
});
|
|
36
|
-
exports.DeadlineSchema = zod_1.z.object({
|
|
37
|
-
date: zod_1.z.string(),
|
|
38
|
-
lang: zod_1.z.string(),
|
|
39
|
-
});
|
|
40
|
-
exports.TaskSchema = zod_1.z
|
|
41
|
-
.object({
|
|
42
|
-
id: zod_1.z.string(),
|
|
43
|
-
userId: zod_1.z.string(),
|
|
44
|
-
projectId: zod_1.z.string(),
|
|
45
|
-
sectionId: zod_1.z.string().nullable(),
|
|
46
|
-
parentId: zod_1.z.string().nullable(),
|
|
47
|
-
addedByUid: zod_1.z.string().nullable(),
|
|
48
|
-
assignedByUid: zod_1.z.string().nullable(),
|
|
49
|
-
responsibleUid: zod_1.z.string().nullable(),
|
|
50
|
-
labels: zod_1.z.array(zod_1.z.string()),
|
|
51
|
-
deadline: exports.DeadlineSchema.nullable(),
|
|
52
|
-
duration: exports.DurationSchema.nullable(),
|
|
53
|
-
checked: zod_1.z.boolean(),
|
|
54
|
-
isDeleted: zod_1.z.boolean(),
|
|
55
|
-
addedAt: zod_1.z.string().nullable(),
|
|
56
|
-
completedAt: zod_1.z.string().nullable(),
|
|
57
|
-
updatedAt: zod_1.z.string().nullable(),
|
|
58
|
-
due: exports.DueDateSchema.nullable(),
|
|
59
|
-
priority: zod_1.z.number().int(),
|
|
60
|
-
childOrder: zod_1.z.number().int(),
|
|
61
|
-
content: zod_1.z.string(),
|
|
62
|
-
description: zod_1.z.string(),
|
|
63
|
-
dayOrder: zod_1.z.number().int(),
|
|
64
|
-
isCollapsed: zod_1.z.boolean(),
|
|
65
|
-
isUncompletable: zod_1.z.boolean().default(false),
|
|
66
|
-
})
|
|
67
|
-
.transform((data) => {
|
|
68
|
-
// Auto-detect uncompletable status from content prefix
|
|
69
|
-
const isUncompletable = (0, uncompletable_helpers_1.hasUncompletablePrefix)(data.content);
|
|
70
|
-
return Object.assign(Object.assign({}, data), { isUncompletable, url: (0, url_helpers_1.getTaskUrl)(data.id, data.content) });
|
|
71
|
-
});
|
|
72
|
-
/**
|
|
73
|
-
* Base schema for all project types in Todoist.
|
|
74
|
-
* Contains common fields shared between personal and workspace projects.
|
|
75
|
-
*/
|
|
76
|
-
exports.BaseProjectSchema = zod_1.z.object({
|
|
77
|
-
id: zod_1.z.string(),
|
|
78
|
-
canAssignTasks: zod_1.z.boolean(),
|
|
79
|
-
childOrder: zod_1.z.number().int(),
|
|
80
|
-
color: zod_1.z.string(),
|
|
81
|
-
createdAt: zod_1.z.string().nullable(),
|
|
82
|
-
isArchived: zod_1.z.boolean(),
|
|
83
|
-
isDeleted: zod_1.z.boolean(),
|
|
84
|
-
isFavorite: zod_1.z.boolean(),
|
|
85
|
-
isFrozen: zod_1.z.boolean(),
|
|
86
|
-
name: zod_1.z.string(),
|
|
87
|
-
updatedAt: zod_1.z.string().nullable(),
|
|
88
|
-
viewStyle: zod_1.z.string(),
|
|
89
|
-
defaultOrder: zod_1.z.number().int(),
|
|
90
|
-
description: zod_1.z.string(),
|
|
91
|
-
isCollapsed: zod_1.z.boolean(),
|
|
92
|
-
isShared: zod_1.z.boolean(),
|
|
93
|
-
});
|
|
94
|
-
/**
|
|
95
|
-
* Schema for personal projects in Todoist.
|
|
96
|
-
*/
|
|
97
|
-
exports.PersonalProjectSchema = exports.BaseProjectSchema.extend({
|
|
98
|
-
parentId: zod_1.z.string().nullable(),
|
|
99
|
-
inboxProject: zod_1.z.boolean().optional().default(false),
|
|
100
|
-
}).transform((data) => {
|
|
101
|
-
return Object.assign(Object.assign({}, data), { url: (0, url_helpers_1.getProjectUrl)(data.id, data.name) });
|
|
102
|
-
});
|
|
103
|
-
/** Available project visibility levels. */
|
|
104
|
-
exports.PROJECT_VISIBILITIES = ['restricted', 'team', 'public'];
|
|
105
|
-
exports.ProjectVisibilitySchema = zod_1.z.enum(exports.PROJECT_VISIBILITIES);
|
|
106
|
-
/**
|
|
107
|
-
* Schema for workspace projects in Todoist.
|
|
108
|
-
*/
|
|
109
|
-
exports.WorkspaceProjectSchema = exports.BaseProjectSchema.extend({
|
|
110
|
-
access: zod_1.z.object({ visibility: exports.ProjectVisibilitySchema }).optional(),
|
|
111
|
-
collaboratorRoleDefault: zod_1.z.string(),
|
|
112
|
-
folderId: zod_1.z.string().nullable(),
|
|
113
|
-
isInviteOnly: zod_1.z.boolean().nullable(),
|
|
114
|
-
isLinkSharingEnabled: zod_1.z.boolean(),
|
|
115
|
-
role: zod_1.z.string().nullable(),
|
|
116
|
-
status: zod_1.z.string(),
|
|
117
|
-
workspaceId: zod_1.z.string(),
|
|
118
|
-
}).transform((data) => {
|
|
119
|
-
return Object.assign(Object.assign({}, data), { url: (0, url_helpers_1.getProjectUrl)(data.id, data.name) });
|
|
120
|
-
});
|
|
121
|
-
/** Available project view styles. */
|
|
122
|
-
exports.PROJECT_VIEW_STYLES = ['list', 'board', 'calendar'];
|
|
123
|
-
exports.SectionSchema = zod_1.z
|
|
124
|
-
.object({
|
|
125
|
-
id: zod_1.z.string(),
|
|
126
|
-
userId: zod_1.z.string(),
|
|
127
|
-
projectId: zod_1.z.string(),
|
|
128
|
-
addedAt: zod_1.z.string(),
|
|
129
|
-
updatedAt: zod_1.z.string(),
|
|
130
|
-
archivedAt: zod_1.z.string().nullable(),
|
|
131
|
-
name: zod_1.z.string(),
|
|
132
|
-
sectionOrder: zod_1.z.number().int(),
|
|
133
|
-
isArchived: zod_1.z.boolean(),
|
|
134
|
-
isDeleted: zod_1.z.boolean(),
|
|
135
|
-
isCollapsed: zod_1.z.boolean(),
|
|
136
|
-
})
|
|
137
|
-
.transform((data) => {
|
|
138
|
-
return Object.assign(Object.assign({}, data), { url: (0, url_helpers_1.getSectionUrl)(data.id, data.name) });
|
|
139
|
-
});
|
|
140
|
-
exports.LabelSchema = zod_1.z.object({
|
|
141
|
-
id: zod_1.z.string(),
|
|
142
|
-
order: zod_1.z.number().int().nullable(),
|
|
143
|
-
name: zod_1.z.string(),
|
|
144
|
-
color: zod_1.z.string(),
|
|
145
|
-
isFavorite: zod_1.z.boolean(),
|
|
146
|
-
});
|
|
147
|
-
/** Available file attachment upload states. */
|
|
148
|
-
exports.UPLOAD_STATES = ['pending', 'completed'];
|
|
149
|
-
exports.AttachmentSchema = zod_1.z
|
|
150
|
-
.object({
|
|
151
|
-
resourceType: zod_1.z.string(),
|
|
152
|
-
})
|
|
153
|
-
.extend({
|
|
154
|
-
fileName: zod_1.z.string().nullable().optional(),
|
|
155
|
-
fileSize: zod_1.z.number().int().nullable().optional(),
|
|
156
|
-
fileType: zod_1.z.string().nullable().optional(),
|
|
157
|
-
fileUrl: zod_1.z.string().nullable().optional(),
|
|
158
|
-
fileDuration: zod_1.z.number().int().nullable().optional(),
|
|
159
|
-
uploadState: zod_1.z.enum(exports.UPLOAD_STATES).nullable().optional(),
|
|
160
|
-
image: zod_1.z.string().nullable().optional(),
|
|
161
|
-
imageWidth: zod_1.z.number().int().nullable().optional(),
|
|
162
|
-
imageHeight: zod_1.z.number().int().nullable().optional(),
|
|
163
|
-
url: zod_1.z.string().nullable().optional(),
|
|
164
|
-
title: zod_1.z.string().nullable().optional(),
|
|
165
|
-
});
|
|
166
|
-
exports.RawCommentSchema = zod_1.z
|
|
167
|
-
.object({
|
|
168
|
-
id: zod_1.z.string(),
|
|
169
|
-
itemId: zod_1.z.string().optional(),
|
|
170
|
-
projectId: zod_1.z.string().optional(),
|
|
171
|
-
content: zod_1.z.string(),
|
|
172
|
-
postedAt: zod_1.z.string(),
|
|
173
|
-
fileAttachment: exports.AttachmentSchema.nullable(),
|
|
174
|
-
postedUid: zod_1.z.string(),
|
|
175
|
-
uidsToNotify: zod_1.z.array(zod_1.z.string()).nullable(),
|
|
176
|
-
reactions: zod_1.z.record(zod_1.z.string(), zod_1.z.array(zod_1.z.string())).nullable(),
|
|
177
|
-
isDeleted: zod_1.z.boolean(),
|
|
178
|
-
})
|
|
179
|
-
.refine((data) => {
|
|
180
|
-
// At least one of itemId or projectId must be present
|
|
181
|
-
return ((data.itemId !== undefined && data.projectId === undefined) ||
|
|
182
|
-
(data.itemId === undefined && data.projectId !== undefined));
|
|
183
|
-
}, {
|
|
184
|
-
message: 'Exactly one of itemId or projectId must be provided',
|
|
185
|
-
});
|
|
186
|
-
exports.CommentSchema = exports.RawCommentSchema.transform((data) => {
|
|
187
|
-
const { itemId } = data, rest = __rest(data, ["itemId"]);
|
|
188
|
-
return Object.assign(Object.assign({}, rest), {
|
|
189
|
-
// Map itemId to taskId for backwards compatibility
|
|
190
|
-
taskId: itemId });
|
|
191
|
-
});
|
|
192
|
-
exports.UserSchema = zod_1.z.object({
|
|
193
|
-
id: zod_1.z.string(),
|
|
194
|
-
name: zod_1.z.string(),
|
|
195
|
-
email: zod_1.z.string(),
|
|
196
|
-
});
|
|
197
|
-
exports.TimezoneInfoSchema = zod_1.z.object({
|
|
198
|
-
gmtString: zod_1.z.string(),
|
|
199
|
-
hours: zod_1.z.number().int(),
|
|
200
|
-
isDst: zod_1.z.number().int(),
|
|
201
|
-
minutes: zod_1.z.number().int(),
|
|
202
|
-
timezone: zod_1.z.string(),
|
|
203
|
-
});
|
|
204
|
-
/** Available user premium statuses. */
|
|
205
|
-
exports.PREMIUM_STATUSES = [
|
|
206
|
-
'not_premium',
|
|
207
|
-
'current_personal_plan',
|
|
208
|
-
'legacy_personal_plan',
|
|
209
|
-
'teams_business_member',
|
|
210
|
-
];
|
|
211
|
-
exports.CurrentUserSchema = zod_1.z.object({
|
|
212
|
-
id: zod_1.z.string(),
|
|
213
|
-
email: zod_1.z.string(),
|
|
214
|
-
fullName: zod_1.z.string(),
|
|
215
|
-
avatarBig: zod_1.z.string().nullish(),
|
|
216
|
-
avatarMedium: zod_1.z.string().nullish(),
|
|
217
|
-
avatarS640: zod_1.z.string().nullish(),
|
|
218
|
-
avatarSmall: zod_1.z.string().nullish(),
|
|
219
|
-
businessAccountId: zod_1.z.string().nullable(),
|
|
220
|
-
isPremium: zod_1.z.boolean(),
|
|
221
|
-
premiumStatus: zod_1.z.enum(exports.PREMIUM_STATUSES),
|
|
222
|
-
dateFormat: zod_1.z.number().int(),
|
|
223
|
-
timeFormat: zod_1.z.number().int(),
|
|
224
|
-
weeklyGoal: zod_1.z.number().int(),
|
|
225
|
-
dailyGoal: zod_1.z.number().int(),
|
|
226
|
-
completedCount: zod_1.z.number().int(),
|
|
227
|
-
completedToday: zod_1.z.number().int(),
|
|
228
|
-
karma: zod_1.z.number(),
|
|
229
|
-
karmaTrend: zod_1.z.string(),
|
|
230
|
-
lang: zod_1.z.string(),
|
|
231
|
-
nextWeek: zod_1.z.number().int(),
|
|
232
|
-
startDay: zod_1.z.number().int(),
|
|
233
|
-
startPage: zod_1.z.string(),
|
|
234
|
-
tzInfo: exports.TimezoneInfoSchema,
|
|
235
|
-
inboxProjectId: zod_1.z.string(),
|
|
236
|
-
daysOff: zod_1.z.array(zod_1.z.number().int()),
|
|
237
|
-
weekendStartDay: zod_1.z.number().int(),
|
|
238
|
-
});
|
|
239
|
-
exports.StreakSchema = zod_1.z.object({
|
|
240
|
-
count: zod_1.z.number(),
|
|
241
|
-
start: zod_1.z.string(),
|
|
242
|
-
end: zod_1.z.string(),
|
|
243
|
-
});
|
|
244
|
-
exports.CompletedItemSchema = zod_1.z.object({
|
|
245
|
-
id: zod_1.z.string(),
|
|
246
|
-
completed: zod_1.z.number(),
|
|
247
|
-
});
|
|
248
|
-
exports.ItemsWithDateSchema = zod_1.z.object({
|
|
249
|
-
items: zod_1.z.array(exports.CompletedItemSchema),
|
|
250
|
-
totalCompleted: zod_1.z.number(),
|
|
251
|
-
});
|
|
252
|
-
exports.KarmaUpdateSchema = zod_1.z.object({
|
|
253
|
-
time: zod_1.z.string(),
|
|
254
|
-
newKarma: zod_1.z.number(),
|
|
255
|
-
positiveKarma: zod_1.z.number(),
|
|
256
|
-
negativeKarma: zod_1.z.number(),
|
|
257
|
-
positiveKarmaReasons: zod_1.z.array(zod_1.z.any()),
|
|
258
|
-
negativeKarmaReasons: zod_1.z.array(zod_1.z.any()),
|
|
259
|
-
});
|
|
260
|
-
exports.ProductivityStatsSchema = zod_1.z.object({
|
|
261
|
-
completedCount: zod_1.z.number(),
|
|
262
|
-
daysItems: zod_1.z.array(exports.ItemsWithDateSchema.extend({
|
|
263
|
-
date: zod_1.z.string(),
|
|
264
|
-
})),
|
|
265
|
-
goals: zod_1.z.object({
|
|
266
|
-
currentDailyStreak: exports.StreakSchema,
|
|
267
|
-
currentWeeklyStreak: exports.StreakSchema,
|
|
268
|
-
dailyGoal: zod_1.z.number(),
|
|
269
|
-
ignoreDays: zod_1.z.array(zod_1.z.number()),
|
|
270
|
-
karmaDisabled: zod_1.z.number(),
|
|
271
|
-
lastDailyStreak: exports.StreakSchema,
|
|
272
|
-
lastWeeklyStreak: exports.StreakSchema,
|
|
273
|
-
maxDailyStreak: exports.StreakSchema,
|
|
274
|
-
maxWeeklyStreak: exports.StreakSchema,
|
|
275
|
-
user: zod_1.z.string(),
|
|
276
|
-
userId: zod_1.z.string(),
|
|
277
|
-
vacationMode: zod_1.z.number(),
|
|
278
|
-
weeklyGoal: zod_1.z.number(),
|
|
279
|
-
}),
|
|
280
|
-
karma: zod_1.z.number(),
|
|
281
|
-
karmaGraphData: zod_1.z.array(zod_1.z.object({
|
|
282
|
-
date: zod_1.z.string(),
|
|
283
|
-
karmaAvg: zod_1.z.number(),
|
|
284
|
-
})),
|
|
285
|
-
karmaLastUpdate: zod_1.z.number(),
|
|
286
|
-
karmaTrend: zod_1.z.string(),
|
|
287
|
-
karmaUpdateReasons: zod_1.z.array(exports.KarmaUpdateSchema),
|
|
288
|
-
projectColors: zod_1.z.record(zod_1.z.string(), zod_1.z.string()),
|
|
289
|
-
weekItems: zod_1.z.array(exports.ItemsWithDateSchema.extend({
|
|
290
|
-
from: zod_1.z.string(),
|
|
291
|
-
to: zod_1.z.string(),
|
|
292
|
-
})),
|
|
293
|
-
});
|
|
294
|
-
exports.ColorSchema = zod_1.z.object({
|
|
295
|
-
/** The key of the color (i.e. 'berry_red') */
|
|
296
|
-
key: zod_1.z.string(),
|
|
297
|
-
/** The display name of the color (i.e. 'Berry Red') */
|
|
298
|
-
displayName: zod_1.z.string(),
|
|
299
|
-
/** The hex value of the color (i.e. '#b8255f') */
|
|
300
|
-
hexValue: zod_1.z.string(),
|
|
301
|
-
});
|
|
302
|
-
/**
|
|
303
|
-
* Flexible object containing event-specific data.
|
|
304
|
-
* Uses z.record to accept any properties for forward compatibility.
|
|
305
|
-
*/
|
|
306
|
-
exports.ActivityEventExtraDataSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.any()).nullable();
|
|
307
|
-
/**
|
|
308
|
-
* Activity log event schema. Accepts unknown fields for forward compatibility.
|
|
309
|
-
*/
|
|
310
|
-
exports.ActivityEventSchema = zod_1.z
|
|
311
|
-
.object({
|
|
312
|
-
objectType: zod_1.z.string(),
|
|
313
|
-
objectId: zod_1.z.string(),
|
|
314
|
-
eventType: zod_1.z.string(),
|
|
315
|
-
eventDate: zod_1.z.string(),
|
|
316
|
-
id: zod_1.z
|
|
317
|
-
.union([zod_1.z.string(), zod_1.z.number()])
|
|
318
|
-
.transform((val) => { var _a; return (_a = val === null || val === void 0 ? void 0 : val.toString()) !== null && _a !== void 0 ? _a : null; })
|
|
319
|
-
.nullable(),
|
|
320
|
-
parentProjectId: zod_1.z.string().nullable(),
|
|
321
|
-
parentItemId: zod_1.z.string().nullable(),
|
|
322
|
-
initiatorId: zod_1.z.string().nullable(),
|
|
323
|
-
extraData: exports.ActivityEventExtraDataSchema,
|
|
324
|
-
})
|
|
325
|
-
.catchall(zod_1.z.any());
|
|
326
|
-
/** Available project collaborator roles. */
|
|
327
|
-
exports.COLLABORATOR_ROLES = [
|
|
328
|
-
'CREATOR',
|
|
329
|
-
'ADMIN',
|
|
330
|
-
'READ_WRITE',
|
|
331
|
-
'EDIT_ONLY',
|
|
332
|
-
'COMPLETE_ONLY',
|
|
333
|
-
];
|
|
334
|
-
/**
|
|
335
|
-
* Available workspace roles.
|
|
336
|
-
*/
|
|
337
|
-
exports.WORKSPACE_ROLES = ['ADMIN', 'MEMBER', 'GUEST'];
|
|
338
|
-
exports.WorkspaceRoleSchema = zod_1.z.enum(exports.WORKSPACE_ROLES);
|
|
339
|
-
exports.WorkspaceUserSchema = zod_1.z.object({
|
|
340
|
-
userId: zod_1.z.string(),
|
|
341
|
-
workspaceId: zod_1.z.string(),
|
|
342
|
-
userEmail: zod_1.z.string(),
|
|
343
|
-
fullName: zod_1.z.string(),
|
|
344
|
-
timezone: zod_1.z.string(),
|
|
345
|
-
role: exports.WorkspaceRoleSchema,
|
|
346
|
-
imageId: zod_1.z.string().nullable(),
|
|
347
|
-
isDeleted: zod_1.z.boolean().default(false),
|
|
348
|
-
});
|
|
349
|
-
exports.WorkspaceInvitationSchema = zod_1.z.object({
|
|
350
|
-
id: zod_1.z.string().default('0'),
|
|
351
|
-
inviterId: zod_1.z.string(),
|
|
352
|
-
userEmail: zod_1.z.string(),
|
|
353
|
-
workspaceId: zod_1.z.string(),
|
|
354
|
-
role: exports.WorkspaceRoleSchema,
|
|
355
|
-
isExistingUser: zod_1.z.boolean(),
|
|
356
|
-
});
|
|
357
|
-
exports.PlanPriceSchema = zod_1.z.object({
|
|
358
|
-
currency: zod_1.z.string(),
|
|
359
|
-
amount: zod_1.z.union([zod_1.z.number(), zod_1.z.string()]),
|
|
360
|
-
interval: zod_1.z.string().optional(),
|
|
361
|
-
});
|
|
362
|
-
exports.FormattedPriceListingSchema = zod_1.z.object({
|
|
363
|
-
currency: zod_1.z.string().optional(),
|
|
364
|
-
amount: zod_1.z.number().optional(),
|
|
365
|
-
interval: zod_1.z.string().optional(),
|
|
366
|
-
formatted: zod_1.z.string().optional(),
|
|
367
|
-
});
|
|
368
|
-
/** Available workspace plan names. */
|
|
369
|
-
exports.WORKSPACE_CURRENT_PLANS = ['Business', 'Starter'];
|
|
370
|
-
/** Available workspace plan statuses. */
|
|
371
|
-
exports.WORKSPACE_PLAN_STATUSES = [
|
|
372
|
-
'Active',
|
|
373
|
-
'Downgraded',
|
|
374
|
-
'Cancelled',
|
|
375
|
-
'NeverSubscribed',
|
|
376
|
-
];
|
|
377
|
-
exports.WorkspacePlanDetailsSchema = zod_1.z.object({
|
|
378
|
-
currentMemberCount: zod_1.z.number(),
|
|
379
|
-
currentPlan: zod_1.z.enum(exports.WORKSPACE_CURRENT_PLANS),
|
|
380
|
-
currentPlanStatus: zod_1.z.enum(exports.WORKSPACE_PLAN_STATUSES),
|
|
381
|
-
downgradeAt: zod_1.z.string().nullable(),
|
|
382
|
-
currentActiveProjects: zod_1.z.number(),
|
|
383
|
-
maximumActiveProjects: zod_1.z.number(),
|
|
384
|
-
priceList: zod_1.z.array(exports.FormattedPriceListingSchema),
|
|
385
|
-
workspaceId: zod_1.z.number(),
|
|
386
|
-
isTrialing: zod_1.z.boolean(),
|
|
387
|
-
trialEndsAt: zod_1.z.string().nullable(),
|
|
388
|
-
cancelAtPeriodEnd: zod_1.z.boolean(),
|
|
389
|
-
hasTrialed: zod_1.z.boolean(),
|
|
390
|
-
planPrice: exports.PlanPriceSchema.nullable(),
|
|
391
|
-
hasBillingPortal: zod_1.z.boolean(),
|
|
392
|
-
hasBillingPortalSwitchToAnnual: zod_1.z.boolean(),
|
|
393
|
-
});
|
|
394
|
-
exports.JoinWorkspaceResultSchema = zod_1.z.object({
|
|
395
|
-
customSortingApplied: zod_1.z.boolean(),
|
|
396
|
-
projectSortPreference: zod_1.z.string(),
|
|
397
|
-
role: exports.WorkspaceRoleSchema,
|
|
398
|
-
userId: zod_1.z.string(),
|
|
399
|
-
workspaceId: zod_1.z.string(),
|
|
400
|
-
});
|
|
401
|
-
/**
|
|
402
|
-
* Available workspace plans.
|
|
403
|
-
*/
|
|
404
|
-
exports.WORKSPACE_PLANS = ['STARTER', 'BUSINESS'];
|
|
405
|
-
exports.WorkspacePlanSchema = zod_1.z.enum(exports.WORKSPACE_PLANS);
|
|
406
|
-
/**
|
|
407
|
-
* Workspace resource limits.
|
|
408
|
-
*/
|
|
409
|
-
exports.WorkspaceLimitsSchema = zod_1.z
|
|
410
|
-
.object({
|
|
411
|
-
current: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).nullable(),
|
|
412
|
-
next: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).nullable(),
|
|
413
|
-
})
|
|
414
|
-
.catchall(zod_1.z.any());
|
|
415
|
-
/**
|
|
416
|
-
* Workspace properties (flexible object for unknown fields).
|
|
417
|
-
*/
|
|
418
|
-
exports.WorkspacePropertiesSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.unknown());
|
|
419
|
-
/**
|
|
420
|
-
* Represents a workspace in Todoist.
|
|
421
|
-
*/
|
|
422
|
-
exports.WorkspaceSchema = zod_1.z.object({
|
|
423
|
-
id: zod_1.z.string(),
|
|
424
|
-
name: zod_1.z.string(),
|
|
425
|
-
plan: exports.WorkspacePlanSchema,
|
|
426
|
-
role: exports.WorkspaceRoleSchema,
|
|
427
|
-
inviteCode: zod_1.z.string(),
|
|
428
|
-
isLinkSharingEnabled: zod_1.z.boolean(),
|
|
429
|
-
isGuestAllowed: zod_1.z.boolean(),
|
|
430
|
-
limits: exports.WorkspaceLimitsSchema,
|
|
431
|
-
logoBig: zod_1.z.string().nullish(),
|
|
432
|
-
logoMedium: zod_1.z.string().nullish(),
|
|
433
|
-
logoSmall: zod_1.z.string().nullish(),
|
|
434
|
-
logoS640: zod_1.z.string().nullish(),
|
|
435
|
-
createdAt: zod_1.z.string(),
|
|
436
|
-
creatorId: zod_1.z.string(),
|
|
437
|
-
properties: exports.WorkspacePropertiesSchema,
|
|
438
|
-
});
|
|
439
|
-
exports.MemberActivityInfoSchema = zod_1.z.object({
|
|
440
|
-
userId: zod_1.z.string(),
|
|
441
|
-
tasksAssigned: zod_1.z.number().int(),
|
|
442
|
-
tasksOverdue: zod_1.z.number().int(),
|
|
443
|
-
});
|
|
444
|
-
exports.WorkspaceUserTaskSchema = zod_1.z.object({
|
|
445
|
-
id: zod_1.z.string(),
|
|
446
|
-
content: zod_1.z.string(),
|
|
447
|
-
responsibleUid: zod_1.z.string().nullable(),
|
|
448
|
-
due: exports.DueDateSchema.nullable(),
|
|
449
|
-
deadline: exports.DeadlineSchema.nullable(),
|
|
450
|
-
labels: zod_1.z.array(zod_1.z.string()),
|
|
451
|
-
notesCount: zod_1.z.number().int(),
|
|
452
|
-
projectId: zod_1.z.string(),
|
|
453
|
-
projectName: zod_1.z.string(),
|
|
454
|
-
priority: zod_1.z.number().int(),
|
|
455
|
-
description: zod_1.z.string(),
|
|
456
|
-
isOverdue: zod_1.z.boolean(),
|
|
457
|
-
});
|
|
458
|
-
// Insights entities
|
|
459
|
-
exports.DayActivitySchema = zod_1.z.object({
|
|
460
|
-
date: zod_1.z.string(),
|
|
461
|
-
totalCount: zod_1.z.number().int(),
|
|
462
|
-
});
|
|
463
|
-
exports.WeekRollupSchema = zod_1.z.object({
|
|
464
|
-
fromDate: zod_1.z.string(),
|
|
465
|
-
toDate: zod_1.z.string(),
|
|
466
|
-
totalCount: zod_1.z.number().int(),
|
|
467
|
-
});
|
|
468
|
-
exports.ProjectActivityStatsSchema = zod_1.z.object({
|
|
469
|
-
dayItems: zod_1.z.array(exports.DayActivitySchema),
|
|
470
|
-
weekItems: zod_1.z.array(exports.WeekRollupSchema).nullable(),
|
|
471
|
-
});
|
|
472
|
-
/** Available project health statuses. */
|
|
473
|
-
exports.HEALTH_STATUSES = [
|
|
474
|
-
'UNKNOWN',
|
|
475
|
-
'ON_TRACK',
|
|
476
|
-
'AT_RISK',
|
|
477
|
-
'CRITICAL',
|
|
478
|
-
'EXCELLENT',
|
|
479
|
-
'ERROR',
|
|
480
|
-
];
|
|
481
|
-
exports.TaskRecommendationSchema = zod_1.z.object({
|
|
482
|
-
taskId: zod_1.z.string(),
|
|
483
|
-
recommendation: zod_1.z.string(),
|
|
484
|
-
});
|
|
485
|
-
exports.ProjectHealthSchema = zod_1.z.object({
|
|
486
|
-
status: zod_1.z.enum(exports.HEALTH_STATUSES),
|
|
487
|
-
description: zod_1.z.string().nullable().optional(),
|
|
488
|
-
descriptionSummary: zod_1.z.string().nullable().optional(),
|
|
489
|
-
taskRecommendations: zod_1.z.array(exports.TaskRecommendationSchema).nullable().optional(),
|
|
490
|
-
projectId: zod_1.z.string().nullable().optional(),
|
|
491
|
-
updatedAt: zod_1.z.string().nullable().optional(),
|
|
492
|
-
isStale: zod_1.z.boolean().default(false),
|
|
493
|
-
updateInProgress: zod_1.z.boolean().default(false),
|
|
494
|
-
});
|
|
495
|
-
exports.ProjectMetricsSchema = zod_1.z.object({
|
|
496
|
-
totalTasks: zod_1.z.number().int(),
|
|
497
|
-
completedTasks: zod_1.z.number().int(),
|
|
498
|
-
overdueTasks: zod_1.z.number().int(),
|
|
499
|
-
tasksCreatedThisWeek: zod_1.z.number().int(),
|
|
500
|
-
tasksCompletedThisWeek: zod_1.z.number().int(),
|
|
501
|
-
averageCompletionTime: zod_1.z.number().nullable(),
|
|
502
|
-
});
|
|
503
|
-
exports.TaskContextSchema = zod_1.z.object({
|
|
504
|
-
id: zod_1.z.string(),
|
|
505
|
-
content: zod_1.z.string(),
|
|
506
|
-
due: zod_1.z.string().nullable().optional(),
|
|
507
|
-
deadline: zod_1.z.string().nullable().optional(),
|
|
508
|
-
priority: zod_1.z.string(),
|
|
509
|
-
isCompleted: zod_1.z.boolean(),
|
|
510
|
-
createdAt: zod_1.z.string(),
|
|
511
|
-
updatedAt: zod_1.z.string(),
|
|
512
|
-
completedAt: zod_1.z.string().nullable(),
|
|
513
|
-
completedByUid: zod_1.z.string().nullable(),
|
|
514
|
-
labels: zod_1.z.array(zod_1.z.string()),
|
|
515
|
-
});
|
|
516
|
-
exports.ProjectHealthContextSchema = zod_1.z.object({
|
|
517
|
-
projectId: zod_1.z.string(),
|
|
518
|
-
projectName: zod_1.z.string(),
|
|
519
|
-
projectDescription: zod_1.z.string().nullable(),
|
|
520
|
-
projectMetrics: exports.ProjectMetricsSchema,
|
|
521
|
-
tasks: zod_1.z.array(exports.TaskContextSchema),
|
|
522
|
-
language: zod_1.z.string().nullable().optional(),
|
|
523
|
-
});
|
|
524
|
-
exports.ProjectProgressSchema = zod_1.z.object({
|
|
525
|
-
projectId: zod_1.z.string(),
|
|
526
|
-
completedCount: zod_1.z.number().int(),
|
|
527
|
-
activeCount: zod_1.z.number().int(),
|
|
528
|
-
progressPercent: zod_1.z.number().int(),
|
|
529
|
-
});
|
|
530
|
-
exports.ProjectInsightSchema = zod_1.z.object({
|
|
531
|
-
projectId: zod_1.z.string(),
|
|
532
|
-
health: exports.ProjectHealthSchema.nullable(),
|
|
533
|
-
progress: exports.ProjectProgressSchema.nullable(),
|
|
534
|
-
});
|
|
535
|
-
exports.WorkspaceInsightsSchema = zod_1.z.object({
|
|
536
|
-
folderId: zod_1.z.string().nullable(),
|
|
537
|
-
projectInsights: zod_1.z.array(exports.ProjectInsightSchema),
|
|
538
|
-
});
|
|
539
|
-
// Backups
|
|
540
|
-
exports.BackupSchema = zod_1.z.object({
|
|
541
|
-
version: zod_1.z.string(),
|
|
542
|
-
url: zod_1.z.string(),
|
|
543
|
-
});
|
|
544
|
-
// ID Mappings
|
|
545
|
-
exports.IdMappingSchema = zod_1.z.object({
|
|
546
|
-
oldId: zod_1.z.string().nullable(),
|
|
547
|
-
newId: zod_1.z.string().nullable(),
|
|
548
|
-
});
|
|
549
|
-
exports.MovedIdSchema = zod_1.z.object({
|
|
550
|
-
oldId: zod_1.z.string(),
|
|
551
|
-
newId: zod_1.z.string(),
|
|
552
|
-
});
|