@doist/todoist-sdk 8.1.0 → 8.2.1-next.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.
- package/README.md +23 -24
- package/dist/cjs/authentication.js +2 -2
- package/dist/cjs/test-utils/msw-setup.js +2 -2
- package/dist/cjs/todoist-api.js +10 -11
- package/dist/cjs/types/reminders/requests.js +1 -1
- package/dist/cjs/types/tasks/types.js +1 -1
- package/dist/cjs/utils/validators.js +40 -38
- package/dist/esm/authentication.js +2 -2
- package/dist/esm/test-utils/msw-setup.js +2 -2
- package/dist/esm/todoist-api.js +10 -11
- package/dist/esm/types/reminders/requests.js +1 -1
- package/dist/esm/types/tasks/types.js +1 -1
- package/dist/esm/utils/validators.js +10 -8
- package/dist/types/todoist-api.d.ts +16 -16
- package/dist/types/types/projects/requests.d.ts +1 -1
- package/dist/types/types/sync/commands/index.d.ts +12 -12
- package/dist/types/types/sync/commands/projects.d.ts +1 -1
- package/dist/types/types/sync/commands/reminders.d.ts +1 -1
- package/dist/types/types/sync/resources/view-options.d.ts +3 -3
- package/dist/types/types/sync/response.d.ts +2 -2
- package/dist/types/utils/validators.d.ts +62 -4
- package/package.json +6 -11
package/README.md
CHANGED
|
@@ -34,21 +34,21 @@ If you're migrating from an older version of the Todoist API (v9), please refer
|
|
|
34
34
|
|
|
35
35
|
Key changes in v1 include:
|
|
36
36
|
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
37
|
+
- Updated endpoint structure
|
|
38
|
+
- New pagination system
|
|
39
|
+
- Unified error response format
|
|
40
|
+
- Object renames (e.g., items → tasks, notes → comments)
|
|
41
|
+
- URL renames and endpoint signature changes
|
|
42
42
|
|
|
43
43
|
## Custom HTTP Clients
|
|
44
44
|
|
|
45
45
|
The Todoist API client supports custom HTTP implementations to enable usage in environments with specific networking requirements, such as:
|
|
46
46
|
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
47
|
+
- **Obsidian plugins** - Desktop app with strict CORS policies
|
|
48
|
+
- **Browser extensions** - Custom HTTP APIs with different security models
|
|
49
|
+
- **Electron apps** - Requests routed through IPC layer
|
|
50
|
+
- **React Native** - Different networking stack
|
|
51
|
+
- **Enterprise environments** - Proxy configuration, custom headers, or certificate handling
|
|
52
52
|
|
|
53
53
|
### Basic Usage
|
|
54
54
|
|
|
@@ -106,20 +106,20 @@ const { accessToken } = await getAuthToken(args, baseUrl)
|
|
|
106
106
|
|
|
107
107
|
### Important Notes
|
|
108
108
|
|
|
109
|
-
-
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
109
|
+
- All existing transforms (snake_case ↔ camelCase) work automatically with custom fetch
|
|
110
|
+
- Retry logic and error handling are preserved
|
|
111
|
+
- File uploads work with custom fetch implementations
|
|
112
|
+
- The custom fetch function should handle FormData for multipart uploads
|
|
113
|
+
- Timeout parameter is optional and up to your custom implementation
|
|
114
114
|
|
|
115
115
|
## Development and Testing
|
|
116
116
|
|
|
117
117
|
Instead of having an example app in the repository to assist development and testing, we have included [ts-node](https://github.com/TypeStrong/ts-node) as a dev dependency. This allows us to have a scratch file locally that can import and utilize the API while developing or reviewing pull requests without having to manage a separate app project.
|
|
118
118
|
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
119
|
+
- `npm install`
|
|
120
|
+
- Add a file named `scratch.ts` in the `src` folder.
|
|
121
|
+
- Configure your IDE to run the scratch file with `ts-node` (instructions for [VSCode](https://medium.com/@dupski/debug-typescript-in-vs-code-without-compiling-using-ts-node-9d1f4f9a94a), [WebStorm](https://www.jetbrains.com/help/webstorm/running-and-debugging-typescript.html#ws_ts_run_debug_server_side_ts_node)), or you can optionally run ts-node in a terminal using instructions [here](https://github.com/TypeStrong/ts-node) (`npx ts-node ./src/scratch.ts` should be enough).
|
|
122
|
+
- Import and call the relevant modules and run the scratch file.
|
|
123
123
|
|
|
124
124
|
Example scratch.ts file:
|
|
125
125
|
|
|
@@ -169,10 +169,10 @@ This project uses [Release Please](https://github.com/googleapis/release-please)
|
|
|
169
169
|
|
|
170
170
|
When making changes, use conventional commit messages:
|
|
171
171
|
|
|
172
|
-
-
|
|
173
|
-
-
|
|
174
|
-
-
|
|
175
|
-
-
|
|
172
|
+
- `feat:` - New features (triggers a minor version bump)
|
|
173
|
+
- `fix:` - Bug fixes (triggers a patch version bump)
|
|
174
|
+
- `feat!:` or `BREAKING CHANGE:` - Breaking changes (triggers a major version bump)
|
|
175
|
+
- `chore:`, `docs:`, `refactor:`, `perf:` - Other changes (included in changelog)
|
|
176
176
|
|
|
177
177
|
Example:
|
|
178
178
|
|
|
@@ -187,7 +187,6 @@ feat!: remove deprecated getTask method
|
|
|
187
187
|
The release process is fully automated:
|
|
188
188
|
|
|
189
189
|
1. **Automatic PR Creation**: When commits are merged to `main`, Release Please automatically creates or updates a release PR with:
|
|
190
|
-
|
|
191
190
|
- Updated version in `package.json`
|
|
192
191
|
- Updated `CHANGELOG.md`
|
|
193
192
|
- Aggregated changes since the last release
|
|
@@ -18,10 +18,10 @@ exports.getAuthToken = getAuthToken;
|
|
|
18
18
|
exports.revokeToken = revokeToken;
|
|
19
19
|
exports.migratePersonalToken = migratePersonalToken;
|
|
20
20
|
exports.registerClient = registerClient;
|
|
21
|
-
const http_client_1 = require("./transport/http-client");
|
|
22
21
|
const uuid_1 = require("uuid");
|
|
23
|
-
const types_1 = require("./types");
|
|
24
22
|
const endpoints_1 = require("./consts/endpoints");
|
|
23
|
+
const http_client_1 = require("./transport/http-client");
|
|
24
|
+
const types_1 = require("./types");
|
|
25
25
|
/** Available OAuth2 permission scopes. */
|
|
26
26
|
exports.PERMISSIONS = [
|
|
27
27
|
'task:add',
|
|
@@ -7,11 +7,11 @@ exports.getAllRequests = getAllRequests;
|
|
|
7
7
|
exports.clearCapturedRequests = clearCapturedRequests;
|
|
8
8
|
exports.mockApiResponse = mockApiResponse;
|
|
9
9
|
exports.mockApiError = mockApiError;
|
|
10
|
-
const vitest_1 = require("vitest");
|
|
11
|
-
const node_1 = require("msw/node");
|
|
12
10
|
const msw_1 = require("msw");
|
|
13
11
|
Object.defineProperty(exports, "http", { enumerable: true, get: function () { return msw_1.http; } });
|
|
14
12
|
Object.defineProperty(exports, "HttpResponse", { enumerable: true, get: function () { return msw_1.HttpResponse; } });
|
|
13
|
+
const node_1 = require("msw/node");
|
|
14
|
+
const vitest_1 = require("vitest");
|
|
15
15
|
// Request capture storage
|
|
16
16
|
const capturedRequests = [];
|
|
17
17
|
// Helper function to capture requests
|
package/dist/cjs/todoist-api.js
CHANGED
|
@@ -12,20 +12,19 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.TodoistApi = void 0;
|
|
15
|
-
const
|
|
16
|
-
const reminders_1 = require("./types/reminders");
|
|
17
|
-
const http_client_1 = require("./transport/http-client");
|
|
15
|
+
const zod_1 = require("zod");
|
|
18
16
|
const endpoints_1 = require("./consts/endpoints");
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const multipart_upload_1 = require("./utils/multipart-upload");
|
|
22
|
-
const case_conversion_1 = require("./utils/case-conversion");
|
|
17
|
+
const http_client_1 = require("./transport/http-client");
|
|
18
|
+
const reminders_1 = require("./types/reminders");
|
|
23
19
|
const activity_helpers_1 = require("./utils/activity-helpers");
|
|
20
|
+
const case_conversion_1 = require("./utils/case-conversion");
|
|
21
|
+
const multipart_upload_1 = require("./utils/multipart-upload");
|
|
24
22
|
const uncompletable_helpers_1 = require("./utils/uncompletable-helpers");
|
|
25
|
-
const
|
|
23
|
+
const url_helpers_1 = require("./utils/url-helpers");
|
|
24
|
+
const validators_1 = require("./utils/validators");
|
|
26
25
|
const uuid_1 = require("uuid");
|
|
27
|
-
const sync_1 = require("./types/sync");
|
|
28
26
|
const types_1 = require("./types");
|
|
27
|
+
const sync_1 = require("./types/sync");
|
|
29
28
|
const MAX_COMMAND_COUNT = 100;
|
|
30
29
|
/**
|
|
31
30
|
* Joins path segments using `/` separator.
|
|
@@ -792,14 +791,14 @@ class TodoistApi {
|
|
|
792
791
|
requestId: requestId,
|
|
793
792
|
});
|
|
794
793
|
return {
|
|
795
|
-
project:
|
|
794
|
+
project: (0, validators_1.validateWorkspaceProject)(data.project),
|
|
796
795
|
tasks: (0, validators_1.validateTaskArray)(data.tasks),
|
|
797
796
|
sections: (0, validators_1.validateSectionArray)(data.sections),
|
|
798
797
|
comments: (0, validators_1.validateNoteArray)(data.comments),
|
|
799
798
|
collaborators: (0, validators_1.validateCollaboratorArray)(data.collaborators),
|
|
800
799
|
collaboratorStates: (0, validators_1.validateCollaboratorStateArray)(data.collaboratorStates),
|
|
801
800
|
folder: data.folder ? (0, validators_1.validateFolder)(data.folder) : null,
|
|
802
|
-
subprojects:
|
|
801
|
+
subprojects: (0, validators_1.validateWorkspaceProjectArray)(data.subprojects),
|
|
803
802
|
};
|
|
804
803
|
}
|
|
805
804
|
/**
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UpdateLocationReminderArgsSchema = exports.UpdateReminderArgsSchema = exports.UpdateAbsoluteReminderArgsSchema = exports.UpdateRelativeReminderArgsSchema = exports.AddLocationReminderArgsSchema = exports.AddReminderArgsSchema = exports.AddAbsoluteReminderArgsSchema = exports.AddRelativeReminderArgsSchema = exports.ReminderDueDateSchema = exports.ReminderIdSchema = exports.ReminderDeliveryServiceSchema = exports.REMINDER_DELIVERY_SERVICES = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const types_1 = require("../tasks/types");
|
|
6
5
|
const reminders_1 = require("../sync/resources/reminders");
|
|
6
|
+
const types_1 = require("../tasks/types");
|
|
7
7
|
/** Available reminder delivery services. */
|
|
8
8
|
exports.REMINDER_DELIVERY_SERVICES = ['email', 'push'];
|
|
9
9
|
exports.ReminderDeliveryServiceSchema = zod_1.z.enum(exports.REMINDER_DELIVERY_SERVICES);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TaskSchema = exports.DeadlineSchema = exports.DurationSchema = exports.DURATION_UNITS = exports.DueDateSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const url_helpers_1 = require("../../utils/url-helpers");
|
|
6
5
|
const uncompletable_helpers_1 = require("../../utils/uncompletable-helpers");
|
|
6
|
+
const url_helpers_1 = require("../../utils/url-helpers");
|
|
7
7
|
exports.DueDateSchema = zod_1.z
|
|
8
8
|
.object({
|
|
9
9
|
isRecurring: zod_1.z.boolean(),
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.validateSuggestionArray = exports.validateSuggestion = exports.validateUserSettings = exports.validateSyncUser = exports.validateSyncWorkspaceArray = exports.validateSyncWorkspace = exports.validateLiveNotificationArray = exports.validateLiveNotification = exports.validateUserPlanLimits = exports.validateProjectViewOptionsDefaultsArray = exports.validateProjectViewOptionsDefaults = exports.validateViewOptionsArray = exports.validateViewOptions = exports.validateCompletedInfoArray = exports.validateCompletedInfo = exports.validateLocationReminderArray = exports.validateLocationReminder = exports.validateReminderArray = exports.validateReminder = exports.validateCalendarAccountArray = exports.validateCalendarAccount = exports.validateCalendarArray = exports.validateCalendar = exports.validateWorkspaceGoalArray = exports.validateWorkspaceGoal = void 0;
|
|
3
|
+
exports.validateTooltips = exports.validateNoteArray = exports.validateNote = exports.validateFolderArray = exports.validateFolder = exports.validateCollaboratorStateArray = exports.validateCollaboratorState = exports.validateCollaboratorArray = exports.validateCollaborator = exports.validateFilterArray = exports.validateFilter = exports.validateMovedIdArray = exports.validateMovedId = exports.validateIdMappingArray = exports.validateIdMapping = exports.validateBackupArray = exports.validateBackup = exports.validateWorkspaceInsights = exports.validateProjectProgress = exports.validateProjectHealthContext = exports.validateProjectHealth = exports.validateProjectActivityStats = exports.validateWorkspaceUserTaskArray = exports.validateWorkspaceUserTask = exports.validateMemberActivityInfoArray = exports.validateMemberActivityInfo = exports.validateWorkspaceArray = exports.validateWorkspace = exports.validateJoinWorkspaceResult = exports.validateWorkspacePlanDetails = exports.validateWorkspaceInvitationArray = exports.validateWorkspaceInvitation = exports.validateWorkspaceUser = exports.validateAttachment = exports.validateActivityEventArray = exports.validateActivityEvent = exports.validateCurrentUser = exports.validateProductivityStats = exports.validateUserArray = exports.validateUser = exports.validateCommentArray = exports.validateComment = exports.validateLabelArray = exports.validateLabel = exports.validateSectionArray = exports.validateSection = exports.validateWorkspaceProjectArray = exports.validateWorkspaceProject = exports.validateTaskArray = exports.validateTask = void 0;
|
|
4
|
+
exports.validateSuggestionArray = exports.validateSuggestion = exports.validateUserSettings = exports.validateSyncUser = exports.validateSyncWorkspaceArray = exports.validateSyncWorkspace = exports.validateLiveNotificationArray = exports.validateLiveNotification = exports.validateUserPlanLimits = exports.validateProjectViewOptionsDefaultsArray = exports.validateProjectViewOptionsDefaults = exports.validateViewOptionsArray = exports.validateViewOptions = exports.validateCompletedInfoArray = exports.validateCompletedInfo = exports.validateLocationReminderArray = exports.validateLocationReminder = exports.validateReminderArray = exports.validateReminder = exports.validateCalendarAccountArray = exports.validateCalendarAccount = exports.validateCalendarArray = exports.validateCalendar = exports.validateWorkspaceGoalArray = exports.validateWorkspaceGoal = exports.validateWorkspaceFilterArray = exports.validateWorkspaceFilter = void 0;
|
|
5
5
|
exports.isWorkspaceProject = isWorkspaceProject;
|
|
6
6
|
exports.isPersonalProject = isPersonalProject;
|
|
7
7
|
exports.validateProject = validateProject;
|
|
8
8
|
exports.validateProjectArray = validateProjectArray;
|
|
9
9
|
exports.validateWorkspaceUserArray = validateWorkspaceUserArray;
|
|
10
|
-
const types_1 = require("../types/
|
|
11
|
-
const types_2 = require("../types/
|
|
12
|
-
const types_3 = require("../types/
|
|
13
|
-
const types_4 = require("../types/
|
|
14
|
-
const types_5 = require("../types/
|
|
15
|
-
const types_6 = require("../types/
|
|
10
|
+
const types_1 = require("../types/activity/types");
|
|
11
|
+
const types_2 = require("../types/backups/types");
|
|
12
|
+
const types_3 = require("../types/comments/types");
|
|
13
|
+
const types_4 = require("../types/id-mappings/types");
|
|
14
|
+
const types_5 = require("../types/insights/types");
|
|
15
|
+
const types_6 = require("../types/labels/types");
|
|
16
16
|
const types_7 = require("../types/productivity/types");
|
|
17
|
-
const types_8 = require("../types/
|
|
18
|
-
const types_9 = require("../types/
|
|
19
|
-
const types_10 = require("../types/
|
|
20
|
-
const types_11 = require("../types/
|
|
21
|
-
const types_12 = require("../types/
|
|
17
|
+
const types_8 = require("../types/projects/types");
|
|
18
|
+
const types_9 = require("../types/sections/types");
|
|
19
|
+
const types_10 = require("../types/tasks/types");
|
|
20
|
+
const types_11 = require("../types/users/types");
|
|
21
|
+
const types_12 = require("../types/workspaces/types");
|
|
22
22
|
const resources_1 = require("../types/sync/resources");
|
|
23
23
|
function createValidator(schema) {
|
|
24
24
|
return (input) => schema.parse(input);
|
|
@@ -27,7 +27,7 @@ function createArrayValidator(validateItem) {
|
|
|
27
27
|
return (input) => input.map(validateItem);
|
|
28
28
|
}
|
|
29
29
|
// Entity validators
|
|
30
|
-
exports.validateTask = createValidator(
|
|
30
|
+
exports.validateTask = createValidator(types_10.TaskSchema);
|
|
31
31
|
exports.validateTaskArray = createArrayValidator(exports.validateTask);
|
|
32
32
|
/**
|
|
33
33
|
* Type guard to check if a project is a workspace project.
|
|
@@ -52,53 +52,55 @@ function isPersonalProject(project) {
|
|
|
52
52
|
*/
|
|
53
53
|
function validateProject(input) {
|
|
54
54
|
if ('workspaceId' in input) {
|
|
55
|
-
return
|
|
55
|
+
return types_8.WorkspaceProjectSchema.parse(input);
|
|
56
56
|
}
|
|
57
|
-
return
|
|
57
|
+
return types_8.PersonalProjectSchema.parse(input);
|
|
58
58
|
}
|
|
59
59
|
function validateProjectArray(input) {
|
|
60
60
|
return input.map(validateProject);
|
|
61
61
|
}
|
|
62
|
-
exports.
|
|
62
|
+
exports.validateWorkspaceProject = createValidator(types_8.WorkspaceProjectSchema);
|
|
63
|
+
exports.validateWorkspaceProjectArray = createArrayValidator(exports.validateWorkspaceProject);
|
|
64
|
+
exports.validateSection = createValidator(types_9.SectionSchema);
|
|
63
65
|
exports.validateSectionArray = createArrayValidator(exports.validateSection);
|
|
64
|
-
exports.validateLabel = createValidator(
|
|
66
|
+
exports.validateLabel = createValidator(types_6.LabelSchema);
|
|
65
67
|
exports.validateLabelArray = createArrayValidator(exports.validateLabel);
|
|
66
|
-
exports.validateComment = createValidator(
|
|
68
|
+
exports.validateComment = createValidator(types_3.CommentSchema);
|
|
67
69
|
exports.validateCommentArray = createArrayValidator(exports.validateComment);
|
|
68
|
-
exports.validateUser = createValidator(
|
|
70
|
+
exports.validateUser = createValidator(types_11.UserSchema);
|
|
69
71
|
exports.validateUserArray = createArrayValidator(exports.validateUser);
|
|
70
72
|
exports.validateProductivityStats = createValidator(types_7.ProductivityStatsSchema);
|
|
71
|
-
exports.validateCurrentUser = createValidator(
|
|
72
|
-
exports.validateActivityEvent = createValidator(
|
|
73
|
+
exports.validateCurrentUser = createValidator(types_11.CurrentUserSchema);
|
|
74
|
+
exports.validateActivityEvent = createValidator(types_1.ActivityEventSchema);
|
|
73
75
|
exports.validateActivityEventArray = createArrayValidator(exports.validateActivityEvent);
|
|
74
|
-
exports.validateAttachment = createValidator(
|
|
75
|
-
exports.validateWorkspaceUser = createValidator(
|
|
76
|
+
exports.validateAttachment = createValidator(types_3.AttachmentSchema);
|
|
77
|
+
exports.validateWorkspaceUser = createValidator(types_12.WorkspaceUserSchema);
|
|
76
78
|
function validateWorkspaceUserArray(input) {
|
|
77
79
|
if (!Array.isArray(input)) {
|
|
78
80
|
throw new Error(`Expected array for workspace users, got ${typeof input}`);
|
|
79
81
|
}
|
|
80
82
|
return input.map(exports.validateWorkspaceUser);
|
|
81
83
|
}
|
|
82
|
-
exports.validateWorkspaceInvitation = createValidator(
|
|
84
|
+
exports.validateWorkspaceInvitation = createValidator(types_12.WorkspaceInvitationSchema);
|
|
83
85
|
exports.validateWorkspaceInvitationArray = createArrayValidator(exports.validateWorkspaceInvitation);
|
|
84
|
-
exports.validateWorkspacePlanDetails = createValidator(
|
|
85
|
-
exports.validateJoinWorkspaceResult = createValidator(
|
|
86
|
-
exports.validateWorkspace = createValidator(
|
|
86
|
+
exports.validateWorkspacePlanDetails = createValidator(types_12.WorkspacePlanDetailsSchema);
|
|
87
|
+
exports.validateJoinWorkspaceResult = createValidator(types_12.JoinWorkspaceResultSchema);
|
|
88
|
+
exports.validateWorkspace = createValidator(types_12.WorkspaceSchema);
|
|
87
89
|
exports.validateWorkspaceArray = createArrayValidator(exports.validateWorkspace);
|
|
88
|
-
exports.validateMemberActivityInfo = createValidator(
|
|
90
|
+
exports.validateMemberActivityInfo = createValidator(types_12.MemberActivityInfoSchema);
|
|
89
91
|
exports.validateMemberActivityInfoArray = createArrayValidator(exports.validateMemberActivityInfo);
|
|
90
|
-
exports.validateWorkspaceUserTask = createValidator(
|
|
92
|
+
exports.validateWorkspaceUserTask = createValidator(types_12.WorkspaceUserTaskSchema);
|
|
91
93
|
exports.validateWorkspaceUserTaskArray = createArrayValidator(exports.validateWorkspaceUserTask);
|
|
92
|
-
exports.validateProjectActivityStats = createValidator(
|
|
93
|
-
exports.validateProjectHealth = createValidator(
|
|
94
|
-
exports.validateProjectHealthContext = createValidator(
|
|
95
|
-
exports.validateProjectProgress = createValidator(
|
|
96
|
-
exports.validateWorkspaceInsights = createValidator(
|
|
97
|
-
exports.validateBackup = createValidator(
|
|
94
|
+
exports.validateProjectActivityStats = createValidator(types_5.ProjectActivityStatsSchema);
|
|
95
|
+
exports.validateProjectHealth = createValidator(types_5.ProjectHealthSchema);
|
|
96
|
+
exports.validateProjectHealthContext = createValidator(types_5.ProjectHealthContextSchema);
|
|
97
|
+
exports.validateProjectProgress = createValidator(types_5.ProjectProgressSchema);
|
|
98
|
+
exports.validateWorkspaceInsights = createValidator(types_5.WorkspaceInsightsSchema);
|
|
99
|
+
exports.validateBackup = createValidator(types_2.BackupSchema);
|
|
98
100
|
exports.validateBackupArray = createArrayValidator(exports.validateBackup);
|
|
99
|
-
exports.validateIdMapping = createValidator(
|
|
101
|
+
exports.validateIdMapping = createValidator(types_4.IdMappingSchema);
|
|
100
102
|
exports.validateIdMappingArray = createArrayValidator(exports.validateIdMapping);
|
|
101
|
-
exports.validateMovedId = createValidator(
|
|
103
|
+
exports.validateMovedId = createValidator(types_4.MovedIdSchema);
|
|
102
104
|
exports.validateMovedIdArray = createArrayValidator(exports.validateMovedId);
|
|
103
105
|
// Sync resource validators
|
|
104
106
|
exports.validateFilter = createValidator(resources_1.FilterSchema);
|
|
@@ -9,10 +9,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { request, isSuccess } from './transport/http-client.js';
|
|
13
12
|
import { v4 as uuid } from 'uuid';
|
|
14
|
-
import { TodoistRequestError } from './types/index.js';
|
|
15
13
|
import { getAuthBaseUri, getSyncBaseUri, ENDPOINT_AUTHORIZATION, ENDPOINT_GET_TOKEN, ENDPOINT_REVOKE, ENDPOINT_REGISTER, ENDPOINT_REST_ACCESS_TOKENS_MIGRATE, } from './consts/endpoints.js';
|
|
14
|
+
import { request, isSuccess } from './transport/http-client.js';
|
|
15
|
+
import { TodoistRequestError } from './types/index.js';
|
|
16
16
|
/** Available OAuth2 permission scopes. */
|
|
17
17
|
export const PERMISSIONS = [
|
|
18
18
|
'task:add',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { beforeAll, afterEach, afterAll } from 'vitest';
|
|
2
|
-
import { setupServer } from 'msw/node';
|
|
3
1
|
import { http, HttpResponse } from 'msw';
|
|
2
|
+
import { setupServer } from 'msw/node';
|
|
3
|
+
import { beforeAll, afterEach, afterAll } from 'vitest';
|
|
4
4
|
// Request capture storage
|
|
5
5
|
const capturedRequests = [];
|
|
6
6
|
// Helper function to capture requests
|
package/dist/esm/todoist-api.js
CHANGED
|
@@ -9,20 +9,19 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
13
|
-
import { UpdateReminderArgsSchema, UpdateLocationReminderArgsSchema, ReminderIdSchema, } from './types/reminders/index.js';
|
|
14
|
-
import { request, isSuccess } from './transport/http-client.js';
|
|
12
|
+
import { z } from 'zod';
|
|
15
13
|
import { getSyncBaseUri, ENDPOINT_REST_TASKS, ENDPOINT_REST_TASKS_FILTER, ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE, ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE, ENDPOINT_REST_TASKS_COMPLETED_SEARCH, ENDPOINT_REST_TASKS_COMPLETED, ENDPOINT_REST_TEMPLATES_FILE, ENDPOINT_REST_TEMPLATES_URL, ENDPOINT_REST_TEMPLATES_CREATE_FROM_FILE, ENDPOINT_REST_TEMPLATES_IMPORT_FROM_FILE, ENDPOINT_REST_TEMPLATES_IMPORT_FROM_ID, ENDPOINT_REST_PROJECTS, ENDPOINT_REST_PROJECTS_SEARCH, ENDPOINT_SYNC_QUICK_ADD, ENDPOINT_REST_TASK_CLOSE, ENDPOINT_REST_TASK_REOPEN, ENDPOINT_REST_TASK_MOVE, ENDPOINT_REST_LABELS, ENDPOINT_REST_LABELS_SEARCH, ENDPOINT_REST_PROJECT_COLLABORATORS, ENDPOINT_REST_SECTIONS, ENDPOINT_REST_SECTIONS_SEARCH, ENDPOINT_REST_COMMENTS, ENDPOINT_REST_LOCATION_REMINDERS, ENDPOINT_REST_REMINDERS, ENDPOINT_REST_LABELS_SHARED, ENDPOINT_REST_LABELS_SHARED_RENAME, ENDPOINT_REST_LABELS_SHARED_REMOVE, ENDPOINT_SYNC, PROJECT_ARCHIVE, PROJECT_UNARCHIVE, ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE, ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL, ENDPOINT_REST_PROJECTS_ARCHIVED, ENDPOINT_REST_PROJECTS_ARCHIVED_COUNT, ENDPOINT_REST_PROJECTS_PERMISSIONS, ENDPOINT_REST_PROJECT_FULL, ENDPOINT_REST_PROJECT_JOIN, SECTION_ARCHIVE, SECTION_UNARCHIVE, ENDPOINT_REST_USER, ENDPOINT_REST_PRODUCTIVITY, ENDPOINT_REST_ACTIVITIES, ENDPOINT_REST_UPLOADS, getProjectInsightsActivityStatsEndpoint, getProjectInsightsHealthEndpoint, getProjectInsightsHealthContextEndpoint, getProjectInsightsProgressEndpoint, getProjectInsightsHealthAnalyzeEndpoint, getWorkspaceInsightsEndpoint, ENDPOINT_REST_BACKUPS, ENDPOINT_REST_BACKUPS_DOWNLOAD, ENDPOINT_REST_EMAILS, ENDPOINT_REST_ID_MAPPINGS, ENDPOINT_REST_MOVED_IDS, ENDPOINT_REST_WORKSPACES, ENDPOINT_WORKSPACE_MEMBERS, getWorkspaceUserTasksEndpoint, getWorkspaceInviteUsersEndpoint, getWorkspaceUserEndpoint, ENDPOINT_WORKSPACE_INVITATIONS, ENDPOINT_WORKSPACE_INVITATIONS_ALL, ENDPOINT_WORKSPACE_INVITATIONS_DELETE, getWorkspaceInvitationAcceptEndpoint, getWorkspaceInvitationRejectEndpoint, ENDPOINT_WORKSPACE_JOIN, ENDPOINT_WORKSPACE_LOGO, ENDPOINT_WORKSPACE_PLAN_DETAILS, ENDPOINT_WORKSPACE_USERS, getWorkspaceActiveProjectsEndpoint, getWorkspaceArchivedProjectsEndpoint, ENDPOINT_REST_FOLDERS, } from './consts/endpoints.js';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { uploadMultipartFile } from './utils/multipart-upload.js';
|
|
19
|
-
import { camelCaseKeys } from './utils/case-conversion.js';
|
|
14
|
+
import { request, isSuccess } from './transport/http-client.js';
|
|
15
|
+
import { UpdateReminderArgsSchema, UpdateLocationReminderArgsSchema, ReminderIdSchema, } from './types/reminders/index.js';
|
|
20
16
|
import { normalizeObjectEventTypeForApi, denormalizeObjectTypeFromApi, } from './utils/activity-helpers.js';
|
|
17
|
+
import { camelCaseKeys } from './utils/case-conversion.js';
|
|
18
|
+
import { uploadMultipartFile } from './utils/multipart-upload.js';
|
|
21
19
|
import { processTaskContent } from './utils/uncompletable-helpers.js';
|
|
22
|
-
import {
|
|
20
|
+
import { formatDateToYYYYMMDD } from './utils/url-helpers.js';
|
|
21
|
+
import { validateAttachment, validateComment, validateCommentArray, validateCurrentUser, validateLabel, validateLabelArray, validateProject, validateProjectArray, validateSection, validateSectionArray, validateTask, validateTaskArray, validateUserArray, validateProductivityStats, validateReminder, validateReminderArray, validateLocationReminderArray, validateActivityEventArray, validateWorkspaceUserArray, validateWorkspaceInvitation, validateWorkspaceInvitationArray, validateWorkspacePlanDetails, validateJoinWorkspaceResult, validateWorkspace, validateWorkspaceArray, validateMemberActivityInfoArray, validateWorkspaceUserTaskArray, validateProjectActivityStats, validateProjectHealth, validateProjectHealthContext, validateProjectProgress, validateWorkspaceInsights, validateBackupArray, validateIdMappingArray, validateMovedIdArray, validateFolder, validateFolderArray, validateCollaboratorArray, validateCollaboratorStateArray, validateNoteArray, validateWorkspaceProject, validateWorkspaceProjectArray, } from './utils/validators.js';
|
|
23
22
|
import { v4 as uuidv4 } from 'uuid';
|
|
24
|
-
import { DATE_FORMAT_TO_API, TIME_FORMAT_TO_API, DAY_OF_WEEK_TO_API, } from './types/sync/index.js';
|
|
25
23
|
import { TodoistArgumentError, TodoistRequestError } from './types/index.js';
|
|
24
|
+
import { DATE_FORMAT_TO_API, TIME_FORMAT_TO_API, DAY_OF_WEEK_TO_API, } from './types/sync/index.js';
|
|
26
25
|
const MAX_COMMAND_COUNT = 100;
|
|
27
26
|
/**
|
|
28
27
|
* Joins path segments using `/` separator.
|
|
@@ -789,14 +788,14 @@ export class TodoistApi {
|
|
|
789
788
|
requestId: requestId,
|
|
790
789
|
});
|
|
791
790
|
return {
|
|
792
|
-
project:
|
|
791
|
+
project: validateWorkspaceProject(data.project),
|
|
793
792
|
tasks: validateTaskArray(data.tasks),
|
|
794
793
|
sections: validateSectionArray(data.sections),
|
|
795
794
|
comments: validateNoteArray(data.comments),
|
|
796
795
|
collaborators: validateCollaboratorArray(data.collaborators),
|
|
797
796
|
collaboratorStates: validateCollaboratorStateArray(data.collaboratorStates),
|
|
798
797
|
folder: data.folder ? validateFolder(data.folder) : null,
|
|
799
|
-
subprojects: data.subprojects
|
|
798
|
+
subprojects: validateWorkspaceProjectArray(data.subprojects),
|
|
800
799
|
};
|
|
801
800
|
}
|
|
802
801
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { DueDateSchema } from '../tasks/types.js';
|
|
3
2
|
import { LOCATION_TRIGGERS, ReminderTypeEnum } from '../sync/resources/reminders.js';
|
|
3
|
+
import { DueDateSchema } from '../tasks/types.js';
|
|
4
4
|
/** Available reminder delivery services. */
|
|
5
5
|
export const REMINDER_DELIVERY_SERVICES = ['email', 'push'];
|
|
6
6
|
export const ReminderDeliveryServiceSchema = z.enum(REMINDER_DELIVERY_SERVICES);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { getTaskUrl } from '../../utils/url-helpers.js';
|
|
3
2
|
import { hasUncompletablePrefix } from '../../utils/uncompletable-helpers.js';
|
|
3
|
+
import { getTaskUrl } from '../../utils/url-helpers.js';
|
|
4
4
|
export const DueDateSchema = z
|
|
5
5
|
.object({
|
|
6
6
|
isRecurring: z.boolean(),
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ActivityEventSchema } from '../types/activity/types.js';
|
|
2
|
+
import { BackupSchema } from '../types/backups/types.js';
|
|
3
|
+
import { AttachmentSchema, CommentSchema } from '../types/comments/types.js';
|
|
4
|
+
import { IdMappingSchema, MovedIdSchema } from '../types/id-mappings/types.js';
|
|
5
|
+
import { ProjectActivityStatsSchema, ProjectHealthSchema, ProjectHealthContextSchema, ProjectProgressSchema, WorkspaceInsightsSchema, } from '../types/insights/types.js';
|
|
6
|
+
import { LabelSchema } from '../types/labels/types.js';
|
|
7
|
+
import { ProductivityStatsSchema } from '../types/productivity/types.js';
|
|
2
8
|
import { PersonalProjectSchema, WorkspaceProjectSchema, } from '../types/projects/types.js';
|
|
3
9
|
import { SectionSchema } from '../types/sections/types.js';
|
|
4
|
-
import {
|
|
5
|
-
import { AttachmentSchema, CommentSchema } from '../types/comments/types.js';
|
|
10
|
+
import { TaskSchema } from '../types/tasks/types.js';
|
|
6
11
|
import { UserSchema, CurrentUserSchema } from '../types/users/types.js';
|
|
7
|
-
import { ProductivityStatsSchema } from '../types/productivity/types.js';
|
|
8
|
-
import { ActivityEventSchema } from '../types/activity/types.js';
|
|
9
12
|
import { WorkspaceUserSchema, WorkspaceInvitationSchema, WorkspacePlanDetailsSchema, JoinWorkspaceResultSchema, WorkspaceSchema, MemberActivityInfoSchema, WorkspaceUserTaskSchema, } from '../types/workspaces/types.js';
|
|
10
|
-
import { ProjectActivityStatsSchema, ProjectHealthSchema, ProjectHealthContextSchema, ProjectProgressSchema, WorkspaceInsightsSchema, } from '../types/insights/types.js';
|
|
11
|
-
import { BackupSchema } from '../types/backups/types.js';
|
|
12
|
-
import { IdMappingSchema, MovedIdSchema } from '../types/id-mappings/types.js';
|
|
13
13
|
import { FilterSchema, CollaboratorSchema, CollaboratorStateSchema, FolderSchema, NoteSchema, TooltipsSchema, WorkspaceFilterSchema, WorkspaceGoalSchema, CalendarSchema, CalendarAccountSchema, ReminderSchema, LocationReminderSchema, CompletedInfoSchema, ViewOptionsSchema, ProjectViewOptionsDefaultsSchema, UserPlanLimitsSchema, LiveNotificationSchema, SyncWorkspaceSchema, SyncUserSchema, UserSettingsSchema, SuggestionSchema, } from '../types/sync/resources/index.js';
|
|
14
14
|
function createValidator(schema) {
|
|
15
15
|
return (input) => schema.parse(input);
|
|
@@ -50,6 +50,8 @@ export function validateProject(input) {
|
|
|
50
50
|
export function validateProjectArray(input) {
|
|
51
51
|
return input.map(validateProject);
|
|
52
52
|
}
|
|
53
|
+
export const validateWorkspaceProject = createValidator(WorkspaceProjectSchema);
|
|
54
|
+
export const validateWorkspaceProjectArray = createArrayValidator(validateWorkspaceProject);
|
|
53
55
|
export const validateSection = createValidator(SectionSchema);
|
|
54
56
|
export const validateSectionArray = createArrayValidator(validateSection);
|
|
55
57
|
export const validateLabel = createValidator(LabelSchema);
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { PersonalProject, WorkspaceProject, AddProjectArgs, UpdateProjectArgs, GetProjectsArgs, SearchProjectsArgs, GetProjectCollaboratorsArgs, GetProjectsResponse, GetProjectCollaboratorsResponse, GetArchivedProjectsArgs, GetArchivedProjectsResponse, MoveProjectToWorkspaceArgs, MoveProjectToPersonalArgs, GetArchivedProjectsCountArgs, GetArchivedProjectsCountResponse, GetProjectPermissionsResponse, GetFullProjectArgs, GetFullProjectResponse, JoinProjectResponse } from './types/projects/index.js';
|
|
3
|
-
import { Section, AddSectionArgs, UpdateSectionArgs, GetSectionsArgs, SearchSectionsArgs, GetSectionsResponse } from './types/sections/index.js';
|
|
4
|
-
import { Label, AddLabelArgs, UpdateLabelArgs, GetLabelsArgs, SearchLabelsArgs, GetLabelsResponse, GetSharedLabelsArgs, GetSharedLabelsResponse, RenameSharedLabelArgs, RemoveSharedLabelArgs } from './types/labels/index.js';
|
|
5
|
-
import { Attachment, Comment, AddCommentArgs, UpdateCommentArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetCommentsResponse } from './types/comments/index.js';
|
|
6
|
-
import { AddReminderArgs, UpdateReminderArgs, AddLocationReminderArgs, UpdateLocationReminderArgs, GetRemindersArgs, GetRemindersResponse, GetLocationRemindersArgs, GetLocationRemindersResponse } from './types/reminders/index.js';
|
|
7
|
-
import { CurrentUser } from './types/users/index.js';
|
|
8
|
-
import { ProductivityStats } from './types/productivity/index.js';
|
|
1
|
+
import type { Reminder } from './types/index.js';
|
|
9
2
|
import { GetActivityLogsArgs, GetActivityLogsResponse } from './types/activity/index.js';
|
|
10
|
-
import { WorkspaceInvitation, WorkspacePlanDetails, JoinWorkspaceResult, Workspace, AddWorkspaceArgs, UpdateWorkspaceArgs, GetWorkspaceMembersActivityArgs, GetWorkspaceMembersActivityResponse, GetWorkspaceUserTasksArgs, GetWorkspaceUserTasksResponse, InviteWorkspaceUsersArgs, InviteWorkspaceUsersResponse, UpdateWorkspaceUserArgs, RemoveWorkspaceUserArgs, GetWorkspaceInvitationsArgs, DeleteWorkspaceInvitationArgs, WorkspaceInvitationActionArgs, JoinWorkspaceArgs, WorkspaceLogoArgs, GetWorkspacePlanDetailsArgs, GetWorkspaceUsersArgs, GetWorkspaceUsersResponse, GetWorkspaceProjectsArgs, WorkspaceInvitationsResponse, AllWorkspaceInvitationsResponse, WorkspaceLogoResponse } from './types/workspaces/index.js';
|
|
11
|
-
import { GetFoldersArgs, GetFoldersResponse, AddFolderArgs, UpdateFolderArgs } from './types/folders/index.js';
|
|
12
|
-
import type { Folder } from './types/sync/resources/folders.js';
|
|
13
|
-
import { ProjectActivityStats, ProjectHealth, ProjectHealthContext, ProjectProgress, WorkspaceInsights, GetProjectActivityStatsArgs, GetWorkspaceInsightsArgs } from './types/insights/index.js';
|
|
14
3
|
import { Backup, GetBackupsArgs, DownloadBackupArgs } from './types/backups/index.js';
|
|
15
|
-
import {
|
|
4
|
+
import { Attachment, Comment, AddCommentArgs, UpdateCommentArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetCommentsResponse } from './types/comments/index.js';
|
|
16
5
|
import { GetOrCreateEmailArgs, GetOrCreateEmailResponse, DisableEmailArgs } from './types/emails/index.js';
|
|
17
|
-
import {
|
|
18
|
-
import { ExportTemplateFileArgs, ExportTemplateUrlArgs, ExportTemplateUrlResponse, CreateProjectFromTemplateArgs, CreateProjectFromTemplateResponse, ImportTemplateIntoProjectArgs, ImportTemplateFromIdArgs, ImportTemplateResponse } from './types/templates/index.js';
|
|
6
|
+
import { GetFoldersArgs, GetFoldersResponse, AddFolderArgs, UpdateFolderArgs } from './types/folders/index.js';
|
|
19
7
|
import { CustomFetch, CustomFetchResponse } from './types/http.js';
|
|
20
|
-
import
|
|
8
|
+
import { IdMapping, MovedId, GetIdMappingsArgs, GetMovedIdsArgs } from './types/id-mappings/index.js';
|
|
9
|
+
import { ProjectActivityStats, ProjectHealth, ProjectHealthContext, ProjectProgress, WorkspaceInsights, GetProjectActivityStatsArgs, GetWorkspaceInsightsArgs } from './types/insights/index.js';
|
|
10
|
+
import { Label, AddLabelArgs, UpdateLabelArgs, GetLabelsArgs, SearchLabelsArgs, GetLabelsResponse, GetSharedLabelsArgs, GetSharedLabelsResponse, RenameSharedLabelArgs, RemoveSharedLabelArgs } from './types/labels/index.js';
|
|
11
|
+
import { ProductivityStats } from './types/productivity/index.js';
|
|
12
|
+
import { PersonalProject, WorkspaceProject, AddProjectArgs, UpdateProjectArgs, GetProjectsArgs, SearchProjectsArgs, GetProjectCollaboratorsArgs, GetProjectsResponse, GetProjectCollaboratorsResponse, GetArchivedProjectsArgs, GetArchivedProjectsResponse, MoveProjectToWorkspaceArgs, MoveProjectToPersonalArgs, GetArchivedProjectsCountArgs, GetArchivedProjectsCountResponse, GetProjectPermissionsResponse, GetFullProjectArgs, GetFullProjectResponse, JoinProjectResponse } from './types/projects/index.js';
|
|
13
|
+
import { AddReminderArgs, UpdateReminderArgs, AddLocationReminderArgs, UpdateLocationReminderArgs, GetRemindersArgs, GetRemindersResponse, GetLocationRemindersArgs, GetLocationRemindersResponse } from './types/reminders/index.js';
|
|
14
|
+
import { Section, AddSectionArgs, UpdateSectionArgs, GetSectionsArgs, SearchSectionsArgs, GetSectionsResponse } from './types/sections/index.js';
|
|
15
|
+
import type { Folder } from './types/sync/resources/folders.js';
|
|
16
|
+
import { Task, AddTaskArgs, GetTasksArgs, GetTasksByFilterArgs, UpdateTaskArgs, QuickAddTaskArgs, type MoveTaskArgs, GetCompletedTasksByCompletionDateArgs, GetCompletedTasksByDueDateArgs, GetCompletedTasksResponse, SearchCompletedTasksArgs, GetTasksResponse, GetAllCompletedTasksArgs, GetAllCompletedTasksResponse } from './types/tasks/index.js';
|
|
17
|
+
import { ExportTemplateFileArgs, ExportTemplateUrlArgs, ExportTemplateUrlResponse, CreateProjectFromTemplateArgs, CreateProjectFromTemplateResponse, ImportTemplateIntoProjectArgs, ImportTemplateFromIdArgs, ImportTemplateResponse } from './types/templates/index.js';
|
|
18
|
+
import { UploadFileArgs, DeleteUploadArgs } from './types/uploads/index.js';
|
|
19
|
+
import { CurrentUser } from './types/users/index.js';
|
|
20
|
+
import { WorkspaceInvitation, WorkspacePlanDetails, JoinWorkspaceResult, Workspace, AddWorkspaceArgs, UpdateWorkspaceArgs, GetWorkspaceMembersActivityArgs, GetWorkspaceMembersActivityResponse, GetWorkspaceUserTasksArgs, GetWorkspaceUserTasksResponse, InviteWorkspaceUsersArgs, InviteWorkspaceUsersResponse, UpdateWorkspaceUserArgs, RemoveWorkspaceUserArgs, GetWorkspaceInvitationsArgs, DeleteWorkspaceInvitationArgs, WorkspaceInvitationActionArgs, JoinWorkspaceArgs, WorkspaceLogoArgs, GetWorkspacePlanDetailsArgs, GetWorkspaceUsersArgs, GetWorkspaceUsersResponse, GetWorkspaceProjectsArgs, WorkspaceInvitationsResponse, AllWorkspaceInvitationsResponse, WorkspaceLogoResponse } from './types/workspaces/index.js';
|
|
21
21
|
import { type SyncResponse, type SyncRequest } from './types/sync/index.js';
|
|
22
22
|
/**
|
|
23
23
|
* Response from viewAttachment, extending CustomFetchResponse with
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ColorKey } from '../../utils/colors.js';
|
|
2
|
-
import type { SearchArgs } from '../common.js';
|
|
3
2
|
import type { Comment } from '../comments/types.js';
|
|
3
|
+
import type { SearchArgs } from '../common.js';
|
|
4
4
|
import type { Section } from '../sections/types.js';
|
|
5
5
|
import type { Collaborator, CollaboratorState } from '../sync/resources/collaborators.js';
|
|
6
6
|
import type { Folder } from '../sync/resources/folders.js';
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ProjectAddArgs, ProjectUpdateArgs, ProjectMoveArgs, ProjectReorderArgs, ShareProjectArgs, ProjectLeaveArgs, ProjectArchiveArgs, ProjectUnarchiveArgs, ProjectDeleteArgs, ProjectMoveToWorkspaceArgs, ProjectMoveToPersonalArgs } from './projects.js';
|
|
3
|
-
import type { SectionAddArgs, SectionUpdateArgs, SectionMoveArgs, SectionReorderArgs, SectionArchiveArgs, SectionUnarchiveArgs, SectionDeleteArgs } from './sections.js';
|
|
4
|
-
import type { LabelAddArgs, LabelRenameArgs, LabelUpdateArgs, LabelUpdateOrdersArgs, LabelDeleteArgs, LabelDeleteOccurrencesArgs } from './labels.js';
|
|
1
|
+
import type { CalendarUpdateArgs, CalendarAccountUpdateArgs, CalendarAccountRestoreTaskCalendarArgs } from './calendars.js';
|
|
5
2
|
import type { FilterAddArgs, FilterUpdateArgs, FilterUpdateOrdersArgs, FilterDeleteArgs } from './filters.js';
|
|
6
|
-
import type { NoteAddArgs, NoteUpdateArgs, NoteDeleteArgs, NoteReactionAddArgs, NoteReactionRemoveArgs } from './notes.js';
|
|
7
|
-
import type { ReminderAddArgs, ReminderUpdateArgs, ReminderDeleteArgs } from './reminders.js';
|
|
8
|
-
import type { WorkspaceAddArgs, WorkspaceUpdateArgs, WorkspaceDeleteArgs, WorkspaceUpdateUserArgs, WorkspaceDeleteUserArgs, WorkspaceLeaveArgs, WorkspaceInviteArgs, WorkspaceSetDefaultOrderArgs, WorkspaceUpdateUserProjectSortPreferenceArgs } from './workspaces.js';
|
|
9
3
|
import type { FolderAddArgs, FolderUpdateArgs, FolderDeleteArgs } from './folders.js';
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
4
|
+
import type { LabelAddArgs, LabelRenameArgs, LabelUpdateArgs, LabelUpdateOrdersArgs, LabelDeleteArgs, LabelDeleteOccurrencesArgs } from './labels.js';
|
|
5
|
+
import type { NoteAddArgs, NoteUpdateArgs, NoteDeleteArgs, NoteReactionAddArgs, NoteReactionRemoveArgs } from './notes.js';
|
|
12
6
|
import type { LiveNotificationsMarkUnreadArgs, LiveNotificationsMarkReadArgs, LiveNotificationsMarkReadAllArgs, LiveNotificationsSetLastReadArgs } from './notifications.js';
|
|
7
|
+
import type { UserUpdateArgs, DeleteCollaboratorArgs, IdMappingArgs, SuggestionDeleteArgs, UserSettingsUpdateArgs, UpdateGoalsArgs } from './others.js';
|
|
8
|
+
import type { ProjectViewOptionsDefaultsSetArgs } from './project-view-options.js';
|
|
9
|
+
import type { ProjectAddArgs, ProjectUpdateArgs, ProjectMoveArgs, ProjectReorderArgs, ShareProjectArgs, ProjectLeaveArgs, ProjectArchiveArgs, ProjectUnarchiveArgs, ProjectDeleteArgs, ProjectMoveToWorkspaceArgs, ProjectMoveToPersonalArgs } from './projects.js';
|
|
10
|
+
import type { ReminderAddArgs, ReminderUpdateArgs, ReminderDeleteArgs } from './reminders.js';
|
|
11
|
+
import type { SectionAddArgs, SectionUpdateArgs, SectionMoveArgs, SectionReorderArgs, SectionArchiveArgs, SectionUnarchiveArgs, SectionDeleteArgs } from './sections.js';
|
|
13
12
|
import type { AcceptInvitationArgs, RejectInvitationArgs, BizAcceptInvitationArgs, BizRejectInvitationArgs } from './sharing.js';
|
|
13
|
+
import type { TaskAddArgs, TaskUpdateArgs, TaskCompleteArgs, TaskCompleteUndoArgs, TaskMoveArgs, TaskReorderArgs, TaskUncompleteArgs, TaskUpdateDateCompleteArgs, TaskDeleteArgs, TaskUpdateDayOrderArgs } from './tasks.js';
|
|
14
14
|
import type { ViewOptionsSetArgs, ViewOptionsDeleteArgs } from './view-options.js';
|
|
15
|
-
import type {
|
|
16
|
-
import type {
|
|
17
|
-
import type {
|
|
15
|
+
import type { WorkspaceFilterAddArgs, WorkspaceFilterUpdateArgs, WorkspaceFilterUpdateOrdersArgs, WorkspaceFilterDeleteArgs } from './workspace-filters.js';
|
|
16
|
+
import type { WorkspaceGoalAddArgs, WorkspaceGoalUpdateArgs, WorkspaceGoalDeleteArgs, WorkspaceGoalProjectAddArgs, WorkspaceGoalProjectRemoveArgs } from './workspace-goals.js';
|
|
17
|
+
import type { WorkspaceAddArgs, WorkspaceUpdateArgs, WorkspaceDeleteArgs, WorkspaceUpdateUserArgs, WorkspaceDeleteUserArgs, WorkspaceLeaveArgs, WorkspaceInviteArgs, WorkspaceSetDefaultOrderArgs, WorkspaceUpdateUserProjectSortPreferenceArgs } from './workspaces.js';
|
|
18
18
|
/**
|
|
19
19
|
* Maps each Sync API command type string to its corresponding argument type.
|
|
20
20
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { ColorKey } from '../../../utils/colors.js';
|
|
1
2
|
import type { ProjectViewStyle, ProjectVisibility } from '../../projects/types.js';
|
|
2
3
|
import type { WorkspaceRole, CollaboratorRole } from '../../workspaces/types.js';
|
|
3
4
|
import type { ProjectStatus } from './shared.js';
|
|
4
|
-
import type { ColorKey } from '../../../utils/colors.js';
|
|
5
5
|
export type ProjectAccessConfig = {
|
|
6
6
|
visibility: ProjectVisibility;
|
|
7
7
|
configuration?: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SyncDueDate, ReminderService } from './shared.js';
|
|
2
1
|
import type { LocationTrigger, ReminderType } from '../resources/reminders.js';
|
|
2
|
+
import type { SyncDueDate, ReminderService } from './shared.js';
|
|
3
3
|
export type ReminderAddArgs = {
|
|
4
4
|
type: Extract<ReminderType, 'absolute'>;
|
|
5
5
|
itemId: string;
|
|
@@ -47,13 +47,13 @@ export declare const SORTED_BY_OPTIONS: readonly ["MANUAL", "ALPHABETICALLY", "A
|
|
|
47
47
|
export type SortedBy = (typeof SORTED_BY_OPTIONS)[number];
|
|
48
48
|
export declare const SortedBySchema: z.ZodNullable<z.ZodEnum<{
|
|
49
49
|
PROJECT: "PROJECT";
|
|
50
|
-
MANUAL: "MANUAL";
|
|
51
50
|
ASSIGNEE: "ASSIGNEE";
|
|
52
51
|
ADDED_DATE: "ADDED_DATE";
|
|
53
52
|
DUE_DATE: "DUE_DATE";
|
|
54
53
|
DEADLINE: "DEADLINE";
|
|
55
54
|
PRIORITY: "PRIORITY";
|
|
56
55
|
WORKSPACE: "WORKSPACE";
|
|
56
|
+
MANUAL: "MANUAL";
|
|
57
57
|
ALPHABETICALLY: "ALPHABETICALLY";
|
|
58
58
|
}>>;
|
|
59
59
|
/** Available sort directions. */
|
|
@@ -110,13 +110,13 @@ export declare const ViewOptionsSchema: z.ZodObject<{
|
|
|
110
110
|
showCompletedTasks: z.ZodOptional<z.ZodBoolean>;
|
|
111
111
|
sortedBy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
112
112
|
PROJECT: "PROJECT";
|
|
113
|
-
MANUAL: "MANUAL";
|
|
114
113
|
ASSIGNEE: "ASSIGNEE";
|
|
115
114
|
ADDED_DATE: "ADDED_DATE";
|
|
116
115
|
DUE_DATE: "DUE_DATE";
|
|
117
116
|
DEADLINE: "DEADLINE";
|
|
118
117
|
PRIORITY: "PRIORITY";
|
|
119
118
|
WORKSPACE: "WORKSPACE";
|
|
119
|
+
MANUAL: "MANUAL";
|
|
120
120
|
ALPHABETICALLY: "ALPHABETICALLY";
|
|
121
121
|
}>>>;
|
|
122
122
|
sortOrder: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
@@ -144,13 +144,13 @@ export declare const ProjectViewOptionsDefaultsSchema: z.ZodObject<{
|
|
|
144
144
|
}>>>;
|
|
145
145
|
sortedBy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
146
146
|
PROJECT: "PROJECT";
|
|
147
|
-
MANUAL: "MANUAL";
|
|
148
147
|
ASSIGNEE: "ASSIGNEE";
|
|
149
148
|
ADDED_DATE: "ADDED_DATE";
|
|
150
149
|
DUE_DATE: "DUE_DATE";
|
|
151
150
|
DEADLINE: "DEADLINE";
|
|
152
151
|
PRIORITY: "PRIORITY";
|
|
153
152
|
WORKSPACE: "WORKSPACE";
|
|
153
|
+
MANUAL: "MANUAL";
|
|
154
154
|
ALPHABETICALLY: "ALPHABETICALLY";
|
|
155
155
|
}>>>;
|
|
156
156
|
sortOrder: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Label } from '../labels/types.js';
|
|
2
2
|
import type { PersonalProject, WorkspaceProject } from '../projects/types.js';
|
|
3
3
|
import type { Section } from '../sections/types.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { Task } from '../tasks/types.js';
|
|
5
5
|
import type { WorkspaceUser } from '../workspaces/types.js';
|
|
6
6
|
import type { Filter, Collaborator, CollaboratorState, Folder, Note, Tooltips, WorkspaceFilter, WorkspaceGoal, Calendar, CalendarAccount, Reminder, CompletedInfo, ViewOptions, ProjectViewOptionsDefaults, UserPlanLimits, LiveNotification, SyncWorkspace, SyncUser, UserSettings, LocationReminder, Suggestion } from './resources/index.js';
|
|
7
7
|
export type SyncError = {
|
|
@@ -99,6 +99,64 @@ export declare function isPersonalProject(project: PersonalProject | WorkspacePr
|
|
|
99
99
|
*/
|
|
100
100
|
export declare function validateProject(input: unknown): PersonalProject | WorkspaceProject;
|
|
101
101
|
export declare function validateProjectArray(input: unknown[]): (PersonalProject | WorkspaceProject)[];
|
|
102
|
+
export declare const validateWorkspaceProject: (input: unknown) => {
|
|
103
|
+
url: string;
|
|
104
|
+
id: string;
|
|
105
|
+
canAssignTasks: boolean;
|
|
106
|
+
childOrder: number;
|
|
107
|
+
color: string;
|
|
108
|
+
createdAt: string | null;
|
|
109
|
+
isArchived: boolean;
|
|
110
|
+
isDeleted: boolean;
|
|
111
|
+
isFavorite: boolean;
|
|
112
|
+
isFrozen: boolean;
|
|
113
|
+
name: string;
|
|
114
|
+
updatedAt: string | null;
|
|
115
|
+
viewStyle: string;
|
|
116
|
+
defaultOrder: number;
|
|
117
|
+
description: string;
|
|
118
|
+
isCollapsed: boolean;
|
|
119
|
+
isShared: boolean;
|
|
120
|
+
collaboratorRoleDefault: string;
|
|
121
|
+
folderId: string | null;
|
|
122
|
+
isInviteOnly: boolean | null;
|
|
123
|
+
isLinkSharingEnabled: boolean;
|
|
124
|
+
role: string | null;
|
|
125
|
+
status: string;
|
|
126
|
+
workspaceId: string;
|
|
127
|
+
access?: {
|
|
128
|
+
visibility: "restricted" | "team" | "public";
|
|
129
|
+
} | undefined;
|
|
130
|
+
};
|
|
131
|
+
export declare const validateWorkspaceProjectArray: (input: unknown[]) => {
|
|
132
|
+
url: string;
|
|
133
|
+
id: string;
|
|
134
|
+
canAssignTasks: boolean;
|
|
135
|
+
childOrder: number;
|
|
136
|
+
color: string;
|
|
137
|
+
createdAt: string | null;
|
|
138
|
+
isArchived: boolean;
|
|
139
|
+
isDeleted: boolean;
|
|
140
|
+
isFavorite: boolean;
|
|
141
|
+
isFrozen: boolean;
|
|
142
|
+
name: string;
|
|
143
|
+
updatedAt: string | null;
|
|
144
|
+
viewStyle: string;
|
|
145
|
+
defaultOrder: number;
|
|
146
|
+
description: string;
|
|
147
|
+
isCollapsed: boolean;
|
|
148
|
+
isShared: boolean;
|
|
149
|
+
collaboratorRoleDefault: string;
|
|
150
|
+
folderId: string | null;
|
|
151
|
+
isInviteOnly: boolean | null;
|
|
152
|
+
isLinkSharingEnabled: boolean;
|
|
153
|
+
role: string | null;
|
|
154
|
+
status: string;
|
|
155
|
+
workspaceId: string;
|
|
156
|
+
access?: {
|
|
157
|
+
visibility: "restricted" | "team" | "public";
|
|
158
|
+
} | undefined;
|
|
159
|
+
}[];
|
|
102
160
|
export declare const validateSection: (input: unknown) => {
|
|
103
161
|
url: string;
|
|
104
162
|
id: string;
|
|
@@ -1019,7 +1077,7 @@ export declare const validateViewOptions: (input: unknown) => {
|
|
|
1019
1077
|
filteredBy?: string | null | undefined;
|
|
1020
1078
|
viewMode?: "LIST" | "BOARD" | "CALENDAR" | undefined;
|
|
1021
1079
|
showCompletedTasks?: boolean | undefined;
|
|
1022
|
-
sortedBy?: "PROJECT" | "
|
|
1080
|
+
sortedBy?: "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
|
|
1023
1081
|
sortOrder?: "ASC" | "DESC" | null | undefined;
|
|
1024
1082
|
};
|
|
1025
1083
|
export declare const validateViewOptionsArray: (input: unknown[]) => {
|
|
@@ -1030,7 +1088,7 @@ export declare const validateViewOptionsArray: (input: unknown[]) => {
|
|
|
1030
1088
|
filteredBy?: string | null | undefined;
|
|
1031
1089
|
viewMode?: "LIST" | "BOARD" | "CALENDAR" | undefined;
|
|
1032
1090
|
showCompletedTasks?: boolean | undefined;
|
|
1033
|
-
sortedBy?: "PROJECT" | "
|
|
1091
|
+
sortedBy?: "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
|
|
1034
1092
|
sortOrder?: "ASC" | "DESC" | null | undefined;
|
|
1035
1093
|
}[];
|
|
1036
1094
|
export declare const validateProjectViewOptionsDefaults: (input: unknown) => {
|
|
@@ -1038,7 +1096,7 @@ export declare const validateProjectViewOptionsDefaults: (input: unknown) => {
|
|
|
1038
1096
|
projectId: string;
|
|
1039
1097
|
viewMode?: "LIST" | "BOARD" | "CALENDAR" | null | undefined;
|
|
1040
1098
|
groupedBy?: "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | null | undefined;
|
|
1041
|
-
sortedBy?: "PROJECT" | "
|
|
1099
|
+
sortedBy?: "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
|
|
1042
1100
|
sortOrder?: "ASC" | "DESC" | null | undefined;
|
|
1043
1101
|
showCompletedTasks?: boolean | undefined;
|
|
1044
1102
|
filteredBy?: string | null | undefined;
|
|
@@ -1052,7 +1110,7 @@ export declare const validateProjectViewOptionsDefaultsArray: (input: unknown[])
|
|
|
1052
1110
|
projectId: string;
|
|
1053
1111
|
viewMode?: "LIST" | "BOARD" | "CALENDAR" | null | undefined;
|
|
1054
1112
|
groupedBy?: "PROJECT" | "LABEL" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | null | undefined;
|
|
1055
|
-
sortedBy?: "PROJECT" | "
|
|
1113
|
+
sortedBy?: "PROJECT" | "ASSIGNEE" | "ADDED_DATE" | "DUE_DATE" | "DEADLINE" | "PRIORITY" | "WORKSPACE" | "MANUAL" | "ALPHABETICALLY" | null | undefined;
|
|
1056
1114
|
sortOrder?: "ASC" | "DESC" | null | undefined;
|
|
1057
1115
|
showCompletedTasks?: boolean | undefined;
|
|
1058
1116
|
filteredBy?: string | null | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doist/todoist-sdk",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.2.1-next.1",
|
|
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",
|
|
@@ -27,10 +27,8 @@
|
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"clean": "rimraf dist",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"lint": "oxlint src --fix",
|
|
33
|
-
"lint-check": "oxlint src",
|
|
30
|
+
"check": "oxlint src && oxfmt --check",
|
|
31
|
+
"check:fix": "oxlint src --fix && oxfmt",
|
|
34
32
|
"ts-compile-check": "npx tsc -p tsconfig.typecheck.json",
|
|
35
33
|
"audit": "npm audit --audit-level=moderate",
|
|
36
34
|
"test": "vitest run",
|
|
@@ -44,7 +42,7 @@
|
|
|
44
42
|
"build:post": "echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
45
43
|
"build": "npm-run-all clean build:cjs build:esm build:fix-esm build:fix-dts build:post",
|
|
46
44
|
"attw": "npx @arethetypeswrong/cli --pack --ignore-rules fallback-condition false-esm",
|
|
47
|
-
"integrity-checks": "npm-run-all clean
|
|
45
|
+
"integrity-checks": "npm-run-all clean check test build attw",
|
|
48
46
|
"prepublishOnly": "npm run integrity-checks",
|
|
49
47
|
"prepare": "npm run build"
|
|
50
48
|
},
|
|
@@ -58,9 +56,7 @@
|
|
|
58
56
|
"zod": "4.3.6"
|
|
59
57
|
},
|
|
60
58
|
"devDependencies": {
|
|
61
|
-
"@doist/prettier-config": "4.0.0",
|
|
62
59
|
"@semantic-release/changelog": "6.0.3",
|
|
63
|
-
"@semantic-release/exec": "7.1.0",
|
|
64
60
|
"@semantic-release/git": "10.0.1",
|
|
65
61
|
"conventional-changelog-conventionalcommits": "9.3.0",
|
|
66
62
|
"dotenv": "17.3.1",
|
|
@@ -69,8 +65,8 @@
|
|
|
69
65
|
"msw": "2.12.13",
|
|
70
66
|
"npm-run-all2": "8.0.4",
|
|
71
67
|
"obsidian": "^1.10.2-1",
|
|
68
|
+
"oxfmt": "0.43.0",
|
|
72
69
|
"oxlint": "1.57.0",
|
|
73
|
-
"prettier": "3.3.2",
|
|
74
70
|
"rimraf": "6.1.3",
|
|
75
71
|
"semantic-release": "25.0.3",
|
|
76
72
|
"ts-node": "10.9.2",
|
|
@@ -81,7 +77,6 @@
|
|
|
81
77
|
"peerDependencies": {
|
|
82
78
|
"type-fest": "^4.12.0"
|
|
83
79
|
},
|
|
84
|
-
"prettier": "@doist/prettier-config",
|
|
85
80
|
"husky": {
|
|
86
81
|
"hooks": {
|
|
87
82
|
"pre-commit": "npx lint-staged && npm run build"
|
|
@@ -89,7 +84,7 @@
|
|
|
89
84
|
},
|
|
90
85
|
"lint-staged": {
|
|
91
86
|
"*.{ts,tsx}": "oxlint --fix",
|
|
92
|
-
"*.{ts,tsx,json,
|
|
87
|
+
"*.{ts,tsx,json,md,yml,yaml}": "oxfmt --no-error-on-unmatched-pattern"
|
|
93
88
|
},
|
|
94
89
|
"files": [
|
|
95
90
|
"dist/cjs/**/*",
|