@doist/todoist-api-typescript 7.3.0 → 7.4.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.
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PERMISSIONS = void 0;
3
4
  exports.getAuthStateParameter = getAuthStateParameter;
4
5
  exports.getAuthorizationUrl = getAuthorizationUrl;
5
6
  exports.getAuthToken = getAuthToken;
@@ -8,6 +9,15 @@ const rest_client_1 = require("./rest-client");
8
9
  const uuid_1 = require("uuid");
9
10
  const types_1 = require("./types");
10
11
  const endpoints_1 = require("./consts/endpoints");
12
+ /** Available OAuth2 permission scopes. */
13
+ exports.PERMISSIONS = [
14
+ 'task:add',
15
+ 'data:read',
16
+ 'data:read_write',
17
+ 'data:delete',
18
+ 'project:delete',
19
+ 'backups:read',
20
+ ];
11
21
  /**
12
22
  * Creates a Basic Authentication header value from client credentials.
13
23
  * @param clientId - The OAuth client ID
@@ -13,7 +13,7 @@ function paramsSerializer(params) {
13
13
  const qs = new URLSearchParams();
14
14
  Object.keys(params).forEach((key) => {
15
15
  const value = params[key];
16
- if (value != null) {
16
+ if (value !== null && value !== undefined) {
17
17
  if (Array.isArray(value)) {
18
18
  qs.append(key, JSON.stringify(value));
19
19
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assertInstance = assertInstance;
4
4
  // Has to use 'any' to express constructor type
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+ // oxlint-disable-next-line no-explicit-any
6
6
  function assertInstance(value, type) {
7
7
  if (value instanceof type) {
8
8
  return;
@@ -849,7 +849,7 @@ class TodoistApi {
849
849
  * @returns A promise that resolves to an array of labels.
850
850
  */
