@trigger.dev/core 3.0.0-beta.5 → 3.0.0-beta.51

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.
Files changed (201) hide show
  1. package/dist/api-Pl9fxB8v.d.mts +13879 -0
  2. package/dist/api-sNoooMbT.d.ts +13879 -0
  3. package/dist/catalog-H7yFiZ60.d.mts +202 -0
  4. package/dist/catalog-h79CG5Wy.d.ts +202 -0
  5. package/dist/common-CLW82lkt.d.mts +1423 -0
  6. package/dist/common-CLW82lkt.d.ts +1423 -0
  7. package/dist/{eventFilterMatches-2kHImluE.d.mts → eventFilter-66NaBAMi.d.mts} +1 -3
  8. package/dist/{eventFilterMatches-2kHImluE.d.ts → eventFilter-66NaBAMi.d.ts} +1 -3
  9. package/dist/eventFilterMatches.d.mts +6 -0
  10. package/dist/eventFilterMatches.d.ts +6 -0
  11. package/dist/eventFilterMatches.js +165 -0
  12. package/dist/eventFilterMatches.js.map +1 -0
  13. package/dist/eventFilterMatches.mjs +163 -0
  14. package/dist/eventFilterMatches.mjs.map +1 -0
  15. package/dist/index.d.mts +14 -16657
  16. package/dist/index.d.ts +14 -16657
  17. package/dist/index.js +8 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +8 -2
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/json-DBPEJQRe.d.mts +16 -0
  22. package/dist/json-DBPEJQRe.d.ts +16 -0
  23. package/dist/manager-KvCabW1a.d.mts +18 -0
  24. package/dist/manager-OBA35PzR.d.ts +18 -0
  25. package/dist/messages-JvHJ83wv.d.mts +19428 -0
  26. package/dist/messages-JvHJ83wv.d.ts +19428 -0
  27. package/dist/replacements.d.mts +22 -0
  28. package/dist/replacements.d.ts +22 -0
  29. package/dist/replacements.js +33 -0
  30. package/dist/replacements.js.map +1 -0
  31. package/dist/replacements.mjs +28 -0
  32. package/dist/replacements.mjs.map +1 -0
  33. package/dist/requestFilter-HNZQEpQb.d.ts +180 -0
  34. package/dist/requestFilter-b5W2_1oP.d.mts +180 -0
  35. package/dist/requestFilterMatches.d.mts +13 -0
  36. package/dist/requestFilterMatches.d.ts +13 -0
  37. package/dist/requestFilterMatches.js +238 -0
  38. package/dist/requestFilterMatches.js.map +1 -0
  39. package/dist/requestFilterMatches.mjs +235 -0
  40. package/dist/requestFilterMatches.mjs.map +1 -0
  41. package/dist/retry.d.mts +10 -0
  42. package/dist/retry.d.ts +10 -0
  43. package/dist/retry.js +100 -0
  44. package/dist/retry.js.map +1 -0
  45. package/dist/retry.mjs +97 -0
  46. package/dist/retry.mjs.map +1 -0
  47. package/dist/schemas/index.d.mts +2611 -0
  48. package/dist/schemas/index.d.ts +2611 -0
  49. package/dist/schemas/index.js +1630 -0
  50. package/dist/schemas/index.js.map +1 -0
  51. package/dist/schemas/index.mjs +1463 -0
  52. package/dist/schemas/index.mjs.map +1 -0
  53. package/dist/schemas-C9ssfehv.d.mts +2568 -0
  54. package/dist/schemas-C9ssfehv.d.ts +2568 -0
  55. package/dist/taskLogger-CzADe4je.d.ts +33 -0
  56. package/dist/taskLogger-r_AFTX45.d.mts +33 -0
  57. package/dist/tracer-N0p2Fuuv.d.mts +23 -0
  58. package/dist/tracer-N0p2Fuuv.d.ts +23 -0
  59. package/dist/types.d.mts +11 -0
  60. package/dist/types.d.ts +11 -0
  61. package/dist/types.js +4 -0
  62. package/dist/types.js.map +1 -0
  63. package/dist/types.mjs +3 -0
  64. package/dist/types.mjs.map +1 -0
  65. package/dist/utils.d.mts +7 -0
  66. package/dist/utils.d.ts +7 -0
  67. package/dist/utils.js +33 -0
  68. package/dist/utils.js.map +1 -0
  69. package/dist/utils.mjs +30 -0
  70. package/dist/utils.mjs.map +1 -0
  71. package/dist/v3/dev/index.d.mts +29 -0
  72. package/dist/v3/dev/index.d.ts +29 -0
  73. package/dist/v3/dev/index.js +93 -0
  74. package/dist/v3/dev/index.js.map +1 -0
  75. package/dist/v3/dev/index.mjs +91 -0
  76. package/dist/v3/dev/index.mjs.map +1 -0
  77. package/dist/v3/errors.d.mts +39 -0
  78. package/dist/v3/errors.d.ts +39 -0
  79. package/dist/v3/errors.js +204 -0
  80. package/dist/v3/errors.js.map +1 -0
  81. package/dist/v3/errors.mjs +195 -0
  82. package/dist/v3/errors.mjs.map +1 -0
  83. package/dist/v3/index.d.mts +445 -20508
  84. package/dist/v3/index.d.ts +445 -20508
  85. package/dist/v3/index.js +2843 -2884
  86. package/dist/v3/index.js.map +1 -1
  87. package/dist/v3/index.mjs +2785 -2856
  88. package/dist/v3/index.mjs.map +1 -1
  89. package/dist/v3/logger-api.d.mts +24 -0
  90. package/dist/v3/logger-api.d.ts +24 -0
  91. package/dist/v3/logger-api.js +118 -0
  92. package/dist/v3/logger-api.js.map +1 -0
  93. package/dist/v3/logger-api.mjs +116 -0
  94. package/dist/v3/logger-api.mjs.map +1 -0
  95. package/dist/v3/otel/index.js +119 -53
  96. package/dist/v3/otel/index.js.map +1 -1
  97. package/dist/v3/otel/index.mjs +119 -53
  98. package/dist/v3/otel/index.mjs.map +1 -1
  99. package/dist/v3/prod/index.d.mts +46 -0
  100. package/dist/v3/prod/index.d.ts +46 -0
  101. package/dist/v3/prod/index.js +180 -0
  102. package/dist/v3/prod/index.js.map +1 -0
  103. package/dist/v3/prod/index.mjs +178 -0
  104. package/dist/v3/prod/index.mjs.map +1 -0
  105. package/dist/v3/schemas/index.d.mts +4807 -0
  106. package/dist/v3/schemas/index.d.ts +4807 -0
  107. package/dist/v3/schemas/index.js +2054 -0
  108. package/dist/v3/schemas/index.js.map +1 -0
  109. package/dist/v3/schemas/index.mjs +1913 -0
  110. package/dist/v3/schemas/index.mjs.map +1 -0
  111. package/dist/v3/semanticInternalAttributes.d.mts +56 -0
  112. package/dist/v3/semanticInternalAttributes.d.ts +56 -0
  113. package/dist/v3/semanticInternalAttributes.js +61 -0
  114. package/dist/v3/semanticInternalAttributes.js.map +1 -0
  115. package/dist/v3/semanticInternalAttributes.mjs +59 -0
  116. package/dist/v3/semanticInternalAttributes.mjs.map +1 -0
  117. package/dist/v3/utils/durations.d.mts +15 -0
  118. package/dist/v3/utils/durations.d.ts +15 -0
  119. package/dist/v3/utils/durations.js +93 -0
  120. package/dist/v3/utils/durations.js.map +1 -0
  121. package/dist/v3/utils/durations.mjs +82 -0
  122. package/dist/v3/utils/durations.mjs.map +1 -0
  123. package/dist/v3/utils/flattenAttributes.d.mts +8 -0
  124. package/dist/v3/utils/flattenAttributes.d.ts +8 -0
  125. package/dist/v3/utils/flattenAttributes.js +131 -0
  126. package/dist/v3/utils/flattenAttributes.js.map +1 -0
  127. package/dist/v3/utils/flattenAttributes.mjs +126 -0
  128. package/dist/v3/utils/flattenAttributes.mjs.map +1 -0
  129. package/dist/v3/utils/ioSerialization.d.mts +21 -0
  130. package/dist/v3/utils/ioSerialization.d.ts +21 -0
  131. package/dist/v3/utils/ioSerialization.js +2392 -0
  132. package/dist/v3/utils/ioSerialization.js.map +1 -0
  133. package/dist/v3/utils/ioSerialization.mjs +2383 -0
  134. package/dist/v3/utils/ioSerialization.mjs.map +1 -0
  135. package/dist/v3/utils/omit.d.mts +3 -0
  136. package/dist/v3/utils/omit.d.ts +3 -0
  137. package/dist/v3/utils/omit.js +20 -0
  138. package/dist/v3/utils/omit.js.map +1 -0
  139. package/dist/v3/utils/omit.mjs +18 -0
  140. package/dist/v3/utils/omit.mjs.map +1 -0
  141. package/dist/v3/utils/retries.d.mts +46 -0
  142. package/dist/v3/utils/retries.d.ts +46 -0
  143. package/dist/v3/utils/retries.js +118 -0
  144. package/dist/v3/utils/retries.js.map +1 -0
  145. package/dist/v3/utils/retries.mjs +113 -0
  146. package/dist/v3/utils/retries.mjs.map +1 -0
  147. package/dist/v3/utils/structuredLogger.d.mts +31 -0
  148. package/dist/v3/utils/structuredLogger.d.ts +31 -0
  149. package/dist/v3/utils/structuredLogger.js +88 -0
  150. package/dist/v3/utils/structuredLogger.js.map +1 -0
  151. package/dist/v3/utils/structuredLogger.mjs +86 -0
  152. package/dist/v3/utils/structuredLogger.mjs.map +1 -0
  153. package/dist/v3/utils/timers.d.mts +6 -0
  154. package/dist/v3/utils/timers.d.ts +6 -0
  155. package/dist/v3/utils/timers.js +31 -0
  156. package/dist/v3/utils/timers.js.map +1 -0
  157. package/dist/v3/utils/timers.mjs +28 -0
  158. package/dist/v3/utils/timers.mjs.map +1 -0
  159. package/dist/v3/workers/index.d.mts +144 -0
  160. package/dist/v3/workers/index.d.ts +144 -0
  161. package/dist/v3/workers/index.js +3708 -0
  162. package/dist/v3/workers/index.js.map +1 -0
  163. package/dist/v3/workers/index.mjs +3689 -0
  164. package/dist/v3/workers/index.mjs.map +1 -0
  165. package/dist/v3/zodIpc.d.mts +32 -0
  166. package/dist/v3/zodIpc.d.ts +32 -0
  167. package/dist/v3/zodIpc.js +268 -0
  168. package/dist/v3/zodIpc.js.map +1 -0
  169. package/dist/v3/zodIpc.mjs +266 -0
  170. package/dist/v3/zodIpc.mjs.map +1 -0
  171. package/dist/v3/zodMessageHandler.d.mts +82 -0
  172. package/dist/v3/zodMessageHandler.d.ts +82 -0
  173. package/dist/v3/zodMessageHandler.js +222 -0
  174. package/dist/v3/zodMessageHandler.js.map +1 -0
  175. package/dist/v3/zodMessageHandler.mjs +217 -0
  176. package/dist/v3/zodMessageHandler.mjs.map +1 -0
  177. package/dist/v3/zodNamespace.d.mts +3663 -0
  178. package/dist/v3/zodNamespace.d.ts +3663 -0
  179. package/dist/v3/zodNamespace.js +397 -0
  180. package/dist/v3/zodNamespace.js.map +1 -0
  181. package/dist/v3/zodNamespace.mjs +395 -0
  182. package/dist/v3/zodNamespace.mjs.map +1 -0
  183. package/dist/v3/zodSocket.d.mts +93 -0
  184. package/dist/v3/zodSocket.d.ts +93 -0
  185. package/dist/v3/zodSocket.js +350 -0
  186. package/dist/v3/zodSocket.js.map +1 -0
  187. package/dist/v3/zodSocket.mjs +346 -0
  188. package/dist/v3/zodSocket.mjs.map +1 -0
  189. package/dist/v3/zodfetch.d.mts +219 -0
  190. package/dist/v3/zodfetch.d.ts +219 -0
  191. package/dist/v3/zodfetch.js +834 -0
  192. package/dist/v3/zodfetch.js.map +1 -0
  193. package/dist/v3/zodfetch.mjs +811 -0
  194. package/dist/v3/zodfetch.mjs.map +1 -0
  195. package/dist/versions.d.mts +11 -0
  196. package/dist/versions.d.ts +11 -0
  197. package/dist/versions.js +31 -0
  198. package/dist/versions.js.map +1 -0
  199. package/dist/versions.mjs +27 -0
  200. package/dist/versions.mjs.map +1 -0
  201. package/package.json +223 -5
