@trigger.dev/sdk 0.2.22 → 2.0.0-next.1

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/index.d.ts CHANGED
@@ -1,371 +1,1401 @@
1
1
  import * as zod from 'zod';
2
2
  import { z } from 'zod';
3
3
 
4
- declare const SerializableSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodDate, z.ZodUndefined]>;
4
+ type LogLevel = "log" | "error" | "warn" | "info" | "debug";
5
+ declare class Logger {
6
+ #private;
7
+ constructor(name: string, level?: LogLevel, filteredKeys?: string[]);
8
+ filter(...keys: string[]): Logger;
9
+ log(...args: any[]): void;
10
+ error(...args: any[]): void;
11
+ warn(...args: any[]): void;
12
+ info(...args: any[]): void;
13
+ debug(message: string, ...args: Array<Record<string, unknown> | undefined>): void;
14
+ }
15
+
16
+ declare const EventMatcherSchema: z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodNumber, "many">, z.ZodArray<z.ZodBoolean, "many">]>;
17
+ type EventMatcher = z.infer<typeof EventMatcherSchema>;
18
+ type EventFilter = {
19
+ [key: string]: EventMatcher | EventFilter;
20
+ };
21
+
22
+ declare const LiteralSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
23
+ type Literal = z.infer<typeof LiteralSchema>;
24
+ type DeserializedJson = Literal | {
25
+ [key: string]: DeserializedJson;
26
+ } | DeserializedJson[];
27
+ declare const SerializableSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodDate, z.ZodUndefined, z.ZodSymbol]>;
5
28
  type Serializable = z.infer<typeof SerializableSchema>;
6
29
  type SerializableJson = Serializable | {
7
30
  [key: string]: SerializableJson;
8
31
  } | SerializableJson[];
9
- declare const SerializableJsonSchema: z.ZodType<SerializableJson>;
10
32
 
11
- declare const SerializableCustomEventSchema: z.ZodObject<{
33
+ declare const ServerTaskSchema: z.ZodObject<z.extendShape<{
34
+ id: z.ZodString;
12
35
  name: z.ZodString;
13
- payload: z.ZodType<string | number | boolean | Date | {
14
- [key: string]: string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
15
- } | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined, z.ZodTypeDef, string | number | boolean | Date | {
16
- [key: string]: string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
17
- } | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined>;
18
- context: z.ZodOptional<z.ZodType<string | number | boolean | Date | {
19
- [key: string]: string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
20
- } | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined, z.ZodTypeDef, string | number | boolean | Date | {
21
- [key: string]: string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
22
- } | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined>>;
23
- timestamp: z.ZodOptional<z.ZodString>;
24
- delay: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
25
- seconds: z.ZodNumber;
26
- }, "strip", z.ZodTypeAny, {
27
- seconds: number;
28
- }, {
29
- seconds: number;
30
- }>, z.ZodObject<{
31
- minutes: z.ZodNumber;
36
+ icon: z.ZodNullable<z.ZodOptional<z.ZodString>>;
37
+ noop: z.ZodBoolean;
38
+ startedAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
39
+ completedAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
40
+ delayUntil: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
41
+ status: z.ZodEnum<["PENDING", "WAITING", "RUNNING", "COMPLETED", "ERRORED"]>;
42
+ description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
43
+ properties: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
44
+ label: z.ZodString;
45
+ text: z.ZodString;
46
+ url: z.ZodOptional<z.ZodString>;
32
47
  }, "strip", z.ZodTypeAny, {
33
- minutes: number;
48
+ url?: string | undefined;
49
+ label: string;
50
+ text: string;
34
51
  }, {
35
- minutes: number;
36
- }>, z.ZodObject<{
37
- hours: z.ZodNumber;
38
- }, "strip", z.ZodTypeAny, {
39
- hours: number;
40
- }, {
41
- hours: number;
42
- }>, z.ZodObject<{
43
- days: z.ZodNumber;
52
+ url?: string | undefined;
53
+ label: string;
54
+ text: string;
55
+ }>, "many">>>;
56
+ params: z.ZodNullable<z.ZodOptional<z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>>>;
57
+ output: z.ZodNullable<z.ZodOptional<z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>>>;
58
+ error: z.ZodNullable<z.ZodOptional<z.ZodString>>;
59
+ parentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
60
+ style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
61
+ style: z.ZodEnum<["normal", "minimal"]>;
62
+ variant: z.ZodOptional<z.ZodString>;
44
63
  }, "strip", z.ZodTypeAny, {
45
- days: number;
64
+ variant?: string | undefined;
65
+ style: "normal" | "minimal";
46
66
  }, {
47
- days: number;
48
- }>, z.ZodObject<{
49
- until: z.ZodDate;
67
+ variant?: string | undefined;
68
+ style: "normal" | "minimal";
69
+ }>>>;
70
+ }, {
71
+ idempotencyKey: z.ZodString;
72
+ attempts: z.ZodNumber;
73
+ }>, "strip", z.ZodTypeAny, {
74
+ icon?: string | null | undefined;
75
+ startedAt?: Date | null | undefined;
76
+ completedAt?: Date | null | undefined;
77
+ delayUntil?: Date | null | undefined;
78
+ description?: string | null | undefined;
79
+ params?: DeserializedJson | undefined;
80
+ properties?: {
81
+ url?: string | undefined;
82
+ label: string;
83
+ text: string;
84
+ }[] | null | undefined;
85
+ output?: DeserializedJson | undefined;
86
+ error?: string | null | undefined;
87
+ parentId?: string | null | undefined;
88
+ style?: {
89
+ variant?: string | undefined;
90
+ style: "normal" | "minimal";
91
+ } | null | undefined;
92
+ id: string;
93
+ name: string;
94
+ noop: boolean;
95
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
96
+ idempotencyKey: string;
97
+ attempts: number;
98
+ }, {
99
+ icon?: string | null | undefined;
100
+ startedAt?: Date | null | undefined;
101
+ completedAt?: Date | null | undefined;
102
+ delayUntil?: Date | null | undefined;
103
+ description?: string | null | undefined;
104
+ params?: DeserializedJson | undefined;
105
+ properties?: {
106
+ url?: string | undefined;
107
+ label: string;
108
+ text: string;
109
+ }[] | null | undefined;
110
+ output?: DeserializedJson | undefined;
111
+ error?: string | null | undefined;
112
+ parentId?: string | null | undefined;
113
+ style?: {
114
+ variant?: string | undefined;
115
+ style: "normal" | "minimal";
116
+ } | null | undefined;
117
+ id: string;
118
+ name: string;
119
+ noop: boolean;
120
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
121
+ idempotencyKey: string;
122
+ attempts: number;
123
+ }>;
124
+ type ServerTask = z.infer<typeof ServerTaskSchema>;
125
+ declare const CachedTaskSchema: z.ZodObject<{
126
+ id: z.ZodString;
127
+ idempotencyKey: z.ZodString;
128
+ status: z.ZodEnum<["PENDING", "WAITING", "RUNNING", "COMPLETED", "ERRORED"]>;
129
+ noop: z.ZodDefault<z.ZodBoolean>;
130
+ output: z.ZodNullable<z.ZodOptional<z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>>>;
131
+ parentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
132
+ }, "strip", z.ZodTypeAny, {
133
+ output?: DeserializedJson | undefined;
134
+ parentId?: string | null | undefined;
135
+ id: string;
136
+ noop: boolean;
137
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
138
+ idempotencyKey: string;
139
+ }, {
140
+ noop?: boolean | undefined;
141
+ output?: DeserializedJson | undefined;
142
+ parentId?: string | null | undefined;
143
+ id: string;
144
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
145
+ idempotencyKey: string;
146
+ }>;
147
+
148
+ declare const UpdateTriggerSourceBodySchema: z.ZodObject<{
149
+ registeredEvents: z.ZodArray<z.ZodString, "many">;
150
+ secret: z.ZodOptional<z.ZodString>;
151
+ data: z.ZodOptional<z.ZodType<SerializableJson, z.ZodTypeDef, SerializableJson>>;
152
+ }, "strip", z.ZodTypeAny, {
153
+ data?: SerializableJson;
154
+ secret?: string | undefined;
155
+ registeredEvents: string[];
156
+ }, {
157
+ data?: SerializableJson;
158
+ secret?: string | undefined;
159
+ registeredEvents: string[];
160
+ }>;
161
+ type UpdateTriggerSourceBody = z.infer<typeof UpdateTriggerSourceBodySchema>;
162
+ declare const RegisterSourceEventSchema: z.ZodObject<{
163
+ id: z.ZodString;
164
+ source: z.ZodObject<{
165
+ key: z.ZodString;
166
+ params: z.ZodAny;
167
+ active: z.ZodBoolean;
168
+ secret: z.ZodString;
169
+ data: z.ZodOptional<z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>>;
170
+ channel: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
171
+ type: z.ZodLiteral<"HTTP">;
172
+ url: z.ZodString;
173
+ }, "strip", z.ZodTypeAny, {
174
+ url: string;
175
+ type: "HTTP";
176
+ }, {
177
+ url: string;
178
+ type: "HTTP";
179
+ }>, z.ZodObject<{
180
+ type: z.ZodLiteral<"SMTP">;
181
+ }, "strip", z.ZodTypeAny, {
182
+ type: "SMTP";
183
+ }, {
184
+ type: "SMTP";
185
+ }>, z.ZodObject<{
186
+ type: z.ZodLiteral<"SQS">;
187
+ }, "strip", z.ZodTypeAny, {
188
+ type: "SQS";
189
+ }, {
190
+ type: "SQS";
191
+ }>]>;
192
+ clientId: z.ZodOptional<z.ZodString>;
50
193
  }, "strip", z.ZodTypeAny, {
51
- until: Date;
194
+ params?: any;
195
+ data?: DeserializedJson | undefined;
196
+ clientId?: string | undefined;
197
+ key: string;
198
+ secret: string;
199
+ active: boolean;
200
+ channel: {
201
+ url: string;
202
+ type: "HTTP";
203
+ } | {
204
+ type: "SMTP";
205
+ } | {
206
+ type: "SQS";
207
+ };
52
208
  }, {
53
- until: Date;
54
- }>]>>;
209
+ params?: any;
210
+ data?: DeserializedJson | undefined;
211
+ clientId?: string | undefined;
212
+ key: string;
213
+ secret: string;
214
+ active: boolean;
215
+ channel: {
216
+ url: string;
217
+ type: "HTTP";
218
+ } | {
219
+ type: "SMTP";
220
+ } | {
221
+ type: "SQS";
222
+ };
223
+ }>;
224
+ events: z.ZodArray<z.ZodString, "many">;
225
+ missingEvents: z.ZodArray<z.ZodString, "many">;
226
+ orphanedEvents: z.ZodArray<z.ZodString, "many">;
227
+ dynamicTriggerId: z.ZodOptional<z.ZodString>;
55
228
  }, "strip", z.ZodTypeAny, {
56
- payload?: string | number | boolean | Date | {
57
- [key: string]: string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
58
- } | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
59
- context?: string | number | boolean | Date | {
60
- [key: string]: string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
61
- } | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
62
- timestamp?: string | undefined;
63
- delay?: {
64
- seconds: number;
65
- } | {
66
- minutes: number;
67
- } | {
68
- hours: number;
69
- } | {
70
- days: number;
71
- } | {
72
- until: Date;
73
- } | undefined;
74
- name: string;
229
+ dynamicTriggerId?: string | undefined;
230
+ id: string;
231
+ source: {
232
+ params?: any;
233
+ data?: DeserializedJson | undefined;
234
+ clientId?: string | undefined;
235
+ key: string;
236
+ secret: string;
237
+ active: boolean;
238
+ channel: {
239
+ url: string;
240
+ type: "HTTP";
241
+ } | {
242
+ type: "SMTP";
243
+ } | {
244
+ type: "SQS";
245
+ };
246
+ };
247
+ events: string[];
248
+ missingEvents: string[];
249
+ orphanedEvents: string[];
75
250
  }, {
76
- payload?: string | number | boolean | Date | {
77
- [key: string]: string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
78
- } | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
79
- context?: string | number | boolean | Date | {
80
- [key: string]: string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
81
- } | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
82
- timestamp?: string | undefined;
83
- delay?: {
84
- seconds: number;
85
- } | {
86
- minutes: number;
87
- } | {
88
- hours: number;
89
- } | {
90
- days: number;
91
- } | {
92
- until: Date;
93
- } | undefined;
94
- name: string;
251
+ dynamicTriggerId?: string | undefined;
252
+ id: string;
253
+ source: {
254
+ params?: any;
255
+ data?: DeserializedJson | undefined;
256
+ clientId?: string | undefined;
257
+ key: string;
258
+ secret: string;
259
+ active: boolean;
260
+ channel: {
261
+ url: string;
262
+ type: "HTTP";
263
+ } | {
264
+ type: "SMTP";
265
+ } | {
266
+ type: "SQS";
267
+ };
268
+ };
269
+ events: string[];
270
+ missingEvents: string[];
271
+ orphanedEvents: string[];
95
272
  }>;
96
- declare const EventMatcherSchema: z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodNumber, "many">, z.ZodArray<z.ZodBoolean, "many">]>;
97
- type EventMatcher = z.infer<typeof EventMatcherSchema>;
98
- type EventFilter = {
99
- [key: string]: EventMatcher | EventFilter;
100
- };
101
- declare const EventFilterSchema: z.ZodType<EventFilter>;
102
- declare const ScheduledEventPayloadSchema: z.ZodObject<{
103
- lastRunAt: z.ZodOptional<z.ZodDate>;
104
- scheduledTime: z.ZodDate;
273
+ type RegisterSourceEvent = z.infer<typeof RegisterSourceEventSchema>;
274
+ declare const TriggerSourceSchema: z.ZodObject<{
275
+ id: z.ZodString;
276
+ key: z.ZodString;
277
+ }, "strip", z.ZodTypeAny, {
278
+ id: string;
279
+ key: string;
280
+ }, {
281
+ id: string;
282
+ key: string;
283
+ }>;
284
+ declare const HandleTriggerSourceSchema: z.ZodObject<{
285
+ key: z.ZodString;
286
+ secret: z.ZodString;
287
+ data: z.ZodAny;
288
+ params: z.ZodAny;
289
+ }, "strip", z.ZodTypeAny, {
290
+ params?: any;
291
+ data?: any;
292
+ key: string;
293
+ secret: string;
294
+ }, {
295
+ params?: any;
296
+ data?: any;
297
+ key: string;
298
+ secret: string;
299
+ }>;
300
+ type HandleTriggerSource = z.infer<typeof HandleTriggerSourceSchema>;
301
+ type TriggerSource = z.infer<typeof TriggerSourceSchema>;
302
+ declare const QueueOptionsSchema: z.ZodObject<{
303
+ name: z.ZodString;
304
+ maxConcurrent: z.ZodOptional<z.ZodNumber>;
105
305
  }, "strip", z.ZodTypeAny, {
106
- lastRunAt?: Date | undefined;
107
- scheduledTime: Date;
306
+ maxConcurrent?: number | undefined;
307
+ name: string;
108
308
  }, {
109
- lastRunAt?: Date | undefined;
110
- scheduledTime: Date;
309
+ maxConcurrent?: number | undefined;
310
+ name: string;
111
311
  }>;
112
- declare const ScheduleSourceSchema: z.ZodUnion<[z.ZodObject<{
113
- rateOf: z.ZodUnion<[z.ZodObject<{
114
- minutes: z.ZodNumber;
312
+ type QueueOptions = z.infer<typeof QueueOptionsSchema>;
313
+ declare const JobMetadataSchema: z.ZodObject<{
314
+ id: z.ZodString;
315
+ name: z.ZodString;
316
+ version: z.ZodString;
317
+ event: z.ZodObject<{
318
+ name: z.ZodString;
319
+ title: z.ZodString;
320
+ source: z.ZodString;
321
+ icon: z.ZodString;
322
+ filter: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
323
+ properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
324
+ label: z.ZodString;
325
+ text: z.ZodString;
326
+ url: z.ZodOptional<z.ZodString>;
327
+ }, "strip", z.ZodTypeAny, {
328
+ url?: string | undefined;
329
+ label: string;
330
+ text: string;
331
+ }, {
332
+ url?: string | undefined;
333
+ label: string;
334
+ text: string;
335
+ }>, "many">>;
336
+ schema: z.ZodOptional<z.ZodAny>;
337
+ examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
338
+ id: z.ZodString;
339
+ icon: z.ZodOptional<z.ZodString>;
340
+ name: z.ZodString;
341
+ payload: z.ZodAny;
342
+ }, "strip", z.ZodTypeAny, {
343
+ icon?: string | undefined;
344
+ payload?: any;
345
+ id: string;
346
+ name: string;
347
+ }, {
348
+ icon?: string | undefined;
349
+ payload?: any;
350
+ id: string;
351
+ name: string;
352
+ }>, "many">>;
353
+ }, "strip", z.ZodTypeAny, {
354
+ filter?: EventFilter | undefined;
355
+ properties?: {
356
+ url?: string | undefined;
357
+ label: string;
358
+ text: string;
359
+ }[] | undefined;
360
+ schema?: any;
361
+ examples?: {
362
+ icon?: string | undefined;
363
+ payload?: any;
364
+ id: string;
365
+ name: string;
366
+ }[] | undefined;
367
+ name: string;
368
+ icon: string;
369
+ source: string;
370
+ title: string;
371
+ }, {
372
+ filter?: EventFilter | undefined;
373
+ properties?: {
374
+ url?: string | undefined;
375
+ label: string;
376
+ text: string;
377
+ }[] | undefined;
378
+ schema?: any;
379
+ examples?: {
380
+ icon?: string | undefined;
381
+ payload?: any;
382
+ id: string;
383
+ name: string;
384
+ }[] | undefined;
385
+ name: string;
386
+ icon: string;
387
+ source: string;
388
+ title: string;
389
+ }>;
390
+ trigger: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
391
+ type: z.ZodLiteral<"dynamic">;
392
+ id: z.ZodString;
115
393
  }, "strip", z.ZodTypeAny, {
116
- minutes: number;
394
+ id: string;
395
+ type: "dynamic";
117
396
  }, {
118
- minutes: number;
397
+ id: string;
398
+ type: "dynamic";
119
399
  }>, z.ZodObject<{
120
- hours: z.ZodNumber;
400
+ type: z.ZodLiteral<"static">;
401
+ title: z.ZodString;
402
+ properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
403
+ label: z.ZodString;
404
+ text: z.ZodString;
405
+ url: z.ZodOptional<z.ZodString>;
406
+ }, "strip", z.ZodTypeAny, {
407
+ url?: string | undefined;
408
+ label: string;
409
+ text: string;
410
+ }, {
411
+ url?: string | undefined;
412
+ label: string;
413
+ text: string;
414
+ }>, "many">>;
415
+ rule: z.ZodObject<{
416
+ event: z.ZodString;
417
+ source: z.ZodString;
418
+ payload: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
419
+ context: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
420
+ }, "strip", z.ZodTypeAny, {
421
+ payload?: EventFilter | undefined;
422
+ context?: EventFilter | undefined;
423
+ event: string;
424
+ source: string;
425
+ }, {
426
+ payload?: EventFilter | undefined;
427
+ context?: EventFilter | undefined;
428
+ event: string;
429
+ source: string;
430
+ }>;
121
431
  }, "strip", z.ZodTypeAny, {
122
- hours: number;
432
+ properties?: {
433
+ url?: string | undefined;
434
+ label: string;
435
+ text: string;
436
+ }[] | undefined;
437
+ type: "static";
438
+ title: string;
439
+ rule: {
440
+ payload?: EventFilter | undefined;
441
+ context?: EventFilter | undefined;
442
+ event: string;
443
+ source: string;
444
+ };
123
445
  }, {
124
- hours: number;
446
+ properties?: {
447
+ url?: string | undefined;
448
+ label: string;
449
+ text: string;
450
+ }[] | undefined;
451
+ type: "static";
452
+ title: string;
453
+ rule: {
454
+ payload?: EventFilter | undefined;
455
+ context?: EventFilter | undefined;
456
+ event: string;
457
+ source: string;
458
+ };
125
459
  }>, z.ZodObject<{
126
- days: z.ZodNumber;
460
+ type: z.ZodLiteral<"scheduled">;
461
+ schedule: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
462
+ type: z.ZodLiteral<"interval">;
463
+ options: z.ZodObject<{
464
+ seconds: z.ZodNumber;
465
+ }, "strip", z.ZodTypeAny, {
466
+ seconds: number;
467
+ }, {
468
+ seconds: number;
469
+ }>;
470
+ metadata: z.ZodAny;
471
+ }, "strip", z.ZodTypeAny, {
472
+ metadata?: any;
473
+ options: {
474
+ seconds: number;
475
+ };
476
+ type: "interval";
477
+ }, {
478
+ metadata?: any;
479
+ options: {
480
+ seconds: number;
481
+ };
482
+ type: "interval";
483
+ }>, z.ZodObject<{
484
+ type: z.ZodLiteral<"cron">;
485
+ options: z.ZodObject<{
486
+ cron: z.ZodString;
487
+ }, "strip", z.ZodTypeAny, {
488
+ cron: string;
489
+ }, {
490
+ cron: string;
491
+ }>;
492
+ metadata: z.ZodAny;
493
+ }, "strip", z.ZodTypeAny, {
494
+ metadata?: any;
495
+ options: {
496
+ cron: string;
497
+ };
498
+ type: "cron";
499
+ }, {
500
+ metadata?: any;
501
+ options: {
502
+ cron: string;
503
+ };
504
+ type: "cron";
505
+ }>]>;
127
506
  }, "strip", z.ZodTypeAny, {
128
- days: number;
507
+ type: "scheduled";
508
+ schedule: {
509
+ metadata?: any;
510
+ options: {
511
+ cron: string;
512
+ };
513
+ type: "cron";
514
+ } | {
515
+ metadata?: any;
516
+ options: {
517
+ seconds: number;
518
+ };
519
+ type: "interval";
520
+ };
129
521
  }, {
130
- days: number;
522
+ type: "scheduled";
523
+ schedule: {
524
+ metadata?: any;
525
+ options: {
526
+ cron: string;
527
+ };
528
+ type: "cron";
529
+ } | {
530
+ metadata?: any;
531
+ options: {
532
+ seconds: number;
533
+ };
534
+ type: "interval";
535
+ };
131
536
  }>]>;