851
851
  async getLabels(args = {}) {
852
- const { data: { results, nextCursor: nextCursor }, } = await (0, rest_client_1.request)({
852
+ const { data: { results, nextCursor }, } = await (0, rest_client_1.request)({
853
853
  httpMethod: 'GET',
854
854
  baseUri: this.syncApiBase,
855
855
  relativePath: endpoints_1.ENDPOINT_REST_LABELS,
@@ -948,7 +948,7 @@ class TodoistApi {
948
948
  * @returns A promise that resolves to an array of shared labels.
949
949
  */
950
950
  async getSharedLabels(args) {
951
- const { data: { results, nextCursor: nextCursor }, } = await (0, rest_client_1.request)({
951
+ const { data: { results, nextCursor }, } = await (0, rest_client_1.request)({
952
952
  httpMethod: 'GET',
953
953
  baseUri: this.syncApiBase,
954
954
  relativePath: endpoints_1.ENDPOINT_REST_LABELS_SHARED,
@@ -1574,10 +1574,10 @@ class TodoistApi {
1574
1574
  payload: queryParams,
1575
1575
  requestId: requestId,
1576
1576
  });
1577
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
1577
+ // oxlint-disable-next-line no-unsafe-assignment, no-unsafe-call, no-unsafe-member-access
1578
1578
  const validatedProjects = (_a = response.data.results) === null || _a === void 0 ? void 0 : _a.map((project) => (0, validators_1.validateProject)(project));
1579
1579
  return Object.assign(Object.assign({}, response.data), {
1580
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1580
+ // oxlint-disable-next-line no-unsafe-assignment
1581
1581
  results: validatedProjects || [] });
1582
1582
  }
1583
1583
  /**
@@ -1605,10 +1605,10 @@ class TodoistApi {
1605
1605
  payload: queryParams,
1606
1606
  requestId: requestId,
1607
1607
  });
1608
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
1608
+ // oxlint-disable-next-line no-unsafe-assignment, no-unsafe-call, no-unsafe-member-access
1609
1609
  const validatedProjects = (_a = response.data.results) === null || _a === void 0 ? void 0 : _a.map((project) => (0, validators_1.validateProject)(project));
1610
1610
  return Object.assign(Object.assign({}, response.data), {
1611
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1611
+ // oxlint-disable-next-line no-unsafe-assignment
1612
1612
  results: validatedProjects || [] });
1613
1613
  }
1614
1614
  }
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  return t;
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- 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.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.WorkspaceProjectSchema = exports.ProjectVisibilitySchema = exports.PROJECT_VISIBILITIES = exports.PersonalProjectSchema = exports.BaseProjectSchema = exports.TaskSchema = exports.DeadlineSchema = exports.DurationSchema = exports.DURATION_UNITS = exports.DueDateSchema = void 0;
14
+ 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.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
15
  const zod_1 = require("zod");
16
16
  const url_helpers_1 = require("../utils/url-helpers");
17
17
  const uncompletable_helpers_1 = require("../utils/uncompletable-helpers");
@@ -117,6 +117,8 @@ exports.WorkspaceProjectSchema = exports.BaseProjectSchema.extend({
117
117
  }).transform((data) => {
118
118
  return Object.assign(Object.assign({}, data), { url: (0, url_helpers_1.getProjectUrl)(data.id, data.name) });
119
119
  });
120
+ /** Available project view styles. */
121
+ exports.PROJECT_VIEW_STYLES = ['list', 'board', 'calendar'];
120
122
  exports.SectionSchema = zod_1.z
121
123
  .object({
122
124
  id: zod_1.z.string(),
@@ -4,7 +4,6 @@ exports.TodoistRequestError = void 0;
4
4
  const ts_custom_error_1 = require("ts-custom-error");
5
5
  const authenticationErrorCodes = [401, 403];
6
6
  class TodoistRequestError extends ts_custom_error_1.CustomError {
7
- // eslint-disable-next-line max-params
8
7
  constructor(message, httpStatusCode, responseData) {
9
8
  super(message);
10
9
  this.message = message;
@@ -1,2 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LABEL_DELETE_CASCADE_MODES = void 0;
4
+ /** Available label delete cascade modes. */
5
+ exports.LABEL_DELETE_CASCADE_MODES = ['none', 'all'];
@@ -3,3 +3,24 @@
3
3
  * Shared types used across multiple Sync API command argument types.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.WORKSPACE_PROJECT_SORT_ORDERS = exports.REMINDER_SERVICES = exports.COLLABORATOR_ROLES = exports.PROJECT_STATUSES = void 0;
7
+ /** Available project workflow statuses. */
8
+ exports.PROJECT_STATUSES = [
9
+ 'PLANNED',
10
+ 'IN_PROGRESS',
11
+ 'PAUSED',
12
+ 'COMPLETED',
13
+ 'CANCELED',
14
+ ];
15
+ /** Available default collaborator roles. */
16
+ exports.COLLABORATOR_ROLES = [
17
+ 'CREATOR',
18
+ 'ADMIN',
19
+ 'READ_WRITE',
20
+ 'EDIT_ONLY',
21
+ 'COMPLETE_ONLY',
22
+ ];
23
+ /** Available reminder notification services. */
24
+ exports.REMINDER_SERVICES = ['default', 'email', 'mobile', 'push', 'no_default'];
25
+ /** Available workspace project sort orders. */
26
+ exports.WORKSPACE_PROJECT_SORT_ORDERS = ['MANUAL', 'A_TO_Z', 'Z_TO_A'];
@@ -1,10 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DayOfWeekSchema = exports.TimeFormatSchema = exports.DateFormatSchema = exports.BooleanFromZeroOneSchema = exports.DAY_OF_WEEK_TO_API = exports.TIME_FORMAT_TO_API = exports.DATE_FORMAT_TO_API = void 0;
3
+ exports.DayOfWeekSchema = exports.TimeFormatSchema = exports.DateFormatSchema = exports.BooleanFromZeroOneSchema = exports.DAY_OF_WEEK_TO_API = exports.TIME_FORMAT_TO_API = exports.DATE_FORMAT_TO_API = exports.DAY_OF_WEEK_FROM_API = exports.TIME_FORMAT_FROM_API = exports.DATE_FORMAT_FROM_API = exports.DAYS_OF_WEEK = exports.TIME_FORMATS = exports.DATE_FORMATS = void 0;
4
4
  const zod_1 = require("zod");
5
- const DATE_FORMAT_FROM_API = { 0: 'DD/MM/YYYY', 1: 'MM/DD/YYYY' };
6
- const TIME_FORMAT_FROM_API = { 0: '24h', 1: '12h' };
7
- const DAY_OF_WEEK_FROM_API = {
5
+ /** Available date format options. */
6
+ exports.DATE_FORMATS = ['DD/MM/YYYY', 'MM/DD/YYYY'];
7
+ /** Available time format options. */
8
+ exports.TIME_FORMATS = ['24h', '12h'];
9
+ /** Available days of the week. */
10
+ exports.DAYS_OF_WEEK = [
11
+ 'Monday',
12
+ 'Tuesday',
13
+ 'Wednesday',
14
+ 'Thursday',
15
+ 'Friday',
16
+ 'Saturday',
17
+ 'Sunday',
18
+ ];
19
+ exports.DATE_FORMAT_FROM_API = {
20
+ 0: 'DD/MM/YYYY',
21
+ 1: 'MM/DD/YYYY',
22
+ };
23
+ exports.TIME_FORMAT_FROM_API = {
24
+ 0: '24h',
25
+ 1: '12h',
26
+ };
27
+ exports.DAY_OF_WEEK_FROM_API = {
8
28
  1: 'Monday',
9
29
  2: 'Tuesday',
10
30
  3: 'Wednesday',
@@ -34,10 +54,10 @@ exports.BooleanFromZeroOneSchema = zod_1.z
34
54
  /** Zod read-schemas: parse API numbers, emit descriptive strings */
35
55
  exports.DateFormatSchema = zod_1.z
36
56
  .union([zod_1.z.literal(0), zod_1.z.literal(1)])
37
- .transform((v) => DATE_FORMAT_FROM_API[v]);
57
+ .transform((v) => exports.DATE_FORMAT_FROM_API[v]);
38
58
  exports.TimeFormatSchema = zod_1.z
39
59
  .union([zod_1.z.literal(0), zod_1.z.literal(1)])
40
- .transform((v) => TIME_FORMAT_FROM_API[v]);
60
+ .transform((v) => exports.TIME_FORMAT_FROM_API[v]);
41
61
  exports.DayOfWeekSchema = zod_1.z
42
62
  .union([
43
63
  zod_1.z.literal(1),
@@ -48,4 +68,4 @@ exports.DayOfWeekSchema = zod_1.z
48
68
  zod_1.z.literal(6),
49
69
  zod_1.z.literal(7),
50
70
  ])
51
- .transform((v) => DAY_OF_WEEK_FROM_API[v]);
71
+ .transform((v) => exports.DAY_OF_WEEK_FROM_API[v]);
@@ -18,7 +18,7 @@ function removeStyleFormatting(input) {
18
18
  if (!input.includes('!') && !input.includes('*') && !input.includes('_')) {
19
19
  return input;
20
20
  }
21
- function removeMarkdown(match, prefix, text) {
21
+ function removeMarkdown(_match, prefix, text) {
22
22
  return `${prefix}${text}`;
23
23
  }
24
24
  input = input.replace(BOLD_ITALIC_FORMAT, removeMarkdown);
@@ -27,7 +27,7 @@ function removeStyleFormatting(input) {
27
27
  return input;
28
28
  }
29
29
  function removeCodeFormatting(input) {
30
- function removeMarkdown(match, text) {
30
+ function removeMarkdown(_match, text) {
31
31
  return text;
32
32
  }
33
33
  input = input.replace(CODE_BLOCK_FORMAT, removeMarkdown);
@@ -47,7 +47,7 @@ function removeMarkdownLinks(input) {
47
47
  if (!input.includes('[') || !input.includes(']')) {
48
48
  return input;
49
49
  }
50
- function removeMarkdown(match, text) {
50
+ function removeMarkdown(_match, text) {
51
51
  return text;
52
52
  }
53
53
  return input.replace(MARKDOWN_LINK, removeMarkdown);
@@ -56,20 +56,20 @@ function removeTodoistLinks(input) {
56
56
  if (!input.includes('(') || !input.includes(')')) {
57
57
  return input;
58
58
  }
59
- function removeMarkdown(match, url, text) {
59
+ function removeMarkdown(_match, _url, text) {
60
60
  return text;
61
61
  }
62
62
  return input.replace(TODOIST_LINK, removeMarkdown);
63
63
  }
64
64
  function removeAppLinks(input) {
65
65
  if (input.includes('gmail')) {
66
- input = input.replace(GMAIL_LINK, (match, id, text) => text);
66
+ input = input.replace(GMAIL_LINK, (_match, _id, text) => text);
67
67
  }
68
68
  if (input.includes('outlook')) {
69
- input = input.replace(OUTLOOK_LINK, (match, id, text) => text);
69
+ input = input.replace(OUTLOOK_LINK, (_match, _id, text) => text);
70
70
  }
71
71
  if (input.includes('thunderbird')) {
72
- input = input.replace(THUNDERBIRD_LINK, (match, text) => text);
72
+ input = input.replace(THUNDERBIRD_LINK, (_match, text) => text);
73
73
  }
74
74
  return input;
75
75
  }
@@ -2,6 +2,15 @@ import { request, isSuccess } from './rest-client.js';
2
2
  import { v4 as uuid } from 'uuid';
3
3
  import { TodoistRequestError } from './types/index.js';
4
4
  import { getAuthBaseUri, getSyncBaseUri, ENDPOINT_AUTHORIZATION, ENDPOINT_GET_TOKEN, ENDPOINT_REVOKE, } from './consts/endpoints.js';
5
+ /** Available OAuth2 permission scopes. */
6
+ export const PERMISSIONS = [
7
+ 'task:add',
8
+ 'data:read',
9
+ 'data:read_write',
10
+ 'data:delete',
11
+ 'project:delete',
12
+ 'backups:read',
13
+ ];
5
14
  /**
6
15
  * Creates a Basic Authentication header value from client credentials.
7
16
  * @param clientId - The OAuth client ID
@@ -8,7 +8,7 @@ export function paramsSerializer(params) {
8
8
  const qs = new URLSearchParams();
9
9
  Object.keys(params).forEach((key) => {
10
10
  const value = params[key];
11
- if (value != null) {
11
+ if (value !== null && value !== undefined) {
12
12
  if (Array.isArray(value)) {
13
13
  qs.append(key, JSON.stringify(value));
14
14
  }
@@ -1,5 +1,5 @@
1
1
  // Has to use 'any' to express constructor type
2
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
+ // oxlint-disable-next-line no-explicit-any
3
3
  export function assertInstance(value, type) {
4
4
  if (value instanceof type) {
5
5
  return;
@@ -846,7 +846,7 @@ export class TodoistApi {
846
846
  * @returns A promise that resolves to an array of labels.
847
847
  */
848
848
  async getLabels(args = {}) {
849
- const { data: { results, nextCursor: nextCursor }, } = await request({
849
+ const { data: { results, nextCursor }, } = await request({
850
850
  httpMethod: 'GET',
851
851
  baseUri: this.syncApiBase,
852
852
  relativePath: ENDPOINT_REST_LABELS,
@@ -945,7 +945,7 @@ export class TodoistApi {
945
945
  * @returns A promise that resolves to an array of shared labels.
946
946
  */
947
947
  async getSharedLabels(args) {
948
- const { data: { results, nextCursor: nextCursor }, } = await request({
948
+ const { data: { results, nextCursor }, } = await request({
949
949
  httpMethod: 'GET',
950
950
  baseUri: this.syncApiBase,
951
951
  relativePath: ENDPOINT_REST_LABELS_SHARED,
@@ -1571,10 +1571,10 @@ export class TodoistApi {
1571
1571
  payload: queryParams,
1572
1572
  requestId: requestId,
1573
1573
  });
1574
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
1574
+ // oxlint-disable-next-line no-unsafe-assignment, no-unsafe-call, no-unsafe-member-access
1575
1575
  const validatedProjects = (_a = response.data.results) === null || _a === void 0 ? void 0 : _a.map((project) => validateProject(project));
1576
1576
  return Object.assign(Object.assign({}, response.data), {
1577
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1577
+ // oxlint-disable-next-line no-unsafe-assignment
1578
1578
  results: validatedProjects || [] });
1579
1579
  }
1580
1580
  /**
@@ -1602,10 +1602,10 @@ export class TodoistApi {
1602
1602
  payload: queryParams,
1603
1603
  requestId: requestId,
1604
1604
  });
1605
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
1605
+ // oxlint-disable-next-line no-unsafe-assignment, no-unsafe-call, no-unsafe-member-access
1606
1606
  const validatedProjects = (_a = response.data.results) === null || _a === void 0 ? void 0 : _a.map((project) => validateProject(project));
1607
1607
  return Object.assign(Object.assign({}, response.data), {
1608
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1608
+ // oxlint-disable-next-line no-unsafe-assignment
1609
1609
  results: validatedProjects || [] });
1610
1610
  }
1611
1611
  }
@@ -114,6 +114,8 @@ export const WorkspaceProjectSchema = BaseProjectSchema.extend({
114
114
  }).transform((data) => {
115
115
  return Object.assign(Object.assign({}, data), { url: getProjectUrl(data.id, data.name) });
116
116
  });
117
+ /** Available project view styles. */
118
+ export const PROJECT_VIEW_STYLES = ['list', 'board', 'calendar'];
117
119
  export const SectionSchema = z
118
120
  .object({
119
121
  id: z.string(),
@@ -1,7 +1,6 @@
1
1
  import { CustomError } from 'ts-custom-error';
2
2
  const authenticationErrorCodes = [401, 403];
3
3
  export class TodoistRequestError extends CustomError {
4
- // eslint-disable-next-line max-params
5
4
  constructor(message, httpStatusCode, responseData) {
6
5
  super(message);
7
6
  this.message = message;
@@ -1 +1,2 @@
1
- export {};
1
+ /** Available label delete cascade modes. */
2
+ export const LABEL_DELETE_CASCADE_MODES = ['none', 'all'];
@@ -1,4 +1,23 @@
1
1
  /**
2
2
  * Shared types used across multiple Sync API command argument types.
3
3
  */
4
- export {};
4
+ /** Available project workflow statuses. */
5
+ export const PROJECT_STATUSES = [
6
+ 'PLANNED',
7
+ 'IN_PROGRESS',
8
+ 'PAUSED',
9
+ 'COMPLETED',
10
+ 'CANCELED',
11
+ ];
12
+ /** Available default collaborator roles. */
13
+ export const COLLABORATOR_ROLES = [
14
+ 'CREATOR',
15
+ 'ADMIN',
16
+ 'READ_WRITE',
17
+ 'EDIT_ONLY',
18
+ 'COMPLETE_ONLY',
19
+ ];
20
+ /** Available reminder notification services. */
21
+ export const REMINDER_SERVICES = ['default', 'email', 'mobile', 'push', 'no_default'];
22
+ /** Available workspace project sort orders. */
23
+ export const WORKSPACE_PROJECT_SORT_ORDERS = ['MANUAL', 'A_TO_Z', 'Z_TO_A'];
@@ -1,7 +1,27 @@
1
1
  import { z } from 'zod';
2
- const DATE_FORMAT_FROM_API = { 0: 'DD/MM/YYYY', 1: 'MM/DD/YYYY' };
3
- const TIME_FORMAT_FROM_API = { 0: '24h', 1: '12h' };
4
- const DAY_OF_WEEK_FROM_API = {
2
+ /** Available date format options. */
3
+ export const DATE_FORMATS = ['DD/MM/YYYY', 'MM/DD/YYYY'];
4
+ /** Available time format options. */
5
+ export const TIME_FORMATS = ['24h', '12h'];
6
+ /** Available days of the week. */
7
+ export const DAYS_OF_WEEK = [
8
+ 'Monday',
9
+ 'Tuesday',
10
+ 'Wednesday',
11
+ 'Thursday',
12
+ 'Friday',
13
+ 'Saturday',
14
+ 'Sunday',
15
+ ];
16
+ export const DATE_FORMAT_FROM_API = {
17
+ 0: 'DD/MM/YYYY',
18
+ 1: 'MM/DD/YYYY',
19
+ };
20
+ export const TIME_FORMAT_FROM_API = {
21
+ 0: '24h',
22
+ 1: '12h',
23
+ };
24
+ export const DAY_OF_WEEK_FROM_API = {
5
25
  1: 'Monday',
6
26
  2: 'Tuesday',
7
27
  3: 'Wednesday',
@@ -14,7 +14,7 @@ function removeStyleFormatting(input) {
14
14
  if (!input.includes('!') && !input.includes('*') && !input.includes('_')) {
15
15
  return input;
16
16
  }
17
- function removeMarkdown(match, prefix, text) {
17
+ function removeMarkdown(_match, prefix, text) {
18
18
  return `${prefix}${text}`;
19
19
  }
20
20
  input = input.replace(BOLD_ITALIC_FORMAT, removeMarkdown);
@@ -23,7 +23,7 @@ function removeStyleFormatting(input) {
23
23
  return input;
24
24
  }
25
25
  function removeCodeFormatting(input) {
26
- function removeMarkdown(match, text) {
26
+ function removeMarkdown(_match, text) {
27
27
  return text;
28
28
  }
29
29
  input = input.replace(CODE_BLOCK_FORMAT, removeMarkdown);
@@ -43,7 +43,7 @@ function removeMarkdownLinks(input) {
43
43
  if (!input.includes('[') || !input.includes(']')) {
44
44
  return input;
45
45
  }
46
- function removeMarkdown(match, text) {
46
+ function removeMarkdown(_match, text) {
47
47
  return text;
48
48
  }
49
49
  return input.replace(MARKDOWN_LINK, removeMarkdown);
@@ -52,20 +52,20 @@ function removeTodoistLinks(input) {
52
52
  if (!input.includes('(') || !input.includes(')')) {
53
53
  return input;
54
54
  }
55
- function removeMarkdown(match, url, text) {
55
+ function removeMarkdown(_match, _url, text) {
56
56
  return text;
57
57
  }
58
58
  return input.replace(TODOIST_LINK, removeMarkdown);
59
59
  }
60
60
  function removeAppLinks(input) {
61
61
  if (input.includes('gmail')) {
62
- input = input.replace(GMAIL_LINK, (match, id, text) => text);
62
+ input = input.replace(GMAIL_LINK, (_match, _id, text) => text);
63
63
  }
64
64
  if (input.includes('outlook')) {
65
- input = input.replace(OUTLOOK_LINK, (match, id, text) => text);
65
+ input = input.replace(OUTLOOK_LINK, (_match, _id, text) => text);
66
66
  }
67
67
  if (input.includes('thunderbird')) {
68
- input = input.replace(THUNDERBIRD_LINK, (match, text) => text);
68
+ input = input.replace(THUNDERBIRD_LINK, (_match, text) => text);
69
69
  }
70
70
  return input;
71
71
  }
@@ -6,11 +6,13 @@ export type AuthOptions = {
6
6
  baseUrl?: string;
7
7
  customFetch?: CustomFetch;
8
8
  };
9
+ /** Available OAuth2 permission scopes. */
10
+ export declare const PERMISSIONS: readonly ["task:add", "data:read", "data:read_write", "data:delete", "project:delete", "backups:read"];
9
11
  /**
10
- * Permission scopes that can be requested during OAuth2 authorization.
12
+ * Permission scope that can be requested during OAuth2 authorization.
11
13
  * @see {@link https://todoist.com/api/v1/docs#tag/Authorization}
12
14
  */
13
- export type Permission = 'task:add' | 'data:read' | 'data:read_write' | 'data:delete' | 'project:delete' | 'backups:read';
15
+ export type Permission = (typeof PERMISSIONS)[number];
14
16
  /**
15
17
  * Parameters required to exchange an authorization code for an access token.
16
18
  * @see https://todoist.com/api/v1/docs#tag/Authorization/OAuth
@@ -69,7 +71,7 @@ export declare function getAuthStateParameter(): string;
69
71
  */
70
72
  export declare function getAuthorizationUrl({ clientId, permissions, state, baseUrl, }: {
71
73
  clientId: string;
72
- permissions: Permission[];
74
+ permissions: readonly Permission[];
73
75
  state: string;
74
76
  baseUrl?: string;
75
77
  }): string;
@@ -353,10 +353,13 @@ export type PersonalProject = z.infer<typeof PersonalProjectSchema>;
353
353
  * @see https://todoist.com/api/v1/docs#tag/Projects
354
354
  */
355
355
  export type WorkspaceProject = z.infer<typeof WorkspaceProjectSchema>;
356
+ /** Available project view styles. */
357
+ export declare const PROJECT_VIEW_STYLES: readonly ["list", "board", "calendar"];
356
358
  /**
359
+ * View style for a project.
357
360
  * @see https://todoist.com/api/v1/docs#tag/Projects
358
361
  */
359
- export type ProjectViewStyle = 'list' | 'board' | 'calendar';
362
+ export type ProjectViewStyle = (typeof PROJECT_VIEW_STYLES)[number];
360
363
  export declare const SectionSchema: z.ZodPipe<z.ZodObject<{
361
364
  id: z.ZodString;
362
365
  userId: z.ZodString;
@@ -19,9 +19,13 @@ export type LabelUpdateArgs = {
19
19
  export type LabelUpdateOrdersArgs = {
20
20
  idOrderMapping: Record<string, number>;
21
21
  };
22
+ /** Available label delete cascade modes. */
23
+ export declare const LABEL_DELETE_CASCADE_MODES: readonly ["none", "all"];
24
+ /** Cascade mode when deleting a label. */
25
+ export type LabelDeleteCascadeMode = (typeof LABEL_DELETE_CASCADE_MODES)[number];
22
26
  export type LabelDeleteArgs = {
23
27
  id: string;
24
- cascade?: 'none' | 'all';
28
+ cascade?: LabelDeleteCascadeMode;
25
29
  };
26
30
  export type LabelDeleteOccurrencesArgs = {
27
31
  name: string;
@@ -1,4 +1,5 @@
1
1
  import type { SyncDueDate, ReminderService } from './shared.js';
2
+ import type { LocationTrigger } from '../resources/reminders.js';
2
3
  export type ReminderAddArgs = {
3
4
  type: 'absolute';
4
5
  itemId: string;
@@ -19,7 +20,7 @@ export type ReminderAddArgs = {
19
20
  locLat: string;
20
21
  locLong: string;
21
22
  radius?: number;
22
- locTrigger?: 'on_enter' | 'on_leave';
23
+ locTrigger?: LocationTrigger;
23
24
  notifyUid?: string;
24
25
  };
25
26
  export type ReminderUpdateArgs = {
@@ -42,7 +43,7 @@ export type ReminderUpdateArgs = {
42
43
  locLat?: string;
43
44
  locLong?: string;
44
45
  radius?: number;
45
- locTrigger?: 'on_enter' | 'on_leave';
46
+ locTrigger?: LocationTrigger;
46
47
  notifyUid?: string;
47
48
  };
48
49
  export type ReminderDeleteArgs = {
@@ -31,16 +31,24 @@ export type SyncDuration = {
31
31
  } | null;
32
32
  /** Task priority: 1 = normal, 2 = medium, 3 = high, 4 = urgent. */
33
33
  export type TaskPriority = 1 | 2 | 3 | 4;
34
+ /** Available project workflow statuses. */
35
+ export declare const PROJECT_STATUSES: readonly ["PLANNED", "IN_PROGRESS", "PAUSED", "COMPLETED", "CANCELED"];
34
36
  /** Project workflow status. */
35
- export type ProjectStatus = 'PLANNED' | 'IN_PROGRESS' | 'PAUSED' | 'COMPLETED' | 'CANCELED';
37
+ export type ProjectStatus = (typeof PROJECT_STATUSES)[number];
38
+ /** Available default collaborator roles. */
39
+ export declare const COLLABORATOR_ROLES: readonly ["CREATOR", "ADMIN", "READ_WRITE", "EDIT_ONLY", "COMPLETE_ONLY"];
36
40
  /** Default collaborator role for a project. */
37
- export type CollaboratorRole = 'CREATOR' | 'ADMIN' | 'READ_WRITE' | 'EDIT_ONLY' | 'COMPLETE_ONLY';
41
+ export type CollaboratorRole = (typeof COLLABORATOR_ROLES)[number];
42
+ /** Available reminder notification services. */
43
+ export declare const REMINDER_SERVICES: readonly ["default", "email", "mobile", "push", "no_default"];
38
44
  /** Reminder notification service. */
39
- export type ReminderService = 'default' | 'email' | 'mobile' | 'push' | 'no_default';
45
+ export type ReminderService = (typeof REMINDER_SERVICES)[number];
40
46
  /**
41
47
  * Default access level for workspaces.
42
48
  * Same values as {@link ProjectVisibility} from entities.
43
49
  */
44
50
  export { type ProjectVisibility as DefaultAccessLevel } from '../../entities.js';
51
+ /** Available workspace project sort orders. */
52
+ export declare const WORKSPACE_PROJECT_SORT_ORDERS: readonly ["MANUAL", "A_TO_Z", "Z_TO_A"];
45
53
  /** Workspace project sort order preference. */
46
- export type WorkspaceProjectSortOrder = 'MANUAL' | 'A_TO_Z' | 'Z_TO_A';
54
+ export type WorkspaceProjectSortOrder = (typeof WORKSPACE_PROJECT_SORT_ORDERS)[number];
@@ -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", 2 | 1 | 3 | 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", 2 | 1 | 3 | 4 | 5 | 7 | 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", 2 | 1 | 3 | 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", 2 | 1 | 3 | 4 | 5 | 7 | 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>>;
@@ -1,7 +1,33 @@
1
1
  import { z } from 'zod';
2
- export type DateFormat = 'DD/MM/YYYY' | 'MM/DD/YYYY';
3
- export type TimeFormat = '24h' | '12h';
4
- export type DayOfWeek = 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday' | 'Sunday';
2
+ /** Available date format options. */
3
+ export declare const DATE_FORMATS: readonly ["DD/MM/YYYY", "MM/DD/YYYY"];
4
+ /** User date format preference. */
5
+ export type DateFormat = (typeof DATE_FORMATS)[number];
6
+ /** Available time format options. */
7
+ export declare const TIME_FORMATS: readonly ["24h", "12h"];
8
+ /** User time format preference. */
9
+ export type TimeFormat = (typeof TIME_FORMATS)[number];
10
+ /** Available days of the week. */
11
+ export declare const DAYS_OF_WEEK: readonly ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
12
+ /** Day of the week. */
13
+ export type DayOfWeek = (typeof DAYS_OF_WEEK)[number];
14
+ export declare const DATE_FORMAT_FROM_API: {
15
+ readonly 0: "DD/MM/YYYY";
16
+ readonly 1: "MM/DD/YYYY";
17
+ };
18
+ export declare const TIME_FORMAT_FROM_API: {
19
+ readonly 0: "24h";
20
+ readonly 1: "12h";
21
+ };
22
+ export declare const DAY_OF_WEEK_FROM_API: {
23
+ readonly 1: "Monday";
24
+ readonly 2: "Tuesday";
25
+ readonly 3: "Wednesday";
26
+ readonly 4: "Thursday";
27
+ readonly 5: "Friday";
28
+ readonly 6: "Saturday";
29
+ readonly 7: "Sunday";
30
+ };
5
31
  export declare const DATE_FORMAT_TO_API: Record<DateFormat, 0 | 1>;
6
32
  export declare const TIME_FORMAT_TO_API: Record<TimeFormat, 0 | 1>;
7
33
  export declare const DAY_OF_WEEK_TO_API: Record<DayOfWeek, 1 | 2 | 3 | 4 | 5 | 6 | 7>;
@@ -10,4 +36,4 @@ export declare const BooleanFromZeroOneSchema: z.ZodPipe<z.ZodUnion<readonly [z.
10
36
  /** Zod read-schemas: parse API numbers, emit descriptive strings */
11
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>>;
12
38
  export declare const TimeFormatSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>, z.ZodTransform<"24h" | "12h", 0 | 1>>;
13
- 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", 2 | 1 | 3 | 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", 2 | 1 | 3 | 4 | 5 | 7 | 6>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/todoist-api-typescript",
3
- "version": "7.3.0",
3
+ "version": "7.4.0",
4
4
  "description": "A typescript wrapper for the Todoist REST API.",
5
5
  "author": "Doist developers",
6
6
  "repository": "https://github.com/Doist/todoist-api-typescript",
@@ -25,8 +25,8 @@
25
25
  "clean": "rimraf dist",
26
26
  "format-check": "npx prettier --check \"./**/*.{ts,tsx,json,md,yml,babelrc,html}\" --ignore-path .prettierignore",
27
27
  "format-fix": "npx prettier --write \"./**/*.{ts,tsx,json,md,yml,babelrc,html}\" --ignore-path .prettierignore",
28
- "lint": "eslint ./src --ext ts,tsx --fix",
29
- "lint-check": "eslint ./src --ext ts,tsx",
28
+ "lint": "oxlint src --fix",
29
+ "lint-check": "oxlint src",
30
30
  "ts-compile-check": "npx tsc -p tsconfig.typecheck.json",
31
31
  "audit": "npm audit --audit-level=moderate",
32
32
  "test": "vitest run",
@@ -54,27 +54,20 @@
54
54
  "zod": "4.3.6"
55
55
  },
56
56
  "devDependencies": {
57
- "@doist/eslint-config": "12.0.0",
58
57
  "@doist/prettier-config": "4.0.0",
59
- "@typescript-eslint/eslint-plugin": "8.46.3",
60
- "@typescript-eslint/parser": "8.46.3",
61
58
  "dotenv": "17.3.1",
62
- "eslint": "8.57.1",
63
- "eslint-config-prettier": "8.7.0",
64
- "eslint-import-resolver-webpack": "0.13.2",
65
- "eslint-plugin-import": "2.27.5",
66
- "eslint-plugin-prettier": "5.1.3",
67
59
  "husky": "9.1.7",
68
60
  "lint-staged": "16.2.7",
69
61
  "msw": "2.12.10",
70
62
  "npm-run-all2": "8.0.4",
71
63
  "obsidian": "^1.10.2-1",
64
+ "oxlint": "1.57.0",
72
65
  "prettier": "3.3.2",
73
66
  "rimraf": "6.1.2",
74
- "vitest": "4.0.14",
75
67
  "ts-node": "10.9.2",
76
68
  "type-fest": "^5.0.0",
77
- "typescript": "5.9.3"
69
+ "typescript": "5.9.3",
70
+ "vitest": "4.0.14"
78
71
  },
79
72
  "peerDependencies": {
80
73
  "type-fest": "^4.12.0"
@@ -86,7 +79,7 @@
86
79
  }
87
80
  },
88
81
  "lint-staged": {
89
- "*.{ts,tsx}": "eslint --fix",
82
+ "*.{ts,tsx}": "oxlint --fix",
90
83
  "*.{ts,tsx,json,html,yml,yaml,md}": "prettier --check"
91
84
  },
92
85
  "files": [
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file is reserved for future test utilities
3
- // All network mocking is now handled by MSW in msw-setup.ts
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file is reserved for future test utilities
3
- // All network mocking is now handled by MSW in msw-setup.ts
File without changes