@automate.ax/integration-contracts 0.124.0 → 0.126.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/apify/index.d.ts +1085 -0
- package/dist/apify/index.js +169 -0
- package/dist/apify/schemas.d.ts +100 -0
- package/dist/apify/schemas.js +203 -0
- package/dist/linear/schemas.d.ts +8 -8
- package/dist/notion/schemas.d.ts +33 -33
- package/dist/reddit/api.d.ts +56 -0
- package/dist/reddit/api.js +135 -0
- package/dist/reddit/events.d.ts +439 -0
- package/dist/reddit/events.js +53 -0
- package/dist/reddit/index.d.ts +3 -0
- package/dist/reddit/index.js +3 -0
- package/dist/reddit/schemas.d.ts +816 -0
- package/dist/reddit/schemas.js +398 -0
- package/dist/triggers.d.ts +3 -1
- package/dist/vercel/index.d.ts +16 -16
- package/dist/vercel/schemas.d.ts +24 -24
- package/package.json +14 -2
- package/src/apify/index.ts +210 -0
- package/src/apify/schemas.ts +214 -0
- package/src/reddit/api.ts +183 -0
- package/src/reddit/events.ts +68 -0
- package/src/reddit/index.ts +3 -0
- package/src/reddit/schemas.ts +442 -0
- package/src/triggers.ts +4 -0
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
const REDDIT_ORIGIN = "https://www.reddit.com";
|
|
3
|
+
const REDDIT_EDITED_SCHEMA = z.union([z.literal(false), z.number()]);
|
|
4
|
+
export const REDDIT_THING_ID_SCHEMA = z
|
|
5
|
+
.string()
|
|
6
|
+
.regex(/^t[1345]_[a-z0-9]+$/i, "Expected a Reddit thing fullname.");
|
|
7
|
+
export const REDDIT_POST_ID_SCHEMA = z
|
|
8
|
+
.string()
|
|
9
|
+
.regex(/^t3_[a-z0-9]+$/i, "Expected a Reddit post fullname.");
|
|
10
|
+
export const REDDIT_CONTENT_ID_SCHEMA = z
|
|
11
|
+
.string()
|
|
12
|
+
.regex(/^t[13]_[a-z0-9]+$/i, "Expected a Reddit post or comment fullname.");
|
|
13
|
+
export const REDDIT_INBOX_ID_SCHEMA = z
|
|
14
|
+
.string()
|
|
15
|
+
.regex(/^t[14]_[a-z0-9]+$/i, "Expected a Reddit inbox item fullname.");
|
|
16
|
+
export const REDDIT_SUBREDDIT_NAME_SCHEMA = z
|
|
17
|
+
.string()
|
|
18
|
+
.trim()
|
|
19
|
+
.regex(/^[A-Za-z0-9_]{2,21}$/, "Expected a Reddit subreddit name.");
|
|
20
|
+
export const REDDIT_USERNAME_SCHEMA = z
|
|
21
|
+
.string()
|
|
22
|
+
.trim()
|
|
23
|
+
.regex(/^[A-Za-z0-9_-]{3,20}$/, "Expected a Reddit username.");
|
|
24
|
+
export const REDDIT_FLAIR_SCHEMA = z.object({
|
|
25
|
+
backgroundColor: z.string().nullable(),
|
|
26
|
+
cssClass: z.string().nullable(),
|
|
27
|
+
templateId: z.string().nullable(),
|
|
28
|
+
text: z.string().nullable(),
|
|
29
|
+
textColor: z.enum(["dark", "light"]).nullable(),
|
|
30
|
+
});
|
|
31
|
+
export const REDDIT_POST_SCHEMA = z.object({
|
|
32
|
+
archived: z.boolean(),
|
|
33
|
+
author: z.string().nullable(),
|
|
34
|
+
body: z.string(),
|
|
35
|
+
commentCount: z.number().int().nonnegative(),
|
|
36
|
+
createdAt: z.date(),
|
|
37
|
+
editedAt: z.date().nullable(),
|
|
38
|
+
flair: REDDIT_FLAIR_SCHEMA,
|
|
39
|
+
hidden: z.boolean(),
|
|
40
|
+
id: REDDIT_POST_ID_SCHEMA,
|
|
41
|
+
isLocked: z.boolean(),
|
|
42
|
+
isNsfw: z.boolean(),
|
|
43
|
+
isSelfPost: z.boolean(),
|
|
44
|
+
isSpoiler: z.boolean(),
|
|
45
|
+
isStickied: z.boolean(),
|
|
46
|
+
permalink: z.url(),
|
|
47
|
+
saved: z.boolean(),
|
|
48
|
+
score: z.number().int(),
|
|
49
|
+
shortId: z.string().min(1),
|
|
50
|
+
subreddit: z.string(),
|
|
51
|
+
subredditId: z.string(),
|
|
52
|
+
title: z.string(),
|
|
53
|
+
upvoteRatio: z.number().min(0).max(1),
|
|
54
|
+
url: z.url(),
|
|
55
|
+
});
|
|
56
|
+
export const REDDIT_COMMENT_SCHEMA = z.object({
|
|
57
|
+
author: z.string().nullable(),
|
|
58
|
+
body: z.string(),
|
|
59
|
+
createdAt: z.date(),
|
|
60
|
+
depth: z.number().int().nonnegative(),
|
|
61
|
+
distinguished: z.enum(["admin", "moderator", "special"]).nullable(),
|
|
62
|
+
editedAt: z.date().nullable(),
|
|
63
|
+
id: z.string().regex(/^t1_[a-z0-9]+$/i),
|
|
64
|
+
isPostAuthor: z.boolean(),
|
|
65
|
+
isStickied: z.boolean(),
|
|
66
|
+
parentId: REDDIT_THING_ID_SCHEMA,
|
|
67
|
+
permalink: z.url(),
|
|
68
|
+
postId: REDDIT_POST_ID_SCHEMA,
|
|
69
|
+
saved: z.boolean(),
|
|
70
|
+
score: z.number().int(),
|
|
71
|
+
shortId: z.string().min(1),
|
|
72
|
+
subreddit: z.string(),
|
|
73
|
+
});
|
|
74
|
+
export const REDDIT_MESSAGE_SCHEMA = z.object({
|
|
75
|
+
author: z.string().nullable(),
|
|
76
|
+
body: z.string(),
|
|
77
|
+
context: z.string(),
|
|
78
|
+
createdAt: z.date(),
|
|
79
|
+
destination: z.string(),
|
|
80
|
+
id: REDDIT_INBOX_ID_SCHEMA,
|
|
81
|
+
isNew: z.boolean(),
|
|
82
|
+
parentId: z.string().nullable(),
|
|
83
|
+
permalink: z.url().nullable(),
|
|
84
|
+
shortId: z.string().min(1),
|
|
85
|
+
subject: z.string(),
|
|
86
|
+
subreddit: z.string().nullable(),
|
|
87
|
+
wasComment: z.boolean(),
|
|
88
|
+
});
|
|
89
|
+
export const REDDIT_SUBREDDIT_SCHEMA = z.object({
|
|
90
|
+
activeUserCount: z.number().int().nonnegative().nullable(),
|
|
91
|
+
createdAt: z.date(),
|
|
92
|
+
description: z.string(),
|
|
93
|
+
displayName: z.string(),
|
|
94
|
+
id: z.string().regex(/^t5_[a-z0-9]+$/i),
|
|
95
|
+
isNsfw: z.boolean(),
|
|
96
|
+
name: z.string(),
|
|
97
|
+
publicDescription: z.string(),
|
|
98
|
+
subscribers: z.number().int().nonnegative(),
|
|
99
|
+
title: z.string(),
|
|
100
|
+
url: z.url(),
|
|
101
|
+
userIsSubscriber: z.boolean(),
|
|
102
|
+
});
|
|
103
|
+
export const REDDIT_PROFILE_SCHEMA = z.object({
|
|
104
|
+
commentKarma: z.number().int(),
|
|
105
|
+
createdAt: z.date(),
|
|
106
|
+
hasVerifiedEmail: z.boolean().nullable(),
|
|
107
|
+
id: z.string().min(1),
|
|
108
|
+
isEmployee: z.boolean(),
|
|
109
|
+
isModerator: z.boolean(),
|
|
110
|
+
linkKarma: z.number().int(),
|
|
111
|
+
username: z.string(),
|
|
112
|
+
});
|
|
113
|
+
export const REDDIT_PAGE_INFO_SCHEMA = z.object({
|
|
114
|
+
after: z.string().nullable(),
|
|
115
|
+
before: z.string().nullable(),
|
|
116
|
+
});
|
|
117
|
+
export const REDDIT_POST_PAGE_SCHEMA = z.object({
|
|
118
|
+
pageInfo: REDDIT_PAGE_INFO_SCHEMA,
|
|
119
|
+
posts: REDDIT_POST_SCHEMA.array(),
|
|
120
|
+
});
|
|
121
|
+
export const REDDIT_CONTENT_PAGE_SCHEMA = z.object({
|
|
122
|
+
content: z.union([REDDIT_POST_SCHEMA, REDDIT_COMMENT_SCHEMA]).array(),
|
|
123
|
+
pageInfo: REDDIT_PAGE_INFO_SCHEMA,
|
|
124
|
+
});
|
|
125
|
+
export const REDDIT_MESSAGE_PAGE_SCHEMA = z.object({
|
|
126
|
+
messages: REDDIT_MESSAGE_SCHEMA.array(),
|
|
127
|
+
pageInfo: REDDIT_PAGE_INFO_SCHEMA,
|
|
128
|
+
});
|
|
129
|
+
export const REDDIT_POST_FLAIR_TEMPLATE_SCHEMA = z.object({
|
|
130
|
+
backgroundColor: z.string(),
|
|
131
|
+
cssClass: z.string(),
|
|
132
|
+
id: z.string(),
|
|
133
|
+
isEditable: z.boolean(),
|
|
134
|
+
text: z.string(),
|
|
135
|
+
textColor: z.enum(["dark", "light"]),
|
|
136
|
+
});
|
|
137
|
+
export const REDDIT_PROVIDER_PROFILE_SCHEMA = z.looseObject({
|
|
138
|
+
comment_karma: z.number().int(),
|
|
139
|
+
created_utc: z.number(),
|
|
140
|
+
has_verified_email: z.boolean().nullable(),
|
|
141
|
+
id: z.string().min(1),
|
|
142
|
+
is_employee: z.boolean(),
|
|
143
|
+
is_mod: z.boolean(),
|
|
144
|
+
link_karma: z.number().int(),
|
|
145
|
+
name: z.string(),
|
|
146
|
+
});
|
|
147
|
+
export const REDDIT_PROVIDER_POST_SCHEMA = z.looseObject({
|
|
148
|
+
archived: z.boolean().default(false),
|
|
149
|
+
author: z.string().nullable().catch(null),
|
|
150
|
+
created_utc: z.number(),
|
|
151
|
+
edited: REDDIT_EDITED_SCHEMA.catch(false),
|
|
152
|
+
hidden: z.boolean().default(false),
|
|
153
|
+
id: z.string().min(1),
|
|
154
|
+
is_self: z.boolean().default(false),
|
|
155
|
+
link_flair_background_color: z.string().nullable().catch(null),
|
|
156
|
+
link_flair_css_class: z.string().nullable().catch(null),
|
|
157
|
+
link_flair_template_id: z.string().nullable().catch(null),
|
|
158
|
+
link_flair_text: z.string().nullable().catch(null),
|
|
159
|
+
link_flair_text_color: z.enum(["dark", "light"]).nullable().catch(null),
|
|
160
|
+
locked: z.boolean().default(false),
|
|
161
|
+
name: REDDIT_POST_ID_SCHEMA,
|
|
162
|
+
num_comments: z.number().int().nonnegative().default(0),
|
|
163
|
+
over_18: z.boolean().default(false),
|
|
164
|
+
permalink: z.string(),
|
|
165
|
+
saved: z.boolean().default(false),
|
|
166
|
+
score: z.number().int().default(0),
|
|
167
|
+
selftext: z.string().default(""),
|
|
168
|
+
spoiler: z.boolean().default(false),
|
|
169
|
+
stickied: z.boolean().default(false),
|
|
170
|
+
subreddit: z.string(),
|
|
171
|
+
subreddit_id: z.string(),
|
|
172
|
+
title: z.string(),
|
|
173
|
+
upvote_ratio: z.number().min(0).max(1).default(0),
|
|
174
|
+
url: z.string(),
|
|
175
|
+
});
|
|
176
|
+
export const REDDIT_PROVIDER_COMMENT_SCHEMA = z.looseObject({
|
|
177
|
+
author: z.string().nullable().catch(null),
|
|
178
|
+
body: z.string().default(""),
|
|
179
|
+
created_utc: z.number(),
|
|
180
|
+
depth: z.number().int().nonnegative().default(0),
|
|
181
|
+
distinguished: z
|
|
182
|
+
.enum(["admin", "moderator", "special"])
|
|
183
|
+
.nullable()
|
|
184
|
+
.catch(null),
|
|
185
|
+
edited: REDDIT_EDITED_SCHEMA.catch(false),
|
|
186
|
+
id: z.string().min(1),
|
|
187
|
+
is_submitter: z.boolean().default(false),
|
|
188
|
+
link_id: REDDIT_POST_ID_SCHEMA,
|
|
189
|
+
name: z.string().regex(/^t1_[a-z0-9]+$/i),
|
|
190
|
+
parent_id: REDDIT_THING_ID_SCHEMA,
|
|
191
|
+
permalink: z.string(),
|
|
192
|
+
saved: z.boolean().default(false),
|
|
193
|
+
score: z.number().int().default(0),
|
|
194
|
+
stickied: z.boolean().default(false),
|
|
195
|
+
subreddit: z.string(),
|
|
196
|
+
});
|
|
197
|
+
export const REDDIT_PROVIDER_MESSAGE_SCHEMA = z.looseObject({
|
|
198
|
+
author: z.string().nullable().catch(null),
|
|
199
|
+
body: z.string().default(""),
|
|
200
|
+
context: z.string().default(""),
|
|
201
|
+
created_utc: z.number(),
|
|
202
|
+
dest: z.string().default(""),
|
|
203
|
+
id: z.string().min(1),
|
|
204
|
+
name: REDDIT_INBOX_ID_SCHEMA,
|
|
205
|
+
new: z.boolean().default(false),
|
|
206
|
+
parent_id: z.string().nullable().catch(null),
|
|
207
|
+
permalink: z.string().nullable().catch(null),
|
|
208
|
+
subject: z.string().default(""),
|
|
209
|
+
subreddit: z.string().nullable().catch(null),
|
|
210
|
+
was_comment: z.boolean().default(false),
|
|
211
|
+
});
|
|
212
|
+
export const REDDIT_PROVIDER_SUBREDDIT_SCHEMA = z.looseObject({
|
|
213
|
+
active_user_count: z.number().int().nonnegative().nullable().catch(null),
|
|
214
|
+
created_utc: z.number(),
|
|
215
|
+
description: z.string().default(""),
|
|
216
|
+
display_name: z.string(),
|
|
217
|
+
display_name_prefixed: z.string(),
|
|
218
|
+
name: z.string().regex(/^t5_[a-z0-9]+$/i),
|
|
219
|
+
over18: z.boolean().default(false),
|
|
220
|
+
public_description: z.string().default(""),
|
|
221
|
+
subscribers: z.number().int().nonnegative().default(0),
|
|
222
|
+
title: z.string(),
|
|
223
|
+
url: z.string(),
|
|
224
|
+
user_is_subscriber: z.boolean().nullable().catch(null),
|
|
225
|
+
});
|
|
226
|
+
export const REDDIT_PROVIDER_POST_THING_SCHEMA = z.object({
|
|
227
|
+
data: REDDIT_PROVIDER_POST_SCHEMA,
|
|
228
|
+
kind: z.literal("t3"),
|
|
229
|
+
});
|
|
230
|
+
export const REDDIT_PROVIDER_COMMENT_THING_SCHEMA = z.object({
|
|
231
|
+
data: REDDIT_PROVIDER_COMMENT_SCHEMA,
|
|
232
|
+
kind: z.literal("t1"),
|
|
233
|
+
});
|
|
234
|
+
export const REDDIT_PROVIDER_MESSAGE_THING_SCHEMA = z.object({
|
|
235
|
+
data: REDDIT_PROVIDER_MESSAGE_SCHEMA,
|
|
236
|
+
kind: z.literal("t4"),
|
|
237
|
+
});
|
|
238
|
+
export const REDDIT_PROVIDER_INBOX_THING_SCHEMA = z.union([
|
|
239
|
+
REDDIT_PROVIDER_MESSAGE_THING_SCHEMA,
|
|
240
|
+
z.object({
|
|
241
|
+
data: REDDIT_PROVIDER_MESSAGE_SCHEMA,
|
|
242
|
+
kind: z.literal("t1"),
|
|
243
|
+
}),
|
|
244
|
+
]);
|
|
245
|
+
export const REDDIT_PROVIDER_SUBREDDIT_THING_SCHEMA = z.object({
|
|
246
|
+
data: REDDIT_PROVIDER_SUBREDDIT_SCHEMA,
|
|
247
|
+
kind: z.literal("t5"),
|
|
248
|
+
});
|
|
249
|
+
export const REDDIT_PROVIDER_CONTENT_THING_SCHEMA = z.union([
|
|
250
|
+
REDDIT_PROVIDER_POST_THING_SCHEMA,
|
|
251
|
+
REDDIT_PROVIDER_COMMENT_THING_SCHEMA,
|
|
252
|
+
]);
|
|
253
|
+
/** Builds one provider listing schema with exact child contracts. */
|
|
254
|
+
/** @param childSchema - Schema for one listing child. */
|
|
255
|
+
export function redditProviderListingSchema(childSchema) {
|
|
256
|
+
return z.object({
|
|
257
|
+
data: z.object({
|
|
258
|
+
after: z.string().nullable(),
|
|
259
|
+
before: z.string().nullable(),
|
|
260
|
+
children: childSchema.array(),
|
|
261
|
+
}),
|
|
262
|
+
kind: z.literal("Listing"),
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
export const REDDIT_PROVIDER_POST_LISTING_SCHEMA = redditProviderListingSchema(REDDIT_PROVIDER_POST_THING_SCHEMA);
|
|
266
|
+
export const REDDIT_PROVIDER_CONTENT_LISTING_SCHEMA = redditProviderListingSchema(REDDIT_PROVIDER_CONTENT_THING_SCHEMA);
|
|
267
|
+
export const REDDIT_PROVIDER_MESSAGE_LISTING_SCHEMA = redditProviderListingSchema(REDDIT_PROVIDER_INBOX_THING_SCHEMA);
|
|
268
|
+
export const REDDIT_PROVIDER_FLAIR_TEMPLATE_SCHEMA = z.looseObject({
|
|
269
|
+
background_color: z.string().default(""),
|
|
270
|
+
css_class: z.string().default(""),
|
|
271
|
+
flair_template_id: z.string(),
|
|
272
|
+
flair_text_editable: z.boolean().default(false),
|
|
273
|
+
flair_text: z.string().default(""),
|
|
274
|
+
text_color: z.enum(["dark", "light"]).default("dark"),
|
|
275
|
+
});
|
|
276
|
+
/** Converts a Reddit provider post into the stable public post shape. */
|
|
277
|
+
/** @param post - Parsed provider post. */
|
|
278
|
+
export function toRedditPost(post) {
|
|
279
|
+
return REDDIT_POST_SCHEMA.parse({
|
|
280
|
+
archived: post.archived,
|
|
281
|
+
author: post.author,
|
|
282
|
+
body: post.selftext,
|
|
283
|
+
commentCount: post.num_comments,
|
|
284
|
+
createdAt: new Date(post.created_utc * 1_000),
|
|
285
|
+
editedAt: post.edited === false ? null : new Date(post.edited * 1_000),
|
|
286
|
+
flair: {
|
|
287
|
+
backgroundColor: post.link_flair_background_color,
|
|
288
|
+
cssClass: post.link_flair_css_class,
|
|
289
|
+
templateId: post.link_flair_template_id,
|
|
290
|
+
text: post.link_flair_text,
|
|
291
|
+
textColor: post.link_flair_text_color,
|
|
292
|
+
},
|
|
293
|
+
hidden: post.hidden,
|
|
294
|
+
id: post.name,
|
|
295
|
+
isLocked: post.locked,
|
|
296
|
+
isNsfw: post.over_18,
|
|
297
|
+
isSelfPost: post.is_self,
|
|
298
|
+
isSpoiler: post.spoiler,
|
|
299
|
+
isStickied: post.stickied,
|
|
300
|
+
permalink: new URL(post.permalink, REDDIT_ORIGIN).toString(),
|
|
301
|
+
saved: post.saved,
|
|
302
|
+
score: post.score,
|
|
303
|
+
shortId: post.id,
|
|
304
|
+
subreddit: post.subreddit,
|
|
305
|
+
subredditId: post.subreddit_id,
|
|
306
|
+
title: post.title,
|
|
307
|
+
upvoteRatio: post.upvote_ratio,
|
|
308
|
+
url: new URL(post.url, REDDIT_ORIGIN).toString(),
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
/** Converts a Reddit provider comment into the stable public comment shape. */
|
|
312
|
+
/** @param comment - Parsed provider comment. */
|
|
313
|
+
export function toRedditComment(comment) {
|
|
314
|
+
return REDDIT_COMMENT_SCHEMA.parse({
|
|
315
|
+
author: comment.author,
|
|
316
|
+
body: comment.body,
|
|
317
|
+
createdAt: new Date(comment.created_utc * 1_000),
|
|
318
|
+
depth: comment.depth,
|
|
319
|
+
distinguished: comment.distinguished,
|
|
320
|
+
editedAt: comment.edited === false ? null : new Date(comment.edited * 1_000),
|
|
321
|
+
id: comment.name,
|
|
322
|
+
isPostAuthor: comment.is_submitter,
|
|
323
|
+
isStickied: comment.stickied,
|
|
324
|
+
parentId: comment.parent_id,
|
|
325
|
+
permalink: new URL(comment.permalink, REDDIT_ORIGIN).toString(),
|
|
326
|
+
postId: comment.link_id,
|
|
327
|
+
saved: comment.saved,
|
|
328
|
+
score: comment.score,
|
|
329
|
+
shortId: comment.id,
|
|
330
|
+
subreddit: comment.subreddit,
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
/** Converts a Reddit inbox record into the stable public message shape. */
|
|
334
|
+
/** @param message - Parsed provider inbox record. */
|
|
335
|
+
export function toRedditMessage(message) {
|
|
336
|
+
return REDDIT_MESSAGE_SCHEMA.parse({
|
|
337
|
+
author: message.author,
|
|
338
|
+
body: message.body,
|
|
339
|
+
context: message.context,
|
|
340
|
+
createdAt: new Date(message.created_utc * 1_000),
|
|
341
|
+
destination: message.dest,
|
|
342
|
+
id: message.name,
|
|
343
|
+
isNew: message.new,
|
|
344
|
+
parentId: message.parent_id,
|
|
345
|
+
permalink: message.permalink
|
|
346
|
+
? new URL(message.permalink, REDDIT_ORIGIN).toString()
|
|
347
|
+
: null,
|
|
348
|
+
shortId: message.id,
|
|
349
|
+
subject: message.subject,
|
|
350
|
+
subreddit: message.subreddit,
|
|
351
|
+
wasComment: message.was_comment,
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
/** Converts a Reddit subreddit thing into the stable public shape. */
|
|
355
|
+
/** @param subreddit - Parsed provider subreddit. */
|
|
356
|
+
export function toRedditSubreddit(subreddit) {
|
|
357
|
+
return REDDIT_SUBREDDIT_SCHEMA.parse({
|
|
358
|
+
activeUserCount: subreddit.active_user_count,
|
|
359
|
+
createdAt: new Date(subreddit.created_utc * 1_000),
|
|
360
|
+
description: subreddit.description,
|
|
361
|
+
displayName: subreddit.display_name,
|
|
362
|
+
id: subreddit.name,
|
|
363
|
+
isNsfw: subreddit.over18,
|
|
364
|
+
name: subreddit.display_name_prefixed,
|
|
365
|
+
publicDescription: subreddit.public_description,
|
|
366
|
+
subscribers: subreddit.subscribers,
|
|
367
|
+
title: subreddit.title,
|
|
368
|
+
url: new URL(subreddit.url, REDDIT_ORIGIN).toString(),
|
|
369
|
+
userIsSubscriber: subreddit.user_is_subscriber ?? false,
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
/** Converts a Reddit identity response into the stable public profile shape. */
|
|
373
|
+
/** @param profile - Parsed provider identity. */
|
|
374
|
+
export function toRedditProfile(profile) {
|
|
375
|
+
return REDDIT_PROFILE_SCHEMA.parse({
|
|
376
|
+
commentKarma: profile.comment_karma,
|
|
377
|
+
createdAt: new Date(profile.created_utc * 1_000),
|
|
378
|
+
hasVerifiedEmail: profile.has_verified_email,
|
|
379
|
+
id: profile.id,
|
|
380
|
+
isEmployee: profile.is_employee,
|
|
381
|
+
isModerator: profile.is_mod,
|
|
382
|
+
linkKarma: profile.link_karma,
|
|
383
|
+
username: profile.name,
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
/** Converts provider listing cursors into stable public pagination metadata. */
|
|
387
|
+
/**
|
|
388
|
+
* @param listing - Parsed provider listing.
|
|
389
|
+
* @param listing.data - Provider listing data.
|
|
390
|
+
* @param listing.data.after - Forward cursor.
|
|
391
|
+
* @param listing.data.before - Backward cursor.
|
|
392
|
+
*/
|
|
393
|
+
export function toRedditPageInfo(listing) {
|
|
394
|
+
return REDDIT_PAGE_INFO_SCHEMA.parse({
|
|
395
|
+
after: listing.data.after,
|
|
396
|
+
before: listing.data.before,
|
|
397
|
+
});
|
|
398
|
+
}
|
package/dist/triggers.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { airtableTriggerContracts } from "./airtable/index.js";
|
|
2
|
+
import type { apifyTriggerContracts } from "./apify/index.js";
|
|
2
3
|
import type { automateTriggerContracts } from "./automate/index.js";
|
|
3
4
|
import type { asanaTriggerContracts } from "./asana/index.js";
|
|
4
5
|
import type { brevoTriggerContracts } from "./brevo/index.js";
|
|
@@ -17,6 +18,7 @@ import type { linearTriggerContracts } from "./linear/index.js";
|
|
|
17
18
|
import type { millionVerifierTriggerContracts } from "./millionverifier/index.js";
|
|
18
19
|
import type { notionTriggerContracts } from "./notion/index.js";
|
|
19
20
|
import type { outlookTriggerContracts } from "./outlook/index.js";
|
|
21
|
+
import type { redditTriggerContracts } from "./reddit/index.js";
|
|
20
22
|
import type { resendTriggerContracts } from "./resend/index.js";
|
|
21
23
|
import type { slackTriggerContracts } from "./slack/index.js";
|
|
22
24
|
import type { stripeTriggerContracts } from "./stripe/index.js";
|
|
@@ -26,7 +28,7 @@ import type { vercelTriggerContracts } from "./vercel/index.js";
|
|
|
26
28
|
import type { webflowTriggerContracts } from "./webflow/index.js";
|
|
27
29
|
import type { whatsappTriggerContracts } from "./whatsapp/index.js";
|
|
28
30
|
import type { z } from "zod";
|
|
29
|
-
export type TriggerContractMap = typeof airtableTriggerContracts & typeof automateTriggerContracts & typeof asanaTriggerContracts & typeof brevoTriggerContracts & typeof convexTriggerContracts & typeof closeTriggerContracts & typeof cloudflareTriggerContracts & typeof githubTriggerContracts & typeof gmailTriggerContracts & typeof googleCalendarTriggerContracts & typeof googleDriveTriggerContracts & typeof googleFormsTriggerContracts & typeof googleMeetTriggerContracts & typeof googleSheetsTriggerContracts & typeof hubspotTriggerContracts & typeof linearTriggerContracts & typeof millionVerifierTriggerContracts & typeof notionTriggerContracts & typeof outlookTriggerContracts & typeof resendTriggerContracts & typeof slackTriggerContracts & typeof stripeTriggerContracts & typeof teamsTriggerContracts & typeof trelloTriggerContracts & typeof vercelTriggerContracts & typeof webflowTriggerContracts & typeof whatsappTriggerContracts;
|
|
31
|
+
export type TriggerContractMap = typeof airtableTriggerContracts & typeof apifyTriggerContracts & typeof automateTriggerContracts & typeof asanaTriggerContracts & typeof brevoTriggerContracts & typeof convexTriggerContracts & typeof closeTriggerContracts & typeof cloudflareTriggerContracts & typeof githubTriggerContracts & typeof gmailTriggerContracts & typeof googleCalendarTriggerContracts & typeof googleDriveTriggerContracts & typeof googleFormsTriggerContracts & typeof googleMeetTriggerContracts & typeof googleSheetsTriggerContracts & typeof hubspotTriggerContracts & typeof linearTriggerContracts & typeof millionVerifierTriggerContracts & typeof notionTriggerContracts & typeof outlookTriggerContracts & typeof redditTriggerContracts & typeof resendTriggerContracts & typeof slackTriggerContracts & typeof stripeTriggerContracts & typeof teamsTriggerContracts & typeof trelloTriggerContracts & typeof vercelTriggerContracts & typeof webflowTriggerContracts & typeof whatsappTriggerContracts;
|
|
30
32
|
export type IntegrationTriggerType = keyof TriggerContractMap;
|
|
31
33
|
/** Canonical authoring configuration for one integration trigger type. */
|
|
32
34
|
export type TriggerConfig<TType extends IntegrationTriggerType> = z.input<TriggerContractMap[TType]["configSchema"]> extends Record<string, never> ? object : z.input<TriggerContractMap[TType]["configSchema"]>;
|
package/dist/vercel/index.d.ts
CHANGED
|
@@ -1898,9 +1898,9 @@ export declare const vercelTriggerContracts: {
|
|
|
1898
1898
|
ownerId: z.ZodString;
|
|
1899
1899
|
projectId: z.ZodString;
|
|
1900
1900
|
state: z.ZodEnum<{
|
|
1901
|
+
ABORTED: "ABORTED";
|
|
1901
1902
|
ACTIVE: "ACTIVE";
|
|
1902
1903
|
COMPLETE: "COMPLETE";
|
|
1903
|
-
ABORTED: "ABORTED";
|
|
1904
1904
|
}>;
|
|
1905
1905
|
writtenBy: z.ZodString;
|
|
1906
1906
|
}, z.core.$catchall<z.ZodJSONSchema>>>>;
|
|
@@ -1925,9 +1925,9 @@ export declare const vercelTriggerContracts: {
|
|
|
1925
1925
|
ownerId: z.ZodString;
|
|
1926
1926
|
projectId: z.ZodString;
|
|
1927
1927
|
state: z.ZodEnum<{
|
|
1928
|
+
ABORTED: "ABORTED";
|
|
1928
1929
|
ACTIVE: "ACTIVE";
|
|
1929
1930
|
COMPLETE: "COMPLETE";
|
|
1930
|
-
ABORTED: "ABORTED";
|
|
1931
1931
|
}>;
|
|
1932
1932
|
writtenBy: z.ZodString;
|
|
1933
1933
|
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
@@ -1961,9 +1961,9 @@ export declare const vercelTriggerContracts: {
|
|
|
1961
1961
|
ownerId: z.ZodString;
|
|
1962
1962
|
projectId: z.ZodString;
|
|
1963
1963
|
state: z.ZodEnum<{
|
|
1964
|
+
ABORTED: "ABORTED";
|
|
1964
1965
|
ACTIVE: "ACTIVE";
|
|
1965
1966
|
COMPLETE: "COMPLETE";
|
|
1966
|
-
ABORTED: "ABORTED";
|
|
1967
1967
|
}>;
|
|
1968
1968
|
writtenBy: z.ZodString;
|
|
1969
1969
|
}, z.core.$catchall<z.ZodJSONSchema>>>>;
|
|
@@ -1988,9 +1988,9 @@ export declare const vercelTriggerContracts: {
|
|
|
1988
1988
|
ownerId: z.ZodString;
|
|
1989
1989
|
projectId: z.ZodString;
|
|
1990
1990
|
state: z.ZodEnum<{
|
|
1991
|
+
ABORTED: "ABORTED";
|
|
1991
1992
|
ACTIVE: "ACTIVE";
|
|
1992
1993
|
COMPLETE: "COMPLETE";
|
|
1993
|
-
ABORTED: "ABORTED";
|
|
1994
1994
|
}>;
|
|
1995
1995
|
writtenBy: z.ZodString;
|
|
1996
1996
|
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
@@ -2024,9 +2024,9 @@ export declare const vercelTriggerContracts: {
|
|
|
2024
2024
|
ownerId: z.ZodString;
|
|
2025
2025
|
projectId: z.ZodString;
|
|
2026
2026
|
state: z.ZodEnum<{
|
|
2027
|
+
ABORTED: "ABORTED";
|
|
2027
2028
|
ACTIVE: "ACTIVE";
|
|
2028
2029
|
COMPLETE: "COMPLETE";
|
|
2029
|
-
ABORTED: "ABORTED";
|
|
2030
2030
|
}>;
|
|
2031
2031
|
writtenBy: z.ZodString;
|
|
2032
2032
|
}, z.core.$catchall<z.ZodJSONSchema>>>>;
|
|
@@ -2051,9 +2051,9 @@ export declare const vercelTriggerContracts: {
|
|
|
2051
2051
|
ownerId: z.ZodString;
|
|
2052
2052
|
projectId: z.ZodString;
|
|
2053
2053
|
state: z.ZodEnum<{
|
|
2054
|
+
ABORTED: "ABORTED";
|
|
2054
2055
|
ACTIVE: "ACTIVE";
|
|
2055
2056
|
COMPLETE: "COMPLETE";
|
|
2056
|
-
ABORTED: "ABORTED";
|
|
2057
2057
|
}>;
|
|
2058
2058
|
writtenBy: z.ZodString;
|
|
2059
2059
|
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
@@ -2087,9 +2087,9 @@ export declare const vercelTriggerContracts: {
|
|
|
2087
2087
|
ownerId: z.ZodString;
|
|
2088
2088
|
projectId: z.ZodString;
|
|
2089
2089
|
state: z.ZodEnum<{
|
|
2090
|
+
ABORTED: "ABORTED";
|
|
2090
2091
|
ACTIVE: "ACTIVE";
|
|
2091
2092
|
COMPLETE: "COMPLETE";
|
|
2092
|
-
ABORTED: "ABORTED";
|
|
2093
2093
|
}>;
|
|
2094
2094
|
writtenBy: z.ZodString;
|
|
2095
2095
|
}, z.core.$catchall<z.ZodJSONSchema>>>>;
|
|
@@ -2114,9 +2114,9 @@ export declare const vercelTriggerContracts: {
|
|
|
2114
2114
|
ownerId: z.ZodString;
|
|
2115
2115
|
projectId: z.ZodString;
|
|
2116
2116
|
state: z.ZodEnum<{
|
|
2117
|
+
ABORTED: "ABORTED";
|
|
2117
2118
|
ACTIVE: "ACTIVE";
|
|
2118
2119
|
COMPLETE: "COMPLETE";
|
|
2119
|
-
ABORTED: "ABORTED";
|
|
2120
2120
|
}>;
|
|
2121
2121
|
writtenBy: z.ZodString;
|
|
2122
2122
|
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
@@ -2154,9 +2154,9 @@ export declare const vercelTriggerContracts: {
|
|
|
2154
2154
|
ownerId: z.ZodString;
|
|
2155
2155
|
projectId: z.ZodString;
|
|
2156
2156
|
state: z.ZodEnum<{
|
|
2157
|
+
ABORTED: "ABORTED";
|
|
2157
2158
|
ACTIVE: "ACTIVE";
|
|
2158
2159
|
COMPLETE: "COMPLETE";
|
|
2159
|
-
ABORTED: "ABORTED";
|
|
2160
2160
|
}>;
|
|
2161
2161
|
writtenBy: z.ZodString;
|
|
2162
2162
|
}, z.core.$catchall<z.ZodJSONSchema>>>>;
|
|
@@ -2181,9 +2181,9 @@ export declare const vercelTriggerContracts: {
|
|
|
2181
2181
|
ownerId: z.ZodString;
|
|
2182
2182
|
projectId: z.ZodString;
|
|
2183
2183
|
state: z.ZodEnum<{
|
|
2184
|
+
ABORTED: "ABORTED";
|
|
2184
2185
|
ACTIVE: "ACTIVE";
|
|
2185
2186
|
COMPLETE: "COMPLETE";
|
|
2186
|
-
ABORTED: "ABORTED";
|
|
2187
2187
|
}>;
|
|
2188
2188
|
writtenBy: z.ZodString;
|
|
2189
2189
|
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
@@ -2221,9 +2221,9 @@ export declare const vercelTriggerContracts: {
|
|
|
2221
2221
|
ownerId: z.ZodString;
|
|
2222
2222
|
projectId: z.ZodString;
|
|
2223
2223
|
state: z.ZodEnum<{
|
|
2224
|
+
ABORTED: "ABORTED";
|
|
2224
2225
|
ACTIVE: "ACTIVE";
|
|
2225
2226
|
COMPLETE: "COMPLETE";
|
|
2226
|
-
ABORTED: "ABORTED";
|
|
2227
2227
|
}>;
|
|
2228
2228
|
writtenBy: z.ZodString;
|
|
2229
2229
|
}, z.core.$catchall<z.ZodJSONSchema>>>>;
|
|
@@ -2248,9 +2248,9 @@ export declare const vercelTriggerContracts: {
|
|
|
2248
2248
|
ownerId: z.ZodString;
|
|
2249
2249
|
projectId: z.ZodString;
|
|
2250
2250
|
state: z.ZodEnum<{
|
|
2251
|
+
ABORTED: "ABORTED";
|
|
2251
2252
|
ACTIVE: "ACTIVE";
|
|
2252
2253
|
COMPLETE: "COMPLETE";
|
|
2253
|
-
ABORTED: "ABORTED";
|
|
2254
2254
|
}>;
|
|
2255
2255
|
writtenBy: z.ZodString;
|
|
2256
2256
|
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
@@ -2288,9 +2288,9 @@ export declare const vercelTriggerContracts: {
|
|
|
2288
2288
|
ownerId: z.ZodString;
|
|
2289
2289
|
projectId: z.ZodString;
|
|
2290
2290
|
state: z.ZodEnum<{
|
|
2291
|
+
ABORTED: "ABORTED";
|
|
2291
2292
|
ACTIVE: "ACTIVE";
|
|
2292
2293
|
COMPLETE: "COMPLETE";
|
|
2293
|
-
ABORTED: "ABORTED";
|
|
2294
2294
|
}>;
|
|
2295
2295
|
writtenBy: z.ZodString;
|
|
2296
2296
|
}, z.core.$catchall<z.ZodJSONSchema>>>>;
|
|
@@ -2315,9 +2315,9 @@ export declare const vercelTriggerContracts: {
|
|
|
2315
2315
|
ownerId: z.ZodString;
|
|
2316
2316
|
projectId: z.ZodString;
|
|
2317
2317
|
state: z.ZodEnum<{
|
|
2318
|
+
ABORTED: "ABORTED";
|
|
2318
2319
|
ACTIVE: "ACTIVE";
|
|
2319
2320
|
COMPLETE: "COMPLETE";
|
|
2320
|
-
ABORTED: "ABORTED";
|
|
2321
2321
|
}>;
|
|
2322
2322
|
writtenBy: z.ZodString;
|
|
2323
2323
|
}, z.core.$catchall<z.ZodJSONSchema>>;
|
|
@@ -2355,9 +2355,9 @@ export declare const vercelTriggerContracts: {
|
|
|
2355
2355
|
ownerId: z.ZodString;
|
|
2356
2356
|
projectId: z.ZodString;
|
|
2357
2357
|
state: z.ZodEnum<{
|
|
2358
|
+
ABORTED: "ABORTED";
|
|
2358
2359
|
ACTIVE: "ACTIVE";
|
|
2359
2360
|
COMPLETE: "COMPLETE";
|
|
2360
|
-
ABORTED: "ABORTED";
|
|
2361
2361
|
}>;
|
|
2362
2362
|
writtenBy: z.ZodString;
|
|
2363
2363
|
}, z.core.$catchall<z.ZodJSONSchema>>>>;
|
|
@@ -2382,9 +2382,9 @@ export declare const vercelTriggerContracts: {
|
|
|
2382
2382
|
ownerId: z.ZodString;
|
|
2383
2383
|
projectId: z.ZodString;
|
|
2384
2384
|
state: z.ZodEnum<{
|
|
2385
|
+
ABORTED: "ABORTED";
|
|
2385
2386
|
ACTIVE: "ACTIVE";
|
|
2386
2387
|
COMPLETE: "COMPLETE";
|
|
2387
|
-
ABORTED: "ABORTED";
|
|
2388
2388
|
}>;
|
|
2389
2389
|
writtenBy: z.ZodString;
|
|
2390
2390
|
}, z.core.$catchall<z.ZodJSONSchema>>;
|