terse-types 0.0.12 → 0.0.14

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.
@@ -0,0 +1,437 @@
1
+ import { z } from "zod";
2
+ import { GitHubEventType, WorkOSEventType, gitHubEventTypeSchema, gmailEventTypeSchema, linearEventTypeSchema, slackEventTypeSchema, workOSEventTypeSchema } from "./Configs.js";
3
+ import { IntegrationType, integrationTypeEnum } from "./Integrations.js";
4
+ import { SlackChannelType } from "./SlackTypes.js";
5
+ import { debugTrigger as debugTriggerWithPresenter, formatTriggerForAgent as formatTriggerForAgentWithPresenter } from "./TriggerPresenters.js";
6
+ const providerTriggerTypeSchema = z.union([slackEventTypeSchema, gitHubEventTypeSchema, linearEventTypeSchema, gmailEventTypeSchema, workOSEventTypeSchema]);
7
+ const TriggerHeaderSchema = z.object({
8
+ integrationType: integrationTypeEnum,
9
+ eventType: providerTriggerTypeSchema
10
+ });
11
+ const slackTriggerBaseSchema = TriggerHeaderSchema.extend({
12
+ integrationType: z.literal(IntegrationType.SLACK),
13
+ eventType: slackEventTypeSchema,
14
+ channelId: z.string(),
15
+ channelName: z.string().nullable(),
16
+ userId: z.string(),
17
+ userName: z.string().nullable(),
18
+ text: z.string(),
19
+ timestamp: z.string(),
20
+ // Keep both names during migration; `threadTs` is the target shared field.
21
+ threadTs: z.string().nullable().optional(),
22
+ threadTimestamp: z.string().nullable(),
23
+ teamId: z.string(),
24
+ permalink: z.string().nullable(),
25
+ channelType: z.enum(SlackChannelType).nullable(),
26
+ blocks: z.array(z.unknown()).nullable(),
27
+ attachments: z.array(z.unknown()).nullable(),
28
+ files: z.array(z.unknown()).nullable()
29
+ });
30
+ export const slackMessageTriggerSchema = slackTriggerBaseSchema.extend({
31
+ eventType: z.literal("message")
32
+ });
33
+ export const slackAppMentionTriggerSchema = slackTriggerBaseSchema.extend({
34
+ eventType: z.literal("app_mention")
35
+ });
36
+ export const slackReactionAddedTriggerSchema = slackTriggerBaseSchema.extend({
37
+ eventType: z.literal("reaction_added"),
38
+ reaction: z.string(),
39
+ itemType: z.string().nullable(),
40
+ itemUserId: z.string().nullable(),
41
+ itemChannelId: z.string().nullable(),
42
+ itemTimestamp: z.string().nullable()
43
+ });
44
+ export const slackTriggerSchema = z.discriminatedUnion("eventType", [slackMessageTriggerSchema, slackAppMentionTriggerSchema, slackReactionAddedTriggerSchema]);
45
+ // Github Event Data
46
+ export const fileDiffSchema = z.object({
47
+ filename: z.string(),
48
+ diff: z.string()
49
+ });
50
+ export const commitSchema = z.object({
51
+ sha: z.string(),
52
+ // Keep both names during migration; `message` is the target shared field.
53
+ message: z.string().optional(),
54
+ name: z.string(),
55
+ fileDiffs: z.array(fileDiffSchema)
56
+ });
57
+ export const pullRequestUserSchema = z.object({
58
+ login: z.string(),
59
+ email: z.string().optional()
60
+ });
61
+ export const pullRequestRefSchema = z.object({
62
+ ref: z.string(),
63
+ sha: z.string()
64
+ });
65
+ export const pullRequestSchema = z.object({
66
+ id: z.string(),
67
+ number: z.number(),
68
+ title: z.string(),
69
+ body: z.string().optional(),
70
+ state: z.enum(["open", "closed"]),
71
+ merged: z.boolean(),
72
+ head: pullRequestRefSchema,
73
+ base: pullRequestRefSchema,
74
+ // Keep both names during migration; `author` is the target shared field.
75
+ user: pullRequestUserSchema,
76
+ author: pullRequestUserSchema.optional(),
77
+ url: z.string().optional()
78
+ });
79
+ export const githubRepositorySchema = z.object({
80
+ id: z.number(),
81
+ name: z.string(),
82
+ owner: z.string(),
83
+ defaultBranch: z.string()
84
+ });
85
+ export const senderSchema = z.object({
86
+ login: z.string(),
87
+ email: z.string().optional()
88
+ });
89
+ const GithubTriggerBaseSchema = z.object({
90
+ integrationType: z.literal(IntegrationType.GITHUB),
91
+ username: z.string(),
92
+ installationId: z.number(),
93
+ repositoryName: z.string(),
94
+ repository: githubRepositorySchema,
95
+ sender: senderSchema
96
+ });
97
+ export const GithubPushTriggerSchema = GithubTriggerBaseSchema.extend({
98
+ eventType: z.literal(GitHubEventType.PUSH),
99
+ branch: z.string(),
100
+ commits: z.array(commitSchema),
101
+ pullRequest: z.undefined().optional()
102
+ });
103
+ const GithubPRTriggerBaseSchema = GithubTriggerBaseSchema.extend({
104
+ pullRequest: pullRequestSchema,
105
+ branch: z.string().optional(),
106
+ commits: z.array(commitSchema)
107
+ });
108
+ export const GithubPROpenedTriggerSchema = GithubPRTriggerBaseSchema.extend({
109
+ eventType: z.literal(GitHubEventType.PR_OPENED)
110
+ });
111
+ export const GithubPRSynchronizedTriggerSchema = GithubPRTriggerBaseSchema.extend({
112
+ eventType: z.literal(GitHubEventType.PR_SYNCHRONIZE)
113
+ });
114
+ export const GithubPRClosedTriggerSchema = GithubPRTriggerBaseSchema.extend({
115
+ eventType: z.literal(GitHubEventType.PR_CLOSED)
116
+ });
117
+ export const GithubPRMergedTriggerSchema = GithubPRTriggerBaseSchema.extend({
118
+ eventType: z.literal(GitHubEventType.PR_MERGED)
119
+ });
120
+ export const GithubPRTriggerSchema = z.discriminatedUnion("eventType", [GithubPROpenedTriggerSchema, GithubPRSynchronizedTriggerSchema, GithubPRClosedTriggerSchema, GithubPRMergedTriggerSchema]);
121
+ export const GithubTriggerSchema = z.discriminatedUnion("eventType", [
122
+ GithubPushTriggerSchema,
123
+ GithubPROpenedTriggerSchema,
124
+ GithubPRSynchronizedTriggerSchema,
125
+ GithubPRClosedTriggerSchema,
126
+ GithubPRMergedTriggerSchema
127
+ ]);
128
+ export const GmailParsedAttachmentSchema = z.object({
129
+ attachmentId: z.string(),
130
+ filename: z.string(),
131
+ mimeType: z.string(),
132
+ contentId: z.string().optional(),
133
+ isInline: z.boolean()
134
+ });
135
+ const gmailMessagePayloadSchema = z.object({
136
+ id: z.string(),
137
+ threadId: z.string(),
138
+ subject: z.string(),
139
+ from: z.string(),
140
+ to: z.string(),
141
+ date: z.string(),
142
+ internalDate: z.string(),
143
+ messageId: z.string(),
144
+ body: z.string(),
145
+ snippet: z.string(),
146
+ labelIds: z.array(z.string()),
147
+ attachments: z.array(GmailParsedAttachmentSchema).optional()
148
+ });
149
+ export const LinearWebhookActionSchema = z.enum(["create", "update", "remove"]);
150
+ export const LinearWebhookTypeSchema = z.union([z.literal("Issue"), z.literal("Comment"), z.literal("Project"), z.string()]);
151
+ export const LinearWebhookActorSchema = z.object({
152
+ id: z.string(),
153
+ name: z.string(),
154
+ email: z.string(),
155
+ url: z.string(),
156
+ type: z.string()
157
+ });
158
+ export const LinearWebhookStateSchema = z.object({
159
+ id: z.string(),
160
+ color: z.string(),
161
+ name: z.string(),
162
+ type: z.string()
163
+ });
164
+ export const LinearWebhookTeamSchema = z.object({
165
+ id: z.string(),
166
+ key: z.string(),
167
+ name: z.string()
168
+ });
169
+ export const LinearWebhookAssigneeSchema = z.object({
170
+ id: z.string(),
171
+ name: z.string()
172
+ });
173
+ export const LinearWebhookDataSchema = z.object({
174
+ id: z.string(),
175
+ createdAt: z.string(),
176
+ updatedAt: z.string(),
177
+ number: z.number(),
178
+ title: z.string(),
179
+ priority: z.number(),
180
+ sortOrder: z.number(),
181
+ prioritySortOrder: z.number(),
182
+ slaType: z.string(),
183
+ addedToTeamAt: z.string(),
184
+ trashed: z.boolean(),
185
+ labelIds: z.array(z.string()),
186
+ teamId: z.string(),
187
+ previousIdentifiers: z.array(z.string()),
188
+ stateId: z.string(),
189
+ reactionData: z.array(z.any()),
190
+ priorityLabel: z.string(),
191
+ botActor: z.string().optional(),
192
+ identifier: z.string(),
193
+ url: z.string(),
194
+ subscriberIds: z.array(z.string()),
195
+ state: LinearWebhookStateSchema,
196
+ team: LinearWebhookTeamSchema,
197
+ labels: z.array(z.any()),
198
+ description: z.string().optional(),
199
+ descriptionData: z.string().optional(),
200
+ assignee: LinearWebhookAssigneeSchema.optional()
201
+ });
202
+ export const LinearWebhookCommentDataSchema = z
203
+ .object({
204
+ id: z.string(),
205
+ body: z.string().optional(),
206
+ issueId: z.string().optional()
207
+ })
208
+ .passthrough();
209
+ export const linearWebhookPayloadSchema = z.object({
210
+ action: LinearWebhookActionSchema,
211
+ actor: LinearWebhookActorSchema,
212
+ createdAt: z.string(),
213
+ data: LinearWebhookDataSchema,
214
+ type: LinearWebhookTypeSchema,
215
+ url: z.string().optional(),
216
+ organizationId: z.string(),
217
+ webhookTimestamp: z.number(),
218
+ webhookId: z.string()
219
+ });
220
+ export const WorkOSWebhookDataSchema = z.record(z.string(), z.any());
221
+ export const workOSWebhookPayloadSchema = z.object({
222
+ id: z.string(),
223
+ event: z.string(),
224
+ data: WorkOSWebhookDataSchema,
225
+ created_at: z.string()
226
+ });
227
+ // MARK: Canonical Trigger Events
228
+ export const webhookTriggerTypeSchema = z.literal("webhook");
229
+ export const cronTriggerTypeSchema = z.literal("cron");
230
+ export const manualSampleTriggerTypeSchema = z.literal("manual_sample");
231
+ export const TriggerTypeSchema = z.union([
232
+ slackEventTypeSchema,
233
+ gitHubEventTypeSchema,
234
+ linearEventTypeSchema,
235
+ gmailEventTypeSchema,
236
+ workOSEventTypeSchema,
237
+ webhookTriggerTypeSchema,
238
+ cronTriggerTypeSchema,
239
+ manualSampleTriggerTypeSchema
240
+ ]);
241
+ export const baseTriggerSchema = z.object({
242
+ integrationType: integrationTypeEnum,
243
+ eventType: TriggerTypeSchema
244
+ });
245
+ export const gmailTriggerSchema = baseTriggerSchema
246
+ .extend({
247
+ integrationType: z.literal(IntegrationType.GMAIL),
248
+ eventType: gmailEventTypeSchema
249
+ })
250
+ .merge(gmailMessagePayloadSchema);
251
+ const linearTriggerBaseSchema = z.object({
252
+ integrationType: z.literal(IntegrationType.LINEAR),
253
+ action: LinearWebhookActionSchema,
254
+ actor: LinearWebhookActorSchema,
255
+ createdAt: z.string(),
256
+ url: z.string().optional(),
257
+ organizationId: z.string(),
258
+ webhookTimestamp: z.number(),
259
+ webhookId: z.string()
260
+ });
261
+ export const linearIssueCreatedTriggerSchema = linearTriggerBaseSchema.extend({
262
+ eventType: z.literal("issue.created"),
263
+ action: z.literal("create"),
264
+ type: z.literal("Issue"),
265
+ data: LinearWebhookDataSchema
266
+ });
267
+ export const linearIssueUpdatedTriggerSchema = linearTriggerBaseSchema.extend({
268
+ eventType: z.literal("issue.updated"),
269
+ action: z.literal("update"),
270
+ type: z.literal("Issue"),
271
+ data: LinearWebhookDataSchema
272
+ });
273
+ export const linearCommentCreatedTriggerSchema = linearTriggerBaseSchema.extend({
274
+ eventType: z.literal("comment.created"),
275
+ action: z.literal("create"),
276
+ type: z.literal("Comment"),
277
+ data: LinearWebhookCommentDataSchema
278
+ });
279
+ export const linearTriggerSchema = z.discriminatedUnion("eventType", [linearIssueCreatedTriggerSchema, linearIssueUpdatedTriggerSchema, linearCommentCreatedTriggerSchema]);
280
+ export const workOSTriggerUserSchema = z.object({
281
+ id: z.string(),
282
+ email: z.string(),
283
+ firstName: z.string().optional(),
284
+ lastName: z.string().optional(),
285
+ emailVerified: z.boolean(),
286
+ profilePictureUrl: z.string().optional()
287
+ });
288
+ export const workOSTriggerMembershipSchema = z.object({
289
+ id: z.string(),
290
+ userId: z.string(),
291
+ organizationId: z.string(),
292
+ role: z.object({
293
+ slug: z.string()
294
+ }),
295
+ status: z.string()
296
+ });
297
+ export const workOSTriggerInvitationSchema = z.object({
298
+ id: z.string(),
299
+ email: z.string(),
300
+ organizationId: z.string(),
301
+ inviterEmail: z.string().optional(),
302
+ state: z.string(),
303
+ acceptedAt: z.string().optional()
304
+ });
305
+ export const workOSTriggerOrganizationSchema = z.object({
306
+ id: z.string(),
307
+ name: z.string()
308
+ });
309
+ const workOSTriggerBaseSchema = baseTriggerSchema.extend({
310
+ integrationType: z.literal(IntegrationType.WORKOS),
311
+ eventType: workOSEventTypeSchema,
312
+ eventId: z.string(),
313
+ createdAt: z.string()
314
+ });
315
+ export const workOSUserCreatedTriggerSchema = workOSTriggerBaseSchema.extend({
316
+ eventType: z.literal(WorkOSEventType.USER_CREATED),
317
+ user: workOSTriggerUserSchema
318
+ });
319
+ export const workOSUserUpdatedTriggerSchema = workOSTriggerBaseSchema.extend({
320
+ eventType: z.literal(WorkOSEventType.USER_UPDATED),
321
+ user: workOSTriggerUserSchema
322
+ });
323
+ export const workOSUserDeletedTriggerSchema = workOSTriggerBaseSchema.extend({
324
+ eventType: z.literal(WorkOSEventType.USER_DELETED),
325
+ user: workOSTriggerUserSchema
326
+ });
327
+ export const workOSUserTriggerSchema = z.discriminatedUnion("eventType", [workOSUserCreatedTriggerSchema, workOSUserUpdatedTriggerSchema, workOSUserDeletedTriggerSchema]);
328
+ export const workOSOrganizationMembershipCreatedTriggerSchema = workOSTriggerBaseSchema.extend({
329
+ eventType: z.literal(WorkOSEventType.ORGANIZATION_MEMBERSHIP_CREATED),
330
+ membership: workOSTriggerMembershipSchema
331
+ });
332
+ export const workOSOrganizationMembershipUpdatedTriggerSchema = workOSTriggerBaseSchema.extend({
333
+ eventType: z.literal(WorkOSEventType.ORGANIZATION_MEMBERSHIP_UPDATED),
334
+ membership: workOSTriggerMembershipSchema
335
+ });
336
+ export const workOSOrganizationMembershipDeletedTriggerSchema = workOSTriggerBaseSchema.extend({
337
+ eventType: z.literal(WorkOSEventType.ORGANIZATION_MEMBERSHIP_DELETED),
338
+ membership: workOSTriggerMembershipSchema
339
+ });
340
+ export const workOSMembershipTriggerSchema = z.discriminatedUnion("eventType", [
341
+ workOSOrganizationMembershipCreatedTriggerSchema,
342
+ workOSOrganizationMembershipUpdatedTriggerSchema,
343
+ workOSOrganizationMembershipDeletedTriggerSchema
344
+ ]);
345
+ export const workOSInvitationCreatedTriggerSchema = workOSTriggerBaseSchema.extend({
346
+ eventType: z.literal(WorkOSEventType.INVITATION_CREATED),
347
+ invitation: workOSTriggerInvitationSchema,
348
+ user: workOSTriggerUserSchema.optional()
349
+ });
350
+ export const workOSInvitationAcceptedTriggerSchema = workOSTriggerBaseSchema.extend({
351
+ eventType: z.literal(WorkOSEventType.INVITATION_ACCEPTED),
352
+ invitation: workOSTriggerInvitationSchema,
353
+ user: workOSTriggerUserSchema.optional()
354
+ });
355
+ export const workOSInvitationResentTriggerSchema = workOSTriggerBaseSchema.extend({
356
+ eventType: z.literal(WorkOSEventType.INVITATION_RESENT),
357
+ invitation: workOSTriggerInvitationSchema,
358
+ user: workOSTriggerUserSchema.optional()
359
+ });
360
+ export const workOSInvitationRevokedTriggerSchema = workOSTriggerBaseSchema.extend({
361
+ eventType: z.literal(WorkOSEventType.INVITATION_REVOKED),
362
+ invitation: workOSTriggerInvitationSchema,
363
+ user: workOSTriggerUserSchema.optional()
364
+ });
365
+ export const workOSInvitationTriggerSchema = z.discriminatedUnion("eventType", [
366
+ workOSInvitationCreatedTriggerSchema,
367
+ workOSInvitationAcceptedTriggerSchema,
368
+ workOSInvitationResentTriggerSchema,
369
+ workOSInvitationRevokedTriggerSchema
370
+ ]);
371
+ export const workOSOrganizationTriggerSchema = workOSTriggerBaseSchema.extend({
372
+ eventType: z.literal(WorkOSEventType.ORGANIZATION_CREATED),
373
+ organization: workOSTriggerOrganizationSchema
374
+ });
375
+ export const workOSTriggerSchema = z.discriminatedUnion("eventType", [
376
+ workOSUserCreatedTriggerSchema,
377
+ workOSUserUpdatedTriggerSchema,
378
+ workOSUserDeletedTriggerSchema,
379
+ workOSOrganizationMembershipCreatedTriggerSchema,
380
+ workOSOrganizationMembershipUpdatedTriggerSchema,
381
+ workOSOrganizationMembershipDeletedTriggerSchema,
382
+ workOSInvitationCreatedTriggerSchema,
383
+ workOSInvitationAcceptedTriggerSchema,
384
+ workOSInvitationResentTriggerSchema,
385
+ workOSInvitationRevokedTriggerSchema,
386
+ workOSOrganizationTriggerSchema
387
+ ]);
388
+ export const webhookTriggerSchema = baseTriggerSchema.extend({
389
+ integrationType: z.literal(IntegrationType.WEBHOOK),
390
+ eventType: webhookTriggerTypeSchema,
391
+ body: z.record(z.string(), z.unknown()),
392
+ headers: z.record(z.string(), z.string()),
393
+ method: z.string()
394
+ });
395
+ export const cronTriggerSchema = baseTriggerSchema.extend({
396
+ integrationType: z.literal(IntegrationType.CRON_JOB),
397
+ eventType: cronTriggerTypeSchema,
398
+ inputId: z.string(),
399
+ isManualTrigger: z.boolean().optional(),
400
+ manualContext: z.string().optional()
401
+ });
402
+ export const manualSampleTriggerSchema = baseTriggerSchema.extend({
403
+ eventType: manualSampleTriggerTypeSchema
404
+ });
405
+ export const TriggerSchema = z.union([
406
+ slackTriggerSchema,
407
+ GithubTriggerSchema,
408
+ gmailTriggerSchema,
409
+ linearTriggerSchema,
410
+ workOSTriggerSchema,
411
+ webhookTriggerSchema,
412
+ cronTriggerSchema,
413
+ manualSampleTriggerSchema
414
+ ]);
415
+ export function parseTrigger(value) {
416
+ return TriggerSchema.parse(value);
417
+ }
418
+ export function createManualTrigger(params = {}) {
419
+ return parseTrigger({
420
+ integrationType: params.integrationType ?? IntegrationType.TERSE,
421
+ eventType: "manual_sample"
422
+ });
423
+ }
424
+ export function formatTriggerForAgent(event) {
425
+ return formatTriggerForAgentWithPresenter(event);
426
+ }
427
+ export function debugTrigger(event) {
428
+ return debugTriggerWithPresenter(event);
429
+ }
430
+ export const TriggerArraySchema = z.array(TriggerSchema);
431
+ export const serializedEventSchema = z.object({
432
+ integrationType: integrationTypeEnum,
433
+ eventType: TriggerTypeSchema,
434
+ formattedContent: z.string(),
435
+ debugLog: z.string(),
436
+ data: TriggerSchema
437
+ });
@@ -39,6 +39,10 @@ const TriggerPresenters = {
39
39
  [IntegrationType.CRON_JOB]: {
40
40
  formatForAgent: formatCronTrigger,
41
41
  debug: (event) => (event.isManualTrigger ? "Manual Trigger" : "Scheduled Event")
42
+ },
43
+ [IntegrationType.WEBMONITOR]: {
44
+ formatForAgent: formatWebMonitorTrigger,
45
+ debug: (event) => `${event.query.slice(0, 80)}${event.query.length > 80 ? "…" : ""}`
42
46
  }
43
47
  };