@@ -0,0 +1,1630 @@
1
+ 'use strict';
2
+
3
+ var ulidx = require('ulidx');
4
+ var zod = require('zod');
5
+
6
+ var __defProp = Object.defineProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+
9
+ // src/schemas/addMissingVersionField.ts
10
+ function addMissingVersionField(val) {
11
+ if (val !== null && typeof val === "object" && !("version" in val)) {
12
+ return {
13
+ ...val,
14
+ version: "1"
15
+ };
16
+ }
17
+ return val;
18
+ }
19
+ __name(addMissingVersionField, "addMissingVersionField");
20
+ var ErrorWithStackSchema = zod.z.object({
21
+ message: zod.z.string(),
22
+ name: zod.z.string().optional(),
23
+ stack: zod.z.string().optional()
24
+ });
25
+ var SchemaErrorSchema = zod.z.object({
26
+ path: zod.z.array(zod.z.string()),
27
+ message: zod.z.string()
28
+ });
29
+ var stringPatternMatchers = [
30
+ zod.z.object({
31
+ $endsWith: zod.z.string()
32
+ }),
33
+ zod.z.object({
34
+ $startsWith: zod.z.string()
35
+ }),
36
+ zod.z.object({
37
+ $ignoreCaseEquals: zod.z.string()
38
+ })
39
+ ];
40
+ var EventMatcherSchema = zod.z.union([
41
+ /** Match against a string */
42
+ zod.z.array(zod.z.string()),
43
+ /** Match against a number */
44
+ zod.z.array(zod.z.number()),
45
+ /** Match against a boolean */
46
+ zod.z.array(zod.z.boolean()),
47
+ zod.z.array(zod.z.union([
48
+ ...stringPatternMatchers,
49
+ zod.z.object({
50
+ $exists: zod.z.boolean()
51
+ }),
52
+ zod.z.object({
53
+ $isNull: zod.z.boolean()
54
+ }),
55
+ zod.z.object({
56
+ $anythingBut: zod.z.union([
57
+ zod.z.string(),
58
+ zod.z.number(),
59
+ zod.z.boolean()
60
+ ])
61
+ }),
62
+ zod.z.object({
63
+ $anythingBut: zod.z.union([
64
+ zod.z.array(zod.z.string()),
65
+ zod.z.array(zod.z.number()),
66
+ zod.z.array(zod.z.boolean())
67
+ ])
68
+ }),
69
+ zod.z.object({
70
+ $gt: zod.z.number()
71
+ }),
72
+ zod.z.object({
73
+ $lt: zod.z.number()
74
+ }),
75
+ zod.z.object({
76
+ $gte: zod.z.number()
77
+ }),
78
+ zod.z.object({
79
+ $lte: zod.z.number()
80
+ }),
81
+ zod.z.object({
82
+ $between: zod.z.tuple([
83
+ zod.z.number(),
84
+ zod.z.number()
85
+ ])
86
+ }),
87
+ zod.z.object({
88
+ $includes: zod.z.union([
89
+ zod.z.string(),
90
+ zod.z.number(),
91
+ zod.z.boolean()
92
+ ])
93
+ }),
94
+ zod.z.object({
95
+ $not: zod.z.union([
96
+ zod.z.string(),
97
+ zod.z.number(),
98
+ zod.z.boolean()
99
+ ])
100
+ })
101
+ ]))
102
+ ]);
103
+ var EventFilterSchema = zod.z.lazy(() => zod.z.record(zod.z.union([
104
+ EventMatcherSchema,
105
+ EventFilterSchema
106
+ ])));
107
+ var EventRuleSchema = zod.z.object({
108
+ event: zod.z.string().or(zod.z.array(zod.z.string())),
109
+ source: zod.z.string(),
110
+ payload: EventFilterSchema.optional(),
111
+ context: EventFilterSchema.optional()
112
+ });
113
+ var ConnectionAuthSchema = zod.z.object({
114
+ type: zod.z.enum([
115
+ "oauth2",
116
+ "apiKey"
117
+ ]),
118
+ accessToken: zod.z.string(),
119
+ scopes: zod.z.array(zod.z.string()).optional(),
120
+ additionalFields: zod.z.record(zod.z.string()).optional()
121
+ });
122
+ var IntegrationMetadataSchema = zod.z.object({
123
+ id: zod.z.string(),
124
+ name: zod.z.string(),
125
+ instructions: zod.z.string().optional()
126
+ });
127
+ var IntegrationConfigSchema = zod.z.object({
128
+ id: zod.z.string(),
129
+ metadata: IntegrationMetadataSchema,
130
+ authSource: zod.z.enum([
131
+ "HOSTED",
132
+ "LOCAL",
133
+ "RESOLVER"
134
+ ])
135
+ });
136
+ var LiteralSchema = zod.z.union([
137
+ zod.z.string(),
138
+ zod.z.number(),
139
+ zod.z.boolean(),
140
+ zod.z.null()
141
+ ]);
142
+ var DeserializedJsonSchema = zod.z.lazy(() => zod.z.union([
143
+ LiteralSchema,
144
+ zod.z.array(DeserializedJsonSchema),
145
+ zod.z.record(DeserializedJsonSchema)
146
+ ]));
147
+ var SerializableSchema = zod.z.union([
148
+ zod.z.string(),
149
+ zod.z.number(),
150
+ zod.z.boolean(),
151
+ zod.z.null(),
152
+ zod.z.date(),
153
+ zod.z.undefined(),
154
+ zod.z.symbol()
155
+ ]);
156
+ var SerializableJsonSchema = zod.z.lazy(() => zod.z.union([
157
+ SerializableSchema,
158
+ zod.z.array(SerializableJsonSchema),
159
+ zod.z.record(SerializableJsonSchema)
160
+ ]));
161
+ var DisplayPropertySchema = zod.z.object({
162
+ /** The label for the property */
163
+ label: zod.z.string(),
164
+ /** The value of the property */
165
+ text: zod.z.string(),
166
+ /** The URL to link to when the property is clicked */
167
+ url: zod.z.string().optional(),
168
+ /** The URL to a list of images to display next to the property */
169
+ imageUrl: zod.z.array(zod.z.string()).optional()
170
+ });
171
+ var DisplayPropertiesSchema = zod.z.array(DisplayPropertySchema);
172
+ var StyleSchema = zod.z.object({
173
+ /** The style, `normal` or `minimal` */
174
+ style: zod.z.enum([
175
+ "normal",
176
+ "minimal"
177
+ ]),
178
+ /** A variant of the style. */
179
+ variant: zod.z.string().optional()
180
+ });
181
+ var SCHEDULED_EVENT = "dev.trigger.scheduled";
182
+ var ScheduledPayloadSchema = zod.z.object({
183
+ ts: zod.z.coerce.date(),
184
+ lastTimestamp: zod.z.coerce.date().optional()
185
+ });
186
+ var IntervalOptionsSchema = zod.z.object({
187
+ /** The number of seconds for the interval. Min = 20, Max = 2_592_000 (30 days) */
188
+ seconds: zod.z.number().int().positive().min(20).max(2592e3)
189
+ });
190
+ var CronOptionsSchema = zod.z.object({
191
+ /** A CRON expression that defines the schedule. A useful tool when writing CRON
192
+ expressions is [crontab guru](https://crontab.guru). Note that the timezone
193
+ used is UTC. */
194
+ cron: zod.z.string()
195
+ });
196
+ var CronMetadataSchema = zod.z.object({
197
+ type: zod.z.literal("cron"),
198
+ options: CronOptionsSchema,
199
+ /** An optional Account ID to associate with runs triggered by this interval */
200
+ accountId: zod.z.string().optional(),
201
+ metadata: zod.z.any()
202
+ });
203
+ var IntervalMetadataSchema = zod.z.object({
204
+ /** An interval reoccurs at the specified number of seconds */
205
+ type: zod.z.literal("interval"),
206
+ /** An object containing options about the interval. */
207
+ options: IntervalOptionsSchema,
208
+ /** An optional Account ID to associate with runs triggered by this interval */
209
+ accountId: zod.z.string().optional(),
210
+ /** Any additional metadata about the schedule. */
211
+ metadata: zod.z.any()
212
+ });
213
+ var ScheduleMetadataSchema = zod.z.discriminatedUnion("type", [
214
+ IntervalMetadataSchema,
215
+ CronMetadataSchema
216
+ ]);
217
+ var RegisterDynamicSchedulePayloadSchema = zod.z.object({
218
+ id: zod.z.string(),
219
+ jobs: zod.z.array(zod.z.object({
220
+ id: zod.z.string(),
221
+ version: zod.z.string()
222
+ }))
223
+ });
224
+ var TaskStatusSchema = zod.z.enum([
225
+ "PENDING",
226
+ "WAITING",
227
+ "RUNNING",
228
+ "COMPLETED",
229
+ "ERRORED",
230
+ "CANCELED"
231
+ ]);
232
+ var TaskSchema = zod.z.object({
233
+ id: zod.z.string(),
234
+ name: zod.z.string(),
235
+ icon: zod.z.string().optional().nullable(),
236
+ noop: zod.z.boolean(),
237
+ startedAt: zod.z.coerce.date().optional().nullable(),
238
+ completedAt: zod.z.coerce.date().optional().nullable(),
239
+ delayUntil: zod.z.coerce.date().optional().nullable(),
240
+ status: TaskStatusSchema,
241
+ description: zod.z.string().optional().nullable(),
242
+ properties: zod.z.array(DisplayPropertySchema).optional().nullable(),
243
+ outputProperties: zod.z.array(DisplayPropertySchema).optional().nullable(),
244
+ params: DeserializedJsonSchema.optional().nullable(),
245
+ output: DeserializedJsonSchema.optional().nullable(),
246
+ context: DeserializedJsonSchema.optional().nullable(),
247
+ error: zod.z.string().optional().nullable(),
248
+ parentId: zod.z.string().optional().nullable(),
249
+ style: StyleSchema.optional().nullable(),
250
+ operation: zod.z.string().optional().nullable(),
251
+ callbackUrl: zod.z.string().optional().nullable(),
252
+ childExecutionMode: zod.z.enum([
253
+ "SEQUENTIAL",
254
+ "PARALLEL"
255
+ ]).optional().nullable()
256
+ });
257
+ var ServerTaskSchema = TaskSchema.extend({
258
+ idempotencyKey: zod.z.string(),
259
+ attempts: zod.z.number(),
260
+ forceYield: zod.z.boolean().optional().nullable()
261
+ });
262
+ var CachedTaskSchema = zod.z.object({
263
+ id: zod.z.string(),
264
+ idempotencyKey: zod.z.string(),
265
+ status: TaskStatusSchema,
266
+ noop: zod.z.boolean().default(false),
267
+ output: DeserializedJsonSchema.optional().nullable(),
268
+ parentId: zod.z.string().optional().nullable()
269
+ });
270
+ var EventExampleSchema = zod.z.object({
271
+ id: zod.z.string(),
272
+ icon: zod.z.string().optional(),
273
+ name: zod.z.string(),
274
+ payload: zod.z.any()
275
+ });
276
+ var EventSpecificationSchema = zod.z.object({
277
+ name: zod.z.string().or(zod.z.array(zod.z.string())),
278
+ title: zod.z.string(),
279
+ source: zod.z.string(),
280
+ icon: zod.z.string(),
281
+ filter: EventFilterSchema.optional(),
282
+ properties: zod.z.array(DisplayPropertySchema).optional(),
283
+ schema: zod.z.any().optional(),
284
+ examples: zod.z.array(EventExampleSchema).optional()
285
+ });
286
+ var DynamicTriggerMetadataSchema = zod.z.object({
287
+ type: zod.z.literal("dynamic"),
288
+ id: zod.z.string()
289
+ });
290
+ var TriggerHelpSchema = zod.z.object({
291
+ noRuns: zod.z.object({
292
+ text: zod.z.string(),
293
+ link: zod.z.string().optional()
294
+ }).optional()
295
+ });
296
+ var StaticTriggerMetadataSchema = zod.z.object({
297
+ type: zod.z.literal("static"),
298
+ title: zod.z.union([
299
+ zod.z.string(),
300
+ zod.z.array(zod.z.string())
301
+ ]),
302
+ properties: zod.z.array(DisplayPropertySchema).optional(),
303
+ rule: EventRuleSchema,
304
+ link: zod.z.string().optional(),
305
+ help: TriggerHelpSchema.optional()
306
+ });
307
+ var InvokeTriggerMetadataSchema = zod.z.object({
308
+ type: zod.z.literal("invoke")
309
+ });
310
+ var ScheduledTriggerMetadataSchema = zod.z.object({
311
+ type: zod.z.literal("scheduled"),
312
+ schedule: ScheduleMetadataSchema
313
+ });
314
+ var TriggerMetadataSchema = zod.z.discriminatedUnion("type", [
315
+ DynamicTriggerMetadataSchema,
316
+ StaticTriggerMetadataSchema,
317
+ ScheduledTriggerMetadataSchema,
318
+ InvokeTriggerMetadataSchema
319
+ ]);
320
+ var StatusUpdateStateSchema = zod.z.union([
321
+ zod.z.literal("loading"),
322
+ zod.z.literal("success"),
323
+ zod.z.literal("failure")
324
+ ]);
325
+ var StatusUpdateDataSchema = zod.z.record(SerializableJsonSchema);
326
+ var StatusUpdateSchema = zod.z.object({
327
+ label: zod.z.string().optional(),
328
+ state: StatusUpdateStateSchema.optional(),
329
+ data: StatusUpdateDataSchema.optional()
330
+ });
331
+ var InitalStatusUpdateSchema = StatusUpdateSchema.required({
332
+ label: true
333
+ });
334
+ var StatusHistorySchema = zod.z.array(StatusUpdateSchema);
335
+ var JobRunStatusRecordSchema = InitalStatusUpdateSchema.extend({
336
+ key: zod.z.string(),
337
+ history: StatusHistorySchema
338
+ });
339
+
340
+ // src/schemas/runs.ts
341
+ var RunStatusSchema = zod.z.union([
342
+ zod.z.literal("PENDING"),
343
+ zod.z.literal("QUEUED"),
344
+ zod.z.literal("WAITING_ON_CONNECTIONS"),
345
+ zod.z.literal("PREPROCESSING"),
346
+ zod.z.literal("STARTED"),
347
+ zod.z.literal("SUCCESS"),
348
+ zod.z.literal("FAILURE"),
349
+ zod.z.literal("TIMED_OUT"),
350
+ zod.z.literal("ABORTED"),
351
+ zod.z.literal("CANCELED"),
352
+ zod.z.literal("UNRESOLVED_AUTH"),
353
+ zod.z.literal("INVALID_PAYLOAD"),
354
+ zod.z.literal("EXECUTING"),
355
+ zod.z.literal("WAITING_TO_CONTINUE"),
356
+ zod.z.literal("WAITING_TO_EXECUTE")
357
+ ]);
358
+ var RunTaskSchema = zod.z.object({
359
+ /** The Task id */
360
+ id: zod.z.string(),
361
+ /** The key that you defined when creating the Task, the first param in any task. */
362
+ displayKey: zod.z.string().nullable(),
363
+ /** The Task status */
364
+ status: TaskStatusSchema,
365
+ /** The name of the Task */
366
+ name: zod.z.string(),
367
+ /** The icon of the Task, a string.
368
+ * For integrations, this will be a lowercase name of the company.
369
+ * Can be used with the [@trigger.dev/companyicons](https://www.npmjs.com/package/@trigger.dev/companyicons) package to display an svg. */
370
+ icon: zod.z.string().nullable(),
371
+ /** When the task started */
372
+ startedAt: zod.z.coerce.date().nullable(),
373
+ /** When the task completed */
374
+ completedAt: zod.z.coerce.date().nullable()
375
+ });
376
+ var RunTaskWithSubtasksSchema = RunTaskSchema.extend({
377
+ subtasks: zod.z.lazy(() => RunTaskWithSubtasksSchema.array()).optional()
378
+ });
379
+ var GetRunOptionsSchema = zod.z.object({
380
+ /** Return subtasks, which appear in a `subtasks` array on a task. @default false */
381
+ subtasks: zod.z.boolean().optional(),
382
+ /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
383
+ cursor: zod.z.string().optional(),
384
+ /** How many tasks you want to return in one go, max 50. @default 20 */
385
+ take: zod.z.number().optional()
386
+ });
387
+ GetRunOptionsSchema.extend({
388
+ /** If `true`, it returns the `params` and `output` of all tasks. @default false */
389
+ taskdetails: zod.z.boolean().optional()
390
+ });
391
+ var RunSchema = zod.z.object({
392
+ /** The Run id */
393
+ id: zod.z.string(),
394
+ /** The Run status */
395
+ status: RunStatusSchema,
396
+ /** When the run started */
397
+ startedAt: zod.z.coerce.date().nullable(),
398
+ /** When the run was last updated */
399
+ updatedAt: zod.z.coerce.date().nullable(),
400
+ /** When the run was completed */
401
+ completedAt: zod.z.coerce.date().nullable()
402
+ });
403
+ var GetRunSchema = RunSchema.extend({
404
+ /** The output of the run */
405
+ output: zod.z.any().optional(),
406
+ /** The tasks from the run */
407
+ tasks: zod.z.array(RunTaskWithSubtasksSchema),
408
+ /** Any status updates that were published from the run */
409
+ statuses: zod.z.array(JobRunStatusRecordSchema).default([]),
410
+ /** If there are more tasks, you can use this to get them */
411
+ nextCursor: zod.z.string().optional()
412
+ });
413
+ zod.z.object({
414
+ /** You can use this to get more tasks, if there are more than are returned in a single batch @default undefined */
415
+ cursor: zod.z.string().optional(),
416
+ /** How many runs you want to return in one go, max 50. @default 20 */
417
+ take: zod.z.number().optional()
418
+ });
419
+ var GetRunsSchema = zod.z.object({
420
+ /** The runs from the query */
421
+ runs: RunSchema.array(),
422
+ /** If there are more runs, you can use this to get them */
423
+ nextCursor: zod.z.string().optional()
424
+ });
425
+ var StringMatchSchema = zod.z.union([
426
+ /** Match against a string */
427
+ zod.z.array(zod.z.string()),
428
+ zod.z.array(zod.z.union(stringPatternMatchers))
429
+ ]);
430
+ var HTTPMethodUnionSchema = zod.z.union([
431
+ zod.z.literal("GET"),
432
+ zod.z.literal("POST"),
433
+ zod.z.literal("PUT"),
434
+ zod.z.literal("PATCH"),
435
+ zod.z.literal("DELETE"),
436
+ zod.z.literal("HEAD"),
437
+ zod.z.literal("OPTIONS")
438
+ ]);
439
+ var RequestFilterSchema = zod.z.object({
440
+ /** An array of HTTP methods to match.
441
+ * For example, `["GET", "POST"]` will match both `GET` and `POST` Requests. */
442
+ method: zod.z.array(HTTPMethodUnionSchema).optional(),
443
+ /** An object of header key/values to match.
444
+ * This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).
445
+
446
+ @example
447
+ ```ts
448
+ filter: {
449
+ header: {
450
+ "content-type": ["application/json"],
451
+ },
452
+ },
453
+ ``` */
454
+ headers: zod.z.record(StringMatchSchema).optional(),
455
+ /** An object of query parameters to match.
456
+ * This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).
457
+
458
+ @example
459
+ ```ts
460
+ filter: {
461
+ query: {
462
+ "hub.mode": [{ $startsWith: "sub" }],
463
+ },
464
+ },
465
+ ``` */
466
+ query: zod.z.record(StringMatchSchema).optional(),
467
+ /** An object of key/values to match.
468
+ * This uses the [EventFilter matching syntax](https://trigger.dev/docs/documentation/guides/event-filter).
469
+ */
470
+ body: EventFilterSchema.optional()
471
+ });
472
+ var ResponseFilterSchema = RequestFilterSchema.omit({
473
+ method: true,
474
+ query: true
475
+ }).extend({
476
+ status: zod.z.array(zod.z.number()).optional()
477
+ });
478
+
479
+ // src/schemas/api.ts
480
+ var UpdateTriggerSourceBodyV1Schema = zod.z.object({
481
+ registeredEvents: zod.z.array(zod.z.string()),
482
+ secret: zod.z.string().optional(),
483
+ data: SerializableJsonSchema.optional()
484
+ });
485
+ var UpdateTriggerSourceBodyV2Schema = zod.z.object({
486
+ secret: zod.z.string().optional(),
487
+ data: SerializableJsonSchema.optional(),
488
+ options: zod.z.object({
489
+ event: zod.z.array(zod.z.string())
490
+ }).and(zod.z.record(zod.z.string(), zod.z.array(zod.z.string())).optional())
491
+ });
492
+ var UpdateWebhookBodySchema = zod.z.discriminatedUnion("active", [
493
+ zod.z.object({
494
+ active: zod.z.literal(false)
495
+ }),
496
+ zod.z.object({
497
+ active: zod.z.literal(true),
498
+ config: zod.z.record(zod.z.string().array())
499
+ })
500
+ ]);
501
+ var RegisterHTTPTriggerSourceBodySchema = zod.z.object({
502
+ type: zod.z.literal("HTTP"),
503
+ url: zod.z.string().url()
504
+ });
505
+ var RegisterSMTPTriggerSourceBodySchema = zod.z.object({
506
+ type: zod.z.literal("SMTP")
507
+ });
508
+ var RegisterSQSTriggerSourceBodySchema = zod.z.object({
509
+ type: zod.z.literal("SQS")
510
+ });
511
+ var RegisterSourceChannelBodySchema = zod.z.discriminatedUnion("type", [
512
+ RegisterHTTPTriggerSourceBodySchema,
513
+ RegisterSMTPTriggerSourceBodySchema,
514
+ RegisterSQSTriggerSourceBodySchema
515
+ ]);
516
+ var REGISTER_WEBHOOK = "dev.trigger.webhook.register";
517
+ var DELIVER_WEBHOOK_REQUEST = "dev.trigger.webhook.deliver";
518
+ var RegisterWebhookSourceSchema = zod.z.object({
519
+ key: zod.z.string(),
520
+ params: zod.z.any(),
521
+ config: zod.z.any(),
522
+ active: zod.z.boolean(),
523
+ secret: zod.z.string(),
524
+ url: zod.z.string(),
525
+ data: DeserializedJsonSchema.optional(),
526
+ clientId: zod.z.string().optional()
527
+ });
528
+ var RegisterWebhookPayloadSchema = zod.z.object({
529
+ active: zod.z.boolean(),
530
+ params: zod.z.any().optional(),
531
+ config: zod.z.object({
532
+ current: zod.z.record(zod.z.string().array()),
533
+ desired: zod.z.record(zod.z.string().array())
534
+ }),
535
+ // from HTTP Endpoint
536
+ url: zod.z.string(),
537
+ secret: zod.z.string()
538
+ });
539
+ var REGISTER_SOURCE_EVENT_V1 = "dev.trigger.source.register";
540
+ var REGISTER_SOURCE_EVENT_V2 = "dev.trigger.source.register.v2";
541
+ var RegisterTriggerSourceSchema = zod.z.object({
542
+ key: zod.z.string(),
543
+ params: zod.z.any(),
544
+ active: zod.z.boolean(),
545
+ secret: zod.z.string(),
546
+ data: DeserializedJsonSchema.optional(),
547
+ channel: RegisterSourceChannelBodySchema,
548
+ clientId: zod.z.string().optional()
549
+ });
550
+ zod.z.object({
551
+ name: zod.z.string(),
552
+ value: zod.z.string()
553
+ });
554
+ var RegisterSourceEventSchemaV1 = zod.z.object({
555
+ /** The id of the source */
556
+ id: zod.z.string(),
557
+ source: RegisterTriggerSourceSchema,
558
+ events: zod.z.array(zod.z.string()),
559
+ missingEvents: zod.z.array(zod.z.string()),
560
+ orphanedEvents: zod.z.array(zod.z.string()),
561
+ dynamicTriggerId: zod.z.string().optional()
562
+ });
563
+ var RegisteredOptionsDiffSchema = zod.z.object({
564
+ desired: zod.z.array(zod.z.string()),
565
+ missing: zod.z.array(zod.z.string()),
566
+ orphaned: zod.z.array(zod.z.string())
567
+ });
568
+ var RegisterSourceEventOptionsSchema = zod.z.object({
569
+ event: RegisteredOptionsDiffSchema
570
+ }).and(zod.z.record(zod.z.string(), RegisteredOptionsDiffSchema));
571
+ var RegisterSourceEventSchemaV2 = zod.z.object({
572
+ /** The id of the source */
573
+ id: zod.z.string(),
574
+ source: RegisterTriggerSourceSchema,
575
+ options: RegisterSourceEventOptionsSchema,
576
+ dynamicTriggerId: zod.z.string().optional()
577
+ });
578
+ var TriggerSourceSchema = zod.z.object({
579
+ id: zod.z.string(),
580
+ key: zod.z.string()
581
+ });
582
+ var HttpSourceResponseMetadataSchema = DeserializedJsonSchema;
583
+ var HandleTriggerSourceSchema = zod.z.object({
584
+ key: zod.z.string(),
585
+ secret: zod.z.string(),
586
+ data: zod.z.any(),
587
+ params: zod.z.any(),
588
+ auth: ConnectionAuthSchema.optional(),
589
+ metadata: HttpSourceResponseMetadataSchema.optional()
590
+ });
591
+ var HttpSourceRequestHeadersSchema = zod.z.object({
592
+ "x-ts-key": zod.z.string(),
593
+ "x-ts-dynamic-id": zod.z.string().optional(),
594
+ "x-ts-secret": zod.z.string(),
595
+ "x-ts-data": zod.z.string().transform((s) => JSON.parse(s)),
596
+ "x-ts-params": zod.z.string().transform((s) => JSON.parse(s)),
597
+ "x-ts-http-url": zod.z.string(),
598
+ "x-ts-http-method": zod.z.string(),
599
+ "x-ts-http-headers": zod.z.string().transform((s) => zod.z.record(zod.z.string()).parse(JSON.parse(s))),
600
+ "x-ts-auth": zod.z.string().optional().transform((s) => {
601
+ if (s === void 0)
602
+ return;
603
+ const json = JSON.parse(s);
604
+ return ConnectionAuthSchema.parse(json);
605
+ }),
606
+ "x-ts-metadata": zod.z.string().optional().transform((s) => {
607
+ if (s === void 0)
608
+ return;
609
+ const json = JSON.parse(s);
610
+ return DeserializedJsonSchema.parse(json);
611
+ })
612
+ });
613
+ var HttpEndpointRequestHeadersSchema = zod.z.object({
614
+ "x-ts-key": zod.z.string(),
615
+ "x-ts-http-url": zod.z.string(),
616
+ "x-ts-http-method": zod.z.string(),
617
+ "x-ts-http-headers": zod.z.string().transform((s) => zod.z.record(zod.z.string()).parse(JSON.parse(s)))
618
+ });
619
+ var WebhookSourceRequestHeadersSchema = zod.z.object({
620
+ "x-ts-key": zod.z.string(),
621
+ "x-ts-dynamic-id": zod.z.string().optional(),
622
+ "x-ts-secret": zod.z.string(),
623
+ "x-ts-params": zod.z.string().transform((s) => JSON.parse(s)),
624
+ "x-ts-http-url": zod.z.string(),
625
+ "x-ts-http-method": zod.z.string(),
626
+ "x-ts-http-headers": zod.z.string().transform((s) => zod.z.record(zod.z.string()).parse(JSON.parse(s)))
627
+ });
628
+ var PongSuccessResponseSchema = zod.z.object({
629
+ ok: zod.z.literal(true),
630
+ triggerVersion: zod.z.string().optional(),
631
+ triggerSdkVersion: zod.z.string().optional()
632
+ });
633
+ var PongErrorResponseSchema = zod.z.object({
634
+ ok: zod.z.literal(false),
635
+ error: zod.z.string(),
636
+ triggerVersion: zod.z.string().optional(),
637
+ triggerSdkVersion: zod.z.string().optional()
638
+ });
639
+ var PongResponseSchema = zod.z.discriminatedUnion("ok", [
640
+ PongSuccessResponseSchema,
641
+ PongErrorResponseSchema
642
+ ]);
643
+ var ValidateSuccessResponseSchema = zod.z.object({
644
+ ok: zod.z.literal(true),
645
+ endpointId: zod.z.string(),
646
+ triggerVersion: zod.z.string().optional()
647
+ });
648
+ var ValidateErrorResponseSchema = zod.z.object({
649
+ ok: zod.z.literal(false),
650
+ error: zod.z.string(),
651
+ triggerVersion: zod.z.string().optional()
652
+ });
653
+ var ValidateResponseSchema = zod.z.discriminatedUnion("ok", [
654
+ ValidateSuccessResponseSchema,
655
+ ValidateErrorResponseSchema
656
+ ]);
657
+ var QueueOptionsSchema = zod.z.object({
658
+ name: zod.z.string(),
659
+ maxConcurrent: zod.z.number().optional()
660
+ });
661
+ var ConcurrencyLimitOptionsSchema = zod.z.object({
662
+ id: zod.z.string(),
663
+ limit: zod.z.number()
664
+ });
665
+ var JobMetadataSchema = zod.z.object({
666
+ id: zod.z.string(),
667
+ name: zod.z.string(),
668
+ version: zod.z.string(),
669
+ event: EventSpecificationSchema,
670
+ trigger: TriggerMetadataSchema,
671
+ integrations: zod.z.record(IntegrationConfigSchema),
672
+ internal: zod.z.boolean().default(false),
673
+ enabled: zod.z.boolean(),
674
+ startPosition: zod.z.enum([
675
+ "initial",
676
+ "latest"
677
+ ]),
678
+ preprocessRuns: zod.z.boolean(),
679
+ concurrencyLimit: ConcurrencyLimitOptionsSchema.or(zod.z.number().int().positive()).optional()
680
+ });
681
+ var SourceMetadataV1Schema = zod.z.object({
682
+ version: zod.z.literal("1"),
683
+ channel: zod.z.enum([
684
+ "HTTP",
685
+ "SQS",
686
+ "SMTP"
687
+ ]),
688
+ integration: IntegrationConfigSchema,
689
+ key: zod.z.string(),
690
+ params: zod.z.any(),
691
+ events: zod.z.array(zod.z.string()),
692
+ registerSourceJob: zod.z.object({
693
+ id: zod.z.string(),
694
+ version: zod.z.string()
695
+ }).optional()
696
+ });
697
+ var SourceMetadataV2Schema = zod.z.object({
698
+ version: zod.z.literal("2"),
699
+ channel: zod.z.enum([
700
+ "HTTP",
701
+ "SQS",
702
+ "SMTP"
703
+ ]),
704
+ integration: IntegrationConfigSchema,
705
+ key: zod.z.string(),
706
+ params: zod.z.any(),
707
+ options: zod.z.record(zod.z.array(zod.z.string())),
708
+ registerSourceJob: zod.z.object({
709
+ id: zod.z.string(),
710
+ version: zod.z.string()
711
+ }).optional()
712
+ });
713
+ var SourceMetadataSchema = zod.z.preprocess(addMissingVersionField, zod.z.discriminatedUnion("version", [
714
+ SourceMetadataV1Schema,
715
+ SourceMetadataV2Schema
716
+ ]));
717
+ var WebhookMetadataSchema = zod.z.object({
718
+ key: zod.z.string(),
719
+ params: zod.z.any(),
720
+ config: zod.z.record(zod.z.array(zod.z.string())),
721
+ integration: IntegrationConfigSchema,
722
+ httpEndpoint: zod.z.object({
723
+ id: zod.z.string()
724
+ })
725
+ });
726
+ var WebhookContextMetadataSchema = zod.z.object({
727
+ params: zod.z.any(),
728
+ config: zod.z.record(zod.z.string().array()),
729
+ secret: zod.z.string()
730
+ });
731
+ var DynamicTriggerEndpointMetadataSchema = zod.z.object({
732
+ id: zod.z.string(),
733
+ jobs: zod.z.array(JobMetadataSchema.pick({
734
+ id: true,
735
+ version: true
736
+ })),
737
+ registerSourceJob: zod.z.object({
738
+ id: zod.z.string(),
739
+ version: zod.z.string()
740
+ }).optional()
741
+ });
742
+ var HttpEndpointMetadataSchema = zod.z.object({
743
+ id: zod.z.string(),
744
+ version: zod.z.string(),
745
+ enabled: zod.z.boolean(),
746
+ title: zod.z.string().optional(),
747
+ icon: zod.z.string().optional(),
748
+ properties: zod.z.array(DisplayPropertySchema).optional(),
749
+ event: EventSpecificationSchema,
750
+ immediateResponseFilter: RequestFilterSchema.optional(),
751
+ skipTriggeringRuns: zod.z.boolean().optional(),
752
+ source: zod.z.string()
753
+ });
754
+ var IndexEndpointResponseSchema = zod.z.object({
755
+ jobs: zod.z.array(JobMetadataSchema),
756
+ sources: zod.z.array(SourceMetadataSchema),
757
+ webhooks: zod.z.array(WebhookMetadataSchema).optional(),
758
+ dynamicTriggers: zod.z.array(DynamicTriggerEndpointMetadataSchema),
759
+ dynamicSchedules: zod.z.array(RegisterDynamicSchedulePayloadSchema),
760
+ httpEndpoints: zod.z.array(HttpEndpointMetadataSchema).optional()
761
+ });
762
+ var EndpointIndexErrorSchema = zod.z.object({
763
+ message: zod.z.string(),
764
+ raw: zod.z.any().optional()
765
+ });
766
+ var IndexEndpointStatsSchema = zod.z.object({
767
+ jobs: zod.z.number(),
768
+ sources: zod.z.number(),
769
+ webhooks: zod.z.number().optional(),
770
+ dynamicTriggers: zod.z.number(),
771
+ dynamicSchedules: zod.z.number(),
772
+ disabledJobs: zod.z.number().default(0),
773
+ httpEndpoints: zod.z.number().default(0)
774
+ });
775
+ function parseEndpointIndexStats(stats) {
776
+ if (stats === null || stats === void 0) {
777
+ return;
778
+ }
779
+ return IndexEndpointStatsSchema.parse(stats);
780
+ }
781
+ __name(parseEndpointIndexStats, "parseEndpointIndexStats");
782
+ var GetEndpointIndexResponseSchema = zod.z.discriminatedUnion("status", [
783
+ zod.z.object({
784
+ status: zod.z.literal("PENDING"),
785
+ updatedAt: zod.z.coerce.date()
786
+ }),
787
+ zod.z.object({
788
+ status: zod.z.literal("STARTED"),
789
+ updatedAt: zod.z.coerce.date()
790
+ }),
791
+ zod.z.object({
792
+ status: zod.z.literal("SUCCESS"),
793
+ stats: IndexEndpointStatsSchema,
794
+ updatedAt: zod.z.coerce.date()
795
+ }),
796
+ zod.z.object({
797
+ status: zod.z.literal("FAILURE"),
798
+ error: EndpointIndexErrorSchema,
799
+ updatedAt: zod.z.coerce.date()
800
+ })
801
+ ]);
802
+ var EndpointHeadersSchema = zod.z.object({
803
+ "trigger-version": zod.z.string().optional(),
804
+ "trigger-sdk-version": zod.z.string().optional()
805
+ });
806
+ var ExecuteJobRunMetadataSchema = zod.z.object({
807
+ successSubscription: zod.z.boolean().optional(),
808
+ failedSubscription: zod.z.boolean().optional()
809
+ });
810
+ var ExecuteJobHeadersSchema = EndpointHeadersSchema.extend({
811
+ "x-trigger-run-metadata": zod.z.preprocess((val) => typeof val === "string" && JSON.parse(val), ExecuteJobRunMetadataSchema).optional()
812
+ });
813
+ var RawEventSchema = zod.z.object({
814
+ /** The `name` property must exactly match any subscriptions you want to
815
+ trigger. */
816
+ name: zod.z.string(),
817
+ /** The `payload` property will be sent to any matching Jobs and will appear
818
+ as the `payload` param of the `run()` function. You can leave this
819
+ parameter out if you just want to trigger a Job without any input data. */
820
+ payload: zod.z.any(),
821
+ /** The optional `context` property will be sent to any matching Jobs and will
822
+ be passed through as the `context.event.context` param of the `run()`
823
+ function. This is optional but can be useful if you want to pass through
824
+ some additional context to the Job. */
825
+ context: zod.z.any().optional(),
826
+ /** The `id` property uniquely identify this particular event. If unset it
827
+ will be set automatically using `ulid`. */
828
+ id: zod.z.string().default(() => ulidx.ulid()),
829
+ /** This is optional, it defaults to the current timestamp. Usually you would
830
+ only set this if you have a timestamp that you wish to pass through, e.g.
831
+ you receive a timestamp from a service and you want the same timestamp to
832
+ be used in your Job. */
833
+ timestamp: zod.z.coerce.date().optional(),
834
+ /** This is optional, it defaults to "trigger.dev". It can be useful to set
835
+ this as you can filter events using this in the `eventTrigger()`. */
836
+ source: zod.z.string().optional(),
837
+ /** This is optional, it defaults to "JSON". If your event is actually a request,
838
+ with a url, headers, method and rawBody you can use "REQUEST" */
839
+ payloadType: zod.z.union([
840
+ zod.z.literal("JSON"),
841
+ zod.z.literal("REQUEST")
842
+ ]).optional()
843
+ });
844
+ var ApiEventLogSchema = zod.z.object({
845
+ /** The `id` of the event that was sent.
846
+ */
847
+ id: zod.z.string(),
848
+ /** The `name` of the event that was sent. */
849
+ name: zod.z.string(),
850
+ /** The `payload` of the event that was sent */
851
+ payload: DeserializedJsonSchema,
852
+ /** The `context` of the event that was sent. Is `undefined` if no context was
853
+ set when sending the event. */
854
+ context: DeserializedJsonSchema.optional().nullable(),
855
+ /** The `timestamp` of the event that was sent */
856
+ timestamp: zod.z.coerce.date(),
857
+ /** The timestamp when the event will be delivered to any matching Jobs. Is
858
+ `undefined` if `deliverAt` or `deliverAfter` wasn't set when sending the
859
+ event. */
860
+ deliverAt: zod.z.coerce.date().optional().nullable(),
861
+ /** The timestamp when the event was delivered. Is `undefined` if `deliverAt`
862
+ or `deliverAfter` were set when sending the event. */
863
+ deliveredAt: zod.z.coerce.date().optional().nullable(),
864
+ /** The timestamp when the event was cancelled. Is `undefined` if the event
865
+ * wasn't cancelled. */
866
+ cancelledAt: zod.z.coerce.date().optional().nullable()
867
+ });
868
+ var SendEventOptionsSchema = zod.z.object({
869
+ /** An optional Date when you want the event to trigger Jobs. The event will
870
+ be sent to the platform immediately but won't be acted upon until the
871
+ specified time. */
872
+ deliverAt: zod.z.coerce.date().optional(),
873
+ /** An optional number of seconds you want to wait for the event to trigger
874
+ any relevant Jobs. The event will be sent to the platform immediately but
875
+ won't be delivered until after the elapsed number of seconds. */
876
+ deliverAfter: zod.z.number().int().optional(),
877
+ /** This optional param will be used by Trigger.dev Connect, which
878
+ is coming soon. */
879
+ accountId: zod.z.string().optional()
880
+ });
881
+ var SendEventBodySchema = zod.z.object({
882
+ event: RawEventSchema,
883
+ options: SendEventOptionsSchema.optional()
884
+ });
885
+ var SendBulkEventsBodySchema = zod.z.object({
886
+ events: RawEventSchema.array(),
887
+ options: SendEventOptionsSchema.optional()
888
+ });
889
+ var DeliverEventResponseSchema = zod.z.object({
890
+ deliveredAt: zod.z.string().datetime()
891
+ });
892
+ var RuntimeEnvironmentTypeSchema = zod.z.enum([
893
+ "PRODUCTION",
894
+ "STAGING",
895
+ "DEVELOPMENT",
896
+ "PREVIEW"
897
+ ]);
898
+ var RunSourceContextSchema = zod.z.object({
899
+ id: zod.z.string(),
900
+ metadata: zod.z.any()
901
+ });
902
+ var AutoYieldConfigSchema = zod.z.object({
903
+ startTaskThreshold: zod.z.number(),
904
+ beforeExecuteTaskThreshold: zod.z.number(),
905
+ beforeCompleteTaskThreshold: zod.z.number(),
906
+ afterCompleteTaskThreshold: zod.z.number()
907
+ });
908
+ var RunJobBodySchema = zod.z.object({
909
+ event: ApiEventLogSchema,
910
+ job: zod.z.object({
911
+ id: zod.z.string(),
912
+ version: zod.z.string()
913
+ }),
914
+ run: zod.z.object({
915
+ id: zod.z.string(),
916
+ isTest: zod.z.boolean(),
917
+ isRetry: zod.z.boolean().default(false),
918
+ startedAt: zod.z.coerce.date()
919
+ }),
920
+ environment: zod.z.object({
921
+ id: zod.z.string(),
922
+ slug: zod.z.string(),
923
+ type: RuntimeEnvironmentTypeSchema
924
+ }),
925
+ organization: zod.z.object({
926
+ id: zod.z.string(),
927
+ title: zod.z.string(),
928
+ slug: zod.z.string()
929
+ }),
930
+ project: zod.z.object({
931
+ id: zod.z.string(),
932
+ name: zod.z.string(),
933
+ slug: zod.z.string()
934
+ }).optional(),
935
+ account: zod.z.object({
936
+ id: zod.z.string(),
937
+ metadata: zod.z.any()
938
+ }).optional(),
939
+ source: RunSourceContextSchema.optional(),
940
+ tasks: zod.z.array(CachedTaskSchema).optional(),
941
+ cachedTaskCursor: zod.z.string().optional(),
942
+ noopTasksSet: zod.z.string().optional(),
943
+ connections: zod.z.record(ConnectionAuthSchema).optional(),
944
+ yieldedExecutions: zod.z.string().array().optional(),
945
+ runChunkExecutionLimit: zod.z.number().optional(),
946
+ autoYieldConfig: AutoYieldConfigSchema.optional()
947
+ });
948
+ var RunJobErrorSchema = zod.z.object({
949
+ status: zod.z.literal("ERROR"),
950
+ error: ErrorWithStackSchema,
951
+ task: TaskSchema.optional()
952
+ });
953
+ var RunJobYieldExecutionErrorSchema = zod.z.object({
954
+ status: zod.z.literal("YIELD_EXECUTION"),
955
+ key: zod.z.string()
956
+ });
957
+ var AutoYieldMetadataSchema = zod.z.object({
958
+ location: zod.z.string(),
959
+ timeRemaining: zod.z.number(),
960
+ timeElapsed: zod.z.number(),
961
+ limit: zod.z.number().optional()
962
+ });
963
+ var RunJobAutoYieldExecutionErrorSchema = AutoYieldMetadataSchema.extend({
964
+ status: zod.z.literal("AUTO_YIELD_EXECUTION")
965
+ });
966
+ var RunJobAutoYieldWithCompletedTaskExecutionErrorSchema = zod.z.object({
967
+ status: zod.z.literal("AUTO_YIELD_EXECUTION_WITH_COMPLETED_TASK"),
968
+ id: zod.z.string(),
969
+ properties: zod.z.array(DisplayPropertySchema).optional(),
970
+ output: zod.z.string().optional(),
971
+ data: AutoYieldMetadataSchema
972
+ });
973
+ var RunJobAutoYieldRateLimitErrorSchema = zod.z.object({
974
+ status: zod.z.literal("AUTO_YIELD_RATE_LIMIT"),
975
+ reset: zod.z.coerce.number()
976
+ });
977
+ var RunJobInvalidPayloadErrorSchema = zod.z.object({
978
+ status: zod.z.literal("INVALID_PAYLOAD"),
979
+ errors: zod.z.array(SchemaErrorSchema)
980
+ });
981
+ var RunJobUnresolvedAuthErrorSchema = zod.z.object({
982
+ status: zod.z.literal("UNRESOLVED_AUTH_ERROR"),
983
+ issues: zod.z.record(zod.z.object({
984
+ id: zod.z.string(),
985
+ error: zod.z.string()
986
+ }))
987
+ });
988
+ var RunJobResumeWithTaskSchema = zod.z.object({
989
+ status: zod.z.literal("RESUME_WITH_TASK"),
990
+ task: TaskSchema
991
+ });
992
+ var RunJobRetryWithTaskSchema = zod.z.object({
993
+ status: zod.z.literal("RETRY_WITH_TASK"),
994
+ task: TaskSchema,
995
+ error: ErrorWithStackSchema,
996
+ retryAt: zod.z.coerce.date()
997
+ });
998
+ var RunJobCanceledWithTaskSchema = zod.z.object({
999
+ status: zod.z.literal("CANCELED"),
1000
+ task: TaskSchema
1001
+ });
1002
+ var RunJobSuccessSchema = zod.z.object({
1003
+ status: zod.z.literal("SUCCESS"),
1004
+ output: DeserializedJsonSchema.optional()
1005
+ });
1006
+ var RunJobErrorResponseSchema = zod.z.union([
1007
+ RunJobAutoYieldExecutionErrorSchema,
1008
+ RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
1009
+ RunJobYieldExecutionErrorSchema,
1010
+ RunJobAutoYieldRateLimitErrorSchema,
1011
+ RunJobErrorSchema,
1012
+ RunJobUnresolvedAuthErrorSchema,
1013
+ RunJobInvalidPayloadErrorSchema,
1014
+ RunJobResumeWithTaskSchema,
1015
+ RunJobRetryWithTaskSchema,
1016
+ RunJobCanceledWithTaskSchema
1017
+ ]);
1018
+ var RunJobResumeWithParallelTaskSchema = zod.z.object({
1019
+ status: zod.z.literal("RESUME_WITH_PARALLEL_TASK"),
1020
+ task: TaskSchema,
1021
+ childErrors: zod.z.array(RunJobErrorResponseSchema)
1022
+ });
1023
+ var RunJobResponseSchema = zod.z.discriminatedUnion("status", [
1024
+ RunJobAutoYieldExecutionErrorSchema,
1025
+ RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
1026
+ RunJobYieldExecutionErrorSchema,
1027
+ RunJobAutoYieldRateLimitErrorSchema,
1028
+ RunJobErrorSchema,
1029
+ RunJobUnresolvedAuthErrorSchema,
1030
+ RunJobInvalidPayloadErrorSchema,
1031
+ RunJobResumeWithTaskSchema,
1032
+ RunJobResumeWithParallelTaskSchema,
1033
+ RunJobRetryWithTaskSchema,
1034
+ RunJobCanceledWithTaskSchema,
1035
+ RunJobSuccessSchema
1036
+ ]);
1037
+ var PreprocessRunBodySchema = zod.z.object({
1038
+ event: ApiEventLogSchema,
1039
+ job: zod.z.object({
1040
+ id: zod.z.string(),
1041
+ version: zod.z.string()
1042
+ }),
1043
+ run: zod.z.object({
1044
+ id: zod.z.string(),
1045
+ isTest: zod.z.boolean()
1046
+ }),
1047
+ environment: zod.z.object({
1048
+ id: zod.z.string(),
1049
+ slug: zod.z.string(),
1050
+ type: RuntimeEnvironmentTypeSchema
1051
+ }),
1052
+ organization: zod.z.object({
1053
+ id: zod.z.string(),
1054
+ title: zod.z.string(),
1055
+ slug: zod.z.string()
1056
+ }),
1057
+ account: zod.z.object({
1058
+ id: zod.z.string(),
1059
+ metadata: zod.z.any()
1060
+ }).optional()
1061
+ });
1062
+ var PreprocessRunResponseSchema = zod.z.object({
1063
+ abort: zod.z.boolean(),
1064
+ properties: zod.z.array(DisplayPropertySchema).optional()
1065
+ });
1066
+ var CreateRunResponseOkSchema = zod.z.object({
1067
+ ok: zod.z.literal(true),
1068
+ data: zod.z.object({
1069
+ id: zod.z.string()
1070
+ })
1071
+ });
1072
+ var CreateRunResponseErrorSchema = zod.z.object({
1073
+ ok: zod.z.literal(false),
1074
+ error: zod.z.string()
1075
+ });
1076
+ var CreateRunResponseBodySchema = zod.z.discriminatedUnion("ok", [
1077
+ CreateRunResponseOkSchema,
1078
+ CreateRunResponseErrorSchema
1079
+ ]);
1080
+ var RedactStringSchema = zod.z.object({
1081
+ __redactedString: zod.z.literal(true),
1082
+ strings: zod.z.array(zod.z.string()),
1083
+ interpolations: zod.z.array(zod.z.string())
1084
+ });
1085
+ var LogMessageSchema = zod.z.object({
1086
+ level: zod.z.enum([
1087
+ "DEBUG",
1088
+ "INFO",
1089
+ "WARN",
1090
+ "ERROR"
1091
+ ]),
1092
+ message: zod.z.string(),
1093
+ data: SerializableJsonSchema.optional()
1094
+ });
1095
+ var RedactSchema = zod.z.object({
1096
+ paths: zod.z.array(zod.z.string())
1097
+ });
1098
+ var RetryOptionsSchema = zod.z.object({
1099
+ /** The maximum number of times to retry the request. */
1100
+ limit: zod.z.number().optional(),
1101
+ /** The exponential factor to use when calculating the next retry time. */
1102
+ factor: zod.z.number().optional(),
1103
+ /** The minimum amount of time to wait before retrying the request. */
1104
+ minTimeoutInMs: zod.z.number().optional(),
1105
+ /** The maximum amount of time to wait before retrying the request. */
1106
+ maxTimeoutInMs: zod.z.number().optional(),
1107
+ /** Whether to randomize the retry time. */
1108
+ randomize: zod.z.boolean().optional()
1109
+ });
1110
+ var RunTaskOptionsSchema = zod.z.object({
1111
+ /** The name of the Task is required. This is displayed on the Task in the logs. */
1112
+ name: zod.z.string().optional(),
1113
+ /** The Task will wait and only start at the specified Date */
1114
+ delayUntil: zod.z.coerce.date().optional(),
1115
+ /** Retry options */
1116
+ retry: RetryOptionsSchema.optional(),
1117
+ /** The icon for the Task, it will appear in the logs.
1118
+ * You can use the name of a company in lowercase, e.g. "github".
1119
+ * Or any icon name that [Tabler Icons](https://tabler-icons.io/) supports. */
1120
+ icon: zod.z.string().optional(),
1121
+ /** The key for the Task that you want to appear in the logs */
1122
+ displayKey: zod.z.string().optional(),
1123
+ /** A description of the Task */
1124
+ description: zod.z.string().optional(),
1125
+ /** Properties that are displayed in the logs */
1126
+ properties: zod.z.array(DisplayPropertySchema).optional(),
1127
+ /** The input params to the Task, will be displayed in the logs */
1128
+ params: zod.z.any(),
1129
+ /** The style of the log entry. */
1130
+ style: StyleSchema.optional(),
1131
+ /** Allows you to expose a `task.callbackUrl` to use in your tasks. Enabling this feature will cause the task to return the data sent to the callbackUrl instead of the usual async callback result. */
1132
+ callback: zod.z.object({
1133
+ /** Causes the task to wait for and return the data of the first request sent to `task.callbackUrl`. */
1134
+ enabled: zod.z.boolean(),
1135
+ /** Time to wait for the first request to `task.callbackUrl`. Default: One hour. */
1136
+ timeoutInSeconds: zod.z.number()
1137
+ }).partial().optional(),
1138
+ /** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
1139
+ connectionKey: zod.z.string().optional(),
1140
+ /** An operation you want to perform on the Trigger.dev platform, current only "fetch", "fetch-response", and "fetch-poll" is supported. If you wish to `fetch` use [`io.backgroundFetch()`](https://trigger.dev/docs/sdk/io/backgroundfetch) instead. */
1141
+ operation: zod.z.enum([
1142
+ "fetch",
1143
+ "fetch-response",
1144
+ "fetch-poll"
1145
+ ]).optional(),
1146
+ /** A No Operation means that the code won't be executed. This is used internally to implement features like [io.wait()](https://trigger.dev/docs/sdk/io/wait). */
1147
+ noop: zod.z.boolean().default(false),
1148
+ redact: RedactSchema.optional(),
1149
+ parallel: zod.z.boolean().optional()
1150
+ });
1151
+ var RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({
1152
+ idempotencyKey: zod.z.string(),
1153
+ parentId: zod.z.string().optional()
1154
+ });
1155
+ var RunTaskBodyOutputSchema = RunTaskBodyInputSchema.extend({
1156
+ properties: zod.z.array(DisplayPropertySchema.partial()).optional(),
1157
+ params: DeserializedJsonSchema.optional().nullable(),
1158
+ callback: zod.z.object({
1159
+ enabled: zod.z.boolean(),
1160
+ timeoutInSeconds: zod.z.number().default(3600)
1161
+ }).optional()
1162
+ });
1163
+ var RunTaskResponseWithCachedTasksBodySchema = zod.z.object({
1164
+ task: ServerTaskSchema,
1165
+ cachedTasks: zod.z.object({
1166
+ tasks: zod.z.array(CachedTaskSchema),
1167
+ cursor: zod.z.string().optional()
1168
+ }).optional()
1169
+ });
1170
+ var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
1171
+ properties: true,
1172
+ description: true,
1173
+ params: true
1174
+ }).extend({
1175
+ output: SerializableJsonSchema.optional().transform((v) => v ? DeserializedJsonSchema.parse(JSON.parse(JSON.stringify(v))) : {})
1176
+ });
1177
+ var CompleteTaskBodyV2InputSchema = RunTaskBodyInputSchema.pick({
1178
+ properties: true,
1179
+ description: true,
1180
+ params: true
1181
+ }).extend({
1182
+ output: zod.z.string().optional()
1183
+ });
1184
+ var FailTaskBodyInputSchema = zod.z.object({
1185
+ error: ErrorWithStackSchema
1186
+ });
1187
+ var NormalizedRequestSchema = zod.z.object({
1188
+ headers: zod.z.record(zod.z.string()),
1189
+ method: zod.z.string(),
1190
+ query: zod.z.record(zod.z.string()),
1191
+ url: zod.z.string(),
1192
+ body: zod.z.any()
1193
+ });
1194
+ var NormalizedResponseSchema = zod.z.object({
1195
+ status: zod.z.number(),
1196
+ body: zod.z.any(),
1197
+ headers: zod.z.record(zod.z.string()).optional()
1198
+ });
1199
+ var HttpSourceResponseSchema = zod.z.object({
1200
+ response: NormalizedResponseSchema,
1201
+ events: zod.z.array(RawEventSchema),
1202
+ metadata: HttpSourceResponseMetadataSchema.optional()
1203
+ });
1204
+ var WebhookDeliveryResponseSchema = zod.z.object({
1205
+ response: NormalizedResponseSchema,
1206
+ verified: zod.z.boolean(),
1207
+ error: zod.z.string().optional()
1208
+ });
1209
+ var RegisterTriggerBodySchemaV1 = zod.z.object({
1210
+ rule: EventRuleSchema,
1211
+ source: SourceMetadataV1Schema
1212
+ });
1213
+ var RegisterTriggerBodySchemaV2 = zod.z.object({
1214
+ rule: EventRuleSchema,
1215
+ source: SourceMetadataV2Schema,
1216
+ accountId: zod.z.string().optional()
1217
+ });
1218
+ var InitializeTriggerBodySchema = zod.z.object({
1219
+ id: zod.z.string(),
1220
+ params: zod.z.any(),
1221
+ accountId: zod.z.string().optional(),
1222
+ metadata: zod.z.any().optional()
1223
+ });
1224
+ var RegisterCommonScheduleBodySchema = zod.z.object({
1225
+ /** A unique id for the schedule. This is used to identify and unregister the schedule later. */
1226
+ id: zod.z.string(),
1227
+ /** Any additional metadata about the schedule. */
1228
+ metadata: zod.z.any(),
1229
+ /** An optional Account ID to associate with runs triggered by this schedule */
1230
+ accountId: zod.z.string().optional()
1231
+ });
1232
+ var RegisterIntervalScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(IntervalMetadataSchema);
1233
+ var InitializeCronScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(CronMetadataSchema);
1234
+ var RegisterScheduleBodySchema = zod.z.discriminatedUnion("type", [
1235
+ RegisterIntervalScheduleBodySchema,
1236
+ InitializeCronScheduleBodySchema
1237
+ ]);
1238
+ var RegisterScheduleResponseBodySchema = zod.z.object({
1239
+ id: zod.z.string(),
1240
+ schedule: ScheduleMetadataSchema,
1241
+ metadata: zod.z.any(),
1242
+ active: zod.z.boolean()
1243
+ });
1244
+ var CreateExternalConnectionBodySchema = zod.z.object({
1245
+ accessToken: zod.z.string(),
1246
+ type: zod.z.enum([
1247
+ "oauth2"
1248
+ ]),
1249
+ scopes: zod.z.array(zod.z.string()).optional(),
1250
+ metadata: zod.z.any()
1251
+ });
1252
+ var GetRunStatusesSchema = zod.z.object({
1253
+ run: zod.z.object({
1254
+ id: zod.z.string(),
1255
+ status: RunStatusSchema,
1256
+ output: zod.z.any().optional()
1257
+ }),
1258
+ statuses: zod.z.array(JobRunStatusRecordSchema)
1259
+ });
1260
+ var InvokeJobResponseSchema = zod.z.object({
1261
+ id: zod.z.string()
1262
+ });
1263
+ var InvokeJobRequestBodySchema = zod.z.object({
1264
+ payload: zod.z.any(),
1265
+ context: zod.z.any().optional(),
1266
+ options: zod.z.object({
1267
+ accountId: zod.z.string().optional(),
1268
+ callbackUrl: zod.z.string().optional()
1269
+ }).optional()
1270
+ });
1271
+ var InvokeOptionsSchema = zod.z.object({
1272
+ accountId: zod.z.string().optional(),
1273
+ idempotencyKey: zod.z.string().optional(),
1274
+ context: zod.z.any().optional(),
1275
+ callbackUrl: zod.z.string().optional()
1276
+ });
1277
+ var EphemeralEventDispatcherRequestBodySchema = zod.z.object({
1278
+ url: zod.z.string(),
1279
+ name: zod.z.string().or(zod.z.array(zod.z.string())),
1280
+ source: zod.z.string().optional(),
1281
+ filter: EventFilterSchema.optional(),
1282
+ contextFilter: EventFilterSchema.optional(),
1283
+ accountId: zod.z.string().optional(),
1284
+ timeoutInSeconds: zod.z.number().int().positive().min(10).max(60 * 60 * 24 * 365).default(3600)
1285
+ });
1286
+ var EphemeralEventDispatcherResponseBodySchema = zod.z.object({
1287
+ id: zod.z.string()
1288
+ });
1289
+ var KeyValueStoreResponseBodySchema = zod.z.discriminatedUnion("action", [
1290
+ zod.z.object({
1291
+ action: zod.z.literal("DELETE"),
1292
+ key: zod.z.string(),
1293
+ deleted: zod.z.boolean()
1294
+ }),
1295
+ zod.z.object({
1296
+ action: zod.z.literal("GET"),
1297
+ key: zod.z.string(),
1298
+ value: zod.z.string().optional()
1299
+ }),
1300
+ zod.z.object({
1301
+ action: zod.z.literal("HAS"),
1302
+ key: zod.z.string(),
1303
+ has: zod.z.boolean()
1304
+ }),
1305
+ zod.z.object({
1306
+ action: zod.z.literal("SET"),
1307
+ key: zod.z.string(),
1308
+ value: zod.z.string().optional()
1309
+ })
1310
+ ]);
1311
+ var MISSING_CONNECTION_NOTIFICATION = "dev.trigger.notifications.missingConnection";
1312
+ var MISSING_CONNECTION_RESOLVED_NOTIFICATION = "dev.trigger.notifications.missingConnectionResolved";
1313
+ var CommonMissingConnectionNotificationPayloadSchema = zod.z.object({
1314
+ id: zod.z.string(),
1315
+ client: zod.z.object({
1316
+ id: zod.z.string(),
1317
+ title: zod.z.string(),
1318
+ scopes: zod.z.array(zod.z.string()),
1319
+ createdAt: zod.z.coerce.date(),
1320
+ updatedAt: zod.z.coerce.date()
1321
+ }),
1322
+ authorizationUrl: zod.z.string()
1323
+ });
1324
+ var MissingDeveloperConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
1325
+ type: zod.z.literal("DEVELOPER")
1326
+ });
1327
+ var MissingExternalConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
1328
+ type: zod.z.literal("EXTERNAL"),
1329
+ account: zod.z.object({
1330
+ id: zod.z.string(),
1331
+ metadata: zod.z.any()
1332
+ })
1333
+ });
1334
+ var MissingConnectionNotificationPayloadSchema = zod.z.discriminatedUnion("type", [
1335
+ MissingDeveloperConnectionNotificationPayloadSchema,
1336
+ MissingExternalConnectionNotificationPayloadSchema
1337
+ ]);
1338
+ var CommonMissingConnectionNotificationResolvedPayloadSchema = zod.z.object({
1339
+ id: zod.z.string(),
1340
+ client: zod.z.object({
1341
+ id: zod.z.string(),
1342
+ title: zod.z.string(),
1343
+ scopes: zod.z.array(zod.z.string()),
1344
+ createdAt: zod.z.coerce.date(),
1345
+ updatedAt: zod.z.coerce.date(),
1346
+ integrationIdentifier: zod.z.string(),
1347
+ integrationAuthMethod: zod.z.string()
1348
+ }),
1349
+ expiresAt: zod.z.coerce.date()
1350
+ });
1351
+ var MissingDeveloperConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
1352
+ type: zod.z.literal("DEVELOPER")
1353
+ });
1354
+ var MissingExternalConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
1355
+ type: zod.z.literal("EXTERNAL"),
1356
+ account: zod.z.object({
1357
+ id: zod.z.string(),
1358
+ metadata: zod.z.any()
1359
+ })
1360
+ });
1361
+ var MissingConnectionResolvedNotificationPayloadSchema = zod.z.discriminatedUnion("type", [
1362
+ MissingDeveloperConnectionResolvedNotificationPayloadSchema,
1363
+ MissingExternalConnectionResolvedNotificationPayloadSchema
1364
+ ]);
1365
+ var FetchRetryHeadersStrategySchema = zod.z.object({
1366
+ /** The `headers` strategy retries the request using info from the response headers. */
1367
+ strategy: zod.z.literal("headers"),
1368
+ /** The header to use to determine the maximum number of times to retry the request. */
1369
+ limitHeader: zod.z.string(),
1370
+ /** The header to use to determine the number of remaining retries. */
1371
+ remainingHeader: zod.z.string(),
1372
+ /** The header to use to determine the time when the number of remaining retries will be reset. */
1373
+ resetHeader: zod.z.string(),
1374
+ /** The event filter to use to determine if the request should be retried. */
1375
+ bodyFilter: EventFilterSchema.optional(),
1376
+ /** The format of the `resetHeader` value. */
1377
+ resetFormat: zod.z.enum([
1378
+ "unix_timestamp",
1379
+ "unix_timestamp_in_ms",
1380
+ "iso_8601",
1381
+ "iso_8601_duration_openai_variant"
1382
+ ]).default("unix_timestamp")
1383
+ });
1384
+ var FetchRetryBackoffStrategySchema = RetryOptionsSchema.extend({
1385
+ /** The `backoff` strategy retries the request with an exponential backoff. */
1386
+ strategy: zod.z.literal("backoff"),
1387
+ /** The event filter to use to determine if the request should be retried. */
1388
+ bodyFilter: EventFilterSchema.optional()
1389
+ });
1390
+ var FetchRetryStrategySchema = zod.z.discriminatedUnion("strategy", [
1391
+ FetchRetryHeadersStrategySchema,
1392
+ FetchRetryBackoffStrategySchema
1393
+ ]);
1394
+ var FetchRequestInitSchema = zod.z.object({
1395
+ /** The HTTP method to use for the request. */
1396
+ method: zod.z.string().optional(),
1397
+ /** Any headers to send with the request. Note that you can use [redactString](https://trigger.dev/docs/sdk/redactString) to prevent sensitive information from being stored (e.g. in the logs), like API keys and tokens. */
1398
+ headers: zod.z.record(zod.z.union([
1399
+ zod.z.string(),
1400
+ RedactStringSchema
1401
+ ])).optional(),
1402
+ /** The body of the request. */
1403
+ body: zod.z.union([
1404
+ zod.z.string(),
1405
+ zod.z.instanceof(ArrayBuffer)
1406
+ ]).optional()
1407
+ });
1408
+ var FetchRetryOptionsSchema = zod.z.record(FetchRetryStrategySchema);
1409
+ var FetchTimeoutOptionsSchema = zod.z.object({
1410
+ durationInMs: zod.z.number(),
1411
+ retry: RetryOptionsSchema.optional()
1412
+ });
1413
+ var FetchOperationSchema = zod.z.object({
1414
+ url: zod.z.string(),
1415
+ requestInit: FetchRequestInitSchema.optional(),
1416
+ retry: zod.z.record(FetchRetryStrategySchema).optional(),
1417
+ timeout: FetchTimeoutOptionsSchema.optional()
1418
+ });
1419
+ var FetchPollOperationSchema = zod.z.object({
1420
+ url: zod.z.string(),
1421
+ interval: zod.z.number().int().positive().min(10).max(600).default(10),
1422
+ timeout: zod.z.number().int().positive().min(30).max(3600).default(600),
1423
+ responseFilter: ResponseFilterSchema,
1424
+ requestInit: FetchRequestInitSchema.optional(),
1425
+ requestTimeout: FetchTimeoutOptionsSchema.optional()
1426
+ });
1427
+ var GetEventSchema = zod.z.object({
1428
+ /** The event id */
1429
+ id: zod.z.string(),
1430
+ /** The event name */
1431
+ name: zod.z.string(),
1432
+ /** When the event was created */
1433
+ createdAt: zod.z.coerce.date(),
1434
+ /** When the event was last updated */
1435
+ updatedAt: zod.z.coerce.date(),
1436
+ /** The runs that were triggered by the event */
1437
+ runs: zod.z.array(zod.z.object({
1438
+ /** The Run id */
1439
+ id: zod.z.string(),
1440
+ /** The Run status */
1441
+ status: RunStatusSchema,
1442
+ /** When the run started */
1443
+ startedAt: zod.z.coerce.date().optional().nullable(),
1444
+ /** When the run completed */
1445
+ completedAt: zod.z.coerce.date().optional().nullable()
1446
+ }))
1447
+ });
1448
+ var CancelRunsForEventSchema = zod.z.object({
1449
+ cancelledRunIds: zod.z.array(zod.z.string()),
1450
+ failedToCancelRunIds: zod.z.array(zod.z.string())
1451
+ });
1452
+ var RequestWithRawBodySchema = zod.z.object({
1453
+ url: zod.z.string(),
1454
+ method: zod.z.string(),
1455
+ headers: zod.z.record(zod.z.string()),
1456
+ rawBody: zod.z.string()
1457
+ });
1458
+ var CancelRunsForJobSchema = zod.z.object({
1459
+ cancelledRunIds: zod.z.array(zod.z.string()),
1460
+ failedToCancelRunIds: zod.z.array(zod.z.string())
1461
+ });
1462
+
1463
+ exports.ApiEventLogSchema = ApiEventLogSchema;
1464
+ exports.AutoYieldConfigSchema = AutoYieldConfigSchema;
1465
+ exports.AutoYieldMetadataSchema = AutoYieldMetadataSchema;
1466
+ exports.CachedTaskSchema = CachedTaskSchema;
1467
+ exports.CancelRunsForEventSchema = CancelRunsForEventSchema;
1468
+ exports.CancelRunsForJobSchema = CancelRunsForJobSchema;
1469
+ exports.CommonMissingConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema;
1470
+ exports.CommonMissingConnectionNotificationResolvedPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema;
1471
+ exports.CompleteTaskBodyInputSchema = CompleteTaskBodyInputSchema;
1472
+ exports.CompleteTaskBodyV2InputSchema = CompleteTaskBodyV2InputSchema;
1473
+ exports.ConcurrencyLimitOptionsSchema = ConcurrencyLimitOptionsSchema;
1474
+ exports.ConnectionAuthSchema = ConnectionAuthSchema;
1475
+ exports.CreateExternalConnectionBodySchema = CreateExternalConnectionBodySchema;
1476
+ exports.CreateRunResponseBodySchema = CreateRunResponseBodySchema;
1477
+ exports.CronMetadataSchema = CronMetadataSchema;
1478
+ exports.CronOptionsSchema = CronOptionsSchema;
1479
+ exports.DELIVER_WEBHOOK_REQUEST = DELIVER_WEBHOOK_REQUEST;
1480
+ exports.DeliverEventResponseSchema = DeliverEventResponseSchema;
1481
+ exports.DeserializedJsonSchema = DeserializedJsonSchema;
1482
+ exports.DisplayPropertiesSchema = DisplayPropertiesSchema;
1483
+ exports.DisplayPropertySchema = DisplayPropertySchema;
1484
+ exports.DynamicTriggerEndpointMetadataSchema = DynamicTriggerEndpointMetadataSchema;
1485
+ exports.DynamicTriggerMetadataSchema = DynamicTriggerMetadataSchema;
1486
+ exports.EndpointHeadersSchema = EndpointHeadersSchema;
1487
+ exports.EndpointIndexErrorSchema = EndpointIndexErrorSchema;
1488
+ exports.EphemeralEventDispatcherRequestBodySchema = EphemeralEventDispatcherRequestBodySchema;
1489
+ exports.EphemeralEventDispatcherResponseBodySchema = EphemeralEventDispatcherResponseBodySchema;
1490
+ exports.ErrorWithStackSchema = ErrorWithStackSchema;
1491
+ exports.EventExampleSchema = EventExampleSchema;
1492
+ exports.EventFilterSchema = EventFilterSchema;
1493
+ exports.EventRuleSchema = EventRuleSchema;
1494
+ exports.EventSpecificationSchema = EventSpecificationSchema;
1495
+ exports.ExecuteJobHeadersSchema = ExecuteJobHeadersSchema;
1496
+ exports.ExecuteJobRunMetadataSchema = ExecuteJobRunMetadataSchema;
1497
+ exports.FailTaskBodyInputSchema = FailTaskBodyInputSchema;
1498
+ exports.FetchOperationSchema = FetchOperationSchema;
1499
+ exports.FetchPollOperationSchema = FetchPollOperationSchema;
1500
+ exports.FetchRequestInitSchema = FetchRequestInitSchema;
1501
+ exports.FetchRetryBackoffStrategySchema = FetchRetryBackoffStrategySchema;
1502
+ exports.FetchRetryHeadersStrategySchema = FetchRetryHeadersStrategySchema;
1503
+ exports.FetchRetryOptionsSchema = FetchRetryOptionsSchema;
1504
+ exports.FetchRetryStrategySchema = FetchRetryStrategySchema;
1505
+ exports.FetchTimeoutOptionsSchema = FetchTimeoutOptionsSchema;
1506
+ exports.GetEndpointIndexResponseSchema = GetEndpointIndexResponseSchema;
1507
+ exports.GetEventSchema = GetEventSchema;
1508
+ exports.GetRunSchema = GetRunSchema;
1509
+ exports.GetRunStatusesSchema = GetRunStatusesSchema;
1510
+ exports.GetRunsSchema = GetRunsSchema;
1511
+ exports.HTTPMethodUnionSchema = HTTPMethodUnionSchema;
1512
+ exports.HandleTriggerSourceSchema = HandleTriggerSourceSchema;
1513
+ exports.HttpEndpointRequestHeadersSchema = HttpEndpointRequestHeadersSchema;
1514
+ exports.HttpSourceRequestHeadersSchema = HttpSourceRequestHeadersSchema;
1515
+ exports.HttpSourceResponseSchema = HttpSourceResponseSchema;
1516
+ exports.IndexEndpointResponseSchema = IndexEndpointResponseSchema;
1517
+ exports.InitializeCronScheduleBodySchema = InitializeCronScheduleBodySchema;
1518
+ exports.InitializeTriggerBodySchema = InitializeTriggerBodySchema;
1519
+ exports.IntegrationConfigSchema = IntegrationConfigSchema;
1520
+ exports.IntegrationMetadataSchema = IntegrationMetadataSchema;
1521
+ exports.IntervalMetadataSchema = IntervalMetadataSchema;
1522
+ exports.IntervalOptionsSchema = IntervalOptionsSchema;
1523
+ exports.InvokeJobRequestBodySchema = InvokeJobRequestBodySchema;
1524
+ exports.InvokeJobResponseSchema = InvokeJobResponseSchema;
1525
+ exports.InvokeOptionsSchema = InvokeOptionsSchema;
1526
+ exports.InvokeTriggerMetadataSchema = InvokeTriggerMetadataSchema;
1527
+ exports.JobMetadataSchema = JobMetadataSchema;
1528
+ exports.JobRunStatusRecordSchema = JobRunStatusRecordSchema;
1529
+ exports.KeyValueStoreResponseBodySchema = KeyValueStoreResponseBodySchema;
1530
+ exports.LogMessageSchema = LogMessageSchema;
1531
+ exports.MISSING_CONNECTION_NOTIFICATION = MISSING_CONNECTION_NOTIFICATION;
1532
+ exports.MISSING_CONNECTION_RESOLVED_NOTIFICATION = MISSING_CONNECTION_RESOLVED_NOTIFICATION;
1533
+ exports.MissingConnectionNotificationPayloadSchema = MissingConnectionNotificationPayloadSchema;
1534
+ exports.MissingConnectionResolvedNotificationPayloadSchema = MissingConnectionResolvedNotificationPayloadSchema;
1535
+ exports.MissingDeveloperConnectionNotificationPayloadSchema = MissingDeveloperConnectionNotificationPayloadSchema;
1536
+ exports.MissingDeveloperConnectionResolvedNotificationPayloadSchema = MissingDeveloperConnectionResolvedNotificationPayloadSchema;
1537
+ exports.MissingExternalConnectionNotificationPayloadSchema = MissingExternalConnectionNotificationPayloadSchema;
1538
+ exports.MissingExternalConnectionResolvedNotificationPayloadSchema = MissingExternalConnectionResolvedNotificationPayloadSchema;
1539
+ exports.NormalizedRequestSchema = NormalizedRequestSchema;
1540
+ exports.NormalizedResponseSchema = NormalizedResponseSchema;
1541
+ exports.PongErrorResponseSchema = PongErrorResponseSchema;
1542
+ exports.PongResponseSchema = PongResponseSchema;
1543
+ exports.PongSuccessResponseSchema = PongSuccessResponseSchema;
1544
+ exports.PreprocessRunBodySchema = PreprocessRunBodySchema;
1545
+ exports.PreprocessRunResponseSchema = PreprocessRunResponseSchema;
1546
+ exports.QueueOptionsSchema = QueueOptionsSchema;
1547
+ exports.REGISTER_SOURCE_EVENT_V1 = REGISTER_SOURCE_EVENT_V1;
1548
+ exports.REGISTER_SOURCE_EVENT_V2 = REGISTER_SOURCE_EVENT_V2;
1549
+ exports.REGISTER_WEBHOOK = REGISTER_WEBHOOK;
1550
+ exports.RawEventSchema = RawEventSchema;
1551
+ exports.RedactSchema = RedactSchema;
1552
+ exports.RedactStringSchema = RedactStringSchema;
1553
+ exports.RegisterDynamicSchedulePayloadSchema = RegisterDynamicSchedulePayloadSchema;
1554
+ exports.RegisterHTTPTriggerSourceBodySchema = RegisterHTTPTriggerSourceBodySchema;
1555
+ exports.RegisterIntervalScheduleBodySchema = RegisterIntervalScheduleBodySchema;
1556
+ exports.RegisterSMTPTriggerSourceBodySchema = RegisterSMTPTriggerSourceBodySchema;
1557
+ exports.RegisterSQSTriggerSourceBodySchema = RegisterSQSTriggerSourceBodySchema;
1558
+ exports.RegisterScheduleBodySchema = RegisterScheduleBodySchema;
1559
+ exports.RegisterScheduleResponseBodySchema = RegisterScheduleResponseBodySchema;
1560
+ exports.RegisterSourceChannelBodySchema = RegisterSourceChannelBodySchema;
1561
+ exports.RegisterSourceEventSchemaV1 = RegisterSourceEventSchemaV1;
1562
+ exports.RegisterSourceEventSchemaV2 = RegisterSourceEventSchemaV2;
1563
+ exports.RegisterTriggerBodySchemaV1 = RegisterTriggerBodySchemaV1;
1564
+ exports.RegisterTriggerBodySchemaV2 = RegisterTriggerBodySchemaV2;
1565
+ exports.RegisterTriggerSourceSchema = RegisterTriggerSourceSchema;
1566
+ exports.RegisterWebhookPayloadSchema = RegisterWebhookPayloadSchema;
1567
+ exports.RegisterWebhookSourceSchema = RegisterWebhookSourceSchema;
1568
+ exports.RequestFilterSchema = RequestFilterSchema;
1569
+ exports.RequestWithRawBodySchema = RequestWithRawBodySchema;
1570
+ exports.ResponseFilterSchema = ResponseFilterSchema;
1571
+ exports.RetryOptionsSchema = RetryOptionsSchema;
1572
+ exports.RunJobAutoYieldExecutionErrorSchema = RunJobAutoYieldExecutionErrorSchema;
1573
+ exports.RunJobAutoYieldRateLimitErrorSchema = RunJobAutoYieldRateLimitErrorSchema;
1574
+ exports.RunJobAutoYieldWithCompletedTaskExecutionErrorSchema = RunJobAutoYieldWithCompletedTaskExecutionErrorSchema;
1575
+ exports.RunJobBodySchema = RunJobBodySchema;
1576
+ exports.RunJobCanceledWithTaskSchema = RunJobCanceledWithTaskSchema;
1577
+ exports.RunJobErrorResponseSchema = RunJobErrorResponseSchema;
1578
+ exports.RunJobErrorSchema = RunJobErrorSchema;
1579
+ exports.RunJobInvalidPayloadErrorSchema = RunJobInvalidPayloadErrorSchema;
1580
+ exports.RunJobResponseSchema = RunJobResponseSchema;
1581
+ exports.RunJobResumeWithParallelTaskSchema = RunJobResumeWithParallelTaskSchema;
1582
+ exports.RunJobResumeWithTaskSchema = RunJobResumeWithTaskSchema;
1583
+ exports.RunJobRetryWithTaskSchema = RunJobRetryWithTaskSchema;
1584
+ exports.RunJobSuccessSchema = RunJobSuccessSchema;
1585
+ exports.RunJobUnresolvedAuthErrorSchema = RunJobUnresolvedAuthErrorSchema;
1586
+ exports.RunJobYieldExecutionErrorSchema = RunJobYieldExecutionErrorSchema;
1587
+ exports.RunSourceContextSchema = RunSourceContextSchema;
1588
+ exports.RunStatusSchema = RunStatusSchema;
1589
+ exports.RunTaskBodyInputSchema = RunTaskBodyInputSchema;
1590
+ exports.RunTaskBodyOutputSchema = RunTaskBodyOutputSchema;
1591
+ exports.RunTaskOptionsSchema = RunTaskOptionsSchema;
1592
+ exports.RunTaskResponseWithCachedTasksBodySchema = RunTaskResponseWithCachedTasksBodySchema;
1593
+ exports.RunTaskSchema = RunTaskSchema;
1594
+ exports.RuntimeEnvironmentTypeSchema = RuntimeEnvironmentTypeSchema;
1595
+ exports.SCHEDULED_EVENT = SCHEDULED_EVENT;
1596
+ exports.ScheduleMetadataSchema = ScheduleMetadataSchema;
1597
+ exports.ScheduledPayloadSchema = ScheduledPayloadSchema;
1598
+ exports.ScheduledTriggerMetadataSchema = ScheduledTriggerMetadataSchema;
1599
+ exports.SchemaErrorSchema = SchemaErrorSchema;
1600
+ exports.SendBulkEventsBodySchema = SendBulkEventsBodySchema;
1601
+ exports.SendEventBodySchema = SendEventBodySchema;
1602
+ exports.SendEventOptionsSchema = SendEventOptionsSchema;
1603
+ exports.SerializableJsonSchema = SerializableJsonSchema;
1604
+ exports.ServerTaskSchema = ServerTaskSchema;
1605
+ exports.SourceMetadataV2Schema = SourceMetadataV2Schema;
1606
+ exports.StaticTriggerMetadataSchema = StaticTriggerMetadataSchema;
1607
+ exports.StatusHistorySchema = StatusHistorySchema;
1608
+ exports.StatusUpdateSchema = StatusUpdateSchema;
1609
+ exports.StatusUpdateStateSchema = StatusUpdateStateSchema;
1610
+ exports.StyleSchema = StyleSchema;
1611
+ exports.TaskSchema = TaskSchema;
1612
+ exports.TaskStatusSchema = TaskStatusSchema;
1613
+ exports.TriggerHelpSchema = TriggerHelpSchema;
1614
+ exports.TriggerMetadataSchema = TriggerMetadataSchema;
1615
+ exports.TriggerSourceSchema = TriggerSourceSchema;
1616
+ exports.UpdateTriggerSourceBodyV1Schema = UpdateTriggerSourceBodyV1Schema;
1617
+ exports.UpdateTriggerSourceBodyV2Schema = UpdateTriggerSourceBodyV2Schema;
1618
+ exports.UpdateWebhookBodySchema = UpdateWebhookBodySchema;
1619
+ exports.ValidateErrorResponseSchema = ValidateErrorResponseSchema;
1620
+ exports.ValidateResponseSchema = ValidateResponseSchema;
1621
+ exports.ValidateSuccessResponseSchema = ValidateSuccessResponseSchema;
1622
+ exports.WebhookContextMetadataSchema = WebhookContextMetadataSchema;
1623
+ exports.WebhookDeliveryResponseSchema = WebhookDeliveryResponseSchema;
1624
+ exports.WebhookMetadataSchema = WebhookMetadataSchema;
1625
+ exports.WebhookSourceRequestHeadersSchema = WebhookSourceRequestHeadersSchema;
1626
+ exports.addMissingVersionField = addMissingVersionField;
1627
+ exports.parseEndpointIndexStats = parseEndpointIndexStats;
1628
+ exports.stringPatternMatchers = stringPatternMatchers;
1629
+ //# sourceMappingURL=out.js.map
1630
+ //# sourceMappingURL=index.js.map