@trigger.dev/sdk 2.2.5 → 2.2.7

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
@@ -81,7 +81,8 @@ __export(src_exports, {
81
81
  redactString: () => redactString,
82
82
  retry: () => retry,
83
83
  verifyHmacSha256: () => verifyHmacSha256,
84
- verifyRequestSignature: () => verifyRequestSignature
84
+ verifyRequestSignature: () => verifyRequestSignature,
85
+ waitForEventSchema: () => waitForEventSchema
85
86
  });
86
87
  module.exports = __toCommonJS(src_exports);
87
88
 
@@ -397,6 +398,23 @@ var ApiClient = class {
397
398
  })
398
399
  });
399
400
  }
401
+ async sendEvents(events, options = {}) {
402
+ const apiKey = await __privateMethod(this, _apiKey, apiKey_fn).call(this);
403
+ __privateGet(this, _logger).debug("Sending multiple events", {
404
+ events
405
+ });
406
+ return await zodfetch(import_core.ApiEventLogSchema.array(), `${__privateGet(this, _apiUrl)}/api/v1/events/bulk`, {
407
+ method: "POST",
408
+ headers: {
409
+ "Content-Type": "application/json",
410
+ Authorization: `Bearer ${apiKey}`
411
+ },
412
+ body: JSON.stringify({
413
+ events,
414
+ options
415
+ })
416
+ });
417
+ }
400
418
  async cancelEvent(eventId) {
401
419
  const apiKey = await __privateMethod(this, _apiKey, apiKey_fn).call(this);
402
420
  __privateGet(this, _logger).debug("Cancelling event", {
@@ -610,6 +628,21 @@ var ApiClient = class {
610
628
  body: JSON.stringify(body)
611
629
  });
612
630
  }
631
+ async createEphemeralEventDispatcher(payload) {
632
+ const apiKey = await __privateMethod(this, _apiKey, apiKey_fn).call(this);
633
+ __privateGet(this, _logger).debug("Creating ephemeral event dispatcher", {
634
+ payload
635
+ });
636
+ const response = await zodfetch(import_core.EphemeralEventDispatcherResponseBodySchema, `${__privateGet(this, _apiUrl)}/api/v1/event-dispatchers/ephemeral`, {
637
+ method: "POST",
638
+ headers: {
639
+ "Content-Type": "application/json",
640
+ Authorization: `Bearer ${apiKey}`
641
+ },
642
+ body: JSON.stringify(payload)
643
+ });
644
+ return response;
645
+ }
613
646
  };
614
647
  __name(ApiClient, "ApiClient");
615
648
  _apiUrl = new WeakMap();
@@ -933,6 +966,13 @@ var retry = {
933
966
  minTimeoutInMs: 500,
934
967
  maxTimeoutInMs: 3e4,
935
968
  randomize: true
969
+ },
970
+ exponentialBackoff: {
971
+ limit: 8,
972
+ factor: 2,
973
+ minTimeoutInMs: 1e3,
974
+ maxTimeoutInMs: 3e4,
975
+ randomize: true
936
976
  }
937
977
  };
938
978
 
@@ -970,7 +1010,29 @@ var TriggerStatus = class {
970
1010
  };
971
1011
  __name(TriggerStatus, "TriggerStatus");
972
1012
 
1013
+ // src/types.ts
1014
+ var import_zod2 = require("zod");
1015
+ var EventSpecificationExampleSchema = import_zod2.z.object({
1016
+ id: import_zod2.z.string(),
1017
+ name: import_zod2.z.string(),
1018
+ icon: import_zod2.z.string().optional(),
1019
+ payload: import_zod2.z.any()
1020
+ });
1021
+ function waitForEventSchema(schema) {
1022
+ return import_zod2.z.object({
1023
+ id: import_zod2.z.string(),
1024
+ name: import_zod2.z.string(),
1025
+ source: import_zod2.z.string(),
1026
+ payload: schema,
1027
+ timestamp: import_zod2.z.coerce.date(),
1028
+ context: import_zod2.z.any().optional(),
1029
+ accountId: import_zod2.z.string().optional()
1030
+ });
1031
+ }
1032
+ __name(waitForEventSchema, "waitForEventSchema");
1033
+
973
1034
  // src/io.ts
1035
+ var import_zod3 = require("zod");
974
1036
  var JSONOutputSerializer = class {
975
1037
  serialize(value) {
976
1038
  return JSON.stringify(value);
@@ -1153,6 +1215,63 @@ var IO = class {
1153
1215
  }
1154
1216
  });
