@doist/todoist-api-typescript 7.9.1 → 7.10.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/README.md +5 -204
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.mjs +1 -0
- package/package.json +12 -92
- package/LICENSE +0 -21
- package/dist/cjs/authentication.js +0 -204
- package/dist/cjs/consts/endpoints.js +0 -141
- package/dist/cjs/index.js +0 -20
- 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 -53
- package/dist/cjs/test-utils/test-defaults.js +0 -240
- package/dist/cjs/todoist-api.js +0 -2623
- package/dist/cjs/transport/fetch-with-retry.js +0 -206
- package/dist/cjs/transport/http-client.js +0 -133
- package/dist/cjs/transport/http-dispatcher.js +0 -72
- 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/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/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 -36
- 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 -84
- 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 -67
- 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 -56
- 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 -22
- 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 -35
- 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/workspace-goals.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 -40
- package/dist/cjs/types/sync/resources/calendars.js +0 -31
- package/dist/cjs/types/sync/resources/collaborators.js +0 -25
- package/dist/cjs/types/sync/resources/completed-info.js +0 -30
- package/dist/cjs/types/sync/resources/filters.js +0 -16
- package/dist/cjs/types/sync/resources/folders.js +0 -14
- package/dist/cjs/types/sync/resources/index.js +0 -33
- package/dist/cjs/types/sync/resources/live-notifications.js +0 -39
- package/dist/cjs/types/sync/resources/notes.js +0 -23
- package/dist/cjs/types/sync/resources/reminders.js +0 -50
- package/dist/cjs/types/sync/resources/suggestions.js +0 -42
- package/dist/cjs/types/sync/resources/tooltips.js +0 -10
- package/dist/cjs/types/sync/resources/user-plan-limits.js +0 -24
- package/dist/cjs/types/sync/resources/user-settings.js +0 -42
- package/dist/cjs/types/sync/resources/user.js +0 -120
- package/dist/cjs/types/sync/resources/view-options.js +0 -83
- package/dist/cjs/types/sync/resources/workspace-filters.js +0 -21
- package/dist/cjs/types/sync/resources/workspace-goals.js +0 -32
- package/dist/cjs/types/sync/resources/workspaces.js +0 -73
- package/dist/cjs/types/sync/response.js +0 -2
- 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/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/workspaces/index.js +0 -18
- package/dist/cjs/types/workspaces/requests.js +0 -2
- package/dist/cjs/types/workspaces/types.js +0 -155
- 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/index.js +0 -25
- package/dist/cjs/utils/multipart-upload.js +0 -178
- package/dist/cjs/utils/processing-helpers.js +0 -18
- package/dist/cjs/utils/sanitization.js +0 -116
- package/dist/cjs/utils/sync-helpers.js +0 -22
- 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 -141
- package/dist/esm/authentication.js +0 -196
- package/dist/esm/consts/endpoints.js +0 -122
- package/dist/esm/index.js +0 -4
- package/dist/esm/test-utils/asserts.js +0 -8
- package/dist/esm/test-utils/msw-setup.js +0 -88
- package/dist/esm/test-utils/obsidian-fetch-adapter.js +0 -50
- package/dist/esm/test-utils/test-defaults.js +0 -237
- package/dist/esm/todoist-api.js +0 -2619
- package/dist/esm/transport/fetch-with-retry.js +0 -203
- package/dist/esm/transport/http-client.js +0 -128
- package/dist/esm/transport/http-dispatcher.js +0 -35
- package/dist/esm/types/activity/index.js +0 -2
- package/dist/esm/types/activity/requests.js +0 -1
- package/dist/esm/types/activity/types.js +0 -25
- package/dist/esm/types/backups/index.js +0 -2
- package/dist/esm/types/backups/requests.js +0 -1
- package/dist/esm/types/backups/types.js +0 -5
- package/dist/esm/types/comments/index.js +0 -2
- package/dist/esm/types/comments/requests.js +0 -1
- package/dist/esm/types/comments/types.js +0 -57
- package/dist/esm/types/common.js +0 -7
- package/dist/esm/types/emails/index.js +0 -1
- package/dist/esm/types/emails/requests.js +0 -2
- package/dist/esm/types/errors.js +0 -24
- package/dist/esm/types/folders/index.js +0 -1
- package/dist/esm/types/folders/requests.js +0 -1
- package/dist/esm/types/http.js +0 -20
- package/dist/esm/types/id-mappings/index.js +0 -2
- package/dist/esm/types/id-mappings/requests.js +0 -17
- package/dist/esm/types/id-mappings/types.js +0 -9
- package/dist/esm/types/index.js +0 -20
- package/dist/esm/types/insights/index.js +0 -2
- package/dist/esm/types/insights/requests.js +0 -1
- package/dist/esm/types/insights/types.js +0 -81
- package/dist/esm/types/labels/index.js +0 -2
- package/dist/esm/types/labels/requests.js +0 -1
- package/dist/esm/types/labels/types.js +0 -8
- package/dist/esm/types/productivity/index.js +0 -1
- package/dist/esm/types/productivity/types.js +0 -64
- package/dist/esm/types/projects/index.js +0 -2
- package/dist/esm/types/projects/requests.js +0 -1
- package/dist/esm/types/projects/types.js +0 -53
- package/dist/esm/types/reminders/index.js +0 -1
- package/dist/esm/types/reminders/requests.js +0 -92
- package/dist/esm/types/sections/index.js +0 -2
- package/dist/esm/types/sections/requests.js +0 -1
- package/dist/esm/types/sections/types.js +0 -19
- package/dist/esm/types/sync/commands/calendars.js +0 -1
- package/dist/esm/types/sync/commands/filters.js +0 -1
- package/dist/esm/types/sync/commands/folders.js +0 -1
- package/dist/esm/types/sync/commands/index.js +0 -19
- package/dist/esm/types/sync/commands/labels.js +0 -2
- package/dist/esm/types/sync/commands/notes.js +0 -1
- package/dist/esm/types/sync/commands/notifications.js +0 -1
- package/dist/esm/types/sync/commands/others.js +0 -1
- package/dist/esm/types/sync/commands/project-view-options.js +0 -1
- package/dist/esm/types/sync/commands/projects.js +0 -1
- package/dist/esm/types/sync/commands/reminders.js +0 -1
- package/dist/esm/types/sync/commands/sections.js +0 -1
- package/dist/esm/types/sync/commands/shared.js +0 -16
- package/dist/esm/types/sync/commands/sharing.js +0 -1
- package/dist/esm/types/sync/commands/tasks.js +0 -1
- package/dist/esm/types/sync/commands/view-options.js +0 -1
- package/dist/esm/types/sync/commands/workspace-filters.js +0 -1
- package/dist/esm/types/sync/commands/workspace-goals.js +0 -1
- package/dist/esm/types/sync/commands/workspaces.js +0 -1
- package/dist/esm/types/sync/index.js +0 -6
- package/dist/esm/types/sync/request.js +0 -1
- package/dist/esm/types/sync/resource-types.js +0 -37
- package/dist/esm/types/sync/resources/calendars.js +0 -28
- package/dist/esm/types/sync/resources/collaborators.js +0 -22
- package/dist/esm/types/sync/resources/completed-info.js +0 -27
- package/dist/esm/types/sync/resources/filters.js +0 -13
- package/dist/esm/types/sync/resources/folders.js +0 -11
- package/dist/esm/types/sync/resources/index.js +0 -17
- package/dist/esm/types/sync/resources/live-notifications.js +0 -36
- package/dist/esm/types/sync/resources/notes.js +0 -20
- package/dist/esm/types/sync/resources/reminders.js +0 -47
- package/dist/esm/types/sync/resources/suggestions.js +0 -39
- package/dist/esm/types/sync/resources/tooltips.js +0 -7
- package/dist/esm/types/sync/resources/user-plan-limits.js +0 -21
- package/dist/esm/types/sync/resources/user-settings.js +0 -39
- package/dist/esm/types/sync/resources/user.js +0 -117
- package/dist/esm/types/sync/resources/view-options.js +0 -80
- package/dist/esm/types/sync/resources/workspace-filters.js +0 -18
- package/dist/esm/types/sync/resources/workspace-goals.js +0 -29
- package/dist/esm/types/sync/resources/workspaces.js +0 -70
- package/dist/esm/types/sync/response.js +0 -1
- package/dist/esm/types/sync/user-preferences.js +0 -68
- package/dist/esm/types/tasks/index.js +0 -2
- package/dist/esm/types/tasks/requests.js +0 -1
- package/dist/esm/types/tasks/types.js +0 -56
- package/dist/esm/types/templates/index.js +0 -1
- package/dist/esm/types/templates/requests.js +0 -1
- package/dist/esm/types/uploads/index.js +0 -1
- package/dist/esm/types/uploads/requests.js +0 -1
- package/dist/esm/types/users/index.js +0 -1
- package/dist/esm/types/users/types.js +0 -48
- package/dist/esm/types/workspaces/index.js +0 -2
- package/dist/esm/types/workspaces/requests.js +0 -1
- package/dist/esm/types/workspaces/types.js +0 -152
- package/dist/esm/utils/activity-helpers.js +0 -53
- package/dist/esm/utils/case-conversion.js +0 -61
- package/dist/esm/utils/colors.js +0 -139
- package/dist/esm/utils/index.js +0 -4
- package/dist/esm/utils/multipart-upload.js +0 -142
- package/dist/esm/utils/processing-helpers.js +0 -12
- package/dist/esm/utils/sanitization.js +0 -112
- package/dist/esm/utils/sync-helpers.js +0 -19
- package/dist/esm/utils/uncompletable-helpers.js +0 -54
- package/dist/esm/utils/url-helpers.js +0 -68
- package/dist/esm/utils/validators.js +0 -132
- package/dist/types/authentication.d.ts +0 -158
- package/dist/types/consts/endpoints.d.ts +0 -81
- package/dist/types/index.d.ts +0 -4
- package/dist/types/test-utils/asserts.d.ts +0 -1
- package/dist/types/test-utils/msw-setup.d.ts +0 -33
- package/dist/types/test-utils/obsidian-fetch-adapter.d.ts +0 -29
- package/dist/types/test-utils/test-defaults.d.ts +0 -261
- package/dist/types/todoist-api.d.ts +0 -1018
- package/dist/types/transport/fetch-with-retry.d.ts +0 -12
- package/dist/types/transport/http-client.d.ts +0 -16
- package/dist/types/transport/http-dispatcher.d.ts +0 -3
- package/dist/types/types/activity/index.d.ts +0 -2
- package/dist/types/types/activity/requests.d.ts +0 -85
- package/dist/types/types/activity/types.d.ts +0 -49
- package/dist/types/types/backups/index.d.ts +0 -2
- package/dist/types/types/backups/requests.d.ts +0 -16
- package/dist/types/types/backups/types.d.ts +0 -7
- package/dist/types/types/comments/index.d.ts +0 -2
- package/dist/types/types/comments/requests.d.ts +0 -64
- package/dist/types/types/comments/types.d.ts +0 -141
- package/dist/types/types/common.d.ts +0 -13
- package/dist/types/types/emails/index.d.ts +0 -1
- package/dist/types/types/emails/requests.d.ts +0 -30
- package/dist/types/types/errors.d.ts +0 -12
- package/dist/types/types/folders/index.d.ts +0 -1
- package/dist/types/types/folders/requests.d.ts +0 -20
- package/dist/types/types/http.d.ts +0 -85
- package/dist/types/types/id-mappings/index.d.ts +0 -2
- package/dist/types/types/id-mappings/requests.d.ts +0 -28
- package/dist/types/types/id-mappings/types.d.ts +0 -13
- package/dist/types/types/index.d.ts +0 -20
- package/dist/types/types/insights/index.d.ts +0 -2
- package/dist/types/types/insights/requests.d.ts +0 -26
- package/dist/types/types/insights/types.d.ts +0 -186
- package/dist/types/types/labels/index.d.ts +0 -2
- package/dist/types/types/labels/requests.d.ts +0 -75
- package/dist/types/types/labels/types.d.ts +0 -13
- package/dist/types/types/productivity/index.d.ts +0 -1
- package/dist/types/types/productivity/types.d.ts +0 -115
- package/dist/types/types/projects/index.d.ts +0 -2
- package/dist/types/types/projects/requests.d.ts +0 -169
- package/dist/types/types/projects/types.d.ts +0 -201
- package/dist/types/types/reminders/index.d.ts +0 -1
- package/dist/types/types/reminders/requests.d.ts +0 -205
- package/dist/types/types/sections/index.d.ts +0 -2
- package/dist/types/types/sections/requests.d.ts +0 -41
- package/dist/types/types/sections/types.d.ts +0 -44
- package/dist/types/types/sync/commands/calendars.d.ts +0 -14
- package/dist/types/types/sync/commands/filters.d.ts +0 -22
- package/dist/types/types/sync/commands/folders.d.ts +0 -18
- package/dist/types/types/sync/commands/index.d.ts +0 -171
- package/dist/types/types/sync/commands/labels.d.ts +0 -32
- package/dist/types/types/sync/commands/notes.d.ts +0 -27
- package/dist/types/types/sync/commands/notifications.d.ts +0 -10
- package/dist/types/types/sync/commands/others.d.ts +0 -39
- package/dist/types/types/sync/commands/project-view-options.d.ts +0 -14
- package/dist/types/types/sync/commands/projects.d.ts +0 -90
- package/dist/types/types/sync/commands/reminders.d.ts +0 -51
- package/dist/types/types/sync/commands/sections.d.ts +0 -31
- package/dist/types/types/sync/commands/shared.d.ts +0 -51
- package/dist/types/types/sync/commands/sharing.d.ts +0 -16
- package/dist/types/types/sync/commands/tasks.d.ts +0 -78
- package/dist/types/types/sync/commands/view-options.d.ts +0 -15
- package/dist/types/types/sync/commands/workspace-filters.d.ts +0 -23
- package/dist/types/types/sync/commands/workspace-goals.d.ts +0 -24
- package/dist/types/types/sync/commands/workspaces.d.ts +0 -79
- package/dist/types/types/sync/index.d.ts +0 -6
- package/dist/types/types/sync/request.d.ts +0 -7
- package/dist/types/types/sync/resource-types.d.ts +0 -5
- package/dist/types/types/sync/resources/calendars.d.ts +0 -38
- package/dist/types/types/sync/resources/collaborators.d.ts +0 -28
- package/dist/types/types/sync/resources/completed-info.d.ts +0 -33
- package/dist/types/types/sync/resources/filters.d.ts +0 -12
- package/dist/types/types/sync/resources/folders.d.ts +0 -10
- package/dist/types/types/sync/resources/index.d.ts +0 -17
- package/dist/types/types/sync/resources/live-notifications.d.ts +0 -32
- package/dist/types/types/sync/resources/notes.d.ts +0 -34
- package/dist/types/types/sync/resources/reminders.d.ts +0 -126
- package/dist/types/types/sync/resources/suggestions.d.ts +0 -96
- package/dist/types/types/sync/resources/tooltips.d.ts +0 -6
- package/dist/types/types/sync/resources/user-plan-limits.d.ts +0 -41
- package/dist/types/types/sync/resources/user-settings.d.ts +0 -40
- package/dist/types/types/sync/resources/user.d.ts +0 -134
- package/dist/types/types/sync/resources/view-options.d.ts +0 -169
- package/dist/types/types/sync/resources/workspace-filters.d.ts +0 -17
- package/dist/types/types/sync/resources/workspace-goals.d.ts +0 -29
- package/dist/types/types/sync/resources/workspaces.d.ts +0 -142
- package/dist/types/types/sync/response.d.ts +0 -51
- package/dist/types/types/sync/user-preferences.d.ts +0 -39
- package/dist/types/types/tasks/index.d.ts +0 -2
- package/dist/types/types/tasks/requests.d.ts +0 -197
- package/dist/types/types/tasks/types.d.ts +0 -162
- package/dist/types/types/templates/index.d.ts +0 -1
- package/dist/types/types/templates/requests.d.ts +0 -92
- package/dist/types/types/uploads/index.d.ts +0 -1
- package/dist/types/types/uploads/requests.d.ts +0 -32
- package/dist/types/types/users/index.d.ts +0 -1
- package/dist/types/types/users/types.d.ts +0 -66
- package/dist/types/types/workspaces/index.d.ts +0 -2
- package/dist/types/types/workspaces/requests.d.ts +0 -260
- package/dist/types/types/workspaces/types.d.ts +0 -267
- package/dist/types/utils/activity-helpers.d.ts +0 -28
- package/dist/types/utils/case-conversion.d.ts +0 -12
- package/dist/types/utils/colors.d.ts +0 -197
- package/dist/types/utils/index.d.ts +0 -4
- package/dist/types/utils/multipart-upload.d.ts +0 -54
- package/dist/types/utils/processing-helpers.d.ts +0 -1
- package/dist/types/utils/sanitization.d.ts +0 -35
- package/dist/types/utils/sync-helpers.d.ts +0 -17
- package/dist/types/utils/uncompletable-helpers.d.ts +0 -30
- package/dist/types/utils/url-helpers.d.ts +0 -32
- package/dist/types/utils/validators.d.ts +0 -1404
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeObjectTypeForApi = normalizeObjectTypeForApi;
|
|
4
|
-
exports.denormalizeObjectTypeFromApi = denormalizeObjectTypeFromApi;
|
|
5
|
-
exports.normalizeObjectEventTypeForApi = normalizeObjectEventTypeForApi;
|
|
6
|
-
/**
|
|
7
|
-
* Converts modern SDK object type naming to legacy API naming.
|
|
8
|
-
* Maps 'task' -> 'item' and 'comment' -> 'note' for API requests.
|
|
9
|
-
* Other values pass through unchanged.
|
|
10
|
-
*
|
|
11
|
-
* @internal
|
|
12
|
-
* @param objectType The object type using modern naming.
|
|
13
|
-
* @returns The object type using legacy API naming.
|
|
14
|
-
*/
|
|
15
|
-
function normalizeObjectTypeForApi(objectType) {
|
|
16
|
-
if (!objectType)
|
|
17
|
-
return objectType;
|
|
18
|
-
if (objectType === 'task')
|
|
19
|
-
return 'item';
|
|
20
|
-
if (objectType === 'comment')
|
|
21
|
-
return 'note';
|
|
22
|
-
return objectType;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Converts legacy API object type naming to modern SDK naming.
|
|
26
|
-
* Maps 'item' -> 'task' and 'note' -> 'comment' for SDK responses.
|
|
27
|
-
* Other values pass through unchanged.
|
|
28
|
-
*
|
|
29
|
-
* @internal
|
|
30
|
-
* @param objectType The object type using legacy API naming.
|
|
31
|
-
* @returns The object type using modern SDK naming.
|
|
32
|
-
*/
|
|
33
|
-
function denormalizeObjectTypeFromApi(objectType) {
|
|
34
|
-
if (!objectType)
|
|
35
|
-
return objectType;
|
|
36
|
-
if (objectType === 'item')
|
|
37
|
-
return 'task';
|
|
38
|
-
if (objectType === 'note')
|
|
39
|
-
return 'comment';
|
|
40
|
-
return objectType;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Normalizes an `ActivityObjectEventType` filter string for the API,
|
|
44
|
-
* converting modern object type names to legacy API names.
|
|
45
|
-
* e.g. 'task:added' -> 'item:added', 'comment:' -> 'note:', ':deleted' -> ':deleted'
|
|
46
|
-
*
|
|
47
|
-
* @internal
|
|
48
|
-
*/
|
|
49
|
-
function normalizeObjectEventTypeForApi(filter) {
|
|
50
|
-
var _a, _b;
|
|
51
|
-
const colonIndex = filter.indexOf(':');
|
|
52
|
-
if (colonIndex === -1) {
|
|
53
|
-
return (_a = normalizeObjectTypeForApi(filter)) !== null && _a !== void 0 ? _a : filter;
|
|
54
|
-
}
|
|
55
|
-
const objectPart = filter.slice(0, colonIndex);
|
|
56
|
-
const eventPart = filter.slice(colonIndex); // includes the colon
|
|
57
|
-
return `${(_b = normalizeObjectTypeForApi(objectPart)) !== null && _b !== void 0 ? _b : objectPart}${eventPart}`;
|
|
58
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.customCamelCase = customCamelCase;
|
|
7
|
-
exports.camelCaseKeys = camelCaseKeys;
|
|
8
|
-
exports.snakeCaseKeys = snakeCaseKeys;
|
|
9
|
-
const camelcase_1 = __importDefault(require("camelcase"));
|
|
10
|
-
const emoji_regex_1 = __importDefault(require("emoji-regex"));
|
|
11
|
-
/**
|
|
12
|
-
* Checks if a string is a solitary emoji
|
|
13
|
-
*/
|
|
14
|
-
function isEmojiKey(input) {
|
|
15
|
-
const regex = (0, emoji_regex_1.default)();
|
|
16
|
-
const match = input.match(regex);
|
|
17
|
-
return match !== null && match.join('') === input;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Custom camelCase function that preserves emoji strings
|
|
21
|
-
*/
|
|
22
|
-
function customCamelCase(input) {
|
|
23
|
-
// If the value is a solitary emoji string, return the key as-is
|
|
24
|
-
if (isEmojiKey(input)) {
|
|
25
|
-
return input;
|
|
26
|
-
}
|
|
27
|
-
return (0, camelcase_1.default)(input);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Converts object keys from snake_case to camelCase recursively
|
|
31
|
-
*/
|
|
32
|
-
function camelCaseKeys(obj) {
|
|
33
|
-
if (obj === null || obj === undefined) {
|
|
34
|
-
return obj;
|
|
35
|
-
}
|
|
36
|
-
if (Array.isArray(obj)) {
|
|
37
|
-
return obj.map((item) => camelCaseKeys(item));
|
|
38
|
-
}
|
|
39
|
-
if (typeof obj === 'object' && obj.constructor === Object) {
|
|
40
|
-
const converted = {};
|
|
41
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
42
|
-
const camelKey = customCamelCase(key);
|
|
43
|
-
converted[camelKey] = camelCaseKeys(value);
|
|
44
|
-
}
|
|
45
|
-
return converted;
|
|
46
|
-
}
|
|
47
|
-
return obj;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Converts object keys from camelCase to snake_case recursively
|
|
51
|
-
*/
|
|
52
|
-
function snakeCaseKeys(obj) {
|
|
53
|
-
if (obj === null || obj === undefined) {
|
|
54
|
-
return obj;
|
|
55
|
-
}
|
|
56
|
-
if (Array.isArray(obj)) {
|
|
57
|
-
return obj.map((item) => snakeCaseKeys(item));
|
|
58
|
-
}
|
|
59
|
-
if (typeof obj === 'object' && obj.constructor === Object) {
|
|
60
|
-
const converted = {};
|
|
61
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
62
|
-
// Convert camelCase to snake_case
|
|
63
|
-
const snakeKey = key.replace(/([A-Z])/g, '_$1').toLowerCase();
|
|
64
|
-
converted[snakeKey] = snakeCaseKeys(value);
|
|
65
|
-
}
|
|
66
|
-
return converted;
|
|
67
|
-
}
|
|
68
|
-
return obj;
|
|
69
|
-
}
|
package/dist/cjs/utils/colors.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultColor = exports.colors = exports.taupe = exports.grey = exports.charcoal = exports.salmon = exports.magenta = exports.lavender = exports.violet = exports.grape = exports.blue = exports.lightBlue = exports.skyBlue = exports.teal = exports.mintGreen = exports.green = exports.limeGreen = exports.oliveGreen = exports.yellow = exports.orange = exports.red = exports.berryRed = void 0;
|
|
4
|
-
exports.getColorByKey = getColorByKey;
|
|
5
|
-
exports.berryRed = {
|
|
6
|
-
key: 'berry_red',
|
|
7
|
-
displayName: 'Berry Red',
|
|
8
|
-
hexValue: '#b8255f',
|
|
9
|
-
};
|
|
10
|
-
exports.red = {
|
|
11
|
-
key: 'red',
|
|
12
|
-
displayName: 'Red',
|
|
13
|
-
hexValue: '#db4035',
|
|
14
|
-
};
|
|
15
|
-
exports.orange = {
|
|
16
|
-
key: 'orange',
|
|
17
|
-
displayName: 'Orange',
|
|
18
|
-
hexValue: '#ff9933',
|
|
19
|
-
};
|
|
20
|
-
exports.yellow = {
|
|
21
|
-
key: 'yellow',
|
|
22
|
-
displayName: 'Yellow',
|
|
23
|
-
hexValue: '#fad000',
|
|
24
|
-
};
|
|
25
|
-
exports.oliveGreen = {
|
|
26
|
-
key: 'olive_green',
|
|
27
|
-
displayName: 'Olive Green',
|
|
28
|
-
hexValue: '#afb83b',
|
|
29
|
-
};
|
|
30
|
-
exports.limeGreen = {
|
|
31
|
-
key: 'lime_green',
|
|
32
|
-
displayName: 'Lime Green',
|
|
33
|
-
hexValue: '#7ecc49',
|
|
34
|
-
};
|
|
35
|
-
exports.green = {
|
|
36
|
-
key: 'green',
|
|
37
|
-
displayName: 'Green',
|
|
38
|
-
hexValue: '#299438',
|
|
39
|
-
};
|
|
40
|
-
exports.mintGreen = {
|
|
41
|
-
key: 'mint_green',
|
|
42
|
-
displayName: 'Mint Green',
|
|
43
|
-
hexValue: '#6accbc',
|
|
44
|
-
};
|
|
45
|
-
exports.teal = {
|
|
46
|
-
key: 'teal',
|
|
47
|
-
displayName: 'Teal',
|
|
48
|
-
hexValue: '#158fad',
|
|
49
|
-
};
|
|
50
|
-
exports.skyBlue = {
|
|
51
|
-
key: 'sky_blue',
|
|
52
|
-
displayName: 'Sky Blue',
|
|
53
|
-
hexValue: '#14aaf5',
|
|
54
|
-
};
|
|
55
|
-
exports.lightBlue = {
|
|
56
|
-
key: 'light_blue',
|
|
57
|
-
displayName: 'Light Blue',
|
|
58
|
-
hexValue: '#96c3eb',
|
|
59
|
-
};
|
|
60
|
-
exports.blue = {
|
|
61
|
-
key: 'blue',
|
|
62
|
-
displayName: 'Blue',
|
|
63
|
-
hexValue: '#4073ff',
|
|
64
|
-
};
|
|
65
|
-
exports.grape = {
|
|
66
|
-
key: 'grape',
|
|
67
|
-
displayName: 'Grape',
|
|
68
|
-
hexValue: '#884dff',
|
|
69
|
-
};
|
|
70
|
-
exports.violet = {
|
|
71
|
-
key: 'violet',
|
|
72
|
-
displayName: 'Violet',
|
|
73
|
-
hexValue: '#af38eb',
|
|
74
|
-
};
|
|
75
|
-
exports.lavender = {
|
|
76
|
-
key: 'lavender',
|
|
77
|
-
displayName: 'Lavender',
|
|
78
|
-
hexValue: '#eb96eb',
|
|
79
|
-
};
|
|
80
|
-
exports.magenta = {
|
|
81
|
-
key: 'magenta',
|
|
82
|
-
displayName: 'Magenta',
|
|
83
|
-
hexValue: '#e05194',
|
|
84
|
-
};
|
|
85
|
-
exports.salmon = {
|
|
86
|
-
key: 'salmon',
|
|
87
|
-
displayName: 'Salmon',
|
|
88
|
-
hexValue: '#ff8d85',
|
|
89
|
-
};
|
|
90
|
-
exports.charcoal = {
|
|
91
|
-
key: 'charcoal',
|
|
92
|
-
displayName: 'Charcoal',
|
|
93
|
-
hexValue: '#808080',
|
|
94
|
-
};
|
|
95
|
-
exports.grey = {
|
|
96
|
-
key: 'grey',
|
|
97
|
-
displayName: 'Grey',
|
|
98
|
-
hexValue: '#b8b8b8',
|
|
99
|
-
};
|
|
100
|
-
exports.taupe = {
|
|
101
|
-
key: 'taupe',
|
|
102
|
-
displayName: 'Taupe',
|
|
103
|
-
hexValue: '#ccac93',
|
|
104
|
-
};
|
|
105
|
-
exports.colors = [
|
|
106
|
-
exports.berryRed,
|
|
107
|
-
exports.red,
|
|
108
|
-
exports.orange,
|
|
109
|
-
exports.yellow,
|
|
110
|
-
exports.oliveGreen,
|
|
111
|
-
exports.limeGreen,
|
|
112
|
-
exports.green,
|
|
113
|
-
exports.mintGreen,
|
|
114
|
-
exports.teal,
|
|
115
|
-
exports.skyBlue,
|
|
116
|
-
exports.lightBlue,
|
|
117
|
-
exports.blue,
|
|
118
|
-
exports.grape,
|
|
119
|
-
exports.violet,
|
|
120
|
-
exports.lavender,
|
|
121
|
-
exports.magenta,
|
|
122
|
-
exports.salmon,
|
|
123
|
-
exports.charcoal,
|
|
124
|
-
exports.grey,
|
|
125
|
-
exports.taupe,
|
|
126
|
-
];
|
|
127
|
-
exports.defaultColor = exports.charcoal;
|
|
128
|
-
/**
|
|
129
|
-
* Retrieves a {@link Color} object by its key identifier.
|
|
130
|
-
*
|
|
131
|
-
* @param colorKey - The unique key identifier of the color to find (e.g., 'berry_red', 'sky_blue')
|
|
132
|
-
* @returns The matching Color object if found, otherwise returns the default color (charcoal)
|
|
133
|
-
*
|
|
134
|
-
* @example
|
|
135
|
-
* ```typescript
|
|
136
|
-
* const color = getColorByKey('berry_red');
|
|
137
|
-
* console.log(color.hexValue); // '#b8255f'
|
|
138
|
-
* ```
|
|
139
|
-
*/
|
|
140
|
-
function getColorByKey(colorKey) {
|
|
141
|
-
const color = exports.colors.find((color) => color.key === colorKey);
|
|
142
|
-
return color !== null && color !== void 0 ? color : exports.defaultColor;
|
|
143
|
-
}
|
package/dist/cjs/utils/index.js
DELETED
|
@@ -1,25 +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.createCommand = exports.getSectionUrl = exports.getProjectUrl = exports.getTaskUrl = void 0;
|
|
18
|
-
__exportStar(require("./colors"), exports);
|
|
19
|
-
__exportStar(require("./sanitization"), exports);
|
|
20
|
-
var url_helpers_1 = require("./url-helpers");
|
|
21
|
-
Object.defineProperty(exports, "getTaskUrl", { enumerable: true, get: function () { return url_helpers_1.getTaskUrl; } });
|
|
22
|
-
Object.defineProperty(exports, "getProjectUrl", { enumerable: true, get: function () { return url_helpers_1.getProjectUrl; } });
|
|
23
|
-
Object.defineProperty(exports, "getSectionUrl", { enumerable: true, get: function () { return url_helpers_1.getSectionUrl; } });
|
|
24
|
-
var sync_helpers_1 = require("./sync-helpers");
|
|
25
|
-
Object.defineProperty(exports, "createCommand", { enumerable: true, get: function () { return sync_helpers_1.createCommand; } });
|
|
@@ -1,178 +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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.uploadMultipartFile = uploadMultipartFile;
|
|
37
|
-
const fetch_with_retry_1 = require("../transport/fetch-with-retry");
|
|
38
|
-
/**
|
|
39
|
-
* Helper function to determine content-type from filename extension.
|
|
40
|
-
* @param fileName - The filename to analyze
|
|
41
|
-
* @returns The appropriate MIME type
|
|
42
|
-
*/
|
|
43
|
-
function getContentTypeFromFileName(fileName) {
|
|
44
|
-
const extension = fileName.toLowerCase().split('.').pop();
|
|
45
|
-
switch (extension) {
|
|
46
|
-
case 'png':
|
|
47
|
-
return 'image/png';
|
|
48
|
-
case 'jpg':
|
|
49
|
-
case 'jpeg':
|
|
50
|
-
return 'image/jpeg';
|
|
51
|
-
case 'gif':
|
|
52
|
-
return 'image/gif';
|
|
53
|
-
case 'webp':
|
|
54
|
-
return 'image/webp';
|
|
55
|
-
case 'svg':
|
|
56
|
-
return 'image/svg+xml';
|
|
57
|
-
default:
|
|
58
|
-
return 'application/octet-stream';
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Uploads a file using multipart/form-data.
|
|
63
|
-
*
|
|
64
|
-
* This is a shared utility for uploading files to Todoist endpoints that require
|
|
65
|
-
* multipart/form-data content type (e.g., file uploads, workspace logo uploads).
|
|
66
|
-
*
|
|
67
|
-
* Supports both browser (Blob/File) and Node.js (Buffer/ReadableStream/path) environments.
|
|
68
|
-
*
|
|
69
|
-
* @param baseUrl - The base API URL (e.g., https://api.todoist.com/api/v1/)
|
|
70
|
-
* @param authToken - The authentication token
|
|
71
|
-
* @param endpoint - The relative endpoint path (e.g., 'uploads', 'workspaces/logo')
|
|
72
|
-
* @param file - The file content (Blob/File for browser, or Buffer/ReadableStream/path for Node)
|
|
73
|
-
* @param fileName - Optional file name (required for Buffer/Stream, optional for paths and File objects)
|
|
74
|
-
* @param additionalFields - Additional form fields to include (e.g., project_id, workspace_id)
|
|
75
|
-
* @param requestId - Optional request ID for idempotency
|
|
76
|
-
* @returns The response data from the server
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```typescript
|
|
80
|
-
* // Upload from a file path
|
|
81
|
-
* const result = await uploadMultipartFile(
|
|
82
|
-
* 'https://api.todoist.com/api/v1/',
|
|
83
|
-
* 'my-token',
|
|
84
|
-
* 'uploads',
|
|
85
|
-
* '/path/to/file.pdf',
|
|
86
|
-
* undefined,
|
|
87
|
-
* { project_id: '12345' }
|
|
88
|
-
* )
|
|
89
|
-
*
|
|
90
|
-
* // Upload from a Buffer
|
|
91
|
-
* const buffer = Buffer.from('file content')
|
|
92
|
-
* const result = await uploadMultipartFile(
|
|
93
|
-
* 'https://api.todoist.com/api/v1/',
|
|
94
|
-
* 'my-token',
|
|
95
|
-
* 'uploads',
|
|
96
|
-
* buffer,
|
|
97
|
-
* 'document.pdf',
|
|
98
|
-
* { project_id: '12345' }
|
|
99
|
-
* )
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
async function uploadMultipartFile(args) {
|
|
103
|
-
const { baseUrl, authToken, endpoint, file, fileName, additionalFields, requestId, customFetch, } = args;
|
|
104
|
-
// Build the full URL
|
|
105
|
-
const url = `${baseUrl}${endpoint}`;
|
|
106
|
-
let body;
|
|
107
|
-
const headers = {
|
|
108
|
-
Authorization: `Bearer ${authToken}`,
|
|
109
|
-
};
|
|
110
|
-
if (requestId) {
|
|
111
|
-
headers['X-Request-Id'] = requestId;
|
|
112
|
-
}
|
|
113
|
-
if (file instanceof Blob) {
|
|
114
|
-
// Browser path: use native FormData
|
|
115
|
-
const form = new globalThis.FormData();
|
|
116
|
-
const resolvedFileName = fileName || (file instanceof File ? file.name : undefined) || 'upload';
|
|
117
|
-
form.append('file', file, resolvedFileName);
|
|
118
|
-
for (const [key, value] of Object.entries(additionalFields)) {
|
|
119
|
-
if (value !== undefined && value !== null) {
|
|
120
|
-
form.append(key, value.toString());
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
// Don't set Content-Type — let fetch set it with the correct multipart boundary
|
|
124
|
-
body = form;
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
// Node path: dynamically import Node-only modules
|
|
128
|
-
const [FormDataModule, fsModule, pathModule] = await Promise.all([
|
|
129
|
-
Promise.resolve().then(() => __importStar(require('form-data'))),
|
|
130
|
-
Promise.resolve().then(() => __importStar(require('fs'))),
|
|
131
|
-
Promise.resolve().then(() => __importStar(require('path'))),
|
|
132
|
-
]);
|
|
133
|
-
const FormData = FormDataModule.default;
|
|
134
|
-
const form = new FormData();
|
|
135
|
-
if (typeof file === 'string') {
|
|
136
|
-
// File path - create read stream
|
|
137
|
-
const resolvedFileName = fileName || pathModule.basename(file);
|
|
138
|
-
form.append('file', fsModule.createReadStream(file), resolvedFileName);
|
|
139
|
-
}
|
|
140
|
-
else if (Buffer.isBuffer(file)) {
|
|
141
|
-
// Buffer - require fileName
|
|
142
|
-
if (!fileName) {
|
|
143
|
-
throw new Error('fileName is required when uploading from a Buffer');
|
|
144
|
-
}
|
|
145
|
-
const contentType = getContentTypeFromFileName(fileName);
|
|
146
|
-
form.append('file', file, {
|
|
147
|
-
filename: fileName,
|
|
148
|
-
contentType: contentType,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
// Stream - require fileName
|
|
153
|
-
if (!fileName) {
|
|
154
|
-
throw new Error('fileName is required when uploading from a stream');
|
|
155
|
-
}
|
|
156
|
-
form.append('file', file, fileName);
|
|
157
|
-
}
|
|
158
|
-
for (const [key, value] of Object.entries(additionalFields)) {
|
|
159
|
-
if (value !== undefined && value !== null) {
|
|
160
|
-
form.append(key, value.toString());
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
Object.assign(headers, form.getHeaders());
|
|
164
|
-
body = form;
|
|
165
|
-
}
|
|
166
|
-
// Make the request using fetch
|
|
167
|
-
const response = await (0, fetch_with_retry_1.fetchWithRetry)({
|
|
168
|
-
url,
|
|
169
|
-
options: {
|
|
170
|
-
method: 'POST',
|
|
171
|
-
body,
|
|
172
|
-
headers,
|
|
173
|
-
timeout: 30000, // 30 second timeout for file uploads
|
|
174
|
-
},
|
|
175
|
-
customFetch,
|
|
176
|
-
});
|
|
177
|
-
return response.data;
|
|
178
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.customCamelCase = customCamelCase;
|
|
7
|
-
const camelcase_1 = __importDefault(require("camelcase"));
|
|
8
|
-
const emoji_regex_1 = __importDefault(require("emoji-regex"));
|
|
9
|
-
function isEmojiKey(key) {
|
|
10
|
-
const regex = (0, emoji_regex_1.default)();
|
|
11
|
-
return regex.test(key);
|
|
12
|
-
}
|
|
13
|
-
function customCamelCase(input) {
|
|
14
|
-
// If the value is a solitary emoji string, return the key as-is
|
|
15
|
-
if (isEmojiKey(input))
|
|
16
|
-
return input;
|
|
17
|
-
return (0, camelcase_1.default)(input);
|
|
18
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSanitizedContent = getSanitizedContent;
|
|
4
|
-
exports.getSanitizedTasks = getSanitizedTasks;
|
|
5
|
-
const BOLD_FORMAT = /(^|[\s!?,;>:]+)(?:\*\*|__|!!)(.+?)(\*\*|__|!!)(?=$|[\s!?,;><:]+)/gi;
|
|
6
|
-
const ITALIC_FORMAT = /(^|[\s!?,;>:]+)(?:\*|_|!)(.+?)(\*|_|!)(?=$|[\s!?,;><:]+)/gi;
|
|
7
|
-
const BOLD_ITALIC_FORMAT = /(^|[\s!?,;>:]+)(?:\*\*\*|___|!!!)(.+?)(\*\*\*|___|!!!)(?=$|[\s!?,;><:]+)/gi;
|
|
8
|
-
const CODE_BLOCK_FORMAT = /```([\s\S]*?)```/gi;
|
|
9
|
-
const CODE_INLINE_FORMAT = /`([^`]+)`/gi;
|
|
10
|
-
const TODOIST_LINK = /((?:(?:onenote:)?[\w-]+):\/\/[^\s]+)\s+[[(]([^)]+)[\])]/gi;
|
|
11
|
-
const MARKDOWN_LINK = /\[(.+?)\]\((.+?)\)/gi;
|
|
12
|
-
const GMAIL_LINK = /\[\[gmail=(.+?),\s*(.+?)\]\]/gi;
|
|
13
|
-
const OUTLOOK_LINK = /\[\[outlook=(.+?),\s*(.+?)\]\]/gi;
|
|
14
|
-
const THUNDERBIRD_LINK = /\[\[thunderbird\n(.+)\n(.+)\n\s*\]\]/gi;
|
|
15
|
-
const FAKE_SECTION_PREFIX = '* ';
|
|
16
|
-
const FAKE_SECTION_SUFFIX = ':';
|
|
17
|
-
function removeStyleFormatting(input) {
|
|
18
|
-
if (!input.includes('!') && !input.includes('*') && !input.includes('_')) {
|
|
19
|
-
return input;
|
|
20
|
-
}
|
|
21
|
-
function removeMarkdown(_match, prefix, text) {
|
|
22
|
-
return `${prefix}${text}`;
|
|
23
|
-
}
|
|
24
|
-
input = input.replace(BOLD_ITALIC_FORMAT, removeMarkdown);
|
|
25
|
-
input = input.replace(BOLD_FORMAT, removeMarkdown);
|
|
26
|
-
input = input.replace(ITALIC_FORMAT, removeMarkdown);
|
|
27
|
-
return input;
|
|
28
|
-
}
|
|
29
|
-
function removeCodeFormatting(input) {
|
|
30
|
-
function removeMarkdown(_match, text) {
|
|
31
|
-
return text;
|
|
32
|
-
}
|
|
33
|
-
input = input.replace(CODE_BLOCK_FORMAT, removeMarkdown);
|
|
34
|
-
input = input.replace(CODE_INLINE_FORMAT, removeMarkdown);
|
|
35
|
-
return input;
|
|
36
|
-
}
|
|
37
|
-
function removeFakeSectionFormatting(input) {
|
|
38
|
-
if (input.startsWith(FAKE_SECTION_PREFIX)) {
|
|
39
|
-
input = input.slice(FAKE_SECTION_PREFIX.length);
|
|
40
|
-
}
|
|
41
|
-
if (input.endsWith(FAKE_SECTION_SUFFIX)) {
|
|
42
|
-
input = input.slice(0, input.length - FAKE_SECTION_SUFFIX.length);
|
|
43
|
-
}
|
|
44
|
-
return input;
|
|
45
|
-
}
|
|
46
|
-
function removeMarkdownLinks(input) {
|
|
47
|
-
if (!input.includes('[') || !input.includes(']')) {
|
|
48
|
-
return input;
|
|
49
|
-
}
|
|
50
|
-
function removeMarkdown(_match, text) {
|
|
51
|
-
return text;
|
|
52
|
-
}
|
|
53
|
-
return input.replace(MARKDOWN_LINK, removeMarkdown);
|
|
54
|
-
}
|
|
55
|
-
function removeTodoistLinks(input) {
|
|
56
|
-
if (!input.includes('(') || !input.includes(')')) {
|
|
57
|
-
return input;
|
|
58
|
-
}
|
|
59
|
-
function removeMarkdown(_match, _url, text) {
|
|
60
|
-
return text;
|
|
61
|
-
}
|
|
62
|
-
return input.replace(TODOIST_LINK, removeMarkdown);
|
|
63
|
-
}
|
|
64
|
-
function removeAppLinks(input) {
|
|
65
|
-
if (input.includes('gmail')) {
|
|
66
|
-
input = input.replace(GMAIL_LINK, (_match, _id, text) => text);
|
|
67
|
-
}
|
|
68
|
-
if (input.includes('outlook')) {
|
|
69
|
-
input = input.replace(OUTLOOK_LINK, (_match, _id, text) => text);
|
|
70
|
-
}
|
|
71
|
-
if (input.includes('thunderbird')) {
|
|
72
|
-
input = input.replace(THUNDERBIRD_LINK, (_match, text) => text);
|
|
73
|
-
}
|
|
74
|
-
return input;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Sanitizes a string by removing Todoist's formatting syntax (e.g. bold, italic, code blocks, links).
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* // Removes bold/italic formatting
|
|
81
|
-
* getSanitizedContent('Some **bold** and *italic*') // 'Some bold and italic'
|
|
82
|
-
*
|
|
83
|
-
* // Removes markdown links
|
|
84
|
-
* getSanitizedContent('A [markdown](http://url.com) link') // 'A markdown link'
|
|
85
|
-
*
|
|
86
|
-
* // Removes app-specific links
|
|
87
|
-
* getSanitizedContent('A [[gmail=id, link from gmail]]') // 'A link from gmail'
|
|
88
|
-
*
|
|
89
|
-
* @param input - The string to sanitize
|
|
90
|
-
* @returns The sanitized string with all formatting removed
|
|
91
|
-
*/
|
|
92
|
-
function getSanitizedContent(input) {
|
|
93
|
-
input = removeStyleFormatting(input);
|
|
94
|
-
input = removeCodeFormatting(input);
|
|
95
|
-
input = removeFakeSectionFormatting(input);
|
|
96
|
-
input = removeMarkdownLinks(input);
|
|
97
|
-
input = removeTodoistLinks(input);
|
|
98
|
-
input = removeAppLinks(input);
|
|
99
|
-
return input;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Takes an array of tasks and returns a new array with sanitized content
|
|
103
|
-
* added as 'sanitizedContent' property to each task.
|
|
104
|
-
*
|
|
105
|
-
* @see {@link getSanitizedContent}
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* const tasks = [{ content: '**Bold** task', ... }]
|
|
109
|
-
* getSanitizedTasks(tasks) // [{ content: '**Bold** task', sanitizedContent: 'Bold task', ... }]
|
|
110
|
-
*
|
|
111
|
-
* @param tasks - Array of Task objects to sanitize
|
|
112
|
-
* @returns Array of tasks with added sanitizedContent property
|
|
113
|
-
*/
|
|
114
|
-
function getSanitizedTasks(tasks) {
|
|
115
|
-
return tasks.map((task) => (Object.assign(Object.assign({}, task), { sanitizedContent: getSanitizedContent(task.content) })));
|
|
116
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createCommand = createCommand;
|
|
4
|
-
const uuid_1 = require("uuid");
|
|
5
|
-
/**
|
|
6
|
-
* Creates a strongly-typed Sync API command with an auto-generated UUID.
|
|
7
|
-
*
|
|
8
|
-
* @param type - The command type (e.g. `'item_add'`, `'project_update'`).
|
|
9
|
-
* @param args - The command arguments, constrained by the command type.
|
|
10
|
-
* @param tempId - Optional temporary ID for referencing the created resource in subsequent commands.
|
|
11
|
-
* @returns A fully formed `SyncCommand` ready to include in a sync request.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const cmd = createCommand('item_add', { content: 'Buy milk', priority: 2 })
|
|
16
|
-
* // cmd.type === 'item_add'
|
|
17
|
-
* // cmd.args is typed as TaskAddArgs
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
function createCommand(type, args, tempId) {
|
|
21
|
-
return Object.assign({ type, uuid: (0, uuid_1.v4)(), args: args }, (tempId !== undefined ? { tempId } : {}));
|
|
22
|
-
}
|