@trigger.dev/sdk 2.0.0-next.9 → 2.0.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.js CHANGED
@@ -146,880 +146,13 @@ validate_fn = /* @__PURE__ */ __name(function() {
146
146
  }
147
147
  }, "#validate");
148
148
 
149
- // ../internal/src/logger.ts
150
- var logLevels = [
151
- "log",
152
- "error",
153
- "warn",
154
- "info",
155
- "debug"
156
- ];
157
- var _name, _level, _filteredKeys, _jsonReplacer;
158
- var _Logger = class {
159
- constructor(name, level = "info", filteredKeys = [], jsonReplacer) {
160
- __privateAdd(this, _name, void 0);
161
- __privateAdd(this, _level, void 0);
162
- __privateAdd(this, _filteredKeys, []);
163
- __privateAdd(this, _jsonReplacer, void 0);
164
- __privateSet(this, _name, name);
165
- __privateSet(this, _level, logLevels.indexOf(process.env.TRIGGER_LOG_LEVEL ?? level));
166
- __privateSet(this, _filteredKeys, filteredKeys);
167
- __privateSet(this, _jsonReplacer, jsonReplacer);
168
- }
169
- filter(...keys) {
170
- return new _Logger(__privateGet(this, _name), logLevels[__privateGet(this, _level)], keys, __privateGet(this, _jsonReplacer));
171
- }
172
- static satisfiesLogLevel(logLevel, setLevel) {
173
- return logLevels.indexOf(logLevel) <= logLevels.indexOf(setLevel);
174
- }
175
- log(...args) {
176
- if (__privateGet(this, _level) < 0)
177
- return;
178
- console.log(`[${formattedDateTime()}] [${__privateGet(this, _name)}] `, ...args);
179
- }
180
- error(...args) {
181
- if (__privateGet(this, _level) < 1)
182
- return;
183
- console.error(`[${formattedDateTime()}] [${__privateGet(this, _name)}] `, ...args);
184
- }
185
- warn(...args) {
186
- if (__privateGet(this, _level) < 2)
187
- return;
188
- console.warn(`[${formattedDateTime()}] [${__privateGet(this, _name)}] `, ...args);
189
- }
190
- info(...args) {
191
- if (__privateGet(this, _level) < 3)
192
- return;
193
- console.info(`[${formattedDateTime()}] [${__privateGet(this, _name)}] `, ...args);
194
- }
195
- debug(message, ...args) {
196
- if (__privateGet(this, _level) < 4)
197
- return;
198
- const structuredLog = {
199
- timestamp: new Date(),
200
- name: __privateGet(this, _name),
201
- message,
202
- args: structureArgs(safeJsonClone(args), __privateGet(this, _filteredKeys))
203
- };
204
- console.debug(JSON.stringify(structuredLog, createReplacer(__privateGet(this, _jsonReplacer))));
205
- }
206
- };
207
- var Logger = _Logger;
208
- __name(Logger, "Logger");
209
- _name = new WeakMap();
210
- _level = new WeakMap();
211
- _filteredKeys = new WeakMap();
212
- _jsonReplacer = new WeakMap();
213
- function createReplacer(replacer) {
214
- return (key, value) => {
215
- if (typeof value === "bigint") {
216
- return value.toString();
217
- }
218
- if (replacer) {
219
- return replacer(key, value);
220
- }
221
- return value;
222
- };
223
- }
224
- __name(createReplacer, "createReplacer");
225
- function bigIntReplacer(_key, value) {
226
- if (typeof value === "bigint") {
227
- return value.toString();
228
- }
229
- return value;
230
- }
231
- __name(bigIntReplacer, "bigIntReplacer");
232
- function safeJsonClone(obj) {
233
- try {
234
- return JSON.parse(JSON.stringify(obj, bigIntReplacer));
235
- } catch (e) {
236
- return obj;
237
- }
238
- }
239
- __name(safeJsonClone, "safeJsonClone");
240
- function formattedDateTime() {
241
- const date = new Date();
242
- const hours = date.getHours();
243
- const minutes = date.getMinutes();
244
- const seconds = date.getSeconds();
245
- const milliseconds = date.getMilliseconds();
246
- const formattedHours = hours < 10 ? `0${hours}` : hours;
247
- const formattedMinutes = minutes < 10 ? `0${minutes}` : minutes;
248
- const formattedSeconds = seconds < 10 ? `0${seconds}` : seconds;
249
- const formattedMilliseconds = milliseconds < 10 ? `00${milliseconds}` : milliseconds < 100 ? `0${milliseconds}` : milliseconds;
250
- return `${formattedHours}:${formattedMinutes}:${formattedSeconds}.${formattedMilliseconds}`;
251
- }
252
- __name(formattedDateTime, "formattedDateTime");
253
- function structureArgs(args, filteredKeys = []) {
254
- if (args.length === 0) {
255
- return;
256
- }
257
- if (args.length === 1 && typeof args[0] === "object") {
258
- return filterKeys(JSON.parse(JSON.stringify(args[0], bigIntReplacer)), filteredKeys);
259
- }
260
- return args;
261
- }
262
- __name(structureArgs, "structureArgs");
263
- function filterKeys(obj, keys) {
264
- if (typeof obj !== "object" || obj === null) {
265
- return obj;
266
- }
267
- if (Array.isArray(obj)) {
268
- return obj.map((item) => filterKeys(item, keys));
269
- }
270
- const filteredObj = {};
271
- for (const [key, value] of Object.entries(obj)) {
272
- if (keys.includes(key)) {
273
- continue;
274
- }
275
- filteredObj[key] = filterKeys(value, keys);
276
- }
277
- return filteredObj;
278
- }
279
- __name(filterKeys, "filterKeys");
280
-
281
- // ../internal/src/schemas/api.ts
282
- var import_ulid = require("ulid");
283
- var import_zod9 = require("zod");
284
-
285
- // ../internal/src/schemas/errors.ts
286
- var import_zod = require("zod");
287
- var ErrorWithStackSchema = import_zod.z.object({
288
- message: import_zod.z.string(),
289
- name: import_zod.z.string().optional(),
290
- stack: import_zod.z.string().optional()
291
- });
292
-
293
- // ../internal/src/schemas/eventFilter.ts
294
- var import_zod2 = require("zod");
295
- var EventMatcherSchema = import_zod2.z.union([
296
- import_zod2.z.array(import_zod2.z.string()),
297
- import_zod2.z.array(import_zod2.z.number()),
298
- import_zod2.z.array(import_zod2.z.boolean())
299
- ]);
300
- var EventFilterSchema = import_zod2.z.lazy(() => import_zod2.z.record(import_zod2.z.union([
301
- EventMatcherSchema,
302
- EventFilterSchema
303
- ])));
304
- var EventRuleSchema = import_zod2.z.object({
305
- event: import_zod2.z.string(),
306
- source: import_zod2.z.string(),
307
- payload: EventFilterSchema.optional(),
308
- context: EventFilterSchema.optional()
309
- });
310
-
311
- // ../internal/src/schemas/integrations.ts
312
- var import_zod3 = require("zod");
313
- var ConnectionAuthSchema = import_zod3.z.object({
314
- type: import_zod3.z.enum([
315
- "oauth2"
316
- ]),
317
- accessToken: import_zod3.z.string(),
318
- scopes: import_zod3.z.array(import_zod3.z.string()).optional(),
319
- additionalFields: import_zod3.z.record(import_zod3.z.string()).optional()
320
- });
321
- var IntegrationMetadataSchema = import_zod3.z.object({
322
- id: import_zod3.z.string(),
323
- name: import_zod3.z.string(),
324
- instructions: import_zod3.z.string().optional()
325
- });
326
- var IntegrationConfigSchema = import_zod3.z.object({
327
- id: import_zod3.z.string(),
328
- metadata: IntegrationMetadataSchema,
329
- authSource: import_zod3.z.enum([
330
- "HOSTED",
331
- "LOCAL"
332
- ])
333
- });
334
-
335
- // ../internal/src/schemas/json.ts
336
- var import_zod4 = require("zod");
337
- var LiteralSchema = import_zod4.z.union([
338
- import_zod4.z.string(),
339
- import_zod4.z.number(),
340
- import_zod4.z.boolean(),
341
- import_zod4.z.null()
342
- ]);
343
- var DeserializedJsonSchema = import_zod4.z.lazy(() => import_zod4.z.union([
344
- LiteralSchema,
345
- import_zod4.z.array(DeserializedJsonSchema),
346
- import_zod4.z.record(DeserializedJsonSchema)
347
- ]));
348
- var SerializableSchema = import_zod4.z.union([
349
- import_zod4.z.string(),
350
- import_zod4.z.number(),
351
- import_zod4.z.boolean(),
352
- import_zod4.z.null(),
353
- import_zod4.z.date(),
354
- import_zod4.z.undefined(),
355
- import_zod4.z.symbol()
356
- ]);
357
- var SerializableJsonSchema = import_zod4.z.lazy(() => import_zod4.z.union([
358
- SerializableSchema,
359
- import_zod4.z.array(SerializableJsonSchema),
360
- import_zod4.z.record(SerializableJsonSchema)
361
- ]));
362
-
363
- // ../internal/src/schemas/properties.ts
364
- var import_zod5 = require("zod");
365
- var DisplayPropertySchema = import_zod5.z.object({
366
- label: import_zod5.z.string(),
367
- text: import_zod5.z.string(),
368
- url: import_zod5.z.string().optional()
369
- });
370
- var DisplayPropertiesSchema = import_zod5.z.array(DisplayPropertySchema);
371
- var StyleSchema = import_zod5.z.object({
372
- style: import_zod5.z.enum([
373
- "normal",
374
- "minimal"
375
- ]),
376
- variant: import_zod5.z.string().optional()
377
- });
378
-
379
- // ../internal/src/schemas/schedules.ts
380
- var import_zod6 = require("zod");
381
- var ScheduledPayloadSchema = import_zod6.z.object({
382
- ts: import_zod6.z.coerce.date(),
383
- lastTimestamp: import_zod6.z.coerce.date().optional()
384
- });
385
- var IntervalOptionsSchema = import_zod6.z.object({
386
- seconds: import_zod6.z.number().int().positive().min(60).max(86400)
387
- });
388
- var CronOptionsSchema = import_zod6.z.object({
389
- cron: import_zod6.z.string()
390
- });
391
- var CronMetadataSchema = import_zod6.z.object({
392
- type: import_zod6.z.literal("cron"),
393
- options: CronOptionsSchema,
394
- metadata: import_zod6.z.any()
395
- });
396
- var IntervalMetadataSchema = import_zod6.z.object({
397
- type: import_zod6.z.literal("interval"),
398
- options: IntervalOptionsSchema,
399
- metadata: import_zod6.z.any()
400
- });
401
- var ScheduleMetadataSchema = import_zod6.z.discriminatedUnion("type", [
402
- IntervalMetadataSchema,
403
- CronMetadataSchema
404
- ]);
405
- var RegisterDynamicSchedulePayloadSchema = import_zod6.z.object({
406
- id: import_zod6.z.string(),
407
- jobs: import_zod6.z.array(import_zod6.z.object({
408
- id: import_zod6.z.string(),
409
- version: import_zod6.z.string()
410
- }))
411
- });
412
-
413
- // ../internal/src/schemas/tasks.ts
414
- var import_zod7 = require("zod");
415
- var TaskStatusSchema = import_zod7.z.enum([
416
- "PENDING",
417
- "WAITING",
418
- "RUNNING",
419
- "COMPLETED",
420
- "ERRORED"
421
- ]);
422
- var TaskSchema = import_zod7.z.object({
423
- id: import_zod7.z.string(),
424
- name: import_zod7.z.string(),
425
- icon: import_zod7.z.string().optional().nullable(),
426
- noop: import_zod7.z.boolean(),
427
- startedAt: import_zod7.z.coerce.date().optional().nullable(),
428
- completedAt: import_zod7.z.coerce.date().optional().nullable(),
429
- delayUntil: import_zod7.z.coerce.date().optional().nullable(),
430
- status: TaskStatusSchema,
431
- description: import_zod7.z.string().optional().nullable(),
432
- properties: import_zod7.z.array(DisplayPropertySchema).optional().nullable(),
433
- params: DeserializedJsonSchema.optional().nullable(),
434
- output: DeserializedJsonSchema.optional().nullable(),
435
- error: import_zod7.z.string().optional().nullable(),
436
- parentId: import_zod7.z.string().optional().nullable(),
437
- style: StyleSchema.optional().nullable(),
438
- operation: import_zod7.z.string().optional().nullable()
439
- });
440
- var ServerTaskSchema = TaskSchema.extend({
441
- idempotencyKey: import_zod7.z.string(),
442
- attempts: import_zod7.z.number()
443
- });
444
- var CachedTaskSchema = import_zod7.z.object({
445
- id: import_zod7.z.string(),
446
- idempotencyKey: import_zod7.z.string(),
447
- status: TaskStatusSchema,
448
- noop: import_zod7.z.boolean().default(false),
449
- output: DeserializedJsonSchema.optional().nullable(),
450
- parentId: import_zod7.z.string().optional().nullable()
451
- });
452
-
453
- // ../internal/src/schemas/triggers.ts
454
- var import_zod8 = require("zod");
455
- var EventExampleSchema = import_zod8.z.object({
456
- id: import_zod8.z.string(),
457
- icon: import_zod8.z.string().optional(),
458
- name: import_zod8.z.string(),
459
- payload: import_zod8.z.any()
460
- });
461
- var EventSpecificationSchema = import_zod8.z.object({
462
- name: import_zod8.z.string(),
463
- title: import_zod8.z.string(),
464
- source: import_zod8.z.string(),
465
- icon: import_zod8.z.string(),
466
- filter: EventFilterSchema.optional(),
467
- properties: import_zod8.z.array(DisplayPropertySchema).optional(),
468
- schema: import_zod8.z.any().optional(),
469
- examples: import_zod8.z.array(EventExampleSchema).optional()
470
- });
471
- var DynamicTriggerMetadataSchema = import_zod8.z.object({
472
- type: import_zod8.z.literal("dynamic"),
473
- id: import_zod8.z.string()
474
- });
475
- var StaticTriggerMetadataSchema = import_zod8.z.object({
476
- type: import_zod8.z.literal("static"),
477
- title: import_zod8.z.string(),
478
- properties: import_zod8.z.array(DisplayPropertySchema).optional(),
479
- rule: EventRuleSchema
480
- });
481
- var ScheduledTriggerMetadataSchema = import_zod8.z.object({
482
- type: import_zod8.z.literal("scheduled"),
483
- schedule: ScheduleMetadataSchema
484
- });
485
- var TriggerMetadataSchema = import_zod8.z.discriminatedUnion("type", [
486
- DynamicTriggerMetadataSchema,
487
- StaticTriggerMetadataSchema,
488
- ScheduledTriggerMetadataSchema
489
- ]);
490
-
491
- // ../internal/src/schemas/api.ts
492
- var UpdateTriggerSourceBodySchema = import_zod9.z.object({
493
- registeredEvents: import_zod9.z.array(import_zod9.z.string()),
494
- secret: import_zod9.z.string().optional(),
495
- data: SerializableJsonSchema.optional()
496
- });
497
- var HttpEventSourceSchema = UpdateTriggerSourceBodySchema.extend({
498
- id: import_zod9.z.string(),
499
- active: import_zod9.z.boolean(),
500
- url: import_zod9.z.string().url()
501
- });
502
- var RegisterHTTPTriggerSourceBodySchema = import_zod9.z.object({
503
- type: import_zod9.z.literal("HTTP"),
504
- url: import_zod9.z.string().url()
505
- });
506
- var RegisterSMTPTriggerSourceBodySchema = import_zod9.z.object({
507
- type: import_zod9.z.literal("SMTP")
508
- });
509
- var RegisterSQSTriggerSourceBodySchema = import_zod9.z.object({
510
- type: import_zod9.z.literal("SQS")
511
- });
512
- var RegisterSourceChannelBodySchema = import_zod9.z.discriminatedUnion("type", [
513
- RegisterHTTPTriggerSourceBodySchema,
514
- RegisterSMTPTriggerSourceBodySchema,
515
- RegisterSQSTriggerSourceBodySchema
516
- ]);
517
- var REGISTER_SOURCE_EVENT = "dev.trigger.source.register";
518
- var RegisterTriggerSourceSchema = import_zod9.z.object({
519
- key: import_zod9.z.string(),
520
- params: import_zod9.z.any(),
521
- active: import_zod9.z.boolean(),
522
- secret: import_zod9.z.string(),
523
- data: DeserializedJsonSchema.optional(),
524
- channel: RegisterSourceChannelBodySchema,
525
- clientId: import_zod9.z.string().optional()
526
- });
527
- var RegisterSourceEventSchema = import_zod9.z.object({
528
- id: import_zod9.z.string(),
529
- source: RegisterTriggerSourceSchema,
530
- events: import_zod9.z.array(import_zod9.z.string()),
531
- missingEvents: import_zod9.z.array(import_zod9.z.string()),
532
- orphanedEvents: import_zod9.z.array(import_zod9.z.string()),
533
- dynamicTriggerId: import_zod9.z.string().optional()
534
- });
535
- var TriggerSourceSchema = import_zod9.z.object({
536
- id: import_zod9.z.string(),
537
- key: import_zod9.z.string()
538
- });
539
- var HandleTriggerSourceSchema = import_zod9.z.object({
540
- key: import_zod9.z.string(),
541
- secret: import_zod9.z.string(),
542
- data: import_zod9.z.any(),
543
- params: import_zod9.z.any()
544
- });
545
- var HttpSourceRequestSchema = import_zod9.z.object({
546
- url: import_zod9.z.string().url(),
547
- method: import_zod9.z.string(),
548
- headers: import_zod9.z.record(import_zod9.z.string()),
549
- rawBody: import_zod9.z.instanceof(Buffer).optional().nullable()
550
- });
551
- var HttpSourceRequestHeadersSchema = import_zod9.z.object({
552
- "x-ts-key": import_zod9.z.string(),
553
- "x-ts-dynamic-id": import_zod9.z.string().optional(),
554
- "x-ts-secret": import_zod9.z.string(),
555
- "x-ts-data": import_zod9.z.string().transform((s) => JSON.parse(s)),
556
- "x-ts-params": import_zod9.z.string().transform((s) => JSON.parse(s)),
557
- "x-ts-http-url": import_zod9.z.string(),
558
- "x-ts-http-method": import_zod9.z.string(),
559
- "x-ts-http-headers": import_zod9.z.string().transform((s) => import_zod9.z.record(import_zod9.z.string()).parse(JSON.parse(s)))
560
- });
561
- var PongSuccessResponseSchema = import_zod9.z.object({
562
- ok: import_zod9.z.literal(true)
563
- });
564
- var PongErrorResponseSchema = import_zod9.z.object({
565
- ok: import_zod9.z.literal(false),
566
- error: import_zod9.z.string()
567
- });
568
- var PongResponseSchema = import_zod9.z.discriminatedUnion("ok", [
569
- PongSuccessResponseSchema,
570
- PongErrorResponseSchema
571
- ]);
572
- var QueueOptionsSchema = import_zod9.z.object({
573
- name: import_zod9.z.string(),
574
- maxConcurrent: import_zod9.z.number().optional()
575
- });
576
- var JobMetadataSchema = import_zod9.z.object({
577
- id: import_zod9.z.string(),
578
- name: import_zod9.z.string(),
579
- version: import_zod9.z.string(),
580
- event: EventSpecificationSchema,
581
- trigger: TriggerMetadataSchema,
582
- integrations: import_zod9.z.record(IntegrationConfigSchema),
583
- internal: import_zod9.z.boolean().default(false),
584
- queue: import_zod9.z.union([
585
- QueueOptionsSchema,
586
- import_zod9.z.string()
587
- ]).optional(),
588
- startPosition: import_zod9.z.enum([
589
- "initial",
590
- "latest"
591
- ]),
592
- enabled: import_zod9.z.boolean(),
593
- preprocessRuns: import_zod9.z.boolean()
594
- });
595
- var SourceMetadataSchema = import_zod9.z.object({
596
- channel: import_zod9.z.enum([
597
- "HTTP",
598
- "SQS",
599
- "SMTP"
600
- ]),
601
- integration: IntegrationConfigSchema,
602
- key: import_zod9.z.string(),
603
- params: import_zod9.z.any(),
604
- events: import_zod9.z.array(import_zod9.z.string())
605
- });
606
- var DynamicTriggerEndpointMetadataSchema = import_zod9.z.object({
607
- id: import_zod9.z.string(),
608
- jobs: import_zod9.z.array(JobMetadataSchema.pick({
609
- id: true,
610
- version: true
611
- }))
612
- });
613
- var IndexEndpointResponseSchema = import_zod9.z.object({
614
- jobs: import_zod9.z.array(JobMetadataSchema),
615
- sources: import_zod9.z.array(SourceMetadataSchema),
616
- dynamicTriggers: import_zod9.z.array(DynamicTriggerEndpointMetadataSchema),
617
- dynamicSchedules: import_zod9.z.array(RegisterDynamicSchedulePayloadSchema)
618
- });
619
- var RawEventSchema = import_zod9.z.object({
620
- name: import_zod9.z.string(),
621
- payload: import_zod9.z.any(),
622
- context: import_zod9.z.any().optional(),
623
- id: import_zod9.z.string().default(() => (0, import_ulid.ulid)()),
624
- timestamp: import_zod9.z.coerce.date().optional(),
625
- source: import_zod9.z.string().optional()
626
- });
627
- var ApiEventLogSchema = import_zod9.z.object({
628
- id: import_zod9.z.string(),
629
- name: import_zod9.z.string(),
630
- payload: DeserializedJsonSchema,
631
- context: DeserializedJsonSchema.optional().nullable(),
632
- timestamp: import_zod9.z.coerce.date(),
633
- deliverAt: import_zod9.z.coerce.date().optional().nullable(),
634
- deliveredAt: import_zod9.z.coerce.date().optional().nullable()
635
- });
636
- var SendEventOptionsSchema = import_zod9.z.object({
637
- deliverAt: import_zod9.z.coerce.date().optional(),
638
- deliverAfter: import_zod9.z.number().int().optional(),
639
- accountId: import_zod9.z.string().optional()
640
- });
641
- var SendEventBodySchema = import_zod9.z.object({
642
- event: RawEventSchema,
643
- options: SendEventOptionsSchema.optional()
644
- });
645
- var DeliverEventResponseSchema = import_zod9.z.object({
646
- deliveredAt: import_zod9.z.string().datetime()
647
- });
648
- var RuntimeEnvironmentTypeSchema = import_zod9.z.enum([
649
- "PRODUCTION",
650
- "STAGING",
651
- "DEVELOPMENT",
652
- "PREVIEW"
653
- ]);
654
- var RunSourceContextSchema = import_zod9.z.object({
655
- id: import_zod9.z.string(),
656
- metadata: import_zod9.z.any()
657
- });
658
- var RunJobBodySchema = import_zod9.z.object({
659
- event: ApiEventLogSchema,
660
- job: import_zod9.z.object({
661
- id: import_zod9.z.string(),
662
- version: import_zod9.z.string()
663
- }),
664
- run: import_zod9.z.object({
665
- id: import_zod9.z.string(),
666
- isTest: import_zod9.z.boolean(),
667
- startedAt: import_zod9.z.coerce.date()
668
- }),
669
- environment: import_zod9.z.object({
670
- id: import_zod9.z.string(),
671
- slug: import_zod9.z.string(),
672
- type: RuntimeEnvironmentTypeSchema
673
- }),
674
- organization: import_zod9.z.object({
675
- id: import_zod9.z.string(),
676
- title: import_zod9.z.string(),
677
- slug: import_zod9.z.string()
678
- }),
679
- account: import_zod9.z.object({
680
- id: import_zod9.z.string(),
681
- metadata: import_zod9.z.any()
682
- }).optional(),
683
- source: RunSourceContextSchema.optional(),
684
- tasks: import_zod9.z.array(CachedTaskSchema).optional(),
685
- connections: import_zod9.z.record(ConnectionAuthSchema).optional()
686
- });
687
- var RunJobErrorSchema = import_zod9.z.object({
688
- status: import_zod9.z.literal("ERROR"),
689
- error: ErrorWithStackSchema,
690
- task: TaskSchema.optional()
691
- });
692
- var RunJobResumeWithTaskSchema = import_zod9.z.object({
693
- status: import_zod9.z.literal("RESUME_WITH_TASK"),
694
- task: TaskSchema
695
- });
696
- var RunJobRetryWithTaskSchema = import_zod9.z.object({
697
- status: import_zod9.z.literal("RETRY_WITH_TASK"),
698
- task: TaskSchema,
699
- error: ErrorWithStackSchema,
700
- retryAt: import_zod9.z.coerce.date()
701
- });
702
- var RunJobSuccessSchema = import_zod9.z.object({
703
- status: import_zod9.z.literal("SUCCESS"),
704
- output: DeserializedJsonSchema.optional()
705
- });
706
- var RunJobResponseSchema = import_zod9.z.discriminatedUnion("status", [
707
- RunJobErrorSchema,
708
- RunJobResumeWithTaskSchema,
709
- RunJobRetryWithTaskSchema,
710
- RunJobSuccessSchema
711
- ]);
712
- var PreprocessRunBodySchema = import_zod9.z.object({
713
- event: ApiEventLogSchema,
714
- job: import_zod9.z.object({
715
- id: import_zod9.z.string(),
716
- version: import_zod9.z.string()
717
- }),
718
- run: import_zod9.z.object({
719
- id: import_zod9.z.string(),
720
- isTest: import_zod9.z.boolean()
721
- }),
722
- environment: import_zod9.z.object({
723
- id: import_zod9.z.string(),
724
- slug: import_zod9.z.string(),
725
- type: RuntimeEnvironmentTypeSchema
726
- }),
727
- organization: import_zod9.z.object({
728
- id: import_zod9.z.string(),
729
- title: import_zod9.z.string(),
730
- slug: import_zod9.z.string()
731
- }),
732
- account: import_zod9.z.object({
733
- id: import_zod9.z.string(),
734
- metadata: import_zod9.z.any()
735
- }).optional()
736
- });
737
- var PreprocessRunResponseSchema = import_zod9.z.object({
738
- abort: import_zod9.z.boolean(),
739
- properties: import_zod9.z.array(DisplayPropertySchema).optional()
740
- });
741
- var CreateRunBodySchema = import_zod9.z.object({
742
- client: import_zod9.z.string(),
743
- job: JobMetadataSchema,
744
- event: ApiEventLogSchema,
745
- properties: import_zod9.z.array(DisplayPropertySchema).optional()
746
- });
747
- var CreateRunResponseOkSchema = import_zod9.z.object({
748
- ok: import_zod9.z.literal(true),
749
- data: import_zod9.z.object({
750
- id: import_zod9.z.string()
751
- })
752
- });
753
- var CreateRunResponseErrorSchema = import_zod9.z.object({
754
- ok: import_zod9.z.literal(false),
755
- error: import_zod9.z.string()
756
- });
757
- var CreateRunResponseBodySchema = import_zod9.z.discriminatedUnion("ok", [
758
- CreateRunResponseOkSchema,
759
- CreateRunResponseErrorSchema
760
- ]);
761
- var RedactStringSchema = import_zod9.z.object({
762
- __redactedString: import_zod9.z.literal(true),
763
- strings: import_zod9.z.array(import_zod9.z.string()),
764
- interpolations: import_zod9.z.array(import_zod9.z.string())
765
- });
766
- var LogMessageSchema = import_zod9.z.object({
767
- level: import_zod9.z.enum([
768
- "DEBUG",
769
- "INFO",
770
- "WARN",
771
- "ERROR"
772
- ]),
773
- message: import_zod9.z.string(),
774
- data: SerializableJsonSchema.optional()
775
- });
776
- var RedactSchema = import_zod9.z.object({
777
- paths: import_zod9.z.array(import_zod9.z.string())
778
- });
779
- var RetryOptionsSchema = import_zod9.z.object({
780
- limit: import_zod9.z.number().optional(),
781
- factor: import_zod9.z.number().optional(),
782
- minTimeoutInMs: import_zod9.z.number().optional(),
783
- maxTimeoutInMs: import_zod9.z.number().optional(),
784
- randomize: import_zod9.z.boolean().optional()
785
- });
786
- var RunTaskOptionsSchema = import_zod9.z.object({
787
- name: import_zod9.z.string(),
788
- delayUntil: import_zod9.z.coerce.date().optional(),
789
- retry: RetryOptionsSchema.optional(),
790
- icon: import_zod9.z.string().optional(),
791
- displayKey: import_zod9.z.string().optional(),
792
- description: import_zod9.z.string().optional(),
793
- properties: import_zod9.z.array(DisplayPropertySchema).optional(),
794
- params: import_zod9.z.any(),
795
- style: StyleSchema.optional(),
796
- connectionKey: import_zod9.z.string().optional(),
797
- operation: import_zod9.z.enum([
798
- "fetch"
799
- ]).optional(),
800
- noop: import_zod9.z.boolean().default(false),
801
- redact: RedactSchema.optional(),
802
- trigger: TriggerMetadataSchema.optional()
803
- });
804
- var RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({
805
- idempotencyKey: import_zod9.z.string(),
806
- parentId: import_zod9.z.string().optional()
807
- });
808
- var RunTaskBodyOutputSchema = RunTaskBodyInputSchema.extend({
809
- params: DeserializedJsonSchema.optional().nullable()
810
- });
811
- var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
812
- properties: true,
813
- description: true,
814
- params: true
815
- }).extend({
816
- output: SerializableJsonSchema.optional().transform((v) => v ? DeserializedJsonSchema.parse(JSON.parse(JSON.stringify(v))) : {})
817
- });
818
- var FailTaskBodyInputSchema = import_zod9.z.object({
819
- error: ErrorWithStackSchema
820
- });
821
- var NormalizedRequestSchema = import_zod9.z.object({
822
- headers: import_zod9.z.record(import_zod9.z.string()),
823
- method: import_zod9.z.string(),
824
- query: import_zod9.z.record(import_zod9.z.string()),
825
- url: import_zod9.z.string(),
826
- body: import_zod9.z.any()
827
- });
828
- var NormalizedResponseSchema = import_zod9.z.object({
829
- status: import_zod9.z.number(),
830
- body: import_zod9.z.any(),
831
- headers: import_zod9.z.record(import_zod9.z.string()).optional()
832
- });
833
- var HttpSourceResponseSchema = import_zod9.z.object({
834
- response: NormalizedResponseSchema,
835
- events: import_zod9.z.array(RawEventSchema)
836
- });
837
- var RegisterTriggerBodySchema = import_zod9.z.object({
838
- rule: EventRuleSchema,
839
- source: SourceMetadataSchema
840
- });
841
- var InitializeTriggerBodySchema = import_zod9.z.object({
842
- id: import_zod9.z.string(),
843
- params: import_zod9.z.any(),
844
- accountId: import_zod9.z.string().optional(),
845
- metadata: import_zod9.z.any().optional()
846
- });
847
- var RegisterCommonScheduleBodySchema = import_zod9.z.object({
848
- id: import_zod9.z.string(),
849
- metadata: import_zod9.z.any(),
850
- accountId: import_zod9.z.string().optional()
851
- });
852
- var RegisterIntervalScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(IntervalMetadataSchema);
853
- var InitializeCronScheduleBodySchema = RegisterCommonScheduleBodySchema.merge(CronMetadataSchema);
854
- var RegisterScheduleBodySchema = import_zod9.z.discriminatedUnion("type", [
855
- RegisterIntervalScheduleBodySchema,
856
- InitializeCronScheduleBodySchema
857
- ]);
858
- var RegisterScheduleResponseBodySchema = import_zod9.z.object({
859
- id: import_zod9.z.string(),
860
- schedule: ScheduleMetadataSchema,
861
- metadata: import_zod9.z.any(),
862
- active: import_zod9.z.boolean()
863
- });
864
- var CreateExternalConnectionBodySchema = import_zod9.z.object({
865
- accessToken: import_zod9.z.string(),
866
- type: import_zod9.z.enum([
867
- "oauth2"
868
- ]),
869
- scopes: import_zod9.z.array(import_zod9.z.string()).optional(),
870
- metadata: import_zod9.z.any()
871
- });
872
-
873
- // ../internal/src/schemas/notifications.ts
874
- var import_zod10 = require("zod");
875
- var MISSING_CONNECTION_NOTIFICATION = "dev.trigger.notifications.missingConnection";
876
- var MISSING_CONNECTION_RESOLVED_NOTIFICATION = "dev.trigger.notifications.missingConnectionResolved";
877
- var CommonMissingConnectionNotificationPayloadSchema = import_zod10.z.object({
878
- id: import_zod10.z.string(),
879
- client: import_zod10.z.object({
880
- id: import_zod10.z.string(),
881
- title: import_zod10.z.string(),
882
- scopes: import_zod10.z.array(import_zod10.z.string()),
883
- createdAt: import_zod10.z.coerce.date(),
884
- updatedAt: import_zod10.z.coerce.date()
885
- }),
886
- authorizationUrl: import_zod10.z.string()
887
- });
888
- var MissingDeveloperConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
889
- type: import_zod10.z.literal("DEVELOPER")
890
- });
891
- var MissingExternalConnectionNotificationPayloadSchema = CommonMissingConnectionNotificationPayloadSchema.extend({
892
- type: import_zod10.z.literal("EXTERNAL"),
893
- account: import_zod10.z.object({
894
- id: import_zod10.z.string(),
895
- metadata: import_zod10.z.any()
896
- })
897
- });
898
- var MissingConnectionNotificationPayloadSchema = import_zod10.z.discriminatedUnion("type", [
899
- MissingDeveloperConnectionNotificationPayloadSchema,
900
- MissingExternalConnectionNotificationPayloadSchema
901
- ]);
902
- var CommonMissingConnectionNotificationResolvedPayloadSchema = import_zod10.z.object({
903
- id: import_zod10.z.string(),
904
- client: import_zod10.z.object({
905
- id: import_zod10.z.string(),
906
- title: import_zod10.z.string(),
907
- scopes: import_zod10.z.array(import_zod10.z.string()),
908
- createdAt: import_zod10.z.coerce.date(),
909
- updatedAt: import_zod10.z.coerce.date(),
910
- integrationIdentifier: import_zod10.z.string(),
911
- integrationAuthMethod: import_zod10.z.string()
912
- }),
913
- expiresAt: import_zod10.z.coerce.date()
914
- });
915
- var MissingDeveloperConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
916
- type: import_zod10.z.literal("DEVELOPER")
917
- });
918
- var MissingExternalConnectionResolvedNotificationPayloadSchema = CommonMissingConnectionNotificationResolvedPayloadSchema.extend({
919
- type: import_zod10.z.literal("EXTERNAL"),
920
- account: import_zod10.z.object({
921
- id: import_zod10.z.string(),
922
- metadata: import_zod10.z.any()
923
- })
924
- });
925
- var MissingConnectionResolvedNotificationPayloadSchema = import_zod10.z.discriminatedUnion("type", [
926
- MissingDeveloperConnectionResolvedNotificationPayloadSchema,
927
- MissingExternalConnectionResolvedNotificationPayloadSchema
928
- ]);
929
-
930
- // ../internal/src/schemas/fetch.ts
931
- var import_zod11 = require("zod");
932
- var FetchRetryHeadersStrategySchema = import_zod11.z.object({
933
- strategy: import_zod11.z.literal("headers"),
934
- limitHeader: import_zod11.z.string(),
935
- remainingHeader: import_zod11.z.string(),
936
- resetHeader: import_zod11.z.string()
937
- });
938
- var FetchRetryBackoffStrategySchema = RetryOptionsSchema.extend({
939
- strategy: import_zod11.z.literal("backoff")
940
- });
941
- var FetchRetryStrategySchema = import_zod11.z.discriminatedUnion("strategy", [
942
- FetchRetryHeadersStrategySchema,
943
- FetchRetryBackoffStrategySchema
944
- ]);
945
- var FetchRequestInitSchema = import_zod11.z.object({
946
- method: import_zod11.z.string().optional(),
947
- headers: import_zod11.z.record(import_zod11.z.union([
948
- import_zod11.z.string(),
949
- RedactStringSchema
950
- ])).optional(),
951
- body: import_zod11.z.union([
952
- import_zod11.z.string(),
953
- import_zod11.z.instanceof(ArrayBuffer)
954
- ]).optional()
955
- });
956
- var FetchRetryOptionsSchema = import_zod11.z.record(FetchRetryStrategySchema);
957
- var FetchOperationSchema = import_zod11.z.object({
958
- url: import_zod11.z.string(),
959
- requestInit: FetchRequestInitSchema.optional(),
960
- retry: import_zod11.z.record(FetchRetryStrategySchema).optional()
961
- });
962
-
963
- // ../internal/src/utils.ts
964
- function deepMergeFilters(filter, other) {
965
- const result = {
966
- ...filter
967
- };
968
- for (const key in other) {
969
- if (other.hasOwnProperty(key)) {
970
- const otherValue = other[key];
971
- if (typeof otherValue === "object" && !Array.isArray(otherValue) && otherValue !== null) {
972
- const filterValue = filter[key];
973
- if (filterValue && typeof filterValue === "object" && !Array.isArray(filterValue)) {
974
- result[key] = deepMergeFilters(filterValue, otherValue);
975
- } else {
976
- result[key] = {
977
- ...other[key]
978
- };
979
- }
980
- } else {
981
- result[key] = other[key];
982
- }
983
- }
984
- }
985
- return result;
986
- }
987
- __name(deepMergeFilters, "deepMergeFilters");
988
-
989
- // ../internal/src/retry.ts
990
- var DEFAULT_RETRY_OPTIONS = {
991
- limit: 5,
992
- factor: 1.8,
993
- minTimeoutInMs: 1e3,
994
- maxTimeoutInMs: 6e4,
995
- randomize: true
996
- };
997
- function calculateRetryAt(retryOptions, attempts) {
998
- const options = {
999
- ...DEFAULT_RETRY_OPTIONS,
1000
- ...retryOptions
1001
- };
1002
- const retryCount = attempts + 1;
1003
- if (retryCount >= options.limit) {
1004
- return;
1005
- }
1006
- const random = options.randomize ? Math.random() + 1 : 1;
1007
- let timeoutInMs = Math.round(random * Math.max(options.minTimeoutInMs, 1) * Math.pow(options.factor, Math.max(attempts - 1, 0)));
1008
- timeoutInMs = Math.min(timeoutInMs, options.maxTimeoutInMs);
1009
- return new Date(Date.now() + timeoutInMs);
1010
- }
1011
- __name(calculateRetryAt, "calculateRetryAt");
1012
-
1013
- // ../internal/src/replacements.ts
1014
- var currentDate = {
1015
- marker: "__CURRENT_DATE__",
1016
- replace({ data: { now } }) {
1017
- return now.toISOString();
1018
- }
1019
- };
149
+ // src/triggerClient.ts
150
+ var import_core5 = require("@trigger.dev/core");
1020
151
 
