@doist/todoist-sdk 9.7.0 → 10.0.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.
@@ -24,8 +24,16 @@ function serializeTaskUpdateDateCompleteArgs(args) {
24
24
  })));
25
25
  }
26
26
  function serializeUpdateGoalsArgs(args) {
27
- return Object.assign(Object.assign(Object.assign({}, args), (0, request_helpers_1.spreadIfDefined)(args.vacationMode, (v) => ({ vacationMode: v ? 1 : 0 }))), (0, request_helpers_1.spreadIfDefined)(args.karmaDisabled, (v) => ({
27
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, args), (0, request_helpers_1.spreadIfDefined)(args.vacationMode, (v) => ({ vacationMode: v ? 1 : 0 }))), (0, request_helpers_1.spreadIfDefined)(args.karmaDisabled, (v) => ({
28
28
  karmaDisabled: v ? 1 : 0,
29
+ }))), (0, request_helpers_1.spreadIfDefined)(args.ignoreDays, (v) => ({
30
+ ignoreDays: v.map((day) => {
31
+ const apiValue = sync_1.DAY_OF_WEEK_TO_API[day];
32
+ if (apiValue === undefined) {
33
+ throw new types_1.TodoistArgumentError(`Invalid ignoreDays entry "${String(day)}". Expected a DayOfWeek (e.g. "Monday").`);
34
+ }
35
+ return apiValue;
36
+ }),
29
37
  })));
30
38
  }
31
39
  function preprocessSyncCommands(commands) {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ColorSchema = exports.ProductivityStatsSchema = exports.KarmaUpdateSchema = exports.ItemsWithDateSchema = exports.CompletedItemSchema = exports.StreakSchema = void 0;
4
4
  const zod_1 = require("zod");
5
+ const user_preferences_1 = require("../sync/user-preferences");
5
6
  exports.StreakSchema = zod_1.z.object({
6
7
  count: zod_1.z.number(),
7
8
  start: zod_1.z.string(),
@@ -32,15 +33,15 @@ exports.ProductivityStatsSchema = zod_1.z.object({
32
33
  currentDailyStreak: exports.StreakSchema,
33
34
  currentWeeklyStreak: exports.StreakSchema,
34
35
  dailyGoal: zod_1.z.number(),
35
- ignoreDays: zod_1.z.array(zod_1.z.number()),
36
- karmaDisabled: zod_1.z.number(),
36
+ ignoreDays: zod_1.z.array(user_preferences_1.DayOfWeekSchema),
37
+ karmaDisabled: user_preferences_1.BooleanFromZeroOneSchema,
37
38
  lastDailyStreak: exports.StreakSchema,
38
39
  lastWeeklyStreak: exports.StreakSchema,
39
40
  maxDailyStreak: exports.StreakSchema,
40
41
  maxWeeklyStreak: exports.StreakSchema,
41
42
  user: zod_1.z.string(),
42
43
  userId: zod_1.z.string(),
43
- vacationMode: zod_1.z.number(),
44
+ vacationMode: user_preferences_1.BooleanFromZeroOneSchema,
44
45
  weeklyGoal: zod_1.z.number(),
45
46
  }),
46
47
  karma: zod_1.z.number(),
@@ -1,5 +1,5 @@
1
1
  import { ENDPOINT_SYNC } from '../consts/endpoints.js';
2
- import { TodoistRequestError } from '../types/index.js';
2
+ import { TodoistArgumentError, TodoistRequestError } from '../types/index.js';
3
3
  import { DATE_FORMAT_TO_API, TIME_FORMAT_TO_API, DAY_OF_WEEK_TO_API, } from '../types/sync/index.js';
4
4
  import { spreadIfDefined } from '../utils/request-helpers.js';
5
5
  import { parseSyncResponse } from '../utils/validators.js';
@@ -21,8 +21,16 @@ function serializeTaskUpdateDateCompleteArgs(args) {
21
21
  })));
22
22
  }
23
23
  function serializeUpdateGoalsArgs(args) {
24
- return Object.assign(Object.assign(Object.assign({}, args), spreadIfDefined(args.vacationMode, (v) => ({ vacationMode: v ? 1 : 0 }))), spreadIfDefined(args.karmaDisabled, (v) => ({
24
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, args), spreadIfDefined(args.vacationMode, (v) => ({ vacationMode: v ? 1 : 0 }))), spreadIfDefined(args.karmaDisabled, (v) => ({
25
25
  karmaDisabled: v ? 1 : 0,
26
+ }))), spreadIfDefined(args.ignoreDays, (v) => ({
27
+ ignoreDays: v.map((day) => {
28
+ const apiValue = DAY_OF_WEEK_TO_API[day];
29
+ if (apiValue === undefined) {
30
+ throw new TodoistArgumentError(`Invalid ignoreDays entry "${String(day)}". Expected a DayOfWeek (e.g. "Monday").`);
31
+ }
32
+ return apiValue;
33
+ }),
26
34
  })));
27
35
  }
