@doist/todoist-api-typescript 6.6.0 → 6.8.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/cjs/todoist-api.js +33 -4
- package/dist/cjs/types/sync/index.js +1 -0
- package/dist/cjs/types/sync/resources/live-notifications.js +11 -0
- package/dist/cjs/types/sync/resources/user.js +7 -6
- package/dist/cjs/types/sync/resources/workspaces.js +7 -0
- package/dist/cjs/types/sync/user-preferences.js +51 -0
- package/dist/esm/todoist-api.js +33 -4
- package/dist/esm/types/sync/index.js +1 -0
- package/dist/esm/types/sync/resources/live-notifications.js +11 -0
- package/dist/esm/types/sync/resources/user.js +7 -6
- package/dist/esm/types/sync/resources/workspaces.js +7 -0
- package/dist/esm/types/sync/user-preferences.js +48 -0
- package/dist/types/types/sync/commands/index.d.ts +5 -2
- package/dist/types/types/sync/commands/others.d.ts +26 -1
- package/dist/types/types/sync/commands/reminders.d.ts +23 -0
- package/dist/types/types/sync/commands/tasks.d.ts +2 -2
- package/dist/types/types/sync/index.d.ts +1 -0
- package/dist/types/types/sync/resources/live-notifications.d.ts +9 -0
- package/dist/types/types/sync/resources/user.d.ts +6 -6
- package/dist/types/types/sync/resources/workspaces.d.ts +5 -0
- package/dist/types/types/sync/user-preferences.d.ts +13 -0
- package/dist/types/utils/validators.d.ts +34 -6
- package/package.json +1 -1
package/dist/cjs/todoist-api.js
CHANGED
|
@@ -10,6 +10,7 @@ const activity_helpers_1 = require("./utils/activity-helpers");
|
|
|
10
10
|
const uncompletable_helpers_1 = require("./utils/uncompletable-helpers");
|
|
11
11
|
const zod_1 = require("zod");
|
|
12
12
|
const uuid_1 = require("uuid");
|
|
13
|
+
const sync_1 = require("./types/sync");
|
|
13
14
|
const types_1 = require("./types");
|
|
14
15
|
const MAX_COMMAND_COUNT = 100;
|
|
15
16
|
/**
|
|
@@ -20,6 +21,29 @@ const MAX_COMMAND_COUNT = 100;
|
|
|
20
21
|
function generatePath(...segments) {
|
|
21
22
|
return segments.join('/');
|
|
22
23
|
}
|
|
24
|
+
function spreadIfDefined(value, fn) {
|
|
25
|
+
return value !== undefined ? fn(value) : {};
|
|
26
|
+
}
|
|
27
|
+
function serializeUserUpdateArgs(args) {
|
|
28
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, args), spreadIfDefined(args.dateFormat, (v) => ({ dateFormat: sync_1.DATE_FORMAT_TO_API[v] }))), spreadIfDefined(args.timeFormat, (v) => ({ timeFormat: sync_1.TIME_FORMAT_TO_API[v] }))), spreadIfDefined(args.startDay, (v) => ({ startDay: sync_1.DAY_OF_WEEK_TO_API[v] }))), spreadIfDefined(args.nextWeek, (v) => ({ nextWeek: sync_1.DAY_OF_WEEK_TO_API[v] })));
|
|
29
|
+
}
|
|
30
|
+
function serializeTaskUpdateDateCompleteArgs(args) {
|
|
31
|
+
return Object.assign(Object.assign(Object.assign({}, args), { isForward: args.isForward ? 1 : 0 }), spreadIfDefined(args.resetSubtasks, (v) => ({ resetSubtasks: v ? 1 : 0 })));
|
|
32
|
+
}
|
|
33
|
+
function serializeUpdateGoalsArgs(args) {
|
|
34
|
+
return Object.assign(Object.assign(Object.assign({}, args), spreadIfDefined(args.vacationMode, (v) => ({ vacationMode: v ? 1 : 0 }))), spreadIfDefined(args.karmaDisabled, (v) => ({ karmaDisabled: v ? 1 : 0 })));
|
|
35
|
+
}
|
|
36
|
+
function preprocessSyncCommands(commands) {
|
|
37
|
+
return commands.map((cmd) => {
|
|
38
|
+
if (cmd.type === 'user_update')
|
|
39
|
+
return Object.assign(Object.assign({}, cmd), { args: serializeUserUpdateArgs(cmd.args) });
|
|
40
|
+
if (cmd.type === 'item_update_date_complete')
|
|
41
|
+
return Object.assign(Object.assign({}, cmd), { args: serializeTaskUpdateDateCompleteArgs(cmd.args) });
|
|
42
|
+
if (cmd.type === 'update_goals')
|
|
43
|
+
return Object.assign(Object.assign({}, cmd), { args: serializeUpdateGoalsArgs(cmd.args) });
|
|
44
|
+
return cmd;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
23
47
|
class TodoistApi {
|
|
24
48
|
constructor(
|
|
25
49
|
/**
|
|
@@ -56,13 +80,16 @@ class TodoistApi {
|
|
|
56
80
|
* @throws TodoistRequestError if sync status contains errors
|
|
57
81
|
*/
|
|
58
82
|
async requestSync(syncRequest, requestId, hasSyncCommands = false) {
|
|
83
|
+
var _a;
|
|
84
|
+
const processedRequest = ((_a = syncRequest.commands) === null || _a === void 0 ? void 0 : _a.length)
|
|
85
|
+
? Object.assign(Object.assign({}, syncRequest), { commands: preprocessSyncCommands(syncRequest.commands) }) : syncRequest;
|
|
59
86
|
const response = await (0, rest_client_1.request)({
|
|
60
87
|
httpMethod: 'POST',
|
|
61
88
|
baseUri: this.syncApiBase,
|
|
62
89
|
relativePath: endpoints_1.ENDPOINT_SYNC,
|
|
63
90
|
apiToken: this.authToken,
|
|
64
91
|
customFetch: this.customFetch,
|
|
65
|
-
payload:
|
|
92
|
+
payload: processedRequest,
|
|
66
93
|
requestId: requestId,
|
|
67
94
|
hasSyncCommands: hasSyncCommands,
|
|
68
95
|
});
|
|
@@ -317,7 +344,7 @@ class TodoistApi {
|
|
|
317
344
|
const commands = ids.map((id) => ({
|
|
318
345
|
type: 'item_move',
|
|
319
346
|
uuid: (0, uuid_1.v4)(),
|
|
320
|
-
args: Object.assign(Object.assign(Object.assign({ id }, (args.projectId
|
|
347
|
+
args: Object.assign(Object.assign(Object.assign({ id }, spreadIfDefined(args.projectId, (v) => ({ projectId: v }))), spreadIfDefined(args.sectionId, (v) => ({ sectionId: v }))), spreadIfDefined(args.parentId, (v) => ({ parentId: v }))),
|
|
321
348
|
}));
|
|
322
349
|
const syncRequest = {
|
|
323
350
|
commands,
|
|
@@ -349,7 +376,7 @@ class TodoistApi {
|
|
|
349
376
|
relativePath: generatePath(endpoints_1.ENDPOINT_REST_TASKS, id, endpoints_1.ENDPOINT_REST_TASK_MOVE),
|
|
350
377
|
apiToken: this.authToken,
|
|
351
378
|
customFetch: this.customFetch,
|
|
352
|
-
payload: Object.assign(Object.assign(Object.assign({}, (args.projectId
|
|
379
|
+
payload: Object.assign(Object.assign(Object.assign({}, spreadIfDefined(args.projectId, (v) => ({ project_id: v }))), spreadIfDefined(args.sectionId, (v) => ({ section_id: v }))), spreadIfDefined(args.parentId, (v) => ({ parent_id: v }))),
|
|
353
380
|
requestId: requestId,
|
|
354
381
|
});
|
|
355
382
|
return (0, validators_1.validateTask)(response.data);
|
|
@@ -1048,7 +1075,9 @@ class TodoistApi {
|
|
|
1048
1075
|
*/
|
|
1049
1076
|
async getActivityLogs(args = {}) {
|
|
1050
1077
|
// Convert Date objects to YYYY-MM-DD strings and modern object types to legacy API types
|
|
1051
|
-
const processedArgs = Object.assign(Object.assign(Object.assign(Object.assign({}, args), (args.since instanceof Date
|
|
1078
|
+
const processedArgs = Object.assign(Object.assign(Object.assign(Object.assign({}, args), (args.since instanceof Date ? { since: (0, url_helpers_1.formatDateToYYYYMMDD)(args.since) } : {})), (args.until instanceof Date ? { until: (0, url_helpers_1.formatDateToYYYYMMDD)(args.until) } : {})), spreadIfDefined(args.objectType, (v) => ({
|
|
1079
|
+
objectType: (0, activity_helpers_1.normalizeObjectTypeForApi)(v),
|
|
1080
|
+
})));
|
|
1052
1081
|
const { data: { results, nextCursor }, } = await (0, rest_client_1.request)({
|
|
1053
1082
|
httpMethod: 'GET',
|
|
1054
1083
|
baseUri: this.syncApiBase,
|
|
@@ -24,5 +24,16 @@ exports.LiveNotificationSchema = zod_1.z
|
|
|
24
24
|
itemContent: zod_1.z.string().optional(),
|
|
25
25
|
responsibleUid: zod_1.z.string().optional(),
|
|
26
26
|
assignedByUid: zod_1.z.string().optional(),
|
|
27
|
+
fromUser: zod_1.z
|
|
28
|
+
.object({
|
|
29
|
+
email: zod_1.z.string(),
|
|
30
|
+
fullName: zod_1.z.string(),
|
|
31
|
+
id: zod_1.z.string(),
|
|
32
|
+
imageId: zod_1.z.string().nullable(),
|
|
33
|
+
})
|
|
34
|
+
.optional(),
|
|
35
|
+
projectName: zod_1.z.string().optional(),
|
|
36
|
+
isDeleted: zod_1.z.boolean().optional(),
|
|
37
|
+
invitationSecret: zod_1.z.string().optional(),
|
|
27
38
|
})
|
|
28
39
|
.passthrough();
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SyncUserSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const user_preferences_1 = require("../user-preferences");
|
|
5
6
|
const FeaturesSchema = zod_1.z
|
|
6
7
|
.object({
|
|
7
8
|
karmaDisabled: zod_1.z.boolean(),
|
|
8
9
|
restriction: zod_1.z.number().int(),
|
|
9
10
|
karmaVacation: zod_1.z.boolean(),
|
|
10
11
|
dateistLang: zod_1.z.any(),
|
|
11
|
-
beta:
|
|
12
|
+
beta: user_preferences_1.BooleanFromZeroOneSchema,
|
|
12
13
|
hasPushReminders: zod_1.z.boolean(),
|
|
13
14
|
dateistInlineDisabled: zod_1.z.boolean(),
|
|
14
15
|
autoInviteDisabled: zod_1.z.boolean().optional(),
|
|
@@ -21,7 +22,7 @@ const TzInfoSchema = zod_1.z
|
|
|
21
22
|
timezone: zod_1.z.string(),
|
|
22
23
|
hours: zod_1.z.number().int(),
|
|
23
24
|
minutes: zod_1.z.number().int(),
|
|
24
|
-
isDst:
|
|
25
|
+
isDst: user_preferences_1.BooleanFromZeroOneSchema,
|
|
25
26
|
gmtString: zod_1.z.string(),
|
|
26
27
|
})
|
|
27
28
|
.passthrough();
|
|
@@ -59,7 +60,7 @@ exports.SyncUserSchema = zod_1.z
|
|
|
59
60
|
avatarSmall: zod_1.z.string().optional(),
|
|
60
61
|
businessAccountId: zod_1.z.string().nullable(),
|
|
61
62
|
dailyGoal: zod_1.z.number().int(),
|
|
62
|
-
dateFormat:
|
|
63
|
+
dateFormat: user_preferences_1.DateFormatSchema,
|
|
63
64
|
dateistLang: zod_1.z.string().nullable(),
|
|
64
65
|
daysOff: zod_1.z.array(zod_1.z.number().int()),
|
|
65
66
|
featureIdentifier: zod_1.z.string(),
|
|
@@ -81,7 +82,7 @@ exports.SyncUserSchema = zod_1.z
|
|
|
81
82
|
mfaEnabled: zod_1.z.boolean().optional(),
|
|
82
83
|
mobileHost: zod_1.z.string().nullable(),
|
|
83
84
|
mobileNumber: zod_1.z.string().nullable(),
|
|
84
|
-
nextWeek:
|
|
85
|
+
nextWeek: user_preferences_1.DayOfWeekSchema,
|
|
85
86
|
onboardingLevel: zod_1.z.string().nullable().optional(),
|
|
86
87
|
onboardingRole: zod_1.z.string().nullable().optional(),
|
|
87
88
|
onboardingPersona: zod_1.z.string().nullable().optional(),
|
|
@@ -108,10 +109,10 @@ exports.SyncUserSchema = zod_1.z
|
|
|
108
109
|
.optional(),
|
|
109
110
|
shareLimit: zod_1.z.number().int(),
|
|
110
111
|
sortOrder: zod_1.z.number().int(),
|
|
111
|
-
startDay:
|
|
112
|
+
startDay: user_preferences_1.DayOfWeekSchema,
|
|
112
113
|
startPage: zod_1.z.string(),
|
|
113
114
|
themeId: zod_1.z.string(),
|
|
114
|
-
timeFormat:
|
|
115
|
+
timeFormat: user_preferences_1.TimeFormatSchema,
|
|
115
116
|
token: zod_1.z.string(),
|
|
116
117
|
tzInfo: TzInfoSchema,
|
|
117
118
|
uniquePrefix: zod_1.z.number().int(),
|
|
@@ -31,6 +31,13 @@ exports.SyncWorkspaceSchema = zod_1.z
|
|
|
31
31
|
isGuestAllowed: zod_1.z.boolean().nullable().optional(),
|
|
32
32
|
currentActiveProjects: zod_1.z.number().nullable(),
|
|
33
33
|
currentMemberCount: zod_1.z.number().nullable(),
|
|
34
|
+
memberCountByType: zod_1.z
|
|
35
|
+
.object({
|
|
36
|
+
adminCount: zod_1.z.number().int(),
|
|
37
|
+
guestCount: zod_1.z.number().int(),
|
|
38
|
+
memberCount: zod_1.z.number().int(),
|
|
39
|
+
})
|
|
40
|
+
.optional(),
|
|
34
41
|
currentTemplateCount: zod_1.z.number().nullable(),
|
|
35
42
|
pendingInvitations: zod_1.z.array(zod_1.z.string()).nullable().optional(),
|
|
36
43
|
domainName: zod_1.z.string().optional(),
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DayOfWeekSchema = exports.TimeFormatSchema = exports.DateFormatSchema = exports.BooleanFromZeroOneSchema = exports.DAY_OF_WEEK_TO_API = exports.TIME_FORMAT_TO_API = exports.DATE_FORMAT_TO_API = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const DATE_FORMAT_FROM_API = { 0: 'DD/MM/YYYY', 1: 'MM/DD/YYYY' };
|
|
6
|
+
const TIME_FORMAT_FROM_API = { 0: '24h', 1: '12h' };
|
|
7
|
+
const DAY_OF_WEEK_FROM_API = {
|
|
8
|
+
1: 'Monday',
|
|
9
|
+
2: 'Tuesday',
|
|
10
|
+
3: 'Wednesday',
|
|
11
|
+
4: 'Thursday',
|
|
12
|
+
5: 'Friday',
|
|
13
|
+
6: 'Saturday',
|
|
14
|
+
7: 'Sunday',
|
|
15
|
+
};
|
|
16
|
+
exports.DATE_FORMAT_TO_API = {
|
|
17
|
+
'DD/MM/YYYY': 0,
|
|
18
|
+
'MM/DD/YYYY': 1,
|
|
19
|
+
};
|
|
20
|
+
exports.TIME_FORMAT_TO_API = { '24h': 0, '12h': 1 };
|
|
21
|
+
exports.DAY_OF_WEEK_TO_API = {
|
|
22
|
+
Monday: 1,
|
|
23
|
+
Tuesday: 2,
|
|
24
|
+
Wednesday: 3,
|
|
25
|
+
Thursday: 4,
|
|
26
|
+
Friday: 5,
|
|
27
|
+
Saturday: 6,
|
|
28
|
+
Sunday: 7,
|
|
29
|
+
};
|
|
30
|
+
/** Zod read-schema: parse API 0/1 integer, emit boolean */
|
|
31
|
+
exports.BooleanFromZeroOneSchema = zod_1.z
|
|
32
|
+
.union([zod_1.z.literal(0), zod_1.z.literal(1)])
|
|
33
|
+
.transform((v) => v === 1);
|
|
34
|
+
/** Zod read-schemas: parse API numbers, emit descriptive strings */
|
|
35
|
+
exports.DateFormatSchema = zod_1.z
|
|
36
|
+
.union([zod_1.z.literal(0), zod_1.z.literal(1)])
|
|
37
|
+
.transform((v) => DATE_FORMAT_FROM_API[v]);
|
|
38
|
+
exports.TimeFormatSchema = zod_1.z
|
|
39
|
+
.union([zod_1.z.literal(0), zod_1.z.literal(1)])
|
|
40
|
+
.transform((v) => TIME_FORMAT_FROM_API[v]);
|
|
41
|
+
exports.DayOfWeekSchema = zod_1.z
|
|
42
|
+
.union([
|
|
43
|
+
zod_1.z.literal(1),
|
|
44
|
+
zod_1.z.literal(2),
|
|
45
|
+
zod_1.z.literal(3),
|
|
46
|
+
zod_1.z.literal(4),
|
|
47
|
+
zod_1.z.literal(5),
|
|
48
|
+
zod_1.z.literal(6),
|
|
49
|
+
zod_1.z.literal(7),
|
|
50
|
+
])
|
|
51
|
+
.transform((v) => DAY_OF_WEEK_FROM_API[v]);
|
package/dist/esm/todoist-api.js
CHANGED
|
@@ -7,6 +7,7 @@ import { normalizeObjectTypeForApi, denormalizeObjectTypeFromApi } from './utils
|
|
|
7
7
|
import { processTaskContent } from './utils/uncompletable-helpers.js';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { v4 as uuidv4 } from 'uuid';
|
|
10
|
+
import { DATE_FORMAT_TO_API, TIME_FORMAT_TO_API, DAY_OF_WEEK_TO_API, } from './types/sync/index.js';
|
|
10
11
|
import { TodoistRequestError } from './types/index.js';
|
|
11
12
|
const MAX_COMMAND_COUNT = 100;
|
|
12
13
|
/**
|
|
@@ -17,6 +18,29 @@ const MAX_COMMAND_COUNT = 100;
|
|
|
17
18
|
function generatePath(...segments) {
|
|
18
19
|
return segments.join('/');
|
|
19
20
|
}
|
|
21
|
+
function spreadIfDefined(value, fn) {
|
|
22
|
+
return value !== undefined ? fn(value) : {};
|
|
23
|
+
}
|
|
24
|
+
function serializeUserUpdateArgs(args) {
|
|
25
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, args), spreadIfDefined(args.dateFormat, (v) => ({ dateFormat: DATE_FORMAT_TO_API[v] }))), spreadIfDefined(args.timeFormat, (v) => ({ timeFormat: TIME_FORMAT_TO_API[v] }))), spreadIfDefined(args.startDay, (v) => ({ startDay: DAY_OF_WEEK_TO_API[v] }))), spreadIfDefined(args.nextWeek, (v) => ({ nextWeek: DAY_OF_WEEK_TO_API[v] })));
|
|
26
|
+
}
|
|
27
|
+
function serializeTaskUpdateDateCompleteArgs(args) {
|
|
28
|
+
return Object.assign(Object.assign(Object.assign({}, args), { isForward: args.isForward ? 1 : 0 }), spreadIfDefined(args.resetSubtasks, (v) => ({ resetSubtasks: v ? 1 : 0 })));
|
|
29
|
+
}
|
|
30
|
+
function serializeUpdateGoalsArgs(args) {
|
|
31
|
+
return Object.assign(Object.assign(Object.assign({}, args), spreadIfDefined(args.vacationMode, (v) => ({ vacationMode: v ? 1 : 0 }))), spreadIfDefined(args.karmaDisabled, (v) => ({ karmaDisabled: v ? 1 : 0 })));
|
|
32
|
+
}
|
|
33
|
+
function preprocessSyncCommands(commands) {
|
|
34
|
+
return commands.map((cmd) => {
|
|
35
|
+
if (cmd.type === 'user_update')
|
|
36
|
+
return Object.assign(Object.assign({}, cmd), { args: serializeUserUpdateArgs(cmd.args) });
|
|
37
|
+
if (cmd.type === 'item_update_date_complete')
|
|
38
|
+
return Object.assign(Object.assign({}, cmd), { args: serializeTaskUpdateDateCompleteArgs(cmd.args) });
|
|
39
|
+
if (cmd.type === 'update_goals')
|
|
40
|
+
return Object.assign(Object.assign({}, cmd), { args: serializeUpdateGoalsArgs(cmd.args) });
|
|
41
|
+
return cmd;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
20
44
|
export class TodoistApi {
|
|
21
45
|
constructor(
|
|
22
46
|
/**
|
|
@@ -53,13 +77,16 @@ export class TodoistApi {
|
|
|
53
77
|
* @throws TodoistRequestError if sync status contains errors
|
|
54
78
|
*/
|
|
55
79
|
async requestSync(syncRequest, requestId, hasSyncCommands = false) {
|
|
80
|
+
var _a;
|
|
81
|
+
const processedRequest = ((_a = syncRequest.commands) === null || _a === void 0 ? void 0 : _a.length)
|
|
82
|
+
? Object.assign(Object.assign({}, syncRequest), { commands: preprocessSyncCommands(syncRequest.commands) }) : syncRequest;
|
|
56
83
|
const response = await request({
|
|
57
84
|
httpMethod: 'POST',
|
|
58
85
|
baseUri: this.syncApiBase,
|
|
59
86
|
relativePath: ENDPOINT_SYNC,
|
|
60
87
|
apiToken: this.authToken,
|
|
61
88
|
customFetch: this.customFetch,
|
|
62
|
-
payload:
|
|
89
|
+
payload: processedRequest,
|
|
63
90
|
requestId: requestId,
|
|
64
91
|
hasSyncCommands: hasSyncCommands,
|
|
65
92
|
});
|
|
@@ -314,7 +341,7 @@ export class TodoistApi {
|
|
|
314
341
|
const commands = ids.map((id) => ({
|
|
315
342
|
type: 'item_move',
|
|
316
343
|
uuid: uuidv4(),
|
|
317
|
-
args: Object.assign(Object.assign(Object.assign({ id }, (args.projectId
|
|
344
|
+
args: Object.assign(Object.assign(Object.assign({ id }, spreadIfDefined(args.projectId, (v) => ({ projectId: v }))), spreadIfDefined(args.sectionId, (v) => ({ sectionId: v }))), spreadIfDefined(args.parentId, (v) => ({ parentId: v }))),
|
|
318
345
|
}));
|
|
319
346
|
const syncRequest = {
|
|
320
347
|
commands,
|
|
@@ -346,7 +373,7 @@ export class TodoistApi {
|
|
|
346
373
|
relativePath: generatePath(ENDPOINT_REST_TASKS, id, ENDPOINT_REST_TASK_MOVE),
|
|
347
374
|
apiToken: this.authToken,
|
|
348
375
|
customFetch: this.customFetch,
|
|
349
|
-
payload: Object.assign(Object.assign(Object.assign({}, (args.projectId
|
|
376
|
+
payload: Object.assign(Object.assign(Object.assign({}, spreadIfDefined(args.projectId, (v) => ({ project_id: v }))), spreadIfDefined(args.sectionId, (v) => ({ section_id: v }))), spreadIfDefined(args.parentId, (v) => ({ parent_id: v }))),
|
|
350
377
|
requestId: requestId,
|
|
351
378
|
});
|
|
352
379
|
return validateTask(response.data);
|
|
@@ -1045,7 +1072,9 @@ export class TodoistApi {
|
|
|
1045
1072
|
*/
|
|
1046
1073
|
async getActivityLogs(args = {}) {
|
|
1047
1074
|
// Convert Date objects to YYYY-MM-DD strings and modern object types to legacy API types
|
|
1048
|
-
const processedArgs = Object.assign(Object.assign(Object.assign(Object.assign({}, args), (args.since instanceof Date
|
|
1075
|
+
const processedArgs = Object.assign(Object.assign(Object.assign(Object.assign({}, args), (args.since instanceof Date ? { since: formatDateToYYYYMMDD(args.since) } : {})), (args.until instanceof Date ? { until: formatDateToYYYYMMDD(args.until) } : {})), spreadIfDefined(args.objectType, (v) => ({
|
|
1076
|
+
objectType: normalizeObjectTypeForApi(v),
|
|
1077
|
+
})));
|
|
1049
1078
|
const { data: { results, nextCursor }, } = await request({
|
|
1050
1079
|
httpMethod: 'GET',
|
|
1051
1080
|
baseUri: this.syncApiBase,
|
|
@@ -21,5 +21,16 @@ export const LiveNotificationSchema = z
|
|
|
21
21
|
itemContent: z.string().optional(),
|
|
22
22
|
responsibleUid: z.string().optional(),
|
|
23
23
|
assignedByUid: z.string().optional(),
|
|
24
|
+
fromUser: z
|
|
25
|
+
.object({
|
|
26
|
+
email: z.string(),
|
|
27
|
+
fullName: z.string(),
|
|
28
|
+
id: z.string(),
|
|
29
|
+
imageId: z.string().nullable(),
|
|
30
|
+
})
|
|
31
|
+
.optional(),
|
|
32
|
+
projectName: z.string().optional(),
|
|
33
|
+
isDeleted: z.boolean().optional(),
|
|
34
|
+
invitationSecret: z.string().optional(),
|
|
24
35
|
})
|
|
25
36
|
.passthrough();
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { BooleanFromZeroOneSchema, DateFormatSchema, DayOfWeekSchema, TimeFormatSchema, } from '../user-preferences.js';
|
|
2
3
|
const FeaturesSchema = z
|
|
3
4
|
.object({
|
|
4
5
|
karmaDisabled: z.boolean(),
|
|
5
6
|
restriction: z.number().int(),
|
|
6
7
|
karmaVacation: z.boolean(),
|
|
7
8
|
dateistLang: z.any(),
|
|
8
|
-
beta:
|
|
9
|
+
beta: BooleanFromZeroOneSchema,
|
|
9
10
|
hasPushReminders: z.boolean(),
|
|
10
11
|
dateistInlineDisabled: z.boolean(),
|
|
11
12
|
autoInviteDisabled: z.boolean().optional(),
|
|
@@ -18,7 +19,7 @@ const TzInfoSchema = z
|
|
|
18
19
|
timezone: z.string(),
|
|
19
20
|
hours: z.number().int(),
|
|
20
21
|
minutes: z.number().int(),
|
|
21
|
-
isDst:
|
|
22
|
+
isDst: BooleanFromZeroOneSchema,
|
|
22
23
|
gmtString: z.string(),
|
|
23
24
|
})
|
|
24
25
|
.passthrough();
|
|
@@ -56,7 +57,7 @@ export const SyncUserSchema = z
|
|
|
56
57
|
avatarSmall: z.string().optional(),
|
|
57
58
|
businessAccountId: z.string().nullable(),
|
|
58
59
|
dailyGoal: z.number().int(),
|
|
59
|
-
dateFormat:
|
|
60
|
+
dateFormat: DateFormatSchema,
|
|
60
61
|
dateistLang: z.string().nullable(),
|
|
61
62
|
daysOff: z.array(z.number().int()),
|
|
62
63
|
featureIdentifier: z.string(),
|
|
@@ -78,7 +79,7 @@ export const SyncUserSchema = z
|
|
|
78
79
|
mfaEnabled: z.boolean().optional(),
|
|
79
80
|
mobileHost: z.string().nullable(),
|
|
80
81
|
mobileNumber: z.string().nullable(),
|
|
81
|
-
nextWeek:
|
|
82
|
+
nextWeek: DayOfWeekSchema,
|
|
82
83
|
onboardingLevel: z.string().nullable().optional(),
|
|
83
84
|
onboardingRole: z.string().nullable().optional(),
|
|
84
85
|
onboardingPersona: z.string().nullable().optional(),
|
|
@@ -105,10 +106,10 @@ export const SyncUserSchema = z
|
|
|
105
106
|
.optional(),
|
|
106
107
|
shareLimit: z.number().int(),
|
|
107
108
|
sortOrder: z.number().int(),
|
|
108
|
-
startDay:
|
|
109
|
+
startDay: DayOfWeekSchema,
|
|
109
110
|
startPage: z.string(),
|
|
110
111
|
themeId: z.string(),
|
|
111
|
-
timeFormat:
|
|
112
|
+
timeFormat: TimeFormatSchema,
|
|
112
113
|
token: z.string(),
|
|
113
114
|
tzInfo: TzInfoSchema,
|
|
114
115
|
uniquePrefix: z.number().int(),
|
|
@@ -28,6 +28,13 @@ export const SyncWorkspaceSchema = z
|
|
|
28
28
|
isGuestAllowed: z.boolean().nullable().optional(),
|
|
29
29
|
currentActiveProjects: z.number().nullable(),
|
|
30
30
|
currentMemberCount: z.number().nullable(),
|
|
31
|
+
memberCountByType: z
|
|
32
|
+
.object({
|
|
33
|
+
adminCount: z.number().int(),
|
|
34
|
+
guestCount: z.number().int(),
|
|
35
|
+
memberCount: z.number().int(),
|
|
36
|
+
})
|
|
37
|
+
.optional(),
|
|
31
38
|
currentTemplateCount: z.number().nullable(),
|
|
32
39
|
pendingInvitations: z.array(z.string()).nullable().optional(),
|
|
33
40
|
domainName: z.string().optional(),
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const DATE_FORMAT_FROM_API = { 0: 'DD/MM/YYYY', 1: 'MM/DD/YYYY' };
|
|
3
|
+
const TIME_FORMAT_FROM_API = { 0: '24h', 1: '12h' };
|
|
4
|
+
const DAY_OF_WEEK_FROM_API = {
|
|
5
|
+
1: 'Monday',
|
|
6
|
+
2: 'Tuesday',
|
|
7
|
+
3: 'Wednesday',
|
|
8
|
+
4: 'Thursday',
|
|
9
|
+
5: 'Friday',
|
|
10
|
+
6: 'Saturday',
|
|
11
|
+
7: 'Sunday',
|
|
12
|
+
};
|
|
13
|
+
export const DATE_FORMAT_TO_API = {
|
|
14
|
+
'DD/MM/YYYY': 0,
|
|
15
|
+
'MM/DD/YYYY': 1,
|
|
16
|
+
};
|
|
17
|
+
export const TIME_FORMAT_TO_API = { '24h': 0, '12h': 1 };
|
|
18
|
+
export const DAY_OF_WEEK_TO_API = {
|
|
19
|
+
Monday: 1,
|
|
20
|
+
Tuesday: 2,
|
|
21
|
+
Wednesday: 3,
|
|
22
|
+
Thursday: 4,
|
|
23
|
+
Friday: 5,
|
|
24
|
+
Saturday: 6,
|
|
25
|
+
Sunday: 7,
|
|
26
|
+
};
|
|
27
|
+
/** Zod read-schema: parse API 0/1 integer, emit boolean */
|
|
28
|
+
export const BooleanFromZeroOneSchema = z
|
|
29
|
+
.union([z.literal(0), z.literal(1)])
|
|
30
|
+
.transform((v) => v === 1);
|
|
31
|
+
/** Zod read-schemas: parse API numbers, emit descriptive strings */
|
|
32
|
+
export const DateFormatSchema = z
|
|
33
|
+
.union([z.literal(0), z.literal(1)])
|
|
34
|
+
.transform((v) => DATE_FORMAT_FROM_API[v]);
|
|
35
|
+
export const TimeFormatSchema = z
|
|
36
|
+
.union([z.literal(0), z.literal(1)])
|
|
37
|
+
.transform((v) => TIME_FORMAT_FROM_API[v]);
|
|
38
|
+
export const DayOfWeekSchema = z
|
|
39
|
+
.union([
|
|
40
|
+
z.literal(1),
|
|
41
|
+
z.literal(2),
|
|
42
|
+
z.literal(3),
|
|
43
|
+
z.literal(4),
|
|
44
|
+
z.literal(5),
|
|
45
|
+
z.literal(6),
|
|
46
|
+
z.literal(7),
|
|
47
|
+
])
|
|
48
|
+
.transform((v) => DAY_OF_WEEK_FROM_API[v]);
|
|
@@ -4,7 +4,7 @@ import type { SectionAddArgs, SectionUpdateArgs, SectionMoveArgs, SectionReorder
|
|
|
4
4
|
import type { LabelAddArgs, LabelRenameArgs, LabelUpdateArgs, LabelUpdateOrdersArgs, LabelDeleteArgs, LabelDeleteOccurrencesArgs } from './labels.js';
|
|
5
5
|
import type { FilterAddArgs, FilterUpdateArgs, FilterUpdateOrdersArgs, FilterDeleteArgs } from './filters.js';
|
|
6
6
|
import type { NoteAddArgs, NoteUpdateArgs, NoteDeleteArgs, NoteReactionAddArgs, NoteReactionRemoveArgs } from './notes.js';
|
|
7
|
-
import type { ReminderAddArgs, ReminderDeleteArgs } from './reminders.js';
|
|
7
|
+
import type { ReminderAddArgs, ReminderUpdateArgs, ReminderDeleteArgs } from './reminders.js';
|
|
8
8
|
import type { WorkspaceAddArgs, WorkspaceUpdateArgs, WorkspaceDeleteArgs, WorkspaceUpdateUserArgs, WorkspaceDeleteUserArgs, WorkspaceLeaveArgs, WorkspaceInviteArgs, WorkspaceSetDefaultOrderArgs, WorkspaceUpdateUserProjectSortPreferenceArgs } from './workspaces.js';
|
|
9
9
|
import type { FolderAddArgs, FolderUpdateArgs, FolderDeleteArgs } from './folders.js';
|
|
10
10
|
import type { WorkspaceFilterAddArgs, WorkspaceFilterUpdateArgs, WorkspaceFilterUpdateOrdersArgs, WorkspaceFilterDeleteArgs } from './workspace-filters.js';
|
|
@@ -14,7 +14,7 @@ import type { AcceptInvitationArgs, RejectInvitationArgs, BizAcceptInvitationArg
|
|
|
14
14
|
import type { ViewOptionsSetArgs, ViewOptionsDeleteArgs } from './view-options.js';
|
|
15
15
|
import type { ProjectViewOptionsDefaultsSetArgs } from './project-view-options.js';
|
|
16
16
|
import type { CalendarUpdateArgs, CalendarAccountUpdateArgs, CalendarAccountRestoreTaskCalendarArgs } from './calendars.js';
|
|
17
|
-
import type { UserUpdateArgs, DeleteCollaboratorArgs, IdMappingArgs, SuggestionDeleteArgs } from './others.js';
|
|
17
|
+
import type { UserUpdateArgs, DeleteCollaboratorArgs, IdMappingArgs, SuggestionDeleteArgs, UserSettingsUpdateArgs, UpdateGoalsArgs } from './others.js';
|
|
18
18
|
/**
|
|
19
19
|
* Maps each Sync API command type string to its corresponding argument type.
|
|
20
20
|
*
|
|
@@ -73,6 +73,7 @@ export type SyncCommandsMap = {
|
|
|
73
73
|
note_reaction_add: NoteReactionAddArgs;
|
|
74
74
|
note_reaction_remove: NoteReactionRemoveArgs;
|
|
75
75
|
reminder_add: ReminderAddArgs;
|
|
76
|
+
reminder_update: ReminderUpdateArgs;
|
|
76
77
|
reminder_delete: ReminderDeleteArgs;
|
|
77
78
|
workspace_add: WorkspaceAddArgs;
|
|
78
79
|
workspace_update: WorkspaceUpdateArgs;
|
|
@@ -110,6 +111,8 @@ export type SyncCommandsMap = {
|
|
|
110
111
|
calendar_account_update: CalendarAccountUpdateArgs;
|
|
111
112
|
calendar_account_restore_task_calendar: CalendarAccountRestoreTaskCalendarArgs;
|
|
112
113
|
user_update: UserUpdateArgs;
|
|
114
|
+
user_settings_update: UserSettingsUpdateArgs;
|
|
115
|
+
update_goals: UpdateGoalsArgs;
|
|
113
116
|
delete_collaborator: DeleteCollaboratorArgs;
|
|
114
117
|
id_mapping: IdMappingArgs;
|
|
115
118
|
suggestion_delete: SuggestionDeleteArgs;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import type { DateFormat, DayOfWeek, TimeFormat } from '../user-preferences.js';
|
|
2
|
+
export type UserUpdateArgs = {
|
|
3
|
+
fullName?: string;
|
|
4
|
+
autoReminder?: number;
|
|
5
|
+
dateFormat?: DateFormat;
|
|
6
|
+
nextWeek?: DayOfWeek;
|
|
7
|
+
startDay?: DayOfWeek;
|
|
8
|
+
startPage?: string;
|
|
9
|
+
themeId?: string;
|
|
10
|
+
timeFormat?: TimeFormat;
|
|
11
|
+
timezone?: string;
|
|
12
|
+
};
|
|
2
13
|
export type DeleteCollaboratorArgs = {
|
|
3
14
|
projectId: string;
|
|
4
15
|
email: string;
|
|
@@ -12,3 +23,17 @@ export type IdMappingArgs = {
|
|
|
12
23
|
export type SuggestionDeleteArgs = {
|
|
13
24
|
type: 'templates';
|
|
14
25
|
};
|
|
26
|
+
export type UserSettingsUpdateArgs = {
|
|
27
|
+
reminderPush?: boolean;
|
|
28
|
+
reminderDesktop?: boolean;
|
|
29
|
+
reminderEmail?: boolean;
|
|
30
|
+
completedSoundDesktop?: boolean;
|
|
31
|
+
completedSoundMobile?: boolean;
|
|
32
|
+
};
|
|
33
|
+
export type UpdateGoalsArgs = {
|
|
34
|
+
dailyGoal?: number;
|
|
35
|
+
weeklyGoal?: number;
|
|
36
|
+
ignoreDays?: number[];
|
|
37
|
+
vacationMode?: boolean;
|
|
38
|
+
karmaDisabled?: boolean;
|
|
39
|
+
};
|
|
@@ -22,6 +22,29 @@ export type ReminderAddArgs = {
|
|
|
22
22
|
locTrigger?: 'on_enter' | 'on_leave';
|
|
23
23
|
notifyUid?: string;
|
|
24
24
|
};
|
|
25
|
+
export type ReminderUpdateArgs = {
|
|
26
|
+
id: string;
|
|
27
|
+
type: 'absolute';
|
|
28
|
+
service?: ReminderService;
|
|
29
|
+
notifyUid?: string;
|
|
30
|
+
due?: SyncDueDate;
|
|
31
|
+
} | {
|
|
32
|
+
id: string;
|
|
33
|
+
type: 'relative';
|
|
34
|
+
service?: ReminderService;
|
|
35
|
+
notifyUid?: string;
|
|
36
|
+
minuteOffset?: number;
|
|
37
|
+
due?: SyncDueDate;
|
|
38
|
+
} | {
|
|
39
|
+
id: string;
|
|
40
|
+
type: 'location';
|
|
41
|
+
name?: string;
|
|
42
|
+
locLat?: string;
|
|
43
|
+
locLong?: string;
|
|
44
|
+
radius?: number;
|
|
45
|
+
locTrigger?: 'on_enter' | 'on_leave';
|
|
46
|
+
notifyUid?: string;
|
|
47
|
+
};
|
|
25
48
|
export type ReminderDeleteArgs = {
|
|
26
49
|
id: string;
|
|
27
50
|
};
|
|
@@ -67,8 +67,8 @@ export type TaskUncompleteArgs = {
|
|
|
67
67
|
export type TaskUpdateDateCompleteArgs = {
|
|
68
68
|
id: string;
|
|
69
69
|
due: SyncDueDate;
|
|
70
|
-
isForward:
|
|
71
|
-
resetSubtasks?:
|
|
70
|
+
isForward: boolean;
|
|
71
|
+
resetSubtasks?: boolean;
|
|
72
72
|
};
|
|
73
73
|
export type TaskDeleteArgs = {
|
|
74
74
|
id: string;
|
|
@@ -19,5 +19,14 @@ export declare const LiveNotificationSchema: z.ZodObject<{
|
|
|
19
19
|
itemContent: z.ZodOptional<z.ZodString>;
|
|
20
20
|
responsibleUid: z.ZodOptional<z.ZodString>;
|
|
21
21
|
assignedByUid: z.ZodOptional<z.ZodString>;
|
|
22
|
+
fromUser: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
email: z.ZodString;
|
|
24
|
+
fullName: z.ZodString;
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
imageId: z.ZodNullable<z.ZodString>;
|
|
27
|
+
}, z.core.$strip>>;
|
|
28
|
+
projectName: z.ZodOptional<z.ZodString>;
|
|
29
|
+
isDeleted: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
invitationSecret: z.ZodOptional<z.ZodString>;
|
|
22
31
|
}, z.core.$loose>;
|
|
23
32
|
export type LiveNotification = z.infer<typeof LiveNotificationSchema>;
|
|
@@ -17,7 +17,7 @@ export declare const SyncUserSchema: z.ZodObject<{
|
|
|
17
17
|
avatarSmall: z.ZodOptional<z.ZodString>;
|
|
18
18
|
businessAccountId: z.ZodNullable<z.ZodString>;
|
|
19
19
|
dailyGoal: z.ZodNumber;
|
|
20
|
-
dateFormat: z.
|
|
20
|
+
dateFormat: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>, z.ZodTransform<"DD/MM/YYYY" | "MM/DD/YYYY", 0 | 1>>;
|
|
21
21
|
dateistLang: z.ZodNullable<z.ZodString>;
|
|
22
22
|
daysOff: z.ZodArray<z.ZodNumber>;
|
|
23
23
|
featureIdentifier: z.ZodString;
|
|
@@ -26,7 +26,7 @@ export declare const SyncUserSchema: z.ZodObject<{
|
|
|
26
26
|
restriction: z.ZodNumber;
|
|
27
27
|
karmaVacation: z.ZodBoolean;
|
|
28
28
|
dateistLang: z.ZodAny;
|
|
29
|
-
beta: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]
|
|
29
|
+
beta: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>, z.ZodTransform<boolean, 0 | 1>>;
|
|
30
30
|
hasPushReminders: z.ZodBoolean;
|
|
31
31
|
dateistInlineDisabled: z.ZodBoolean;
|
|
32
32
|
autoInviteDisabled: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -59,7 +59,7 @@ export declare const SyncUserSchema: z.ZodObject<{
|
|
|
59
59
|
mfaEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
60
60
|
mobileHost: z.ZodNullable<z.ZodString>;
|
|
61
61
|
mobileNumber: z.ZodNullable<z.ZodString>;
|
|
62
|
-
nextWeek: z.
|
|
62
|
+
nextWeek: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>]>, z.ZodTransform<"Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday", 2 | 1 | 3 | 4 | 5 | 6 | 7>>;
|
|
63
63
|
onboardingLevel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
64
64
|
onboardingRole: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
65
65
|
onboardingPersona: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -83,16 +83,16 @@ export declare const SyncUserSchema: z.ZodObject<{
|
|
|
83
83
|
}, z.core.$strip>>>;
|
|
84
84
|
shareLimit: z.ZodNumber;
|
|
85
85
|
sortOrder: z.ZodNumber;
|
|
86
|
-
startDay: z.
|
|
86
|
+
startDay: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>]>, z.ZodTransform<"Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday", 2 | 1 | 3 | 4 | 5 | 6 | 7>>;
|
|
87
87
|
startPage: z.ZodString;
|
|
88
88
|
themeId: z.ZodString;
|
|
89
|
-
timeFormat: z.
|
|
89
|
+
timeFormat: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>, z.ZodTransform<"24h" | "12h", 0 | 1>>;
|
|
90
90
|
token: z.ZodString;
|
|
91
91
|
tzInfo: z.ZodObject<{
|
|
92
92
|
timezone: z.ZodString;
|
|
93
93
|
hours: z.ZodNumber;
|
|
94
94
|
minutes: z.ZodNumber;
|
|
95
|
-
isDst: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]
|
|
95
|
+
isDst: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>, z.ZodTransform<boolean, 0 | 1>>;
|
|
96
96
|
gmtString: z.ZodString;
|
|
97
97
|
}, z.core.$loose>;
|
|
98
98
|
uniquePrefix: z.ZodNumber;
|
|
@@ -36,6 +36,11 @@ export declare const SyncWorkspaceSchema: z.ZodObject<{
|
|
|
36
36
|
isGuestAllowed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
37
37
|
currentActiveProjects: z.ZodNullable<z.ZodNumber>;
|
|
38
38
|
currentMemberCount: z.ZodNullable<z.ZodNumber>;
|
|
39
|
+
memberCountByType: z.ZodOptional<z.ZodObject<{
|
|
40
|
+
adminCount: z.ZodNumber;
|
|
41
|
+
guestCount: z.ZodNumber;
|
|
42
|
+
memberCount: z.ZodNumber;
|
|
43
|
+
}, z.core.$strip>>;
|
|
39
44
|
currentTemplateCount: z.ZodNullable<z.ZodNumber>;
|
|
40
45
|
pendingInvitations: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
41
46
|
domainName: z.ZodOptional<z.ZodString>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export type DateFormat = 'DD/MM/YYYY' | 'MM/DD/YYYY';
|
|
3
|
+
export type TimeFormat = '24h' | '12h';
|
|
4
|
+
export type DayOfWeek = 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday' | 'Sunday';
|
|
5
|
+
export declare const DATE_FORMAT_TO_API: Record<DateFormat, 0 | 1>;
|
|
6
|
+
export declare const TIME_FORMAT_TO_API: Record<TimeFormat, 0 | 1>;
|
|
7
|
+
export declare const DAY_OF_WEEK_TO_API: Record<DayOfWeek, 1 | 2 | 3 | 4 | 5 | 6 | 7>;
|
|
8
|
+
/** Zod read-schema: parse API 0/1 integer, emit boolean */
|
|
9
|
+
export declare const BooleanFromZeroOneSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>, z.ZodTransform<boolean, 0 | 1>>;
|
|
10
|
+
/** Zod read-schemas: parse API numbers, emit descriptive strings */
|
|
11
|
+
export declare const DateFormatSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>, z.ZodTransform<"DD/MM/YYYY" | "MM/DD/YYYY", 0 | 1>>;
|
|
12
|
+
export declare const TimeFormatSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>, z.ZodTransform<"24h" | "12h", 0 | 1>>;
|
|
13
|
+
export declare const DayOfWeekSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>]>, z.ZodTransform<"Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday", 2 | 1 | 3 | 4 | 5 | 6 | 7>>;
|
|
@@ -908,6 +908,15 @@ export declare const validateLiveNotification: (input: unknown) => {
|
|
|
908
908
|
itemContent?: string | undefined;
|
|
909
909
|
responsibleUid?: string | undefined;
|
|
910
910
|
assignedByUid?: string | undefined;
|
|
911
|
+
fromUser?: {
|
|
912
|
+
email: string;
|
|
913
|
+
fullName: string;
|
|
914
|
+
id: string;
|
|
915
|
+
imageId: string | null;
|
|
916
|
+
} | undefined;
|
|
917
|
+
projectName?: string | undefined;
|
|
918
|
+
isDeleted?: boolean | undefined;
|
|
919
|
+
invitationSecret?: string | undefined;
|
|
911
920
|
};
|
|
912
921
|
export declare const validateLiveNotificationArray: (input: unknown[]) => {
|
|
913
922
|
[x: string]: unknown;
|
|
@@ -922,6 +931,15 @@ export declare const validateLiveNotificationArray: (input: unknown[]) => {
|
|
|
922
931
|
itemContent?: string | undefined;
|
|
923
932
|
responsibleUid?: string | undefined;
|
|
924
933
|
assignedByUid?: string | undefined;
|
|
934
|
+
fromUser?: {
|
|
935
|
+
email: string;
|
|
936
|
+
fullName: string;
|
|
937
|
+
id: string;
|
|
938
|
+
imageId: string | null;
|
|
939
|
+
} | undefined;
|
|
940
|
+
projectName?: string | undefined;
|
|
941
|
+
isDeleted?: boolean | undefined;
|
|
942
|
+
invitationSecret?: string | undefined;
|
|
925
943
|
}[];
|
|
926
944
|
export declare const validateSyncWorkspace: (input: unknown) => {
|
|
927
945
|
[x: string]: unknown;
|
|
@@ -950,6 +968,11 @@ export declare const validateSyncWorkspace: (input: unknown) => {
|
|
|
950
968
|
inviteCode?: string | null | undefined;
|
|
951
969
|
isLinkSharingEnabled?: boolean | null | undefined;
|
|
952
970
|
isGuestAllowed?: boolean | null | undefined;
|
|
971
|
+
memberCountByType?: {
|
|
972
|
+
adminCount: number;
|
|
973
|
+
guestCount: number;
|
|
974
|
+
memberCount: number;
|
|
975
|
+
} | undefined;
|
|
953
976
|
pendingInvitations?: string[] | null | undefined;
|
|
954
977
|
domainName?: string | undefined;
|
|
955
978
|
domainDiscovery?: boolean | undefined;
|
|
@@ -988,6 +1011,11 @@ export declare const validateSyncWorkspaceArray: (input: unknown[]) => {
|
|
|
988
1011
|
inviteCode?: string | null | undefined;
|
|
989
1012
|
isLinkSharingEnabled?: boolean | null | undefined;
|
|
990
1013
|
isGuestAllowed?: boolean | null | undefined;
|
|
1014
|
+
memberCountByType?: {
|
|
1015
|
+
adminCount: number;
|
|
1016
|
+
guestCount: number;
|
|
1017
|
+
memberCount: number;
|
|
1018
|
+
} | undefined;
|
|
991
1019
|
pendingInvitations?: string[] | null | undefined;
|
|
992
1020
|
domainName?: string | undefined;
|
|
993
1021
|
domainDiscovery?: boolean | undefined;
|
|
@@ -1008,7 +1036,7 @@ export declare const validateSyncUser: (input: unknown) => {
|
|
|
1008
1036
|
autoReminder: number;
|
|
1009
1037
|
businessAccountId: string | null;
|
|
1010
1038
|
dailyGoal: number;
|
|
1011
|
-
dateFormat:
|
|
1039
|
+
dateFormat: "DD/MM/YYYY" | "MM/DD/YYYY";
|
|
1012
1040
|
dateistLang: string | null;
|
|
1013
1041
|
daysOff: number[];
|
|
1014
1042
|
featureIdentifier: string;
|
|
@@ -1018,7 +1046,7 @@ export declare const validateSyncUser: (input: unknown) => {
|
|
|
1018
1046
|
restriction: number;
|
|
1019
1047
|
karmaVacation: boolean;
|
|
1020
1048
|
dateistLang: any;
|
|
1021
|
-
beta:
|
|
1049
|
+
beta: boolean;
|
|
1022
1050
|
hasPushReminders: boolean;
|
|
1023
1051
|
dateistInlineDisabled: boolean;
|
|
1024
1052
|
autoInviteDisabled?: boolean | undefined;
|
|
@@ -1050,22 +1078,22 @@ export declare const validateSyncUser: (input: unknown) => {
|
|
|
1050
1078
|
lang: string;
|
|
1051
1079
|
mobileHost: string | null;
|
|
1052
1080
|
mobileNumber: string | null;
|
|
1053
|
-
nextWeek:
|
|
1081
|
+
nextWeek: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday";
|
|
1054
1082
|
premiumStatus: "not_premium" | "current_personal_plan" | "legacy_personal_plan" | "teams_business_member";
|
|
1055
1083
|
premiumUntil: string | null;
|
|
1056
1084
|
shareLimit: number;
|
|
1057
1085
|
sortOrder: number;
|
|
1058
|
-
startDay:
|
|
1086
|
+
startDay: "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday";
|
|
1059
1087
|
startPage: string;
|
|
1060
1088
|
themeId: string;
|
|
1061
|
-
timeFormat:
|
|
1089
|
+
timeFormat: "24h" | "12h";
|
|
1062
1090
|
token: string;
|
|
1063
1091
|
tzInfo: {
|
|
1064
1092
|
[x: string]: unknown;
|
|
1065
1093
|
timezone: string;
|
|
1066
1094
|
hours: number;
|
|
1067
1095
|
minutes: number;
|
|
1068
|
-
isDst:
|
|
1096
|
+
isDst: boolean;
|
|
1069
1097
|
gmtString: string;
|
|
1070
1098
|
};
|
|
1071
1099
|
uniquePrefix: number;
|
package/package.json
CHANGED