44
48
  function dispatchPresenter(event, method) {
@@ -57,6 +61,8 @@ function dispatchPresenter(event, method) {
57
61
  return TriggerPresenters[IntegrationType.WEBHOOK][method](event);
58
62
  case IntegrationType.CRON_JOB:
59
63
  return TriggerPresenters[IntegrationType.CRON_JOB][method](event);
64
+ case IntegrationType.WEBMONITOR:
65
+ return TriggerPresenters[IntegrationType.WEBMONITOR][method](event);
60
66
  }
61
67
  }
62
68
  export function formatTriggerForAgent(event) {
@@ -242,6 +248,23 @@ function formatWorkOSTrigger(event) {
242
248
  function formatWebhookTrigger(event) {
243
249
  return `Webhook request received.\n\nMethod: ${event.method}\n\nPayload:\n${JSON.stringify(event.body, null, 2)}`;
244
250
  }
251
+ function formatWebMonitorTrigger(event) {
252
+ const lines = [
253
+ `Web event for monitored query (frequency: ${event.frequency.number}${event.frequency.unit}).`,
254
+ `Query: ${event.query}`,
255
+ `Monitor ID: ${event.monitorId}`,
256
+ `Event Group ID: ${event.eventGroupId}`,
257
+ `Output Type: ${event.outputType}`
258
+ ];
259
+ if (Object.keys(event.metadata).length > 0) {
260
+ lines.push(`Metadata:\n${JSON.stringify(event.metadata, null, 2)}`);
261
+ }
262
+ lines.push(`Payload:\n${JSON.stringify(event.payload, null, 2)}`);
263
+ if (event.rawPayload) {
264
+ lines.push(`Raw Payload:\n${event.rawPayload}`);
265
+ }
266
+ return lines.join("\n\n");
267
+ }
245
268
  function formatCronTrigger(event) {
246
269
  if (event.isManualTrigger) {
247
270
  let message = `This is a manually triggered event for the channel input ${event.inputId}.`;
@@ -1090,6 +1090,8 @@ export declare const webhookTriggerTypeSchema: z.ZodLiteral<"webhook">;
1090
1090
  export type WebhookTriggerType = z.infer<typeof webhookTriggerTypeSchema>;
1091
1091
  export declare const cronTriggerTypeSchema: z.ZodLiteral<"cron">;
1092
1092
  export type CronTriggerType = z.infer<typeof cronTriggerTypeSchema>;
1093
+ export declare const webMonitorTriggerTypeSchema: z.ZodLiteral<"webmonitor">;
1094
+ export type WebMonitorTriggerType = z.infer<typeof webMonitorTriggerTypeSchema>;
1093
1095
  export declare const manualSampleTriggerTypeSchema: z.ZodLiteral<"manual_sample">;
1094
1096
  export type ManualSampleTriggerType = z.infer<typeof manualSampleTriggerTypeSchema>;
1095
1097
  export declare const TriggerTypeSchema: z.ZodUnion<readonly [z.ZodEnum<{
@@ -1120,7 +1122,7 @@ export declare const TriggerTypeSchema: z.ZodUnion<readonly [z.ZodEnum<{
1120
1122
  readonly INVITATION_ACCEPTED: "invitation.accepted";
1121
1123
  readonly INVITATION_RESENT: "invitation.resent";
1122
1124
  readonly INVITATION_REVOKED: "invitation.revoked";
1123
- }>, z.ZodLiteral<"webhook">, z.ZodLiteral<"cron">, z.ZodLiteral<"manual_sample">]>;
1125
+ }>, z.ZodLiteral<"webhook">, z.ZodLiteral<"cron">, z.ZodLiteral<"webmonitor">, z.ZodLiteral<"manual_sample">]>;
1124
1126
  export type TriggerType = z.infer<typeof TriggerTypeSchema>;
1125
1127
  export declare const baseTriggerSchema: z.ZodObject<{
1126
1128
  integrationType: z.ZodEnum<typeof IntegrationType>;
@@ -1152,7 +1154,7 @@ export declare const baseTriggerSchema: z.ZodObject<{
1152
1154
  readonly INVITATION_ACCEPTED: "invitation.accepted";
1153
1155
  readonly INVITATION_RESENT: "invitation.resent";
1154
1156
  readonly INVITATION_REVOKED: "invitation.revoked";
1155
- }>, z.ZodLiteral<"webhook">, z.ZodLiteral<"cron">, z.ZodLiteral<"manual_sample">]>;
1157
+ }>, z.ZodLiteral<"webhook">, z.ZodLiteral<"cron">, z.ZodLiteral<"webmonitor">, z.ZodLiteral<"manual_sample">]>;
1156
1158
  }, z.core.$strip>;
1157
1159
  export type BaseTrigger = z.infer<typeof baseTriggerSchema>;
1158
1160
  export declare const gmailTriggerSchema: z.ZodObject<{
@@ -2062,6 +2064,75 @@ export declare const cronTriggerSchema: z.ZodObject<{
2062
2064
  manualContext: z.ZodOptional<z.ZodString>;
2063
2065
  }, z.core.$strip>;
2064
2066
  export type CronTrigger = z.infer<typeof cronTriggerSchema>;
2067
+ export declare const ParallelMonitorDetectedWebhookPayloadSchema: z.ZodObject<{
2068
+ type: z.ZodLiteral<"monitor.event.detected">;
2069
+ timestamp: z.ZodString;
2070
+ data: z.ZodObject<{
2071
+ event: z.ZodObject<{
2072
+ event_group_id: z.ZodString;
2073
+ }, z.core.$strip>;
2074
+ metadata: z.ZodRecord<z.ZodString, z.ZodString>;
2075
+ monitor_id: z.ZodString;
2076
+ }, z.core.$strip>;
2077
+ }, z.core.$strip>;
2078
+ export type ParallelMonitorDetectedWebhookPayload = z.infer<typeof ParallelMonitorDetectedWebhookPayloadSchema>;
2079
+ export declare const ParallelMonitorTextResultSchema: z.ZodObject<{
2080
+ type: z.ZodLiteral<"text">;
2081
+ content: z.ZodString;
2082
+ }, z.core.$strip>;
2083
+ export type ParallelMonitorTextResult = z.infer<typeof ParallelMonitorTextResultSchema>;
2084
+ export declare const ParallelMonitorJsonResultSchema: z.ZodObject<{
2085
+ type: z.ZodLiteral<"json">;
2086
+ content: z.ZodUnknown;
2087
+ }, z.core.$strip>;
2088
+ export type ParallelMonitorJsonResult<TStructured = unknown> = Omit<z.infer<typeof ParallelMonitorJsonResultSchema>, "content"> & {
2089
+ content: TStructured;
2090
+ };
2091
+ export declare const ParallelMonitorEventSchema: z.ZodObject<{
2092
+ type: z.ZodLiteral<"event">;
2093
+ event_group_id: z.ZodString;
2094
+ output: z.ZodString;
2095
+ event_date: z.ZodString;
2096
+ source_urls: z.ZodArray<z.ZodString>;
2097
+ result: z.ZodDiscriminatedUnion<[z.ZodObject<{
2098
+ type: z.ZodLiteral<"text">;
2099
+ content: z.ZodString;
2100
+ }, z.core.$strip>, z.ZodObject<{
2101
+ type: z.ZodLiteral<"json">;
2102
+ content: z.ZodUnknown;
2103
+ }, z.core.$strip>], "type">;
2104
+ }, z.core.$strip>;
2105
+ export type ParallelMonitorEvent<TStructured = unknown> = Omit<z.infer<typeof ParallelMonitorEventSchema>, "result"> & {
2106
+ result: ParallelMonitorTextResult | ParallelMonitorJsonResult<TStructured>;
2107
+ };
2108
+ export declare const webMonitorTriggerSchema: z.ZodObject<{
2109
+ integrationType: z.ZodLiteral<IntegrationType.WEBMONITOR>;
2110
+ eventType: z.ZodLiteral<"webmonitor">;
2111
+ inputId: z.ZodString;
2112
+ query: z.ZodString;
2113
+ frequency: z.ZodObject<{
2114
+ number: z.ZodNumber;
2115
+ unit: z.ZodEnum<{
2116
+ hour: "hour";
2117
+ day: "day";
2118
+ week: "week";
2119
+ }>;
2120
+ }, z.core.$strip>;
2121
+ monitorId: z.ZodString;
2122
+ eventGroupId: z.ZodString;
2123
+ metadata: z.ZodRecord<z.ZodString, z.ZodString>;
2124
+ outputType: z.ZodEnum<{
2125
+ json: "json";
2126
+ text: "text";
2127
+ }>;
2128
+ rawPayload: z.ZodOptional<z.ZodString>;
2129
+ payload: z.ZodUnknown;
2130
+ eventDate: z.ZodString;
2131
+ sourceUrls: z.ZodArray<z.ZodString>;
2132
+ }, z.core.$strip>;
2133
+ export type WebMonitorTrigger<TPayload = string> = Omit<z.infer<typeof webMonitorTriggerSchema>, "payload"> & {
2134
+ payload: TPayload;
2135
+ };
2065
2136
  export declare const manualSampleTriggerSchema: z.ZodObject<{
2066
2137
  integrationType: z.ZodEnum<typeof IntegrationType>;
2067
2138
  eventType: z.ZodLiteral<"manual_sample">;
@@ -2715,6 +2786,30 @@ export declare const TriggerSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion
2715
2786
  inputId: z.ZodString;
2716
2787
  isManualTrigger: z.ZodOptional<z.ZodBoolean>;
2717
2788
  manualContext: z.ZodOptional<z.ZodString>;
2789
+ }, z.core.$strip>, z.ZodObject<{
2790
+ integrationType: z.ZodLiteral<IntegrationType.WEBMONITOR>;
2791
+ eventType: z.ZodLiteral<"webmonitor">;
2792
+ inputId: z.ZodString;
2793
+ query: z.ZodString;
2794
+ frequency: z.ZodObject<{
2795
+ number: z.ZodNumber;
2796
+ unit: z.ZodEnum<{
2797
+ hour: "hour";
2798
+ day: "day";
2799
+ week: "week";
2800
+ }>;
2801
+ }, z.core.$strip>;
2802
+ monitorId: z.ZodString;
2803
+ eventGroupId: z.ZodString;
2804
+ metadata: z.ZodRecord<z.ZodString, z.ZodString>;
2805
+ outputType: z.ZodEnum<{
2806
+ json: "json";
2807
+ text: "text";
2808
+ }>;
2809
+ rawPayload: z.ZodOptional<z.ZodString>;
2810
+ payload: z.ZodUnknown;
2811
+ eventDate: z.ZodString;
2812
+ sourceUrls: z.ZodArray<z.ZodString>;
2718
2813
  }, z.core.$strip>, z.ZodObject<{
2719
2814
  integrationType: z.ZodEnum<typeof IntegrationType>;
2720
2815
  eventType: z.ZodLiteral<"manual_sample">;
@@ -3373,6 +3468,30 @@ export declare const TriggerArraySchema: z.ZodArray<z.ZodUnion<readonly [z.ZodDi
3373
3468
  inputId: z.ZodString;
3374
3469
  isManualTrigger: z.ZodOptional<z.ZodBoolean>;
3375
3470
  manualContext: z.ZodOptional<z.ZodString>;
3471
+ }, z.core.$strip>, z.ZodObject<{
3472
+ integrationType: z.ZodLiteral<IntegrationType.WEBMONITOR>;
3473
+ eventType: z.ZodLiteral<"webmonitor">;
3474
+ inputId: z.ZodString;
3475
+ query: z.ZodString;
3476
+ frequency: z.ZodObject<{
3477
+ number: z.ZodNumber;
3478
+ unit: z.ZodEnum<{
3479
+ hour: "hour";
3480
+ day: "day";
3481
+ week: "week";
3482
+ }>;
3483
+ }, z.core.$strip>;
3484
+ monitorId: z.ZodString;
3485
+ eventGroupId: z.ZodString;
3486
+ metadata: z.ZodRecord<z.ZodString, z.ZodString>;
3487
+ outputType: z.ZodEnum<{
3488
+ json: "json";
3489
+ text: "text";
3490
+ }>;
3491
+ rawPayload: z.ZodOptional<z.ZodString>;
3492
+ payload: z.ZodUnknown;
3493
+ eventDate: z.ZodString;
3494
+ sourceUrls: z.ZodArray<z.ZodString>;
3376
3495
  }, z.core.$strip>, z.ZodObject<{
3377
3496
  integrationType: z.ZodEnum<typeof IntegrationType>;
3378
3497
  eventType: z.ZodLiteral<"manual_sample">;
@@ -3407,7 +3526,7 @@ export declare const serializedEventSchema: z.ZodObject<{
3407
3526
  readonly INVITATION_ACCEPTED: "invitation.accepted";
3408
3527
  readonly INVITATION_RESENT: "invitation.resent";
3409
3528
  readonly INVITATION_REVOKED: "invitation.revoked";
3410
- }>, z.ZodLiteral<"webhook">, z.ZodLiteral<"cron">, z.ZodLiteral<"manual_sample">]>;
3529
+ }>, z.ZodLiteral<"webhook">, z.ZodLiteral<"cron">, z.ZodLiteral<"webmonitor">, z.ZodLiteral<"manual_sample">]>;
3411
3530
  formattedContent: z.ZodString;
3412
3531
  debugLog: z.ZodString;
3413
3532
  data: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -4058,6 +4177,30 @@ export declare const serializedEventSchema: z.ZodObject<{
4058
4177
  inputId: z.ZodString;
4059
4178
  isManualTrigger: z.ZodOptional<z.ZodBoolean>;
4060
4179
  manualContext: z.ZodOptional<z.ZodString>;
4180
+ }, z.core.$strip>, z.ZodObject<{
4181
+ integrationType: z.ZodLiteral<IntegrationType.WEBMONITOR>;
4182
+ eventType: z.ZodLiteral<"webmonitor">;
4183
+ inputId: z.ZodString;
4184
+ query: z.ZodString;
4185
+ frequency: z.ZodObject<{
4186
+ number: z.ZodNumber;
4187
+ unit: z.ZodEnum<{
4188
+ hour: "hour";
4189
+ day: "day";
4190
+ week: "week";
4191
+ }>;
4192
+ }, z.core.$strip>;
4193
+ monitorId: z.ZodString;
4194
+ eventGroupId: z.ZodString;
4195
+ metadata: z.ZodRecord<z.ZodString, z.ZodString>;
4196
+ outputType: z.ZodEnum<{
4197
+ json: "json";
4198
+ text: "text";
4199
+ }>;
4200
+ rawPayload: z.ZodOptional<z.ZodString>;
4201
+ payload: z.ZodUnknown;
4202
+ eventDate: z.ZodString;
4203
+ sourceUrls: z.ZodArray<z.ZodString>;
4061
4204
  }, z.core.$strip>, z.ZodObject<{
4062
4205
  integrationType: z.ZodEnum<typeof IntegrationType>;
4063
4206
  eventType: z.ZodLiteral<"manual_sample">;