1155
1217
  }
1218
+ async waitForEvent(cacheKey, event, options) {
1219
+ const timeoutInSeconds = options?.timeoutInSeconds ?? 60 * 60;
1220
+ return await this.runTask(cacheKey, async (task, io) => {
1221
+ if (!task.callbackUrl) {
1222
+ throw new Error("No callbackUrl found on task");
1223
+ }
1224
+ await this.triggerClient.createEphemeralEventDispatcher({
1225
+ url: task.callbackUrl,
1226
+ name: event.name,
1227
+ filter: event.filter,
1228
+ contextFilter: event.contextFilter,
1229
+ source: event.source,
1230
+ accountId: event.accountId,
1231
+ timeoutInSeconds
1232
+ });
1233
+ return {};
1234
+ }, {
1235
+ name: "Wait for Event",
1236
+ icon: "custom-event",
1237
+ params: {
1238
+ name: event.name,
1239
+ source: event.source,
1240
+ filter: event.filter,
1241
+ contextFilter: event.contextFilter,
1242
+ accountId: event.accountId
1243
+ },
1244
+ callback: {
1245
+ enabled: true,
1246
+ timeoutInSeconds
1247
+ },
1248
+ properties: [
1249
+ {
1250
+ label: "Event",
1251
+ text: event.name
1252
+ },
1253
+ {
1254
+ label: "Timeout",
1255
+ text: `${timeoutInSeconds}s`
1256
+ },
1257
+ ...event.source ? [
1258
+ {
1259
+ label: "Source",
1260
+ text: event.source
1261
+ }
1262
+ ] : [],
1263
+ ...event.accountId ? [
1264
+ {
1265
+ label: "Account ID",
1266
+ text: event.accountId
1267
+ }
1268
+ ] : []
1269
+ ],
1270
+ parseOutput: (output) => {
1271
+ return waitForEventSchema(event.schema ?? import_zod3.z.any()).parse(output);
1272
+ }
1273
+ });
1274
+ }
1156
1275
  async waitForRequest(cacheKey, callback, options) {
1157
1276
  const timeoutInSeconds = options?.timeoutInSeconds ?? 60 * 60;
1158
1277
  return await this.runTask(cacheKey, async (task, io) => {
@@ -1187,17 +1306,18 @@ var IO = class {
1187
1306
  await status.update(cacheKey, initialStatus);
1188
1307
  return status;
1189
1308
  }
1190
- async backgroundFetch(cacheKey, url, requestInit, retry2, timeout) {
1309
+ async backgroundFetch(cacheKey, url, requestInit, options) {
1191
1310
  const urlObject = new URL(url);
1192
1311
  return await this.runTask(cacheKey, async (task) => {
1312
+ console.log("task context", task.context);
1193
1313
  return task.output;
1194
1314
  }, {
1195
1315
  name: `fetch ${urlObject.hostname}${urlObject.pathname}`,
1196
1316
  params: {
1197
1317
  url,
1198
1318
  requestInit,
1199
- retry: retry2,
1200
- timeout
1319
+ retry: options?.retry,
1320
+ timeout: options?.timeout
1201
1321
  },
1202
1322
  operation: "fetch",
1203
1323
  icon: "background",
@@ -1216,10 +1336,80 @@ var IO = class {
1216
1336
  label: "background",
1217
1337
  text: "true"
1218
1338
  },
1219
- ...timeout ? [
1339
+ ...options?.timeout ? [
1340
+ {
1341
+ label: "timeout",
1342
+ text: `${options.timeout.durationInMs}ms`
1343
+ }
1344
+ ] : []
1345
+ ],
1346
+ retry: {
1347
+ limit: 0
1348
+ }
1349
+ });
1350
+ }
1351
+ async backgroundPoll(cacheKey, params) {
1352
+ const urlObject = new URL(params.url);
1353
+ return await this.runTask(cacheKey, async (task) => {
1354
+ return task.output;
1355
+ }, {
1356
+ name: `poll ${urlObject.hostname}${urlObject.pathname}`,
1357
+ params,
1358
+ operation: "fetch-poll",
1359
+ icon: "clock-bolt",
1360
+ noop: false,
1361
+ properties: [
1362
+ {
1363
+ label: "url",
1364
+ text: params.url
1365
+ },
1366
+ {
1367
+ label: "interval",
1368
+ text: `${params.interval}s`
1369
+ },
1370
+ {
1371
+ label: "timeout",
1372
+ text: `${params.timeout}s`
1373
+ }
1374
+ ],
1375
+ retry: {
1376
+ limit: 0
1377
+ }
1378
+ });
1379
+ }
1380
+ async backgroundFetchResponse(cacheKey, url, requestInit, options) {
1381
+ const urlObject = new URL(url);
1382
+ return await this.runTask(cacheKey, async (task) => {
1383
+ return task.output;
1384
+ }, {
1385
+ name: `fetch response ${urlObject.hostname}${urlObject.pathname}`,
1386
+ params: {
1387
+ url,
1388
+ requestInit,
1389
+ retry: options?.retry,
1390
+ timeout: options?.timeout
1391
+ },
1392
+ operation: "fetch-response",
1393
+ icon: "background",
1394
+ noop: false,
1395
+ properties: [
1396
+ {
1397
+ label: "url",
1398
+ text: url,
1399
+ url
1400
+ },
1401
+ {
1402
+ label: "method",
1403
+ text: requestInit?.method ?? "GET"
1404
+ },
1405
+ {
1406
+ label: "background",
1407
+ text: "true"
1408
+ },
1409
+ ...options?.timeout ? [
1220
1410
  {
1221
1411
  label: "timeout",
1222
- text: `${timeout.durationInMs}ms`
1412
+ text: `${options.timeout.durationInMs}ms`
1223
1413
  }
1224
1414
  ] : []
1225
1415
  ],
@@ -1247,7 +1437,26 @@ var IO = class {
1247
1437
  label: "ID",
1248
1438
  text: event.id
1249
1439
  }
1250
- ] : []
1440
+ ] : [],
1441
+ ...sendEventOptionsProperties(options)
1442
+ ]
1443
+ });
1444
+ }
1445
+ async sendEvents(cacheKey, events, options) {
1446
+ return await this.runTask(cacheKey, async (task) => {
1447
+ return await this._triggerClient.sendEvents(events, options);
1448
+ }, {
1449
+ name: "sendEvents",
1450
+ params: {
1451
+ events,
1452
+ options
1453
+ },
1454
+ properties: [
1455
+ {
1456
+ label: "Total Events",
1457
+ text: String(events.length)
1458
+ },
1459
+ ...sendEventOptionsProperties(options)
1251
1460
  ]
1252
1461
  });
1253
1462
  }
@@ -1471,7 +1680,7 @@ var IO = class {
1471
1680
  idempotencyKey
1472
1681
  });
