@doist/todoist-api-typescript 7.2.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.
Files changed (55) hide show
  1. package/dist/cjs/authentication.js +10 -0
  2. package/dist/cjs/rest-client.js +1 -1
  3. package/dist/cjs/test-utils/asserts.js +1 -1
  4. package/dist/cjs/test-utils/msw-setup.js +4 -3
  5. package/dist/cjs/todoist-api.js +6 -6
  6. package/dist/cjs/types/entities.js +45 -26
  7. package/dist/cjs/types/errors.js +0 -1
  8. package/dist/cjs/types/sync/commands/labels.js +3 -0
  9. package/dist/cjs/types/sync/commands/shared.js +21 -0
  10. package/dist/cjs/types/sync/resources/calendars.js +7 -3
  11. package/dist/cjs/types/sync/resources/collaborators.js +4 -2
  12. package/dist/cjs/types/sync/resources/reminders.js +8 -6
  13. package/dist/cjs/types/sync/resources/suggestions.js +11 -7
  14. package/dist/cjs/types/sync/resources/user-settings.js +5 -5
  15. package/dist/cjs/types/sync/resources/user.js +11 -15
  16. package/dist/cjs/types/sync/resources/view-options.js +33 -25
  17. package/dist/cjs/types/sync/user-preferences.js +27 -7
  18. package/dist/cjs/utils/sanitization.js +7 -7
  19. package/dist/esm/authentication.js +9 -0
  20. package/dist/esm/rest-client.js +1 -1
  21. package/dist/esm/test-utils/asserts.js +1 -1
  22. package/dist/esm/test-utils/msw-setup.js +1 -0
  23. package/dist/esm/todoist-api.js +6 -6
  24. package/dist/esm/types/entities.js +34 -15
  25. package/dist/esm/types/errors.js +0 -1
  26. package/dist/esm/types/sync/commands/labels.js +2 -1
  27. package/dist/esm/types/sync/commands/shared.js +20 -1
  28. package/dist/esm/types/sync/resources/calendars.js +6 -2
  29. package/dist/esm/types/sync/resources/collaborators.js +3 -1
  30. package/dist/esm/types/sync/resources/reminders.js +4 -2
  31. package/dist/esm/types/sync/resources/suggestions.js +8 -4
  32. package/dist/esm/types/sync/resources/user-settings.js +2 -2
  33. package/dist/esm/types/sync/resources/user.js +6 -10
  34. package/dist/esm/types/sync/resources/view-options.js +22 -14
  35. package/dist/esm/types/sync/user-preferences.js +23 -3
  36. package/dist/esm/utils/sanitization.js +7 -7
  37. package/dist/types/authentication.d.ts +5 -3
  38. package/dist/types/types/entities.d.ts +52 -2
  39. package/dist/types/types/sync/commands/labels.d.ts +5 -1
  40. package/dist/types/types/sync/commands/project-view-options.d.ts +2 -2
  41. package/dist/types/types/sync/commands/reminders.d.ts +3 -2
  42. package/dist/types/types/sync/commands/shared.d.ts +12 -4
  43. package/dist/types/types/sync/commands/view-options.d.ts +3 -7
  44. package/dist/types/types/sync/resources/calendars.d.ts +8 -0
  45. package/dist/types/types/sync/resources/collaborators.d.ts +4 -0
  46. package/dist/types/types/sync/resources/reminders.d.ts +11 -0
  47. package/dist/types/types/sync/resources/suggestions.d.ts +42 -0
  48. package/dist/types/types/sync/resources/user-settings.d.ts +8 -0
  49. package/dist/types/types/sync/resources/user.d.ts +32 -2
  50. package/dist/types/types/sync/resources/view-options.d.ts +75 -0
  51. package/dist/types/types/sync/user-preferences.d.ts +30 -4
  52. package/package.json +10 -17
  53. package/dist/cjs/test-utils/mocks.js +0 -3
  54. package/dist/esm/test-utils/mocks.js +0 -3
  55. package/dist/types/test-utils/mocks.d.ts +0 -0
