@doist/todoist-sdk 14.2.0 → 15.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/url-helpers.js +151 -23
- package/dist/types/utils/index.d.ts +2 -1
- package/dist/types/utils/url-helpers.d.ts +88 -0
- package/package.json +5 -10
- package/dist/cjs/authentication.js +0 -317
- package/dist/cjs/clients/activity-client.js +0 -63
- package/dist/cjs/clients/app-client.js +0 -345
- package/dist/cjs/clients/backup-client.js +0 -47
- package/dist/cjs/clients/base-client.js +0 -31
- package/dist/cjs/clients/billing-client.js +0 -152
- package/dist/cjs/clients/comment-client.js +0 -91
- package/dist/cjs/clients/email-client.js +0 -43
- package/dist/cjs/clients/folder-client.js +0 -79
- package/dist/cjs/clients/id-mapping-client.js +0 -39
- package/dist/cjs/clients/insights-client.js +0 -87
- package/dist/cjs/clients/label-client.js +0 -126
- package/dist/cjs/clients/productivity-client.js +0 -27
- package/dist/cjs/clients/project-client.js +0 -235
- package/dist/cjs/clients/reminder-client.js +0 -198
- package/dist/cjs/clients/section-client.js +0 -117
- package/dist/cjs/clients/task-client.js +0 -254
- package/dist/cjs/clients/template-client.js +0 -88
- package/dist/cjs/clients/ui-extension-client.js +0 -107
- package/dist/cjs/clients/upload-client.js +0 -155
- package/dist/cjs/clients/view-options-client.js +0 -25
- package/dist/cjs/clients/workspace-client.js +0 -366
- package/dist/cjs/consts/endpoints.js +0 -224
- package/dist/cjs/index.js +0 -24
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/test-utils/asserts.js +0 -11
- package/dist/cjs/test-utils/msw-setup.js +0 -97
- package/dist/cjs/test-utils/obsidian-fetch-adapter.js +0 -54
- package/dist/cjs/test-utils/test-defaults.js +0 -371
- package/dist/cjs/test-utils/transport-seam.js +0 -17
- package/dist/cjs/test-utils/webhook-fixtures.js +0 -32
- package/dist/cjs/todoist-api.js +0 -1711
- package/dist/cjs/transport/fetch-with-retry.js +0 -219
- package/dist/cjs/transport/http-client.js +0 -134
- package/dist/cjs/transport/http-dispatcher.js +0 -198
- package/dist/cjs/transport/sync-request.js +0 -83
- package/dist/cjs/types/activity/index.js +0 -18
- package/dist/cjs/types/activity/requests.js +0 -2
- package/dist/cjs/types/activity/types.js +0 -28
- package/dist/cjs/types/apps/index.js +0 -18
- package/dist/cjs/types/apps/requests.js +0 -2
- package/dist/cjs/types/apps/types.js +0 -254
- package/dist/cjs/types/backups/index.js +0 -18
- package/dist/cjs/types/backups/requests.js +0 -2
- package/dist/cjs/types/backups/types.js +0 -8
- package/dist/cjs/types/billing/index.js +0 -18
- package/dist/cjs/types/billing/requests.js +0 -2
- package/dist/cjs/types/billing/types.js +0 -92
- package/dist/cjs/types/comments/index.js +0 -18
- package/dist/cjs/types/comments/requests.js +0 -2
- package/dist/cjs/types/comments/types.js +0 -60
- package/dist/cjs/types/common.js +0 -10
- package/dist/cjs/types/emails/index.js +0 -17
- package/dist/cjs/types/emails/requests.js +0 -5
- package/dist/cjs/types/errors.js +0 -29
- package/dist/cjs/types/folders/index.js +0 -17
- package/dist/cjs/types/folders/requests.js +0 -2
- package/dist/cjs/types/http.js +0 -24
- package/dist/cjs/types/id-mappings/index.js +0 -18
- package/dist/cjs/types/id-mappings/requests.js +0 -20
- package/dist/cjs/types/id-mappings/types.js +0 -12
- package/dist/cjs/types/index.js +0 -40
- package/dist/cjs/types/insights/index.js +0 -18
- package/dist/cjs/types/insights/requests.js +0 -2
- package/dist/cjs/types/insights/types.js +0 -80
- package/dist/cjs/types/labels/index.js +0 -18
- package/dist/cjs/types/labels/requests.js +0 -2
- package/dist/cjs/types/labels/types.js +0 -11
- package/dist/cjs/types/productivity/index.js +0 -17
- package/dist/cjs/types/productivity/types.js +0 -68
- package/dist/cjs/types/projects/index.js +0 -18
- package/dist/cjs/types/projects/requests.js +0 -2
- package/dist/cjs/types/projects/types.js +0 -66
- package/dist/cjs/types/reminders/index.js +0 -17
- package/dist/cjs/types/reminders/requests.js +0 -95
- package/dist/cjs/types/sections/index.js +0 -18
- package/dist/cjs/types/sections/requests.js +0 -2
- package/dist/cjs/types/sections/types.js +0 -25
- package/dist/cjs/types/sync/commands/calendars.js +0 -2
- package/dist/cjs/types/sync/commands/filters.js +0 -2
- package/dist/cjs/types/sync/commands/folders.js +0 -2
- package/dist/cjs/types/sync/commands/index.js +0 -34
- package/dist/cjs/types/sync/commands/labels.js +0 -5
- package/dist/cjs/types/sync/commands/notes.js +0 -2
- package/dist/cjs/types/sync/commands/notifications.js +0 -2
- package/dist/cjs/types/sync/commands/others.js +0 -2
- package/dist/cjs/types/sync/commands/project-view-options.js +0 -2
- package/dist/cjs/types/sync/commands/projects.js +0 -2
- package/dist/cjs/types/sync/commands/reminders.js +0 -2
- package/dist/cjs/types/sync/commands/sections.js +0 -2
- package/dist/cjs/types/sync/commands/shared.js +0 -20
- package/dist/cjs/types/sync/commands/sharing.js +0 -2
- package/dist/cjs/types/sync/commands/tasks.js +0 -2
- package/dist/cjs/types/sync/commands/view-options.js +0 -2
- package/dist/cjs/types/sync/commands/workspace-filters.js +0 -2
- package/dist/cjs/types/sync/commands/workspaces.js +0 -2
- package/dist/cjs/types/sync/index.js +0 -22
- package/dist/cjs/types/sync/request.js +0 -2
- package/dist/cjs/types/sync/resource-types.js +0 -39
- package/dist/cjs/types/sync/resources/calendars.js +0 -27
- package/dist/cjs/types/sync/resources/collaborators.js +0 -21
- package/dist/cjs/types/sync/resources/completed-info.js +0 -24
- package/dist/cjs/types/sync/resources/filters.js +0 -14
- package/dist/cjs/types/sync/resources/folders.js +0 -12
- package/dist/cjs/types/sync/resources/index.js +0 -32
- package/dist/cjs/types/sync/resources/live-notifications.js +0 -38
- package/dist/cjs/types/sync/resources/notes.js +0 -21
- package/dist/cjs/types/sync/resources/reminders.js +0 -50
- package/dist/cjs/types/sync/resources/suggestions.js +0 -36
- package/dist/cjs/types/sync/resources/tooltips.js +0 -8
- package/dist/cjs/types/sync/resources/user-plan-limits.js +0 -20
- package/dist/cjs/types/sync/resources/user-settings.js +0 -40
- package/dist/cjs/types/sync/resources/user.js +0 -110
- package/dist/cjs/types/sync/resources/view-options.js +0 -86
- package/dist/cjs/types/sync/resources/workspace-filters.js +0 -19
- package/dist/cjs/types/sync/resources/workspaces.js +0 -72
- package/dist/cjs/types/sync/response.js +0 -54
- package/dist/cjs/types/sync/user-preferences.js +0 -71
- package/dist/cjs/types/tasks/index.js +0 -18
- package/dist/cjs/types/tasks/requests.js +0 -2
- package/dist/cjs/types/tasks/types.js +0 -59
- package/dist/cjs/types/templates/index.js +0 -17
- package/dist/cjs/types/templates/requests.js +0 -2
- package/dist/cjs/types/ui-extensions/index.js +0 -18
- package/dist/cjs/types/ui-extensions/requests.js +0 -2
- package/dist/cjs/types/ui-extensions/types.js +0 -77
- package/dist/cjs/types/uploads/index.js +0 -17
- package/dist/cjs/types/uploads/requests.js +0 -2
- package/dist/cjs/types/users/index.js +0 -17
- package/dist/cjs/types/users/types.js +0 -51
- package/dist/cjs/types/webhooks/comments.js +0 -96
- package/dist/cjs/types/webhooks/envelope.js +0 -26
- package/dist/cjs/types/webhooks/filters.js +0 -30
- package/dist/cjs/types/webhooks/index.js +0 -25
- package/dist/cjs/types/webhooks/labels.js +0 -54
- package/dist/cjs/types/webhooks/projects.js +0 -36
- package/dist/cjs/types/webhooks/reminders.js +0 -35
- package/dist/cjs/types/webhooks/sections.js +0 -53
- package/dist/cjs/types/webhooks/tasks.js +0 -68
- package/dist/cjs/types/webhooks/types.js +0 -55
- package/dist/cjs/types/workspaces/index.js +0 -18
- package/dist/cjs/types/workspaces/requests.js +0 -2
- package/dist/cjs/types/workspaces/types.js +0 -154
- package/dist/cjs/utils/activity-helpers.js +0 -58
- package/dist/cjs/utils/case-conversion.js +0 -69
- package/dist/cjs/utils/colors.js +0 -143
- package/dist/cjs/utils/file-response.js +0 -32
- package/dist/cjs/utils/headers.js +0 -16
- package/dist/cjs/utils/index.js +0 -31
- package/dist/cjs/utils/multipart-upload.js +0 -293
- package/dist/cjs/utils/processing-helpers.js +0 -18
- package/dist/cjs/utils/project-helpers.js +0 -20
- package/dist/cjs/utils/request-helpers.js +0 -21
- package/dist/cjs/utils/sanitization.js +0 -116
- package/dist/cjs/utils/sync-helpers.js +0 -22
- package/dist/cjs/utils/task-sorting.js +0 -281
- package/dist/cjs/utils/uncompletable-helpers.js +0 -60
- package/dist/cjs/utils/url-helpers.js +0 -74
- package/dist/cjs/utils/validators.js +0 -108
- package/dist/cjs/utils/view-options.js +0 -19
- package/dist/cjs/utils/webhook-parser.js +0 -60
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ENDPOINT_REST_ID_MAPPINGS = exports.ENDPOINT_REST_EMAILS = exports.ENDPOINT_REST_BACKUPS_DOWNLOAD = exports.ENDPOINT_REST_BACKUPS = exports.ENDPOINT_REST_ACCESS_TOKENS_MIGRATE = exports.ENDPOINT_REST_TEMPLATES_IMPORT_FROM_ID = exports.ENDPOINT_REST_TEMPLATES_IMPORT_FROM_FILE = exports.ENDPOINT_REST_TEMPLATES_CREATE_FROM_FILE = exports.ENDPOINT_REST_TEMPLATES_URL = exports.ENDPOINT_REST_TEMPLATES_FILE = exports.ENDPOINT_REST_TASKS_COMPLETED = exports.ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL = exports.ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE = exports.SECTION_UNARCHIVE = exports.SECTION_ARCHIVE = exports.ENDPOINT_REST_PROJECT_JOIN = exports.ENDPOINT_REST_PROJECT_FULL = exports.ENDPOINT_REST_PROJECTS_PERMISSIONS = exports.ENDPOINT_REST_PROJECTS_ARCHIVED_COUNT = exports.PROJECT_UNARCHIVE = exports.PROJECT_ARCHIVE = exports.ENDPOINT_REST_UPLOADS = exports.ENDPOINT_REST_ACTIVITIES = exports.ENDPOINT_REST_PRODUCTIVITY = exports.ENDPOINT_REST_USER = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_PROJECTS_ARCHIVED = exports.ENDPOINT_REST_PROJECTS_SEARCH = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASK_MOVE = exports.ENDPOINT_REST_TASK_REOPEN = exports.ENDPOINT_REST_TASK_CLOSE = exports.ENDPOINT_REST_LOCATION_REMINDERS = exports.ENDPOINT_REST_REMINDERS = exports.ENDPOINT_REST_COMMENTS = exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS_SEARCH = exports.ENDPOINT_REST_LABELS = exports.ENDPOINT_REST_SECTIONS_SEARCH = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_TASKS_COMPLETED_SEARCH = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE = exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS = exports.API_BASE_URI = exports.API_VERSION = exports.TODOIST_WEB_URI = void 0;
|
|
4
|
-
exports.APP_ICON_SIZES = exports.ENDPOINT_REST_USER_AUTHORIZATIONS_DELETE = exports.ENDPOINT_REST_USER_AUTHORIZATIONS = exports.ENDPOINT_REST_APPS_UI_EXTENSIONS_INSTALLED = exports.ENDPOINT_REST_APPS_UI_EXTENSIONS = exports.ENDPOINT_REST_APPS_INSTALLATIONS = exports.ENDPOINT_REST_APPS = exports.ENDPOINT_WORKSPACE_MEMBERS = exports.ENDPOINT_PRICING = exports.ENDPOINT_PRICES = exports.ENDPOINT_WORKSPACE_BILLING_PORTAL = exports.ENDPOINT_WORKSPACE_TRIAL = exports.ENDPOINT_WORKSPACE_UPGRADE = exports.ENDPOINT_PRO_PLAN_DETAILS = exports.ENDPOINT_PRO_BILLING_PORTAL = exports.ENDPOINT_PRO_TRIAL = exports.ENDPOINT_PRO_UPGRADE = exports.ENDPOINT_PAYMENTS_REACTIVATE_PLAN = exports.ENDPOINT_PAYMENTS_CANCEL_PLAN = exports.ENDPOINT_PAYMENTS_SUBSCRIPTION_INFO = exports.ENDPOINT_WORKSPACE_USERS = exports.ENDPOINT_WORKSPACE_PLAN_DETAILS = exports.ENDPOINT_WORKSPACE_LOGO = exports.ENDPOINT_WORKSPACE_JOIN = exports.ENDPOINT_WORKSPACE_INVITATIONS_DELETE = exports.ENDPOINT_WORKSPACE_INVITATIONS_ALL = exports.ENDPOINT_WORKSPACE_INVITATIONS = exports.ENDPOINT_REST_WORKSPACES = exports.ENDPOINT_REST_FOLDERS = exports.ENDPOINT_REGISTER = exports.ENDPOINT_REVOKE = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_MOVED_IDS = void 0;
|
|
5
|
-
exports.getSyncBaseUri = getSyncBaseUri;
|
|
6
|
-
exports.getApiRootBaseUri = getApiRootBaseUri;
|
|
7
|
-
exports.getAuthBaseUri = getAuthBaseUri;
|
|
8
|
-
exports.getWorkspaceInvitationAcceptEndpoint = getWorkspaceInvitationAcceptEndpoint;
|
|
9
|
-
exports.getWorkspaceInvitationRejectEndpoint = getWorkspaceInvitationRejectEndpoint;
|
|
10
|
-
exports.getProjectInsightsActivityStatsEndpoint = getProjectInsightsActivityStatsEndpoint;
|
|
11
|
-
exports.getProjectInsightsHealthEndpoint = getProjectInsightsHealthEndpoint;
|
|
12
|
-
exports.getProjectInsightsHealthContextEndpoint = getProjectInsightsHealthContextEndpoint;
|
|
13
|
-
exports.getProjectInsightsProgressEndpoint = getProjectInsightsProgressEndpoint;
|
|
14
|
-
exports.getProjectInsightsHealthAnalyzeEndpoint = getProjectInsightsHealthAnalyzeEndpoint;
|
|
15
|
-
exports.getWorkspaceInsightsEndpoint = getWorkspaceInsightsEndpoint;
|
|
16
|
-
exports.getWorkspaceUserTasksEndpoint = getWorkspaceUserTasksEndpoint;
|
|
17
|
-
exports.getWorkspaceInviteUsersEndpoint = getWorkspaceInviteUsersEndpoint;
|
|
18
|
-
exports.getWorkspaceUserEndpoint = getWorkspaceUserEndpoint;
|
|
19
|
-
exports.getWorkspaceActiveProjectsEndpoint = getWorkspaceActiveProjectsEndpoint;
|
|
20
|
-
exports.getWorkspaceArchivedProjectsEndpoint = getWorkspaceArchivedProjectsEndpoint;
|
|
21
|
-
exports.getAppEndpoint = getAppEndpoint;
|
|
22
|
-
exports.getAppSecretsEndpoint = getAppSecretsEndpoint;
|
|
23
|
-
exports.getAppClientSecretEndpoint = getAppClientSecretEndpoint;
|
|
24
|
-
exports.getAppTokensEndpoint = getAppTokensEndpoint;
|
|
25
|
-
exports.getAppTestTokenEndpoint = getAppTestTokenEndpoint;
|
|
26
|
-
exports.getAppDistributionTokenEndpoint = getAppDistributionTokenEndpoint;
|
|
27
|
-
exports.getAppVerificationTokenEndpoint = getAppVerificationTokenEndpoint;
|
|
28
|
-
exports.getAppWebhookEndpoint = getAppWebhookEndpoint;
|
|
29
|
-
exports.getAppIconEndpoint = getAppIconEndpoint;
|
|
30
|
-
exports.getAppInstallationEndpoint = getAppInstallationEndpoint;
|
|
31
|
-
exports.getAppByDistributionTokenEndpoint = getAppByDistributionTokenEndpoint;
|
|
32
|
-
exports.getUiExtensionEndpoint = getUiExtensionEndpoint;
|
|
33
|
-
exports.getUiExtensionIconEndpoint = getUiExtensionIconEndpoint;
|
|
34
|
-
exports.getUiExtensionsByIntegrationEndpoint = getUiExtensionsByIntegrationEndpoint;
|
|
35
|
-
const BASE_URI = 'https://api.todoist.com';
|
|
36
|
-
const TODOIST_URI = 'https://todoist.com';
|
|
37
|
-
exports.TODOIST_WEB_URI = 'https://app.todoist.com/app';
|
|
38
|
-
// The API version is not configurable, to ensure
|
|
39
|
-
// compatibility between the API and the client.
|
|
40
|
-
exports.API_VERSION = 'v1';
|
|
41
|
-
exports.API_BASE_URI = `/api/${exports.API_VERSION}/`;
|
|
42
|
-
const API_AUTHORIZATION_BASE_URI = '/oauth/';
|
|
43
|
-
function getSyncBaseUri(domainBase = BASE_URI) {
|
|
44
|
-
return new URL(exports.API_BASE_URI, domainBase).toString();
|
|
45
|
-
}
|
|
46
|
-
function getApiRootBaseUri(domainBase = BASE_URI) {
|
|
47
|
-
return new URL('/', domainBase).toString();
|
|
48
|
-
}
|
|
49
|
-
function getAuthBaseUri(domainBase = TODOIST_URI) {
|
|
50
|
-
return new URL(API_AUTHORIZATION_BASE_URI, domainBase).toString();
|
|
51
|
-
}
|
|
52
|
-
exports.ENDPOINT_REST_TASKS = 'tasks';
|
|
53
|
-
exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS + '/filter';
|
|
54
|
-
exports.ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE = exports.ENDPOINT_REST_TASKS + '/completed/by_completion_date';
|
|
55
|
-
exports.ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE = exports.ENDPOINT_REST_TASKS + '/completed/by_due_date';
|
|
56
|
-
exports.ENDPOINT_REST_TASKS_COMPLETED_SEARCH = 'completed/search';
|
|
57
|
-
exports.ENDPOINT_REST_SECTIONS = 'sections';
|
|
58
|
-
exports.ENDPOINT_REST_SECTIONS_SEARCH = exports.ENDPOINT_REST_SECTIONS + '/search';
|
|
59
|
-
exports.ENDPOINT_REST_LABELS = 'labels';
|
|
60
|
-
exports.ENDPOINT_REST_LABELS_SEARCH = exports.ENDPOINT_REST_LABELS + '/search';
|
|
61
|
-
exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS + '/shared';
|
|
62
|
-
exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED + '/rename';
|
|
63
|
-
exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED + '/remove';
|
|
64
|
-
exports.ENDPOINT_REST_COMMENTS = 'comments';
|
|
65
|
-
exports.ENDPOINT_REST_REMINDERS = 'reminders';
|
|
66
|
-
exports.ENDPOINT_REST_LOCATION_REMINDERS = 'location_reminders';
|
|
67
|
-
exports.ENDPOINT_REST_TASK_CLOSE = 'close';
|
|
68
|
-
exports.ENDPOINT_REST_TASK_REOPEN = 'reopen';
|
|
69
|
-
exports.ENDPOINT_REST_TASK_MOVE = 'move';
|
|
70
|
-
exports.ENDPOINT_REST_PROJECTS = 'projects';
|
|
71
|
-
exports.ENDPOINT_REST_PROJECTS_SEARCH = exports.ENDPOINT_REST_PROJECTS + '/search';
|
|
72
|
-
exports.ENDPOINT_REST_PROJECTS_ARCHIVED = exports.ENDPOINT_REST_PROJECTS + '/archived';
|
|
73
|
-
exports.ENDPOINT_REST_PROJECT_COLLABORATORS = 'collaborators';
|
|
74
|
-
exports.ENDPOINT_REST_USER = 'user';
|
|
75
|
-
exports.ENDPOINT_REST_PRODUCTIVITY = exports.ENDPOINT_REST_TASKS + '/completed/stats';
|
|
76
|
-
exports.ENDPOINT_REST_ACTIVITIES = 'activities';
|
|
77
|
-
exports.ENDPOINT_REST_UPLOADS = 'uploads';
|
|
78
|
-
exports.PROJECT_ARCHIVE = 'archive';
|
|
79
|
-
exports.PROJECT_UNARCHIVE = 'unarchive';
|
|
80
|
-
exports.ENDPOINT_REST_PROJECTS_ARCHIVED_COUNT = exports.ENDPOINT_REST_PROJECTS + '/archived/count';
|
|
81
|
-
exports.ENDPOINT_REST_PROJECTS_PERMISSIONS = exports.ENDPOINT_REST_PROJECTS + '/permissions';
|
|
82
|
-
exports.ENDPOINT_REST_PROJECT_FULL = 'full';
|
|
83
|
-
exports.ENDPOINT_REST_PROJECT_JOIN = 'join';
|
|
84
|
-
exports.SECTION_ARCHIVE = 'archive';
|
|
85
|
-
exports.SECTION_UNARCHIVE = 'unarchive';
|
|
86
|
-
exports.ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE = exports.ENDPOINT_REST_PROJECTS + '/move_to_workspace';
|
|
87
|
-
exports.ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL = exports.ENDPOINT_REST_PROJECTS + '/move_to_personal';
|
|
88
|
-
exports.ENDPOINT_REST_TASKS_COMPLETED = exports.ENDPOINT_REST_TASKS + '/completed';
|
|
89
|
-
exports.ENDPOINT_REST_TEMPLATES_FILE = 'templates/file';
|
|
90
|
-
exports.ENDPOINT_REST_TEMPLATES_URL = 'templates/url';
|
|
91
|
-
exports.ENDPOINT_REST_TEMPLATES_CREATE_FROM_FILE = 'templates/create_project_from_file';
|
|
92
|
-
exports.ENDPOINT_REST_TEMPLATES_IMPORT_FROM_FILE = 'templates/import_into_project_from_file';
|
|
93
|
-
exports.ENDPOINT_REST_TEMPLATES_IMPORT_FROM_ID = 'templates/import_into_project_from_template_id';
|
|
94
|
-
exports.ENDPOINT_REST_ACCESS_TOKENS_MIGRATE = 'access_tokens/migrate_personal_token';
|
|
95
|
-
exports.ENDPOINT_REST_BACKUPS = 'backups';
|
|
96
|
-
exports.ENDPOINT_REST_BACKUPS_DOWNLOAD = 'backups/download';
|
|
97
|
-
exports.ENDPOINT_REST_EMAILS = 'emails';
|
|
98
|
-
exports.ENDPOINT_REST_ID_MAPPINGS = 'id_mappings';
|
|
99
|
-
exports.ENDPOINT_REST_MOVED_IDS = 'moved_ids';
|
|
100
|
-
exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_TASKS + '/quick';
|
|
101
|
-
exports.ENDPOINT_SYNC = 'sync';
|
|
102
|
-
exports.ENDPOINT_AUTHORIZATION = 'authorize';
|
|
103
|
-
exports.ENDPOINT_GET_TOKEN = 'access_token';
|
|
104
|
-
exports.ENDPOINT_REVOKE = 'revoke';
|
|
105
|
-
exports.ENDPOINT_REGISTER = 'register';
|
|
106
|
-
exports.ENDPOINT_REST_FOLDERS = 'folders';
|
|
107
|
-
// Workspace endpoints
|
|
108
|
-
exports.ENDPOINT_REST_WORKSPACES = 'workspaces';
|
|
109
|
-
exports.ENDPOINT_WORKSPACE_INVITATIONS = 'workspaces/invitations';
|
|
110
|
-
exports.ENDPOINT_WORKSPACE_INVITATIONS_ALL = 'workspaces/invitations/all';
|
|
111
|
-
exports.ENDPOINT_WORKSPACE_INVITATIONS_DELETE = 'workspaces/invitations/delete';
|
|
112
|
-
exports.ENDPOINT_WORKSPACE_JOIN = 'workspaces/join';
|
|
113
|
-
exports.ENDPOINT_WORKSPACE_LOGO = 'workspaces/logo';
|
|
114
|
-
exports.ENDPOINT_WORKSPACE_PLAN_DETAILS = 'workspaces/plan_details';
|
|
115
|
-
exports.ENDPOINT_WORKSPACE_USERS = 'workspaces/users';
|
|
116
|
-
// Billing endpoints
|
|
117
|
-
exports.ENDPOINT_PAYMENTS_SUBSCRIPTION_INFO = 'payments/get_subscription_info';
|
|
118
|
-
exports.ENDPOINT_PAYMENTS_CANCEL_PLAN = 'payments/cancel_plan_with_redirect_to_stripe';
|
|
119
|
-
exports.ENDPOINT_PAYMENTS_REACTIVATE_PLAN = 'payments/reactivate_plan';
|
|
120
|
-
exports.ENDPOINT_PRO_UPGRADE = 'pro/upgrade';
|
|
121
|
-
exports.ENDPOINT_PRO_TRIAL = 'pro/trial';
|
|
122
|
-
exports.ENDPOINT_PRO_BILLING_PORTAL = 'pro/billing_portal';
|
|
123
|
-
exports.ENDPOINT_PRO_PLAN_DETAILS = 'pro/plan_details';
|
|
124
|
-
exports.ENDPOINT_WORKSPACE_UPGRADE = 'workspaces/upgrade';
|
|
125
|
-
exports.ENDPOINT_WORKSPACE_TRIAL = 'workspaces/trial';
|
|
126
|
-
exports.ENDPOINT_WORKSPACE_BILLING_PORTAL = 'workspaces/billing_portal';
|
|
127
|
-
exports.ENDPOINT_PRICES = 'prices';
|
|
128
|
-
exports.ENDPOINT_PRICING = 'pricing';
|
|
129
|
-
// Workspace invitation actions (require invite_code parameter)
|
|
130
|
-
function getWorkspaceInvitationAcceptEndpoint(inviteCode) {
|
|
131
|
-
return `workspaces/invitations/${inviteCode}/accept`;
|
|
132
|
-
}
|
|
133
|
-
function getWorkspaceInvitationRejectEndpoint(inviteCode) {
|
|
134
|
-
return `workspaces/invitations/${inviteCode}/reject`;
|
|
135
|
-
}
|
|
136
|
-
// Insights endpoints
|
|
137
|
-
function getProjectInsightsActivityStatsEndpoint(projectId) {
|
|
138
|
-
return `projects/${projectId}/insights/activity_stats`;
|
|
139
|
-
}
|
|
140
|
-
function getProjectInsightsHealthEndpoint(projectId) {
|
|
141
|
-
return `projects/${projectId}/insights/health`;
|
|
142
|
-
}
|
|
143
|
-
function getProjectInsightsHealthContextEndpoint(projectId) {
|
|
144
|
-
return `projects/${projectId}/insights/health/context`;
|
|
145
|
-
}
|
|
146
|
-
function getProjectInsightsProgressEndpoint(projectId) {
|
|
147
|
-
return `projects/${projectId}/insights/progress`;
|
|
148
|
-
}
|
|
149
|
-
function getProjectInsightsHealthAnalyzeEndpoint(projectId) {
|
|
150
|
-
return `projects/${projectId}/insights/health/analyze`;
|
|
151
|
-
}
|
|
152
|
-
function getWorkspaceInsightsEndpoint(workspaceId) {
|
|
153
|
-
return `workspaces/${workspaceId}/insights`;
|
|
154
|
-
}
|
|
155
|
-
// Workspace members
|
|
156
|
-
exports.ENDPOINT_WORKSPACE_MEMBERS = 'workspaces/members';
|
|
157
|
-
// Workspace user management (require workspace_id and/or user_id parameters)
|
|
158
|
-
function getWorkspaceUserTasksEndpoint(workspaceId, userId) {
|
|
159
|
-
return `workspaces/${workspaceId}/users/${userId}/tasks`;
|
|
160
|
-
}
|
|
161
|
-
function getWorkspaceInviteUsersEndpoint(workspaceId) {
|
|
162
|
-
return `workspaces/${workspaceId}/users/invite`;
|
|
163
|
-
}
|
|
164
|
-
function getWorkspaceUserEndpoint(workspaceId, userId) {
|
|
165
|
-
return `workspaces/${workspaceId}/users/${userId}`;
|
|
166
|
-
}
|
|
167
|
-
// Workspace projects (require workspace_id parameter)
|
|
168
|
-
function getWorkspaceActiveProjectsEndpoint(workspaceId) {
|
|
169
|
-
return `workspaces/${workspaceId}/projects/active`;
|
|
170
|
-
}
|
|
171
|
-
function getWorkspaceArchivedProjectsEndpoint(workspaceId) {
|
|
172
|
-
return `workspaces/${workspaceId}/projects/archived`;
|
|
173
|
-
}
|
|
174
|
-
// App management endpoints (dev:app_console scope)
|
|
175
|
-
exports.ENDPOINT_REST_APPS = 'apps';
|
|
176
|
-
exports.ENDPOINT_REST_APPS_INSTALLATIONS = 'apps/installations';
|
|
177
|
-
exports.ENDPOINT_REST_APPS_UI_EXTENSIONS = 'apps/ui_extensions';
|
|
178
|
-
exports.ENDPOINT_REST_APPS_UI_EXTENSIONS_INSTALLED = 'apps/ui_extensions/installed';
|
|
179
|
-
exports.ENDPOINT_REST_USER_AUTHORIZATIONS = 'user/authorizations';
|
|
180
|
-
exports.ENDPOINT_REST_USER_AUTHORIZATIONS_DELETE = 'user/authorizations/delete';
|
|
181
|
-
/** Available app icon sizes (small 60x60, medium 300x300, large 600x600). */
|
|
182
|
-
exports.APP_ICON_SIZES = ['small', 'medium', 'large'];
|
|
183
|
-
function getAppEndpoint(appId) {
|
|
184
|
-
return `apps/${appId}`;
|
|
185
|
-
}
|
|
186
|
-
function getAppSecretsEndpoint(appId) {
|
|
187
|
-
return `apps/${appId}/secrets`;
|
|
188
|
-
}
|
|
189
|
-
function getAppClientSecretEndpoint(appId) {
|
|
190
|
-
return `apps/${appId}/client_secret`;
|
|
191
|
-
}
|
|
192
|
-
function getAppTokensEndpoint(appId) {
|
|
193
|
-
return `apps/${appId}/tokens`;
|
|
194
|
-
}
|
|
195
|
-
function getAppTestTokenEndpoint(appId) {
|
|
196
|
-
return `apps/${appId}/test_token`;
|
|
197
|
-
}
|
|
198
|
-
function getAppDistributionTokenEndpoint(appId) {
|
|
199
|
-
return `apps/${appId}/distribution_token`;
|
|
200
|
-
}
|
|
201
|
-
function getAppVerificationTokenEndpoint(appId) {
|
|
202
|
-
return `apps/${appId}/verification_token`;
|
|
203
|
-
}
|
|
204
|
-
function getAppWebhookEndpoint(appId) {
|
|
205
|
-
return `apps/${appId}/webhook`;
|
|
206
|
-
}
|
|
207
|
-
function getAppIconEndpoint(appId, size) {
|
|
208
|
-
return size === 'medium' ? `apps/${appId}/icon` : `apps/${appId}/icon/${size}`;
|
|
209
|
-
}
|
|
210
|
-
function getAppInstallationEndpoint(installationId) {
|
|
211
|
-
return `apps/installations/${installationId}`;
|
|
212
|
-
}
|
|
213
|
-
function getAppByDistributionTokenEndpoint(distributionToken) {
|
|
214
|
-
return `apps/by_distribution_token/${distributionToken}`;
|
|
215
|
-
}
|
|
216
|
-
function getUiExtensionEndpoint(uiExtensionId) {
|
|
217
|
-
return `apps/ui_extensions/${uiExtensionId}`;
|
|
218
|
-
}
|
|
219
|
-
function getUiExtensionIconEndpoint(uiExtensionId) {
|
|
220
|
-
return `apps/ui_extensions/${uiExtensionId}/icon`;
|
|
221
|
-
}
|
|
222
|
-
function getUiExtensionsByIntegrationEndpoint(integrationId) {
|
|
223
|
-
return `apps/ui_extensions/integration/${integrationId}`;
|
|
224
|
-
}
|
package/dist/cjs/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.getDefaultTransport = exports.getDefaultDispatcher = void 0;
|
|
18
|
-
__exportStar(require("./todoist-api"), exports);
|
|
19
|
-
__exportStar(require("./authentication"), exports);
|
|
20
|
-
__exportStar(require("./types"), exports);
|
|
21
|
-
__exportStar(require("./utils"), exports);
|
|
22
|
-
var http_dispatcher_1 = require("./transport/http-dispatcher");
|
|
23
|
-
Object.defineProperty(exports, "getDefaultDispatcher", { enumerable: true, get: function () { return http_dispatcher_1.getDefaultDispatcher; } });
|
|
24
|
-
Object.defineProperty(exports, "getDefaultTransport", { enumerable: true, get: function () { return http_dispatcher_1.getDefaultTransport; } });
|
package/dist/cjs/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertInstance = assertInstance;
|
|
4
|
-
// Has to use 'any' to express constructor type
|
|
5
|
-
// oxlint-disable-next-line no-explicit-any
|
|
6
|
-
function assertInstance(value, type) {
|
|
7
|
-
if (value instanceof type) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
throw new TypeError(`Unexpected type ${typeof value}`);
|
|
11
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpResponse = exports.http = exports.server = exports.handlers = void 0;
|
|
4
|
-
exports.captureRequest = captureRequest;
|
|
5
|
-
exports.getLastRequest = getLastRequest;
|
|
6
|
-
exports.getAllRequests = getAllRequests;
|
|
7
|
-
exports.clearCapturedRequests = clearCapturedRequests;
|
|
8
|
-
exports.mockApiResponse = mockApiResponse;
|
|
9
|
-
exports.mockApiError = mockApiError;
|
|
10
|
-
const msw_1 = require("msw");
|
|
11
|
-
Object.defineProperty(exports, "http", { enumerable: true, get: function () { return msw_1.http; } });
|
|
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
|
-
// Request capture storage
|
|
16
|
-
const capturedRequests = [];
|
|
17
|
-
// Helper function to capture requests
|
|
18
|
-
function captureRequest({ request, body }) {
|
|
19
|
-
const headers = {};
|
|
20
|
-
request.headers.forEach((value, key) => {
|
|
21
|
-
headers[key] = value;
|
|
22
|
-
});
|
|
23
|
-
capturedRequests.push({
|
|
24
|
-
url: request.url,
|
|
25
|
-
method: request.method,
|
|
26
|
-
headers,
|
|
27
|
-
body,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
// Helper function to get the last captured request
|
|
31
|
-
function getLastRequest() {
|
|
32
|
-
return capturedRequests[capturedRequests.length - 1];
|
|
33
|
-
}
|
|
34
|
-
// Helper function to get all captured requests
|
|
35
|
-
function getAllRequests() {
|
|
36
|
-
return [...capturedRequests];
|
|
37
|
-
}
|
|
38
|
-
// Helper function to clear captured requests
|
|
39
|
-
function clearCapturedRequests() {
|
|
40
|
-
capturedRequests.length = 0;
|
|
41
|
-
}
|
|
42
|
-
// Default handlers for common API responses
|
|
43
|
-
exports.handlers = [
|
|
44
|
-
// Default handlers can be added here for common endpoints
|
|
45
|
-
// Individual test files will add their own specific handlers
|
|
46
|
-
];
|
|
47
|
-
// Create MSW server instance
|
|
48
|
-
exports.server = (0, node_1.setupServer)(...exports.handlers);
|
|
49
|
-
// Helper to create a resolver function for MSW handlers
|
|
50
|
-
function createResolver(data, status, headers) {
|
|
51
|
-
return async function resolver({ request }) {
|
|
52
|
-
let body = undefined;
|
|
53
|
-
if (request.method !== 'GET') {
|
|
54
|
-
try {
|
|
55
|
-
body = await request.json();
|
|
56
|
-
}
|
|
57
|
-
catch (_a) {
|
|
58
|
-
// Body might not be JSON
|
|
59
|
-
try {
|
|
60
|
-
body = await request.text();
|
|
61
|
-
}
|
|
62
|
-
catch (_b) {
|
|
63
|
-
// Body might be FormData or not parseable
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
captureRequest({ request, body });
|
|
68
|
-
return msw_1.HttpResponse.json(data, {
|
|
69
|
-
status,
|
|
70
|
-
headers,
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
// Helper to mock a successful API response
|
|
75
|
-
function mockApiResponse({ endpoint, data, options = {}, }) {
|
|
76
|
-
const { status = 200, method = 'GET', headers = {} } = options;
|
|
77
|
-
const resolver = createResolver(data, status, headers);
|
|
78
|
-
const httpMethod = method.toLowerCase();
|
|
79
|
-
exports.server.use(msw_1.http[httpMethod](endpoint, resolver));
|
|
80
|
-
}
|
|
81
|
-
// Helper to mock an error response
|
|
82
|
-
function mockApiError({ endpoint, data, status, options = {}, }) {
|
|
83
|
-
mockApiResponse({ endpoint, data, options: Object.assign(Object.assign({}, options), { status }) });
|
|
84
|
-
}
|
|
85
|
-
// Setup MSW for tests
|
|
86
|
-
(0, vitest_1.beforeAll)(() => {
|
|
87
|
-
exports.server.listen({
|
|
88
|
-
onUnhandledRequest: 'error', // Throw errors for unhandled requests to catch unexpected fetch calls
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
(0, vitest_1.afterEach)(() => {
|
|
92
|
-
exports.server.resetHandlers(); // Reset handlers between tests
|
|
93
|
-
clearCapturedRequests(); // Clear captured requests between tests
|
|
94
|
-
});
|
|
95
|
-
(0, vitest_1.afterAll)(() => {
|
|
96
|
-
exports.server.close(); // Clean up after all tests
|
|
97
|
-
});
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createObsidianFetchAdapter = createObsidianFetchAdapter;
|
|
4
|
-
/**
|
|
5
|
-
* Creates a CustomFetch adapter for Obsidian's requestUrl API.
|
|
6
|
-
*
|
|
7
|
-
* This adapter bridges the gap between Obsidian's requestUrl interface and the
|
|
8
|
-
* standard fetch-like interface expected by the Todoist API SDK.
|
|
9
|
-
*
|
|
10
|
-
* Key differences handled by this adapter:
|
|
11
|
-
* - Obsidian returns response data as properties (response.json, response.text)
|
|
12
|
-
* while the SDK expects methods (response.json(), response.text())
|
|
13
|
-
* - Obsidian's requestUrl bypasses CORS restrictions that would block standard fetch
|
|
14
|
-
* - Obsidian throws on HTTP errors by default; we set throw: false to handle manually
|
|
15
|
-
* - Obsidian doesn't provide statusText; we default to empty string
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* import { requestUrl } from 'obsidian';
|
|
20
|
-
* import { createObsidianFetchAdapter } from './obsidian-fetch-adapter';
|
|
21
|
-
*
|
|
22
|
-
* const api = new TodoistApi('your-token', {
|
|
23
|
-
* customFetch: createObsidianFetchAdapter(requestUrl)
|
|
24
|
-
* });
|
|
25
|
-
* ```
|
|
26
|
-
*
|
|
27
|
-
* @param requestUrl - The Obsidian requestUrl function
|
|
28
|
-
* @returns A CustomFetch function compatible with the Todoist API SDK
|
|
29
|
-
*/
|
|
30
|
-
function createObsidianFetchAdapter(requestUrl) {
|
|
31
|
-
return async (url, options) => {
|
|
32
|
-
// Build the request parameters in Obsidian's format
|
|
33
|
-
const requestParams = {
|
|
34
|
-
url,
|
|
35
|
-
method: (options === null || options === void 0 ? void 0 : options.method) || 'GET',
|
|
36
|
-
headers: options === null || options === void 0 ? void 0 : options.headers,
|
|
37
|
-
body: options === null || options === void 0 ? void 0 : options.body,
|
|
38
|
-
throw: false, // Don't throw on HTTP errors; let the SDK handle status codes
|
|
39
|
-
};
|
|
40
|
-
// Make the request using Obsidian's requestUrl
|
|
41
|
-
const response = await requestUrl(requestParams);
|
|
42
|
-
// Transform Obsidian's response format to match CustomFetchResponse interface
|
|
43
|
-
return {
|
|
44
|
-
ok: response.status >= 200 && response.status < 300,
|
|
45
|
-
status: response.status,
|
|
46
|
-
statusText: '', // Obsidian doesn't provide statusText
|
|
47
|
-
headers: response.headers,
|
|
48
|
-
// Wrap Obsidian's direct properties as methods returning promises
|
|
49
|
-
text: () => Promise.resolve(response.text),
|
|
50
|
-
json: () => Promise.resolve(response.json),
|
|
51
|
-
arrayBuffer: () => Promise.resolve(response.arrayBuffer),
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
}
|