@doist/todoist-sdk 13.0.0 → 13.0.2
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/clients/project-client.js +6 -2
- package/dist/cjs/clients/task-client.js +1 -1
- package/dist/cjs/types/insights/types.js +1 -1
- package/dist/esm/clients/project-client.js +7 -3
- package/dist/esm/clients/task-client.js +1 -1
- package/dist/esm/types/insights/types.js +1 -1
- package/dist/types/types/insights/types.d.ts +1 -1
- package/dist/types/utils/validators.d.ts +1 -1
- package/package.json +1 -1
|
@@ -187,8 +187,12 @@ class ProjectClient extends base_client_1.BaseClient {
|
|
|
187
187
|
commentsCount: data.commentsCount,
|
|
188
188
|
tasks: (0, validators_1.validateTaskArray)(data.tasks),
|
|
189
189
|
sections: (0, validators_1.validateSectionArray)(data.sections),
|
|
190
|
-
collaborators: (0, validators_1.
|
|
191
|
-
|
|
190
|
+
collaborators: (0, validators_1.validateCollaboratorArray)(data.collaborators).map((collaborator) => (0, validators_1.validateUser)({
|
|
191
|
+
id: collaborator.id,
|
|
192
|
+
email: collaborator.email,
|
|
193
|
+
name: collaborator.fullName,
|
|
194
|
+
})),
|
|
195
|
+
notes: (0, validators_1.validateCommentArray)(data.notes === undefined ? [] : data.notes),
|
|
192
196
|
};
|
|
193
197
|
}
|
|
194
198
|
async joinProject(id, requestId) {
|
|
@@ -47,7 +47,7 @@ class TaskClient extends base_client_1.BaseClient {
|
|
|
47
47
|
relativePath: endpoints_1.ENDPOINT_REST_TASKS,
|
|
48
48
|
apiToken: this.authToken,
|
|
49
49
|
customFetch: this.customFetch,
|
|
50
|
-
payload: args,
|
|
50
|
+
payload: Object.assign(Object.assign({}, args), (0, request_helpers_1.spreadIfDefined)(args.ids, (ids) => ({ ids: ids.join(',') }))),
|
|
51
51
|
});
|
|
52
52
|
return {
|
|
53
53
|
results: (0, validators_1.validateTaskArray)(results),
|
|
@@ -81,6 +81,6 @@ exports.ProjectInsightSchema = zod_1.z.object({
|
|
|
81
81
|
progress: exports.ProjectProgressSchema.nullable(),
|
|
82
82
|
});
|
|
83
83
|
exports.WorkspaceInsightsSchema = zod_1.z.object({
|
|
84
|
-
folderId: zod_1.z.string().nullable(),
|
|
84
|
+
folderId: zod_1.z.string().nullable().optional(),
|
|
85
85
|
projectInsights: zod_1.z.array(exports.ProjectInsightSchema),
|
|
86
86
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ENDPOINT_REST_PROJECTS, ENDPOINT_REST_PROJECTS_ARCHIVED, ENDPOINT_REST_PROJECTS_ARCHIVED_COUNT, ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL, ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE, ENDPOINT_REST_PROJECTS_PERMISSIONS, ENDPOINT_REST_PROJECTS_SEARCH, ENDPOINT_REST_PROJECT_COLLABORATORS, ENDPOINT_REST_PROJECT_FULL, ENDPOINT_REST_PROJECT_JOIN, PROJECT_ARCHIVE, PROJECT_UNARCHIVE, } from '../consts/endpoints.js';
|
|
2
2
|
import { isSuccess, request } from '../transport/http-client.js';
|
|
3
3
|
import { generatePath } from '../utils/request-helpers.js';
|
|
4
|
-
import { IdSchema, validateCollaboratorArray, validateCollaboratorStateArray, validateCommentArray, validateFolder, validateNoteArray, validateProject, validateProjectArray, validateSectionArray, validateTaskArray, validateUserArray, validateWorkspaceProject, validateWorkspaceProjectArray, } from '../utils/validators.js';
|
|
4
|
+
import { IdSchema, validateCollaboratorArray, validateCollaboratorStateArray, validateCommentArray, validateFolder, validateNoteArray, validateProject, validateProjectArray, validateSectionArray, validateTaskArray, validateUser, validateUserArray, validateWorkspaceProject, validateWorkspaceProjectArray, } from '../utils/validators.js';
|
|
5
5
|
import { BaseClient } from './base-client.js';
|
|
6
6
|
/**
|
|
7
7
|
* Internal sub-client handling all project-domain endpoints.
|
|
@@ -184,8 +184,12 @@ export class ProjectClient extends BaseClient {
|
|
|
184
184
|
commentsCount: data.commentsCount,
|
|
185
185
|
tasks: validateTaskArray(data.tasks),
|
|
186
186
|
sections: validateSectionArray(data.sections),
|
|
187
|
-
collaborators:
|
|
188
|
-
|
|
187
|
+
collaborators: validateCollaboratorArray(data.collaborators).map((collaborator) => validateUser({
|
|
188
|
+
id: collaborator.id,
|
|
189
|
+
email: collaborator.email,
|
|
190
|
+
name: collaborator.fullName,
|
|
191
|
+
})),
|
|
192
|
+
notes: validateCommentArray(data.notes === undefined ? [] : data.notes),
|
|
189
193
|
};
|
|
190
194
|
}
|
|
191
195
|
async joinProject(id, requestId) {
|
|
@@ -44,7 +44,7 @@ export class TaskClient extends BaseClient {
|
|
|
44
44
|
relativePath: ENDPOINT_REST_TASKS,
|
|
45
45
|
apiToken: this.authToken,
|
|
46
46
|
customFetch: this.customFetch,
|
|
47
|
-
payload: args,
|
|
47
|
+
payload: Object.assign(Object.assign({}, args), spreadIfDefined(args.ids, (ids) => ({ ids: ids.join(',') }))),
|
|
48
48
|
});
|
|
49
49
|
return {
|
|
50
50
|
results: validateTaskArray(results),
|
|
@@ -78,6 +78,6 @@ export const ProjectInsightSchema = z.object({
|
|
|
78
78
|
progress: ProjectProgressSchema.nullable(),
|
|
79
79
|
});
|
|
80
80
|
export const WorkspaceInsightsSchema = z.object({
|
|
81
|
-
folderId: z.string().nullable(),
|
|
81
|
+
folderId: z.string().nullable().optional(),
|
|
82
82
|
projectInsights: z.array(ProjectInsightSchema),
|
|
83
83
|
});
|
|
@@ -151,7 +151,7 @@ export declare const ProjectInsightSchema: z.ZodObject<{
|
|
|
151
151
|
/** Insight data for a single project within a workspace. */
|
|
152
152
|
export type ProjectInsight = z.infer<typeof ProjectInsightSchema>;
|
|
153
153
|
export declare const WorkspaceInsightsSchema: z.ZodObject<{
|
|
154
|
-
folderId: z.ZodNullable<z.ZodString
|
|
154
|
+
folderId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
155
155
|
projectInsights: z.ZodArray<z.ZodObject<{
|
|
156
156
|
projectId: z.ZodString;
|
|
157
157
|
health: z.ZodNullable<z.ZodObject<{
|
|
@@ -705,7 +705,6 @@ export declare const validateProjectProgress: (input: unknown) => {
|
|
|
705
705
|
progressPercent: number;
|
|
706
706
|
};
|
|
707
707
|
export declare const validateWorkspaceInsights: (input: unknown) => {
|
|
708
|
-
folderId: string | null;
|
|
709
708
|
projectInsights: {
|
|
710
709
|
projectId: string;
|
|
711
710
|
health: {
|
|
@@ -728,6 +727,7 @@ export declare const validateWorkspaceInsights: (input: unknown) => {
|
|
|
728
727
|
progressPercent: number;
|
|
729
728
|
} | null;
|
|
730
729
|
}[];
|
|
730
|
+
folderId?: string | null | undefined;
|
|
731
731
|
};
|
|
732
732
|
export declare const validateBackup: (input: unknown) => {
|
|
733
733
|
version: string;
|
package/package.json
CHANGED