@@ -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;
@@ -7,6 +7,7 @@ exports.getAllRequests = getAllRequests;
7
7
  exports.clearCapturedRequests = clearCapturedRequests;
8
8
  exports.mockApiResponse = mockApiResponse;
9
9
  exports.mockApiError = mockApiError;
10
+ const vitest_1 = require("vitest");
10
11
  const node_1 = require("msw/node");
11
12
  const msw_1 = require("msw");
12
13
  Object.defineProperty(exports, "http", { enumerable: true, get: function () { return msw_1.http; } });
@@ -82,15 +83,15 @@ function mockApiError({ endpoint, data, status, options = {}, }) {
82
83
  mockApiResponse({ endpoint, data, options: Object.assign(Object.assign({}, options), { status }) });
83
84
  }
84
85
  // Setup MSW for tests
85
- beforeAll(() => {
86
+ (0, vitest_1.beforeAll)(() => {
86
87
  exports.server.listen({
87
88
  onUnhandledRequest: 'error', // Throw errors for unhandled requests to catch unexpected fetch calls
88
89
  });
89
90
  });
90
- afterEach(() => {
91
+ (0, vitest_1.afterEach)(() => {
91
92
  exports.server.resetHandlers(); // Reset handlers between tests
92
93
  clearCapturedRequests(); // Clear captured requests between tests
93
94
  });
94
- afterAll(() => {
95
+ (0, vitest_1.afterAll)(() => {
95
96
  exports.server.close(); // Clean up after all tests
96
97
  });
@@ -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.FormattedPriceListingSchema = exports.PlanPriceSchema = exports.WorkspaceInvitationSchema = exports.WorkspaceUserSchema = exports.WorkspaceRoleSchema = exports.WORKSPACE_ROLES = exports.ActivityEventSchema = exports.ActivityEventExtraDataSchema = exports.ColorSchema = exports.ProductivityStatsSchema = exports.CurrentUserSchema = exports.TimezoneInfoSchema = exports.UserSchema = exports.CommentSchema = exports.RawCommentSchema = exports.AttachmentSchema = exports.LabelSchema = exports.SectionSchema = exports.WorkspaceProjectSchema = exports.ProjectVisibilitySchema = exports.PersonalProjectSchema = exports.BaseProjectSchema = exports.TaskSchema = exports.DeadlineSchema = exports.DurationSchema = 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");
@@ -26,9 +26,11 @@ exports.DueDateSchema = zod_1.z
26
26
  timezone: zod_1.z.string().nullable().optional(),
27
27
  lang: zod_1.z.string().nullable().optional(),
28
28
  });
29
+ /** Available duration units for task deadlines. */
30
+ exports.DURATION_UNITS = ['minute', 'day'];
29
31
  exports.DurationSchema = zod_1.z.object({
30
32
  amount: zod_1.z.number().positive('Value should be greater than zero'),
31
- unit: zod_1.z.enum(['minute', 'day']),
33
+ unit: zod_1.z.enum(exports.DURATION_UNITS),
32
34
  });
33
35
  exports.DeadlineSchema = zod_1.z.object({
34
36
  date: zod_1.z.string(),
@@ -97,7 +99,9 @@ exports.PersonalProjectSchema = exports.BaseProjectSchema.extend({
97
99
  }).transform((data) => {
98
100
  return Object.assign(Object.assign({}, data), { url: (0, url_helpers_1.getProjectUrl)(data.id, data.name) });
99
101
  });
100
- exports.ProjectVisibilitySchema = zod_1.z.enum(['restricted', 'team', 'public']);
102
+ /** Available project visibility levels. */
103
+ exports.PROJECT_VISIBILITIES = ['restricted', 'team', 'public'];
104
+ exports.ProjectVisibilitySchema = zod_1.z.enum(exports.PROJECT_VISIBILITIES);
101
105
  /**
102
106
  * Schema for workspace projects in Todoist.
103
107
  */
@@ -113,6 +117,8 @@ exports.WorkspaceProjectSchema = exports.BaseProjectSchema.extend({
113
117
  }).transform((data) => {
114
118
  return Object.assign(Object.assign({}, data), { url: (0, url_helpers_1.getProjectUrl)(data.id, data.name) });
115
119
  });
120
+ /** Available project view styles. */
121
+ exports.PROJECT_VIEW_STYLES = ['list', 'board', 'calendar'];
116
122
  exports.SectionSchema = zod_1.z
117
123
  .object({
118
124
  id: zod_1.z.string(),
@@ -137,6 +143,8 @@ exports.LabelSchema = zod_1.z.object({
137
143
  color: zod_1.z.string(),
138
144
  isFavorite: zod_1.z.boolean(),
139
145
  });
146
+ /** Available file attachment upload states. */
147
+ exports.UPLOAD_STATES = ['pending', 'completed'];
140
148
  exports.AttachmentSchema = zod_1.z
141
149
  .object({
142
150
  resourceType: zod_1.z.string(),
@@ -147,7 +155,7 @@ exports.AttachmentSchema = zod_1.z
147
155
  fileType: zod_1.z.string().nullable().optional(),
148
156
  fileUrl: zod_1.z.string().nullable().optional(),
149
157
  fileDuration: zod_1.z.number().int().nullable().optional(),
150
- uploadState: zod_1.z.enum(['pending', 'completed']).nullable().optional(),
158
+ uploadState: zod_1.z.enum(exports.UPLOAD_STATES).nullable().optional(),
151
159
  image: zod_1.z.string().nullable().optional(),
152
160
  imageWidth: zod_1.z.number().int().nullable().optional(),
153
161
  imageHeight: zod_1.z.number().int().nullable().optional(),
@@ -192,6 +200,13 @@ exports.TimezoneInfoSchema = zod_1.z.object({
192
200
  minutes: zod_1.z.number().int(),
193
201
  timezone: zod_1.z.string(),
194
202
  });
203
+ /** Available user premium statuses. */
204
+ exports.PREMIUM_STATUSES = [
205
+ 'not_premium',
206
+ 'current_personal_plan',
207
+ 'legacy_personal_plan',
208
+ 'teams_business_member',
209
+ ];
195
210
  exports.CurrentUserSchema = zod_1.z.object({
196
211
  id: zod_1.z.string(),
197
212
  email: zod_1.z.string(),
@@ -202,12 +217,7 @@ exports.CurrentUserSchema = zod_1.z.object({
202
217
  avatarSmall: zod_1.z.string().nullish(),
203
218
  businessAccountId: zod_1.z.string().nullable(),
204
219
  isPremium: zod_1.z.boolean(),
205
- premiumStatus: zod_1.z.enum([
206
- 'not_premium',
207
- 'current_personal_plan',
208
- 'legacy_personal_plan',
209
- 'teams_business_member',
210
- ]),
220
+ premiumStatus: zod_1.z.enum(exports.PREMIUM_STATUSES),
211
221
  dateFormat: zod_1.z.number().int(),
212
222
  timeFormat: zod_1.z.number().int(),
213
223
  weeklyGoal: zod_1.z.number().int(),
@@ -225,20 +235,20 @@ exports.CurrentUserSchema = zod_1.z.object({
225
235
  daysOff: zod_1.z.array(zod_1.z.number().int()),
226
236
  weekendStartDay: zod_1.z.number().int(),
227
237
  });
228
- const StreakSchema = zod_1.z.object({
238
+ exports.StreakSchema = zod_1.z.object({
229
239
  count: zod_1.z.number(),
230
240
  start: zod_1.z.string(),
231
241
  end: zod_1.z.string(),
232
242
  });
233
- const CompletedItemSchema = zod_1.z.object({
243
+ exports.CompletedItemSchema = zod_1.z.object({
234
244
  id: zod_1.z.string(),
235
245
  completed: zod_1.z.number(),
236
246
  });
237
- const ItemsWithDateSchema = zod_1.z.object({
238
- items: zod_1.z.array(CompletedItemSchema),
247
+ exports.ItemsWithDateSchema = zod_1.z.object({
248
+ items: zod_1.z.array(exports.CompletedItemSchema),
239
249
  totalCompleted: zod_1.z.number(),
240
250
  });
241
- const KarmaUpdateSchema = zod_1.z.object({
251
+ exports.KarmaUpdateSchema = zod_1.z.object({
242
252
  time: zod_1.z.string(),
243
253
  newKarma: zod_1.z.number(),
244
254
  positiveKarma: zod_1.z.number(),
@@ -248,19 +258,19 @@ const KarmaUpdateSchema = zod_1.z.object({
248
258
  });
249
259
  exports.ProductivityStatsSchema = zod_1.z.object({
250
260
  completedCount: zod_1.z.number(),
251
- daysItems: zod_1.z.array(ItemsWithDateSchema.extend({
261
+ daysItems: zod_1.z.array(exports.ItemsWithDateSchema.extend({
252
262
  date: zod_1.z.string(),
253
263
  })),
254
264
  goals: zod_1.z.object({
255
- currentDailyStreak: StreakSchema,
256
- currentWeeklyStreak: StreakSchema,
265
+ currentDailyStreak: exports.StreakSchema,
266
+ currentWeeklyStreak: exports.StreakSchema,
257
267
  dailyGoal: zod_1.z.number(),
258
268
  ignoreDays: zod_1.z.array(zod_1.z.number()),
259
269
  karmaDisabled: zod_1.z.number(),
260
- lastDailyStreak: StreakSchema,
261
- lastWeeklyStreak: StreakSchema,
262
- maxDailyStreak: StreakSchema,
263
- maxWeeklyStreak: StreakSchema,
270
+ lastDailyStreak: exports.StreakSchema,
271
+ lastWeeklyStreak: exports.StreakSchema,
272
+ maxDailyStreak: exports.StreakSchema,
273
+ maxWeeklyStreak: exports.StreakSchema,
264
274
  user: zod_1.z.string(),
265
275
  userId: zod_1.z.string(),
266
276
  vacationMode: zod_1.z.number(),
@@ -273,9 +283,9 @@ exports.ProductivityStatsSchema = zod_1.z.object({
273
283
  })),
274
284
  karmaLastUpdate: zod_1.z.number(),
275
285
  karmaTrend: zod_1.z.string(),
276
- karmaUpdateReasons: zod_1.z.array(KarmaUpdateSchema),
286
+ karmaUpdateReasons: zod_1.z.array(exports.KarmaUpdateSchema),
277
287
  projectColors: zod_1.z.record(zod_1.z.string(), zod_1.z.string()),
278
- weekItems: zod_1.z.array(ItemsWithDateSchema.extend({
288
+ weekItems: zod_1.z.array(exports.ItemsWithDateSchema.extend({
279
289
  from: zod_1.z.string(),
280
290
  to: zod_1.z.string(),
281
291
  })),
@@ -346,10 +356,19 @@ exports.FormattedPriceListingSchema = zod_1.z.object({
346
356
  interval: zod_1.z.string().optional(),
347
357
  formatted: zod_1.z.string().optional(),
348
358
  });
359
+ /** Available workspace plan names. */
360
+ exports.WORKSPACE_CURRENT_PLANS = ['Business', 'Starter'];
361
+ /** Available workspace plan statuses. */
362
+ exports.WORKSPACE_PLAN_STATUSES = [
363
+ 'Active',
364
+ 'Downgraded',
365
+ 'Cancelled',
366
+ 'NeverSubscribed',
367
+ ];
349
368
  exports.WorkspacePlanDetailsSchema = zod_1.z.object({
350
369
  currentMemberCount: zod_1.z.number(),
351
- currentPlan: zod_1.z.enum(['Business', 'Starter']),
352
- currentPlanStatus: zod_1.z.enum(['Active', 'Downgraded', 'Cancelled', 'NeverSubscribed']),
370
+ currentPlan: zod_1.z.enum(exports.WORKSPACE_CURRENT_PLANS),
371
+ currentPlanStatus: zod_1.z.enum(exports.WORKSPACE_PLAN_STATUSES),
353
372
  downgradeAt: zod_1.z.string().nullable(),
354
373
  currentActiveProjects: zod_1.z.number(),
355
374
  maximumActiveProjects: zod_1.z.number(),
@@ -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,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CalendarAccountSchema = exports.CalendarSchema = void 0;
3
+ exports.CalendarAccountSchema = exports.CALENDAR_SYNC_STATES = exports.CALENDAR_ACCOUNT_TYPES = exports.CalendarSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.CalendarSchema = zod_1.z
6
6
  .object({
@@ -12,16 +12,20 @@ exports.CalendarSchema = zod_1.z
12
12
  isTaskCalendar: zod_1.z.boolean().optional(),
13
13
  })
14
14
  .passthrough();
15
+ /** Available calendar account provider types. */
16
+ exports.CALENDAR_ACCOUNT_TYPES = ['google', 'microsoft', 'apple'];
17
+ /** Available calendar sync states. */
18
+ exports.CALENDAR_SYNC_STATES = ['synced', 'syncing', 'error'];
15
19
  exports.CalendarAccountSchema = zod_1.z
16
20
  .object({
17
21
  id: zod_1.z.string(),
18
22
  name: zod_1.z.string(),
19
- type: zod_1.z.enum(['google', 'microsoft', 'apple']),
23
+ type: zod_1.z.enum(exports.CALENDAR_ACCOUNT_TYPES),
20
24
  isDeleted: zod_1.z.boolean().optional(),
21
25
  isEventsEnabled: zod_1.z.boolean().optional(),
22
26
  isTasksEnabled: zod_1.z.boolean().optional(),
23
27
  isAllDayTasksEnabled: zod_1.z.boolean().optional(),
24
28
  pendingOperationUntil: zod_1.z.string().nullable().optional(),
25
- calendarsSyncState: zod_1.z.enum(['synced', 'syncing', 'error']).optional(),
29
+ calendarsSyncState: zod_1.z.enum(exports.CALENDAR_SYNC_STATES).optional(),
26
30
  })
27
31
  .passthrough();
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CollaboratorStateSchema = exports.CollaboratorSchema = void 0;
3
+ exports.CollaboratorStateSchema = exports.COLLABORATOR_STATUSES = exports.CollaboratorSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const entities_1 = require("../../entities");
6
6
  exports.CollaboratorSchema = zod_1.z
@@ -12,11 +12,13 @@ exports.CollaboratorSchema = zod_1.z
12
12
  imageId: zod_1.z.string().nullable(),
13
13
  })
14
14
  .passthrough();
15
+ /** Available collaborator statuses. */
16
+ exports.COLLABORATOR_STATUSES = ['active', 'invited'];
15
17
  exports.CollaboratorStateSchema = zod_1.z
16
18
  .object({
17
19
  userId: zod_1.z.string(),
18
20
  projectId: zod_1.z.string(),
19
- state: zod_1.z.enum(['active', 'invited']),
21
+ state: zod_1.z.enum(exports.COLLABORATOR_STATUSES),
20
22
  isDeleted: zod_1.z.boolean(),
21
23
  workspaceRole: entities_1.WorkspaceRoleSchema.optional(),
22
24
  })
@@ -1,28 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ReminderSchema = exports.RelativeReminderSchema = exports.AbsoluteReminderSchema = exports.LocationReminderSchema = void 0;
3
+ exports.ReminderSchema = exports.RelativeReminderSchema = exports.AbsoluteReminderSchema = exports.LocationReminderSchema = exports.LOCATION_TRIGGERS = exports.ReminderBaseSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const entities_1 = require("../../entities");
6
- const ReminderBaseSchema = zod_1.z.object({
6
+ exports.ReminderBaseSchema = zod_1.z.object({
7
7
  id: zod_1.z.string(),
8
8
  notifyUid: zod_1.z.string(),
9
9
  itemId: zod_1.z.string(),
10
10
  projectId: zod_1.z.string().optional(),
11
11
  isDeleted: zod_1.z.boolean(),
12
12
  });
13
- exports.LocationReminderSchema = ReminderBaseSchema.extend({
13
+ /** Available location reminder triggers. */
14
+ exports.LOCATION_TRIGGERS = ['on_enter', 'on_leave'];
15
+ exports.LocationReminderSchema = exports.ReminderBaseSchema.extend({
14
16
  type: zod_1.z.literal('location'),
15
17
  name: zod_1.z.string(),
16
18
  locLat: zod_1.z.string(),
17
19
  locLong: zod_1.z.string(),
18
- locTrigger: zod_1.z.enum(['on_enter', 'on_leave']),
20
+ locTrigger: zod_1.z.enum(exports.LOCATION_TRIGGERS),
19
21
  radius: zod_1.z.number().int(),
20
22
  }).passthrough();
21
- exports.AbsoluteReminderSchema = ReminderBaseSchema.extend({
23
+ exports.AbsoluteReminderSchema = exports.ReminderBaseSchema.extend({
22
24
  type: zod_1.z.literal('absolute'),
23
25
  due: entities_1.DueDateSchema,
24
26
  }).passthrough();
25
- exports.RelativeReminderSchema = ReminderBaseSchema.extend({
27
+ exports.RelativeReminderSchema = exports.ReminderBaseSchema.extend({
26
28
  type: zod_1.z.literal('relative'),
27
29
  minuteOffset: zod_1.z.number().int(),
28
30
  due: entities_1.DueDateSchema.optional(),
@@ -1,20 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SuggestionSchema = exports.WorkspaceTemplateSuggestionSchema = exports.TemplateSuggestionSchema = void 0;
3
+ exports.SuggestionSchema = exports.SyncWorkspaceTemplateSuggestionsSchema = exports.SyncTemplateSuggestionsSchema = exports.SUGGESTION_SECTION_TYPES = exports.WorkspaceTemplateSuggestionSchema = exports.TemplateSuggestionSchema = exports.TEMPLATE_TYPES = void 0;
4
4
  const zod_1 = require("zod");
5
+ /** Available template types. */
6
+ exports.TEMPLATE_TYPES = ['project', 'setup'];
5
7
  exports.TemplateSuggestionSchema = zod_1.z
6
8
  .object({
7
9
  id: zod_1.z.string(),
8
10
  name: zod_1.z.string(),
9
- templateType: zod_1.z.enum(['project', 'setup']),
11
+ templateType: zod_1.z.enum(exports.TEMPLATE_TYPES),
10
12
  })
11
13
  .passthrough();
12
14
  exports.WorkspaceTemplateSuggestionSchema = exports.TemplateSuggestionSchema.extend({
13
15
  workspaceId: zod_1.z.string().nullable(),
14
16
  });
15
- const SyncTemplateSuggestionsSchema = zod_1.z
17
+ /** Available suggestion section types. */
18
+ exports.SUGGESTION_SECTION_TYPES = ['templates', 'most_used_user_templates'];
19
+ exports.SyncTemplateSuggestionsSchema = zod_1.z
16
20
  .object({
17
- type: zod_1.z.enum(['templates', 'most_used_user_templates']),
21
+ type: zod_1.z.enum(exports.SUGGESTION_SECTION_TYPES),
18
22
  content: zod_1.z.object({
19
23
  templates: zod_1.z.array(exports.TemplateSuggestionSchema),
20
24
  locale: zod_1.z.string(),
@@ -22,7 +26,7 @@ const SyncTemplateSuggestionsSchema = zod_1.z
22
26
  isDeleted: zod_1.z.boolean(),
23
27
  })
24
28
  .passthrough();
25
- const SyncWorkspaceTemplateSuggestionsSchema = zod_1.z
29
+ exports.SyncWorkspaceTemplateSuggestionsSchema = zod_1.z
26
30
  .object({
27
31
  type: zod_1.z.literal('most_used_workspace_templates'),
28
32
  content: zod_1.z.object({
@@ -33,6 +37,6 @@ const SyncWorkspaceTemplateSuggestionsSchema = zod_1.z
33
37
  })
34
38
  .passthrough();
35
39
  exports.SuggestionSchema = zod_1.z.union([
36
- SyncWorkspaceTemplateSuggestionsSchema,
37
- SyncTemplateSuggestionsSchema,
40
+ exports.SyncWorkspaceTemplateSuggestionsSchema,
41
+ exports.SyncTemplateSuggestionsSchema,
38
42
  ]);
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserSettingsSchema = void 0;
3
+ exports.UserSettingsSchema = exports.QuickAddFeatureSchema = exports.NavigationFeatureSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- const NavigationFeatureSchema = zod_1.z.object({
5
+ exports.NavigationFeatureSchema = zod_1.z.object({
6
6
  name: zod_1.z.string(),
7
7
  shown: zod_1.z.boolean(),
8
8
  });
9
- const QuickAddFeatureSchema = zod_1.z.object({
9
+ exports.QuickAddFeatureSchema = zod_1.z.object({
10
10
  name: zod_1.z.string(),
11
11
  shown: zod_1.z.boolean(),
12
12
  });
@@ -22,7 +22,7 @@ exports.UserSettingsSchema = zod_1.z
22
22
  navigation: zod_1.z
23
23
  .object({
24
24
  countsShown: zod_1.z.boolean(),
25
- features: zod_1.z.array(NavigationFeatureSchema),
25
+ features: zod_1.z.array(exports.NavigationFeatureSchema),
26
26
  })
27
27
  .passthrough(),
28
28
  reminderDesktop: zod_1.z.boolean(),
@@ -35,7 +35,7 @@ exports.UserSettingsSchema = zod_1.z
35
35
  quickAdd: zod_1.z
36
36
  .object({
37
37
  labelsShown: zod_1.z.boolean(),
38
- features: zod_1.z.array(QuickAddFeatureSchema),
38
+ features: zod_1.z.array(exports.QuickAddFeatureSchema),
39
39
  })
40
40
  .passthrough(),
41
41
  })
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SyncUserSchema = void 0;
3
+ exports.SyncUserSchema = exports.GettingStartedGuideProjectSchema = exports.JoinableWorkspaceSchema = exports.TzInfoSchema = exports.FeaturesSchema = void 0;
4
4
  const zod_1 = require("zod");
5
+ const entities_1 = require("../../entities");
5
6
  const user_preferences_1 = require("../user-preferences");
6
- const FeaturesSchema = zod_1.z
7
+ exports.FeaturesSchema = zod_1.z
7
8
  .object({
8
9
  karmaDisabled: zod_1.z.boolean(),
9
10
  restriction: zod_1.z.number().int(),
@@ -17,7 +18,7 @@ const FeaturesSchema = zod_1.z
17
18
  migratedFromTdb: zod_1.z.boolean().optional(),
18
19
  })
19
20
  .passthrough();
20
- const TzInfoSchema = zod_1.z
21
+ exports.TzInfoSchema = zod_1.z
21
22
  .object({
22
23
  timezone: zod_1.z.string(),
23
24
  hours: zod_1.z.number().int(),
@@ -26,14 +27,14 @@ const TzInfoSchema = zod_1.z
26
27
  gmtString: zod_1.z.string(),
27
28
  })
28
29
  .passthrough();
29
- const JoinableWorkspaceSchema = zod_1.z
30
+ exports.JoinableWorkspaceSchema = zod_1.z
30
31
  .object({
31
32
  workspaceId: zod_1.z.string(),
32
33
  workspaceName: zod_1.z.string(),
33
34
  memberCount: zod_1.z.number().int(),
34
35
  })
35
36
  .passthrough();
36
- const GettingStartedGuideProjectSchema = zod_1.z
37
+ exports.GettingStartedGuideProjectSchema = zod_1.z
37
38
  .object({
38
39
  onboardingUseCase: zod_1.z.string(),
39
40
  projectId: zod_1.z.string(),
@@ -64,7 +65,7 @@ exports.SyncUserSchema = zod_1.z
64
65
  dateistLang: zod_1.z.string().nullable(),
65
66
  daysOff: zod_1.z.array(zod_1.z.number().int()),
66
67
  featureIdentifier: zod_1.z.string(),
67
- features: FeaturesSchema,
68
+ features: exports.FeaturesSchema,
68
69
  freeTrailExpires: zod_1.z.string().optional(),
69
70
  hasMagicNumber: zod_1.z.boolean(),
70
71
  hasPassword: zod_1.z.boolean(),
@@ -73,9 +74,9 @@ exports.SyncUserSchema = zod_1.z
73
74
  inboxProjectId: zod_1.z.string(),
74
75
  isCelebrationsEnabled: zod_1.z.boolean(),
75
76
  isPremium: zod_1.z.boolean(),
76
- joinableWorkspace: JoinableWorkspaceSchema.nullable(),
77
+ joinableWorkspace: exports.JoinableWorkspaceSchema.nullable(),
77
78
  joinedAt: zod_1.z.string(),
78
- gettingStartedGuideProjects: zod_1.z.array(GettingStartedGuideProjectSchema).nullable(),
79
+ gettingStartedGuideProjects: zod_1.z.array(exports.GettingStartedGuideProjectSchema).nullable(),
79
80
  karma: zod_1.z.number(),
80
81
  karmaTrend: zod_1.z.string(),
81
82
  lang: zod_1.z.string(),
@@ -91,12 +92,7 @@ exports.SyncUserSchema = zod_1.z
91
92
  onboardingSkipped: zod_1.z.boolean().optional(),
92
93
  onboardingTeamMode: zod_1.z.boolean().nullable().optional(),
93
94
  onboardingUseCases: zod_1.z.array(zod_1.z.string()).nullable().optional(),
94
- premiumStatus: zod_1.z.enum([
95
- 'not_premium',
96
- 'current_personal_plan',
97
- 'legacy_personal_plan',
98
- 'teams_business_member',
99
- ]),
95
+ premiumStatus: zod_1.z.enum(entities_1.PREMIUM_STATUSES),
100
96
  premiumUntil: zod_1.z.string().nullable(),
101
97
  rambleSessionsUsage: zod_1.z
102
98
  .object({
@@ -114,7 +110,7 @@ exports.SyncUserSchema = zod_1.z
114
110
  themeId: zod_1.z.string(),
115
111
  timeFormat: user_preferences_1.TimeFormatSchema,
116
112
  token: zod_1.z.string(),
117
- tzInfo: TzInfoSchema,
113
+ tzInfo: exports.TzInfoSchema,
118
114
  uniquePrefix: zod_1.z.number().int(),
119
115
  verificationStatus: zod_1.z.string(),
120
116
  websocketUrl: zod_1.z.string(),