537
+ integrations: z.ZodRecord<z.ZodString, z.ZodObject<{
538
+ id: z.ZodString;
539
+ metadata: z.ZodObject<{
540
+ key: z.ZodString;
541
+ title: z.ZodString;
542
+ icon: z.ZodString;
543
+ }, "strip", z.ZodTypeAny, {
544
+ icon: string;
545
+ key: string;
546
+ title: string;
547
+ }, {
548
+ icon: string;
549
+ key: string;
550
+ title: string;
551
+ }>;
552
+ }, "strip", z.ZodTypeAny, {
553
+ id: string;
554
+ metadata: {
555
+ icon: string;
556
+ key: string;
557
+ title: string;
558
+ };
559
+ }, {
560
+ id: string;
561
+ metadata: {
562
+ icon: string;
563
+ key: string;
564
+ title: string;
565
+ };
566
+ }>>;
567
+ internal: z.ZodDefault<z.ZodBoolean>;
568
+ queue: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
569
+ name: z.ZodString;
570
+ maxConcurrent: z.ZodOptional<z.ZodNumber>;
571
+ }, "strip", z.ZodTypeAny, {
572
+ maxConcurrent?: number | undefined;
573
+ name: string;
574
+ }, {
575
+ maxConcurrent?: number | undefined;
576
+ name: string;
577
+ }>, z.ZodString]>>;
578
+ startPosition: z.ZodEnum<["initial", "latest"]>;
579
+ enabled: z.ZodBoolean;
580
+ preprocessRuns: z.ZodBoolean;
132
581
  }, "strip", z.ZodTypeAny, {
133
- rateOf: {
134
- minutes: number;
582
+ queue?: string | {
583
+ maxConcurrent?: number | undefined;
584
+ name: string;
585
+ } | undefined;
586
+ id: string;
587
+ name: string;
588
+ event: {
589
+ filter?: EventFilter | undefined;
590
+ properties?: {
591
+ url?: string | undefined;
592
+ label: string;
593
+ text: string;
594
+ }[] | undefined;
595
+ schema?: any;
596
+ examples?: {
597
+ icon?: string | undefined;
598
+ payload?: any;
599
+ id: string;
600
+ name: string;
601
+ }[] | undefined;
602
+ name: string;
603
+ icon: string;
604
+ source: string;
605
+ title: string;
606
+ };
607
+ version: string;
608
+ trigger: {
609
+ id: string;
610
+ type: "dynamic";
135
611
  } | {
136
- hours: number;
612
+ properties?: {
613
+ url?: string | undefined;
614
+ label: string;
615
+ text: string;
616
+ }[] | undefined;
617
+ type: "static";
618
+ title: string;
619
+ rule: {
620
+ payload?: EventFilter | undefined;
621
+ context?: EventFilter | undefined;
622
+ event: string;
623
+ source: string;
624
+ };
137
625
  } | {
138
- days: number;
626
+ type: "scheduled";
627
+ schedule: {
628
+ metadata?: any;
629
+ options: {
630
+ cron: string;
631
+ };
632
+ type: "cron";
633
+ } | {
634
+ metadata?: any;
635
+ options: {
636
+ seconds: number;
637
+ };
638
+ type: "interval";
639
+ };
139
640
  };
641
+ integrations: Record<string, {
642
+ id: string;
643
+ metadata: {
644
+ icon: string;
645
+ key: string;
646
+ title: string;
647
+ };
648
+ }>;
649
+ internal: boolean;
650
+ startPosition: "initial" | "latest";
651
+ enabled: boolean;
652
+ preprocessRuns: boolean;
140
653
  }, {
141
- rateOf: {
142
- minutes: number;
654
+ internal?: boolean | undefined;
655
+ queue?: string | {
656
+ maxConcurrent?: number | undefined;
657
+ name: string;
658
+ } | undefined;
659
+ id: string;
660
+ name: string;
661
+ event: {
662
+ filter?: EventFilter | undefined;
663
+ properties?: {
664
+ url?: string | undefined;
665
+ label: string;
666
+ text: string;
667
+ }[] | undefined;
668
+ schema?: any;
669
+ examples?: {
670
+ icon?: string | undefined;
671
+ payload?: any;
672
+ id: string;
673
+ name: string;
674
+ }[] | undefined;
675
+ name: string;
676
+ icon: string;
677
+ source: string;
678
+ title: string;
679
+ };
680
+ version: string;
681
+ trigger: {
682
+ id: string;
683
+ type: "dynamic";
143
684
  } | {
144
- hours: number;
685
+ properties?: {
686
+ url?: string | undefined;
687
+ label: string;
688
+ text: string;
689
+ }[] | undefined;
690
+ type: "static";
691
+ title: string;
692
+ rule: {
693
+ payload?: EventFilter | undefined;
694
+ context?: EventFilter | undefined;
695
+ event: string;
696
+ source: string;
697
+ };
145
698
  } | {
146
- days: number;
699
+ type: "scheduled";
700
+ schedule: {
701
+ metadata?: any;
702
+ options: {
703
+ cron: string;
704
+ };
705
+ type: "cron";
706
+ } | {
707
+ metadata?: any;
708
+ options: {
709
+ seconds: number;
710
+ };
711
+ type: "interval";
712
+ };
147
713
  };
148
- }>, z.ZodObject<{
149
- cron: z.ZodString;
150
- }, "strip", z.ZodTypeAny, {
151
- cron: string;
152
- }, {
153
- cron: string;
154
- }>]>;
155
-
156
- declare const TriggerMetadataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
157
- type: z.ZodLiteral<"CUSTOM_EVENT">;
158
- service: z.ZodLiteral<"trigger">;
714
+ integrations: Record<string, {
715
+ id: string;
716
+ metadata: {
717
+ icon: string;
718
+ key: string;
719
+ title: string;
720
+ };
721
+ }>;
722
+ startPosition: "initial" | "latest";
723
+ enabled: boolean;
724
+ preprocessRuns: boolean;
725
+ }>;
726
+ type JobMetadata = z.infer<typeof JobMetadataSchema>;
727
+ declare const RawEventSchema: z.ZodObject<{
728
+ id: z.ZodDefault<z.ZodString>;
159
729
  name: z.ZodString;
160
- filter: z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>;
161
- schema: z.ZodOptional<z.ZodType<string | number | boolean | {
162
- [key: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
163
- } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null, z.ZodTypeDef, string | number | boolean | {
164
- [key: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
165
- } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null>>;
730
+ source: z.ZodOptional<z.ZodString>;
731
+ payload: z.ZodAny;
732
+ context: z.ZodOptional<z.ZodAny>;
733
+ timestamp: z.ZodOptional<z.ZodString>;
166
734
  }, "strip", z.ZodTypeAny, {
167
- schema?: (string | number | boolean | {
168
- [key: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
169
- } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null) | undefined;
170
- filter: EventFilter;
171
- type: "CUSTOM_EVENT";
735
+ source?: string | undefined;
736
+ payload?: any;
737
+ context?: any;
738
+ timestamp?: string | undefined;
739
+ id: string;
172
740
  name: string;
173
- service: "trigger";
174
741
  }, {
175
- schema?: (string | number | boolean | {
176
- [key: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
177
- } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null) | undefined;
178
- filter: EventFilter;
179
- type: "CUSTOM_EVENT";
180
- name: string;
181
- service: "trigger";
182
- }>, z.ZodObject<{
183
- type: z.ZodLiteral<"WEBHOOK">;
184
- service: z.ZodString;
185
- name: z.ZodString;
186
- filter: z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>;
187
- source: z.ZodOptional<z.ZodType<string | number | boolean | {
188
- [key: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
189
- } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null, z.ZodTypeDef, string | number | boolean | {
190
- [key: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
191
- } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null>>;
192
- manualRegistration: z.ZodDefault<z.ZodBoolean>;
193
- schema: z.ZodOptional<z.ZodType<string | number | boolean | {
194
- [key: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
195
- } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null, z.ZodTypeDef, string | number | boolean | {
196
- [key: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
197
- } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null>>;
198
- }, "strip", z.ZodTypeAny, {
199
- schema?: (string | number | boolean | {
200
- [key: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
201
- } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null) | undefined;
202
- source?: (string | number | boolean | {
203
- [key: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
204
- } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null) | undefined;
205
- filter: EventFilter;
206
- type: "WEBHOOK";
207
- name: string;
208
- service: string;
209
- manualRegistration: boolean;
210
- }, {
211
- schema?: (string | number | boolean | {
212
- [key: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
213
- } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null) | undefined;
214
- source?: (string | number | boolean | {
215
- [key: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
216
- } | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null) | undefined;
217
- manualRegistration?: boolean | undefined;
218
- filter: EventFilter;
219
- type: "WEBHOOK";
742
+ id?: string | undefined;
743
+ source?: string | undefined;
744
+ payload?: any;
745
+ context?: any;
746
+ timestamp?: string | undefined;
220
747
  name: string;
221
- service: string;
222
- }>, z.ZodObject<{
223
- type: z.ZodLiteral<"HTTP_ENDPOINT">;
224
- service: z.ZodLiteral<"trigger">;
225
- name: z.ZodString;
226
- filter: z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>;
748
+ }>;
749
+ type SendEvent = z.input<typeof RawEventSchema>;
750
+ declare const SendEventOptionsSchema: z.ZodObject<{
751
+ deliverAt: z.ZodOptional<z.ZodString>;
752
+ deliverAfter: z.ZodOptional<z.ZodNumber>;
753
+ accountId: z.ZodOptional<z.ZodString>;
227
754
  }, "strip", z.ZodTypeAny, {
228
- filter: EventFilter;
229
- type: "HTTP_ENDPOINT";
230
- name: string;
231
- service: "trigger";
755
+ deliverAt?: string | undefined;
756
+ deliverAfter?: number | undefined;
757
+ accountId?: string | undefined;
232
758
  }, {
233
- filter: EventFilter;
234
- type: "HTTP_ENDPOINT";
235
- name: string;
236
- service: "trigger";
237
- }>, z.ZodObject<{
238
- type: z.ZodLiteral<"SCHEDULE">;
239
- service: z.ZodLiteral<"scheduler">;
240
- name: z.ZodString;
241
- source: z.ZodUnion<[z.ZodObject<{
242
- rateOf: z.ZodUnion<[z.ZodObject<{
243
- minutes: z.ZodNumber;
759
+ deliverAt?: string | undefined;
760
+ deliverAfter?: number | undefined;
761
+ accountId?: string | undefined;
762
+ }>;
763
+ type SendEventOptions = z.infer<typeof SendEventOptionsSchema>;
764
+ declare const RuntimeEnvironmentTypeSchema: z.ZodEnum<["PRODUCTION", "STAGING", "DEVELOPMENT", "PREVIEW"]>;
765
+ type RuntimeEnvironmentType = z.infer<typeof RuntimeEnvironmentTypeSchema>;
766
+ declare const CreateRunBodySchema: z.ZodObject<{
767
+ client: z.ZodString;
768
+ job: z.ZodObject<{
769
+ id: z.ZodString;
770
+ name: z.ZodString;
771
+ version: z.ZodString;
772
+ event: z.ZodObject<{
773
+ name: z.ZodString;
774
+ title: z.ZodString;
775
+ source: z.ZodString;
776
+ icon: z.ZodString;
777
+ filter: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
778
+ properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
779
+ label: z.ZodString;
780
+ text: z.ZodString;
781
+ url: z.ZodOptional<z.ZodString>;
782
+ }, "strip", z.ZodTypeAny, {
783
+ url?: string | undefined;
784
+ label: string;
785
+ text: string;
786
+ }, {
787
+ url?: string | undefined;
788
+ label: string;
789
+ text: string;
790
+ }>, "many">>;
791
+ schema: z.ZodOptional<z.ZodAny>;
792
+ examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
793
+ id: z.ZodString;
794
+ icon: z.ZodOptional<z.ZodString>;
795
+ name: z.ZodString;
796
+ payload: z.ZodAny;
797
+ }, "strip", z.ZodTypeAny, {
798
+ icon?: string | undefined;
799
+ payload?: any;
800
+ id: string;
801
+ name: string;
802
+ }, {
803
+ icon?: string | undefined;
804
+ payload?: any;
805
+ id: string;
806
+ name: string;
807
+ }>, "many">>;
808
+ }, "strip", z.ZodTypeAny, {
809
+ filter?: EventFilter | undefined;
810
+ properties?: {
811
+ url?: string | undefined;
812
+ label: string;
813
+ text: string;
814
+ }[] | undefined;
815
+ schema?: any;
816
+ examples?: {
817
+ icon?: string | undefined;
818
+ payload?: any;
819
+ id: string;
820
+ name: string;
821
+ }[] | undefined;
822
+ name: string;
823
+ icon: string;
824
+ source: string;
825
+ title: string;
826
+ }, {
827
+ filter?: EventFilter | undefined;
828
+ properties?: {
829
+ url?: string | undefined;
830
+ label: string;
831
+ text: string;
832
+ }[] | undefined;
833
+ schema?: any;
834
+ examples?: {
835
+ icon?: string | undefined;
836
+ payload?: any;
837
+ id: string;
838
+ name: string;
839
+ }[] | undefined;
840
+ name: string;
841
+ icon: string;
842
+ source: string;
843
+ title: string;
844
+ }>;
845
+ trigger: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
846
+ type: z.ZodLiteral<"dynamic">;
847
+ id: z.ZodString;
244
848
  }, "strip", z.ZodTypeAny, {
245
- minutes: number;
849
+ id: string;
850
+ type: "dynamic";
246
851
  }, {
247
- minutes: number;
852
+ id: string;
853
+ type: "dynamic";
248
854
  }>, z.ZodObject<{
249
- hours: z.ZodNumber;
855
+ type: z.ZodLiteral<"static">;
856
+ title: z.ZodString;
857
+ properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
858
+ label: z.ZodString;
859
+ text: z.ZodString;
860
+ url: z.ZodOptional<z.ZodString>;
861
+ }, "strip", z.ZodTypeAny, {
862
+ url?: string | undefined;
863
+ label: string;
864
+ text: string;
865
+ }, {
866
+ url?: string | undefined;
867
+ label: string;
868
+ text: string;
869
+ }>, "many">>;
870
+ rule: z.ZodObject<{
871
+ event: z.ZodString;
872
+ source: z.ZodString;
873
+ payload: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
874
+ context: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
875
+ }, "strip", z.ZodTypeAny, {
876
+ payload?: EventFilter | undefined;
877
+ context?: EventFilter | undefined;
878
+ event: string;
879
+ source: string;
880
+ }, {
881
+ payload?: EventFilter | undefined;
882
+ context?: EventFilter | undefined;
883
+ event: string;
884
+ source: string;
885
+ }>;
250
886
  }, "strip", z.ZodTypeAny, {
251
- hours: number;
887
+ properties?: {
888
+ url?: string | undefined;
889
+ label: string;
890
+ text: string;
891
+ }[] | undefined;
892
+ type: "static";
893
+ title: string;
894
+ rule: {
895
+ payload?: EventFilter | undefined;
896
+ context?: EventFilter | undefined;
897
+ event: string;
898
+ source: string;
899
+ };
252
900
  }, {
253
- hours: number;
901
+ properties?: {
902
+ url?: string | undefined;
903
+ label: string;
904
+ text: string;
905
+ }[] | undefined;
906
+ type: "static";
907
+ title: string;
908
+ rule: {
909
+ payload?: EventFilter | undefined;
910
+ context?: EventFilter | undefined;
911
+ event: string;
912
+ source: string;
913
+ };
254
914
  }>, z.ZodObject<{
255
- days: z.ZodNumber;
915
+ type: z.ZodLiteral<"scheduled">;
916
+ schedule: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
917
+ type: z.ZodLiteral<"interval">;
918
+ options: z.ZodObject<{
919
+ seconds: z.ZodNumber;
920
+ }, "strip", z.ZodTypeAny, {
921
+ seconds: number;
922
+ }, {
923
+ seconds: number;
924
+ }>;
925
+ metadata: z.ZodAny;
926
+ }, "strip", z.ZodTypeAny, {
927
+ metadata?: any;
928
+ options: {
929
+ seconds: number;
930
+ };
931
+ type: "interval";
932
+ }, {
933
+ metadata?: any;
934
+ options: {
935
+ seconds: number;
936
+ };
937
+ type: "interval";
938
+ }>, z.ZodObject<{
939
+ type: z.ZodLiteral<"cron">;
940
+ options: z.ZodObject<{
941
+ cron: z.ZodString;
942
+ }, "strip", z.ZodTypeAny, {
943
+ cron: string;
944
+ }, {
945
+ cron: string;
946
+ }>;
947
+ metadata: z.ZodAny;
948
+ }, "strip", z.ZodTypeAny, {
949
+ metadata?: any;
950
+ options: {
951
+ cron: string;
952
+ };
953
+ type: "cron";
954
+ }, {
955
+ metadata?: any;
956
+ options: {
957
+ cron: string;
958
+ };
959
+ type: "cron";
960
+ }>]>;
256
961
  }, "strip", z.ZodTypeAny, {
257
- days: number;
962
+ type: "scheduled";
963
+ schedule: {
964
+ metadata?: any;
965
+ options: {
966
+ cron: string;
967
+ };
968
+ type: "cron";
969
+ } | {
970
+ metadata?: any;
971
+ options: {
972
+ seconds: number;
973
+ };
974
+ type: "interval";
975
+ };
258
976
  }, {
259
- days: number;
977
+ type: "scheduled";
978
+ schedule: {
979
+ metadata?: any;
980
+ options: {
981
+ cron: string;
982
+ };
983
+ type: "cron";
984
+ } | {
985
+ metadata?: any;
986
+ options: {
987
+ seconds: number;
988
+ };
989
+ type: "interval";
990
+ };
260
991
  }>]>;
992
+ integrations: z.ZodRecord<z.ZodString, z.ZodObject<{
993
+ id: z.ZodString;
994
+ metadata: z.ZodObject<{
995
+ key: z.ZodString;
996
+ title: z.ZodString;
997
+ icon: z.ZodString;
998
+ }, "strip", z.ZodTypeAny, {
999
+ icon: string;
1000
+ key: string;
1001
+ title: string;
1002
+ }, {
1003
+ icon: string;
1004
+ key: string;
1005
+ title: string;
1006
+ }>;
1007
+ }, "strip", z.ZodTypeAny, {
1008
+ id: string;
1009
+ metadata: {
1010
+ icon: string;
1011
+ key: string;
1012
+ title: string;
1013
+ };
1014
+ }, {
1015
+ id: string;
1016
+ metadata: {
1017
+ icon: string;
1018
+ key: string;
1019
+ title: string;
1020
+ };
1021
+ }>>;
1022
+ internal: z.ZodDefault<z.ZodBoolean>;
1023
+ queue: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
1024
+ name: z.ZodString;
1025
+ maxConcurrent: z.ZodOptional<z.ZodNumber>;
1026
+ }, "strip", z.ZodTypeAny, {
1027
+ maxConcurrent?: number | undefined;
1028
+ name: string;
1029
+ }, {
1030
+ maxConcurrent?: number | undefined;
1031
+ name: string;
1032
+ }>, z.ZodString]>>;
1033
+ startPosition: z.ZodEnum<["initial", "latest"]>;
1034
+ enabled: z.ZodBoolean;
1035
+ preprocessRuns: z.ZodBoolean;
261
1036
  }, "strip", z.ZodTypeAny, {
262
- rateOf: {
263
- minutes: number;
1037
+ queue?: string | {
1038
+ maxConcurrent?: number | undefined;
1039
+ name: string;
1040
+ } | undefined;
1041
+ id: string;
1042
+ name: string;
1043
+ event: {
1044
+ filter?: EventFilter | undefined;
1045
+ properties?: {
1046
+ url?: string | undefined;
1047
+ label: string;
1048
+ text: string;
1049
+ }[] | undefined;
1050
+ schema?: any;
1051
+ examples?: {
1052
+ icon?: string | undefined;
1053
+ payload?: any;
1054
+ id: string;
1055
+ name: string;
1056
+ }[] | undefined;
1057
+ name: string;
1058
+ icon: string;
1059
+ source: string;
1060
+ title: string;
1061
+ };
1062
+ version: string;
1063
+ trigger: {
1064
+ id: string;
1065
+ type: "dynamic";
264
1066
  } | {
265
- hours: number;
1067
+ properties?: {
1068
+ url?: string | undefined;
1069
+ label: string;
1070
+ text: string;
1071
+ }[] | undefined;
1072
+ type: "static";
1073
+ title: string;
1074
+ rule: {
1075
+ payload?: EventFilter | undefined;
1076
+ context?: EventFilter | undefined;
1077
+ event: string;
1078
+ source: string;
1079
+ };
266
1080
  } | {
267
- days: number;
1081
+ type: "scheduled";
1082
+ schedule: {
1083
+ metadata?: any;
1084
+ options: {
1085
+ cron: string;
1086
+ };
1087
+ type: "cron";
1088
+ } | {
1089
+ metadata?: any;
1090
+ options: {
1091
+ seconds: number;
1092
+ };
1093
+ type: "interval";
1094
+ };
268
1095
  };
1096
+ integrations: Record<string, {
1097
+ id: string;
1098
+ metadata: {
1099
+ icon: string;
1100
+ key: string;
1101
+ title: string;
1102
+ };
1103
+ }>;
1104
+ internal: boolean;
1105
+ startPosition: "initial" | "latest";
1106
+ enabled: boolean;
1107
+ preprocessRuns: boolean;
269
1108
  }, {
270
- rateOf: {
271
- minutes: number;
1109
+ internal?: boolean | undefined;
1110
+ queue?: string | {
1111
+ maxConcurrent?: number | undefined;
1112
+ name: string;
1113
+ } | undefined;
1114
+ id: string;
1115
+ name: string;
1116
+ event: {
1117
+ filter?: EventFilter | undefined;
1118
+ properties?: {
1119
+ url?: string | undefined;
1120
+ label: string;
1121
+ text: string;
1122
+ }[] | undefined;
1123
+ schema?: any;
1124
+ examples?: {
1125
+ icon?: string | undefined;
1126
+ payload?: any;
1127
+ id: string;
1128
+ name: string;
1129
+ }[] | undefined;
1130
+ name: string;
1131
+ icon: string;
1132
+ source: string;
1133
+ title: string;
1134
+ };
1135
+ version: string;
1136
+ trigger: {
1137
+ id: string;
1138
+ type: "dynamic";
272
1139
  } | {
273
- hours: number;
1140
+ properties?: {
1141
+ url?: string | undefined;
1142
+ label: string;
1143
+ text: string;
1144
+ }[] | undefined;
1145
+ type: "static";
1146
+ title: string;
1147
+ rule: {
1148
+ payload?: EventFilter | undefined;
1149
+ context?: EventFilter | undefined;
1150
+ event: string;
1151
+ source: string;
1152
+ };
274
1153
  } | {
275
- days: number;
1154
+ type: "scheduled";
1155
+ schedule: {
1156
+ metadata?: any;
1157
+ options: {
1158
+ cron: string;
1159
+ };
1160
+ type: "cron";
1161
+ } | {
1162
+ metadata?: any;
1163
+ options: {
1164
+ seconds: number;
1165
+ };
1166
+ type: "interval";
1167
+ };
276
1168
  };
277
- }>, z.ZodObject<{
278
- cron: z.ZodString;
1169
+ integrations: Record<string, {
1170
+ id: string;
1171
+ metadata: {
1172
+ icon: string;
1173
+ key: string;
1174
+ title: string;
1175
+ };
1176
+ }>;
1177
+ startPosition: "initial" | "latest";
1178
+ enabled: boolean;
1179
+ preprocessRuns: boolean;
1180
+ }>;
1181
+ event: z.ZodObject<{
1182
+ id: z.ZodString;
1183
+ name: z.ZodString;
1184
+ payload: z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>;
1185
+ context: z.ZodNullable<z.ZodOptional<z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>>>;
1186
+ timestamp: z.ZodDate;
1187
+ deliverAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
1188
+ deliveredAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
279
1189
  }, "strip", z.ZodTypeAny, {
280
- cron: string;
1190
+ context?: DeserializedJson | undefined;
1191
+ deliverAt?: Date | null | undefined;
1192
+ deliveredAt?: Date | null | undefined;
1193
+ id: string;
1194
+ name: string;
1195
+ payload: DeserializedJson;
1196
+ timestamp: Date;
281
1197
  }, {
282
- cron: string;
283
- }>]>;
1198
+ context?: DeserializedJson | undefined;
1199
+ deliverAt?: Date | null | undefined;
1200
+ deliveredAt?: Date | null | undefined;
1201
+ id: string;
1202
+ name: string;
1203
+ payload: DeserializedJson;
1204
+ timestamp: Date;
1205
+ }>;
1206
+ properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
1207
+ label: z.ZodString;
1208
+ text: z.ZodString;
1209
+ url: z.ZodOptional<z.ZodString>;
1210
+ }, "strip", z.ZodTypeAny, {
1211
+ url?: string | undefined;
1212
+ label: string;
1213
+ text: string;
1214
+ }, {
1215
+ url?: string | undefined;
1216
+ label: string;
1217
+ text: string;
1218
+ }>, "many">>;
284
1219
  }, "strip", z.ZodTypeAny, {
285
- type: "SCHEDULE";
286
- name: string;
287
- service: "scheduler";
288
- source: {
289
- rateOf: {
290
- minutes: number;
1220
+ properties?: {
1221
+ url?: string | undefined;
1222
+ label: string;
1223
+ text: string;
1224
+ }[] | undefined;
1225
+ event: {
1226
+ context?: DeserializedJson | undefined;
1227
+ deliverAt?: Date | null | undefined;
1228
+ deliveredAt?: Date | null | undefined;
1229
+ id: string;
1230
+ name: string;
1231
+ payload: DeserializedJson;
1232
+ timestamp: Date;
1233
+ };
1234
+ job: {
1235
+ queue?: string | {
1236
+ maxConcurrent?: number | undefined;
1237
+ name: string;
1238
+ } | undefined;
1239
+ id: string;
1240
+ name: string;
1241
+ event: {
1242
+ filter?: EventFilter | undefined;
1243
+ properties?: {
1244
+ url?: string | undefined;
1245
+ label: string;
1246
+ text: string;
1247
+ }[] | undefined;
1248
+ schema?: any;
1249
+ examples?: {
1250
+ icon?: string | undefined;
1251
+ payload?: any;
1252
+ id: string;
1253
+ name: string;
1254
+ }[] | undefined;
1255
+ name: string;
1256
+ icon: string;
1257
+ source: string;
1258
+ title: string;
1259
+ };
1260
+ version: string;
1261
+ trigger: {
1262
+ id: string;
1263
+ type: "dynamic";
291
1264
  } | {
292
- hours: number;
1265
+ properties?: {
1266
+ url?: string | undefined;
1267
+ label: string;
1268
+ text: string;
1269
+ }[] | undefined;
1270
+ type: "static";
1271
+ title: string;
1272
+ rule: {
1273
+ payload?: EventFilter | undefined;
1274
+ context?: EventFilter | undefined;
1275
+ event: string;
1276
+ source: string;
1277
+ };
293
1278
  } | {
294
- days: number;
1279
+ type: "scheduled";
1280
+ schedule: {
1281
+ metadata?: any;
1282
+ options: {
1283
+ cron: string;
1284
+ };
1285
+ type: "cron";
1286
+ } | {
1287
+ metadata?: any;
1288
+ options: {
1289
+ seconds: number;
1290
+ };
1291
+ type: "interval";
1292
+ };
295
1293
  };
296
- } | {
297
- cron: string;
1294
+ integrations: Record<string, {
1295
+ id: string;
1296
+ metadata: {
1297
+ icon: string;
1298
+ key: string;
1299
+ title: string;
1300
+ };
1301
+ }>;
1302
+ internal: boolean;
1303
+ startPosition: "initial" | "latest";
1304
+ enabled: boolean;
1305
+ preprocessRuns: boolean;
298
1306
  };
1307
+ client: string;
299
1308
  }, {
300
- type: "SCHEDULE";
301
- name: string;
302
- service: "scheduler";
303
- source: {
304
- rateOf: {
305
- minutes: number;
1309
+ properties?: {
1310
+ url?: string | undefined;
1311
+ label: string;
1312
+ text: string;
1313
+ }[] | undefined;
1314
+ event: {
1315
+ context?: DeserializedJson | undefined;
1316
+ deliverAt?: Date | null | undefined;
1317
+ deliveredAt?: Date | null | undefined;
1318
+ id: string;
1319
+ name: string;
1320
+ payload: DeserializedJson;
1321
+ timestamp: Date;
1322
+ };
1323
+ job: {
1324
+ internal?: boolean | undefined;
1325
+ queue?: string | {
1326
+ maxConcurrent?: number | undefined;
1327
+ name: string;
1328
+ } | undefined;
1329
+ id: string;
1330
+ name: string;
1331
+ event: {
1332
+ filter?: EventFilter | undefined;
1333
+ properties?: {
1334
+ url?: string | undefined;
1335
+ label: string;
1336
+ text: string;
1337
+ }[] | undefined;
1338
+ schema?: any;
1339
+ examples?: {
1340
+ icon?: string | undefined;
1341
+ payload?: any;
1342
+ id: string;
1343
+ name: string;
1344
+ }[] | undefined;
1345
+ name: string;
1346
+ icon: string;
1347
+ source: string;
1348
+ title: string;
1349
+ };
1350
+ version: string;
1351
+ trigger: {
1352
+ id: string;
1353
+ type: "dynamic";
306
1354
  } | {
307
- hours: number;
1355
+ properties?: {
1356
+ url?: string | undefined;
1357
+ label: string;
1358
+ text: string;
1359
+ }[] | undefined;
1360
+ type: "static";
1361
+ title: string;
1362
+ rule: {
1363
+ payload?: EventFilter | undefined;
1364
+ context?: EventFilter | undefined;
1365
+ event: string;
1366
+ source: string;
1367
+ };
308
1368
  } | {
309
- days: number;
1369
+ type: "scheduled";
1370
+ schedule: {
1371
+ metadata?: any;
1372
+ options: {
1373
+ cron: string;
1374
+ };
1375
+ type: "cron";
1376
+ } | {
1377
+ metadata?: any;
1378
+ options: {
1379
+ seconds: number;
1380
+ };
1381
+ type: "interval";
1382
+ };
310
1383
  };
311
- } | {
312
- cron: string;
313
- };
314
- }>, z.ZodObject<{
315
- type: z.ZodLiteral<"SLACK_INTERACTION">;
316
- service: z.ZodLiteral<"slack">;
317
- name: z.ZodString;
318
- filter: z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>;
319
- source: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
320
- type: z.ZodLiteral<"block_action">;
321
- blockId: z.ZodString;
322
- actionIds: z.ZodArray<z.ZodString, "many">;
323
- }, "strip", z.ZodTypeAny, {
324
- type: "block_action";
325
- blockId: string;
326
- actionIds: string[];
327
- }, {
328
- type: "block_action";
329
- blockId: string;
330
- actionIds: string[];
331
- }>, z.ZodObject<{
332
- type: z.ZodLiteral<"view_submission">;
333
- callbackIds: z.ZodArray<z.ZodString, "many">;
334
- }, "strip", z.ZodTypeAny, {
335
- type: "view_submission";
336
- callbackIds: string[];
337
- }, {
338
- type: "view_submission";
339
- callbackIds: string[];
340
- }>]>;
341
- }, "strip", z.ZodTypeAny, {
342
- filter: EventFilter;
343
- type: "SLACK_INTERACTION";
344
- name: string;
345
- service: "slack";
346
- source: {
347
- type: "block_action";
348
- blockId: string;
349
- actionIds: string[];
350
- } | {
351
- type: "view_submission";
352
- callbackIds: string[];
353
- };
354
- }, {
355
- filter: EventFilter;
356
- type: "SLACK_INTERACTION";
357
- name: string;
358
- service: "slack";
359
- source: {
360
- type: "block_action";
361
- blockId: string;
362
- actionIds: string[];
363
- } | {
364
- type: "view_submission";
365
- callbackIds: string[];
1384
+ integrations: Record<string, {
1385
+ id: string;
1386
+ metadata: {
1387
+ icon: string;
1388
+ key: string;
1389
+ title: string;
1390
+ };
1391
+ }>;
1392
+ startPosition: "initial" | "latest";
1393
+ enabled: boolean;
1394
+ preprocessRuns: boolean;
366
1395
  };
367
- }>]>;
368
-
1396
+ client: string;
1397
+ }>;
1398
+ type CreateRunBody = z.infer<typeof CreateRunBodySchema>;
369
1399
  declare const SecureStringSchema: z.ZodObject<{
370
1400
  __secureString: z.ZodLiteral<true>;
371
1401
  strings: z.ZodArray<z.ZodString, "many">;
@@ -380,158 +1410,2496 @@ declare const SecureStringSchema: z.ZodObject<{
380
1410
  interpolations: string[];
381
1411
  }>;
382
1412
  type SecureString = z.infer<typeof SecureStringSchema>;
383
-
384
- type TriggerCustomEvent = z.infer<typeof SerializableCustomEventSchema>;
385
- type WaitForOptions = {
386
- seconds?: number;
387
- minutes?: number;
388
- hours?: number;
389
- days?: number;
390
- };
391
- type FetchOptions<TResponseBodySchema extends z.ZodTypeAny = z.ZodTypeAny> = {
392
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE";
393
- body?: z.infer<typeof SerializableJsonSchema>;
394
- headers?: Record<string, string | SecureString>;
395
- responseSchema?: TResponseBodySchema;
396
- retry?: {
397
- enabled?: boolean;
398
- factor?: number;
399
- maxTimeout?: number;
400
- minTimeout?: number;
401
- maxAttempts?: number;
402
- statusCodes?: number[];
403
- };
404
- };
405
- type FetchResponse<TResponseBodySchema extends z.ZodTypeAny = z.ZodTypeAny> = {
406
- ok: boolean;
407
- body?: z.infer<TResponseBodySchema>;
408
- headers: Record<string, string>;
409
- status: number;
410
- };
411
- type TriggerFetch = <TBodySchema extends z.ZodTypeAny = z.ZodTypeAny>(key: string, url: string | URL, options: FetchOptions<TBodySchema>) => Promise<FetchResponse<TBodySchema>>;
412
- type TriggerRunOnceCallback = (idempotencyKey: string) => Promise<any>;
413
- interface TriggerKeyValueStorage {
414
- get<T>(key: string): Promise<T | undefined>;
415
- set<T>(key: string, value: T): Promise<void>;
416
- delete(key: string): Promise<void>;
417
- }
418
- interface TriggerContext {
419
- id: string;
420
- environment: string;
421
- apiKey: string;
422
- organizationId: string;
423
- logger: TriggerLogger;
424
- isTest: boolean;
425
- sendEvent(key: string, event: TriggerCustomEvent): Promise<void>;
426
- waitFor(key: string, options: WaitForOptions): Promise<void>;
427
- waitUntil(key: string, date: Date): Promise<void>;
428
- runOnce<T extends TriggerRunOnceCallback>(key: string, callback: T): Promise<Awaited<ReturnType<T>>>;
429
- runOnceLocalOnly<T extends TriggerRunOnceCallback>(key: string, callback: T): Promise<Awaited<ReturnType<T>>>;
430
- fetch: TriggerFetch;
431
- kv: TriggerKeyValueStorage;
432
- globalKv: TriggerKeyValueStorage;
433
- runKv: TriggerKeyValueStorage;
434
- }
435
- interface TriggerLogger {
436
- debug(message: string, properties?: Record<string, any>): Promise<void>;
437
- info(message: string, properties?: Record<string, any>): Promise<void>;
438
- warn(message: string, properties?: Record<string, any>): Promise<void>;
439
- error(message: string, properties?: Record<string, any>): Promise<void>;
1413
+ type CachedTask = z.infer<typeof CachedTaskSchema>;
1414
+ declare const RunTaskOptionsSchema: z.ZodObject<{
1415
+ name: z.ZodString;
1416
+ icon: z.ZodOptional<z.ZodString>;
1417
+ displayKey: z.ZodOptional<z.ZodString>;
1418
+ noop: z.ZodDefault<z.ZodBoolean>;
1419
+ delayUntil: z.ZodOptional<z.ZodDate>;
1420
+ description: z.ZodOptional<z.ZodString>;
1421
+ properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
1422
+ label: z.ZodString;
1423
+ text: z.ZodString;
1424
+ url: z.ZodOptional<z.ZodString>;
1425
+ }, "strip", z.ZodTypeAny, {
1426
+ url?: string | undefined;
1427
+ label: string;
1428
+ text: string;
1429
+ }, {
1430
+ url?: string | undefined;
1431
+ label: string;
1432
+ text: string;
1433
+ }>, "many">>;
1434
+ params: z.ZodOptional<z.ZodType<SerializableJson, z.ZodTypeDef, SerializableJson>>;
1435
+ trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1436
+ type: z.ZodLiteral<"dynamic">;
1437
+ id: z.ZodString;
1438
+ }, "strip", z.ZodTypeAny, {
1439
+ id: string;
1440
+ type: "dynamic";
1441
+ }, {
1442
+ id: string;
1443
+ type: "dynamic";
1444
+ }>, z.ZodObject<{
1445
+ type: z.ZodLiteral<"static">;
1446
+ title: z.ZodString;
1447
+ properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
1448
+ label: z.ZodString;
1449
+ text: z.ZodString;
1450
+ url: z.ZodOptional<z.ZodString>;
1451
+ }, "strip", z.ZodTypeAny, {
1452
+ url?: string | undefined;
1453
+ label: string;
1454
+ text: string;
1455
+ }, {
1456
+ url?: string | undefined;
1457
+ label: string;
1458
+ text: string;
1459
+ }>, "many">>;
1460
+ rule: z.ZodObject<{
1461
+ event: z.ZodString;
1462
+ source: z.ZodString;
1463
+ payload: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
1464
+ context: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
1465
+ }, "strip", z.ZodTypeAny, {
1466
+ payload?: EventFilter | undefined;
1467
+ context?: EventFilter | undefined;
1468
+ event: string;
1469
+ source: string;
1470
+ }, {
1471
+ payload?: EventFilter | undefined;
1472
+ context?: EventFilter | undefined;
1473
+ event: string;
1474
+ source: string;
1475
+ }>;
1476
+ }, "strip", z.ZodTypeAny, {
1477
+ properties?: {
1478
+ url?: string | undefined;
1479
+ label: string;
1480
+ text: string;
1481
+ }[] | undefined;
1482
+ type: "static";
1483
+ title: string;
1484
+ rule: {
1485
+ payload?: EventFilter | undefined;
1486
+ context?: EventFilter | undefined;
1487
+ event: string;
1488
+ source: string;
1489
+ };
1490
+ }, {
1491
+ properties?: {
1492
+ url?: string | undefined;
1493
+ label: string;
1494
+ text: string;
1495
+ }[] | undefined;
1496
+ type: "static";
1497
+ title: string;
1498
+ rule: {
1499
+ payload?: EventFilter | undefined;
1500
+ context?: EventFilter | undefined;
1501
+ event: string;
1502
+ source: string;
1503
+ };
1504
+ }>, z.ZodObject<{
1505
+ type: z.ZodLiteral<"scheduled">;
1506
+ schedule: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1507
+ type: z.ZodLiteral<"interval">;
1508
+ options: z.ZodObject<{
1509
+ seconds: z.ZodNumber;
1510
+ }, "strip", z.ZodTypeAny, {
1511
+ seconds: number;
1512
+ }, {
1513
+ seconds: number;
1514
+ }>;
1515
+ metadata: z.ZodAny;
1516
+ }, "strip", z.ZodTypeAny, {
1517
+ metadata?: any;
1518
+ options: {
1519
+ seconds: number;
1520
+ };
1521
+ type: "interval";
1522
+ }, {
1523
+ metadata?: any;
1524
+ options: {
1525
+ seconds: number;
1526
+ };
1527
+ type: "interval";
1528
+ }>, z.ZodObject<{
1529
+ type: z.ZodLiteral<"cron">;
1530
+ options: z.ZodObject<{
1531
+ cron: z.ZodString;
1532
+ }, "strip", z.ZodTypeAny, {
1533
+ cron: string;
1534
+ }, {
1535
+ cron: string;
1536
+ }>;
1537
+ metadata: z.ZodAny;
1538
+ }, "strip", z.ZodTypeAny, {
1539
+ metadata?: any;
1540
+ options: {
1541
+ cron: string;
1542
+ };
1543
+ type: "cron";
1544
+ }, {
1545
+ metadata?: any;
1546
+ options: {
1547
+ cron: string;
1548
+ };
1549
+ type: "cron";
1550
+ }>]>;
1551
+ }, "strip", z.ZodTypeAny, {
1552
+ type: "scheduled";
1553
+ schedule: {
1554
+ metadata?: any;
1555
+ options: {
1556
+ cron: string;
1557
+ };
1558
+ type: "cron";
1559
+ } | {
1560
+ metadata?: any;
1561
+ options: {
1562
+ seconds: number;
1563
+ };
1564
+ type: "interval";
1565
+ };
1566
+ }, {
1567
+ type: "scheduled";
1568
+ schedule: {
1569
+ metadata?: any;
1570
+ options: {
1571
+ cron: string;
1572
+ };
1573
+ type: "cron";
1574
+ } | {
1575
+ metadata?: any;
1576
+ options: {
1577
+ seconds: number;
1578
+ };
1579
+ type: "interval";
1580
+ };
1581
+ }>]>>;
1582
+ redact: z.ZodOptional<z.ZodObject<{
1583
+ paths: z.ZodArray<z.ZodString, "many">;
1584
+ }, "strip", z.ZodTypeAny, {
1585
+ paths: string[];
1586
+ }, {
1587
+ paths: string[];
1588
+ }>>;
1589
+ connectionKey: z.ZodOptional<z.ZodString>;
1590
+ style: z.ZodOptional<z.ZodObject<{
1591
+ style: z.ZodEnum<["normal", "minimal"]>;
1592
+ variant: z.ZodOptional<z.ZodString>;
1593
+ }, "strip", z.ZodTypeAny, {
1594
+ variant?: string | undefined;
1595
+ style: "normal" | "minimal";
1596
+ }, {
1597
+ variant?: string | undefined;
1598
+ style: "normal" | "minimal";
1599
+ }>>;
1600
+ retry: z.ZodOptional<z.ZodObject<{
1601
+ limit: z.ZodOptional<z.ZodNumber>;
1602
+ factor: z.ZodOptional<z.ZodNumber>;
1603
+ minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
1604
+ maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
1605
+ randomize: z.ZodOptional<z.ZodBoolean>;
1606
+ }, "strip", z.ZodTypeAny, {
1607
+ limit?: number | undefined;
1608
+ factor?: number | undefined;
1609
+ minTimeoutInMs?: number | undefined;
1610
+ maxTimeoutInMs?: number | undefined;
1611
+ randomize?: boolean | undefined;
1612
+ }, {
1613
+ limit?: number | undefined;
1614
+ factor?: number | undefined;
1615
+ minTimeoutInMs?: number | undefined;
1616
+ maxTimeoutInMs?: number | undefined;
1617
+ randomize?: boolean | undefined;
1618
+ }>>;
1619
+ }, "strip", z.ZodTypeAny, {
1620
+ icon?: string | undefined;
1621
+ delayUntil?: Date | undefined;
1622
+ description?: string | undefined;
1623
+ params?: SerializableJson;
1624
+ properties?: {
1625
+ url?: string | undefined;
1626
+ label: string;
1627
+ text: string;
1628
+ }[] | undefined;
1629
+ style?: {
1630
+ variant?: string | undefined;
1631
+ style: "normal" | "minimal";
1632
+ } | undefined;
1633
+ trigger?: {
1634
+ id: string;
1635
+ type: "dynamic";
1636
+ } | {
1637
+ properties?: {
1638
+ url?: string | undefined;
1639
+ label: string;
1640
+ text: string;
1641
+ }[] | undefined;
1642
+ type: "static";
1643
+ title: string;
1644
+ rule: {
1645
+ payload?: EventFilter | undefined;
1646
+ context?: EventFilter | undefined;
1647
+ event: string;
1648
+ source: string;
1649
+ };
1650
+ } | {
1651
+ type: "scheduled";
1652
+ schedule: {
1653
+ metadata?: any;
1654
+ options: {
1655
+ cron: string;
1656
+ };
1657
+ type: "cron";
1658
+ } | {
1659
+ metadata?: any;
1660
+ options: {
1661
+ seconds: number;
1662
+ };
1663
+ type: "interval";
1664
+ };
1665
+ } | undefined;
1666
+ displayKey?: string | undefined;
1667
+ redact?: {
1668
+ paths: string[];
1669
+ } | undefined;
1670
+ connectionKey?: string | undefined;
1671
+ retry?: {
1672
+ limit?: number | undefined;
1673
+ factor?: number | undefined;
1674
+ minTimeoutInMs?: number | undefined;
1675
+ maxTimeoutInMs?: number | undefined;
1676
+ randomize?: boolean | undefined;
1677
+ } | undefined;
1678
+ name: string;
1679
+ noop: boolean;
1680
+ }, {
1681
+ icon?: string | undefined;
1682
+ noop?: boolean | undefined;
1683
+ delayUntil?: Date | undefined;
1684
+ description?: string | undefined;
1685
+ params?: SerializableJson;
1686
+ properties?: {
1687
+ url?: string | undefined;
1688
+ label: string;
1689
+ text: string;
1690
+ }[] | undefined;
1691
+ style?: {
1692
+ variant?: string | undefined;
1693
+ style: "normal" | "minimal";
1694
+ } | undefined;
1695
+ trigger?: {
1696
+ id: string;
1697
+ type: "dynamic";
1698
+ } | {
1699
+ properties?: {
1700
+ url?: string | undefined;
1701
+ label: string;
1702
+ text: string;
1703
+ }[] | undefined;
1704
+ type: "static";
1705
+ title: string;
1706
+ rule: {
1707
+ payload?: EventFilter | undefined;
1708
+ context?: EventFilter | undefined;
1709
+ event: string;
1710
+ source: string;
1711
+ };
1712
+ } | {
1713
+ type: "scheduled";
1714
+ schedule: {
1715
+ metadata?: any;
1716
+ options: {
1717
+ cron: string;
1718
+ };
1719
+ type: "cron";
1720
+ } | {
1721
+ metadata?: any;
1722
+ options: {
1723
+ seconds: number;
1724
+ };
1725
+ type: "interval";
1726
+ };
1727
+ } | undefined;
1728
+ displayKey?: string | undefined;
1729
+ redact?: {
1730
+ paths: string[];
1731
+ } | undefined;
1732
+ connectionKey?: string | undefined;
1733
+ retry?: {
1734
+ limit?: number | undefined;
1735
+ factor?: number | undefined;
1736
+ minTimeoutInMs?: number | undefined;
1737
+ maxTimeoutInMs?: number | undefined;
1738
+ randomize?: boolean | undefined;
1739
+ } | undefined;
1740
+ name: string;
1741
+ }>;
1742
+ type RunTaskOptions = z.input<typeof RunTaskOptionsSchema>;
1743
+ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
1744
+ name: z.ZodString;
1745
+ icon: z.ZodOptional<z.ZodString>;
1746
+ displayKey: z.ZodOptional<z.ZodString>;
1747
+ noop: z.ZodDefault<z.ZodBoolean>;
1748
+ delayUntil: z.ZodOptional<z.ZodDate>;
1749
+ description: z.ZodOptional<z.ZodString>;
1750
+ properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
1751
+ label: z.ZodString;
1752
+ text: z.ZodString;
1753
+ url: z.ZodOptional<z.ZodString>;
1754
+ }, "strip", z.ZodTypeAny, {
1755
+ url?: string | undefined;
1756
+ label: string;
1757
+ text: string;
1758
+ }, {
1759
+ url?: string | undefined;
1760
+ label: string;
1761
+ text: string;
1762
+ }>, "many">>;
1763
+ params: z.ZodOptional<z.ZodType<SerializableJson, z.ZodTypeDef, SerializableJson>>;
1764
+ trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1765
+ type: z.ZodLiteral<"dynamic">;
1766
+ id: z.ZodString;
1767
+ }, "strip", z.ZodTypeAny, {
1768
+ id: string;
1769
+ type: "dynamic";
1770
+ }, {
1771
+ id: string;
1772
+ type: "dynamic";
1773
+ }>, z.ZodObject<{
1774
+ type: z.ZodLiteral<"static">;
1775
+ title: z.ZodString;
1776
+ properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
1777
+ label: z.ZodString;
1778
+ text: z.ZodString;
1779
+ url: z.ZodOptional<z.ZodString>;
1780
+ }, "strip", z.ZodTypeAny, {
1781
+ url?: string | undefined;
1782
+ label: string;
1783
+ text: string;
1784
+ }, {
1785
+ url?: string | undefined;
1786
+ label: string;
1787
+ text: string;
1788
+ }>, "many">>;
1789
+ rule: z.ZodObject<{
1790
+ event: z.ZodString;
1791
+ source: z.ZodString;
1792
+ payload: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
1793
+ context: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
1794
+ }, "strip", z.ZodTypeAny, {
1795
+ payload?: EventFilter | undefined;
1796
+ context?: EventFilter | undefined;
1797
+ event: string;
1798
+ source: string;
1799
+ }, {
1800
+ payload?: EventFilter | undefined;
1801
+ context?: EventFilter | undefined;
1802
+ event: string;
1803
+ source: string;
1804
+ }>;
1805
+ }, "strip", z.ZodTypeAny, {
1806
+ properties?: {
1807
+ url?: string | undefined;
1808
+ label: string;
1809
+ text: string;
1810
+ }[] | undefined;
1811
+ type: "static";
1812
+ title: string;
1813
+ rule: {
1814
+ payload?: EventFilter | undefined;
1815
+ context?: EventFilter | undefined;
1816
+ event: string;
1817
+ source: string;
1818
+ };
1819
+ }, {
1820
+ properties?: {
1821
+ url?: string | undefined;
1822
+ label: string;
1823
+ text: string;
1824
+ }[] | undefined;
1825
+ type: "static";
1826
+ title: string;
1827
+ rule: {
1828
+ payload?: EventFilter | undefined;
1829
+ context?: EventFilter | undefined;
1830
+ event: string;
1831
+ source: string;
1832
+ };
1833
+ }>, z.ZodObject<{
1834
+ type: z.ZodLiteral<"scheduled">;
1835
+ schedule: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1836
+ type: z.ZodLiteral<"interval">;
1837
+ options: z.ZodObject<{
1838
+ seconds: z.ZodNumber;
1839
+ }, "strip", z.ZodTypeAny, {
1840
+ seconds: number;
1841
+ }, {
1842
+ seconds: number;
1843
+ }>;
1844
+ metadata: z.ZodAny;
1845
+ }, "strip", z.ZodTypeAny, {
1846
+ metadata?: any;
1847
+ options: {
1848
+ seconds: number;
1849
+ };
1850
+ type: "interval";
1851
+ }, {
1852
+ metadata?: any;
1853
+ options: {
1854
+ seconds: number;
1855
+ };
1856
+ type: "interval";
1857
+ }>, z.ZodObject<{
1858
+ type: z.ZodLiteral<"cron">;
1859
+ options: z.ZodObject<{
1860
+ cron: z.ZodString;
1861
+ }, "strip", z.ZodTypeAny, {
1862
+ cron: string;
1863
+ }, {
1864
+ cron: string;
1865
+ }>;
1866
+ metadata: z.ZodAny;
1867
+ }, "strip", z.ZodTypeAny, {
1868
+ metadata?: any;
1869
+ options: {
1870
+ cron: string;
1871
+ };
1872
+ type: "cron";
1873
+ }, {
1874
+ metadata?: any;
1875
+ options: {
1876
+ cron: string;
1877
+ };
1878
+ type: "cron";
1879
+ }>]>;
1880
+ }, "strip", z.ZodTypeAny, {
1881
+ type: "scheduled";
1882
+ schedule: {
1883
+ metadata?: any;
1884
+ options: {
1885
+ cron: string;
1886
+ };
1887
+ type: "cron";
1888
+ } | {
1889
+ metadata?: any;
1890
+ options: {
1891
+ seconds: number;
1892
+ };
1893
+ type: "interval";
1894
+ };
1895
+ }, {
1896
+ type: "scheduled";
1897
+ schedule: {
1898
+ metadata?: any;
1899
+ options: {
1900
+ cron: string;
1901
+ };
1902
+ type: "cron";
1903
+ } | {
1904
+ metadata?: any;
1905
+ options: {
1906
+ seconds: number;
1907
+ };
1908
+ type: "interval";
1909
+ };
1910
+ }>]>>;
1911
+ redact: z.ZodOptional<z.ZodObject<{
1912
+ paths: z.ZodArray<z.ZodString, "many">;
1913
+ }, "strip", z.ZodTypeAny, {
1914
+ paths: string[];
1915
+ }, {
1916
+ paths: string[];
1917
+ }>>;
1918
+ connectionKey: z.ZodOptional<z.ZodString>;
1919
+ style: z.ZodOptional<z.ZodObject<{
1920
+ style: z.ZodEnum<["normal", "minimal"]>;
1921
+ variant: z.ZodOptional<z.ZodString>;
1922
+ }, "strip", z.ZodTypeAny, {
1923
+ variant?: string | undefined;
1924
+ style: "normal" | "minimal";
1925
+ }, {
1926
+ variant?: string | undefined;
1927
+ style: "normal" | "minimal";
1928
+ }>>;
1929
+ retry: z.ZodOptional<z.ZodObject<{
1930
+ limit: z.ZodOptional<z.ZodNumber>;
1931
+ factor: z.ZodOptional<z.ZodNumber>;
1932
+ minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
1933
+ maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
1934
+ randomize: z.ZodOptional<z.ZodBoolean>;
1935
+ }, "strip", z.ZodTypeAny, {
1936
+ limit?: number | undefined;
1937
+ factor?: number | undefined;
1938
+ minTimeoutInMs?: number | undefined;
1939
+ maxTimeoutInMs?: number | undefined;
1940
+ randomize?: boolean | undefined;
1941
+ }, {
1942
+ limit?: number | undefined;
1943
+ factor?: number | undefined;
1944
+ minTimeoutInMs?: number | undefined;
1945
+ maxTimeoutInMs?: number | undefined;
1946
+ randomize?: boolean | undefined;
1947
+ }>>;
1948
+ }, {
1949
+ idempotencyKey: z.ZodString;
1950
+ parentId: z.ZodOptional<z.ZodString>;
1951
+ }>, "strip", z.ZodTypeAny, {
1952
+ icon?: string | undefined;
1953
+ delayUntil?: Date | undefined;
1954
+ description?: string | undefined;
1955
+ params?: SerializableJson;
1956
+ properties?: {
1957
+ url?: string | undefined;
1958
+ label: string;
1959
+ text: string;
1960
+ }[] | undefined;
1961
+ parentId?: string | undefined;
1962
+ style?: {
1963
+ variant?: string | undefined;
1964
+ style: "normal" | "minimal";
1965
+ } | undefined;
1966
+ trigger?: {
1967
+ id: string;
1968
+ type: "dynamic";
1969
+ } | {
1970
+ properties?: {
1971
+ url?: string | undefined;
1972
+ label: string;
1973
+ text: string;
1974
+ }[] | undefined;
1975
+ type: "static";
1976
+ title: string;
1977
+ rule: {
1978
+ payload?: EventFilter | undefined;
1979
+ context?: EventFilter | undefined;
1980
+ event: string;
1981
+ source: string;
1982
+ };
1983
+ } | {
1984
+ type: "scheduled";
1985
+ schedule: {
1986
+ metadata?: any;
1987
+ options: {
1988
+ cron: string;
1989
+ };
1990
+ type: "cron";
1991
+ } | {
1992
+ metadata?: any;
1993
+ options: {
1994
+ seconds: number;
1995
+ };
1996
+ type: "interval";
1997
+ };
1998
+ } | undefined;
1999
+ displayKey?: string | undefined;
2000
+ redact?: {
2001
+ paths: string[];
2002
+ } | undefined;
2003
+ connectionKey?: string | undefined;
2004
+ retry?: {
2005
+ limit?: number | undefined;
2006
+ factor?: number | undefined;
2007
+ minTimeoutInMs?: number | undefined;
2008
+ maxTimeoutInMs?: number | undefined;
2009
+ randomize?: boolean | undefined;
2010
+ } | undefined;
2011
+ name: string;
2012
+ noop: boolean;
2013
+ idempotencyKey: string;
2014
+ }, {
2015
+ icon?: string | undefined;
2016
+ noop?: boolean | undefined;
2017
+ delayUntil?: Date | undefined;
2018
+ description?: string | undefined;
2019
+ params?: SerializableJson;
2020
+ properties?: {
2021
+ url?: string | undefined;
2022
+ label: string;
2023
+ text: string;
2024
+ }[] | undefined;
2025
+ parentId?: string | undefined;
2026
+ style?: {
2027
+ variant?: string | undefined;
2028
+ style: "normal" | "minimal";
2029
+ } | undefined;
2030
+ trigger?: {
2031
+ id: string;
2032
+ type: "dynamic";
2033
+ } | {
2034
+ properties?: {
2035
+ url?: string | undefined;
2036
+ label: string;
2037
+ text: string;
2038
+ }[] | undefined;
2039
+ type: "static";
2040
+ title: string;
2041
+ rule: {
2042
+ payload?: EventFilter | undefined;
2043
+ context?: EventFilter | undefined;
2044
+ event: string;
2045
+ source: string;
2046
+ };
2047
+ } | {
2048
+ type: "scheduled";
2049
+ schedule: {
2050
+ metadata?: any;
2051
+ options: {
2052
+ cron: string;
2053
+ };
2054
+ type: "cron";
2055
+ } | {
2056
+ metadata?: any;
2057
+ options: {
2058
+ seconds: number;
2059
+ };
2060
+ type: "interval";
2061
+ };
2062
+ } | undefined;
2063
+ displayKey?: string | undefined;
2064
+ redact?: {
2065
+ paths: string[];
2066
+ } | undefined;
2067
+ connectionKey?: string | undefined;
2068
+ retry?: {
2069
+ limit?: number | undefined;
2070
+ factor?: number | undefined;
2071
+ minTimeoutInMs?: number | undefined;
2072
+ maxTimeoutInMs?: number | undefined;
2073
+ randomize?: boolean | undefined;
2074
+ } | undefined;
2075
+ name: string;
2076
+ idempotencyKey: string;
2077
+ }>;
2078
+ type RunTaskBodyInput = z.infer<typeof RunTaskBodyInputSchema>;
2079
+ declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.extendShape<{
2080
+ name: z.ZodString;
2081
+ icon: z.ZodOptional<z.ZodString>;
2082
+ displayKey: z.ZodOptional<z.ZodString>;
2083
+ noop: z.ZodDefault<z.ZodBoolean>;
2084
+ delayUntil: z.ZodOptional<z.ZodDate>;
2085
+ description: z.ZodOptional<z.ZodString>;
2086
+ properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
2087
+ label: z.ZodString;
2088
+ text: z.ZodString;
2089
+ url: z.ZodOptional<z.ZodString>;
2090
+ }, "strip", z.ZodTypeAny, {
2091
+ url?: string | undefined;
2092
+ label: string;
2093
+ text: string;
2094
+ }, {
2095
+ url?: string | undefined;
2096
+ label: string;
2097
+ text: string;
2098
+ }>, "many">>;
2099
+ params: z.ZodOptional<z.ZodType<SerializableJson, z.ZodTypeDef, SerializableJson>>;
2100
+ trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2101
+ type: z.ZodLiteral<"dynamic">;
2102
+ id: z.ZodString;
2103
+ }, "strip", z.ZodTypeAny, {
2104
+ id: string;
2105
+ type: "dynamic";
2106
+ }, {
2107
+ id: string;
2108
+ type: "dynamic";
2109
+ }>, z.ZodObject<{
2110
+ type: z.ZodLiteral<"static">;
2111
+ title: z.ZodString;
2112
+ properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
2113
+ label: z.ZodString;
2114
+ text: z.ZodString;
2115
+ url: z.ZodOptional<z.ZodString>;
2116
+ }, "strip", z.ZodTypeAny, {
2117
+ url?: string | undefined;
2118
+ label: string;
2119
+ text: string;
2120
+ }, {
2121
+ url?: string | undefined;
2122
+ label: string;
2123
+ text: string;
2124
+ }>, "many">>;
2125
+ rule: z.ZodObject<{
2126
+ event: z.ZodString;
2127
+ source: z.ZodString;
2128
+ payload: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
2129
+ context: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
2130
+ }, "strip", z.ZodTypeAny, {
2131
+ payload?: EventFilter | undefined;
2132
+ context?: EventFilter | undefined;
2133
+ event: string;
2134
+ source: string;
2135
+ }, {
2136
+ payload?: EventFilter | undefined;
2137
+ context?: EventFilter | undefined;
2138
+ event: string;
2139
+ source: string;
2140
+ }>;
2141
+ }, "strip", z.ZodTypeAny, {
2142
+ properties?: {
2143
+ url?: string | undefined;
2144
+ label: string;
2145
+ text: string;
2146
+ }[] | undefined;
2147
+ type: "static";
2148
+ title: string;
2149
+ rule: {
2150
+ payload?: EventFilter | undefined;
2151
+ context?: EventFilter | undefined;
2152
+ event: string;
2153
+ source: string;
2154
+ };
2155
+ }, {
2156
+ properties?: {
2157
+ url?: string | undefined;
2158
+ label: string;
2159
+ text: string;
2160
+ }[] | undefined;
2161
+ type: "static";
2162
+ title: string;
2163
+ rule: {
2164
+ payload?: EventFilter | undefined;
2165
+ context?: EventFilter | undefined;
2166
+ event: string;
2167
+ source: string;
2168
+ };
2169
+ }>, z.ZodObject<{
2170
+ type: z.ZodLiteral<"scheduled">;
2171
+ schedule: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2172
+ type: z.ZodLiteral<"interval">;
2173
+ options: z.ZodObject<{
2174
+ seconds: z.ZodNumber;
2175
+ }, "strip", z.ZodTypeAny, {
2176
+ seconds: number;
2177
+ }, {
2178
+ seconds: number;
2179
+ }>;
2180
+ metadata: z.ZodAny;
2181
+ }, "strip", z.ZodTypeAny, {
2182
+ metadata?: any;
2183
+ options: {
2184
+ seconds: number;
2185
+ };
2186
+ type: "interval";
2187
+ }, {
2188
+ metadata?: any;
2189
+ options: {
2190
+ seconds: number;
2191
+ };
2192
+ type: "interval";
2193
+ }>, z.ZodObject<{
2194
+ type: z.ZodLiteral<"cron">;
2195
+ options: z.ZodObject<{
2196
+ cron: z.ZodString;
2197
+ }, "strip", z.ZodTypeAny, {
2198
+ cron: string;
2199
+ }, {
2200
+ cron: string;
2201
+ }>;
2202
+ metadata: z.ZodAny;
2203
+ }, "strip", z.ZodTypeAny, {
2204
+ metadata?: any;
2205
+ options: {
2206
+ cron: string;
2207
+ };
2208
+ type: "cron";
2209
+ }, {
2210
+ metadata?: any;
2211
+ options: {
2212
+ cron: string;
2213
+ };
2214
+ type: "cron";
2215
+ }>]>;
2216
+ }, "strip", z.ZodTypeAny, {
2217
+ type: "scheduled";
2218
+ schedule: {
2219
+ metadata?: any;
2220
+ options: {
2221
+ cron: string;
2222
+ };
2223
+ type: "cron";
2224
+ } | {
2225
+ metadata?: any;
2226
+ options: {
2227
+ seconds: number;
2228
+ };
2229
+ type: "interval";
2230
+ };
2231
+ }, {
2232
+ type: "scheduled";
2233
+ schedule: {
2234
+ metadata?: any;
2235
+ options: {
2236
+ cron: string;
2237
+ };
2238
+ type: "cron";
2239
+ } | {
2240
+ metadata?: any;
2241
+ options: {
2242
+ seconds: number;
2243
+ };
2244
+ type: "interval";
2245
+ };
2246
+ }>]>>;
2247
+ redact: z.ZodOptional<z.ZodObject<{
2248
+ paths: z.ZodArray<z.ZodString, "many">;
2249
+ }, "strip", z.ZodTypeAny, {
2250
+ paths: string[];
2251
+ }, {
2252
+ paths: string[];
2253
+ }>>;
2254
+ connectionKey: z.ZodOptional<z.ZodString>;
2255
+ style: z.ZodOptional<z.ZodObject<{
2256
+ style: z.ZodEnum<["normal", "minimal"]>;
2257
+ variant: z.ZodOptional<z.ZodString>;
2258
+ }, "strip", z.ZodTypeAny, {
2259
+ variant?: string | undefined;
2260
+ style: "normal" | "minimal";
2261
+ }, {
2262
+ variant?: string | undefined;
2263
+ style: "normal" | "minimal";
2264
+ }>>;
2265
+ retry: z.ZodOptional<z.ZodObject<{
2266
+ limit: z.ZodOptional<z.ZodNumber>;
2267
+ factor: z.ZodOptional<z.ZodNumber>;
2268
+ minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
2269
+ maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
2270
+ randomize: z.ZodOptional<z.ZodBoolean>;
2271
+ }, "strip", z.ZodTypeAny, {
2272
+ limit?: number | undefined;
2273
+ factor?: number | undefined;
2274
+ minTimeoutInMs?: number | undefined;
2275
+ maxTimeoutInMs?: number | undefined;
2276
+ randomize?: boolean | undefined;
2277
+ }, {
2278
+ limit?: number | undefined;
2279
+ factor?: number | undefined;
2280
+ minTimeoutInMs?: number | undefined;
2281
+ maxTimeoutInMs?: number | undefined;
2282
+ randomize?: boolean | undefined;
2283
+ }>>;
2284
+ }, {
2285
+ idempotencyKey: z.ZodString;
2286
+ parentId: z.ZodOptional<z.ZodString>;
2287
+ }>, "description" | "params" | "properties">, {
2288
+ output: z.ZodEffects<z.ZodOptional<z.ZodType<SerializableJson, z.ZodTypeDef, SerializableJson>>, string | number | boolean | {
2289
+ [key: string]: DeserializedJson;
2290
+ } | DeserializedJson[] | null, SerializableJson>;
2291
+ }>, "strip", z.ZodTypeAny, {
2292
+ description?: string | undefined;
2293
+ params?: SerializableJson;
2294
+ properties?: {
2295
+ url?: string | undefined;
2296
+ label: string;
2297
+ text: string;
2298
+ }[] | undefined;
2299
+ output: string | number | boolean | {
2300
+ [key: string]: DeserializedJson;
2301
+ } | DeserializedJson[] | null;
2302
+ }, {
2303
+ description?: string | undefined;
2304
+ params?: SerializableJson;
2305
+ properties?: {
2306
+ url?: string | undefined;
2307
+ label: string;
2308
+ text: string;
2309
+ }[] | undefined;
2310
+ output?: SerializableJson;
2311
+ }>;
2312
+ type CompleteTaskBodyInput = z.input<typeof CompleteTaskBodyInputSchema>;
2313
+ declare const FailTaskBodyInputSchema: z.ZodObject<{
2314
+ error: z.ZodObject<{
2315
+ message: z.ZodString;
2316
+ name: z.ZodOptional<z.ZodString>;
2317
+ stack: z.ZodOptional<z.ZodString>;
2318
+ }, "strip", z.ZodTypeAny, {
2319
+ name?: string | undefined;
2320
+ stack?: string | undefined;
2321
+ message: string;
2322
+ }, {
2323
+ name?: string | undefined;
2324
+ stack?: string | undefined;
2325
+ message: string;
2326
+ }>;
2327
+ }, "strip", z.ZodTypeAny, {
2328
+ error: {
2329
+ name?: string | undefined;
2330
+ stack?: string | undefined;
2331
+ message: string;
2332
+ };
2333
+ }, {
2334
+ error: {
2335
+ name?: string | undefined;
2336
+ stack?: string | undefined;
2337
+ message: string;
2338
+ };
2339
+ }>;
2340
+ type FailTaskBodyInput = z.infer<typeof FailTaskBodyInputSchema>;
2341
+ declare const NormalizedRequestSchema: z.ZodObject<{
2342
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
2343
+ method: z.ZodString;
2344
+ query: z.ZodRecord<z.ZodString, z.ZodString>;
2345
+ url: z.ZodString;
2346
+ body: z.ZodAny;
2347
+ }, "strip", z.ZodTypeAny, {
2348
+ body?: any;
2349
+ url: string;
2350
+ method: string;
2351
+ headers: Record<string, string>;
2352
+ query: Record<string, string>;
2353
+ }, {
2354
+ body?: any;
2355
+ url: string;
2356
+ method: string;
2357
+ headers: Record<string, string>;
2358
+ query: Record<string, string>;
2359
+ }>;
2360
+ type NormalizedRequest = z.infer<typeof NormalizedRequestSchema>;
2361
+ declare const NormalizedResponseSchema: z.ZodObject<{
2362
+ status: z.ZodNumber;
2363
+ body: z.ZodAny;
2364
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2365
+ }, "strip", z.ZodTypeAny, {
2366
+ headers?: Record<string, string> | undefined;
2367
+ body?: any;
2368
+ status: number;
2369
+ }, {
2370
+ headers?: Record<string, string> | undefined;
2371
+ body?: any;
2372
+ status: number;
2373
+ }>;
2374
+ type NormalizedResponse = z.infer<typeof NormalizedResponseSchema>;
2375
+ declare const RegisterTriggerBodySchema: z.ZodObject<{
2376
+ rule: z.ZodObject<{
2377
+ event: z.ZodString;
2378
+ source: z.ZodString;
2379
+ payload: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
2380
+ context: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
2381
+ }, "strip", z.ZodTypeAny, {
2382
+ payload?: EventFilter | undefined;
2383
+ context?: EventFilter | undefined;
2384
+ event: string;
2385
+ source: string;
2386
+ }, {
2387
+ payload?: EventFilter | undefined;
2388
+ context?: EventFilter | undefined;
2389
+ event: string;
2390
+ source: string;
2391
+ }>;
2392
+ source: z.ZodObject<{
2393
+ channel: z.ZodEnum<["HTTP", "SQS", "SMTP"]>;
2394
+ key: z.ZodString;
2395
+ params: z.ZodAny;
2396
+ events: z.ZodArray<z.ZodString, "many">;
2397
+ clientId: z.ZodOptional<z.ZodString>;
2398
+ }, "strip", z.ZodTypeAny, {
2399
+ params?: any;
2400
+ clientId?: string | undefined;
2401
+ key: string;
2402
+ channel: "HTTP" | "SMTP" | "SQS";
2403
+ events: string[];
2404
+ }, {
2405
+ params?: any;
2406
+ clientId?: string | undefined;
2407
+ key: string;
2408
+ channel: "HTTP" | "SMTP" | "SQS";
2409
+ events: string[];
2410
+ }>;
2411
+ }, "strip", z.ZodTypeAny, {
2412
+ source: {
2413
+ params?: any;
2414
+ clientId?: string | undefined;
2415
+ key: string;
2416
+ channel: "HTTP" | "SMTP" | "SQS";
2417
+ events: string[];
2418
+ };
2419
+ rule: {
2420
+ payload?: EventFilter | undefined;
2421
+ context?: EventFilter | undefined;
2422
+ event: string;
2423
+ source: string;
2424
+ };
2425
+ }, {
2426
+ source: {
2427
+ params?: any;
2428
+ clientId?: string | undefined;
2429
+ key: string;
2430
+ channel: "HTTP" | "SMTP" | "SQS";
2431
+ events: string[];
2432
+ };
2433
+ rule: {
2434
+ payload?: EventFilter | undefined;
2435
+ context?: EventFilter | undefined;
2436
+ event: string;
2437
+ source: string;
2438
+ };
2439
+ }>;
2440
+ type RegisterTriggerBody = z.infer<typeof RegisterTriggerBodySchema>;
2441
+
2442
+ declare const TriggerMetadataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2443
+ type: z.ZodLiteral<"dynamic">;
2444
+ id: z.ZodString;
2445
+ }, "strip", z.ZodTypeAny, {
2446
+ id: string;
2447
+ type: "dynamic";
2448
+ }, {
2449
+ id: string;
2450
+ type: "dynamic";
2451
+ }>, z.ZodObject<{
2452
+ type: z.ZodLiteral<"static">;
2453
+ title: z.ZodString;
2454
+ properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
2455
+ label: z.ZodString;
2456
+ text: z.ZodString;
2457
+ url: z.ZodOptional<z.ZodString>;
2458
+ }, "strip", z.ZodTypeAny, {
2459
+ url?: string | undefined;
2460
+ label: string;
2461
+ text: string;
2462
+ }, {
2463
+ url?: string | undefined;
2464
+ label: string;
2465
+ text: string;
2466
+ }>, "many">>;
2467
+ rule: z.ZodObject<{
2468
+ event: z.ZodString;
2469
+ source: z.ZodString;
2470
+ payload: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
2471
+ context: z.ZodOptional<z.ZodType<EventFilter, z.ZodTypeDef, EventFilter>>;
2472
+ }, "strip", z.ZodTypeAny, {
2473
+ payload?: EventFilter | undefined;
2474
+ context?: EventFilter | undefined;
2475
+ event: string;
2476
+ source: string;
2477
+ }, {
2478
+ payload?: EventFilter | undefined;
2479
+ context?: EventFilter | undefined;
2480
+ event: string;
2481
+ source: string;
2482
+ }>;
2483
+ }, "strip", z.ZodTypeAny, {
2484
+ properties?: {
2485
+ url?: string | undefined;
2486
+ label: string;
2487
+ text: string;
2488
+ }[] | undefined;
2489
+ type: "static";
2490
+ title: string;
2491
+ rule: {
2492
+ payload?: EventFilter | undefined;
2493
+ context?: EventFilter | undefined;
2494
+ event: string;
2495
+ source: string;
2496
+ };
2497
+ }, {
2498
+ properties?: {
2499
+ url?: string | undefined;
2500
+ label: string;
2501
+ text: string;
2502
+ }[] | undefined;
2503
+ type: "static";
2504
+ title: string;
2505
+ rule: {
2506
+ payload?: EventFilter | undefined;
2507
+ context?: EventFilter | undefined;
2508
+ event: string;
2509
+ source: string;
2510
+ };
2511
+ }>, z.ZodObject<{
2512
+ type: z.ZodLiteral<"scheduled">;
2513
+ schedule: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2514
+ type: z.ZodLiteral<"interval">;
2515
+ options: z.ZodObject<{
2516
+ seconds: z.ZodNumber;
2517
+ }, "strip", z.ZodTypeAny, {
2518
+ seconds: number;
2519
+ }, {
2520
+ seconds: number;
2521
+ }>;
2522
+ metadata: z.ZodAny;
2523
+ }, "strip", z.ZodTypeAny, {
2524
+ metadata?: any;
2525
+ options: {
2526
+ seconds: number;
2527
+ };
2528
+ type: "interval";
2529
+ }, {
2530
+ metadata?: any;
2531
+ options: {
2532
+ seconds: number;
2533
+ };
2534
+ type: "interval";
2535
+ }>, z.ZodObject<{
2536
+ type: z.ZodLiteral<"cron">;
2537
+ options: z.ZodObject<{
2538
+ cron: z.ZodString;
2539
+ }, "strip", z.ZodTypeAny, {
2540
+ cron: string;
2541
+ }, {
2542
+ cron: string;
2543
+ }>;
2544
+ metadata: z.ZodAny;
2545
+ }, "strip", z.ZodTypeAny, {
2546
+ metadata?: any;
2547
+ options: {
2548
+ cron: string;
2549
+ };
2550
+ type: "cron";
2551
+ }, {
2552
+ metadata?: any;
2553
+ options: {
2554
+ cron: string;
2555
+ };
2556
+ type: "cron";
2557
+ }>]>;
2558
+ }, "strip", z.ZodTypeAny, {
2559
+ type: "scheduled";
2560
+ schedule: {
2561
+ metadata?: any;
2562
+ options: {
2563
+ cron: string;
2564
+ };
2565
+ type: "cron";
2566
+ } | {
2567
+ metadata?: any;
2568
+ options: {
2569
+ seconds: number;
2570
+ };
2571
+ type: "interval";
2572
+ };
2573
+ }, {
2574
+ type: "scheduled";
2575
+ schedule: {
2576
+ metadata?: any;
2577
+ options: {
2578
+ cron: string;
2579
+ };
2580
+ type: "cron";
2581
+ } | {
2582
+ metadata?: any;
2583
+ options: {
2584
+ seconds: number;
2585
+ };
2586
+ type: "interval";
2587
+ };
2588
+ }>]>;
2589
+ type TriggerMetadata = z.infer<typeof TriggerMetadataSchema>;
2590
+
2591
+ declare const ErrorWithStackSchema: z.ZodObject<{
2592
+ message: z.ZodString;
2593
+ name: z.ZodOptional<z.ZodString>;
2594
+ stack: z.ZodOptional<z.ZodString>;
2595
+ }, "strip", z.ZodTypeAny, {
2596
+ name?: string | undefined;
2597
+ stack?: string | undefined;
2598
+ message: string;
2599
+ }, {
2600
+ name?: string | undefined;
2601
+ stack?: string | undefined;
2602
+ message: string;
2603
+ }>;
2604
+ type ErrorWithStack = z.infer<typeof ErrorWithStackSchema>;
2605
+
2606
+ declare const DisplayPropertySchema: z.ZodObject<{
2607
+ label: z.ZodString;
2608
+ text: z.ZodString;
2609
+ url: z.ZodOptional<z.ZodString>;
2610
+ }, "strip", z.ZodTypeAny, {
2611
+ url?: string | undefined;
2612
+ label: string;
2613
+ text: string;
2614
+ }, {
2615
+ url?: string | undefined;
2616
+ label: string;
2617
+ text: string;
2618
+ }>;
2619
+ type DisplayProperty = z.infer<typeof DisplayPropertySchema>;
2620
+
2621
+ declare const ConnectionAuthSchema: z.ZodObject<{
2622
+ type: z.ZodEnum<["oauth2"]>;
2623
+ accessToken: z.ZodString;
2624
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2625
+ additionalFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2626
+ }, "strip", z.ZodTypeAny, {
2627
+ scopes?: string[] | undefined;
2628
+ additionalFields?: Record<string, string> | undefined;
2629
+ type: "oauth2";
2630
+ accessToken: string;
2631
+ }, {
2632
+ scopes?: string[] | undefined;
2633
+ additionalFields?: Record<string, string> | undefined;
2634
+ type: "oauth2";
2635
+ accessToken: string;
2636
+ }>;
2637
+ type ConnectionAuth = z.infer<typeof ConnectionAuthSchema>;
2638
+ declare const IntegrationMetadataSchema: z.ZodObject<{
2639
+ key: z.ZodString;
2640
+ title: z.ZodString;
2641
+ icon: z.ZodString;
2642
+ }, "strip", z.ZodTypeAny, {
2643
+ icon: string;
2644
+ key: string;
2645
+ title: string;
2646
+ }, {
2647
+ icon: string;
2648
+ key: string;
2649
+ title: string;
2650
+ }>;
2651
+ type IntegrationMetadata = z.infer<typeof IntegrationMetadataSchema>;
2652
+ declare const IntegrationConfigSchema: z.ZodObject<{
2653
+ id: z.ZodString;
2654
+ metadata: z.ZodObject<{
2655
+ key: z.ZodString;
2656
+ title: z.ZodString;
2657
+ icon: z.ZodString;
2658
+ }, "strip", z.ZodTypeAny, {
2659
+ icon: string;
2660
+ key: string;
2661
+ title: string;
2662
+ }, {
2663
+ icon: string;
2664
+ key: string;
2665
+ title: string;
2666
+ }>;
2667
+ }, "strip", z.ZodTypeAny, {
2668
+ id: string;
2669
+ metadata: {
2670
+ icon: string;
2671
+ key: string;
2672
+ title: string;
2673
+ };
2674
+ }, {
2675
+ id: string;
2676
+ metadata: {
2677
+ icon: string;
2678
+ key: string;
2679
+ title: string;
2680
+ };
2681
+ }>;
2682
+ type IntegrationConfig = z.infer<typeof IntegrationConfigSchema>;
2683
+
2684
+ declare const ScheduledPayloadSchema: z.ZodObject<{
2685
+ ts: z.ZodDate;
2686
+ lastTimestamp: z.ZodOptional<z.ZodDate>;
2687
+ }, "strip", z.ZodTypeAny, {
2688
+ lastTimestamp?: Date | undefined;
2689
+ ts: Date;
2690
+ }, {
2691
+ lastTimestamp?: Date | undefined;
2692
+ ts: Date;
2693
+ }>;
2694
+ type ScheduledPayload = z.infer<typeof ScheduledPayloadSchema>;
2695
+ declare const IntervalOptionsSchema: z.ZodObject<{
2696
+ seconds: z.ZodNumber;
2697
+ }, "strip", z.ZodTypeAny, {
2698
+ seconds: number;
2699
+ }, {
2700
+ seconds: number;
2701
+ }>;
2702
+ type IntervalOptions = z.infer<typeof IntervalOptionsSchema>;
2703
+ declare const CronOptionsSchema: z.ZodObject<{
2704
+ cron: z.ZodString;
2705
+ }, "strip", z.ZodTypeAny, {
2706
+ cron: string;
2707
+ }, {
2708
+ cron: string;
2709
+ }>;
2710
+ type CronOptions = z.infer<typeof CronOptionsSchema>;
2711
+ declare const ScheduleMetadataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2712
+ type: z.ZodLiteral<"interval">;
2713
+ options: z.ZodObject<{
2714
+ seconds: z.ZodNumber;
2715
+ }, "strip", z.ZodTypeAny, {
2716
+ seconds: number;
2717
+ }, {
2718
+ seconds: number;
2719
+ }>;
2720
+ metadata: z.ZodAny;
2721
+ }, "strip", z.ZodTypeAny, {
2722
+ metadata?: any;
2723
+ options: {
2724
+ seconds: number;
2725
+ };
2726
+ type: "interval";
2727
+ }, {
2728
+ metadata?: any;
2729
+ options: {
2730
+ seconds: number;
2731
+ };
2732
+ type: "interval";
2733
+ }>, z.ZodObject<{
2734
+ type: z.ZodLiteral<"cron">;
2735
+ options: z.ZodObject<{
2736
+ cron: z.ZodString;
2737
+ }, "strip", z.ZodTypeAny, {
2738
+ cron: string;
2739
+ }, {
2740
+ cron: string;
2741
+ }>;
2742
+ metadata: z.ZodAny;
2743
+ }, "strip", z.ZodTypeAny, {
2744
+ metadata?: any;
2745
+ options: {
2746
+ cron: string;
2747
+ };
2748
+ type: "cron";
2749
+ }, {
2750
+ metadata?: any;
2751
+ options: {
2752
+ cron: string;
2753
+ };
2754
+ type: "cron";
2755
+ }>]>;
2756
+ type ScheduleMetadata = z.infer<typeof ScheduleMetadataSchema>;
2757
+
2758
+ declare const MissingConnectionNotificationPayloadSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<z.extendShape<{
2759
+ id: z.ZodString;
2760
+ client: z.ZodObject<{
2761
+ id: z.ZodString;
2762
+ title: z.ZodString;
2763
+ scopes: z.ZodArray<z.ZodString, "many">;
2764
+ createdAt: z.ZodDate;
2765
+ updatedAt: z.ZodDate;
2766
+ integrationIdentifier: z.ZodString;
2767
+ integrationAuthMethod: z.ZodString;
2768
+ }, "strip", z.ZodTypeAny, {
2769
+ id: string;
2770
+ scopes: string[];
2771
+ title: string;
2772
+ createdAt: Date;
2773
+ updatedAt: Date;
2774
+ integrationIdentifier: string;
2775
+ integrationAuthMethod: string;
2776
+ }, {
2777
+ id: string;
2778
+ scopes: string[];
2779
+ title: string;
2780
+ createdAt: Date;
2781
+ updatedAt: Date;
2782
+ integrationIdentifier: string;
2783
+ integrationAuthMethod: string;
2784
+ }>;
2785
+ authorizationUrl: z.ZodString;
2786
+ }, {
2787
+ type: z.ZodLiteral<"DEVELOPER">;
2788
+ }>, "strip", z.ZodTypeAny, {
2789
+ id: string;
2790
+ type: "DEVELOPER";
2791
+ client: {
2792
+ id: string;
2793
+ scopes: string[];
2794
+ title: string;
2795
+ createdAt: Date;
2796
+ updatedAt: Date;
2797
+ integrationIdentifier: string;
2798
+ integrationAuthMethod: string;
2799
+ };
2800
+ authorizationUrl: string;
2801
+ }, {
2802
+ id: string;
2803
+ type: "DEVELOPER";
2804
+ client: {
2805
+ id: string;
2806
+ scopes: string[];
2807
+ title: string;
2808
+ createdAt: Date;
2809
+ updatedAt: Date;
2810
+ integrationIdentifier: string;
2811
+ integrationAuthMethod: string;
2812
+ };
2813
+ authorizationUrl: string;
2814
+ }>, z.ZodObject<z.extendShape<{
2815
+ id: z.ZodString;
2816
+ client: z.ZodObject<{
2817
+ id: z.ZodString;
2818
+ title: z.ZodString;
2819
+ scopes: z.ZodArray<z.ZodString, "many">;
2820
+ createdAt: z.ZodDate;
2821
+ updatedAt: z.ZodDate;
2822
+ integrationIdentifier: z.ZodString;
2823
+ integrationAuthMethod: z.ZodString;
2824
+ }, "strip", z.ZodTypeAny, {
2825
+ id: string;
2826
+ scopes: string[];
2827
+ title: string;
2828
+ createdAt: Date;
2829
+ updatedAt: Date;
2830
+ integrationIdentifier: string;
2831
+ integrationAuthMethod: string;
2832
+ }, {
2833
+ id: string;
2834
+ scopes: string[];
2835
+ title: string;
2836
+ createdAt: Date;
2837
+ updatedAt: Date;
2838
+ integrationIdentifier: string;
2839
+ integrationAuthMethod: string;
2840
+ }>;
2841
+ authorizationUrl: z.ZodString;
2842
+ }, {
2843
+ type: z.ZodLiteral<"EXTERNAL">;
2844
+ account: z.ZodObject<{
2845
+ id: z.ZodString;
2846
+ metadata: z.ZodAny;
2847
+ }, "strip", z.ZodTypeAny, {
2848
+ metadata?: any;
2849
+ id: string;
2850
+ }, {
2851
+ metadata?: any;
2852
+ id: string;
2853
+ }>;
2854
+ }>, "strip", z.ZodTypeAny, {
2855
+ id: string;
2856
+ type: "EXTERNAL";
2857
+ account: {
2858
+ metadata?: any;
2859
+ id: string;
2860
+ };
2861
+ client: {
2862
+ id: string;
2863
+ scopes: string[];
2864
+ title: string;
2865
+ createdAt: Date;
2866
+ updatedAt: Date;
2867
+ integrationIdentifier: string;
2868
+ integrationAuthMethod: string;
2869
+ };
2870
+ authorizationUrl: string;
2871
+ }, {
2872
+ id: string;
2873
+ type: "EXTERNAL";
2874
+ account: {
2875
+ metadata?: any;
2876
+ id: string;
2877
+ };
2878
+ client: {
2879
+ id: string;
2880
+ scopes: string[];
2881
+ title: string;
2882
+ createdAt: Date;
2883
+ updatedAt: Date;
2884
+ integrationIdentifier: string;
2885
+ integrationAuthMethod: string;
2886
+ };
2887
+ authorizationUrl: string;
2888
+ }>]>;
2889
+ type MissingConnectionNotificationPayload = z.infer<typeof MissingConnectionNotificationPayloadSchema>;
2890
+ declare const MissingConnectionResolvedNotificationPayloadSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<z.extendShape<{
2891
+ id: z.ZodString;
2892
+ client: z.ZodObject<{
2893
+ id: z.ZodString;
2894
+ title: z.ZodString;
2895
+ scopes: z.ZodArray<z.ZodString, "many">;
2896
+ createdAt: z.ZodDate;
2897
+ updatedAt: z.ZodDate;
2898
+ integrationIdentifier: z.ZodString;
2899
+ integrationAuthMethod: z.ZodString;
2900
+ }, "strip", z.ZodTypeAny, {
2901
+ id: string;
2902
+ scopes: string[];
2903
+ title: string;
2904
+ createdAt: Date;
2905
+ updatedAt: Date;
2906
+ integrationIdentifier: string;
2907
+ integrationAuthMethod: string;
2908
+ }, {
2909
+ id: string;
2910
+ scopes: string[];
2911
+ title: string;
2912
+ createdAt: Date;
2913
+ updatedAt: Date;
2914
+ integrationIdentifier: string;
2915
+ integrationAuthMethod: string;
2916
+ }>;
2917
+ expiresAt: z.ZodDate;
2918
+ }, {
2919
+ type: z.ZodLiteral<"DEVELOPER">;
2920
+ }>, "strip", z.ZodTypeAny, {
2921
+ id: string;
2922
+ type: "DEVELOPER";
2923
+ client: {
2924
+ id: string;
2925
+ scopes: string[];
2926
+ title: string;
2927
+ createdAt: Date;
2928
+ updatedAt: Date;
2929
+ integrationIdentifier: string;
2930
+ integrationAuthMethod: string;
2931
+ };
2932
+ expiresAt: Date;
2933
+ }, {
2934
+ id: string;
2935
+ type: "DEVELOPER";
2936
+ client: {
2937
+ id: string;
2938
+ scopes: string[];
2939
+ title: string;
2940
+ createdAt: Date;
2941
+ updatedAt: Date;
2942
+ integrationIdentifier: string;
2943
+ integrationAuthMethod: string;
2944
+ };
2945
+ expiresAt: Date;
2946
+ }>, z.ZodObject<z.extendShape<{
2947
+ id: z.ZodString;
2948
+ client: z.ZodObject<{
2949
+ id: z.ZodString;
2950
+ title: z.ZodString;
2951
+ scopes: z.ZodArray<z.ZodString, "many">;
2952
+ createdAt: z.ZodDate;
2953
+ updatedAt: z.ZodDate;
2954
+ integrationIdentifier: z.ZodString;
2955
+ integrationAuthMethod: z.ZodString;
2956
+ }, "strip", z.ZodTypeAny, {
2957
+ id: string;
2958
+ scopes: string[];
2959
+ title: string;
2960
+ createdAt: Date;
2961
+ updatedAt: Date;
2962
+ integrationIdentifier: string;
2963
+ integrationAuthMethod: string;
2964
+ }, {
2965
+ id: string;
2966
+ scopes: string[];
2967
+ title: string;
2968
+ createdAt: Date;
2969
+ updatedAt: Date;
2970
+ integrationIdentifier: string;
2971
+ integrationAuthMethod: string;
2972
+ }>;
2973
+ expiresAt: z.ZodDate;
2974
+ }, {
2975
+ type: z.ZodLiteral<"EXTERNAL">;
2976
+ account: z.ZodObject<{
2977
+ id: z.ZodString;
2978
+ metadata: z.ZodAny;
2979
+ }, "strip", z.ZodTypeAny, {
2980
+ metadata?: any;
2981
+ id: string;
2982
+ }, {
2983
+ metadata?: any;
2984
+ id: string;
2985
+ }>;
2986
+ }>, "strip", z.ZodTypeAny, {
2987
+ id: string;
2988
+ type: "EXTERNAL";
2989
+ account: {
2990
+ metadata?: any;
2991
+ id: string;
2992
+ };
2993
+ client: {
2994
+ id: string;
2995
+ scopes: string[];
2996
+ title: string;
2997
+ createdAt: Date;
2998
+ updatedAt: Date;
2999
+ integrationIdentifier: string;
3000
+ integrationAuthMethod: string;
3001
+ };
3002
+ expiresAt: Date;
3003
+ }, {
3004
+ id: string;
3005
+ type: "EXTERNAL";
3006
+ account: {
3007
+ metadata?: any;
3008
+ id: string;
3009
+ };
3010
+ client: {
3011
+ id: string;
3012
+ scopes: string[];
3013
+ title: string;
3014
+ createdAt: Date;
3015
+ updatedAt: Date;
3016
+ integrationIdentifier: string;
3017
+ integrationAuthMethod: string;
3018
+ };
3019
+ expiresAt: Date;
3020
+ }>]>;
3021
+ type MissingConnectionResolvedNotificationPayload = z.infer<typeof MissingConnectionResolvedNotificationPayloadSchema>;
3022
+
3023
+ type ApiClientOptions = {
3024
+ apiKey?: string;
3025
+ apiUrl?: string;
3026
+ logLevel?: LogLevel;
3027
+ };
3028
+ type EndpointRecord = {
3029
+ id: string;
3030
+ name: string;
3031
+ url: string;
3032
+ };
3033
+ declare class ApiClient {
3034
+ #private;
3035
+ constructor(options: ApiClientOptions);
3036
+ registerEndpoint(options: {
3037
+ url: string;
3038
+ name: string;
3039
+ }): Promise<EndpointRecord>;
3040
+ createRun(params: CreateRunBody): Promise<{
3041
+ data: {
3042
+ id: string;
3043
+ };
3044
+ ok: true;
3045
+ } | {
3046
+ error: string;
3047
+ ok: false;
3048
+ }>;
3049
+ runTask(runId: string, task: RunTaskBodyInput): Promise<{
3050
+ icon?: string | null | undefined;
3051
+ startedAt?: Date | null | undefined;
3052
+ completedAt?: Date | null | undefined;
3053
+ delayUntil?: Date | null | undefined;
3054
+ description?: string | null | undefined;
3055
+ params?: DeserializedJson | undefined;
3056
+ properties?: {
3057
+ url?: string | undefined;
3058
+ label: string;
3059
+ text: string;
3060
+ }[] | null | undefined;
3061
+ output?: DeserializedJson | undefined;
3062
+ error?: string | null | undefined;
3063
+ parentId?: string | null | undefined;
3064
+ style?: {
3065
+ variant?: string | undefined;
3066
+ style: "normal" | "minimal";
3067
+ } | null | undefined;
3068
+ id: string;
3069
+ name: string;
3070
+ noop: boolean;
3071
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
3072
+ idempotencyKey: string;
3073
+ attempts: number;
3074
+ }>;
3075
+ completeTask(runId: string, id: string, task: CompleteTaskBodyInput): Promise<{
3076
+ icon?: string | null | undefined;
3077
+ startedAt?: Date | null | undefined;
3078
+ completedAt?: Date | null | undefined;
3079
+ delayUntil?: Date | null | undefined;
3080
+ description?: string | null | undefined;
3081
+ params?: DeserializedJson | undefined;
3082
+ properties?: {
3083
+ url?: string | undefined;
3084
+ label: string;
3085
+ text: string;
3086
+ }[] | null | undefined;
3087
+ output?: DeserializedJson | undefined;
3088
+ error?: string | null | undefined;
3089
+ parentId?: string | null | undefined;
3090
+ style?: {
3091
+ variant?: string | undefined;
3092
+ style: "normal" | "minimal";
3093
+ } | null | undefined;
3094
+ id: string;
3095
+ name: string;
3096
+ noop: boolean;
3097
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
3098
+ idempotencyKey: string;
3099
+ attempts: number;
3100
+ }>;
3101
+ failTask(runId: string, id: string, body: FailTaskBodyInput): Promise<{
3102
+ icon?: string | null | undefined;
3103
+ startedAt?: Date | null | undefined;
3104
+ completedAt?: Date | null | undefined;
3105
+ delayUntil?: Date | null | undefined;
3106
+ description?: string | null | undefined;
3107
+ params?: DeserializedJson | undefined;
3108
+ properties?: {
3109
+ url?: string | undefined;
3110
+ label: string;
3111
+ text: string;
3112
+ }[] | null | undefined;
3113
+ output?: DeserializedJson | undefined;
3114
+ error?: string | null | undefined;
3115
+ parentId?: string | null | undefined;
3116
+ style?: {
3117
+ variant?: string | undefined;
3118
+ style: "normal" | "minimal";
3119
+ } | null | undefined;
3120
+ id: string;
3121
+ name: string;
3122
+ noop: boolean;
3123
+ status: "PENDING" | "WAITING" | "RUNNING" | "COMPLETED" | "ERRORED";
3124
+ idempotencyKey: string;
3125
+ attempts: number;
3126
+ }>;
3127
+ sendEvent(event: SendEvent, options?: SendEventOptions): Promise<{
3128
+ context?: DeserializedJson | undefined;
3129
+ deliverAt?: Date | null | undefined;
3130
+ deliveredAt?: Date | null | undefined;
3131
+ id: string;
3132
+ name: string;
3133
+ payload: DeserializedJson;
3134
+ timestamp: Date;
3135
+ }>;
3136
+ updateSource(client: string, key: string, source: UpdateTriggerSourceBody): Promise<TriggerSource>;
3137
+ registerTrigger(client: string, id: string, key: string, payload: RegisterTriggerBody): Promise<RegisterSourceEvent>;
3138
+ registerSchedule(client: string, id: string, key: string, payload: ScheduleMetadata): Promise<{
3139
+ metadata?: any;
3140
+ id: string;
3141
+ schedule: {
3142
+ metadata?: any;
3143
+ options: {
3144
+ cron: string;
3145
+ };
3146
+ type: "cron";
3147
+ } | {
3148
+ metadata?: any;
3149
+ options: {
3150
+ seconds: number;
3151
+ };
3152
+ type: "interval";
3153
+ };
3154
+ active: boolean;
3155
+ }>;
3156
+ unregisterSchedule(client: string, id: string, key: string): Promise<{
3157
+ ok: boolean;
3158
+ }>;
3159
+ getAuth(client: string, id: string): Promise<{
3160
+ scopes?: string[] | undefined;
3161
+ additionalFields?: Record<string, string> | undefined;
3162
+ type: "oauth2";
3163
+ accessToken: string;
3164
+ } | undefined>;
440
3165
  }