1473
1682
  this._stats.cachedTaskHits++;
1474
- return cachedTask.output;
1683
+ return options?.parseOutput ? options.parseOutput(cachedTask.output) : cachedTask.output;
1475
1684
  }
1476
1685
  if (options?.noop && this._noopTasksBloomFilter) {
1477
1686
  if (this._noopTasksBloomFilter.test(idempotencyKey)) {
@@ -1482,11 +1691,15 @@ var IO = class {
1482
1691
  return {};
1483
1692
  }
1484
1693
  }
1694
+ const runOptions = {
1695
+ ...options ?? {},
1696
+ parseOutput: void 0
1697
+ };
1485
1698
  const response = await this._apiClient.runTask(this._id, {
1486
1699
  idempotencyKey,
1487
1700
  displayKey: typeof cacheKey === "string" ? cacheKey : void 0,
1488
1701
  noop: false,
1489
- ...options ?? {},
1702
+ ...runOptions ?? {},
1490
1703
  parentId
1491
1704
  }, {
1492
1705
  cachedTasksCursor: this._cachedTasksCursor
@@ -1530,7 +1743,7 @@ var IO = class {
1530
1743
  this._stats.cachedTaskMisses++;
1531
1744
  __privateMethod(this, _addToCachedTasks, addToCachedTasks_fn).call(this, task);
1532
1745
  }
1533
- return task.output;
1746
+ return options?.parseOutput ? options.parseOutput(task.output) : task.output;
1534
1747
  }
1535
1748
  if (task.status === "ERRORED") {
1536
1749
  this._logger.debug("Task errored", {
@@ -1571,7 +1784,8 @@ var IO = class {
1571
1784
  throw new CanceledWithTaskError(completedTask);
1572
1785
  }
1573
1786
  __privateMethod(this, _detectAutoYield, detectAutoYield_fn).call(this, "after_complete_task", 500);
1574
- return this._outputSerializer.deserialize(output);
1787
+ const deserializedOutput = this._outputSerializer.deserialize(output);
1788
+ return options?.parseOutput ? options.parseOutput(deserializedOutput) : deserializedOutput;
1575
1789
  } catch (error) {
1576
1790
  if (isTriggerError(error)) {
1577
1791
  throw error;
@@ -1770,6 +1984,29 @@ async function spaceOut(callback, index, delay) {
1770
1984
  return await callback();
1771
1985
  }
1772
1986
  __name(spaceOut, "spaceOut");
1987
+ function sendEventOptionsProperties(options) {
1988
+ return [
1989
+ ...options?.accountId ? [
1990
+ {
1991
+ label: "Account ID",
1992
+ text: options.accountId
1993
+ }
1994
+ ] : [],
1995
+ ...options?.deliverAfter ? [
1996
+ {
1997
+ label: "Deliver After",
1998
+ text: `${options.deliverAfter}s`
1999
+ }
2000
+ ] : [],
2001
+ ...options?.deliverAt ? [
2002
+ {
2003
+ label: "Deliver At",
2004
+ text: options.deliverAt.toISOString()
2005
+ }
2006
+ ] : []
2007
+ ];
2008
+ }
2009
+ __name(sendEventOptionsProperties, "sendEventOptionsProperties");
1773
2010
 
1774
2011
  // src/ioWithIntegrations.ts
1775
2012
  function createIOWithIntegrations(io, auths, integrations) {
@@ -2160,8 +2397,11 @@ var DynamicSchedule = class {
2160
2397
  };
2161
2398
  __name(DynamicSchedule, "DynamicSchedule");
2162
2399
 
2400
+ // src/triggerClient.ts
2401
+ var import_node_events = __toESM(require("events"));
2402
+
2163
2403
  // package.json
2164
- var version = "2.2.5";
2404
+ var version = "2.2.7";
2165
2405
 
2166
2406
  // src/triggerClient.ts
2167
2407
  var registerSourceEvent = {
@@ -2171,7 +2411,7 @@ var registerSourceEvent = {
2171
2411
  icon: "register-source",
2172
2412
  parsePayload: import_core8.RegisterSourceEventSchemaV2.parse
2173
2413
  };
2174
- var _options4, _registeredJobs, _registeredSources, _registeredHttpSourceHandlers, _registeredDynamicTriggers, _jobMetadataByDynamicTriggers, _registeredSchedules, _registeredHttpEndpoints, _authResolvers, _client2, _internalLogger, _preprocessRun, preprocessRun_fn, _executeJob, executeJob_fn, _convertErrorToExecutionResponse, convertErrorToExecutionResponse_fn, _createRunContext, createRunContext_fn, _createPreprocessRunContext, createPreprocessRunContext_fn, _handleHttpSourceRequest, handleHttpSourceRequest_fn, _handleHttpEndpointRequestForResponse, handleHttpEndpointRequestForResponse_fn, _resolveConnections, resolveConnections_fn, _resolveConnection, resolveConnection_fn, _buildJobsIndex, buildJobsIndex_fn, _buildJobIndex, buildJobIndex_fn, _buildJobIntegrations, buildJobIntegrations_fn, _buildJobIntegration, buildJobIntegration_fn, _logIOStats, logIOStats_fn, _standardResponseHeaders, standardResponseHeaders_fn;
2414
+ var _options4, _registeredJobs, _registeredSources, _registeredHttpSourceHandlers, _registeredDynamicTriggers, _jobMetadataByDynamicTriggers, _registeredSchedules, _registeredHttpEndpoints, _authResolvers, _eventEmitter, _client2, _internalLogger, _preprocessRun, preprocessRun_fn, _executeJob, executeJob_fn, _convertErrorToExecutionResponse, convertErrorToExecutionResponse_fn, _createRunContext, createRunContext_fn, _createPreprocessRunContext, createPreprocessRunContext_fn, _handleHttpSourceRequest, handleHttpSourceRequest_fn, _handleHttpEndpointRequestForResponse, handleHttpEndpointRequestForResponse_fn, _resolveConnections, resolveConnections_fn, _resolveConnection, resolveConnection_fn, _buildJobsIndex, buildJobsIndex_fn, _buildJobIndex, buildJobIndex_fn, _buildJobIntegrations, buildJobIntegrations_fn, _buildJobIntegration, buildJobIntegration_fn, _logIOStats, logIOStats_fn, _standardResponseHeaders, standardResponseHeaders_fn, _serializeRunMetadata, serializeRunMetadata_fn, _deliverSuccessfulRunNotification, deliverSuccessfulRunNotification_fn, _deliverFailedRunNotification, deliverFailedRunNotification_fn;
2175
2415
  var TriggerClient = class {
2176
2416
  constructor(options) {
2177
2417
  __privateAdd(this, _preprocessRun);
@@ -2189,6 +2429,9 @@ var TriggerClient = class {
2189
2429
  __privateAdd(this, _buildJobIntegration);
2190
2430
  __privateAdd(this, _logIOStats);
2191
2431
  __privateAdd(this, _standardResponseHeaders);
2432
+ __privateAdd(this, _serializeRunMetadata);
2433
+ __privateAdd(this, _deliverSuccessfulRunNotification);
2434
+ __privateAdd(this, _deliverFailedRunNotification);
2192
2435
  __privateAdd(this, _options4, void 0);
2193
2436
  __privateAdd(this, _registeredJobs, {});
2194
2437
  __privateAdd(this, _registeredSources, {});
@@ -2198,8 +2441,10 @@ var TriggerClient = class {
2198
2441
  __privateAdd(this, _registeredSchedules, {});
2199
2442
  __privateAdd(this, _registeredHttpEndpoints, {});
2200
2443
  __privateAdd(this, _authResolvers, {});
2444
+ __privateAdd(this, _eventEmitter, new import_node_events.default());
2201
2445
  __privateAdd(this, _client2, void 0);
2202
2446
  __privateAdd(this, _internalLogger, void 0);
2447
+ __publicField(this, "on", __privateGet(this, _eventEmitter).on.bind(__privateGet(this, _eventEmitter)));
2203
2448
  this.id = options.id;
2204
2449
  __privateSet(this, _options4, options);
2205
2450
  __privateSet(this, _client2, new ApiClient(__privateGet(this, _options4)));
@@ -2376,10 +2621,12 @@ var TriggerClient = class {
2376
2621
  version: job.version,
2377
2622
  triggerVersion
2378
2623
  });
2624
+ const standardHeaders = __privateMethod(this, _standardResponseHeaders, standardResponseHeaders_fn).call(this, timeOrigin);
2625
+ standardHeaders["x-trigger-run-metadata"] = __privateMethod(this, _serializeRunMetadata, serializeRunMetadata_fn).call(this, job);
2379
2626
  return {
2380
2627
  status: 200,
2381
2628
  body: results,
2382
- headers: __privateMethod(this, _standardResponseHeaders, standardResponseHeaders_fn).call(this, timeOrigin)
2629
+ headers: standardHeaders
2383
2630
  };
2384
2631
  }
2385
2632
  case "PREPROCESS_RUN": {
@@ -2517,6 +2764,22 @@ var TriggerClient = class {
2517
2764
  headers: __privateMethod(this, _standardResponseHeaders, standardResponseHeaders_fn).call(this, timeOrigin)
2518
2765
  };
2519
2766
  }
2767
+ case "RUN_NOTIFICATION": {
2768
+ const rawJson = await request.json();
2769
+ const runNotification = rawJson;
2770
+ if (runNotification.ok) {
2771
+ await __privateMethod(this, _deliverSuccessfulRunNotification, deliverSuccessfulRunNotification_fn).call(this, runNotification);
2772
+ } else {
2773
+ await __privateMethod(this, _deliverFailedRunNotification, deliverFailedRunNotification_fn).call(this, runNotification);
2774
+ }
2775
+ return {
2776
+ status: 200,
2777
+ body: {
2778
+ ok: true
2779
+ },
2780
+ headers: __privateMethod(this, _standardResponseHeaders, standardResponseHeaders_fn).call(this, timeOrigin)
2781
+ };
2782
+ }
2520
2783
  }
2521
2784
  return {
2522
2785
  status: 405,
@@ -2675,6 +2938,9 @@ var TriggerClient = class {
2675
2938
  async sendEvent(event, options) {
2676
2939
  return __privateGet(this, _client2).sendEvent(event, options);
2677
2940
  }
2941
+ async sendEvents(events, options) {
2942
+ return __privateGet(this, _client2).sendEvents(events, options);
2943
+ }
2678
2944
  async cancelEvent(eventId) {
2679
2945
  return __privateGet(this, _client2).cancelEvent(eventId);
2680
2946
  }
@@ -2708,6 +2974,9 @@ var TriggerClient = class {
2708
2974
  async invokeJob(jobId, payload, options) {
2709
2975
  return __privateGet(this, _client2).invokeJob(jobId, payload, options);
2710
2976
  }
2977
+ async createEphemeralEventDispatcher(payload) {
2978
+ return __privateGet(this, _client2).createEphemeralEventDispatcher(payload);
2979
+ }
2711
2980
  authorized(apiKey) {
2712
2981
  if (typeof apiKey !== "string") {
2713
2982
  return "missing-header";
@@ -2732,6 +3001,7 @@ _jobMetadataByDynamicTriggers = new WeakMap();
2732
3001
  _registeredSchedules = new WeakMap();
2733
3002
  _registeredHttpEndpoints = new WeakMap();
2734
3003
  _authResolvers = new WeakMap();
3004
+ _eventEmitter = new WeakMap();
2735
3005
  _client2 = new WeakMap();
2736
3006
  _internalLogger = new WeakMap();
2737
3007
  _preprocessRun = new WeakSet();
@@ -3261,6 +3531,45 @@ standardResponseHeaders_fn = /* @__PURE__ */ __name(function(start) {
3261
3531
  "X-Trigger-Request-Timing": `dur=${performance.now() - start / 1e3}`
3262
3532
  };
3263
3533
  }, "#standardResponseHeaders");
3534
+ _serializeRunMetadata = new WeakSet();
3535
+ serializeRunMetadata_fn = /* @__PURE__ */ __name(function(job4) {
3536
+ const metadata = {};
3537
+ if (__privateGet(this, _eventEmitter).listenerCount("runSucceeeded") > 0 || typeof job4.options.onSuccess === "function") {
3538
+ metadata["successSubscription"] = true;
3539
+ }
3540
+ if (__privateGet(this, _eventEmitter).listenerCount("runFailed") > 0 || typeof job4.options.onFailure === "function") {
3541
+ metadata["failedSubscription"] = true;
3542
+ }
3543
+ return JSON.stringify(metadata);
3544
+ }, "#serializeRunMetadata");
3545
+ _deliverSuccessfulRunNotification = new WeakSet();
3546
+ deliverSuccessfulRunNotification_fn = /* @__PURE__ */ __name(async function(notification) {
3547
+ __privateGet(this, _internalLogger).debug("delivering successful run notification", {
3548
+ notification
3549
+ });
3550
+ __privateGet(this, _eventEmitter).emit("runSucceeeded", notification);
3551
+ const job = __privateGet(this, _registeredJobs)[notification.job.id];
3552
+ if (!job) {
3553
+ return;
3554
+ }
3555
+ if (typeof job.options.onSuccess === "function") {
3556
+ await job.options.onSuccess(notification);
3557
+ }
3558
+ }, "#deliverSuccessfulRunNotification");
3559
+ _deliverFailedRunNotification = new WeakSet();
3560
+ deliverFailedRunNotification_fn = /* @__PURE__ */ __name(async function(notification1) {
3561
+ __privateGet(this, _internalLogger).debug("delivering failed run notification", {
3562
+ notification: notification1
3563
+ });
3564
+ __privateGet(this, _eventEmitter).emit("runFailed", notification1);
3565
+ const job = __privateGet(this, _registeredJobs)[notification1.job.id];
3566
+ if (!job) {
3567
+ return;
3568
+ }
3569
+ if (typeof job.options.onFailure === "function") {
3570
+ await job.options.onFailure(notification1);
3571
+ }
3572
+ }, "#deliverFailedRunNotification");
3264
3573
  function dynamicTriggerRegisterSourceJobId(id) {
3265
3574
  return `register-dynamic-trigger-${id}`;
3266
3575
  }
@@ -3565,15 +3874,6 @@ function invokeTrigger(options) {
3565
3874
  }
3566
3875
  __name(invokeTrigger, "invokeTrigger");
3567
3876
 
3568
- // src/types.ts
3569
- var import_zod2 = require("zod");
3570
- var EventSpecificationExampleSchema = import_zod2.z.object({
3571
- id: import_zod2.z.string(),
3572
- name: import_zod2.z.string(),
3573
- icon: import_zod2.z.string().optional(),
3574
- payload: import_zod2.z.any()
3575
- });
3576
-
3577
3877
  // src/security.ts
3578
3878
  var import_crypto = __toESM(require("crypto"));
3579
3879
  async function verifyRequestSignature({ request, headerName, secret, algorithm }) {
@@ -3653,6 +3953,7 @@ __name(redactString, "redactString");
3653
3953
  redactString,
3654
3954
  retry,
3655
3955
  verifyHmacSha256,
3656
- verifyRequestSignature
3956
+ verifyRequestSignature,
3957
+ waitForEventSchema
3657
3958
  });
3658
3959
  //# sourceMappingURL=index.js.map