1021
152
  // src/apiClient.ts
1022
- var import_zod12 = require("zod");
153
+ var import_core = require("@trigger.dev/core");
154
+ var import_node_fetch = __toESM(require("node-fetch"));
155
+ var import_zod = require("zod");
1023
156
  var _apiUrl, _options, _logger, _apiKey, apiKey_fn;
1024
157
  var ApiClient = class {
1025
158
  constructor(options) {
@@ -1029,7 +162,7 @@ var ApiClient = class {
1029
162
  __privateAdd(this, _logger, void 0);
1030
163
  __privateSet(this, _options, options);
1031
164
  __privateSet(this, _apiUrl, __privateGet(this, _options).apiUrl ?? process.env.TRIGGER_API_URL ?? "https://api.trigger.dev");
1032
- __privateSet(this, _logger, new Logger("trigger.dev", __privateGet(this, _options).logLevel));
165
+ __privateSet(this, _logger, new import_core.Logger("trigger.dev", __privateGet(this, _options).logLevel));
1033
166
  }
1034
167
  async registerEndpoint(options) {
1035
168
  const apiKey = await __privateMethod(this, _apiKey, apiKey_fn).call(this);
@@ -1037,7 +170,7 @@ var ApiClient = class {
1037
170
  url: options.url,
1038
171
  name: options.name
1039
172
  });
1040
- const response = await fetch(`${__privateGet(this, _apiUrl)}/api/v1/endpoints`, {
173
+ const response = await (0, import_node_fetch.default)(`${__privateGet(this, _apiUrl)}/api/v1/endpoints`, {
1041
174
  method: "POST",
1042
175
  headers: {
1043
176
  "Content-Type": "application/json",
@@ -1062,7 +195,7 @@ var ApiClient = class {
1062
195
  __privateGet(this, _logger).debug("Creating run", {
1063
196
  params
1064
197
  });
1065
- return await zodfetch(CreateRunResponseBodySchema, `${__privateGet(this, _apiUrl)}/api/v1/runs`, {
198
+ return await zodfetch(import_core.CreateRunResponseBodySchema, `${__privateGet(this, _apiUrl)}/api/v1/runs`, {
1066
199
  method: "POST",
1067
200
  headers: {
1068
201
  "Content-Type": "application/json",
@@ -1076,7 +209,7 @@ var ApiClient = class {
1076
209
  __privateGet(this, _logger).debug("Running Task", {
1077
210
  task
1078
211
  });
1079
- return await zodfetch(ServerTaskSchema, `${__privateGet(this, _apiUrl)}/api/v1/runs/${runId}/tasks`, {
212
+ return await zodfetch(import_core.ServerTaskSchema, `${__privateGet(this, _apiUrl)}/api/v1/runs/${runId}/tasks`, {
1080
213
  method: "POST",
1081
214
  headers: {
1082
215
  "Content-Type": "application/json",
@@ -1091,7 +224,7 @@ var ApiClient = class {
1091
224
  __privateGet(this, _logger).debug("Complete Task", {
1092
225
  task
1093
226
  });
1094
- return await zodfetch(ServerTaskSchema, `${__privateGet(this, _apiUrl)}/api/v1/runs/${runId}/tasks/${id}/complete`, {
227
+ return await zodfetch(import_core.ServerTaskSchema, `${__privateGet(this, _apiUrl)}/api/v1/runs/${runId}/tasks/${id}/complete`, {
1095
228
  method: "POST",
1096
229
  headers: {
1097
230
  "Content-Type": "application/json",
@@ -1107,7 +240,7 @@ var ApiClient = class {
1107
240
  runId,
1108
241
  body
1109
242
  });
1110
- return await zodfetch(ServerTaskSchema, `${__privateGet(this, _apiUrl)}/api/v1/runs/${runId}/tasks/${id}/fail`, {
243
+ return await zodfetch(import_core.ServerTaskSchema, `${__privateGet(this, _apiUrl)}/api/v1/runs/${runId}/tasks/${id}/fail`, {
1111
244
  method: "POST",
1112
245
  headers: {
1113
246
  "Content-Type": "application/json",
@@ -1121,7 +254,7 @@ var ApiClient = class {
1121
254
  __privateGet(this, _logger).debug("Sending event", {
1122
255
  event
1123
256
  });
1124
- return await zodfetch(ApiEventLogSchema, `${__privateGet(this, _apiUrl)}/api/v1/events`, {
257
+ return await zodfetch(import_core.ApiEventLogSchema, `${__privateGet(this, _apiUrl)}/api/v1/events`, {
1125
258
  method: "POST",
1126
259
  headers: {
1127
260
  "Content-Type": "application/json",
@@ -1138,7 +271,7 @@ var ApiClient = class {
1138
271
  __privateGet(this, _logger).debug("activating http source", {
1139
272
  source
1140
273
  });
1141
- const response = await zodfetch(TriggerSourceSchema, `${__privateGet(this, _apiUrl)}/api/v1/${client}/sources/${key}`, {
274
+ const response = await zodfetch(import_core.TriggerSourceSchema, `${__privateGet(this, _apiUrl)}/api/v1/${client}/sources/${key}`, {
1142
275
  method: "PUT",
1143
276
  headers: {
1144
277
  "Content-Type": "application/json",
@@ -1154,7 +287,7 @@ var ApiClient = class {
1154
287
  id,
1155
288
  payload
1156
289
  });
1157
- const response = await zodfetch(RegisterSourceEventSchema, `${__privateGet(this, _apiUrl)}/api/v1/${client}/triggers/${id}/registrations/${key}`, {
290
+ const response = await zodfetch(import_core.RegisterSourceEventSchema, `${__privateGet(this, _apiUrl)}/api/v1/${client}/triggers/${id}/registrations/${key}`, {
1158
291
  method: "PUT",
1159
292
  headers: {
1160
293
  "Content-Type": "application/json",
@@ -1170,7 +303,7 @@ var ApiClient = class {
1170
303
  id,
1171
304
  payload
1172
305
  });
1173
- const response = await zodfetch(RegisterScheduleResponseBodySchema, `${__privateGet(this, _apiUrl)}/api/v1/${client}/schedules/${id}/registrations`, {
306
+ const response = await zodfetch(import_core.RegisterScheduleResponseBodySchema, `${__privateGet(this, _apiUrl)}/api/v1/${client}/schedules/${id}/registrations`, {
1174
307
  method: "POST",
1175
308
  headers: {
1176
309
  "Content-Type": "application/json",
@@ -1188,8 +321,8 @@ var ApiClient = class {
1188
321
  __privateGet(this, _logger).debug("unregistering schedule", {
1189
322
  id
1190
323
  });
1191
- const response = await zodfetch(import_zod12.z.object({
1192
- ok: import_zod12.z.boolean()
324
+ const response = await zodfetch(import_zod.z.object({
325
+ ok: import_zod.z.boolean()
1193
326
  }), `${__privateGet(this, _apiUrl)}/api/v1/${client}/schedules/${id}/registrations/${encodeURIComponent(key)}`, {
1194
327
  method: "DELETE",
1195
328
  headers: {
@@ -1204,7 +337,7 @@ var ApiClient = class {
1204
337
  __privateGet(this, _logger).debug("getting auth", {
1205
338
  id
1206
339
  });
1207
- const response = await zodfetch(ConnectionAuthSchema, `${__privateGet(this, _apiUrl)}/api/v1/${client}/auth/${id}`, {
340
+ const response = await zodfetch(import_core.ConnectionAuthSchema, `${__privateGet(this, _apiUrl)}/api/v1/${client}/auth/${id}`, {
1208
341
  method: "GET",
1209
342
  headers: {
1210
343
  Accept: "application/json",
@@ -1215,6 +348,42 @@ var ApiClient = class {
1215
348
  });
1216
349
  return response;
1217
350
  }
351
+ async getEvent(eventId) {
352
+ const apiKey = await __privateMethod(this, _apiKey, apiKey_fn).call(this);
353
+ __privateGet(this, _logger).debug("Getting Event", {
354
+ eventId
355
+ });
356
+ return await zodfetch(import_core.GetEventSchema, `${__privateGet(this, _apiUrl)}/api/v1/events/${eventId}`, {
357
+ method: "GET",
358
+ headers: {
359
+ Authorization: `Bearer ${apiKey}`
360
+ }
361
+ });
362
+ }
363
+ async getRun(runId, options) {
364
+ const apiKey = await __privateMethod(this, _apiKey, apiKey_fn).call(this);
365
+ __privateGet(this, _logger).debug("Getting Run", {
366
+ runId
367
+ });
368
+ return await zodfetch(import_core.GetRunSchema, (0, import_core.urlWithSearchParams)(`${__privateGet(this, _apiUrl)}/api/v1/runs/${runId}`, options), {
369
+ method: "GET",
370
+ headers: {
371
+ Authorization: `Bearer ${apiKey}`
372
+ }
373
+ });
374
+ }
375
+ async getRuns(jobSlug, options) {
376
+ const apiKey = await __privateMethod(this, _apiKey, apiKey_fn).call(this);
377
+ __privateGet(this, _logger).debug("Getting Runs", {
378
+ jobSlug
379
+ });
380
+ return await zodfetch(import_core.GetRunsSchema, (0, import_core.urlWithSearchParams)(`${__privateGet(this, _apiUrl)}/api/v1/jobs/${jobSlug}/runs`, options), {
381
+ method: "GET",
382
+ headers: {
383
+ Authorization: `Bearer ${apiKey}`
384
+ }
385
+ });
386
+ }
1218
387
  };
1219
388
  __name(ApiClient, "ApiClient");
1220
389
  _apiUrl = new WeakMap();
@@ -1251,7 +420,7 @@ function getApiKey(key) {
1251
420
  }
1252
421
  __name(getApiKey, "getApiKey");
1253
422
  async function zodfetch(schema, url, requestInit, options) {
1254
- const response = await fetch(url, requestInit);
423
+ const response = await (0, import_node_fetch.default)(url, requestInit);
1255
424
  if ((!requestInit || requestInit.method === "GET") && response.status === 404 && options?.optional) {
1256
425
  return;
1257
426
  }
@@ -1282,12 +451,19 @@ var RetryWithTaskError = class {
1282
451
  }
1283
452
  };
1284
453
  __name(RetryWithTaskError, "RetryWithTaskError");
454
+ var CanceledWithTaskError = class {
455
+ constructor(task) {
456
+ this.task = task;
457
+ }
458
+ };
459
+ __name(CanceledWithTaskError, "CanceledWithTaskError");
1285
460
  function isTriggerError(err) {
1286
- return err instanceof ResumeWithTaskError || err instanceof RetryWithTaskError;
461
+ return err instanceof ResumeWithTaskError || err instanceof RetryWithTaskError || err instanceof CanceledWithTaskError;
1287
462
  }
1288
463
  __name(isTriggerError, "isTriggerError");
1289
464
 
1290
465
  // src/io.ts
466
+ var import_core3 = require("@trigger.dev/core");
1291
467
  var import_node_async_hooks = require("async_hooks");
1292
468
  var import_node_crypto = require("crypto");
1293
469
 
@@ -1306,6 +482,22 @@ function createIOWithIntegrations(io, auths, integrations) {
1306
482
  const ioConnection = {
1307
483
  client
1308
484
  };
485
+ ioConnection.runTask = async (key, callback, options) => {
486
+ return await io.runTask(key, {
487
+ name: "Task",
488
+ icon: integration.metadata.id,
489
+ retry: {
490
+ limit: 10,
491
+ minTimeoutInMs: 1e3,
492
+ maxTimeoutInMs: 3e4,
493
+ factor: 2,
494
+ randomize: true
495
+ },
496
+ ...options
497
+ }, async (ioTask) => {
498
+ return await callback(client, ioTask, io);
499
+ });
500
+ };
1309
501
  if (integration.client.tasks) {
1310
502
  const tasks = integration.client.tasks;
1311
503
  Object.keys(tasks).forEach((taskName) => {
@@ -1337,6 +529,9 @@ function createIOWithIntegrations(io, auths, integrations) {
1337
529
  }
1338
530
  __name(createIOWithIntegrations, "createIOWithIntegrations");
1339
531
 
532
+ // src/retry.ts
533
+ var import_core2 = require("@trigger.dev/core");
534
+
1340
535
  // src/io.ts
1341
536
  var _addToCachedTasks, addToCachedTasks_fn;
1342
537
  var IO = class {
@@ -1345,7 +540,7 @@ var IO = class {
1345
540
  this._id = options.id;
1346
541
  this._apiClient = options.apiClient;
1347
542
  this._triggerClient = options.client;
1348
- this._logger = options.logger ?? new Logger("trigger.dev", options.logLevel);
543
+ this._logger = options.logger ?? new import_core3.Logger("trigger.dev", options.logLevel);
1349
544
  this._cachedTasks = /* @__PURE__ */ new Map();
1350
545
  this._jobLogger = options.jobLogger;
1351
546
  this._jobLogLevel = options.jobLogLevel;
@@ -1387,7 +582,7 @@ var IO = class {
1387
582
  break;
1388
583
  }
1389
584
  }
1390
- if (Logger.satisfiesLogLevel(logLevel, this._jobLogLevel)) {
585
+ if (import_core3.Logger.satisfiesLogLevel(logLevel, this._jobLogLevel)) {
1391
586
  await this.runTask([
1392
587
  message,
1393
588
  level
@@ -1484,13 +679,14 @@ var IO = class {
1484
679
  async updateSource(key, options) {
1485
680
  return this.runTask(key, {
1486
681
  name: "Update Source",
1487
- description: `Update Source ${options.key}`,
682
+ description: "Update Source",
1488
683
  properties: [
1489
684
  {
1490
685
  label: "key",
1491
686
  text: options.key
1492
687
  }
1493
688
  ],
689
+ params: options,
1494
690
  redact: {
1495
691
  paths: [
1496
692
  "secret"
@@ -1663,6 +859,13 @@ var IO = class {
1663
859
  ...options,
1664
860
  parentId
1665
861
  });
862
+ if (task.status === "CANCELED") {
863
+ this._logger.debug("Task canceled", {
864
+ idempotencyKey,
865
+ task
866
+ });
867
+ throw new CanceledWithTaskError(task);
868
+ }
1666
869
  if (task.status === "COMPLETED") {
1667
870
  this._logger.debug("Using task output", {
1668
871
  idempotencyKey,
@@ -1699,26 +902,41 @@ var IO = class {
1699
902
  idempotencyKey,
1700
903
  task
1701
904
  });
1702
- await this._apiClient.completeTask(this._id, task.id, {
1703
- output: result ?? void 0
905
+ const completedTask = await this._apiClient.completeTask(this._id, task.id, {
906
+ output: result ?? void 0,
907
+ properties: task.outputProperties ?? void 0
1704
908
  });
909
+ if (completedTask.status === "CANCELED") {
910
+ throw new CanceledWithTaskError(completedTask);
911
+ }
1705
912
  return result;
1706
913
  } catch (error) {
1707
914
  if (isTriggerError(error)) {
1708
915
  throw error;
1709
916
  }
1710
917
  if (onError) {
1711
- const onErrorResult = onError(error, task, this);
1712
- if (onErrorResult) {
1713
- const parsedError2 = ErrorWithStackSchema.safeParse(onErrorResult.error);
1714
- throw new RetryWithTaskError(parsedError2.success ? parsedError2.data : {
1715
- message: "Unknown error"
1716
- }, task, onErrorResult.retryAt);
918
+ try {
919
+ const onErrorResult = onError(error, task, this);
920
+ if (onErrorResult) {
921
+ if (onErrorResult instanceof Error) {
922
+ error = onErrorResult;
923
+ } else {
924
+ const parsedError2 = import_core3.ErrorWithStackSchema.safeParse(onErrorResult.error);
925
+ throw new RetryWithTaskError(parsedError2.success ? parsedError2.data : {
926
+ message: "Unknown error"
927
+ }, task, onErrorResult.retryAt);
928
+ }
929
+ }
930
+ } catch (innerError) {
931
+ if (isTriggerError(innerError)) {
932
+ throw innerError;
933
+ }
934
+ error = innerError;
1717
935
  }
1718
936
  }
1719
- const parsedError = ErrorWithStackSchema.safeParse(error);
937
+ const parsedError = import_core3.ErrorWithStackSchema.safeParse(error);
1720
938
  if (options.retry) {
1721
- const retryAt = calculateRetryAt(options.retry, task.attempts - 1);
939
+ const retryAt = (0, import_core2.calculateRetryAt)(options.retry, task.attempts - 1);
1722
940
  if (retryAt) {
1723
941
  throw new RetryWithTaskError(parsedError.success ? parsedError.data : {
1724
942
  message: "Unknown error"
@@ -1815,6 +1033,7 @@ var IOLogger = class {
1815
1033
  __name(IOLogger, "IOLogger");
1816
1034
 
1817
1035
  // src/triggers/eventTrigger.ts
1036
+ var import_core4 = require("@trigger.dev/core");
1818
1037
  var _options2;
1819
1038
  var EventTrigger = class {
1820
1039
  constructor(options) {
@@ -1828,7 +1047,7 @@ var EventTrigger = class {
1828
1047
  rule: {
1829
1048
  event: __privateGet(this, _options2).name ?? __privateGet(this, _options2).event.name,
1830
1049
  source: __privateGet(this, _options2).source ?? "trigger.dev",
1831
- payload: deepMergeFilters(__privateGet(this, _options2).filter ?? {}, __privateGet(this, _options2).event.filter ?? {})
1050
+ payload: (0, import_core4.deepMergeFilters)(__privateGet(this, _options2).filter ?? {}, __privateGet(this, _options2).event.filter ?? {})
1832
1051
  }
1833
1052
  };
1834
1053
  }
@@ -1852,6 +1071,7 @@ function eventTrigger(options) {
1852
1071
  title: "Event",
1853
1072
  source: options.source ?? "trigger.dev",
1854
1073
  icon: "custom-event",
1074
+ examples: options.examples,
1855
1075
  parsePayload: (rawPayload) => {
1856
1076
  if (options.schema) {
1857
1077
  return options.schema.parse(rawPayload);
@@ -1865,11 +1085,11 @@ __name(eventTrigger, "eventTrigger");
1865
1085
 
1866
1086
  // src/triggerClient.ts
1867
1087
  var registerSourceEvent = {
1868
- name: REGISTER_SOURCE_EVENT,
1088
+ name: import_core5.REGISTER_SOURCE_EVENT,
1869
1089
  title: "Register Source",
1870
1090
  source: "internal",
1871
1091
  icon: "register-source",
1872
- parsePayload: RegisterSourceEventSchema.parse
1092
+ parsePayload: import_core5.RegisterSourceEventSchema.parse
1873
1093
  };
1874
1094
  var _options3, _registeredJobs, _registeredSources, _registeredHttpSourceHandlers, _registeredDynamicTriggers, _jobMetadataByDynamicTriggers, _registeredSchedules, _client, _internalLogger, _preprocessRun, preprocessRun_fn, _executeJob, executeJob_fn, _createRunContext, createRunContext_fn, _createPreprocessRunContext, createPreprocessRunContext_fn, _handleHttpSourceRequest, handleHttpSourceRequest_fn;
1875
1095
  var TriggerClient = class {
@@ -1891,7 +1111,7 @@ var TriggerClient = class {
1891
1111
  this.id = options.id;
1892
1112
  __privateSet(this, _options3, options);
1893
1113
  __privateSet(this, _client, new ApiClient(__privateGet(this, _options3)));
1894
- __privateSet(this, _internalLogger, new Logger("trigger.dev", __privateGet(this, _options3).verbose ? "debug" : "log"));
1114
+ __privateSet(this, _internalLogger, new import_core5.Logger("trigger.dev", __privateGet(this, _options3).verbose ? "debug" : "log"));
1895
1115
  }
1896
1116
  async handleRequest(request) {
1897
1117
  __privateGet(this, _internalLogger).debug("handling request", {
@@ -1925,7 +1145,7 @@ var TriggerClient = class {
1925
1145
  return {
1926
1146
  status: 401,
1927
1147
  body: {
1928
- message: `Forbidden: client apiKey mismatch: Expected ${__privateGet(this, _options3).apiKey}, got ${apiKey}`
1148
+ message: `Forbidden: client apiKey mismatch: Make sure you are using the correct API Key for your environment`
1929
1149
  }
1930
1150
  };
1931
1151
  }
@@ -1997,7 +1217,11 @@ var TriggerClient = class {
1997
1217
  sources: Object.values(__privateGet(this, _registeredSources)),
1998
1218
  dynamicTriggers: Object.values(__privateGet(this, _registeredDynamicTriggers)).map((trigger) => ({
1999
1219
  id: trigger.id,
2000
- jobs: __privateGet(this, _jobMetadataByDynamicTriggers)[trigger.id] ?? []
1220
+ jobs: __privateGet(this, _jobMetadataByDynamicTriggers)[trigger.id] ?? [],
1221
+ registerSourceJob: {
1222
+ id: dynamicTriggerRegisterSourceJobId(trigger.id),
1223
+ version: trigger.source.version
1224
+ }
2001
1225
  })),
2002
1226
  dynamicSchedules: Object.entries(__privateGet(this, _registeredSchedules)).map(([id, jobs]) => ({
2003
1227
  id,
@@ -2011,7 +1235,7 @@ var TriggerClient = class {
2011
1235
  }
2012
1236
  case "INITIALIZE_TRIGGER": {
2013
1237
  const json = await request.json();
2014
- const body = InitializeTriggerBodySchema.safeParse(json);
1238
+ const body = import_core5.InitializeTriggerBodySchema.safeParse(json);
2015
1239
  if (!body.success) {
2016
1240
  return {
2017
1241
  status: 400,
@@ -2036,7 +1260,7 @@ var TriggerClient = class {
2036
1260
  }
2037
1261
  case "EXECUTE_JOB": {
2038
1262
  const json = await request.json();
2039
- const execution = RunJobBodySchema.safeParse(json);
1263
+ const execution = import_core5.RunJobBodySchema.safeParse(json);
2040
1264
  if (!execution.success) {
2041
1265
  return {
2042
1266
  status: 400,
@@ -2062,7 +1286,7 @@ var TriggerClient = class {
2062
1286
  }
2063
1287
  case "PREPROCESS_RUN": {
2064
1288
  const json = await request.json();
2065
- const body = PreprocessRunBodySchema.safeParse(json);
1289
+ const body = import_core5.PreprocessRunBodySchema.safeParse(json);
2066
1290
  if (!body.success) {
2067
1291
  return {
2068
1292
  status: 400,
@@ -2090,7 +1314,7 @@ var TriggerClient = class {
2090
1314
  };
2091
1315
  }
2092
1316
  case "DELIVER_HTTP_SOURCE_REQUEST": {
2093
- const headers = HttpSourceRequestHeadersSchema.safeParse(Object.fromEntries(request.headers.entries()));
1317
+ const headers = import_core5.HttpSourceRequestHeadersSchema.safeParse(Object.fromEntries(request.headers.entries()));
2094
1318
  if (!headers.success) {
2095
1319
  return {
2096
1320
  status: 400,
@@ -2099,11 +1323,19 @@ var TriggerClient = class {
2099
1323
  }
2100
1324
  };
2101
1325
  }
2102
- const sourceRequest = new Request(headers.data["x-ts-http-url"], {
1326
+ const sourceRequestNeedsBody = headers.data["x-ts-http-method"] !== "GET";
1327
+ const sourceRequestInit = {
2103
1328
  method: headers.data["x-ts-http-method"],
2104
1329
  headers: headers.data["x-ts-http-headers"],
2105
- body: headers.data["x-ts-http-method"] !== "GET" ? request.body : void 0
2106
- });
1330
+ body: sourceRequestNeedsBody ? request.body : void 0
1331
+ };
1332
+ if (sourceRequestNeedsBody) {
1333
+ try {
1334
+ sourceRequestInit.duplex = "half";
1335
+ } catch (error) {
1336
+ }
1337
+ }
1338
+ const sourceRequest = new Request(headers.data["x-ts-http-url"], sourceRequestInit);
2107
1339
  const key = headers.data["x-ts-key"];
2108
1340
  const dynamicId = headers.data["x-ts-dynamic-id"];
2109
1341
  const secret = headers.data["x-ts-secret"];
@@ -2143,7 +1375,7 @@ var TriggerClient = class {
2143
1375
  attachDynamicTrigger(trigger) {
2144
1376
  __privateGet(this, _registeredDynamicTriggers)[trigger.id] = trigger;
2145
1377
  new Job(this, {
2146
- id: `register-dynamic-trigger-${trigger.id}`,
1378
+ id: dynamicTriggerRegisterSourceJobId(trigger.id),
2147
1379
  name: `Register dynamic trigger ${trigger.id}`,
2148
1380
  version: trigger.source.version,
2149
1381
  trigger: new EventTrigger({
@@ -2193,12 +1425,18 @@ var TriggerClient = class {
2193
1425
  id: options.source.integration.id,
2194
1426
  metadata: options.source.integration.metadata,
2195
1427
  authSource: options.source.integration.client.usesLocalAuth ? "LOCAL" : "HOSTED"
1428
+ },
1429
+ registerSourceJob: {
1430
+ id: options.key,
1431
+ version: options.source.version
2196
1432
  }
2197
1433
  };
2198
1434
  }
2199
1435
  registeredSource.events = Array.from(/* @__PURE__ */ new Set([
2200
1436
  ...registeredSource.events,
2201
- options.event.name
1437
+ ...typeof options.event.name === "string" ? [
1438
+ options.event.name
1439
+ ] : options.event.name
2202
1440
  ]));
2203
1441
  __privateGet(this, _registeredSources)[options.key] = registeredSource;
2204
1442
  new Job(this, {
@@ -2259,6 +1497,15 @@ var TriggerClient = class {
2259
1497
  async unregisterSchedule(id, key) {
2260
1498
  return __privateGet(this, _client).unregisterSchedule(this.id, id, key);
2261
1499
  }
1500
+ async getEvent(eventId) {
1501
+ return __privateGet(this, _client).getEvent(eventId);
1502
+ }
1503
+ async getRun(runId, options) {
1504
+ return __privateGet(this, _client).getRun(runId, options);
1505
+ }
1506
+ async getRuns(jobSlug, options) {
1507
+ return __privateGet(this, _client).getRuns(jobSlug, options);
1508
+ }
2262
1509
  authorized(apiKey) {
2263
1510
  if (typeof apiKey !== "string") {
2264
1511
  return "missing-header";
@@ -2272,6 +1519,9 @@ var TriggerClient = class {
2272
1519
  apiKey() {
2273
1520
  return __privateGet(this, _options3).apiKey ?? process.env.TRIGGER_API_KEY;
2274
1521
  }
1522
+ defineJob(options) {
1523
+ return new Job(this, options);
1524
+ }
2275
1525
  };
2276
1526
  __name(TriggerClient, "TriggerClient");
2277
1527
  _options3 = new WeakMap();
@@ -2308,7 +1558,7 @@ executeJob_fn = /* @__PURE__ */ __name(async function(body1, job1) {
2308
1558
  client: this,
2309
1559
  context,
2310
1560
  jobLogLevel: job1.logLevel ?? __privateGet(this, _options3).logLevel ?? "info",
2311
- jobLogger: __privateGet(this, _options3).ioLogLocalEnabled ? new Logger(job1.id, job1.logLevel ?? __privateGet(this, _options3).logLevel ?? "info") : void 0
1561
+ jobLogger: __privateGet(this, _options3).ioLogLocalEnabled ? new import_core5.Logger(job1.id, job1.logLevel ?? __privateGet(this, _options3).logLevel ?? "info") : void 0
2312
1562
  });
2313
1563
  const ioWithConnections = createIOWithIntegrations(io, body1.connections, job1.options.integrations);
2314
1564
  try {
@@ -2332,8 +1582,14 @@ executeJob_fn = /* @__PURE__ */ __name(async function(body1, job1) {
2332
1582
  retryAt: error.retryAt
2333
1583
  };
2334
1584
  }
1585
+ if (error instanceof CanceledWithTaskError) {
1586
+ return {
1587
+ status: "CANCELED",
1588
+ task: error.task
1589
+ };
1590
+ }
2335
1591
  if (error instanceof RetryWithTaskError) {
2336
- const errorWithStack2 = ErrorWithStackSchema.safeParse(error.cause);
1592
+ const errorWithStack2 = import_core5.ErrorWithStackSchema.safeParse(error.cause);
2337
1593
  if (errorWithStack2.success) {
2338
1594
  return {
2339
1595
  status: "ERROR",
@@ -2349,7 +1605,7 @@ executeJob_fn = /* @__PURE__ */ __name(async function(body1, job1) {
2349
1605
  task: error.task
2350
1606
  };
2351
1607
  }
2352
- const errorWithStack = ErrorWithStackSchema.safeParse(error);
1608
+ const errorWithStack = import_core5.ErrorWithStackSchema.safeParse(error);
2353
1609
  if (errorWithStack.success) {
2354
1610
  return {
2355
1611
  status: "ERROR",
@@ -2479,6 +1735,10 @@ handleHttpSourceRequest_fn = /* @__PURE__ */ __name(async function(source, sourc
2479
1735
  }
2480
1736
  };
2481
1737
  }, "#handleHttpSourceRequest");
1738
+ function dynamicTriggerRegisterSourceJobId(id) {
1739
+ return `register-dynamic-trigger-${id}`;
1740
+ }
1741
+ __name(dynamicTriggerRegisterSourceJobId, "dynamicTriggerRegisterSourceJobId");
2482
1742
 
2483
1743
  // src/integrations.ts
2484
1744
  function authenticatedTask(options) {
@@ -2487,6 +1747,7 @@ function authenticatedTask(options) {
2487
1747
  __name(authenticatedTask, "authenticatedTask");
2488
1748
 
2489
1749
  // src/triggers/externalSource.ts
1750
+ var import_core6 = require("@trigger.dev/core");
2490
1751
  var ExternalSource = class {
2491
1752
  constructor(channel, options) {
2492
1753
  this.options = options;
@@ -2502,7 +1763,7 @@ var ExternalSource = class {
2502
1763
  }, logger);
2503
1764
  }
2504
1765
  filter(params) {
2505
- return this.options.filter(params);
1766
+ return this.options.filter?.(params) ?? {};
2506
1767
  }
2507
1768
  properties(params) {
2508
1769
  return this.options.properties?.(params) ?? [];
@@ -2560,7 +1821,7 @@ var ExternalSourceTrigger = class {
2560
1821
  title: "External Source",
2561
1822
  rule: {
2562
1823
  event: this.event.name,
2563
- payload: deepMergeFilters(this.options.source.filter(this.options.params), this.event.filter ?? {}),
1824
+ payload: (0, import_core6.deepMergeFilters)(this.options.source.filter(this.options.params), this.event.filter ?? {}, this.options.params.filter ?? {}),
2564
1825
  source: this.event.source
2565
1826
  },
2566
1827
  properties: this.options.source.properties(this.options.params)
@@ -2594,6 +1855,7 @@ function omit(obj, key) {
2594
1855
  __name(omit, "omit");
2595
1856
 
2596
1857
  // src/triggers/dynamic.ts
1858
+ var import_core7 = require("@trigger.dev/core");
2597
1859
  var _client2, _options4;
2598
1860
  var DynamicTrigger = class {
2599
1861
  constructor(client, options) {
@@ -2617,19 +1879,20 @@ var DynamicTrigger = class {
2617
1879
  return __privateGet(this, _options4).event;
2618
1880
  }
2619
1881
  registeredTriggerForParams(params) {
1882
+ const key = slugifyId(this.source.key(params));
2620
1883
  return {
2621
1884
  rule: {
2622
1885
  event: this.event.name,
2623
1886
  source: this.event.source,
2624
- payload: deepMergeFilters(this.source.filter(params), this.event.filter ?? {})
1887
+ payload: (0, import_core7.deepMergeFilters)(this.source.filter(params), this.event.filter ?? {})
2625
1888
  },
2626
1889
  source: {
2627
- key: slugifyId(this.source.key(params)),
1890
+ key,
2628
1891
  channel: this.source.channel,
2629
1892
  params,
2630
- events: [
1893
+ events: typeof this.event.name === "string" ? [
2631
1894
  this.event.name
2632
- ],
1895
+ ] : this.event.name,
2633
1896
  integration: {
2634
1897
  id: this.source.integration.id,
2635
1898
  metadata: this.source.integration.metadata,
@@ -2653,6 +1916,7 @@ _client2 = new WeakMap();
2653
1916
  _options4 = new WeakMap();
2654
1917
 
2655
1918
  // src/triggers/scheduled.ts
1919
+ var import_core8 = require("@trigger.dev/core");
2656
1920
  var import_cronstrue = __toESM(require("cronstrue"));
2657
1921
  var examples = [
2658
1922
  {
@@ -2660,8 +1924,8 @@ var examples = [
2660
1924
  name: "Now",
2661
1925
  icon: "clock",
2662
1926
  payload: {
2663
- ts: currentDate.marker,
2664
- lastTimestamp: currentDate.marker
1927
+ ts: import_core8.currentDate.marker,
1928
+ lastTimestamp: import_core8.currentDate.marker
2665
1929
  }
2666
1930
  }
2667
1931
  ];
@@ -2676,7 +1940,7 @@ var IntervalTrigger = class {
2676
1940
  source: "trigger.dev",
2677
1941
  icon: "schedule-interval",
2678
1942
  examples,
2679
- parsePayload: ScheduledPayloadSchema.parse,
1943
+ parsePayload: import_core8.ScheduledPayloadSchema.parse,
2680
1944
  properties: [
2681
1945
  {
2682
1946
  label: "Interval",
@@ -2721,7 +1985,7 @@ var CronTrigger = class {
2721
1985
  source: "trigger.dev",
2722
1986
  icon: "schedule-cron",
2723
1987
  examples,
2724
- parsePayload: ScheduledPayloadSchema.parse,
1988
+ parsePayload: import_core8.ScheduledPayloadSchema.parse,
2725
1989
  properties: [
2726
1990
  {
2727
1991
  label: "cron",
@@ -2771,7 +2035,7 @@ var DynamicSchedule = class {
2771
2035
  source: "trigger.dev",
2772
2036
  icon: "schedule-dynamic",
2773
2037
  examples,
2774
- parsePayload: ScheduledPayloadSchema.parse
2038
+ parsePayload: import_core8.ScheduledPayloadSchema.parse
2775
2039
  };
2776
2040
  }
2777
2041
  async register(key, metadata) {
@@ -2796,6 +2060,7 @@ var DynamicSchedule = class {
2796
2060
  __name(DynamicSchedule, "DynamicSchedule");
2797
2061
 
2798
2062
  // src/triggers/notifications.ts
2063
+ var import_core9 = require("@trigger.dev/core");
2799
2064
  function missingConnectionNotification(integrations) {
2800
2065
  return new MissingConnectionNotification({
2801
2066
  integrations
@@ -2814,11 +2079,11 @@ var MissingConnectionNotification = class {
2814
2079
  }
2815
2080
  get event() {
2816
2081
  return {
2817
- name: MISSING_CONNECTION_NOTIFICATION,
2082
+ name: import_core9.MISSING_CONNECTION_NOTIFICATION,
2818
2083
  title: "Missing Connection Notification",
2819
2084
  source: "trigger.dev",
2820
2085
  icon: "connection-alert",
2821
- parsePayload: MissingConnectionNotificationPayloadSchema.parse,
2086
+ parsePayload: import_core9.MissingConnectionNotificationPayloadSchema.parse,
2822
2087
  properties: [
2823
2088
  {
2824
2089
  label: "Integrations",
@@ -2855,11 +2120,11 @@ var MissingConnectionResolvedNotification = class {
2855
2120
  }
2856
2121
  get event() {
2857
2122
  return {
2858
- name: MISSING_CONNECTION_RESOLVED_NOTIFICATION,
2123
+ name: import_core9.MISSING_CONNECTION_RESOLVED_NOTIFICATION,
2859
2124
  title: "Missing Connection Resolved Notification",
2860
2125
  source: "trigger.dev",
2861
2126
  icon: "connection-alert",
2862
- parsePayload: MissingConnectionResolvedNotificationPayloadSchema.parse,
2127
+ parsePayload: import_core9.MissingConnectionResolvedNotificationPayloadSchema.parse,
2863
2128
  properties: [
2864
2129
  {
2865
2130
  label: "Integrations",