@automate.ax/integration-contracts 0.125.0 → 0.127.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/axiom/api.d.ts +60 -0
- package/dist/axiom/api.js +192 -0
- package/dist/axiom/events.d.ts +104 -0
- package/dist/axiom/events.js +25 -0
- package/dist/axiom/index.d.ts +3 -0
- package/dist/axiom/index.js +3 -0
- package/dist/axiom/schemas.d.ts +1520 -0
- package/dist/axiom/schemas.js +580 -0
- package/dist/brevo/index.d.ts +2 -2
- package/dist/brevo/schemas.d.ts +3 -3
- package/dist/close/events.d.ts +9 -9
- package/dist/close/schemas.d.ts +3 -3
- package/dist/cloudflare/schemas.d.ts +4 -4
- package/dist/convex/index.d.ts +8 -8
- package/dist/convex/schemas.d.ts +4 -4
- package/dist/gmail/schemas.d.ts +3 -3
- package/dist/google-calendar/schemas.d.ts +2 -2
- package/dist/google-drive/index.d.ts +3 -3
- package/dist/google-forms/event-schemas.d.ts +2 -2
- package/dist/google-forms/google-forms.d.ts +4 -4
- package/dist/google-forms/index.d.ts +2 -2
- package/dist/google-forms/schemas.d.ts +7 -7
- package/dist/hubspot/events.d.ts +3 -3
- package/dist/linear/schemas.d.ts +12 -12
- package/dist/notion/schemas.d.ts +6 -6
- package/dist/outlook/index.d.ts +9 -9
- package/dist/outlook/schemas.d.ts +6 -6
- 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/trello/schemas.d.ts +2 -2
- package/dist/triggers.d.ts +3 -1
- package/dist/whatsapp/index.d.ts +4 -4
- package/dist/whatsapp/schemas.d.ts +8 -8
- package/package.json +14 -2
- package/src/axiom/api.ts +252 -0
- package/src/axiom/events.ts +31 -0
- package/src/axiom/index.ts +3 -0
- package/src/axiom/schemas.ts +614 -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/trello/schemas.d.ts
CHANGED
|
@@ -155,9 +155,9 @@ export declare const TRELLO_CUSTOM_FIELD_SCHEMA: z.ZodObject<{
|
|
|
155
155
|
type: z.ZodEnum<{
|
|
156
156
|
number: "number";
|
|
157
157
|
date: "date";
|
|
158
|
+
list: "list";
|
|
158
159
|
text: "text";
|
|
159
160
|
checkbox: "checkbox";
|
|
160
|
-
list: "list";
|
|
161
161
|
}>;
|
|
162
162
|
}, z.core.$strip>;
|
|
163
163
|
export declare const TRELLO_CUSTOM_FIELD_VALUE_SCHEMA: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -362,9 +362,9 @@ export declare const TRELLO_PROVIDER_CUSTOM_FIELD_SCHEMA: z.ZodObject<{
|
|
|
362
362
|
type: z.ZodEnum<{
|
|
363
363
|
number: "number";
|
|
364
364
|
date: "date";
|
|
365
|
+
list: "list";
|
|
365
366
|
text: "text";
|
|
366
367
|
checkbox: "checkbox";
|
|
367
|
-
list: "list";
|
|
368
368
|
}>;
|
|
369
369
|
}, z.core.$loose>;
|
|
370
370
|
export declare const TRELLO_PROVIDER_CUSTOM_FIELD_ITEM_SCHEMA: z.ZodObject<{
|
package/dist/triggers.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { airtableTriggerContracts } from "./airtable/index.js";
|
|
2
2
|
import type { apifyTriggerContracts } from "./apify/index.js";
|
|
3
|
+
import type { axiomTriggerContracts } from "./axiom/index.js";
|
|
3
4
|
import type { automateTriggerContracts } from "./automate/index.js";
|
|
4
5
|
import type { asanaTriggerContracts } from "./asana/index.js";
|
|
5
6
|
import type { brevoTriggerContracts } from "./brevo/index.js";
|
|
@@ -18,6 +19,7 @@ import type { linearTriggerContracts } from "./linear/index.js";
|
|
|
18
19
|
import type { millionVerifierTriggerContracts } from "./millionverifier/index.js";
|
|
19
20
|
import type { notionTriggerContracts } from "./notion/index.js";
|
|
20
21
|
import type { outlookTriggerContracts } from "./outlook/index.js";
|
|
22
|
+
import type { redditTriggerContracts } from "./reddit/index.js";
|
|
21
23
|
import type { resendTriggerContracts } from "./resend/index.js";
|
|
22
24
|
import type { slackTriggerContracts } from "./slack/index.js";
|
|
23
25
|
import type { stripeTriggerContracts } from "./stripe/index.js";
|
|
@@ -27,7 +29,7 @@ import type { vercelTriggerContracts } from "./vercel/index.js";
|
|
|
27
29
|
import type { webflowTriggerContracts } from "./webflow/index.js";
|
|
28
30
|
import type { whatsappTriggerContracts } from "./whatsapp/index.js";
|
|
29
31
|
import type { z } from "zod";
|
|
30
|
-
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 resendTriggerContracts & typeof slackTriggerContracts & typeof stripeTriggerContracts & typeof teamsTriggerContracts & typeof trelloTriggerContracts & typeof vercelTriggerContracts & typeof webflowTriggerContracts & typeof whatsappTriggerContracts;
|
|
32
|
+
export type TriggerContractMap = typeof airtableTriggerContracts & typeof apifyTriggerContracts & typeof axiomTriggerContracts & 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;
|
|
31
33
|
export type IntegrationTriggerType = keyof TriggerContractMap;
|
|
32
34
|
/** Canonical authoring configuration for one integration trigger type. */
|
|
33
35
|
export type TriggerConfig<TType extends IntegrationTriggerType> = z.input<TriggerContractMap[TType]["configSchema"]> extends Record<string, never> ? object : z.input<TriggerContractMap[TType]["configSchema"]>;
|
package/dist/whatsapp/index.d.ts
CHANGED
|
@@ -323,15 +323,15 @@ export declare const whatsappTriggerContracts: {
|
|
|
323
323
|
timestamp: z.ZodString;
|
|
324
324
|
type: z.ZodEnum<{
|
|
325
325
|
unknown: "unknown";
|
|
326
|
-
text: "text";
|
|
327
326
|
audio: "audio";
|
|
328
327
|
document: "document";
|
|
329
328
|
image: "image";
|
|
330
329
|
video: "video";
|
|
330
|
+
order: "order";
|
|
331
|
+
text: "text";
|
|
331
332
|
location: "location";
|
|
332
333
|
system: "system";
|
|
333
334
|
contacts: "contacts";
|
|
334
|
-
order: "order";
|
|
335
335
|
reaction: "reaction";
|
|
336
336
|
button: "button";
|
|
337
337
|
interactive: "interactive";
|
|
@@ -418,15 +418,15 @@ export declare const whatsappTriggerContracts: {
|
|
|
418
418
|
timestamp: z.ZodString;
|
|
419
419
|
type: z.ZodEnum<{
|
|
420
420
|
unknown: "unknown";
|
|
421
|
-
text: "text";
|
|
422
421
|
audio: "audio";
|
|
423
422
|
document: "document";
|
|
424
423
|
image: "image";
|
|
425
424
|
video: "video";
|
|
425
|
+
order: "order";
|
|
426
|
+
text: "text";
|
|
426
427
|
location: "location";
|
|
427
428
|
system: "system";
|
|
428
429
|
contacts: "contacts";
|
|
429
|
-
order: "order";
|
|
430
430
|
reaction: "reaction";
|
|
431
431
|
button: "button";
|
|
432
432
|
interactive: "interactive";
|
|
@@ -89,15 +89,15 @@ export declare const WHATSAPP_WEBHOOK_SCHEMA: z.ZodObject<{
|
|
|
89
89
|
timestamp: z.ZodString;
|
|
90
90
|
type: z.ZodEnum<{
|
|
91
91
|
unknown: "unknown";
|
|
92
|
-
text: "text";
|
|
93
92
|
audio: "audio";
|
|
94
93
|
document: "document";
|
|
95
94
|
image: "image";
|
|
96
95
|
video: "video";
|
|
96
|
+
order: "order";
|
|
97
|
+
text: "text";
|
|
97
98
|
location: "location";
|
|
98
99
|
system: "system";
|
|
99
100
|
contacts: "contacts";
|
|
100
|
-
order: "order";
|
|
101
101
|
reaction: "reaction";
|
|
102
102
|
button: "button";
|
|
103
103
|
interactive: "interactive";
|
|
@@ -182,15 +182,15 @@ export declare const WHATSAPP_MESSAGE_RECEIVED_EVENT_SCHEMA: z.ZodObject<{
|
|
|
182
182
|
timestamp: z.ZodString;
|
|
183
183
|
type: z.ZodEnum<{
|
|
184
184
|
unknown: "unknown";
|
|
185
|
-
text: "text";
|
|
186
185
|
audio: "audio";
|
|
187
186
|
document: "document";
|
|
188
187
|
image: "image";
|
|
189
188
|
video: "video";
|
|
189
|
+
order: "order";
|
|
190
|
+
text: "text";
|
|
190
191
|
location: "location";
|
|
191
192
|
system: "system";
|
|
192
193
|
contacts: "contacts";
|
|
193
|
-
order: "order";
|
|
194
194
|
reaction: "reaction";
|
|
195
195
|
button: "button";
|
|
196
196
|
interactive: "interactive";
|
|
@@ -277,15 +277,15 @@ export declare const WHATSAPP_MESSAGE_RECEIVED_EVENT_SCHEMA: z.ZodObject<{
|
|
|
277
277
|
timestamp: z.ZodString;
|
|
278
278
|
type: z.ZodEnum<{
|
|
279
279
|
unknown: "unknown";
|
|
280
|
-
text: "text";
|
|
281
280
|
audio: "audio";
|
|
282
281
|
document: "document";
|
|
283
282
|
image: "image";
|
|
284
283
|
video: "video";
|
|
284
|
+
order: "order";
|
|
285
|
+
text: "text";
|
|
285
286
|
location: "location";
|
|
286
287
|
system: "system";
|
|
287
288
|
contacts: "contacts";
|
|
288
|
-
order: "order";
|
|
289
289
|
reaction: "reaction";
|
|
290
290
|
button: "button";
|
|
291
291
|
interactive: "interactive";
|
|
@@ -768,7 +768,7 @@ export declare function normalizeWhatsAppWebhook(input: unknown): {
|
|
|
768
768
|
message: {
|
|
769
769
|
id: string;
|
|
770
770
|
timestamp: string;
|
|
771
|
-
type: "unknown" | "
|
|
771
|
+
type: "unknown" | "audio" | "document" | "image" | "video" | "order" | "text" | "location" | "system" | "contacts" | "reaction" | "button" | "interactive" | "sticker" | "unsupported";
|
|
772
772
|
content?: z.core.util.JSONType | undefined;
|
|
773
773
|
context?: {
|
|
774
774
|
messageId: string;
|
|
@@ -781,7 +781,7 @@ export declare function normalizeWhatsAppWebhook(input: unknown): {
|
|
|
781
781
|
from: string;
|
|
782
782
|
id: string;
|
|
783
783
|
timestamp: string;
|
|
784
|
-
type: "unknown" | "
|
|
784
|
+
type: "unknown" | "audio" | "document" | "image" | "video" | "order" | "text" | "location" | "system" | "contacts" | "reaction" | "button" | "interactive" | "sticker" | "unsupported";
|
|
785
785
|
audio?: {
|
|
786
786
|
id: string;
|
|
787
787
|
mime_type?: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automate.ax/integration-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.127.0",
|
|
4
4
|
"description": "Shared integration payload contracts and provider primitives for Automate.ax.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"./apify": "./src/apify/index.ts",
|
|
22
22
|
"./airtable": "./src/airtable/index.ts",
|
|
23
23
|
"./automate": "./src/automate/index.ts",
|
|
24
|
+
"./axiom": "./src/axiom/index.ts",
|
|
24
25
|
"./asana": "./src/asana/index.ts",
|
|
25
26
|
"./brevo": "./src/brevo/index.ts",
|
|
26
27
|
"./cloudflare": "./src/cloudflare/index.ts",
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
"./millionverifier": "./src/millionverifier/index.ts",
|
|
40
41
|
"./notion": "./src/notion/index.ts",
|
|
41
42
|
"./outlook": "./src/outlook/index.ts",
|
|
43
|
+
"./reddit": "./src/reddit/index.ts",
|
|
42
44
|
"./resend": "./src/resend/index.ts",
|
|
43
45
|
"./slack": "./src/slack/index.ts",
|
|
44
46
|
"./stripe": "./src/stripe/index.ts",
|
|
@@ -56,7 +58,7 @@
|
|
|
56
58
|
}
|
|
57
59
|
},
|
|
58
60
|
"dependencies": {
|
|
59
|
-
"@automate.ax/codec": "0.
|
|
61
|
+
"@automate.ax/codec": "0.127.0",
|
|
60
62
|
"@cfworker/json-schema": "^4.1.1",
|
|
61
63
|
"@googleapis/calendar": "^15.0.0",
|
|
62
64
|
"@googleapis/forms": "^6.0.1",
|
|
@@ -122,6 +124,11 @@
|
|
|
122
124
|
"types": "./dist/automate/index.d.ts",
|
|
123
125
|
"default": "./dist/automate/index.js"
|
|
124
126
|
},
|
|
127
|
+
"./axiom": {
|
|
128
|
+
"bun": "./src/axiom/index.ts",
|
|
129
|
+
"types": "./dist/axiom/index.d.ts",
|
|
130
|
+
"default": "./dist/axiom/index.js"
|
|
131
|
+
},
|
|
125
132
|
"./asana": {
|
|
126
133
|
"bun": "./src/asana/index.ts",
|
|
127
134
|
"types": "./dist/asana/index.d.ts",
|
|
@@ -212,6 +219,11 @@
|
|
|
212
219
|
"types": "./dist/outlook/index.d.ts",
|
|
213
220
|
"default": "./dist/outlook/index.js"
|
|
214
221
|
},
|
|
222
|
+
"./reddit": {
|
|
223
|
+
"bun": "./src/reddit/index.ts",
|
|
224
|
+
"types": "./dist/reddit/index.d.ts",
|
|
225
|
+
"default": "./dist/reddit/index.js"
|
|
226
|
+
},
|
|
215
227
|
"./resend": {
|
|
216
228
|
"bun": "./src/resend/index.ts",
|
|
217
229
|
"types": "./dist/resend/index.d.ts",
|