28
36
  function preprocessSyncCommands(commands) {
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { BooleanFromZeroOneSchema, DayOfWeekSchema } from '../sync/user-preferences.js';
2
3
  export const StreakSchema = z.object({
3
4
  count: z.number(),
4
5
  start: z.string(),
@@ -29,15 +30,15 @@ export const ProductivityStatsSchema = z.object({
29
30
  currentDailyStreak: StreakSchema,
30
31
  currentWeeklyStreak: StreakSchema,
31
32
  dailyGoal: z.number(),
32
- ignoreDays: z.array(z.number()),
33
- karmaDisabled: z.number(),
33
+ ignoreDays: z.array(DayOfWeekSchema),
34
+ karmaDisabled: BooleanFromZeroOneSchema,
34
35
  lastDailyStreak: StreakSchema,
35
36
  lastWeeklyStreak: StreakSchema,
36
37
  maxDailyStreak: StreakSchema,
37
38
  maxWeeklyStreak: StreakSchema,
38
39
  user: z.string(),
39
40
  userId: z.string(),
40
- vacationMode: z.number(),
41
+ vacationMode: BooleanFromZeroOneSchema,
41
42
  weeklyGoal: z.number(),
42
43
  }),
43
44
  karma: z.number(),
@@ -45,8 +45,8 @@ export declare const ProductivityStatsSchema: z.ZodObject<{
45
45
  end: z.ZodString;
46
46
  }, z.core.$strip>;
47
47
  dailyGoal: z.ZodNumber;
48
- ignoreDays: z.ZodArray<z.ZodNumber>;
49
- karmaDisabled: z.ZodNumber;
48
+ ignoreDays: z.ZodArray<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>]>, z.ZodTransform<"Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday", 3 | 2 | 1 | 7 | 4 | 5 | 6>>>;
49
+ karmaDisabled: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>, z.ZodTransform<boolean, 0 | 1>>;
50
50
  lastDailyStreak: z.ZodObject<{
51
51
  count: z.ZodNumber;
52
52
  start: z.ZodString;
@@ -69,7 +69,7 @@ export declare const ProductivityStatsSchema: z.ZodObject<{
69
69
  }, z.core.$strip>;
70
70
  user: z.ZodString;
71
71
  userId: z.ZodString;
72
- vacationMode: z.ZodNumber;
72
+ vacationMode: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>, z.ZodTransform<boolean, 0 | 1>>;
73
73
  weeklyGoal: z.ZodNumber;
74
74
  }, z.core.$strip>;
75
75
  karma: z.ZodNumber;
@@ -14,6 +14,10 @@ import type { PersonalProject, ProjectViewStyle, ProjectVisibility, WorkspacePro
14
14
  * @see https://developer.todoist.com/api/v1/#tag/Projects/operation/get_projects_api_v1_projects_get
15
15
  */
16
16
  export type GetProjectsArgs = {
17
+ /** Filter projects to only those in this folder. If provided, workspaceId is ignored. */
18
+ folderId?: string | null;
19
+ /** Filter projects to only those in this workspace. Ignored if folderId is also provided. */
20
+ workspaceId?: string | null;
17
21
  cursor?: string | null;
18
22
  limit?: number;
19
23
  };
@@ -66,6 +70,11 @@ export type UpdateProjectArgs = {
66
70
  color?: ColorKey;
67
71
  isFavorite?: boolean;
68
72
  viewStyle?: ProjectViewStyle;
73
+ /**
74
+ * Folder to move the project into. Only supported for workspace projects.
75
+ * Pass `null` to clear the value. Omit this field to keep it unchanged.
76
+ */
77
+ folderId?: string | null;
69
78
  };
70
79
  /**
71
80
  * Arguments for retrieving project collaborators.
@@ -33,7 +33,7 @@ export type UserSettingsUpdateArgs = {
33
33
  export type UpdateGoalsArgs = {
34
34
  dailyGoal?: number;
35
35
  weeklyGoal?: number;
36
- ignoreDays?: number[];
36
+ ignoreDays?: DayOfWeek[];
37
37
  vacationMode?: boolean;
38
38
  karmaDisabled?: boolean;
39
39
  };
@@ -89,7 +89,7 @@ export declare const SyncUserSchema: z.ZodObject<{
89
89
  mfaEnabled: z.ZodOptional<z.ZodBoolean>;
90
90
  mobileHost: z.ZodNullable<z.ZodString>;
91
91
  mobileNumber: z.ZodNullable<z.ZodString>;
92
- nextWeek: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>]>, z.ZodTransform<"Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday", 3 | 2 | 1 | 4 | 5 | 6 | 7>>;
92
+ nextWeek: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>]>, z.ZodTransform<"Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday", 3 | 2 | 1 | 7 | 4 | 5 | 6>>;
93
93
  onboardingLevel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
94
94
  onboardingRole: z.ZodOptional<z.ZodNullable<z.ZodString>>;
95
95
  onboardingPersona: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -113,7 +113,7 @@ export declare const SyncUserSchema: z.ZodObject<{
113
113
  }, z.core.$strip>>>;
114
114
  shareLimit: z.ZodNumber;
115
115
  sortOrder: z.ZodNumber;
116
- startDay: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>]>, z.ZodTransform<"Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday", 3 | 2 | 1 | 4 | 5 | 6 | 7>>;
116
+ startDay: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>]>, z.ZodTransform<"Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday", 3 | 2 | 1 | 7 | 4 | 5 | 6>>;
117
117
  startPage: z.ZodString;
118
118
  themeId: z.ZodString;
119
119
  timeFormat: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>, z.ZodTransform<"24h" | "12h", 0 | 1>>;
@@ -417,7 +417,7 @@ export declare const SyncResponseSchema: z.ZodObject<{
417
417
  mfaEnabled: z.ZodOptional<z.ZodBoolean>;
418
418
  mobileHost: z.ZodNullable<z.ZodString>;
419
419
  mobileNumber: z.ZodNullable<z.ZodString>;
420
- nextWeek: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>]>, z.ZodTransform<"Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday", 3 | 2 | 1 | 4 | 5 | 6 | 7>>;
420
+ nextWeek: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>]>, z.ZodTransform<"Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday", 3 | 2 | 1 | 7 | 4 | 5 | 6>>;
421
421
  onboardingLevel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
422
422
  onboardingRole: z.ZodOptional<z.ZodNullable<z.ZodString>>;
423
423
  onboardingPersona: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -441,7 +441,7 @@ export declare const SyncResponseSchema: z.ZodObject<{
441
441
  }, z.core.$strip>>>;
442
442
  shareLimit: z.ZodNumber;
443
443
  sortOrder: z.ZodNumber;
444
- startDay: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>]>, z.ZodTransform<"Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday", 3 | 2 | 1 | 4 | 5 | 6 | 7>>;
444
+ startDay: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>]>, z.ZodTransform<"Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday", 3 | 2 | 1 | 7 | 4 | 5 | 6>>;
445
445
  startPage: z.ZodString;
446
446
  themeId: z.ZodString;
447
447
  timeFormat: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>, z.ZodTransform<"24h" | "12h", 0 | 1>>;
@@ -36,4 +36,4 @@ export declare const BooleanFromZeroOneSchema: z.ZodPipe<z.ZodUnion<readonly [z.
36
36
  /** Zod read-schemas: parse API numbers, emit descriptive strings */
37
37
  export declare const DateFormatSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>, z.ZodTransform<"DD/MM/YYYY" | "MM/DD/YYYY", 0 | 1>>;
38
38
  export declare const TimeFormatSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>, z.ZodTransform<"24h" | "12h", 0 | 1>>;
39
- export declare const DayOfWeekSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>]>, z.ZodTransform<"Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday", 3 | 2 | 1 | 4 | 5 | 6 | 7>>;
39
+ export declare const DayOfWeekSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>]>, z.ZodTransform<"Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday", 3 | 2 | 1 | 7 | 4 | 5 | 6>>;
@@ -359,8 +359,8 @@ export declare const validateProductivityStats: (input: unknown) => {
359
359
  end: string;
360
360
  };
361
361
  dailyGoal: number;
362
- ignoreDays: number[];
363
- karmaDisabled: number;
362
+ ignoreDays: ("Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday")[];
363
+ karmaDisabled: boolean;
364
364
  lastDailyStreak: {
365
365
  count: number;
366
366
  start: string;
@@ -383,7 +383,7 @@ export declare const validateProductivityStats: (input: unknown) => {
383
383
  };
384
384
  user: string;
385
385
  userId: string;
386
- vacationMode: number;
386
+ vacationMode: boolean;
387
387
  weeklyGoal: number;
388
388
  };
389
389
  karma: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/todoist-sdk",
3
- "version": "9.7.0",
3
+ "version": "10.0.0",
4
4
  "description": "The official TypeScript SDK for the Todoist REST API.",
5
5
  "author": "Doist developers",
6
6
  "repository": "https://github.com/Doist/todoist-sdk-typescript",