@doist/todoist-api-typescript 5.6.4 → 5.7.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.
@@ -112,8 +112,18 @@ export declare class TodoistApi {
112
112
  * @param args - The paramets that should contain only one of projectId, sectionId, or parentId
113
113
  * @param requestId - Optional custom identifier for the request.
114
114
  * @returns - A promise that resolves to an array of the updated tasks.
115
+ * @deprecated Use `moveTask` for single task operations. This method uses the Sync API and may be removed in a future version.
115
116
  */
116
117
  moveTasks(ids: string[], args: MoveTaskArgs, requestId?: string): Promise<Task[]>;
118
+ /**
119
+ * Moves a task by its ID to either a different parent/section/project.
120
+ *
121
+ * @param id - The unique identifier of the task to be moved.
122
+ * @param args - The parameters that should contain exactly one of projectId, sectionId, or parentId
123
+ * @param requestId - Optional custom identifier for the request.
124
+ * @returns A promise that resolves to the updated task.
125
+ */
126
+ moveTask(id: string, args: MoveTaskArgs, requestId?: string): Promise<Task>;
117
127
  /**
118
128
  * Closes (completes) a task by its ID.
119
129
  *
@@ -322,6 +322,7 @@ var TodoistApi = /** @class */ (function () {
322
322
  * @param args - The paramets that should contain only one of projectId, sectionId, or parentId
323
323
  * @param requestId - Optional custom identifier for the request.
324
324
  * @returns - A promise that resolves to an array of the updated tasks.
325
+ * @deprecated Use `moveTask` for single task operations. This method uses the Sync API and may be removed in a future version.
325
326
  */
326
327
  TodoistApi.prototype.moveTasks = function (ids, args, requestId) {
327
328
  return __awaiter(this, void 0, void 0, function () {
@@ -366,6 +367,29 @@ var TodoistApi = /** @class */ (function () {
366
367
  });
367
368
  });
368
369
  };
370
+ /**
371
+ * Moves a task by its ID to either a different parent/section/project.
372
+ *
373
+ * @param id - The unique identifier of the task to be moved.
374
+ * @param args - The parameters that should contain exactly one of projectId, sectionId, or parentId
375
+ * @param requestId - Optional custom identifier for the request.
376
+ * @returns A promise that resolves to the updated task.
377
+ */
378
+ TodoistApi.prototype.moveTask = function (id, args, requestId) {
379
+ return __awaiter(this, void 0, void 0, function () {
380
+ var response;
381
+ return __generator(this, function (_a) {
382
+ switch (_a.label) {
383
+ case 0:
384
+ zod_1.z.string().parse(id);
385
+ return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id, endpoints_1.ENDPOINT_REST_TASK_MOVE), this.authToken, __assign(__assign(__assign({}, (args.projectId && { project_id: args.projectId })), (args.sectionId && { section_id: args.sectionId })), (args.parentId && { parent_id: args.parentId })), requestId)];
386
+ case 1:
387
+ response = _a.sent();
388
+ return [2 /*return*/, (0, validators_1.validateTask)(response.data)];
389
+ }
390
+ });
391
+ });
392
+ };
369
393
  /**
370
394
  * Closes (completes) a task by its ID.
371
395
  *
@@ -16,6 +16,7 @@ export declare const ENDPOINT_REST_LABELS_SHARED_REMOVE: string;
16
16
  export declare const ENDPOINT_REST_COMMENTS = "comments";
17
17
  export declare const ENDPOINT_REST_TASK_CLOSE = "close";
18
18
  export declare const ENDPOINT_REST_TASK_REOPEN = "reopen";
19
+ export declare const ENDPOINT_REST_TASK_MOVE = "move";
19
20
  export declare const ENDPOINT_REST_PROJECTS = "projects";
20
21
  export declare const ENDPOINT_REST_PROJECTS_ARCHIVED: string;
21
22
  export declare const ENDPOINT_REST_PROJECT_COLLABORATORS = "collaborators";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ENDPOINT_REVOKE_TOKEN = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.PROJECT_UNARCHIVE = exports.PROJECT_ARCHIVE = exports.ENDPOINT_REST_ACTIVITIES = exports.ENDPOINT_REST_PRODUCTIVITY = exports.ENDPOINT_REST_USER = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_PROJECTS_ARCHIVED = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASK_REOPEN = exports.ENDPOINT_REST_TASK_CLOSE = exports.ENDPOINT_REST_COMMENTS = exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_TASKS_COMPLETED_SEARCH = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE = exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS = exports.API_BASE_URI = exports.API_VERSION = exports.TODOIST_WEB_URI = void 0;
3
+ exports.ENDPOINT_REVOKE_TOKEN = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.PROJECT_UNARCHIVE = exports.PROJECT_ARCHIVE = exports.ENDPOINT_REST_ACTIVITIES = exports.ENDPOINT_REST_PRODUCTIVITY = exports.ENDPOINT_REST_USER = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_PROJECTS_ARCHIVED = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASK_MOVE = exports.ENDPOINT_REST_TASK_REOPEN = exports.ENDPOINT_REST_TASK_CLOSE = exports.ENDPOINT_REST_COMMENTS = exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_TASKS_COMPLETED_SEARCH = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE = exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS = exports.API_BASE_URI = exports.API_VERSION = exports.TODOIST_WEB_URI = void 0;
4
4
  exports.getSyncBaseUri = getSyncBaseUri;
5
5
  exports.getAuthBaseUri = getAuthBaseUri;
6
6
  var BASE_URI = 'https://api.todoist.com';
@@ -32,6 +32,7 @@ exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED
32
32
  exports.ENDPOINT_REST_COMMENTS = 'comments';
33
33
  exports.ENDPOINT_REST_TASK_CLOSE = 'close';
34
34
  exports.ENDPOINT_REST_TASK_REOPEN = 'reopen';
35
+ exports.ENDPOINT_REST_TASK_MOVE = 'move';
35
36
  exports.ENDPOINT_REST_PROJECTS = 'projects';
36
37
  exports.ENDPOINT_REST_PROJECTS_ARCHIVED = exports.ENDPOINT_REST_PROJECTS + '/archived';
37
38
  exports.ENDPOINT_REST_PROJECT_COLLABORATORS = 'collaborators';
@@ -703,7 +703,7 @@ export declare const ActivityEventSchema: z.ZodObject<{
703
703
  objectId: z.ZodString;
704
704
  eventType: z.ZodString;
705
705
  eventDate: z.ZodString;
706
- id: z.ZodNullable<z.ZodString>;
706
+ id: z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>;
707
707
  parentProjectId: z.ZodNullable<z.ZodString>;
708
708
  parentItemId: z.ZodNullable<z.ZodString>;
709
709
  initiatorId: z.ZodNullable<z.ZodString>;
@@ -310,7 +310,10 @@ exports.ActivityEventSchema = zod_1.z
310
310
  objectId: zod_1.z.string(),
311
311
  eventType: zod_1.z.string(),
312
312
  eventDate: zod_1.z.string(),
313
- id: zod_1.z.string().nullable(),
313
+ id: zod_1.z
314
+ .union([zod_1.z.string(), zod_1.z.number()])
315
+ .transform(function (val) { var _a; return (_a = val === null || val === void 0 ? void 0 : val.toString()) !== null && _a !== void 0 ? _a : null; })
316
+ .nullable(),
314
317
  parentProjectId: zod_1.z.string().nullable(),
315
318
  parentItemId: zod_1.z.string().nullable(),
316
319
  initiatorId: zod_1.z.string().nullable(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/todoist-api-typescript",
3
- "version": "5.6.4",
3
+ "version": "5.7.1",
4
4
  "description": "A typescript wrapper for the Todoist REST API.",
5
5
  "author": "Doist developers",
6
6
  "repository": "git@github.com:doist/todoist-api-typescript.git",
@@ -30,14 +30,13 @@
30
30
  "camelcase": "6.3.0",
31
31
  "emoji-regex": "10.5.0",
32
32
  "ts-custom-error": "^3.2.0",
33
- "uuid": "^11.0.0",
33
+ "uuid": "11.1.0",
34
34
  "zod": "4.1.5"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@doist/eslint-config": "11.1.0",
38
38
  "@doist/prettier-config": "4.0.0",
39
39
  "@types/jest": "30.0.0",
40
- "@types/uuid": "10.0.0",
41
40
  "@typescript-eslint/eslint-plugin": "6.21.0",
42
41
  "@typescript-eslint/parser": "6.21.0",
43
42
  "eslint": "8.35.0",