@doist/todoist-api-typescript 5.2.0 → 5.2.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.
|
@@ -46,6 +46,7 @@ var DEFAULT_IS_COLLAPSED = false;
|
|
|
46
46
|
// URL constants using the helper functions
|
|
47
47
|
var DEFAULT_TASK_URL = (0, urlHelpers_1.getTaskUrl)(exports.DEFAULT_TASK_ID, exports.DEFAULT_TASK_CONTENT);
|
|
48
48
|
var DEFAULT_PROJECT_URL = (0, urlHelpers_1.getProjectUrl)(exports.DEFAULT_PROJECT_ID, exports.DEFAULT_PROJECT_NAME);
|
|
49
|
+
var DEFAULT_SECTION_URL = (0, urlHelpers_1.getSectionUrl)(DEFAULT_SECTION_ID, DEFAULT_SECTION_NAME);
|
|
49
50
|
exports.DEFAULT_AUTH_TOKEN = 'AToken';
|
|
50
51
|
exports.DEFAULT_REQUEST_ID = 'ARequestID';
|
|
51
52
|
exports.INVALID_ENTITY_ID = 1234;
|
|
@@ -154,6 +155,7 @@ exports.DEFAULT_SECTION = {
|
|
|
154
155
|
isArchived: false,
|
|
155
156
|
isDeleted: false,
|
|
156
157
|
isCollapsed: false,
|
|
158
|
+
url: DEFAULT_SECTION_URL,
|
|
157
159
|
};
|
|
158
160
|
exports.INVALID_SECTION = __assign(__assign({}, exports.DEFAULT_SECTION), { projectId: undefined });
|
|
159
161
|
exports.DEFAULT_LABEL = {
|
package/dist/types/entities.d.ts
CHANGED
|
@@ -331,7 +331,7 @@ export type WorkspaceProject = z.infer<typeof WorkspaceProjectSchema>;
|
|
|
331
331
|
* @see https://todoist.com/api/v1/docs#tag/Projects
|
|
332
332
|
*/
|
|
333
333
|
export type ProjectViewStyle = 'list' | 'board' | 'calendar';
|
|
334
|
-
export declare const SectionSchema: z.ZodObject<{
|
|
334
|
+
export declare const SectionSchema: z.ZodPipe<z.ZodObject<{
|
|
335
335
|
id: z.ZodString;
|
|
336
336
|
userId: z.ZodString;
|
|
337
337
|
projectId: z.ZodString;
|
|
@@ -343,7 +343,32 @@ export declare const SectionSchema: z.ZodObject<{
|
|
|
343
343
|
isArchived: z.ZodBoolean;
|
|
344
344
|
isDeleted: z.ZodBoolean;
|
|
345
345
|
isCollapsed: z.ZodBoolean;
|
|
346
|
-
}, z.core.$strip
|
|
346
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
347
|
+
url: string;
|
|
348
|
+
id: string;
|
|
349
|
+
userId: string;
|
|
350
|
+
projectId: string;
|
|
351
|
+
addedAt: string;
|
|
352
|
+
updatedAt: string;
|
|
353
|
+
archivedAt: string | null;
|
|
354
|
+
name: string;
|
|
355
|
+
sectionOrder: number;
|
|
356
|
+
isArchived: boolean;
|
|
357
|
+
isDeleted: boolean;
|
|
358
|
+
isCollapsed: boolean;
|
|
359
|
+
}, {
|
|
360
|
+
id: string;
|
|
361
|
+
userId: string;
|
|
362
|
+
projectId: string;
|
|
363
|
+
addedAt: string;
|
|
364
|
+
updatedAt: string;
|
|
365
|
+
archivedAt: string | null;
|
|
366
|
+
name: string;
|
|
367
|
+
sectionOrder: number;
|
|
368
|
+
isArchived: boolean;
|
|
369
|
+
isDeleted: boolean;
|
|
370
|
+
isCollapsed: boolean;
|
|
371
|
+
}>>;
|
|
347
372
|
/**
|
|
348
373
|
* Represents a section in a Todoist project.
|
|
349
374
|
* @see https://todoist.com/api/v1/docs#tag/Sections
|
package/dist/types/entities.js
CHANGED
|
@@ -119,7 +119,8 @@ exports.WorkspaceProjectSchema = exports.BaseProjectSchema.extend({
|
|
|
119
119
|
}).transform(function (data) {
|
|
120
120
|
return __assign(__assign({}, data), { url: (0, urlHelpers_1.getProjectUrl)(data.id, data.name) });
|
|
121
121
|
});
|
|
122
|
-
exports.SectionSchema = zod_1.z
|
|
122
|
+
exports.SectionSchema = zod_1.z
|
|
123
|
+
.object({
|
|
123
124
|
id: zod_1.z.string(),
|
|
124
125
|
userId: zod_1.z.string(),
|
|
125
126
|
projectId: zod_1.z.string(),
|
|
@@ -131,6 +132,9 @@ exports.SectionSchema = zod_1.z.object({
|
|
|
131
132
|
isArchived: zod_1.z.boolean(),
|
|
132
133
|
isDeleted: zod_1.z.boolean(),
|
|
133
134
|
isCollapsed: zod_1.z.boolean(),
|
|
135
|
+
})
|
|
136
|
+
.transform(function (data) {
|
|
137
|
+
return __assign(__assign({}, data), { url: (0, urlHelpers_1.getSectionUrl)(data.id, data.name) });
|
|
134
138
|
});
|
|
135
139
|
exports.LabelSchema = zod_1.z.object({
|
|
136
140
|
id: zod_1.z.string(),
|
|
@@ -14,3 +14,11 @@ export declare function getTaskUrl(taskId: string, content?: string): string;
|
|
|
14
14
|
* @returns The URL string for the project view.
|
|
15
15
|
*/
|
|
16
16
|
export declare function getProjectUrl(projectId: string, name?: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Generate the URL for a given section.
|
|
19
|
+
*
|
|
20
|
+
* @param sectionId The ID of the section.
|
|
21
|
+
* @param name The name of the section.
|
|
22
|
+
* @returns The URL string for the section view.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getSectionUrl(sectionId: string, name?: string): string;
|
package/dist/utils/urlHelpers.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTaskUrl = getTaskUrl;
|
|
4
4
|
exports.getProjectUrl = getProjectUrl;
|
|
5
|
+
exports.getSectionUrl = getSectionUrl;
|
|
5
6
|
var endpoints_1 = require("../consts/endpoints");
|
|
6
7
|
/**
|
|
7
8
|
* Generate the URL for a given task.
|
|
@@ -27,6 +28,18 @@ function getProjectUrl(projectId, name) {
|
|
|
27
28
|
var path = slug ? "".concat(slug, "-").concat(projectId) : projectId;
|
|
28
29
|
return "".concat(endpoints_1.TODOIST_WEB_URI, "/project/").concat(path);
|
|
29
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Generate the URL for a given section.
|
|
33
|
+
*
|
|
34
|
+
* @param sectionId The ID of the section.
|
|
35
|
+
* @param name The name of the section.
|
|
36
|
+
* @returns The URL string for the section view.
|
|
37
|
+
*/
|
|
38
|
+
function getSectionUrl(sectionId, name) {
|
|
39
|
+
var slug = name ? slugify(name) : undefined;
|
|
40
|
+
var path = slug ? "".concat(slug, "-").concat(sectionId) : sectionId;
|
|
41
|
+
return "".concat(endpoints_1.TODOIST_WEB_URI, "/section/").concat(path);
|
|
42
|
+
}
|
|
30
43
|
/**
|
|
31
44
|
* Slugify function borrowed from Django.
|
|
32
45
|
*
|
package/package.json
CHANGED