@doist/todoist-sdk 9.3.0 → 9.5.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/test-utils/webhook-fixtures.js +32 -0
- package/dist/cjs/types/index.js +1 -0
- package/dist/cjs/types/webhooks/comments.js +96 -0
- package/dist/cjs/types/webhooks/envelope.js +26 -0
- package/dist/cjs/types/webhooks/index.js +21 -0
- package/dist/cjs/types/webhooks/labels.js +54 -0
- package/dist/cjs/types/webhooks/tasks.js +68 -0
- package/dist/cjs/types/webhooks/types.js +54 -0
- package/dist/cjs/utils/index.js +4 -1
- package/dist/cjs/utils/webhook-parser.js +60 -0
- package/dist/esm/test-utils/webhook-fixtures.js +26 -0
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/types/webhooks/comments.js +93 -0
- package/dist/esm/types/webhooks/envelope.js +23 -0
- package/dist/esm/types/webhooks/index.js +5 -0
- package/dist/esm/types/webhooks/labels.js +51 -0
- package/dist/esm/types/webhooks/tasks.js +65 -0
- package/dist/esm/types/webhooks/types.js +51 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/webhook-parser.js +56 -0
- package/dist/types/test-utils/webhook-fixtures.d.ts +13 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/webhooks/comments.d.ts +1600 -0
- package/dist/types/types/webhooks/envelope.d.ts +34 -0
- package/dist/types/types/webhooks/index.d.ts +5 -0
- package/dist/types/types/webhooks/labels.d.ts +160 -0
- package/dist/types/types/webhooks/tasks.d.ts +981 -0
- package/dist/types/types/webhooks/types.d.ts +1936 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/webhook-parser.d.ts +48 -0
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Collaborator info for the user that triggered a webhook event.
|
|
4
|
+
* @see https://developer.todoist.com/sync/v1/#webhooks
|
|
5
|
+
*/
|
|
6
|
+
export declare const WebhookInitiatorSchema: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
fullName: z.ZodString;
|
|
9
|
+
email: z.ZodString;
|
|
10
|
+
imageId: z.ZodNullable<z.ZodString>;
|
|
11
|
+
isPremium: z.ZodBoolean;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
/**
|
|
14
|
+
* Collaborator info for the user that triggered a webhook event.
|
|
15
|
+
*/
|
|
16
|
+
export type WebhookInitiator = z.infer<typeof WebhookInitiatorSchema>;
|
|
17
|
+
/**
|
|
18
|
+
* Fields common to every webhook payload, regardless of `eventName`.
|
|
19
|
+
* Meant to be spread into per-event variant schemas.
|
|
20
|
+
*/
|
|
21
|
+
export declare const BaseWebhookEnvelopeShape: {
|
|
22
|
+
readonly version: z.ZodEnum<{
|
|
23
|
+
1: "1";
|
|
24
|
+
}>;
|
|
25
|
+
readonly userId: z.ZodString;
|
|
26
|
+
readonly initiator: z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
fullName: z.ZodString;
|
|
29
|
+
email: z.ZodString;
|
|
30
|
+
imageId: z.ZodNullable<z.ZodString>;
|
|
31
|
+
isPremium: z.ZodBoolean;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
readonly triggeredAt: z.ZodCoercedDate<unknown>;
|
|
34
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Enum-like object of label (`label:*`) webhook event names. Single source
|
|
4
|
+
* of truth for the discriminator values — `LABEL_WEBHOOK_EVENTS` and every
|
|
5
|
+
* `z.literal()` below derive from it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const LabelWebhookEventEnum: {
|
|
8
|
+
readonly Added: "label:added";
|
|
9
|
+
readonly Updated: "label:updated";
|
|
10
|
+
readonly Deleted: "label:deleted";
|
|
11
|
+
};
|
|
12
|
+
/** Webhook events that carry a label as their `eventData`. */
|
|
13
|
+
export declare const LABEL_WEBHOOK_EVENTS: readonly ["label:added", "label:updated", "label:deleted"];
|
|
14
|
+
/**
|
|
15
|
+
* A label as delivered in a webhook payload.
|
|
16
|
+
*
|
|
17
|
+
* Webhook label payloads differ from the REST label shape in two ways:
|
|
18
|
+
* they use `item_order` (not `order`) and always include `is_deleted`. This
|
|
19
|
+
* schema reuses {@link LabelSchema}, swapping `order` for `itemOrder` on
|
|
20
|
+
* the input side and renaming it back after validation, and surfaces
|
|
21
|
+
* `isDeleted` for downstream filtering.
|
|
22
|
+
*/
|
|
23
|
+
export declare const WebhookLabelSchema: z.ZodPipe<z.ZodObject<{
|
|
24
|
+
name: z.ZodString;
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
color: z.ZodString;
|
|
27
|
+
isFavorite: z.ZodBoolean;
|
|
28
|
+
itemOrder: z.ZodNullable<z.ZodNumber>;
|
|
29
|
+
isDeleted: z.ZodBoolean;
|
|
30
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
31
|
+
order: number | null;
|
|
32
|
+
name: string;
|
|
33
|
+
id: string;
|
|
34
|
+
color: string;
|
|
35
|
+
isFavorite: boolean;
|
|
36
|
+
isDeleted: boolean;
|
|
37
|
+
}, {
|
|
38
|
+
name: string;
|
|
39
|
+
id: string;
|
|
40
|
+
color: string;
|
|
41
|
+
isFavorite: boolean;
|
|
42
|
+
itemOrder: number | null;
|
|
43
|
+
isDeleted: boolean;
|
|
44
|
+
}>>;
|
|
45
|
+
/** A label as delivered in a webhook payload. */
|
|
46
|
+
export type WebhookLabel = z.infer<typeof WebhookLabelSchema>;
|
|
47
|
+
export declare const LabelAddedPayloadSchema: z.ZodObject<{
|
|
48
|
+
eventName: z.ZodLiteral<"label:added">;
|
|
49
|
+
eventData: z.ZodPipe<z.ZodObject<{
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
id: z.ZodString;
|
|
52
|
+
color: z.ZodString;
|
|
53
|
+
isFavorite: z.ZodBoolean;
|
|
54
|
+
itemOrder: z.ZodNullable<z.ZodNumber>;
|
|
55
|
+
isDeleted: z.ZodBoolean;
|
|
56
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
57
|
+
order: number | null;
|
|
58
|
+
name: string;
|
|
59
|
+
id: string;
|
|
60
|
+
color: string;
|
|
61
|
+
isFavorite: boolean;
|
|
62
|
+
isDeleted: boolean;
|
|
63
|
+
}, {
|
|
64
|
+
name: string;
|
|
65
|
+
id: string;
|
|
66
|
+
color: string;
|
|
67
|
+
isFavorite: boolean;
|
|
68
|
+
itemOrder: number | null;
|
|
69
|
+
isDeleted: boolean;
|
|
70
|
+
}>>;
|
|
71
|
+
version: z.ZodEnum<{
|
|
72
|
+
1: "1";
|
|
73
|
+
}>;
|
|
74
|
+
userId: z.ZodString;
|
|
75
|
+
initiator: z.ZodObject<{
|
|
76
|
+
id: z.ZodString;
|
|
77
|
+
fullName: z.ZodString;
|
|
78
|
+
email: z.ZodString;
|
|
79
|
+
imageId: z.ZodNullable<z.ZodString>;
|
|
80
|
+
isPremium: z.ZodBoolean;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
triggeredAt: z.ZodCoercedDate<unknown>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
export type LabelAddedPayload = z.infer<typeof LabelAddedPayloadSchema>;
|
|
85
|
+
export declare const LabelUpdatedPayloadSchema: z.ZodObject<{
|
|
86
|
+
eventName: z.ZodLiteral<"label:updated">;
|
|
87
|
+
eventData: z.ZodPipe<z.ZodObject<{
|
|
88
|
+
name: z.ZodString;
|
|
89
|
+
id: z.ZodString;
|
|
90
|
+
color: z.ZodString;
|
|
91
|
+
isFavorite: z.ZodBoolean;
|
|
92
|
+
itemOrder: z.ZodNullable<z.ZodNumber>;
|
|
93
|
+
isDeleted: z.ZodBoolean;
|
|
94
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
95
|
+
order: number | null;
|
|
96
|
+
name: string;
|
|
97
|
+
id: string;
|
|
98
|
+
color: string;
|
|
99
|
+
isFavorite: boolean;
|
|
100
|
+
isDeleted: boolean;
|
|
101
|
+
}, {
|
|
102
|
+
name: string;
|
|
103
|
+
id: string;
|
|
104
|
+
color: string;
|
|
105
|
+
isFavorite: boolean;
|
|
106
|
+
itemOrder: number | null;
|
|
107
|
+
isDeleted: boolean;
|
|
108
|
+
}>>;
|
|
109
|
+
version: z.ZodEnum<{
|
|
110
|
+
1: "1";
|
|
111
|
+
}>;
|
|
112
|
+
userId: z.ZodString;
|
|
113
|
+
initiator: z.ZodObject<{
|
|
114
|
+
id: z.ZodString;
|
|
115
|
+
fullName: z.ZodString;
|
|
116
|
+
email: z.ZodString;
|
|
117
|
+
imageId: z.ZodNullable<z.ZodString>;
|
|
118
|
+
isPremium: z.ZodBoolean;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
triggeredAt: z.ZodCoercedDate<unknown>;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
export type LabelUpdatedPayload = z.infer<typeof LabelUpdatedPayloadSchema>;
|
|
123
|
+
export declare const LabelDeletedPayloadSchema: z.ZodObject<{
|
|
124
|
+
eventName: z.ZodLiteral<"label:deleted">;
|
|
125
|
+
eventData: z.ZodPipe<z.ZodObject<{
|
|
126
|
+
name: z.ZodString;
|
|
127
|
+
id: z.ZodString;
|
|
128
|
+
color: z.ZodString;
|
|
129
|
+
isFavorite: z.ZodBoolean;
|
|
130
|
+
itemOrder: z.ZodNullable<z.ZodNumber>;
|
|
131
|
+
isDeleted: z.ZodBoolean;
|
|
132
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
133
|
+
order: number | null;
|
|
134
|
+
name: string;
|
|
135
|
+
id: string;
|
|
136
|
+
color: string;
|
|
137
|
+
isFavorite: boolean;
|
|
138
|
+
isDeleted: boolean;
|
|
139
|
+
}, {
|
|
140
|
+
name: string;
|
|
141
|
+
id: string;
|
|
142
|
+
color: string;
|
|
143
|
+
isFavorite: boolean;
|
|
144
|
+
itemOrder: number | null;
|
|
145
|
+
isDeleted: boolean;
|
|
146
|
+
}>>;
|
|
147
|
+
version: z.ZodEnum<{
|
|
148
|
+
1: "1";
|
|
149
|
+
}>;
|
|
150
|
+
userId: z.ZodString;
|
|
151
|
+
initiator: z.ZodObject<{
|
|
152
|
+
id: z.ZodString;
|
|
153
|
+
fullName: z.ZodString;
|
|
154
|
+
email: z.ZodString;
|
|
155
|
+
imageId: z.ZodNullable<z.ZodString>;
|
|
156
|
+
isPremium: z.ZodBoolean;
|
|
157
|
+
}, z.core.$strip>;
|
|
158
|
+
triggeredAt: z.ZodCoercedDate<unknown>;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
export type LabelDeletedPayload = z.infer<typeof LabelDeletedPayloadSchema>;
|