@automate.ax/integration-contracts 0.55.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/airtable/api.d.ts +19 -0
- package/dist/airtable/api.js +44 -0
- package/dist/airtable/index.d.ts +353 -0
- package/dist/airtable/index.js +32 -0
- package/dist/airtable/schemas.d.ts +716 -0
- package/dist/airtable/schemas.js +184 -0
- package/dist/asana/api.d.ts +70 -0
- package/dist/asana/api.js +119 -0
- package/dist/asana/index.d.ts +384 -0
- package/dist/asana/index.js +38 -0
- package/dist/asana/schemas.d.ts +1060 -0
- package/dist/asana/schemas.js +512 -0
- package/dist/brevo/api.d.ts +31 -0
- package/dist/brevo/api.js +64 -0
- package/dist/brevo/index.d.ts +822 -0
- package/dist/brevo/index.js +51 -0
- package/dist/brevo/schemas.d.ts +1217 -0
- package/dist/brevo/schemas.js +332 -0
- package/dist/github/index.d.ts +37 -0
- package/dist/github/index.js +106 -0
- package/dist/github/schemas.d.ts +8014 -0
- package/dist/github/schemas.js +113 -0
- package/dist/gmail/gmail.d.ts +172 -0
- package/dist/gmail/gmail.js +405 -0
- package/dist/gmail/index.d.ts +262 -0
- package/dist/gmail/index.js +23 -0
- package/dist/gmail/schemas.d.ts +444 -0
- package/dist/gmail/schemas.js +242 -0
- package/dist/google-calendar/event-schemas.d.ts +117 -0
- package/dist/google-calendar/event-schemas.js +13 -0
- package/dist/google-calendar/google-calendar.d.ts +147 -0
- package/dist/google-calendar/google-calendar.js +583 -0
- package/dist/google-calendar/index.d.ts +365 -0
- package/dist/google-calendar/index.js +24 -0
- package/dist/google-calendar/schemas.d.ts +592 -0
- package/dist/google-calendar/schemas.js +379 -0
- package/dist/google-forms/event-schemas.d.ts +105 -0
- package/dist/google-forms/event-schemas.js +20 -0
- package/dist/google-forms/google-forms.d.ts +243 -0
- package/dist/google-forms/google-forms.js +581 -0
- package/dist/google-forms/index.d.ts +141 -0
- package/dist/google-forms/index.js +20 -0
- package/dist/google-forms/schemas.d.ts +618 -0
- package/dist/google-forms/schemas.js +383 -0
- package/dist/linear/api.d.ts +63 -0
- package/dist/linear/api.js +88 -0
- package/dist/linear/index.d.ts +1338 -0
- package/dist/linear/index.js +55 -0
- package/dist/linear/schemas.d.ts +1795 -0
- package/dist/linear/schemas.js +760 -0
- package/dist/outlook/graph.d.ts +34 -0
- package/dist/outlook/graph.js +98 -0
- package/dist/outlook/index.d.ts +115 -0
- package/dist/outlook/index.js +11 -0
- package/dist/outlook/schemas.d.ts +529 -0
- package/dist/outlook/schemas.js +312 -0
- package/dist/resend/index.d.ts +707 -0
- package/dist/resend/index.js +54 -0
- package/dist/resend/schemas.d.ts +1033 -0
- package/dist/resend/schemas.js +377 -0
- package/dist/slack/index.d.ts +151 -0
- package/dist/slack/index.js +22 -0
- package/dist/slack/schemas.d.ts +641 -0
- package/dist/slack/schemas.js +581 -0
- package/dist/teams/graph.d.ts +33 -0
- package/dist/teams/graph.js +95 -0
- package/dist/teams/index.d.ts +164 -0
- package/dist/teams/index.js +21 -0
- package/dist/teams/schemas.d.ts +675 -0
- package/dist/teams/schemas.js +365 -0
- package/dist/trello/api.d.ts +69 -0
- package/dist/trello/api.js +140 -0
- package/dist/trello/event-schemas.d.ts +1101 -0
- package/dist/trello/event-schemas.js +233 -0
- package/dist/trello/index.d.ts +721 -0
- package/dist/trello/index.js +35 -0
- package/dist/trello/schemas.d.ts +283 -0
- package/dist/trello/schemas.js +401 -0
- package/dist/triggers.d.ts +26 -0
- package/dist/triggers.js +33 -0
- package/dist/vercel/index.d.ts +1065 -0
- package/dist/vercel/index.js +114 -0
- package/dist/vercel/schemas.d.ts +1518 -0
- package/dist/vercel/schemas.js +335 -0
- package/dist/whatsapp/api.d.ts +62 -0
- package/dist/whatsapp/api.js +121 -0
- package/dist/whatsapp/index.d.ts +614 -0
- package/dist/whatsapp/index.js +35 -0
- package/dist/whatsapp/schemas.d.ts +926 -0
- package/dist/whatsapp/schemas.js +326 -0
- package/package.json +169 -0
- package/src/airtable/api.ts +66 -0
- package/src/airtable/index.ts +41 -0
- package/src/airtable/schemas.ts +231 -0
- package/src/asana/api.ts +171 -0
- package/src/asana/index.ts +49 -0
- package/src/asana/schemas.ts +655 -0
- package/src/brevo/api.ts +89 -0
- package/src/brevo/index.ts +66 -0
- package/src/brevo/schemas.ts +449 -0
- package/src/github/index.ts +217 -0
- package/src/github/schemas.ts +435 -0
- package/src/gmail/gmail.ts +577 -0
- package/src/gmail/index.ts +26 -0
- package/src/gmail/schemas.ts +327 -0
- package/src/google-calendar/event-schemas.ts +16 -0
- package/src/google-calendar/google-calendar.ts +727 -0
- package/src/google-calendar/index.ts +27 -0
- package/src/google-calendar/schemas.ts +529 -0
- package/src/google-forms/event-schemas.ts +26 -0
- package/src/google-forms/google-forms.ts +683 -0
- package/src/google-forms/index.ts +23 -0
- package/src/google-forms/schemas.ts +499 -0
- package/src/linear/api.ts +141 -0
- package/src/linear/index.ts +71 -0
- package/src/linear/schemas.ts +1060 -0
- package/src/outlook/graph.ts +132 -0
- package/src/outlook/index.ts +14 -0
- package/src/outlook/schemas.ts +388 -0
- package/src/resend/index.ts +70 -0
- package/src/resend/schemas.ts +462 -0
- package/src/slack/index.ts +29 -0
- package/src/slack/schemas.ts +737 -0
- package/src/teams/graph.ts +130 -0
- package/src/teams/index.ts +27 -0
- package/src/teams/schemas.ts +463 -0
- package/src/trello/api.ts +190 -0
- package/src/trello/event-schemas.ts +290 -0
- package/src/trello/index.ts +45 -0
- package/src/trello/schemas.ts +507 -0
- package/src/triggers.ts +68 -0
- package/src/vercel/index.ts +147 -0
- package/src/vercel/schemas.ts +594 -0
- package/src/whatsapp/api.ts +171 -0
- package/src/whatsapp/index.ts +46 -0
- package/src/whatsapp/schemas.ts +341 -0
|
@@ -0,0 +1,760 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const LINEAR_DATE_TIME_SCHEMA = z.union([
|
|
3
|
+
z.date(),
|
|
4
|
+
z.iso.datetime({ offset: true }).transform((value) => new Date(value)),
|
|
5
|
+
]);
|
|
6
|
+
const LINEAR_JSON_OBJECT_SCHEMA = z.record(z.string(), z.json());
|
|
7
|
+
const LINEAR_WEBHOOK_USER_SCHEMA = z
|
|
8
|
+
.looseObject({
|
|
9
|
+
/** User avatar URL, when available. */
|
|
10
|
+
avatarUrl: z.string().nullable().optional(),
|
|
11
|
+
/** Workspace email address. */
|
|
12
|
+
email: z.string(),
|
|
13
|
+
/** Stable Linear user ID. */
|
|
14
|
+
id: z.string(),
|
|
15
|
+
/** User-facing name. */
|
|
16
|
+
name: z.string(),
|
|
17
|
+
/** Linear profile URL. */
|
|
18
|
+
url: z.string(),
|
|
19
|
+
})
|
|
20
|
+
.catchall(z.json());
|
|
21
|
+
const LINEAR_WEBHOOK_TEAM_SCHEMA = z
|
|
22
|
+
.looseObject({
|
|
23
|
+
/** Stable Linear team ID. */
|
|
24
|
+
id: z.string(),
|
|
25
|
+
/** Short issue identifier prefix. */
|
|
26
|
+
key: z.string(),
|
|
27
|
+
/** Team name. */
|
|
28
|
+
name: z.string(),
|
|
29
|
+
})
|
|
30
|
+
.catchall(z.json());
|
|
31
|
+
const LINEAR_WEBHOOK_PROJECT_REFERENCE_SCHEMA = z
|
|
32
|
+
.looseObject({
|
|
33
|
+
/** Stable Linear project ID. */
|
|
34
|
+
id: z.string(),
|
|
35
|
+
/** Project name. */
|
|
36
|
+
name: z.string(),
|
|
37
|
+
/** Linear project URL. */
|
|
38
|
+
url: z.string(),
|
|
39
|
+
})
|
|
40
|
+
.catchall(z.json());
|
|
41
|
+
const LINEAR_WEBHOOK_ISSUE_REFERENCE_SCHEMA = z
|
|
42
|
+
.looseObject({
|
|
43
|
+
/** Stable Linear issue ID. */
|
|
44
|
+
id: z.string(),
|
|
45
|
+
/** Human-readable identifier such as `ENG-123`. */
|
|
46
|
+
identifier: z.string(),
|
|
47
|
+
/** Team that owns the issue. */
|
|
48
|
+
team: LINEAR_WEBHOOK_TEAM_SCHEMA,
|
|
49
|
+
/** Stable ID of the team that owns the issue. */
|
|
50
|
+
teamId: z.string(),
|
|
51
|
+
/** Issue title. */
|
|
52
|
+
title: z.string(),
|
|
53
|
+
/** Linear issue URL. */
|
|
54
|
+
url: z.string(),
|
|
55
|
+
})
|
|
56
|
+
.catchall(z.json());
|
|
57
|
+
const LINEAR_WEBHOOK_EVENT_SCHEMA = z
|
|
58
|
+
.looseObject({
|
|
59
|
+
/** Provider action that caused the webhook. */
|
|
60
|
+
action: z.enum(["create", "update", "remove"]),
|
|
61
|
+
/** Linear identity responsible for the change, when available. */
|
|
62
|
+
actor: z
|
|
63
|
+
.looseObject({
|
|
64
|
+
email: z.string().optional(),
|
|
65
|
+
id: z.string().optional(),
|
|
66
|
+
name: z.string().optional(),
|
|
67
|
+
type: z.string().optional(),
|
|
68
|
+
url: z.string().optional(),
|
|
69
|
+
})
|
|
70
|
+
.catchall(z.json())
|
|
71
|
+
.nullable()
|
|
72
|
+
.optional(),
|
|
73
|
+
/** When the underlying change occurred. */
|
|
74
|
+
createdAt: z.iso.datetime({ offset: true }),
|
|
75
|
+
/** Provider-native changed resource fields. */
|
|
76
|
+
data: LINEAR_JSON_OBJECT_SCHEMA,
|
|
77
|
+
/** Stable Linear workspace ID. */
|
|
78
|
+
organizationId: z.string(),
|
|
79
|
+
/** Previous values for fields included in an update. */
|
|
80
|
+
updatedFrom: LINEAR_JSON_OBJECT_SCHEMA.optional(),
|
|
81
|
+
/** Linear URL for the changed resource, when available. */
|
|
82
|
+
url: z.string().optional(),
|
|
83
|
+
/** Stable ID of the OAuth app webhook delivering this event. */
|
|
84
|
+
webhookId: z.string(),
|
|
85
|
+
/** Unix timestamp in milliseconds when Linear sent the webhook. */
|
|
86
|
+
webhookTimestamp: z.number().int().nonnegative(),
|
|
87
|
+
})
|
|
88
|
+
.catchall(z.json());
|
|
89
|
+
const LINEAR_ISSUE_WEBHOOK_DATA_SCHEMA = z
|
|
90
|
+
.looseObject({
|
|
91
|
+
/** When the issue was archived. */
|
|
92
|
+
archivedAt: z.iso.datetime({ offset: true }).nullable().optional(),
|
|
93
|
+
/** User assigned to the issue. */
|
|
94
|
+
assignee: LINEAR_WEBHOOK_USER_SCHEMA.nullable().optional(),
|
|
95
|
+
/** Stable ID of the assigned user. */
|
|
96
|
+
assigneeId: z.string().nullable().optional(),
|
|
97
|
+
/** When the issue was canceled. */
|
|
98
|
+
canceledAt: z.iso.datetime({ offset: true }).nullable().optional(),
|
|
99
|
+
/** When the issue was completed. */
|
|
100
|
+
completedAt: z.iso.datetime({ offset: true }).nullable().optional(),
|
|
101
|
+
/** When the issue was created. */
|
|
102
|
+
createdAt: z.iso.datetime({ offset: true }),
|
|
103
|
+
/** User who created the issue. */
|
|
104
|
+
creator: LINEAR_WEBHOOK_USER_SCHEMA.nullable().optional(),
|
|
105
|
+
/** Stable ID of the issue creator. */
|
|
106
|
+
creatorId: z.string().nullable().optional(),
|
|
107
|
+
/** Markdown issue description. */
|
|
108
|
+
description: z.string().nullable().optional(),
|
|
109
|
+
/** Issue due date. */
|
|
110
|
+
dueDate: z.iso.date().nullable().optional(),
|
|
111
|
+
/** Issue estimate on the team's configured scale. */
|
|
112
|
+
estimate: z.number().nullable().optional(),
|
|
113
|
+
/** Stable Linear issue ID. */
|
|
114
|
+
id: z.string(),
|
|
115
|
+
/** Human-readable identifier such as `ENG-123`. */
|
|
116
|
+
identifier: z.string(),
|
|
117
|
+
/** IDs of labels currently applied to the issue. */
|
|
118
|
+
labelIds: z.string().array(),
|
|
119
|
+
/** Labels currently applied to the issue. */
|
|
120
|
+
labels: z
|
|
121
|
+
.looseObject({
|
|
122
|
+
color: z.string(),
|
|
123
|
+
id: z.string(),
|
|
124
|
+
name: z.string(),
|
|
125
|
+
parentId: z.string().nullable().optional(),
|
|
126
|
+
})
|
|
127
|
+
.catchall(z.json())
|
|
128
|
+
.array(),
|
|
129
|
+
/** Numeric portion of the issue identifier. */
|
|
130
|
+
number: z.number(),
|
|
131
|
+
/** Stable parent issue ID when this is a sub-issue. */
|
|
132
|
+
parentId: z.string().nullable().optional(),
|
|
133
|
+
/** Numeric priority from zero to four. */
|
|
134
|
+
priority: z.number(),
|
|
135
|
+
/** Human-readable issue priority. */
|
|
136
|
+
priorityLabel: z.string(),
|
|
137
|
+
/** Project containing the issue. */
|
|
138
|
+
project: LINEAR_WEBHOOK_PROJECT_REFERENCE_SCHEMA.nullable().optional(),
|
|
139
|
+
/** Stable ID of the project containing the issue. */
|
|
140
|
+
projectId: z.string().nullable().optional(),
|
|
141
|
+
/** When work began. */
|
|
142
|
+
startedAt: z.iso.datetime({ offset: true }).nullable().optional(),
|
|
143
|
+
/** Current workflow state. */
|
|
144
|
+
state: z
|
|
145
|
+
.looseObject({
|
|
146
|
+
color: z.string(),
|
|
147
|
+
id: z.string(),
|
|
148
|
+
name: z.string(),
|
|
149
|
+
type: z.string(),
|
|
150
|
+
})
|
|
151
|
+
.catchall(z.json()),
|
|
152
|
+
/** Stable ID of the current workflow state. */
|
|
153
|
+
stateId: z.string(),
|
|
154
|
+
/** IDs of users subscribed to the issue. */
|
|
155
|
+
subscriberIds: z.string().array(),
|
|
156
|
+
/** Team that owns the issue. */
|
|
157
|
+
team: LINEAR_WEBHOOK_TEAM_SCHEMA.nullable().optional(),
|
|
158
|
+
/** Stable ID of the team that owns the issue. */
|
|
159
|
+
teamId: z.string(),
|
|
160
|
+
/** Issue title. */
|
|
161
|
+
title: z.string(),
|
|
162
|
+
/** Whether the issue is in Linear's recently deleted view. */
|
|
163
|
+
trashed: z.boolean().nullable().optional(),
|
|
164
|
+
/** When the issue was last updated. */
|
|
165
|
+
updatedAt: z.iso.datetime({ offset: true }),
|
|
166
|
+
/** Linear issue URL. */
|
|
167
|
+
url: z.string(),
|
|
168
|
+
})
|
|
169
|
+
.catchall(z.json());
|
|
170
|
+
const LINEAR_COMMENT_WEBHOOK_DATA_SCHEMA = z
|
|
171
|
+
.looseObject({
|
|
172
|
+
/** When the comment was archived. */
|
|
173
|
+
archivedAt: z.iso.datetime({ offset: true }).nullable().optional(),
|
|
174
|
+
/** Markdown comment body. */
|
|
175
|
+
body: z.string(),
|
|
176
|
+
/** When the comment was created. */
|
|
177
|
+
createdAt: z.iso.datetime({ offset: true }),
|
|
178
|
+
/** When the body was last edited. */
|
|
179
|
+
editedAt: z.iso.datetime({ offset: true }).nullable().optional(),
|
|
180
|
+
/** Stable Linear comment ID. */
|
|
181
|
+
id: z.string(),
|
|
182
|
+
/** Issue containing the comment. */
|
|
183
|
+
issue: LINEAR_WEBHOOK_ISSUE_REFERENCE_SCHEMA.nullable().optional(),
|
|
184
|
+
/** Stable ID of the issue containing the comment. */
|
|
185
|
+
issueId: z.string().nullable().optional(),
|
|
186
|
+
/** Stable parent comment ID when this is a threaded reply. */
|
|
187
|
+
parentId: z.string().nullable().optional(),
|
|
188
|
+
/** Text selected by an inline comment. */
|
|
189
|
+
quotedText: z.string().nullable().optional(),
|
|
190
|
+
/** When the comment thread was resolved. */
|
|
191
|
+
resolvedAt: z.iso.datetime({ offset: true }).nullable().optional(),
|
|
192
|
+
/** When the comment was last updated. */
|
|
193
|
+
updatedAt: z.iso.datetime({ offset: true }),
|
|
194
|
+
/** User who authored the comment. */
|
|
195
|
+
user: LINEAR_WEBHOOK_USER_SCHEMA.nullable().optional(),
|
|
196
|
+
/** Stable ID of the comment author. */
|
|
197
|
+
userId: z.string().nullable().optional(),
|
|
198
|
+
})
|
|
199
|
+
.catchall(z.json());
|
|
200
|
+
const LINEAR_PROJECT_WEBHOOK_DATA_SCHEMA = z
|
|
201
|
+
.looseObject({
|
|
202
|
+
/** When the project was archived. */
|
|
203
|
+
archivedAt: z.iso.datetime({ offset: true }).nullable().optional(),
|
|
204
|
+
/** When the project was canceled. */
|
|
205
|
+
canceledAt: z.iso.datetime({ offset: true }).nullable().optional(),
|
|
206
|
+
/** Project display color. */
|
|
207
|
+
color: z.string(),
|
|
208
|
+
/** When the project was completed. */
|
|
209
|
+
completedAt: z.iso.datetime({ offset: true }).nullable().optional(),
|
|
210
|
+
/** Long-form Markdown project content. */
|
|
211
|
+
content: z.string().nullable().optional(),
|
|
212
|
+
/** When the project was created. */
|
|
213
|
+
createdAt: z.iso.datetime({ offset: true }),
|
|
214
|
+
/** Stable ID of the user who created the project. */
|
|
215
|
+
creatorId: z.string().nullable().optional(),
|
|
216
|
+
/** Short project summary. */
|
|
217
|
+
description: z.string(),
|
|
218
|
+
/** Current project health. */
|
|
219
|
+
health: z.string().nullable().optional(),
|
|
220
|
+
/** Emoji or provider-supported project icon value. */
|
|
221
|
+
icon: z.string().nullable().optional(),
|
|
222
|
+
/** Stable Linear project ID. */
|
|
223
|
+
id: z.string(),
|
|
224
|
+
/** Human-readable project identifier. */
|
|
225
|
+
identifier: z.string().nullable().optional(),
|
|
226
|
+
/** Workspace user leading the project. */
|
|
227
|
+
lead: LINEAR_WEBHOOK_USER_SCHEMA.nullable().optional(),
|
|
228
|
+
/** Stable ID of the project lead. */
|
|
229
|
+
leadId: z.string().nullable().optional(),
|
|
230
|
+
/** IDs of project members. */
|
|
231
|
+
memberIds: z.string().array(),
|
|
232
|
+
/** Project name. */
|
|
233
|
+
name: z.string(),
|
|
234
|
+
/** Numeric project priority. */
|
|
235
|
+
priority: z.number(),
|
|
236
|
+
/** URL-safe project slug. */
|
|
237
|
+
slugId: z.string(),
|
|
238
|
+
/** Planned project start date. */
|
|
239
|
+
startDate: z.iso.date().nullable().optional(),
|
|
240
|
+
/** When work actually started. */
|
|
241
|
+
startedAt: z.iso.datetime({ offset: true }).nullable().optional(),
|
|
242
|
+
/** Configured workspace project status. */
|
|
243
|
+
status: z
|
|
244
|
+
.looseObject({
|
|
245
|
+
color: z.string(),
|
|
246
|
+
id: z.string(),
|
|
247
|
+
name: z.string(),
|
|
248
|
+
type: z.string(),
|
|
249
|
+
})
|
|
250
|
+
.catchall(z.json())
|
|
251
|
+
.nullable()
|
|
252
|
+
.optional(),
|
|
253
|
+
/** Stable ID of the configured project status. */
|
|
254
|
+
statusId: z.string(),
|
|
255
|
+
/** Planned project target date. */
|
|
256
|
+
targetDate: z.iso.date().nullable().optional(),
|
|
257
|
+
/** IDs of teams associated with the project. */
|
|
258
|
+
teamIds: z.string().array(),
|
|
259
|
+
/** Whether the project is in Linear's recently deleted view. */
|
|
260
|
+
trashed: z.boolean().nullable().optional(),
|
|
261
|
+
/** When the project was last updated. */
|
|
262
|
+
updatedAt: z.iso.datetime({ offset: true }),
|
|
263
|
+
/** Linear project URL. */
|
|
264
|
+
url: z.string(),
|
|
265
|
+
})
|
|
266
|
+
.catchall(z.json());
|
|
267
|
+
const LINEAR_ISSUE_WEBHOOK_EVENT_SCHEMA = LINEAR_WEBHOOK_EVENT_SCHEMA.extend({
|
|
268
|
+
data: LINEAR_ISSUE_WEBHOOK_DATA_SCHEMA,
|
|
269
|
+
type: z.literal("Issue"),
|
|
270
|
+
});
|
|
271
|
+
const LINEAR_COMMENT_WEBHOOK_EVENT_SCHEMA = LINEAR_WEBHOOK_EVENT_SCHEMA.extend({
|
|
272
|
+
data: LINEAR_COMMENT_WEBHOOK_DATA_SCHEMA,
|
|
273
|
+
type: z.literal("Comment"),
|
|
274
|
+
});
|
|
275
|
+
const LINEAR_PROJECT_WEBHOOK_EVENT_SCHEMA = LINEAR_WEBHOOK_EVENT_SCHEMA.extend({
|
|
276
|
+
data: LINEAR_PROJECT_WEBHOOK_DATA_SCHEMA,
|
|
277
|
+
type: z.literal("Project"),
|
|
278
|
+
});
|
|
279
|
+
export const LINEAR_ISSUE_EVENT_SCHEMA = LINEAR_ISSUE_WEBHOOK_DATA_SCHEMA.extend({
|
|
280
|
+
/** Original provider webhook envelope. */
|
|
281
|
+
event: LINEAR_ISSUE_WEBHOOK_EVENT_SCHEMA,
|
|
282
|
+
});
|
|
283
|
+
export const LINEAR_COMMENT_EVENT_SCHEMA = LINEAR_COMMENT_WEBHOOK_DATA_SCHEMA.extend({
|
|
284
|
+
/** Original provider webhook envelope. */
|
|
285
|
+
event: LINEAR_COMMENT_WEBHOOK_EVENT_SCHEMA,
|
|
286
|
+
});
|
|
287
|
+
export const LINEAR_PROJECT_EVENT_SCHEMA = LINEAR_PROJECT_WEBHOOK_DATA_SCHEMA.extend({
|
|
288
|
+
/** Original provider webhook envelope. */
|
|
289
|
+
event: LINEAR_PROJECT_WEBHOOK_EVENT_SCHEMA,
|
|
290
|
+
});
|
|
291
|
+
export const LINEAR_ISSUE_CREATED_EVENT_SCHEMA = LINEAR_ISSUE_EVENT_SCHEMA.extend({
|
|
292
|
+
event: LINEAR_ISSUE_WEBHOOK_EVENT_SCHEMA.extend({
|
|
293
|
+
action: z.literal("create"),
|
|
294
|
+
}),
|
|
295
|
+
});
|
|
296
|
+
export const LINEAR_ISSUE_UPDATED_EVENT_SCHEMA = LINEAR_ISSUE_EVENT_SCHEMA.extend({
|
|
297
|
+
event: LINEAR_ISSUE_WEBHOOK_EVENT_SCHEMA.extend({
|
|
298
|
+
action: z.literal("update"),
|
|
299
|
+
}),
|
|
300
|
+
});
|
|
301
|
+
export const LINEAR_ISSUE_REMOVED_EVENT_SCHEMA = LINEAR_ISSUE_EVENT_SCHEMA.extend({
|
|
302
|
+
event: LINEAR_ISSUE_WEBHOOK_EVENT_SCHEMA.extend({
|
|
303
|
+
action: z.literal("remove"),
|
|
304
|
+
}),
|
|
305
|
+
});
|
|
306
|
+
export const LINEAR_COMMENT_CREATED_EVENT_SCHEMA = LINEAR_COMMENT_EVENT_SCHEMA.extend({
|
|
307
|
+
event: LINEAR_COMMENT_WEBHOOK_EVENT_SCHEMA.extend({
|
|
308
|
+
action: z.literal("create"),
|
|
309
|
+
}),
|
|
310
|
+
});
|
|
311
|
+
export const LINEAR_COMMENT_UPDATED_EVENT_SCHEMA = LINEAR_COMMENT_EVENT_SCHEMA.extend({
|
|
312
|
+
event: LINEAR_COMMENT_WEBHOOK_EVENT_SCHEMA.extend({
|
|
313
|
+
action: z.literal("update"),
|
|
314
|
+
}),
|
|
315
|
+
});
|
|
316
|
+
export const LINEAR_COMMENT_REMOVED_EVENT_SCHEMA = LINEAR_COMMENT_EVENT_SCHEMA.extend({
|
|
317
|
+
event: LINEAR_COMMENT_WEBHOOK_EVENT_SCHEMA.extend({
|
|
318
|
+
action: z.literal("remove"),
|
|
319
|
+
}),
|
|
320
|
+
});
|
|
321
|
+
export const LINEAR_PROJECT_CREATED_EVENT_SCHEMA = LINEAR_PROJECT_EVENT_SCHEMA.extend({
|
|
322
|
+
event: LINEAR_PROJECT_WEBHOOK_EVENT_SCHEMA.extend({
|
|
323
|
+
action: z.literal("create"),
|
|
324
|
+
}),
|
|
325
|
+
});
|
|
326
|
+
export const LINEAR_PROJECT_UPDATED_EVENT_SCHEMA = LINEAR_PROJECT_EVENT_SCHEMA.extend({
|
|
327
|
+
event: LINEAR_PROJECT_WEBHOOK_EVENT_SCHEMA.extend({
|
|
328
|
+
action: z.literal("update"),
|
|
329
|
+
}),
|
|
330
|
+
});
|
|
331
|
+
export const LINEAR_PROJECT_REMOVED_EVENT_SCHEMA = LINEAR_PROJECT_EVENT_SCHEMA.extend({
|
|
332
|
+
event: LINEAR_PROJECT_WEBHOOK_EVENT_SCHEMA.extend({
|
|
333
|
+
action: z.literal("remove"),
|
|
334
|
+
}),
|
|
335
|
+
});
|
|
336
|
+
export const LINEAR_PAGE_INPUT_SCHEMA = z.object({
|
|
337
|
+
/** Cursor returned by the previous page. */
|
|
338
|
+
after: z.string().min(1).optional(),
|
|
339
|
+
/** Whether archived resources should be included. */
|
|
340
|
+
includeArchived: z.boolean().optional(),
|
|
341
|
+
/** Maximum resources in this page. */
|
|
342
|
+
limit: z.number().int().min(1).max(50).prefault(50),
|
|
343
|
+
});
|
|
344
|
+
export const LINEAR_PAGE_INFO_SCHEMA = z.object({
|
|
345
|
+
/** Cursor for the next page, when more results are available. */
|
|
346
|
+
endCursor: z.string().nullable(),
|
|
347
|
+
/** Whether a later page exists. */
|
|
348
|
+
hasNextPage: z.boolean(),
|
|
349
|
+
/** Whether an earlier page exists. */
|
|
350
|
+
hasPreviousPage: z.boolean(),
|
|
351
|
+
/** Cursor for the first item in this page. */
|
|
352
|
+
startCursor: z.string().nullable(),
|
|
353
|
+
});
|
|
354
|
+
export const LINEAR_USER_REFERENCE_SCHEMA = z.object({
|
|
355
|
+
/** Whether the user can currently access the workspace. */
|
|
356
|
+
active: z.boolean(),
|
|
357
|
+
/** User avatar URL. */
|
|
358
|
+
avatarUrl: z.string().nullable(),
|
|
359
|
+
/** User-facing display name. */
|
|
360
|
+
displayName: z.string(),
|
|
361
|
+
/** Workspace email address. */
|
|
362
|
+
email: z.string(),
|
|
363
|
+
/** Stable Linear user ID. */
|
|
364
|
+
id: z.string(),
|
|
365
|
+
/** Full user name. */
|
|
366
|
+
name: z.string(),
|
|
367
|
+
});
|
|
368
|
+
export const LINEAR_ORGANIZATION_SCHEMA = z.object({
|
|
369
|
+
/** When the workspace was archived, if applicable. */
|
|
370
|
+
archivedAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
371
|
+
/** When the workspace was created. */
|
|
372
|
+
createdAt: LINEAR_DATE_TIME_SCHEMA,
|
|
373
|
+
/** Number of issues created in the workspace. */
|
|
374
|
+
createdIssueCount: z.number().int().nonnegative(),
|
|
375
|
+
/** Stable Linear workspace ID. */
|
|
376
|
+
id: z.string(),
|
|
377
|
+
/** Workspace logo URL. */
|
|
378
|
+
logoUrl: z.string().nullable(),
|
|
379
|
+
/** Workspace name. */
|
|
380
|
+
name: z.string(),
|
|
381
|
+
/** Whether roadmap features are enabled. */
|
|
382
|
+
roadmapEnabled: z.boolean(),
|
|
383
|
+
/** When the workspace was last updated. */
|
|
384
|
+
updatedAt: LINEAR_DATE_TIME_SCHEMA,
|
|
385
|
+
/** URL key used in Linear workspace URLs. */
|
|
386
|
+
urlKey: z.string(),
|
|
387
|
+
/** Number of workspace users. */
|
|
388
|
+
userCount: z.number().int().nonnegative(),
|
|
389
|
+
});
|
|
390
|
+
export const LINEAR_USER_SCHEMA = LINEAR_USER_REFERENCE_SCHEMA.extend({
|
|
391
|
+
/** Whether this user is a workspace administrator. */
|
|
392
|
+
admin: z.boolean(),
|
|
393
|
+
/** When the user was archived, or `null` while active. */
|
|
394
|
+
archivedAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
395
|
+
/** Whether this identity belongs to a Linear app. */
|
|
396
|
+
app: z.boolean(),
|
|
397
|
+
/** When the user joined the workspace. */
|
|
398
|
+
createdAt: LINEAR_DATE_TIME_SCHEMA,
|
|
399
|
+
/** Whether this user has guest access. */
|
|
400
|
+
guest: z.boolean(),
|
|
401
|
+
/** Whether this is the authenticated user. */
|
|
402
|
+
isMe: z.boolean(),
|
|
403
|
+
/** Whether this user owns the workspace. */
|
|
404
|
+
owner: z.boolean(),
|
|
405
|
+
/** IANA time zone configured for the user. */
|
|
406
|
+
timezone: z.string().nullable(),
|
|
407
|
+
/** When the user was last updated. */
|
|
408
|
+
updatedAt: LINEAR_DATE_TIME_SCHEMA,
|
|
409
|
+
/** Linear profile URL. */
|
|
410
|
+
url: z.string(),
|
|
411
|
+
});
|
|
412
|
+
export const LINEAR_TEAM_REFERENCE_SCHEMA = z.object({
|
|
413
|
+
/** Team name shown in Linear. */
|
|
414
|
+
displayName: z.string(),
|
|
415
|
+
/** Stable Linear team ID. */
|
|
416
|
+
id: z.string(),
|
|
417
|
+
/** Short issue identifier prefix. */
|
|
418
|
+
key: z.string(),
|
|
419
|
+
/** Full team name. */
|
|
420
|
+
name: z.string(),
|
|
421
|
+
});
|
|
422
|
+
export const LINEAR_TEAM_SCHEMA = LINEAR_TEAM_REFERENCE_SCHEMA.extend({
|
|
423
|
+
/** When the team was archived, or `null` while active. */
|
|
424
|
+
archivedAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
425
|
+
/** Team display color. */
|
|
426
|
+
color: z.string().nullable(),
|
|
427
|
+
/** When the team was created. */
|
|
428
|
+
createdAt: LINEAR_DATE_TIME_SCHEMA,
|
|
429
|
+
/** Whether cycles are enabled. */
|
|
430
|
+
cyclesEnabled: z.boolean(),
|
|
431
|
+
/** Default estimate assigned to new issues. */
|
|
432
|
+
defaultIssueEstimate: z.number(),
|
|
433
|
+
/** Team description. */
|
|
434
|
+
description: z.string().nullable(),
|
|
435
|
+
/** Team icon value. */
|
|
436
|
+
icon: z.string().nullable(),
|
|
437
|
+
/** Issue estimate scale used by the team. */
|
|
438
|
+
issueEstimationType: z.string(),
|
|
439
|
+
/** Whether membership is restricted. */
|
|
440
|
+
private: z.boolean(),
|
|
441
|
+
/** IANA time zone configured for the team. */
|
|
442
|
+
timezone: z.string(),
|
|
443
|
+
/** Whether new issues may enter triage. */
|
|
444
|
+
triageEnabled: z.boolean(),
|
|
445
|
+
/** When the team was last updated. */
|
|
446
|
+
updatedAt: LINEAR_DATE_TIME_SCHEMA,
|
|
447
|
+
});
|
|
448
|
+
export const LINEAR_WORKFLOW_STATE_SCHEMA = z.object({
|
|
449
|
+
/** When the state was archived, or `null` while active. */
|
|
450
|
+
archivedAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
451
|
+
/** State display color. */
|
|
452
|
+
color: z.string(),
|
|
453
|
+
/** When the state was created. */
|
|
454
|
+
createdAt: LINEAR_DATE_TIME_SCHEMA,
|
|
455
|
+
/** State description. */
|
|
456
|
+
description: z.string().nullable(),
|
|
457
|
+
/** Stable workflow state ID. */
|
|
458
|
+
id: z.string(),
|
|
459
|
+
/** Human-readable state name. */
|
|
460
|
+
name: z.string(),
|
|
461
|
+
/** Relative ordering within the workflow. */
|
|
462
|
+
position: z.number(),
|
|
463
|
+
/** Team that owns the workflow. */
|
|
464
|
+
team: LINEAR_TEAM_REFERENCE_SCHEMA,
|
|
465
|
+
/** State category such as `backlog`, `started`, or `completed`. */
|
|
466
|
+
type: z.string(),
|
|
467
|
+
/** When the state was last updated. */
|
|
468
|
+
updatedAt: LINEAR_DATE_TIME_SCHEMA,
|
|
469
|
+
});
|
|
470
|
+
export const LINEAR_ISSUE_LABEL_SCHEMA = z.object({
|
|
471
|
+
/** When the label was archived, or `null` while active. */
|
|
472
|
+
archivedAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
473
|
+
/** Label display color. */
|
|
474
|
+
color: z.string(),
|
|
475
|
+
/** When the label was created. */
|
|
476
|
+
createdAt: LINEAR_DATE_TIME_SCHEMA,
|
|
477
|
+
/** Label description. */
|
|
478
|
+
description: z.string().nullable(),
|
|
479
|
+
/** Stable issue label ID. */
|
|
480
|
+
id: z.string(),
|
|
481
|
+
/** Whether this label groups child labels. */
|
|
482
|
+
isGroup: z.boolean(),
|
|
483
|
+
/** Human-readable label name. */
|
|
484
|
+
name: z.string(),
|
|
485
|
+
/** Parent label, when nested. */
|
|
486
|
+
parent: z.object({ id: z.string(), name: z.string() }).nullable(),
|
|
487
|
+
/** Owning team, or `null` for workspace labels. */
|
|
488
|
+
team: LINEAR_TEAM_REFERENCE_SCHEMA.nullable(),
|
|
489
|
+
/** When the label was last updated. */
|
|
490
|
+
updatedAt: LINEAR_DATE_TIME_SCHEMA,
|
|
491
|
+
});
|
|
492
|
+
export const LINEAR_PROJECT_REFERENCE_SCHEMA = z.object({
|
|
493
|
+
/** Stable Linear project ID. */
|
|
494
|
+
id: z.string(),
|
|
495
|
+
/** Project name. */
|
|
496
|
+
name: z.string(),
|
|
497
|
+
/** URL-safe project slug. */
|
|
498
|
+
slugId: z.string(),
|
|
499
|
+
/** Linear project URL. */
|
|
500
|
+
url: z.string(),
|
|
501
|
+
});
|
|
502
|
+
export const LINEAR_ISSUE_REFERENCE_SCHEMA = z.object({
|
|
503
|
+
/** Stable Linear issue ID. */
|
|
504
|
+
id: z.string(),
|
|
505
|
+
/** Human-readable identifier such as `ENG-123`. */
|
|
506
|
+
identifier: z.string(),
|
|
507
|
+
/** Issue title. */
|
|
508
|
+
title: z.string(),
|
|
509
|
+
/** Linear issue URL. */
|
|
510
|
+
url: z.string(),
|
|
511
|
+
});
|
|
512
|
+
export const LINEAR_PROJECT_STATUS_SCHEMA = z.object({
|
|
513
|
+
/** Project status display color. */
|
|
514
|
+
color: z.string(),
|
|
515
|
+
/** Status description. */
|
|
516
|
+
description: z.string().nullable(),
|
|
517
|
+
/** Stable project status ID. */
|
|
518
|
+
id: z.string(),
|
|
519
|
+
/** Human-readable status name. */
|
|
520
|
+
name: z.string(),
|
|
521
|
+
/** Project status category. */
|
|
522
|
+
type: z.string(),
|
|
523
|
+
});
|
|
524
|
+
export const LINEAR_PROJECT_SCHEMA = z.object({
|
|
525
|
+
/** When the project was archived, or `null` while active. */
|
|
526
|
+
archivedAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
527
|
+
/** When the project was canceled, or `null` otherwise. */
|
|
528
|
+
canceledAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
529
|
+
/** Project display color. */
|
|
530
|
+
color: z.string(),
|
|
531
|
+
/** When the project was completed, or `null` otherwise. */
|
|
532
|
+
completedAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
533
|
+
/** Long-form Markdown project content. */
|
|
534
|
+
content: z.string().nullable(),
|
|
535
|
+
/** When the project was created. */
|
|
536
|
+
createdAt: LINEAR_DATE_TIME_SCHEMA,
|
|
537
|
+
/** User who created the project. */
|
|
538
|
+
creator: LINEAR_USER_REFERENCE_SCHEMA.nullable(),
|
|
539
|
+
/** Short project summary. */
|
|
540
|
+
description: z.string(),
|
|
541
|
+
/** Emoji or provider-supported project icon value. */
|
|
542
|
+
icon: z.string().nullable(),
|
|
543
|
+
/** Stable Linear project ID. */
|
|
544
|
+
id: z.string(),
|
|
545
|
+
/** Human-readable project identifier, when assigned. */
|
|
546
|
+
identifier: z.string().nullable(),
|
|
547
|
+
/** Workspace user leading the project. */
|
|
548
|
+
lead: LINEAR_USER_REFERENCE_SCHEMA.nullable(),
|
|
549
|
+
/** Project members included in the response. */
|
|
550
|
+
members: LINEAR_USER_REFERENCE_SCHEMA.array(),
|
|
551
|
+
/** Project name. */
|
|
552
|
+
name: z.string(),
|
|
553
|
+
/** Numeric project priority. */
|
|
554
|
+
priority: z.number().int(),
|
|
555
|
+
/** Human-readable project priority. */
|
|
556
|
+
priorityLabel: z.string(),
|
|
557
|
+
/** Completion ratio from zero to one. */
|
|
558
|
+
progress: z.number(),
|
|
559
|
+
/** Number of attached project resources. */
|
|
560
|
+
resourceCount: z.number().int().nonnegative(),
|
|
561
|
+
/** Total estimated project scope. */
|
|
562
|
+
scope: z.number(),
|
|
563
|
+
/** URL-safe project slug. */
|
|
564
|
+
slugId: z.string(),
|
|
565
|
+
/** Planned project start date. */
|
|
566
|
+
startDate: z.iso.date().nullable(),
|
|
567
|
+
/** When work actually started. */
|
|
568
|
+
startedAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
569
|
+
/** Provider-native project lifecycle state. */
|
|
570
|
+
state: z.string(),
|
|
571
|
+
/** Configured workspace project status. */
|
|
572
|
+
status: LINEAR_PROJECT_STATUS_SCHEMA,
|
|
573
|
+
/** Planned project target date. */
|
|
574
|
+
targetDate: z.iso.date().nullable(),
|
|
575
|
+
/** Teams included in the project response. */
|
|
576
|
+
teams: LINEAR_TEAM_REFERENCE_SCHEMA.array(),
|
|
577
|
+
/** When the project was last updated. */
|
|
578
|
+
updatedAt: LINEAR_DATE_TIME_SCHEMA,
|
|
579
|
+
/** Linear project URL. */
|
|
580
|
+
url: z.string(),
|
|
581
|
+
});
|
|
582
|
+
export const LINEAR_ISSUE_SCHEMA = z.object({
|
|
583
|
+
/** When the issue was archived, or `null` while active. */
|
|
584
|
+
archivedAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
585
|
+
/** User assigned to the issue. */
|
|
586
|
+
assignee: LINEAR_USER_REFERENCE_SCHEMA.nullable(),
|
|
587
|
+
/** Suggested source-control branch name. */
|
|
588
|
+
branchName: z.string(),
|
|
589
|
+
/** When the issue was canceled, or `null` otherwise. */
|
|
590
|
+
canceledAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
591
|
+
/** When the issue was completed, or `null` otherwise. */
|
|
592
|
+
completedAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
593
|
+
/** When the issue was created. */
|
|
594
|
+
createdAt: LINEAR_DATE_TIME_SCHEMA,
|
|
595
|
+
/** User who created the issue. */
|
|
596
|
+
creator: LINEAR_USER_REFERENCE_SCHEMA.nullable(),
|
|
597
|
+
/** Markdown issue description. */
|
|
598
|
+
description: z.string().nullable(),
|
|
599
|
+
/** Issue due date. */
|
|
600
|
+
dueDate: z.iso.date().nullable(),
|
|
601
|
+
/** Issue estimate on the team's configured scale. */
|
|
602
|
+
estimate: z.number().nullable(),
|
|
603
|
+
/** Stable Linear issue ID. */
|
|
604
|
+
id: z.string(),
|
|
605
|
+
/** Human-readable issue identifier such as `ENG-123`. */
|
|
606
|
+
identifier: z.string(),
|
|
607
|
+
/** Labels currently applied to the issue. */
|
|
608
|
+
labels: z
|
|
609
|
+
.object({
|
|
610
|
+
/** Label display color. */
|
|
611
|
+
color: z.string(),
|
|
612
|
+
/** Stable issue label ID. */
|
|
613
|
+
id: z.string(),
|
|
614
|
+
/** Human-readable label name. */
|
|
615
|
+
name: z.string(),
|
|
616
|
+
})
|
|
617
|
+
.array(),
|
|
618
|
+
/** Numeric portion of the issue identifier. */
|
|
619
|
+
number: z.number(),
|
|
620
|
+
/** Parent issue when this is a sub-issue. */
|
|
621
|
+
parent: LINEAR_ISSUE_REFERENCE_SCHEMA.nullable(),
|
|
622
|
+
/** Numeric priority from zero to four. */
|
|
623
|
+
priority: z.number(),
|
|
624
|
+
/** Human-readable issue priority. */
|
|
625
|
+
priorityLabel: z.string(),
|
|
626
|
+
/** Project containing the issue. */
|
|
627
|
+
project: LINEAR_PROJECT_REFERENCE_SCHEMA.nullable(),
|
|
628
|
+
/** When work began, or `null` if not started. */
|
|
629
|
+
startedAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
630
|
+
/** Current workflow state. */
|
|
631
|
+
state: z.object({
|
|
632
|
+
/** Workflow state display color. */
|
|
633
|
+
color: z.string(),
|
|
634
|
+
/** Stable workflow state ID. */
|
|
635
|
+
id: z.string(),
|
|
636
|
+
/** Human-readable workflow state name. */
|
|
637
|
+
name: z.string(),
|
|
638
|
+
/** State category such as `started` or `completed`. */
|
|
639
|
+
type: z.string(),
|
|
640
|
+
}),
|
|
641
|
+
/** Team that owns the issue. */
|
|
642
|
+
team: LINEAR_TEAM_REFERENCE_SCHEMA,
|
|
643
|
+
/** Issue title. */
|
|
644
|
+
title: z.string(),
|
|
645
|
+
/** Whether the issue is in Linear's recently deleted view. */
|
|
646
|
+
trashed: z.boolean().nullable(),
|
|
647
|
+
/** When the issue was last updated. */
|
|
648
|
+
updatedAt: LINEAR_DATE_TIME_SCHEMA,
|
|
649
|
+
/** Linear issue URL. */
|
|
650
|
+
url: z.string(),
|
|
651
|
+
});
|
|
652
|
+
export const LINEAR_COMMENT_SCHEMA = z.object({
|
|
653
|
+
/** When the comment was archived, or `null` while active. */
|
|
654
|
+
archivedAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
655
|
+
/** Markdown comment body. */
|
|
656
|
+
body: z.string(),
|
|
657
|
+
/** When the comment was created. */
|
|
658
|
+
createdAt: LINEAR_DATE_TIME_SCHEMA,
|
|
659
|
+
/** When the body was last edited. */
|
|
660
|
+
editedAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
661
|
+
/** Stable Linear comment ID. */
|
|
662
|
+
id: z.string(),
|
|
663
|
+
/** Parent issue ID when this is an issue comment. */
|
|
664
|
+
issueId: z.string().nullable(),
|
|
665
|
+
/** Parent comment ID when this is a threaded reply. */
|
|
666
|
+
parentId: z.string().nullable(),
|
|
667
|
+
/** When the comment thread was resolved. */
|
|
668
|
+
resolvedAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
669
|
+
/** When the comment was last updated. */
|
|
670
|
+
updatedAt: LINEAR_DATE_TIME_SCHEMA,
|
|
671
|
+
/** Linear comment URL. */
|
|
672
|
+
url: z.string(),
|
|
673
|
+
/** Workspace user who authored the comment. */
|
|
674
|
+
user: LINEAR_USER_REFERENCE_SCHEMA.nullable(),
|
|
675
|
+
});
|
|
676
|
+
export const LINEAR_ATTACHMENT_SCHEMA = z.object({
|
|
677
|
+
/** When the attachment was archived, or `null` while active. */
|
|
678
|
+
archivedAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
679
|
+
/** When the attachment was created. */
|
|
680
|
+
createdAt: LINEAR_DATE_TIME_SCHEMA,
|
|
681
|
+
/** Workspace user who created the attachment. */
|
|
682
|
+
creator: LINEAR_USER_REFERENCE_SCHEMA.nullable(),
|
|
683
|
+
/** Whether Linear groups attachments from this source. */
|
|
684
|
+
groupBySource: z.boolean(),
|
|
685
|
+
/** Stable Linear attachment ID. */
|
|
686
|
+
id: z.string(),
|
|
687
|
+
/** Issue containing the attachment. */
|
|
688
|
+
issue: LINEAR_ISSUE_REFERENCE_SCHEMA,
|
|
689
|
+
/** Integration-defined attachment metadata. */
|
|
690
|
+
metadata: LINEAR_JSON_OBJECT_SCHEMA,
|
|
691
|
+
/** Provider-defined source classification. */
|
|
692
|
+
sourceType: z.string().nullable(),
|
|
693
|
+
/** Secondary attachment status or detail. */
|
|
694
|
+
subtitle: z.string().nullable(),
|
|
695
|
+
/** Attachment title. */
|
|
696
|
+
title: z.string(),
|
|
697
|
+
/** When the attachment was last updated. */
|
|
698
|
+
updatedAt: LINEAR_DATE_TIME_SCHEMA,
|
|
699
|
+
/** Unique external attachment URL. */
|
|
700
|
+
url: z.string(),
|
|
701
|
+
});
|
|
702
|
+
export const LINEAR_ISSUE_RELATION_SCHEMA = z.object({
|
|
703
|
+
/** When the relation was archived, or `null` while active. */
|
|
704
|
+
archivedAt: LINEAR_DATE_TIME_SCHEMA.nullable(),
|
|
705
|
+
/** When the relation was created. */
|
|
706
|
+
createdAt: LINEAR_DATE_TIME_SCHEMA,
|
|
707
|
+
/** Stable Linear relation ID. */
|
|
708
|
+
id: z.string(),
|
|
709
|
+
/** Issue on the source side of the relation. */
|
|
710
|
+
issue: LINEAR_ISSUE_REFERENCE_SCHEMA,
|
|
711
|
+
/** Issue on the target side of the relation. */
|
|
712
|
+
relatedIssue: LINEAR_ISSUE_REFERENCE_SCHEMA,
|
|
713
|
+
/** Relation type such as `blocks`, `duplicate`, or `related`. */
|
|
714
|
+
type: z.string(),
|
|
715
|
+
/** When the relation was last updated. */
|
|
716
|
+
updatedAt: LINEAR_DATE_TIME_SCHEMA,
|
|
717
|
+
});
|
|
718
|
+
export const LINEAR_PROVIDER_PROJECT_SCHEMA = LINEAR_PROJECT_SCHEMA.omit({
|
|
719
|
+
members: true,
|
|
720
|
+
teams: true,
|
|
721
|
+
}).extend({
|
|
722
|
+
members: linearConnectionSchema(LINEAR_USER_REFERENCE_SCHEMA),
|
|
723
|
+
teams: linearConnectionSchema(LINEAR_TEAM_REFERENCE_SCHEMA),
|
|
724
|
+
});
|
|
725
|
+
export const LINEAR_PROVIDER_ISSUE_SCHEMA = LINEAR_ISSUE_SCHEMA.omit({
|
|
726
|
+
labels: true,
|
|
727
|
+
}).extend({
|
|
728
|
+
labels: linearConnectionSchema(z.object({ color: z.string(), id: z.string(), name: z.string() })),
|
|
729
|
+
});
|
|
730
|
+
/**
|
|
731
|
+
* Normalizes Linear's nested project connections into direct arrays.
|
|
732
|
+
*
|
|
733
|
+
* @param project - Provider-native project response.
|
|
734
|
+
*/
|
|
735
|
+
export function toLinearProject(project) {
|
|
736
|
+
return {
|
|
737
|
+
...project,
|
|
738
|
+
members: project.members.nodes,
|
|
739
|
+
teams: project.teams.nodes,
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Normalizes Linear's nested label connection into a direct array.
|
|
744
|
+
*
|
|
745
|
+
* @param issue - Provider-native issue response.
|
|
746
|
+
*/
|
|
747
|
+
export function toLinearIssue(issue) {
|
|
748
|
+
return { ...issue, labels: issue.labels.nodes };
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Creates a schema for one provider-native Linear connection.
|
|
752
|
+
*
|
|
753
|
+
* @param itemSchema - Schema for one connection node.
|
|
754
|
+
*/
|
|
755
|
+
export function linearConnectionSchema(itemSchema) {
|
|
756
|
+
return z.object({
|
|
757
|
+
nodes: itemSchema.array(),
|
|
758
|
+
pageInfo: LINEAR_PAGE_INFO_SCHEMA.optional(),
|
|
759
|
+
});
|
|
760
|
+
}
|