@doist/todoist-sdk 9.6.0 → 9.7.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/types/webhooks/filters.js +30 -0
- package/dist/cjs/types/webhooks/index.js +2 -0
- package/dist/cjs/types/webhooks/reminders.js +35 -0
- package/dist/cjs/types/webhooks/types.js +14 -28
- package/dist/esm/types/webhooks/filters.js +27 -0
- package/dist/esm/types/webhooks/index.js +2 -0
- package/dist/esm/types/webhooks/reminders.js +32 -0
- package/dist/esm/types/webhooks/types.js +19 -33
- package/dist/types/types/webhooks/filters.d.ts +96 -0
- package/dist/types/types/webhooks/index.d.ts +2 -0
- package/dist/types/types/webhooks/reminders.d.ts +82 -0
- package/dist/types/types/webhooks/types.d.ts +101 -40
- package/package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterDeletedPayloadSchema = exports.FilterUpdatedPayloadSchema = exports.FilterAddedPayloadSchema = exports.FILTER_WEBHOOK_EVENTS = exports.FilterWebhookEventEnum = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const filters_1 = require("../sync/resources/filters");
|
|
6
|
+
const envelope_1 = require("./envelope");
|
|
7
|
+
/**
|
|
8
|
+
* Enum-like object of filter (`filter:*`) webhook event names. Single
|
|
9
|
+
* source of truth for the discriminator values — `FILTER_WEBHOOK_EVENTS`
|
|
10
|
+
* and every `z.literal()` below derive from it.
|
|
11
|
+
*/
|
|
12
|
+
exports.FilterWebhookEventEnum = {
|
|
13
|
+
Added: 'filter:added',
|
|
14
|
+
Updated: 'filter:updated',
|
|
15
|
+
Deleted: 'filter:deleted',
|
|
16
|
+
};
|
|
17
|
+
/** Webhook events that carry a filter as their `eventData`. */
|
|
18
|
+
exports.FILTER_WEBHOOK_EVENTS = [
|
|
19
|
+
exports.FilterWebhookEventEnum.Added,
|
|
20
|
+
exports.FilterWebhookEventEnum.Updated,
|
|
21
|
+
exports.FilterWebhookEventEnum.Deleted,
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* Webhook filter payloads match the shared {@link Filter} resource shape,
|
|
25
|
+
* so `eventData` reuses `FilterSchema` directly — no webhook-specific
|
|
26
|
+
* schema is needed.
|
|
27
|
+
*/
|
|
28
|
+
exports.FilterAddedPayloadSchema = zod_1.z.object(Object.assign(Object.assign({}, envelope_1.BaseWebhookEnvelopeShape), { eventName: zod_1.z.literal(exports.FilterWebhookEventEnum.Added), eventData: filters_1.FilterSchema }));
|
|
29
|
+
exports.FilterUpdatedPayloadSchema = zod_1.z.object(Object.assign(Object.assign({}, envelope_1.BaseWebhookEnvelopeShape), { eventName: zod_1.z.literal(exports.FilterWebhookEventEnum.Updated), eventData: filters_1.FilterSchema }));
|
|
30
|
+
exports.FilterDeletedPayloadSchema = zod_1.z.object(Object.assign(Object.assign({}, envelope_1.BaseWebhookEnvelopeShape), { eventName: zod_1.z.literal(exports.FilterWebhookEventEnum.Deleted), eventData: filters_1.FilterSchema }));
|
|
@@ -16,8 +16,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./comments"), exports);
|
|
18
18
|
__exportStar(require("./envelope"), exports);
|
|
19
|
+
__exportStar(require("./filters"), exports);
|
|
19
20
|
__exportStar(require("./labels"), exports);
|
|
20
21
|
__exportStar(require("./projects"), exports);
|
|
22
|
+
__exportStar(require("./reminders"), exports);
|
|
21
23
|
__exportStar(require("./sections"), exports);
|
|
22
24
|
__exportStar(require("./tasks"), exports);
|
|
23
25
|
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReminderFiredPayloadSchema = exports.WebhookFiredReminderSchema = exports.REMINDER_WEBHOOK_EVENTS = exports.ReminderWebhookEventEnum = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const reminders_1 = require("../sync/resources/reminders");
|
|
6
|
+
const types_1 = require("../tasks/types");
|
|
7
|
+
const envelope_1 = require("./envelope");
|
|
8
|
+
/**
|
|
9
|
+
* Enum-like object of reminder (`reminder:*`) webhook event names. Single
|
|
10
|
+
* source of truth for the discriminator values — `REMINDER_WEBHOOK_EVENTS`
|
|
11
|
+
* and every `z.literal()` below derive from it.
|
|
12
|
+
*/
|
|
13
|
+
exports.ReminderWebhookEventEnum = {
|
|
14
|
+
Fired: 'reminder:fired',
|
|
15
|
+
};
|
|
16
|
+
/** Webhook events that carry a fired-reminder as their `eventData`. */
|
|
17
|
+
exports.REMINDER_WEBHOOK_EVENTS = [
|
|
18
|
+
exports.ReminderWebhookEventEnum.Fired,
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* A fired-reminder notification as delivered in a webhook payload.
|
|
22
|
+
*
|
|
23
|
+
* `reminder:fired` carries a subset of the full Reminder record (closer
|
|
24
|
+
* to a fired-notification projection), so it doesn't line up with any of
|
|
25
|
+
* the {@link Reminder} discriminated variants directly. This schema
|
|
26
|
+
* reuses {@link ReminderBaseSchema} for the common identity fields and
|
|
27
|
+
* adds the fields always present on a fired notification.
|
|
28
|
+
*/
|
|
29
|
+
exports.WebhookFiredReminderSchema = reminders_1.ReminderBaseSchema.extend({
|
|
30
|
+
type: zod_1.z.enum(reminders_1.REMINDER_TYPES),
|
|
31
|
+
isUrgent: zod_1.z.boolean(),
|
|
32
|
+
minuteOffset: zod_1.z.number().int().nullable(),
|
|
33
|
+
due: types_1.DueDateSchema.nullable(),
|
|
34
|
+
});
|
|
35
|
+
exports.ReminderFiredPayloadSchema = zod_1.z.object(Object.assign(Object.assign({}, envelope_1.BaseWebhookEnvelopeShape), { eventName: zod_1.z.literal(exports.ReminderWebhookEventEnum.Fired), eventData: exports.WebhookFiredReminderSchema }));
|
|
@@ -1,34 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebhookEventSchema = exports.WebhookPayloadSchema =
|
|
3
|
+
exports.WebhookEventSchema = exports.WebhookPayloadSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const types_1 = require("../apps/types");
|
|
6
6
|
Object.defineProperty(exports, "WebhookEventSchema", { enumerable: true, get: function () { return types_1.WebhookEventSchema; } });
|
|
7
7
|
const comments_1 = require("./comments");
|
|
8
|
-
const
|
|
8
|
+
const filters_1 = require("./filters");
|
|
9
9
|
const labels_1 = require("./labels");
|
|
10
10
|
const projects_1 = require("./projects");
|
|
11
|
+
const reminders_1 = require("./reminders");
|
|
11
12
|
const sections_1 = require("./sections");
|
|
12
13
|
const tasks_1 = require("./tasks");
|
|
13
|
-
/**
|
|
14
|
-
* Events whose payloads have been narrowed per resource. Each phase adds to
|
|
15
|
-
* this list; {@link UntypedWebhookPayloadSchema} below is derived by taking
|
|
16
|
-
* every {@link WebhookEvent} not present here.
|
|
17
|
-
*/
|
|
18
|
-
const TYPED_WEBHOOK_EVENTS = [
|
|
19
|
-
...tasks_1.TASK_WEBHOOK_EVENTS,
|
|
20
|
-
...comments_1.COMMENT_WEBHOOK_EVENTS,
|
|
21
|
-
...labels_1.LABEL_WEBHOOK_EVENTS,
|
|
22
|
-
...projects_1.PROJECT_WEBHOOK_EVENTS,
|
|
23
|
-
...sections_1.SECTION_WEBHOOK_EVENTS,
|
|
24
|
-
];
|
|
25
|
-
const untypedEventNames = types_1.WEBHOOK_EVENTS.filter((event) => !TYPED_WEBHOOK_EVENTS.includes(event));
|
|
26
|
-
/**
|
|
27
|
-
* A single branch covering every event whose payload has not yet been typed
|
|
28
|
-
* per resource. Follow-up PRs will replace slices of this with dedicated
|
|
29
|
-
* variants (filters, reminders).
|
|
30
|
-
*/
|
|
31
|
-
exports.UntypedWebhookPayloadSchema = zod_1.z.object(Object.assign(Object.assign({}, envelope_1.BaseWebhookEnvelopeShape), { eventName: zod_1.z.enum(untypedEventNames), eventData: zod_1.z.unknown(), eventDataExtra: zod_1.z.unknown().optional() }));
|
|
32
14
|
/**
|
|
33
15
|
* Wrapper schema for an incoming webhook payload.
|
|
34
16
|
*
|
|
@@ -36,12 +18,13 @@ exports.UntypedWebhookPayloadSchema = zod_1.z.object(Object.assign(Object.assign
|
|
|
36
18
|
* (`item:added`) in the `event_name` field, so consumers using
|
|
37
19
|
* `parseWebhookPayload` receive camelCase fields directly.
|
|
38
20
|
*
|
|
39
|
-
*
|
|
40
|
-
* carry a parsed comment (item-comment or
|
|
41
|
-
*
|
|
42
|
-
* (personal or workspace);
|
|
43
|
-
* {@link WebhookSection}
|
|
44
|
-
*
|
|
21
|
+
* Every {@link WebhookEvent} is typed today: `item:*` events carry a parsed
|
|
22
|
+
* {@link Task}; `note:*` events carry a parsed comment (item-comment or
|
|
23
|
+
* project-comment); `label:*` events carry a parsed label; `project:*`
|
|
24
|
+
* events carry a parsed {@link Project} (personal or workspace);
|
|
25
|
+
* `section:*` events carry a parsed {@link WebhookSection}; `filter:*`
|
|
26
|
+
* events carry a parsed {@link Filter}; `reminder:fired` carries a parsed
|
|
27
|
+
* {@link WebhookFiredReminder}.
|
|
45
28
|
*/
|
|
46
29
|
exports.WebhookPayloadSchema = zod_1.z.discriminatedUnion('eventName', [
|
|
47
30
|
tasks_1.TaskAddedPayloadSchema,
|
|
@@ -65,5 +48,8 @@ exports.WebhookPayloadSchema = zod_1.z.discriminatedUnion('eventName', [
|
|
|
65
48
|
sections_1.SectionDeletedPayloadSchema,
|
|
66
49
|
sections_1.SectionArchivedPayloadSchema,
|
|
67
50
|
sections_1.SectionUnarchivedPayloadSchema,
|
|
68
|
-
|
|
51
|
+
filters_1.FilterAddedPayloadSchema,
|
|
52
|
+
filters_1.FilterUpdatedPayloadSchema,
|
|
53
|
+
filters_1.FilterDeletedPayloadSchema,
|
|
54
|
+
reminders_1.ReminderFiredPayloadSchema,
|
|
69
55
|
]);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { FilterSchema } from '../sync/resources/filters.js';
|
|
3
|
+
import { BaseWebhookEnvelopeShape } from './envelope.js';
|
|
4
|
+
/**
|
|
5
|
+
* Enum-like object of filter (`filter:*`) webhook event names. Single
|
|
6
|
+
* source of truth for the discriminator values — `FILTER_WEBHOOK_EVENTS`
|
|
7
|
+
* and every `z.literal()` below derive from it.
|
|
8
|
+
*/
|
|
9
|
+
export const FilterWebhookEventEnum = {
|
|
10
|
+
Added: 'filter:added',
|
|
11
|
+
Updated: 'filter:updated',
|
|
12
|
+
Deleted: 'filter:deleted',
|
|
13
|
+
};
|
|
14
|
+
/** Webhook events that carry a filter as their `eventData`. */
|
|
15
|
+
export const FILTER_WEBHOOK_EVENTS = [
|
|
16
|
+
FilterWebhookEventEnum.Added,
|
|
17
|
+
FilterWebhookEventEnum.Updated,
|
|
18
|
+
FilterWebhookEventEnum.Deleted,
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* Webhook filter payloads match the shared {@link Filter} resource shape,
|
|
22
|
+
* so `eventData` reuses `FilterSchema` directly — no webhook-specific
|
|
23
|
+
* schema is needed.
|
|
24
|
+
*/
|
|
25
|
+
export const FilterAddedPayloadSchema = z.object(Object.assign(Object.assign({}, BaseWebhookEnvelopeShape), { eventName: z.literal(FilterWebhookEventEnum.Added), eventData: FilterSchema }));
|
|
26
|
+
export const FilterUpdatedPayloadSchema = z.object(Object.assign(Object.assign({}, BaseWebhookEnvelopeShape), { eventName: z.literal(FilterWebhookEventEnum.Updated), eventData: FilterSchema }));
|
|
27
|
+
export const FilterDeletedPayloadSchema = z.object(Object.assign(Object.assign({}, BaseWebhookEnvelopeShape), { eventName: z.literal(FilterWebhookEventEnum.Deleted), eventData: FilterSchema }));
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './comments.js';
|
|
2
2
|
export * from './envelope.js';
|
|
3
|
+
export * from './filters.js';
|
|
3
4
|
export * from './labels.js';
|
|
4
5
|
export * from './projects.js';
|
|
6
|
+
export * from './reminders.js';
|
|
5
7
|
export * from './sections.js';
|
|
6
8
|
export * from './tasks.js';
|
|
7
9
|
export * from './types.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { REMINDER_TYPES, ReminderBaseSchema } from '../sync/resources/reminders.js';
|
|
3
|
+
import { DueDateSchema } from '../tasks/types.js';
|
|
4
|
+
import { BaseWebhookEnvelopeShape } from './envelope.js';
|
|
5
|
+
/**
|
|
6
|
+
* Enum-like object of reminder (`reminder:*`) webhook event names. Single
|
|
7
|
+
* source of truth for the discriminator values — `REMINDER_WEBHOOK_EVENTS`
|
|
8
|
+
* and every `z.literal()` below derive from it.
|
|
9
|
+
*/
|
|
10
|
+
export const ReminderWebhookEventEnum = {
|
|
11
|
+
Fired: 'reminder:fired',
|
|
12
|
+
};
|
|
13
|
+
/** Webhook events that carry a fired-reminder as their `eventData`. */
|
|
14
|
+
export const REMINDER_WEBHOOK_EVENTS = [
|
|
15
|
+
ReminderWebhookEventEnum.Fired,
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* A fired-reminder notification as delivered in a webhook payload.
|
|
19
|
+
*
|
|
20
|
+
* `reminder:fired` carries a subset of the full Reminder record (closer
|
|
21
|
+
* to a fired-notification projection), so it doesn't line up with any of
|
|
22
|
+
* the {@link Reminder} discriminated variants directly. This schema
|
|
23
|
+
* reuses {@link ReminderBaseSchema} for the common identity fields and
|
|
24
|
+
* adds the fields always present on a fired notification.
|
|
25
|
+
*/
|
|
26
|
+
export const WebhookFiredReminderSchema = ReminderBaseSchema.extend({
|
|
27
|
+
type: z.enum(REMINDER_TYPES),
|
|
28
|
+
isUrgent: z.boolean(),
|
|
29
|
+
minuteOffset: z.number().int().nullable(),
|
|
30
|
+
due: DueDateSchema.nullable(),
|
|
31
|
+
});
|
|
32
|
+
export const ReminderFiredPayloadSchema = z.object(Object.assign(Object.assign({}, BaseWebhookEnvelopeShape), { eventName: z.literal(ReminderWebhookEventEnum.Fired), eventData: WebhookFiredReminderSchema }));
|
|
@@ -1,30 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
* Events whose payloads have been narrowed per resource. Each phase adds to
|
|
11
|
-
* this list; {@link UntypedWebhookPayloadSchema} below is derived by taking
|
|
12
|
-
* every {@link WebhookEvent} not present here.
|
|
13
|
-
*/
|
|
14
|
-
const TYPED_WEBHOOK_EVENTS = [
|
|
15
|
-
...TASK_WEBHOOK_EVENTS,
|
|
16
|
-
...COMMENT_WEBHOOK_EVENTS,
|
|
17
|
-
...LABEL_WEBHOOK_EVENTS,
|
|
18
|
-
...PROJECT_WEBHOOK_EVENTS,
|
|
19
|
-
...SECTION_WEBHOOK_EVENTS,
|
|
20
|
-
];
|
|
21
|
-
const untypedEventNames = WEBHOOK_EVENTS.filter((event) => !TYPED_WEBHOOK_EVENTS.includes(event));
|
|
22
|
-
/**
|
|
23
|
-
* A single branch covering every event whose payload has not yet been typed
|
|
24
|
-
* per resource. Follow-up PRs will replace slices of this with dedicated
|
|
25
|
-
* variants (filters, reminders).
|
|
26
|
-
*/
|
|
27
|
-
export const UntypedWebhookPayloadSchema = z.object(Object.assign(Object.assign({}, BaseWebhookEnvelopeShape), { eventName: z.enum(untypedEventNames), eventData: z.unknown(), eventDataExtra: z.unknown().optional() }));
|
|
2
|
+
import { WebhookEventSchema } from '../apps/types.js';
|
|
3
|
+
import { CommentAddedPayloadSchema, CommentDeletedPayloadSchema, CommentUpdatedPayloadSchema, } from './comments.js';
|
|
4
|
+
import { FilterAddedPayloadSchema, FilterDeletedPayloadSchema, FilterUpdatedPayloadSchema, } from './filters.js';
|
|
5
|
+
import { LabelAddedPayloadSchema, LabelDeletedPayloadSchema, LabelUpdatedPayloadSchema, } from './labels.js';
|
|
6
|
+
import { ProjectAddedPayloadSchema, ProjectArchivedPayloadSchema, ProjectDeletedPayloadSchema, ProjectUnarchivedPayloadSchema, ProjectUpdatedPayloadSchema, } from './projects.js';
|
|
7
|
+
import { ReminderFiredPayloadSchema } from './reminders.js';
|
|
8
|
+
import { SectionAddedPayloadSchema, SectionArchivedPayloadSchema, SectionDeletedPayloadSchema, SectionUnarchivedPayloadSchema, SectionUpdatedPayloadSchema, } from './sections.js';
|
|
9
|
+
import { TaskAddedPayloadSchema, TaskCompletedPayloadSchema, TaskDeletedPayloadSchema, TaskUncompletedPayloadSchema, TaskUpdatedPayloadSchema, } from './tasks.js';
|
|
28
10
|
/**
|
|
29
11
|
* Wrapper schema for an incoming webhook payload.
|
|
30
12
|
*
|
|
@@ -32,12 +14,13 @@ export const UntypedWebhookPayloadSchema = z.object(Object.assign(Object.assign(
|
|
|
32
14
|
* (`item:added`) in the `event_name` field, so consumers using
|
|
33
15
|
* `parseWebhookPayload` receive camelCase fields directly.
|
|
34
16
|
*
|
|
35
|
-
*
|
|
36
|
-
* carry a parsed comment (item-comment or
|
|
37
|
-
*
|
|
38
|
-
* (personal or workspace);
|
|
39
|
-
* {@link WebhookSection}
|
|
40
|
-
*
|
|
17
|
+
* Every {@link WebhookEvent} is typed today: `item:*` events carry a parsed
|
|
18
|
+
* {@link Task}; `note:*` events carry a parsed comment (item-comment or
|
|
19
|
+
* project-comment); `label:*` events carry a parsed label; `project:*`
|
|
20
|
+
* events carry a parsed {@link Project} (personal or workspace);
|
|
21
|
+
* `section:*` events carry a parsed {@link WebhookSection}; `filter:*`
|
|
22
|
+
* events carry a parsed {@link Filter}; `reminder:fired` carries a parsed
|
|
23
|
+
* {@link WebhookFiredReminder}.
|
|
41
24
|
*/
|
|
42
25
|
export const WebhookPayloadSchema = z.discriminatedUnion('eventName', [
|
|
43
26
|
TaskAddedPayloadSchema,
|
|
@@ -61,6 +44,9 @@ export const WebhookPayloadSchema = z.discriminatedUnion('eventName', [
|
|
|
61
44
|
SectionDeletedPayloadSchema,
|
|
62
45
|
SectionArchivedPayloadSchema,
|
|
63
46
|
SectionUnarchivedPayloadSchema,
|
|
64
|
-
|
|
47
|
+
FilterAddedPayloadSchema,
|
|
48
|
+
FilterUpdatedPayloadSchema,
|
|
49
|
+
FilterDeletedPayloadSchema,
|
|
50
|
+
ReminderFiredPayloadSchema,
|
|
65
51
|
]);
|
|
66
52
|
export { WebhookEventSchema };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Enum-like object of filter (`filter:*`) webhook event names. Single
|
|
4
|
+
* source of truth for the discriminator values — `FILTER_WEBHOOK_EVENTS`
|
|
5
|
+
* and every `z.literal()` below derive from it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const FilterWebhookEventEnum: {
|
|
8
|
+
readonly Added: "filter:added";
|
|
9
|
+
readonly Updated: "filter:updated";
|
|
10
|
+
readonly Deleted: "filter:deleted";
|
|
11
|
+
};
|
|
12
|
+
/** Webhook events that carry a filter as their `eventData`. */
|
|
13
|
+
export declare const FILTER_WEBHOOK_EVENTS: readonly ["filter:added", "filter:updated", "filter:deleted"];
|
|
14
|
+
/**
|
|
15
|
+
* Webhook filter payloads match the shared {@link Filter} resource shape,
|
|
16
|
+
* so `eventData` reuses `FilterSchema` directly — no webhook-specific
|
|
17
|
+
* schema is needed.
|
|
18
|
+
*/
|
|
19
|
+
export declare const FilterAddedPayloadSchema: z.ZodObject<{
|
|
20
|
+
eventName: z.ZodLiteral<"filter:added">;
|
|
21
|
+
eventData: z.ZodObject<{
|
|
22
|
+
id: z.ZodString;
|
|
23
|
+
name: z.ZodString;
|
|
24
|
+
query: z.ZodString;
|
|
25
|
+
color: z.ZodString;
|
|
26
|
+
isDeleted: z.ZodBoolean;
|
|
27
|
+
isFavorite: z.ZodBoolean;
|
|
28
|
+
isFrozen: z.ZodBoolean;
|
|
29
|
+
itemOrder: z.ZodNumber;
|
|
30
|
+
}, z.core.$loose>;
|
|
31
|
+
version: z.ZodEnum<{
|
|
32
|
+
1: "1";
|
|
33
|
+
}>;
|
|
34
|
+
userId: z.ZodString;
|
|
35
|
+
initiator: z.ZodObject<{
|
|
36
|
+
id: z.ZodString;
|
|
37
|
+
fullName: z.ZodString;
|
|
38
|
+
email: z.ZodString;
|
|
39
|
+
imageId: z.ZodNullable<z.ZodString>;
|
|
40
|
+
isPremium: z.ZodBoolean;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
triggeredAt: z.ZodCoercedDate<unknown>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
export type FilterAddedPayload = z.infer<typeof FilterAddedPayloadSchema>;
|
|
45
|
+
export declare const FilterUpdatedPayloadSchema: z.ZodObject<{
|
|
46
|
+
eventName: z.ZodLiteral<"filter:updated">;
|
|
47
|
+
eventData: z.ZodObject<{
|
|
48
|
+
id: z.ZodString;
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
query: z.ZodString;
|
|
51
|
+
color: z.ZodString;
|
|
52
|
+
isDeleted: z.ZodBoolean;
|
|
53
|
+
isFavorite: z.ZodBoolean;
|
|
54
|
+
isFrozen: z.ZodBoolean;
|
|
55
|
+
itemOrder: z.ZodNumber;
|
|
56
|
+
}, z.core.$loose>;
|
|
57
|
+
version: z.ZodEnum<{
|
|
58
|
+
1: "1";
|
|
59
|
+
}>;
|
|
60
|
+
userId: z.ZodString;
|
|
61
|
+
initiator: z.ZodObject<{
|
|
62
|
+
id: z.ZodString;
|
|
63
|
+
fullName: z.ZodString;
|
|
64
|
+
email: z.ZodString;
|
|
65
|
+
imageId: z.ZodNullable<z.ZodString>;
|
|
66
|
+
isPremium: z.ZodBoolean;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
triggeredAt: z.ZodCoercedDate<unknown>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export type FilterUpdatedPayload = z.infer<typeof FilterUpdatedPayloadSchema>;
|
|
71
|
+
export declare const FilterDeletedPayloadSchema: z.ZodObject<{
|
|
72
|
+
eventName: z.ZodLiteral<"filter:deleted">;
|
|
73
|
+
eventData: z.ZodObject<{
|
|
74
|
+
id: z.ZodString;
|
|
75
|
+
name: z.ZodString;
|
|
76
|
+
query: z.ZodString;
|
|
77
|
+
color: z.ZodString;
|
|
78
|
+
isDeleted: z.ZodBoolean;
|
|
79
|
+
isFavorite: z.ZodBoolean;
|
|
80
|
+
isFrozen: z.ZodBoolean;
|
|
81
|
+
itemOrder: z.ZodNumber;
|
|
82
|
+
}, z.core.$loose>;
|
|
83
|
+
version: z.ZodEnum<{
|
|
84
|
+
1: "1";
|
|
85
|
+
}>;
|
|
86
|
+
userId: z.ZodString;
|
|
87
|
+
initiator: z.ZodObject<{
|
|
88
|
+
id: z.ZodString;
|
|
89
|
+
fullName: z.ZodString;
|
|
90
|
+
email: z.ZodString;
|
|
91
|
+
imageId: z.ZodNullable<z.ZodString>;
|
|
92
|
+
isPremium: z.ZodBoolean;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
triggeredAt: z.ZodCoercedDate<unknown>;
|
|
95
|
+
}, z.core.$strip>;
|
|
96
|
+
export type FilterDeletedPayload = z.infer<typeof FilterDeletedPayloadSchema>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './comments.js';
|
|
2
2
|
export * from './envelope.js';
|
|
3
|
+
export * from './filters.js';
|
|
3
4
|
export * from './labels.js';
|
|
4
5
|
export * from './projects.js';
|
|
6
|
+
export * from './reminders.js';
|
|
5
7
|
export * from './sections.js';
|
|
6
8
|
export * from './tasks.js';
|
|
7
9
|
export * from './types.js';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Enum-like object of reminder (`reminder:*`) webhook event names. Single
|
|
4
|
+
* source of truth for the discriminator values — `REMINDER_WEBHOOK_EVENTS`
|
|
5
|
+
* and every `z.literal()` below derive from it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ReminderWebhookEventEnum: {
|
|
8
|
+
readonly Fired: "reminder:fired";
|
|
9
|
+
};
|
|
10
|
+
/** Webhook events that carry a fired-reminder as their `eventData`. */
|
|
11
|
+
export declare const REMINDER_WEBHOOK_EVENTS: readonly ["reminder:fired"];
|
|
12
|
+
/**
|
|
13
|
+
* A fired-reminder notification as delivered in a webhook payload.
|
|
14
|
+
*
|
|
15
|
+
* `reminder:fired` carries a subset of the full Reminder record (closer
|
|
16
|
+
* to a fired-notification projection), so it doesn't line up with any of
|
|
17
|
+
* the {@link Reminder} discriminated variants directly. This schema
|
|
18
|
+
* reuses {@link ReminderBaseSchema} for the common identity fields and
|
|
19
|
+
* adds the fields always present on a fired notification.
|
|
20
|
+
*/
|
|
21
|
+
export declare const WebhookFiredReminderSchema: z.ZodObject<{
|
|
22
|
+
id: z.ZodString;
|
|
23
|
+
notifyUid: z.ZodString;
|
|
24
|
+
itemId: z.ZodString;
|
|
25
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
26
|
+
isDeleted: z.ZodBoolean;
|
|
27
|
+
type: z.ZodEnum<{
|
|
28
|
+
relative: "relative";
|
|
29
|
+
absolute: "absolute";
|
|
30
|
+
location: "location";
|
|
31
|
+
}>;
|
|
32
|
+
isUrgent: z.ZodBoolean;
|
|
33
|
+
minuteOffset: z.ZodNullable<z.ZodNumber>;
|
|
34
|
+
due: z.ZodNullable<z.ZodObject<{
|
|
35
|
+
isRecurring: z.ZodBoolean;
|
|
36
|
+
string: z.ZodString;
|
|
37
|
+
date: z.ZodString;
|
|
38
|
+
datetime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
39
|
+
timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
40
|
+
lang: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
41
|
+
}, z.core.$strip>>;
|
|
42
|
+
}, z.core.$loose>;
|
|
43
|
+
/** A fired-reminder notification delivered in a webhook payload. */
|
|
44
|
+
export type WebhookFiredReminder = z.infer<typeof WebhookFiredReminderSchema>;
|
|
45
|
+
export declare const ReminderFiredPayloadSchema: z.ZodObject<{
|
|
46
|
+
eventName: z.ZodLiteral<"reminder:fired">;
|
|
47
|
+
eventData: z.ZodObject<{
|
|
48
|
+
id: z.ZodString;
|
|
49
|
+
notifyUid: z.ZodString;
|
|
50
|
+
itemId: z.ZodString;
|
|
51
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
52
|
+
isDeleted: z.ZodBoolean;
|
|
53
|
+
type: z.ZodEnum<{
|
|
54
|
+
relative: "relative";
|
|
55
|
+
absolute: "absolute";
|
|
56
|
+
location: "location";
|
|
57
|
+
}>;
|
|
58
|
+
isUrgent: z.ZodBoolean;
|
|
59
|
+
minuteOffset: z.ZodNullable<z.ZodNumber>;
|
|
60
|
+
due: z.ZodNullable<z.ZodObject<{
|
|
61
|
+
isRecurring: z.ZodBoolean;
|
|
62
|
+
string: z.ZodString;
|
|
63
|
+
date: z.ZodString;
|
|
64
|
+
datetime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
65
|
+
timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
66
|
+
lang: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
}, z.core.$loose>;
|
|
69
|
+
version: z.ZodEnum<{
|
|
70
|
+
1: "1";
|
|
71
|
+
}>;
|
|
72
|
+
userId: z.ZodString;
|
|
73
|
+
initiator: z.ZodObject<{
|
|
74
|
+
id: z.ZodString;
|
|
75
|
+
fullName: z.ZodString;
|
|
76
|
+
email: z.ZodString;
|
|
77
|
+
imageId: z.ZodNullable<z.ZodString>;
|
|
78
|
+
isPremium: z.ZodBoolean;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
triggeredAt: z.ZodCoercedDate<unknown>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
export type ReminderFiredPayload = z.infer<typeof ReminderFiredPayloadSchema>;
|
|
@@ -1,32 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { WebhookEventSchema, type WebhookEvent } from '../apps/types.js';
|
|
3
|
-
/**
|
|
4
|
-
* A single branch covering every event whose payload has not yet been typed
|
|
5
|
-
* per resource. Follow-up PRs will replace slices of this with dedicated
|
|
6
|
-
* variants (filters, reminders).
|
|
7
|
-
*/
|
|
8
|
-
export declare const UntypedWebhookPayloadSchema: z.ZodObject<{
|
|
9
|
-
eventName: z.ZodEnum<{
|
|
10
|
-
"filter:added": "filter:added";
|
|
11
|
-
"filter:updated": "filter:updated";
|
|
12
|
-
"filter:deleted": "filter:deleted";
|
|
13
|
-
"reminder:fired": "reminder:fired";
|
|
14
|
-
}>;
|
|
15
|
-
eventData: z.ZodUnknown;
|
|
16
|
-
eventDataExtra: z.ZodOptional<z.ZodUnknown>;
|
|
17
|
-
version: z.ZodEnum<{
|
|
18
|
-
1: "1";
|
|
19
|
-
}>;
|
|
20
|
-
userId: z.ZodString;
|
|
21
|
-
initiator: z.ZodObject<{
|
|
22
|
-
id: z.ZodString;
|
|
23
|
-
fullName: z.ZodString;
|
|
24
|
-
email: z.ZodString;
|
|
25
|
-
imageId: z.ZodNullable<z.ZodString>;
|
|
26
|
-
isPremium: z.ZodBoolean;
|
|
27
|
-
}, z.core.$strip>;
|
|
28
|
-
triggeredAt: z.ZodCoercedDate<unknown>;
|
|
29
|
-
}, z.core.$strip>;
|
|
30
3
|
/**
|
|
31
4
|
* Wrapper schema for an incoming webhook payload.
|
|
32
5
|
*
|
|
@@ -34,12 +7,13 @@ export declare const UntypedWebhookPayloadSchema: z.ZodObject<{
|
|
|
34
7
|
* (`item:added`) in the `event_name` field, so consumers using
|
|
35
8
|
* `parseWebhookPayload` receive camelCase fields directly.
|
|
36
9
|
*
|
|
37
|
-
*
|
|
38
|
-
* carry a parsed comment (item-comment or
|
|
39
|
-
*
|
|
40
|
-
* (personal or workspace);
|
|
41
|
-
* {@link WebhookSection}
|
|
42
|
-
*
|
|
10
|
+
* Every {@link WebhookEvent} is typed today: `item:*` events carry a parsed
|
|
11
|
+
* {@link Task}; `note:*` events carry a parsed comment (item-comment or
|
|
12
|
+
* project-comment); `label:*` events carry a parsed label; `project:*`
|
|
13
|
+
* events carry a parsed {@link Project} (personal or workspace);
|
|
14
|
+
* `section:*` events carry a parsed {@link WebhookSection}; `filter:*`
|
|
15
|
+
* events carry a parsed {@link Filter}; `reminder:fired` carries a parsed
|
|
16
|
+
* {@link WebhookFiredReminder}.
|
|
43
17
|
*/
|
|
44
18
|
export declare const WebhookPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
45
19
|
eventName: z.ZodLiteral<"item:added">;
|
|
@@ -2462,14 +2436,101 @@ export declare const WebhookPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
2462
2436
|
}, z.core.$strip>;
|
|
2463
2437
|
triggeredAt: z.ZodCoercedDate<unknown>;
|
|
2464
2438
|
}, z.core.$strip>, z.ZodObject<{
|
|
2465
|
-
eventName: z.
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2439
|
+
eventName: z.ZodLiteral<"filter:added">;
|
|
2440
|
+
eventData: z.ZodObject<{
|
|
2441
|
+
id: z.ZodString;
|
|
2442
|
+
name: z.ZodString;
|
|
2443
|
+
query: z.ZodString;
|
|
2444
|
+
color: z.ZodString;
|
|
2445
|
+
isDeleted: z.ZodBoolean;
|
|
2446
|
+
isFavorite: z.ZodBoolean;
|
|
2447
|
+
isFrozen: z.ZodBoolean;
|
|
2448
|
+
itemOrder: z.ZodNumber;
|
|
2449
|
+
}, z.core.$loose>;
|
|
2450
|
+
version: z.ZodEnum<{
|
|
2451
|
+
1: "1";
|
|
2452
|
+
}>;
|
|
2453
|
+
userId: z.ZodString;
|
|
2454
|
+
initiator: z.ZodObject<{
|
|
2455
|
+
id: z.ZodString;
|
|
2456
|
+
fullName: z.ZodString;
|
|
2457
|
+
email: z.ZodString;
|
|
2458
|
+
imageId: z.ZodNullable<z.ZodString>;
|
|
2459
|
+
isPremium: z.ZodBoolean;
|
|
2460
|
+
}, z.core.$strip>;
|
|
2461
|
+
triggeredAt: z.ZodCoercedDate<unknown>;
|
|
2462
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2463
|
+
eventName: z.ZodLiteral<"filter:updated">;
|
|
2464
|
+
eventData: z.ZodObject<{
|
|
2465
|
+
id: z.ZodString;
|
|
2466
|
+
name: z.ZodString;
|
|
2467
|
+
query: z.ZodString;
|
|
2468
|
+
color: z.ZodString;
|
|
2469
|
+
isDeleted: z.ZodBoolean;
|
|
2470
|
+
isFavorite: z.ZodBoolean;
|
|
2471
|
+
isFrozen: z.ZodBoolean;
|
|
2472
|
+
itemOrder: z.ZodNumber;
|
|
2473
|
+
}, z.core.$loose>;
|
|
2474
|
+
version: z.ZodEnum<{
|
|
2475
|
+
1: "1";
|
|
2470
2476
|
}>;
|
|
2471
|
-
|
|
2472
|
-
|
|
2477
|
+
userId: z.ZodString;
|
|
2478
|
+
initiator: z.ZodObject<{
|
|
2479
|
+
id: z.ZodString;
|
|
2480
|
+
fullName: z.ZodString;
|
|
2481
|
+
email: z.ZodString;
|
|
2482
|
+
imageId: z.ZodNullable<z.ZodString>;
|
|
2483
|
+
isPremium: z.ZodBoolean;
|
|
2484
|
+
}, z.core.$strip>;
|
|
2485
|
+
triggeredAt: z.ZodCoercedDate<unknown>;
|
|
2486
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2487
|
+
eventName: z.ZodLiteral<"filter:deleted">;
|
|
2488
|
+
eventData: z.ZodObject<{
|
|
2489
|
+
id: z.ZodString;
|
|
2490
|
+
name: z.ZodString;
|
|
2491
|
+
query: z.ZodString;
|
|
2492
|
+
color: z.ZodString;
|
|
2493
|
+
isDeleted: z.ZodBoolean;
|
|
2494
|
+
isFavorite: z.ZodBoolean;
|
|
2495
|
+
isFrozen: z.ZodBoolean;
|
|
2496
|
+
itemOrder: z.ZodNumber;
|
|
2497
|
+
}, z.core.$loose>;
|
|
2498
|
+
version: z.ZodEnum<{
|
|
2499
|
+
1: "1";
|
|
2500
|
+
}>;
|
|
2501
|
+
userId: z.ZodString;
|
|
2502
|
+
initiator: z.ZodObject<{
|
|
2503
|
+
id: z.ZodString;
|
|
2504
|
+
fullName: z.ZodString;
|
|
2505
|
+
email: z.ZodString;
|
|
2506
|
+
imageId: z.ZodNullable<z.ZodString>;
|
|
2507
|
+
isPremium: z.ZodBoolean;
|
|
2508
|
+
}, z.core.$strip>;
|
|
2509
|
+
triggeredAt: z.ZodCoercedDate<unknown>;
|
|
2510
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2511
|
+
eventName: z.ZodLiteral<"reminder:fired">;
|
|
2512
|
+
eventData: z.ZodObject<{
|
|
2513
|
+
id: z.ZodString;
|
|
2514
|
+
notifyUid: z.ZodString;
|
|
2515
|
+
itemId: z.ZodString;
|
|
2516
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
2517
|
+
isDeleted: z.ZodBoolean;
|
|
2518
|
+
type: z.ZodEnum<{
|
|
2519
|
+
relative: "relative";
|
|
2520
|
+
absolute: "absolute";
|
|
2521
|
+
location: "location";
|
|
2522
|
+
}>;
|
|
2523
|
+
isUrgent: z.ZodBoolean;
|
|
2524
|
+
minuteOffset: z.ZodNullable<z.ZodNumber>;
|
|
2525
|
+
due: z.ZodNullable<z.ZodObject<{
|
|
2526
|
+
isRecurring: z.ZodBoolean;
|
|
2527
|
+
string: z.ZodString;
|
|
2528
|
+
date: z.ZodString;
|
|
2529
|
+
datetime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2530
|
+
timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2531
|
+
lang: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2532
|
+
}, z.core.$strip>>;
|
|
2533
|
+
}, z.core.$loose>;
|
|
2473
2534
|
version: z.ZodEnum<{
|
|
2474
2535
|
1: "1";
|
|
2475
2536
|
}>;
|
package/package.json
CHANGED