@doist/todoist-api-typescript 6.8.0 → 6.8.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/dist/cjs/todoist-api.js +21 -2
- package/dist/esm/todoist-api.js +21 -2
- package/dist/types/types/requests.d.ts +14 -6
- package/package.json +1 -1
package/dist/cjs/todoist-api.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.TodoistApi = void 0;
|
|
4
15
|
const rest_client_1 = require("./rest-client");
|
|
@@ -1074,8 +1085,16 @@ class TodoistApi {
|
|
|
1074
1085
|
* @returns A promise that resolves to a paginated response of activity events.
|
|
1075
1086
|
*/
|
|
1076
1087
|
async getActivityLogs(args = {}) {
|
|
1077
|
-
|
|
1078
|
-
|
|
1088
|
+
var _a, _b;
|
|
1089
|
+
// Resolve dateFrom: prefer new param, fall back to deprecated `since`
|
|
1090
|
+
const rawDateFrom = (_a = args.dateFrom) !== null && _a !== void 0 ? _a : args.since;
|
|
1091
|
+
const rawDateTo = (_b = args.dateTo) !== null && _b !== void 0 ? _b : args.until;
|
|
1092
|
+
// Convert Date objects to YYYY-MM-DD strings
|
|
1093
|
+
const dateFrom = rawDateFrom instanceof Date ? (0, url_helpers_1.formatDateToYYYYMMDD)(rawDateFrom) : rawDateFrom;
|
|
1094
|
+
const dateTo = rawDateTo instanceof Date ? (0, url_helpers_1.formatDateToYYYYMMDD)(rawDateTo) : rawDateTo;
|
|
1095
|
+
// Destructure out deprecated and raw date fields so they don't leak into the payload
|
|
1096
|
+
const { since: _since, until: _until, dateFrom: _dateFrom, dateTo: _dateTo } = args, rest = __rest(args, ["since", "until", "dateFrom", "dateTo"]);
|
|
1097
|
+
const processedArgs = Object.assign(Object.assign(Object.assign(Object.assign({}, rest), (dateFrom !== undefined ? { dateFrom } : {})), (dateTo !== undefined ? { dateTo } : {})), spreadIfDefined(args.objectType, (v) => ({
|
|
1079
1098
|
objectType: (0, activity_helpers_1.normalizeObjectTypeForApi)(v),
|
|
1080
1099
|
})));
|
|
1081
1100
|
const { data: { results, nextCursor }, } = await (0, rest_client_1.request)({
|
package/dist/esm/todoist-api.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { request, isSuccess } from './rest-client.js';
|
|
2
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_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_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_USER, ENDPOINT_REST_PRODUCTIVITY, ENDPOINT_REST_ACTIVITIES, ENDPOINT_REST_UPLOADS, 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, } from './consts/endpoints.js';
|
|
3
14
|
import { validateAttachment, validateComment, validateCommentArray, validateCurrentUser, validateLabel, validateLabelArray, validateProject, validateProjectArray, validateSection, validateSectionArray, validateTask, validateTaskArray, validateUserArray, validateProductivityStats, validateActivityEventArray, validateWorkspaceUserArray, validateWorkspaceInvitation, validateWorkspaceInvitationArray, validateWorkspacePlanDetails, validateJoinWorkspaceResult, validateWorkspaceArray, } from './utils/validators.js';
|
|
@@ -1071,8 +1082,16 @@ export class TodoistApi {
|
|
|
1071
1082
|
* @returns A promise that resolves to a paginated response of activity events.
|
|
1072
1083
|
*/
|
|
1073
1084
|
async getActivityLogs(args = {}) {
|
|
1074
|
-
|
|
1075
|
-
|
|
1085
|
+
var _a, _b;
|
|
1086
|
+
// Resolve dateFrom: prefer new param, fall back to deprecated `since`
|
|
1087
|
+
const rawDateFrom = (_a = args.dateFrom) !== null && _a !== void 0 ? _a : args.since;
|
|
1088
|
+
const rawDateTo = (_b = args.dateTo) !== null && _b !== void 0 ? _b : args.until;
|
|
1089
|
+
// Convert Date objects to YYYY-MM-DD strings
|
|
1090
|
+
const dateFrom = rawDateFrom instanceof Date ? formatDateToYYYYMMDD(rawDateFrom) : rawDateFrom;
|
|
1091
|
+
const dateTo = rawDateTo instanceof Date ? formatDateToYYYYMMDD(rawDateTo) : rawDateTo;
|
|
1092
|
+
// Destructure out deprecated and raw date fields so they don't leak into the payload
|
|
1093
|
+
const { since: _since, until: _until, dateFrom: _dateFrom, dateTo: _dateTo } = args, rest = __rest(args, ["since", "until", "dateFrom", "dateTo"]);
|
|
1094
|
+
const processedArgs = Object.assign(Object.assign(Object.assign(Object.assign({}, rest), (dateFrom !== undefined ? { dateFrom } : {})), (dateTo !== undefined ? { dateTo } : {})), spreadIfDefined(args.objectType, (v) => ({
|
|
1076
1095
|
objectType: normalizeObjectTypeForApi(v),
|
|
1077
1096
|
})));
|
|
1078
1097
|
const { data: { results, nextCursor }, } = await request({
|
|
@@ -465,14 +465,24 @@ type GetActivityLogsArgsBase = {
|
|
|
465
465
|
* Maximum number of results to return per page.
|
|
466
466
|
*/
|
|
467
467
|
limit?: number;
|
|
468
|
+
/**
|
|
469
|
+
* Start date for filtering events (inclusive). Replaces deprecated `since`.
|
|
470
|
+
* Accepts a Date object or YYYY-MM-DD string.
|
|
471
|
+
*/
|
|
472
|
+
dateFrom?: Date | string;
|
|
473
|
+
/**
|
|
474
|
+
* End date for filtering events (inclusive). Replaces deprecated `until`.
|
|
475
|
+
* Accepts a Date object or YYYY-MM-DD string.
|
|
476
|
+
*/
|
|
477
|
+
dateTo?: Date | string;
|
|
468
478
|
};
|
|
469
479
|
type GetActivityLogsArgsWithDate = GetActivityLogsArgsBase & {
|
|
470
480
|
/**
|
|
471
|
-
*
|
|
481
|
+
* @deprecated Use `dateFrom` instead. Will be removed in the next major version.
|
|
472
482
|
*/
|
|
473
483
|
since?: Date;
|
|
474
484
|
/**
|
|
475
|
-
*
|
|
485
|
+
* @deprecated Use `dateTo` instead. Will be removed in the next major version.
|
|
476
486
|
*/
|
|
477
487
|
until?: Date;
|
|
478
488
|
};
|
|
@@ -482,13 +492,11 @@ type GetActivityLogsArgsWithDate = GetActivityLogsArgsBase & {
|
|
|
482
492
|
*/
|
|
483
493
|
type GetActivityLogsArgsWithString = GetActivityLogsArgsBase & {
|
|
484
494
|
/**
|
|
485
|
-
*
|
|
486
|
-
* @deprecated Use Date object instead. String format will be removed in the next major version.
|
|
495
|
+
* @deprecated Use `dateFrom` instead. Will be removed in the next major version.
|
|
487
496
|
*/
|
|
488
497
|
since?: string;
|
|
489
498
|
/**
|
|
490
|
-
*
|
|
491
|
-
* @deprecated Use Date object instead. String format will be removed in the next major version.
|
|
499
|
+
* @deprecated Use `dateTo` instead. Will be removed in the next major version.
|
|
492
500
|
*/
|
|
493
501
|
until?: string;
|
|
494
502
|
};
|
package/package.json
CHANGED