441
3166
 
442
- type EventRule = z.infer<typeof EventFilterSchema>;
443
- type TriggerEvent<TSchema extends z.ZodTypeAny> = {
444
- metadata: z.infer<typeof TriggerMetadataSchema>;
445
- schema: TSchema;
3167
+ interface TriggerContext {
3168
+ job: {
3169
+ id: string;
3170
+ version: string;
3171
+ };
3172
+ environment: {
3173
+ slug: string;
3174
+ id: string;
3175
+ type: RuntimeEnvironmentType;
3176
+ };
3177
+ organization: {
3178
+ slug: string;
3179
+ id: string;
3180
+ title: string;
3181
+ };
3182
+ run: {
3183
+ id: string;
3184
+ isTest: boolean;
3185
+ startedAt: Date;
3186
+ };
3187
+ event: {
3188
+ id: string;
3189
+ name: string;
3190
+ context: any;
3191
+ timestamp: Date;
3192
+ };
3193
+ account?: {
3194
+ id: string;
3195
+ metadata?: any;
3196
+ };
3197
+ }
3198
+ interface TriggerPreprocessContext {
3199
+ job: {
3200
+ id: string;
3201
+ version: string;
3202
+ };
3203
+ environment: {
3204
+ slug: string;
3205
+ id: string;
3206
+ type: RuntimeEnvironmentType;
3207
+ };
3208
+ organization: {
3209
+ slug: string;
3210
+ id: string;
3211
+ title: string;
3212
+ };
3213
+ run: {
3214
+ id: string;
3215
+ isTest: boolean;
3216
+ };
3217
+ event: {
3218
+ id: string;
3219
+ name: string;
3220
+ context: any;
3221
+ timestamp: Date;
3222
+ };
3223
+ account?: {
3224
+ id: string;
3225
+ metadata?: any;
3226
+ };
3227
+ }
3228
+ interface TaskLogger {
3229
+ debug(message: string, properties?: Record<string, any>): Promise<void>;
3230
+ info(message: string, properties?: Record<string, any>): Promise<void>;
3231
+ warn(message: string, properties?: Record<string, any>): Promise<void>;
3232
+ error(message: string, properties?: Record<string, any>): Promise<void>;
3233
+ }
3234
+ type PreprocessResults = {
3235
+ abort: boolean;
3236
+ properties: DisplayProperty[];
446
3237
  };
447
- type TriggerCustomEventOptions<TSchema extends z.ZodTypeAny> = {
3238
+ type TriggerEventType<TTrigger extends Trigger<any>> = TTrigger extends Trigger<infer TEventSpec> ? ReturnType<TEventSpec["parsePayload"]> : never;
3239
+ interface Trigger<TEventSpec extends EventSpecification<any>> {
3240
+ event: TEventSpec;
3241
+ toJSON(): TriggerMetadata;
3242
+ attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpec>, any>): void;
3243
+ preprocessRuns: boolean;
3244
+ }
3245
+ interface EventSpecification<TEvent extends any> {
448
3246
  name: string;
449
- schema?: TSchema;
3247
+ title: string;
3248
+ source: string;
3249
+ icon: string;
3250
+ properties?: DisplayProperty[];
3251
+ schema?: any;
3252
+ examples?: Array<{
3253
+ id: string;
3254
+ name: string;
3255
+ icon?: string;
3256
+ payload: TEvent;
3257
+ }>;
450
3258
  filter?: EventFilter;
3259
+ parsePayload: (payload: unknown) => TEvent;
3260
+ runProperties?: (payload: TEvent) => DisplayProperty[];
3261
+ }
3262
+ type EventTypeFromSpecification<TEventSpec extends EventSpecification<any>> = TEventSpec extends EventSpecification<infer TEvent> ? TEvent : never;
3263
+
3264
+ type HttpSourceEvent = {
3265
+ url: string;
3266
+ method: string;
3267
+ headers: Record<string, string>;
3268
+ rawBody?: Buffer | null;
451
3269
  };
452
- declare function customEvent<TSchema extends z.ZodTypeAny>(options: TriggerCustomEventOptions<TSchema>): TriggerEvent<TSchema>;
453
- type TriggerScheduleOptions = z.infer<typeof ScheduleSourceSchema>;
454
- declare function scheduleEvent(options: TriggerScheduleOptions): TriggerEvent<typeof ScheduledEventPayloadSchema>;
455
- type TriggerWebhookEventOptions<TSchema extends z.ZodTypeAny> = {
456
- schema?: TSchema;
457
- service: string;
458
- eventName: string;
459
- filter?: EventFilter;
460
- verifyPayload?: {
461
- enabled: boolean;
462
- header: string;
3270
+ type SmtpSourceEvent = {
3271
+ from: string;
3272
+ to: string;
3273
+ subject: string;
3274
+ body: string;
3275
+ };
3276
+ type SqsSourceEvent = {
3277
+ body: string;
3278
+ };
3279
+ type ExternalSourceChannelMap = {
3280
+ HTTP: {
3281
+ event: Request;
3282
+ register: {
3283
+ url: string;
3284
+ };
3285
+ };
3286
+ SMTP: {
3287
+ event: SmtpSourceEvent;
3288
+ register: {};
3289
+ };
3290
+ SQS: {
3291
+ event: SqsSourceEvent;
3292
+ register: {};
3293
+ };
3294
+ };
3295
+ type ChannelNames = keyof ExternalSourceChannelMap;
3296
+ type RegisterFunctionEvent<TChannel extends ChannelNames, TParams extends any> = {
3297
+ events: Array<string>;
3298
+ missingEvents: Array<string>;
3299
+ orphanedEvents: Array<string>;
3300
+ source: {
3301
+ active: boolean;
3302
+ data?: any;
3303
+ secret: string;
3304
+ } & ExternalSourceChannelMap[TChannel]["register"];
3305
+ params: TParams;
3306
+ };
3307
+ type RegisterFunction<TIntegration extends TriggerIntegration<IntegrationClient<any, any>>, TParams extends any, TChannel extends ChannelNames> = (event: RegisterFunctionEvent<TChannel, TParams>, io: IOWithIntegrations<{
3308
+ integration: TIntegration;
3309
+ }>, ctx: TriggerContext) => Promise<UpdateTriggerSourceBody | undefined>;
3310
+ type HandlerEvent<TChannel extends ChannelNames, TParams extends any = any> = {
3311
+ rawEvent: ExternalSourceChannelMap[TChannel]["event"];
3312
+ source: HandleTriggerSource & {
3313
+ params: TParams;
463
3314
  };
464
3315
  };
465
- declare function webhookEvent<TSchema extends z.ZodTypeAny>(options: TriggerWebhookEventOptions<TSchema>): TriggerEvent<TSchema>;
3316
+ type HandlerFunction<TChannel extends ChannelNames, TParams extends any> = (event: HandlerEvent<TChannel, TParams>, logger: Logger) => Promise<{
3317
+ events: SendEvent[];
3318
+ response?: NormalizedResponse;
3319
+ } | void>;
3320
+ type KeyFunction<TParams extends any> = (params: TParams) => string;
3321
+ type FilterFunction<TParams extends any> = (params: TParams) => EventFilter;
3322
+ type ExternalSourceOptions<TChannel extends ChannelNames, TIntegration extends TriggerIntegration<IntegrationClient<any, any>>, TParams extends any> = {
3323
+ id: string;
3324
+ version: string;
3325
+ schema: z.Schema<TParams>;
3326
+ integration: TIntegration;
3327
+ register: RegisterFunction<TIntegration, TParams, TChannel>;
3328
+ filter: FilterFunction<TParams>;
3329
+ handler: HandlerFunction<TChannel, TParams>;
3330
+ key: KeyFunction<TParams>;
3331
+ properties?: (params: TParams) => DisplayProperty[];
3332
+ };
3333
+ declare class ExternalSource<TIntegration extends TriggerIntegration<IntegrationClient<any, any>>, TParams extends any, TChannel extends ChannelNames = ChannelNames> {
3334
+ private options;
3335
+ channel: TChannel;
3336
+ constructor(channel: TChannel, options: ExternalSourceOptions<TChannel, TIntegration, TParams>);
3337
+ handle(source: HandleTriggerSource, rawEvent: ExternalSourceChannelMap[TChannel]["event"], logger: Logger): Promise<void | {
3338
+ events: {
3339
+ id?: string | undefined;
3340
+ source?: string | undefined;
3341
+ payload?: any;
3342
+ context?: any;
3343
+ timestamp?: string | undefined;
3344
+ name: string;
3345
+ }[];
3346
+ response?: {
3347
+ headers?: Record<string, string> | undefined;
3348
+ body?: any;
3349
+ status: number;
3350
+ } | undefined;
3351
+ }>;
3352
+ filter(params: TParams): EventFilter;
3353
+ properties(params: TParams): DisplayProperty[];
3354
+ register(params: TParams, registerEvent: RegisterSourceEvent, io: IO, ctx: TriggerContext): Promise<{
3355
+ data?: SerializableJson;
3356
+ secret?: string | undefined;
3357
+ registeredEvents: string[];
3358
+ } | undefined>;
3359
+ key(params: TParams): string;
3360
+ get integration(): TIntegration;
3361
+ get integrationConfig(): {
3362
+ id: string;
3363
+ metadata: {
3364
+ icon: string;
3365
+ key: string;
3366
+ title: string;
3367
+ };
3368
+ };
3369
+ get id(): string;
3370
+ get version(): string;
3371
+ }
3372
+ type ExternalSourceParams<TExternalSource extends ExternalSource<any, any, any>> = TExternalSource extends ExternalSource<any, infer TParams, any> ? TParams : never;
3373
+ type ExternalSourceTriggerOptions<TEventSpecification extends EventSpecification<any>, TEventSource extends ExternalSource<any, any, any>> = {
3374
+ event: TEventSpecification;
3375
+ source: TEventSource;
3376
+ params: ExternalSourceParams<TEventSource>;
3377
+ };
3378
+ declare class ExternalSourceTrigger<TEventSpecification extends EventSpecification<any>, TEventSource extends ExternalSource<any, any, any>> implements Trigger<TEventSpecification> {
3379
+ private options;
3380
+ constructor(options: ExternalSourceTriggerOptions<TEventSpecification, TEventSource>);
3381
+ get event(): TEventSpecification;
3382
+ toJSON(): TriggerMetadata;
3383
+ attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpecification>, any>): void;
3384
+ get preprocessRuns(): boolean;
3385
+ }
3386
+ declare function omit<T extends Record<string, unknown>, K extends keyof T>(obj: T, key: K): {
3387
+ result: Omit<T, K>;
3388
+ ommited: T[K];
3389
+ };
466
3390
 
467
- declare const logLevels: readonly ["disabled", "error", "log", "warn", "info", "debug"];
468
- type LogLevel = (typeof logLevels)[number];
3391
+ type DynamicTriggerOptions<TEventSpec extends EventSpecification<any>, TExternalSource extends ExternalSource<any, any, any>> = {
3392
+ id: string;
3393
+ event: TEventSpec;
3394
+ source: TExternalSource;
3395
+ };
3396
+ declare class DynamicTrigger<TEventSpec extends EventSpecification<any>, TExternalSource extends ExternalSource<any, any, any>> implements Trigger<TEventSpec> {
3397
+ #private;
3398
+ source: TExternalSource;
3399
+ constructor(client: TriggerClient, options: DynamicTriggerOptions<TEventSpec, TExternalSource>);
3400
+ toJSON(): TriggerMetadata;
3401
+ get id(): string;
3402
+ get event(): TEventSpec;
3403
+ registeredTriggerForParams(params: ExternalSourceParams<TExternalSource>): RegisterTriggerBody;
3404
+ register(key: string, params: ExternalSourceParams<TExternalSource>): Promise<RegisterSourceEvent>;
3405
+ attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpec>, any>): void;
3406
+ get preprocessRuns(): boolean;
3407
+ }
469
3408
 
470
- type TriggerOptions<TSchema extends z.ZodTypeAny> = {
3409
+ type TriggerClientOptions = {
471
3410
  id: string;
472
- name: string;
473
- on: TriggerEvent<TSchema>;
3411
+ url?: string;
474
3412
  apiKey?: string;
475
- endpoint?: string;
3413
+ apiUrl?: string;
476
3414
  logLevel?: LogLevel;
477
- /**
478
- * The TTL for the trigger in seconds. If the trigger is not run within this time, it will be aborted. Defaults to 3600 seconds (1 hour).
479
- * @type {number}
480
- */
481
- triggerTTL?: number;
482
- run: (event: z.infer<TSchema>, ctx: TriggerContext) => Promise<any>;
483
3415
  };
484
- declare class Trigger<TSchema extends z.ZodTypeAny> {
3416
+ type ListenOptions = {
3417
+ url: string;
3418
+ };
3419
+ declare class TriggerClient {
485
3420
  #private;
486
- options: TriggerOptions<TSchema>;
487
- constructor(options: TriggerOptions<TSchema>);
3421
+ private _url;
3422
+ id: string;
3423
+ path?: string;
3424
+ constructor(options: TriggerClientOptions);
3425
+ get url(): string;
3426
+ handleRequest(request: Request): Promise<NormalizedResponse>;
3427
+ attach(job: Job<Trigger<any>, any>): void;
3428
+ attachDynamicTrigger(trigger: DynamicTrigger<any, any>): void;
3429
+ attachJobToDynamicTrigger(job: Job<Trigger<any>, any>, trigger: DynamicTrigger<any, any>): void;
3430
+ attachSource(options: {
3431
+ key: string;
3432
+ source: ExternalSource<any, any>;
3433
+ event: EventSpecification<any>;
3434
+ params: any;
3435
+ }): void;
3436
+ attachDynamicSchedule(key: string, job: Job<Trigger<any>, any>): void;
3437
+ registerTrigger(id: string, key: string, options: RegisterTriggerBody): Promise<{
3438
+ dynamicTriggerId?: string | undefined;
3439
+ id: string;
3440
+ source: {
3441
+ params?: any;
3442
+ data?: DeserializedJson | undefined;
3443
+ clientId?: string | undefined;
3444
+ key: string;
3445
+ secret: string;
3446
+ active: boolean;
3447
+ channel: {
3448
+ url: string;
3449
+ type: "HTTP";
3450
+ } | {
3451
+ type: "SMTP";
3452
+ } | {
3453
+ type: "SQS";
3454
+ };
3455
+ };
3456
+ events: string[];
3457
+ missingEvents: string[];
3458
+ orphanedEvents: string[];
3459
+ }>;
3460
+ getAuth(id: string): Promise<{
3461
+ scopes?: string[] | undefined;
3462
+ additionalFields?: Record<string, string> | undefined;
3463
+ type: "oauth2";
3464
+ accessToken: string;
3465
+ } | undefined>;
3466
+ sendEvent(event: SendEvent, options?: SendEventOptions): Promise<{
3467
+ context?: DeserializedJson | undefined;
3468
+ deliverAt?: Date | null | undefined;
3469
+ deliveredAt?: Date | null | undefined;
3470
+ id: string;
3471
+ name: string;
3472
+ payload: DeserializedJson;
3473
+ timestamp: Date;
3474
+ }>;
3475
+ registerSchedule(id: string, key: string, schedule: ScheduleMetadata): Promise<{
3476
+ metadata?: any;
3477
+ id: string;
3478
+ schedule: {
3479
+ metadata?: any;
3480
+ options: {
3481
+ cron: string;
3482
+ };
3483
+ type: "cron";
3484
+ } | {
3485
+ metadata?: any;
3486
+ options: {
3487
+ seconds: number;
3488
+ };
3489
+ type: "interval";
3490
+ };
3491
+ active: boolean;
3492
+ }>;
3493
+ unregisterSchedule(id: string, key: string): Promise<{
3494
+ ok: boolean;
3495
+ }>;
3496
+ authorized(apiKey?: string | null): boolean;
3497
+ apiKey(): string | undefined;
488
3498
  listen(): Promise<void>;
489
- get id(): string;
490
- get name(): string;
491
- get endpoint(): string | undefined;
492
- get on(): TriggerEvent<TSchema>;
493
3499
  }
494
3500
 
495
- declare function sendEvent(idOrKey: string, event: TriggerCustomEvent): Promise<void>;
496
-
497
- declare function fetch<TBodySchema extends z.ZodTypeAny = z.ZodTypeAny>(key: string, url: string | URL, options: FetchOptions<TBodySchema>): Promise<FetchResponse<TBodySchema>>;
498
-
499
- declare function getTriggerRun(): {
500
- performRequest: <TSchema extends zod.ZodTypeAny>(key: string, options: {
501
- version?: string | undefined;
502
- service: string;
503
- params: unknown;
504
- endpoint: string;
505
- response?: {
506
- schema: TSchema;
507
- } | undefined;
508
- }) => Promise<zod.TypeOf<TSchema>>;
509
- sendEvent: (key: string, event: {
510
- payload?: string | number | boolean | Date | {
511
- [key: string]: string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
512
- } | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
513
- context?: string | number | boolean | Date | {
514
- [key: string]: string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
515
- } | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | (string | number | boolean | Date | any | any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
516
- timestamp?: string | undefined;
517
- delay?: {
518
- seconds: number;
3501
+ type ScheduledEventSpecification = EventSpecification<ScheduledPayload>;
3502
+ declare class IntervalTrigger implements Trigger<ScheduledEventSpecification> {
3503
+ private options;
3504
+ constructor(options: IntervalOptions);
3505
+ get event(): {
3506
+ name: string;
3507
+ title: string;
3508
+ source: string;
3509
+ icon: string;
3510
+ parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
3511
+ lastTimestamp?: Date | undefined;
3512
+ ts: Date;
3513
+ };
3514
+ properties: {
3515
+ label: string;
3516
+ text: string;
3517
+ }[];
3518
+ };
3519
+ attachToJob(triggerClient: TriggerClient, job: Job<Trigger<ScheduledEventSpecification>, any>): void;
3520
+ get preprocessRuns(): boolean;
3521
+ toJSON(): TriggerMetadata;
3522
+ }
3523
+ declare function intervalTrigger(options: IntervalOptions): IntervalTrigger;
3524
+ declare class CronTrigger implements Trigger<ScheduledEventSpecification> {
3525
+ private options;
3526
+ constructor(options: CronOptions);
3527
+ get event(): {
3528
+ name: string;
3529
+ title: string;
3530
+ source: string;
3531
+ icon: string;
3532
+ parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
3533
+ lastTimestamp?: Date | undefined;
3534
+ ts: Date;
3535
+ };
3536
+ properties: {
3537
+ label: string;
3538
+ text: string;
3539
+ }[];
3540
+ };
3541
+ attachToJob(triggerClient: TriggerClient, job: Job<Trigger<ScheduledEventSpecification>, any>): void;
3542
+ get preprocessRuns(): boolean;
3543
+ toJSON(): TriggerMetadata;
3544
+ }
3545
+ declare function cronTrigger(options: CronOptions): CronTrigger;
3546
+ type DynamicIntervalOptions = {
3547
+ id: string;
3548
+ };
3549
+ declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
3550
+ private client;
3551
+ private options;
3552
+ constructor(client: TriggerClient, options: DynamicIntervalOptions);
3553
+ get id(): string;
3554
+ get event(): {
3555
+ name: string;
3556
+ title: string;
3557
+ source: string;
3558
+ icon: string;
3559
+ parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
3560
+ lastTimestamp?: Date | undefined;
3561
+ ts: Date;
3562
+ };
3563
+ };
3564
+ register(key: string, metadata: ScheduleMetadata): Promise<{
3565
+ metadata?: any;
3566
+ id: string;
3567
+ schedule: {
3568
+ metadata?: any;
3569
+ options: {
3570
+ cron: string;
3571
+ };
3572
+ type: "cron";
519
3573
  } | {
520
- minutes: number;
3574
+ metadata?: any;
3575
+ options: {
3576
+ seconds: number;
3577
+ };
3578
+ type: "interval";
3579
+ };
3580
+ active: boolean;
3581
+ }>;
3582
+ unregister(key: string): Promise<{
3583
+ ok: boolean;
3584
+ }>;
3585
+ attachToJob(triggerClient: TriggerClient, job: Job<Trigger<ScheduledEventSpecification>, any>): void;
3586
+ get preprocessRuns(): boolean;
3587
+ toJSON(): TriggerMetadata;
3588
+ }
3589
+
3590
+ type IOTask = ServerTask;
3591
+ type IOOptions = {
3592
+ id: string;
3593
+ apiClient: ApiClient;
3594
+ client: TriggerClient;
3595
+ context: TriggerContext;
3596
+ logger?: Logger;
3597
+ logLevel?: LogLevel;
3598
+ cachedTasks?: Array<CachedTask>;
3599
+ };
3600
+ declare class IO {
3601
+ #private;
3602
+ private _id;
3603
+ private _apiClient;
3604
+ private _triggerClient;
3605
+ private _logger;
3606
+ private _cachedTasks;
3607
+ private _taskStorage;
3608
+ private _context;
3609
+ constructor(options: IOOptions);
3610
+ get logger(): IOLogger;
3611
+ wait(key: string | any[], seconds: number): Promise<void>;
3612
+ sendEvent(key: string | any[], event: SendEvent, options?: SendEventOptions): Promise<{
3613
+ context?: DeserializedJson | undefined;
3614
+ deliverAt?: Date | null | undefined;
3615
+ deliveredAt?: Date | null | undefined;
3616
+ id: string;
3617
+ name: string;
3618
+ payload: DeserializedJson;
3619
+ timestamp: Date;
3620
+ }>;
3621
+ updateSource(key: string | any[], options: {
3622
+ key: string;
3623
+ } & UpdateTriggerSourceBody): Promise<{
3624
+ id: string;
3625
+ key: string;
3626
+ }>;
3627
+ registerInterval(key: string | any[], dynamicSchedule: DynamicSchedule, id: string, options: IntervalOptions): Promise<{
3628
+ metadata?: any;
3629
+ id: string;
3630
+ schedule: {
3631
+ metadata?: any;
3632
+ options: {
3633
+ cron: string;
3634
+ };
3635
+ type: "cron";
521
3636
  } | {
522
- hours: number;
3637
+ metadata?: any;
3638
+ options: {
3639
+ seconds: number;
3640
+ };
3641
+ type: "interval";
3642
+ };
3643
+ active: boolean;
3644
+ }>;
3645
+ unregisterInterval(key: string | any[], dynamicSchedule: DynamicSchedule, id: string): Promise<{
3646
+ ok: boolean;
3647
+ }>;
3648
+ registerCron(key: string | any[], dynamicSchedule: DynamicSchedule, id: string, options: CronOptions): Promise<{
3649
+ metadata?: any;
3650
+ id: string;
3651
+ schedule: {
3652
+ metadata?: any;
3653
+ options: {
3654
+ cron: string;
3655
+ };
3656
+ type: "cron";
523
3657
  } | {
524
- days: number;
3658
+ metadata?: any;
3659
+ options: {
3660
+ seconds: number;
3661
+ };
3662
+ type: "interval";
3663
+ };
3664
+ active: boolean;
3665
+ }>;
3666
+ unregisterCron(key: string | any[], dynamicSchedule: DynamicSchedule, id: string): Promise<{
3667
+ ok: boolean;
3668
+ }>;
3669
+ registerTrigger<TTrigger extends DynamicTrigger<EventSpecification<any>, ExternalSource<any, any, any>>>(key: string | any[], trigger: TTrigger, id: string, params: ExternalSourceParams<TTrigger["source"]>): Promise<{
3670
+ id: string;
3671
+ key: string;
3672
+ } | undefined>;
3673
+ getAuth(key: string | any[], clientId?: string): Promise<ConnectionAuth | undefined>;
3674
+ runTask<TResult extends SerializableJson | void = void>(key: string | any[], options: RunTaskOptions, callback: (task: IOTask, io: IO) => Promise<TResult>, onError?: (error: unknown, task: IOTask, io: IO) => {
3675
+ retryAt: Date;
3676
+ error?: Error;
3677
+ } | undefined | void): Promise<TResult>;
3678
+ try<TResult, TCatchResult>(tryCallback: () => Promise<TResult>, catchCallback: (error: unknown) => Promise<TCatchResult>): Promise<TResult | TCatchResult>;
3679
+ }
3680
+ type CallbackFunction = (level: "DEBUG" | "INFO" | "WARN" | "ERROR", message: string, properties?: Record<string, any>) => Promise<void>;
3681
+ declare class IOLogger implements TaskLogger {
3682
+ private callback;
3683
+ constructor(callback: CallbackFunction);
3684
+ debug(message: string, properties?: Record<string, any>): Promise<void>;
3685
+ info(message: string, properties?: Record<string, any>): Promise<void>;
3686
+ warn(message: string, properties?: Record<string, any>): Promise<void>;
3687
+ error(message: string, properties?: Record<string, any>): Promise<void>;
3688
+ }
3689
+
3690
+ type ClientFactory<TClient> = (auth: ConnectionAuth) => TClient;
3691
+ interface TriggerIntegration<TIntegrationClient extends IntegrationClient<any, any> = IntegrationClient<any, any>> {
3692
+ client: TIntegrationClient;
3693
+ id: string;
3694
+ metadata: IntegrationMetadata;
3695
+ }
3696
+ type IntegrationClient<TClient, TTasks extends Record<string, AuthenticatedTask<TClient, any, any>>> = {
3697
+ usesLocalAuth: true;
3698
+ client: TClient;
3699
+ tasks?: TTasks;
3700
+ } | {
3701
+ usesLocalAuth: false;
3702
+ clientFactory: ClientFactory<TClient>;
3703
+ tasks?: TTasks;
3704
+ };
3705
+ type AuthenticatedTask<TClient, TParams, TResult> = {
3706
+ run: (params: TParams, client: TClient, task: ServerTask, io: IO) => Promise<TResult>;
3707
+ init: (params: TParams) => RunTaskOptions;
3708
+ onError?: (error: unknown, task: ServerTask) => {
3709
+ retryAt: Date;
3710
+ error?: Error;
3711
+ } | undefined | void;
3712
+ };
3713
+ declare function authenticatedTask<TClient, TParams, TResult>(options: {
3714
+ run: (params: TParams, client: TClient, task: ServerTask, io: IO) => Promise<TResult>;
3715
+ init: (params: TParams) => RunTaskOptions;
3716
+ }): AuthenticatedTask<TClient, TParams, TResult>;
3717
+ type ExtractRunFunction<T> = T extends AuthenticatedTask<any, infer TParams, infer TResult> ? (key: string, params: TParams) => Promise<TResult> : never;
3718
+ type ExtractTasks<TTasks extends Record<string, AuthenticatedTask<any, any, any>>> = {
3719
+ [key in keyof TTasks]: ExtractRunFunction<TTasks[key]>;
3720
+ };
3721
+ type ExtractIntegrationClientClient<TIntegrationClient extends IntegrationClient<any, any>> = TIntegrationClient extends {
3722
+ usesLocalAuth: true;
3723
+ client: infer TClient;
3724
+ } ? {
3725
+ client: TClient;
3726
+ } : TIntegrationClient extends {
3727
+ usesLocalAuth: false;
3728
+ clientFactory: ClientFactory<infer TClient>;
3729
+ } ? {
3730
+ client: TClient;
3731
+ } : never;
3732
+ type ExtractIntegrationClient<TIntegrationClient extends IntegrationClient<any, any>> = ExtractIntegrationClientClient<TIntegrationClient> & ExtractTasks<TIntegrationClient["tasks"]>;
3733
+ type ExtractIntegrations<TIntegrations extends Record<string, TriggerIntegration<IntegrationClient<any, any>>>> = {
3734
+ [key in keyof TIntegrations]: ExtractIntegrationClient<TIntegrations[key]["client"]>;
3735
+ };
3736
+ type IOWithIntegrations<TIntegrations extends Record<string, TriggerIntegration<IntegrationClient<any, any>>>> = IO & ExtractIntegrations<TIntegrations>;
3737
+
3738
+ type JobOptions<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration<IntegrationClient<any, any>>> = {}> = {
3739
+ id: string;
3740
+ name: string;
3741
+ version: string;
3742
+ trigger: TTrigger;
3743
+ logLevel?: LogLevel;
3744
+ integrations?: TIntegrations;
3745
+ queue?: QueueOptions | string;
3746
+ startPosition?: "initial" | "latest";
3747
+ enabled?: boolean;
3748
+ run: (event: TriggerEventType<TTrigger>, io: IOWithIntegrations<TIntegrations>, ctx: TriggerContext) => Promise<any>;
3749
+ };
3750
+ declare class Job<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration<IntegrationClient<any, any>>> = {}> {
3751
+ #private;
3752
+ readonly options: JobOptions<TTrigger, TIntegrations>;
3753
+ client: TriggerClient;
3754
+ constructor(client: TriggerClient, options: JobOptions<TTrigger, TIntegrations>);
3755
+ get id(): string;
3756
+ get enabled(): boolean;
3757
+ get name(): string;
3758
+ get trigger(): TTrigger;
3759
+ get version(): string;
3760
+ get integrations(): Record<string, IntegrationConfig>;
3761
+ toJSON(): JobMetadata;
3762
+ }
3763
+
3764
+ type EventTriggerOptions<TEventSpecification extends EventSpecification<any>> = {
3765
+ event: TEventSpecification;
3766
+ name?: string;
3767
+ source?: string;
3768
+ filter?: EventFilter;
3769
+ };
3770
+ declare class EventTrigger<TEventSpecification extends EventSpecification<any>> implements Trigger<TEventSpecification> {
3771
+ #private;
3772
+ constructor(options: EventTriggerOptions<TEventSpecification>);
3773
+ toJSON(): TriggerMetadata;
3774
+ get event(): TEventSpecification;
3775
+ attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpecification>, any>): void;
3776
+ get preprocessRuns(): boolean;
3777
+ }
3778
+ type TriggerOptions<TEvent> = {
3779
+ name: string;
3780
+ schema?: z.Schema<TEvent>;
3781
+ source?: string;
3782
+ filter?: EventFilter;
3783
+ };
3784
+ declare function eventTrigger<TEvent extends any = any>(options: TriggerOptions<TEvent>): Trigger<EventSpecification<TEvent>>;
3785
+
3786
+ declare function missingConnectionNotification(integrations: Array<TriggerIntegration>): MissingConnectionNotification;
3787
+ declare function missingConnectionResolvedNotification(integrations: Array<TriggerIntegration>): MissingConnectionResolvedNotification;
3788
+ type MissingConnectionNotificationSpecification = EventSpecification<MissingConnectionNotificationPayload>;
3789
+ type MissingConnectionNotificationOptions = {
3790
+ integrations: Array<TriggerIntegration>;
3791
+ };
3792
+ declare class MissingConnectionNotification implements Trigger<MissingConnectionNotificationSpecification> {
3793
+ private options;
3794
+ constructor(options: MissingConnectionNotificationOptions);
3795
+ get event(): {
3796
+ name: string;
3797
+ title: string;
3798
+ source: string;
3799
+ icon: string;
3800
+ parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
3801
+ id: string;
3802
+ type: "DEVELOPER";
3803
+ client: {
3804
+ id: string;
3805
+ scopes: string[];
3806
+ title: string;
3807
+ createdAt: Date;
3808
+ updatedAt: Date;
3809
+ integrationIdentifier: string;
3810
+ integrationAuthMethod: string;
3811
+ };
3812
+ authorizationUrl: string;
525
3813
  } | {
526
- until: Date;
527
- } | undefined;
3814
+ id: string;
3815
+ type: "EXTERNAL";
3816
+ account: {
3817
+ metadata?: any;
3818
+ id: string;
3819
+ };
3820
+ client: {
3821
+ id: string;
3822
+ scopes: string[];
3823
+ title: string;
3824
+ createdAt: Date;
3825
+ updatedAt: Date;
3826
+ integrationIdentifier: string;
3827
+ integrationAuthMethod: string;
3828
+ };
3829
+ authorizationUrl: string;
3830
+ };
3831
+ properties: {
3832
+ label: string;
3833
+ text: string;
3834
+ }[];
3835
+ };
3836
+ attachToJob(triggerClient: TriggerClient, job: Job<Trigger<MissingConnectionNotificationSpecification>, any>): void;
3837
+ get preprocessRuns(): boolean;
3838
+ toJSON(): TriggerMetadata;
3839
+ }
3840
+ type MissingConnectionResolvedNotificationSpecification = EventSpecification<MissingConnectionResolvedNotificationPayload>;
3841
+ declare class MissingConnectionResolvedNotification implements Trigger<MissingConnectionResolvedNotificationSpecification> {
3842
+ private options;
3843
+ constructor(options: MissingConnectionNotificationOptions);
3844
+ get event(): {
528
3845
  name: string;
529
- }) => Promise<void>;
530
- fetch: TriggerFetch;
531
- workflowId: string;
532
- appOrigin: string;
533
- id: string;
534
- } | undefined;
3846
+ title: string;
3847
+ source: string;
3848
+ icon: string;
3849
+ parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
3850
+ id: string;
3851
+ type: "DEVELOPER";
3852
+ client: {
3853
+ id: string;
3854
+ scopes: string[];
3855
+ title: string;
3856
+ createdAt: Date;
3857
+ updatedAt: Date;
3858
+ integrationIdentifier: string;
3859
+ integrationAuthMethod: string;
3860
+ };
3861
+ expiresAt: Date;
3862
+ } | {
3863
+ id: string;
3864
+ type: "EXTERNAL";
3865
+ account: {
3866
+ metadata?: any;
3867
+ id: string;
3868
+ };
3869
+ client: {
3870
+ id: string;
3871
+ scopes: string[];
3872
+ title: string;
3873
+ createdAt: Date;
3874
+ updatedAt: Date;
3875
+ integrationIdentifier: string;
3876
+ integrationAuthMethod: string;
3877
+ };
3878
+ expiresAt: Date;
3879
+ };
3880
+ properties: {
3881
+ label: string;
3882
+ text: string;
3883
+ }[];
3884
+ };
3885
+ attachToJob(triggerClient: TriggerClient, job: Job<Trigger<MissingConnectionResolvedNotificationSpecification>, any>): void;
3886
+ get preprocessRuns(): boolean;
3887
+ toJSON(): TriggerMetadata;
3888
+ }
3889
+
3890
+ declare class ResumeWithTaskError {
3891
+ task: ServerTask;
3892
+ constructor(task: ServerTask);
3893
+ }
3894
+ declare class RetryWithTaskError {
3895
+ cause: ErrorWithStack;
3896
+ task: ServerTask;
3897
+ retryAt: Date;
3898
+ constructor(cause: ErrorWithStack, task: ServerTask, retryAt: Date);
3899
+ }
3900
+ declare function isTriggerError(err: unknown): err is ResumeWithTaskError | RetryWithTaskError;
3901
+
3902
+ type Task = ServerTask;
535
3903
  declare function secureString(strings: TemplateStringsArray, ...interpolations: string[]): SecureString;
536
3904
 
537
- export { EventRule, Trigger, TriggerCustomEventOptions, TriggerEvent, TriggerOptions, TriggerScheduleOptions, TriggerWebhookEventOptions, customEvent, fetch, getTriggerRun, scheduleEvent, secureString, sendEvent, webhookEvent };
3905
+ export { AuthenticatedTask, ClientFactory, CronTrigger, DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, DynamicTriggerOptions, EventFilter, EventSpecification, EventTrigger, EventTypeFromSpecification, ExternalSource, ExternalSourceParams, ExternalSourceTrigger, ExternalSourceTriggerOptions, HandlerEvent, HttpSourceEvent, IO, IOLogger, IOOptions, IOTask, IOWithIntegrations, IntegrationClient, IntervalTrigger, Job, JobOptions, ListenOptions, Logger, MissingConnectionNotification, MissingConnectionResolvedNotification, NormalizedRequest, PreprocessResults, SecureString, Task, TaskLogger, Trigger, TriggerClient, TriggerClientOptions, TriggerContext, TriggerEventType, TriggerIntegration, TriggerPreprocessContext, authenticatedTask, cronTrigger, eventTrigger, intervalTrigger, isTriggerError, missingConnectionNotification, missingConnectionResolvedNotification, omit, secureString };