@trigger.dev/sdk 2.2.7 → 2.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,25 @@
1
1
  import * as _trigger_dev_core from '@trigger.dev/core';
2
- import { RunTaskBodyInput, CompleteTaskBodyV2Input, FailTaskBodyInput, SendEvent, SendEventOptions, StatusUpdate, UpdateTriggerSourceBodyV2, TriggerSource, RegisterTriggerBodyV2, RegisterSourceEventV2, ScheduleMetadata, GetRunOptionsWithTaskDetails, GetRunsOptions, InvokeOptions, EphemeralEventDispatcherRequestBody, LogLevel, RuntimeEnvironmentType, DisplayProperty, TriggerMetadata, EventFilter, SuccessfulRunNotification, FailedRunNotification, HttpEndpointMetadata, RequestFilter, Prettify, HandleTriggerSource, Logger, RegisterTriggerSource, SerializableJson, ConnectionAuth, NormalizedResponse, HttpSourceResponseMetadata, IntervalOptions, CronOptions, ScheduledPayload, DeserializedJson, ServerTask, CachedTask, InitialStatusUpdate, FetchRequestInit, FetchRetryOptions, FetchTimeoutOptions, FetchPollOperation, RunTaskOptions, IntegrationMetadata, QueueOptions, IntegrationConfig, JobMetadata, RunNotification, MissingConnectionNotificationPayload, MissingConnectionResolvedNotificationPayload, ErrorWithStack, ApiEventLog, RedactString } from '@trigger.dev/core';
2
+ import { AsyncMap, KeyValueStoreResponseBody, RunTaskBodyInput, CompleteTaskBodyV2Input, FailTaskBodyInput, SendEvent, SendEventOptions, StatusUpdate, UpdateTriggerSourceBodyV2, TriggerSource, UpdateWebhookBody, RegisterTriggerBodyV2, RegisterSourceEventV2, ScheduleMetadata, GetRunOptionsWithTaskDetails, GetRunsOptions, InvokeOptions, EphemeralEventDispatcherRequestBody, LogLevel, RuntimeEnvironmentType, DisplayProperty, TriggerMetadata, EventFilter, SuccessfulRunNotification, FailedRunNotification, HttpEndpointMetadata, RequestFilter, Prettify, HandleTriggerSource, Logger, RegisterTriggerSource, SerializableJson, ConnectionAuth, NormalizedResponse, HttpSourceResponseMetadata, IntervalOptions, CronOptions, ScheduledPayload, RegisterWebhookSource, DeserializedJson, ServerTask, CachedTask, InitialStatusUpdate, FetchRequestInit, FetchRetryOptions, FetchTimeoutOptions, FetchPollOperation, RunTaskOptions, IntegrationMetadata, IntegrationConfig, JobMetadata, RunNotification, MissingConnectionNotificationPayload, MissingConnectionResolvedNotificationPayload, ErrorWithStack, ApiEventLog, RedactString } from '@trigger.dev/core';
3
3
  export { ConnectionAuth, DisplayProperty, EventFilter, Logger, NormalizedRequest, OverridableRunTaskOptions, Prettify, RedactString, RegisteredOptionsDiff, RunTaskOptions, SourceEventOption } from '@trigger.dev/core';
4
4
  import * as zod from 'zod';
5
5
  import { z, ZodType, TypeOf } from 'zod';
6
+ import { BinaryToTextEncoding, BinaryLike, KeyObject } from 'crypto';
7
+
8
+ type QueryKeyValueStoreFunction = (action: "DELETE" | "GET" | "HAS" | "SET", data: {
9
+ key: string;
10
+ value?: string;
11
+ }) => Promise<KeyValueStoreResponseBody>;
12
+ declare class KeyValueStoreClient implements AsyncMap {
13
+ #private;
14
+ private queryStore;
15
+ private type;
16
+ private namespace;
17
+ constructor(queryStore: QueryKeyValueStoreFunction, type?: string | null, namespace?: string);
18
+ delete(key: string): Promise<boolean>;
19
+ get<T extends Json<T>>(key: string): Promise<T>;
20
+ has(key: string): Promise<boolean>;
21
+ set<T extends Json<T>>(key: string, value: T): Promise<T>;
22
+ }
6
23
 
7
24
  type ApiClientOptions = {
8
25
  apiKey?: string;
@@ -581,6 +598,7 @@ declare class ApiClient {
581
598
  state?: "loading" | "success" | "failure" | undefined;
582
599
  }>;
583
600
  updateSource(client: string, key: string, source: UpdateTriggerSourceBodyV2): Promise<TriggerSource>;
601
+ updateWebhook(key: string, webhookData: UpdateWebhookBody): Promise<TriggerSource>;
584
602
  registerTrigger(client: string, id: string, key: string, payload: RegisterTriggerBodyV2, idempotencyKey?: string): Promise<RegisterSourceEventV2>;
585
603
  registerSchedule(client: string, id: string, key: string, payload: ScheduleMetadata): Promise<{
586
604
  id: string;
@@ -617,7 +635,7 @@ declare class ApiClient {
617
635
  updatedAt: Date;
618
636
  runs: {
619
637
  id: string;
620
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
638
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
621
639
  startedAt?: Date | null | undefined;
622
640
  completedAt?: Date | null | undefined;
623
641
  }[];
@@ -627,7 +645,7 @@ declare class ApiClient {
627
645
  id: string;
628
646
  startedAt: Date | null;
629
647
  completedAt: Date | null;
630
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
648
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
631
649
  updatedAt: Date | null;
632
650
  tasks: _trigger_dev_core.RunTaskWithSubtasks[];
633
651
  statuses: {
@@ -648,7 +666,7 @@ declare class ApiClient {
648
666
  id: string;
649
667
  startedAt: Date | null;
650
668
  completedAt: Date | null;
651
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
669
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
652
670
  updatedAt: Date | null;
653
671
  tasks: _trigger_dev_core.RunTaskWithSubtasks[];
654
672
  statuses: {
@@ -679,7 +697,7 @@ declare class ApiClient {
679
697
  }[];
680
698
  run: {
681
699
  id: string;
682
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
700
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
683
701
  output?: any;
684
702
  };
685
703
  }>;
@@ -688,7 +706,7 @@ declare class ApiClient {
688
706
  id: string;
689
707
  startedAt: Date | null;
690
708
  completedAt: Date | null;
691
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
709
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
692
710
  updatedAt: Date | null;
693
711
  }[];
694
712
  nextCursor?: string | undefined;
@@ -699,6 +717,7 @@ declare class ApiClient {
699
717
  createEphemeralEventDispatcher(payload: EphemeralEventDispatcherRequestBody): Promise<{
700
718
  id: string;
701
719
  }>;
720
+ get store(): KeyValueStoreClient;
702
721
  }
703
722
  type VersionedResponseBodyMap = {
704
723
  [key: string]: z.ZodTypeAny;
@@ -894,6 +913,12 @@ declare const EventSpecificationExampleSchema: z.ZodObject<{
894
913
  payload?: any;
895
914
  }>;
896
915
  type EventSpecificationExample = z.infer<typeof EventSpecificationExampleSchema>;
916
+ type TypedEventSpecificationExample<TEvent> = {
917
+ id: string;
918
+ name: string;
919
+ icon?: string;
920
+ payload: TEvent;
921
+ };
897
922
  interface EventSpecification<TEvent extends any, TInvoke extends any = TEvent> {
898
923
  name: string | string[];
899
924
  title: string;
@@ -1090,7 +1115,7 @@ type TriggerOptionsRecordWithEvent<TValue, TTriggerOptionDefinitions extends Rec
1090
1115
  type TriggerOptionRecord<TValue, TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
1091
1116
  [K in keyof TTriggerOptionDefinitions]: TValue;
1092
1117
  };
1093
- type RegisterFunctionEvent<TChannel extends ChannelNames, TParams extends any, TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
1118
+ type RegisterFunctionEvent$1<TChannel extends ChannelNames, TParams extends any, TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
1094
1119
  options: TriggerOptionDiffs<TTriggerOptionDefinitions>;
1095
1120
  source: {
1096
1121
  active: boolean;
@@ -1105,14 +1130,14 @@ type RegisterSourceEvent<TTriggerOptionDefinitions extends Record<string, string
1105
1130
  dynamicTriggerId?: string;
1106
1131
  options: TriggerOptionDiffs<TTriggerOptionDefinitions>;
1107
1132
  };
1108
- type RegisterFunctionOutput<TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
1133
+ type RegisterFunctionOutput$1<TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
1109
1134
  secret?: string;
1110
1135
  data?: SerializableJson;
1111
1136
  options: TriggerOptionsRecordWithEvent<string[], TTriggerOptionDefinitions>;
1112
1137
  };
1113
- type RegisterFunction<TIntegration extends TriggerIntegration, TParams extends any, TChannel extends ChannelNames, TTriggerOptionDefinitions extends Record<string, string[]> = any> = (event: RegisterFunctionEvent<TChannel, TParams, TTriggerOptionDefinitions>, io: IOWithIntegrations<{
1138
+ type RegisterFunction$1<TIntegration extends TriggerIntegration, TParams extends any, TChannel extends ChannelNames, TTriggerOptionDefinitions extends Record<string, string[]> = any> = (event: RegisterFunctionEvent$1<TChannel, TParams, TTriggerOptionDefinitions>, io: IOWithIntegrations<{
1114
1139
  integration: TIntegration;
1115
- }>, ctx: TriggerContext) => Promise<RegisterFunctionOutput<TTriggerOptionDefinitions> | undefined>;
1140
+ }>, ctx: TriggerContext) => Promise<RegisterFunctionOutput$1<TTriggerOptionDefinitions> | undefined>;
1116
1141
  type HandlerEvent<TChannel extends ChannelNames, TParams extends any = any> = {
1117
1142
  rawEvent: ExternalSourceChannelMap[TChannel]["event"];
1118
1143
  source: Prettify<Omit<HandleTriggerSource, "params"> & {
@@ -1124,18 +1149,18 @@ type HandlerFunction<TChannel extends ChannelNames, TParams extends any, TTrigge
1124
1149
  response?: NormalizedResponse;
1125
1150
  metadata?: HttpSourceResponseMetadata;
1126
1151
  } | void>;
1127
- type KeyFunction<TParams extends any> = (params: TParams) => string;
1128
- type FilterFunction<TParams extends any, TTriggerOptionDefinitions extends Record<string, string[]> = any> = (params: TParams, options?: TTriggerOptionDefinitions) => EventFilter;
1152
+ type KeyFunction$1<TParams extends any> = (params: TParams) => string;
1153
+ type FilterFunction$1<TParams extends any, TTriggerOptionDefinitions extends Record<string, string[]> = any> = (params: TParams, options?: TTriggerOptionDefinitions) => EventFilter;
1129
1154
  type ExternalSourceOptions<TChannel extends ChannelNames, TIntegration extends TriggerIntegration, TParams extends any, TTriggerOptionDefinitions extends Record<string, string[]> = any> = {
1130
1155
  id: string;
1131
1156
  version: string;
1132
1157
  schema: SchemaParser<TParams>;
1133
1158
  optionSchema?: SchemaParser<TTriggerOptionDefinitions>;
1134
1159
  integration: TIntegration;
1135
- register: RegisterFunction<TIntegration, TParams, TChannel, TTriggerOptionDefinitions>;
1136
- filter?: FilterFunction<TParams, TTriggerOptionDefinitions>;
1160
+ register: RegisterFunction$1<TIntegration, TParams, TChannel, TTriggerOptionDefinitions>;
1161
+ filter?: FilterFunction$1<TParams, TTriggerOptionDefinitions>;
1137
1162
  handler: HandlerFunction<TChannel, TParams, TIntegration>;
1138
- key: KeyFunction<TParams>;
1163
+ key: KeyFunction$1<TParams>;
1139
1164
  properties?: (params: TParams) => DisplayProperty[];
1140
1165
  };
1141
1166
  declare class ExternalSource<TIntegration extends TriggerIntegration, TParams extends any, TChannel extends ChannelNames = ChannelNames, TTriggerOptionDefinitions extends Record<string, string[]> = any> {
@@ -1161,7 +1186,7 @@ declare class ExternalSource<TIntegration extends TriggerIntegration, TParams ex
1161
1186
  }>;
1162
1187
  filter(params: TParams, options?: TTriggerOptionDefinitions): EventFilter;
1163
1188
  properties(params: TParams): DisplayProperty[];
1164
- register(params: TParams, registerEvent: RegisterSourceEvent<TTriggerOptionDefinitions>, io: IO, ctx: TriggerContext): Promise<RegisterFunctionOutput<TTriggerOptionDefinitions> | undefined>;
1189
+ register(params: TParams, registerEvent: RegisterSourceEvent<TTriggerOptionDefinitions>, io: IO, ctx: TriggerContext): Promise<RegisterFunctionOutput$1<TTriggerOptionDefinitions> | undefined>;
1165
1190
  key(params: TParams): string;
1166
1191
  get integration(): TIntegration;
1167
1192
  get integrationConfig(): {
@@ -1390,6 +1415,168 @@ declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
1390
1415
  toJSON(): TriggerMetadata;
1391
1416
  }
1392
1417
 
1418
+ type ConcurrencyLimitOptions = {
1419
+ id: string;
1420
+ limit: number;
1421
+ };
1422
+ declare class ConcurrencyLimit {
1423
+ private options;
1424
+ constructor(options: ConcurrencyLimitOptions);
1425
+ get id(): string;
1426
+ get limit(): number;
1427
+ }
1428
+
1429
+ type WebhookCRUDContext<TParams extends any, TConfig extends Record<string, string[]>> = {
1430
+ active: boolean;
1431
+ params: TParams;
1432
+ config: {
1433
+ current: Partial<TConfig>;
1434
+ desired: TConfig;
1435
+ };
1436
+ url: string;
1437
+ secret: string;
1438
+ };
1439
+ type WebhookCRUDFunction<TIntegration extends TriggerIntegration, TParams extends any, TConfig extends Record<string, string[]>> = (options: {
1440
+ io: IOWithIntegrations<{
1441
+ integration: TIntegration;
1442
+ }>;
1443
+ ctx: WebhookCRUDContext<TParams, TConfig>;
1444
+ }) => Promise<any>;
1445
+ interface WebhookCRUD<TIntegration extends TriggerIntegration, TParams extends any, TConfig extends Record<string, string[]>> {
1446
+ create: WebhookCRUDFunction<TIntegration, TParams, TConfig>;
1447
+ read?: WebhookCRUDFunction<TIntegration, TParams, TConfig>;
1448
+ update?: WebhookCRUDFunction<TIntegration, TParams, TConfig>;
1449
+ delete: WebhookCRUDFunction<TIntegration, TParams, TConfig>;
1450
+ }
1451
+ type WebhookConfig<TConfigKeys extends string> = {
1452
+ [K in TConfigKeys]: string[];
1453
+ };
1454
+ type RegisterFunctionEvent<TParams extends any, TConfig extends Record<string, string[]>> = {
1455
+ source: {
1456
+ active: boolean;
1457
+ data?: any;
1458
+ secret: string;
1459
+ url: string;
1460
+ };
1461
+ params: TParams;
1462
+ config: TConfig;
1463
+ };
1464
+ type WebhookRegisterEvent<TConfig extends Record<string, string[]>> = {
1465
+ id: string;
1466
+ source: RegisterWebhookSource;
1467
+ dynamicTriggerId?: string;
1468
+ config: TConfig;
1469
+ };
1470
+ type RegisterFunctionOutput<TConfig extends Record<string, string[]>> = {
1471
+ secret?: string;
1472
+ data?: SerializableJson;
1473
+ config: TConfig;
1474
+ };
1475
+ type RegisterFunction<TIntegration extends TriggerIntegration, TParams extends any, TConfig extends Record<string, string[]>> = (event: RegisterFunctionEvent<TParams, TConfig>, io: IOWithIntegrations<{
1476
+ integration: TIntegration;
1477
+ }>, ctx: TriggerContext) => Promise<RegisterFunctionOutput<TConfig> | undefined>;
1478
+ type WebhookHandlerEvent<TParams extends any = any> = {
1479
+ rawEvent: Request;
1480
+ source: Prettify<Omit<HandleTriggerSource, "params"> & {
1481
+ params: TParams;
1482
+ }>;
1483
+ };
1484
+ type WebhookDeliveryContext = {
1485
+ key: string;
1486
+ secret: string;
1487
+ params: any;
1488
+ };
1489
+ type EventGenerator<TParams extends any, TConfig extends Record<string, string[]>, TIntegration extends TriggerIntegration> = (options: {
1490
+ request: Request;
1491
+ client: TriggerClient;
1492
+ ctx: WebhookDeliveryContext;
1493
+ }) => Promise<any>;
1494
+ type KeyFunction<TParams extends any> = (params: TParams) => string;
1495
+ type FilterFunction<TParams extends any, TConfig extends Record<string, string[]>> = (params: TParams, config?: TConfig) => EventFilter;
1496
+ type WebhookOptions<TIntegration extends TriggerIntegration, TParams extends any, TConfig extends Record<string, string[]>> = {
1497
+ id: string;
1498
+ version: string;
1499
+ integration: TIntegration;
1500
+ schemas: {
1501
+ params: SchemaParser<TParams>;
1502
+ config?: SchemaParser<TConfig>;
1503
+ };
1504
+ key: KeyFunction<TParams>;
1505
+ crud: WebhookCRUD<TIntegration, TParams, TConfig>;
1506
+ filter?: FilterFunction<TParams, TConfig>;
1507
+ register?: RegisterFunction<TIntegration, TParams, TConfig>;
1508
+ verify?: (options: {
1509
+ request: Request;
1510
+ client: TriggerClient;
1511
+ ctx: WebhookDeliveryContext;
1512
+ }) => Promise<VerifyResult>;
1513
+ generateEvents: EventGenerator<TParams, TConfig, TIntegration>;
1514
+ properties?: (params: TParams) => DisplayProperty[];
1515
+ };
1516
+ declare class WebhookSource<TIntegration extends TriggerIntegration, TParams extends any = any, TConfig extends Record<string, string[]> = Record<string, string[]>> {
1517
+ #private;
1518
+ private options;
1519
+ constructor(options: WebhookOptions<TIntegration, TParams, TConfig>);
1520
+ generateEvents(request: Request, client: TriggerClient, ctx: WebhookDeliveryContext): Promise<any>;
1521
+ filter(params: TParams, config?: TConfig): EventFilter;
1522
+ properties(params: TParams): DisplayProperty[];
1523
+ get crud(): WebhookCRUD<TIntegration, TParams, TConfig>;
1524
+ register(params: TParams, registerEvent: WebhookRegisterEvent<TConfig>, io: IO, ctx: TriggerContext): Promise<RegisterFunctionOutput<TConfig> | undefined>;
1525
+ verify(request: Request, client: TriggerClient, ctx: WebhookDeliveryContext): Promise<VerifyResult>;
1526
+ key(params: TParams): string;
1527
+ get integration(): TIntegration;
1528
+ get integrationConfig(): {
1529
+ id: string;
1530
+ metadata: {
1531
+ id: string;
1532
+ name: string;
1533
+ instructions?: string | undefined;
1534
+ };
1535
+ };
1536
+ get id(): string;
1537
+ get version(): string;
1538
+ }
1539
+ type GetWebhookParams<TWebhook extends WebhookSource<any, any, any>> = TWebhook extends WebhookSource<any, infer TParams, any> ? TParams : never;
1540
+ type GetWebhookConfig<TWebhook extends WebhookSource<any, any, any>> = TWebhook extends WebhookSource<any, any, infer TConfig> ? TConfig : never;
1541
+ type WebhookTriggerOptions<TEventSpecification extends EventSpecification<any>, TEventSource extends WebhookSource<any, any, any>, TConfig extends Record<string, string[]> = Record<string, string[]>> = {
1542
+ event: TEventSpecification;
1543
+ source: TEventSource;
1544
+ params: GetWebhookParams<TEventSource>;
1545
+ config: TConfig;
1546
+ };
1547
+ declare class WebhookTrigger<TEventSpecification extends EventSpecification<any>, TEventSource extends WebhookSource<any, any, any>> implements Trigger<TEventSpecification> {
1548
+ private options;
1549
+ constructor(options: WebhookTriggerOptions<TEventSpecification, TEventSource>);
1550
+ get event(): TEventSpecification;
1551
+ get source(): TEventSource;
1552
+ get key(): string;
1553
+ toJSON(): TriggerMetadata;
1554
+ filter(eventFilter: EventFilter): WebhookTrigger<Omit<TEventSpecification, "filter"> & {
1555
+ filter: EventFilter;
1556
+ }, TEventSource>;
1557
+ attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpecification>, any>): void;
1558
+ get preprocessRuns(): boolean;
1559
+ verifyPayload(payload: ReturnType<TEventSpecification["parsePayload"]>): Promise<{
1560
+ success: true;
1561
+ }>;
1562
+ }
1563
+
1564
+ declare class KeyValueStore {
1565
+ #private;
1566
+ private apiClient;
1567
+ private type;
1568
+ private namespace;
1569
+ constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
1570
+ delete(cacheKey: string | any[], key: string): Promise<boolean>;
1571
+ delete(key: string): Promise<boolean>;
1572
+ get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T>;
1573
+ get<T extends Json<T> = any>(key: string): Promise<T>;
1574
+ has(cacheKey: string | any[], key: string): Promise<boolean>;
1575
+ has(key: string): Promise<boolean>;
1576
+ set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
1577
+ set<T extends Json<T>>(key: string, value: T): Promise<T>;
1578
+ }
1579
+
1393
1580
  type TriggerClientOptions = {
1394
1581
  /** The `id` property is used to uniquely identify the client.
1395
1582
  */
@@ -1432,7 +1619,8 @@ declare class TriggerClient {
1432
1619
  * @returns An HTTP Endpoint, that can be used to create an HTTP Trigger.
1433
1620
  * @link https://trigger.dev/docs/documentation/concepts/http-endpoints
1434
1621
  */
1435
- defineHttpEndpoint(options: EndpointOptions): HttpEndpoint<EventSpecification<Request, Request>>;
1622
+ defineHttpEndpoint(options: EndpointOptions, suppressWarnings?: boolean): HttpEndpoint<EventSpecification<Request, Request>>;
1623
+ defineConcurrencyLimit(options: ConcurrencyLimitOptions): ConcurrencyLimit;
1436
1624
  attach(job: Job<Trigger<any>, any>): void;
1437
1625
  attachDynamicTrigger(trigger: DynamicTrigger<any, any>): void;
1438
1626
  attachJobToDynamicTrigger(job: Job<Trigger<any>, any>, trigger: DynamicTrigger<any, any>): void;
@@ -1445,6 +1633,13 @@ declare class TriggerClient {
1445
1633
  }): void;
1446
1634
  attachDynamicSchedule(key: string): void;
1447
1635
  attachDynamicScheduleToJob(key: string, job: Job<Trigger<any>, any>): void;
1636
+ attachWebhook<TIntegration extends TriggerIntegration, TParams extends any, TConfig extends Record<string, string[]>>(options: {
1637
+ key: string;
1638
+ source: WebhookSource<TIntegration, TParams, TConfig>;
1639
+ event: EventSpecification<any>;
1640
+ params: any;
1641
+ config: TConfig;
1642
+ }): void;
1448
1643
  registerTrigger(id: string, key: string, options: RegisterTriggerBodyV2, idempotencyKey?: string): Promise<{
1449
1644
  id: string;
1450
1645
  options: {
@@ -1578,7 +1773,7 @@ declare class TriggerClient {
1578
1773
  updatedAt: Date;
1579
1774
  runs: {
1580
1775
  id: string;
1581
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
1776
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
1582
1777
  startedAt?: Date | null | undefined;
1583
1778
  completedAt?: Date | null | undefined;
1584
1779
  }[];
@@ -1588,7 +1783,7 @@ declare class TriggerClient {
1588
1783
  id: string;
1589
1784
  startedAt: Date | null;
1590
1785
  completedAt: Date | null;
1591
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
1786
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
1592
1787
  updatedAt: Date | null;
1593
1788
  tasks: _trigger_dev_core.RunTaskWithSubtasks[];
1594
1789
  statuses: {
@@ -1609,7 +1804,7 @@ declare class TriggerClient {
1609
1804
  id: string;
1610
1805
  startedAt: Date | null;
1611
1806
  completedAt: Date | null;
1612
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
1807
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
1613
1808
  updatedAt: Date | null;
1614
1809
  tasks: _trigger_dev_core.RunTaskWithSubtasks[];
1615
1810
  statuses: {
@@ -1631,7 +1826,7 @@ declare class TriggerClient {
1631
1826
  id: string;
1632
1827
  startedAt: Date | null;
1633
1828
  completedAt: Date | null;
1634
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
1829
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
1635
1830
  updatedAt: Date | null;
1636
1831
  }[];
1637
1832
  nextCursor?: string | undefined;
@@ -1650,7 +1845,7 @@ declare class TriggerClient {
1650
1845
  }[];
1651
1846
  run: {
1652
1847
  id: string;
1653
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
1848
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
1654
1849
  output?: any;
1655
1850
  };
1656
1851
  }>;
@@ -1660,6 +1855,9 @@ declare class TriggerClient {
1660
1855
  createEphemeralEventDispatcher(payload: EphemeralEventDispatcherRequestBody): Promise<{
1661
1856
  id: string;
1662
1857
  }>;
1858
+ get store(): {
1859
+ env: KeyValueStore;
1860
+ };
1663
1861
  authorized(apiKey?: string | null): "authorized" | "unauthorized" | "missing-client" | "missing-header";
1664
1862
  apiKey(): string | undefined;
1665
1863
  }
@@ -1667,6 +1865,7 @@ declare class TriggerClient {
1667
1865
  type IOTask = ServerTask;
1668
1866
  type IOOptions = {
1669
1867
  id: string;
1868
+ jobId: string;
1670
1869
  apiClient: ApiClient;
1671
1870
  client: TriggerClient;
1672
1871
  context: TriggerContext;
@@ -1719,6 +1918,7 @@ type BackgroundFetchResponse<T> = {
1719
1918
  declare class IO {
1720
1919
  #private;
1721
1920
  private _id;
1921
+ private _jobId;
1722
1922
  private _apiClient;
1723
1923
  private _triggerClient;
1724
1924
  private _logger;
@@ -1736,6 +1936,9 @@ declare class IO {
1736
1936
  private _executionTimeout?;
1737
1937
  private _outputSerializer;
1738
1938
  private _visitedCacheKeys;
1939
+ private _envStore;
1940
+ private _jobStore;
1941
+ private _runStore;
1739
1942
  get stats(): IOStats;
1740
1943
  constructor(options: IOOptions);
1741
1944
  /** Used to send log messages to the [Run log](https://trigger.dev/docs/documentation/guides/viewing-runs). */
@@ -1929,7 +2132,7 @@ declare class IO {
1929
2132
  updatedAt: Date;
1930
2133
  runs: {
1931
2134
  id: string;
1932
- status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD";
2135
+ status: "PENDING" | "CANCELED" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "SUCCESS" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH" | "INVALID_PAYLOAD" | "EXECUTING" | "WAITING_TO_CONTINUE" | "WAITING_TO_EXECUTE";
1933
2136
  startedAt?: Date | null | undefined;
1934
2137
  completedAt?: Date | null | undefined;
1935
2138
  }[];
@@ -1960,6 +2163,12 @@ declare class IO {
1960
2163
  id: string;
1961
2164
  key: string;
1962
2165
  }>;
2166
+ updateWebhook(cacheKey: string | any[], options: {
2167
+ key: string;
2168
+ } & UpdateWebhookBody): Promise<{
2169
+ id: string;
2170
+ key: string;
2171
+ }>;
1963
2172
  /** `io.registerInterval()` allows you to register a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that will trigger any jobs it's attached to on a regular interval.
1964
2173
  * @param cacheKey Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
1965
2174
  * @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to register a new schedule on.
@@ -2072,6 +2281,11 @@ declare class IO {
2072
2281
  * @returns A Promise that resolves with the returned value or the error
2073
2282
  */
2074
2283
  try<TResult, TCatchResult>(tryCallback: () => Promise<TResult>, catchCallback: (error: unknown) => Promise<TCatchResult>): Promise<TResult | TCatchResult>;
2284
+ get store(): {
2285
+ env: KeyValueStore;
2286
+ job: KeyValueStore;
2287
+ run: KeyValueStore;
2288
+ };
2075
2289
  }
2076
2290
  type CallbackFunction = (level: "DEBUG" | "INFO" | "WARN" | "ERROR" | "LOG", message: string, properties?: Record<string, any>) => Promise<void>;
2077
2291
  declare class IOLogger implements TaskLogger {
@@ -2133,9 +2347,15 @@ type JobOptions<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations
2133
2347
  });
2134
2348
  ``` */
2135
2349
  integrations?: TIntegrations;
2136
- /** @deprecated This property is deprecated and no longer effects the execution of the Job
2137
- * */
2138
- queue?: QueueOptions | string;
2350
+ /**
2351
+ * The `concurrencyLimit` property is used to limit the number of concurrent run executions of a job.
2352
+ * Can be a number which represents the limit or a `ConcurrencyLimit` instance which can be used to
2353
+ * group together multiple jobs to share the same concurrency limit.
2354
+ *
2355
+ * If undefined the job will be limited only by the server's global concurrency limit, or if you are using the
2356
+ * Trigger.dev Cloud service, the concurrency limit of your plan.
2357
+ */
2358
+ concurrencyLimit?: number | ConcurrencyLimit;
2139
2359
  /** The `enabled` property is used to enable or disable the Job. If you disable a Job, it will not run. */
2140
2360
  enabled?: boolean;
2141
2361
  /** This function gets called automatically when a Run is Triggered.
@@ -2187,6 +2407,7 @@ type EventTriggerOptions<TEventSpecification extends EventSpecification<any>> =
2187
2407
  name?: string | string[];
2188
2408
  source?: string;
2189
2409
  filter?: EventFilter;
2410
+ verify?: EventTypeFromSpecification<TEventSpecification> extends Request ? VerifyCallback : never;
2190
2411
  };
2191
2412
  declare class EventTrigger<TEventSpecification extends EventSpecification<any>> implements Trigger<TEventSpecification> {
2192
2413
  #private;
@@ -2195,9 +2416,7 @@ declare class EventTrigger<TEventSpecification extends EventSpecification<any>>
2195
2416
  get event(): TEventSpecification;
2196
2417
  attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpecification>, any>): void;
2197
2418
  get preprocessRuns(): boolean;
2198
- verifyPayload(payload: ReturnType<TEventSpecification["parsePayload"]>): Promise<{
2199
- success: true;
2200
- }>;
2419
+ verifyPayload(payload: ReturnType<TEventSpecification["parsePayload"]>): Promise<VerifyResult>;
2201
2420
  }
2202
2421
  /** Configuration options for an EventTrigger */
2203
2422
  type TriggerOptions<TEvent> = {
@@ -2376,20 +2595,24 @@ declare class InvokeTrigger<TSchema extends ZodType = z.ZodTypeAny> implements T
2376
2595
  }
2377
2596
  declare function invokeTrigger<TSchema extends ZodType = z.ZodTypeAny>(options?: InvokeTriggerOptions<TSchema>): Trigger<EventSpecification<TypeOf<TSchema>, z.input<TSchema>>>;
2378
2597
 
2598
+ declare function slugifyId(input: string): string;
2599
+
2379
2600
  /** Easily verify webhook payloads when they're using common signing methods. */
2380
- declare function verifyRequestSignature({ request, headerName, secret, algorithm, }: {
2601
+ declare function verifyRequestSignature({ request, headerName, headerEncoding, secret, algorithm, }: {
2381
2602
  /** The web request that you want to verify. */
2382
2603
  request: Request;
2383
2604
  /** The name of the header that contains the signature. E.g. `X-Cal-Signature-256`. */
2384
2605
  headerName: string;
2606
+ /** The header encoding. Defaults to `hex`. */
2607
+ headerEncoding?: BinaryToTextEncoding;
2385
2608
  /** The secret that you use to hash the payload. For HttpEndpoints this will usually originally
2386
2609
  come from the Trigger.dev dashboard and should be stored in an environment variable. */
2387
- secret: string;
2610
+ secret: BinaryLike | KeyObject;
2388
2611
  /** The hashing algorithm that was used to create the signature. Currently only `sha256` is
2389
2612
  supported. */
2390
2613
  algorithm: "sha256";
2391
2614
  }): Promise<VerifyResult>;
2392
- declare function verifyHmacSha256(headerValue: string, secret: string, body: string): boolean;
2615
+ declare function verifyHmacSha256(headerValue: string, headerEncoding: BinaryToTextEncoding, secret: BinaryLike | KeyObject, body: string): boolean;
2393
2616
 
2394
2617
  declare class ResumeWithTaskError {
2395
2618
  task: ServerTask;
@@ -2466,4 +2689,4 @@ type Task = ServerTask;
2466
2689
  type SentEvent = ApiEventLog;
2467
2690
  declare function redactString(strings: TemplateStringsArray, ...interpolations: string[]): RedactString;
2468
2691
 
2469
- export { AuthResolverResult, BackgroundFetchResponse, CronTrigger, DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, DynamicTriggerOptions, EventSpecification, EventSpecificationExample, EventSpecificationExampleSchema, EventTrigger, EventTypeFromSpecification, ExternalSource, ExternalSourceParams, ExternalSourceTrigger, ExternalSourceTriggerOptions, HandlerEvent, HttpSourceEvent, IO, IOLogger, IOOptions, IOStats, IOTask, IOWithIntegrations, IntegrationTaskKey, IntervalTrigger, InvokeTrigger, JSONOutputSerializer, Job, JobIO, JobOptions, JobPayload, Json, MissingConnectionNotification, MissingConnectionResolvedNotification, NotificationEvents, NotificationsEventEmitter, OutputSerializer, PreprocessResults, RunTaskErrorCallback, SchemaParser, SchemaParserIssue, SchemaParserResult, SentEvent, Task, TaskLogger, Trigger, TriggerAuthResolver, TriggerClient, TriggerClientOptions, TriggerContext, TriggerEventType, TriggerIntegration, TriggerInvokeType, TriggerOptionRecord, TriggerPayload, TriggerPreprocessContext, VerifyResult, WaitForEventResult, cronTrigger, eventTrigger, intervalTrigger, invokeTrigger, isTriggerError, missingConnectionNotification, missingConnectionResolvedNotification, omit, redactString, retry, verifyHmacSha256, verifyRequestSignature, waitForEventSchema };
2692
+ export { AuthResolverResult, BackgroundFetchResponse, CronTrigger, DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, DynamicTriggerOptions, EventSpecification, EventSpecificationExample, EventSpecificationExampleSchema, EventTrigger, EventTypeFromSpecification, ExternalSource, ExternalSourceParams, ExternalSourceTrigger, ExternalSourceTriggerOptions, GetWebhookConfig, GetWebhookParams, HandlerEvent, HttpSourceEvent, IO, IOLogger, IOOptions, IOStats, IOTask, IOWithIntegrations, IntegrationTaskKey, IntervalTrigger, InvokeTrigger, JSONOutputSerializer, Job, JobIO, JobOptions, JobPayload, Json, MissingConnectionNotification, MissingConnectionResolvedNotification, NotificationEvents, NotificationsEventEmitter, OutputSerializer, PreprocessResults, RunTaskErrorCallback, SchemaParser, SchemaParserIssue, SchemaParserResult, SentEvent, Task, TaskLogger, Trigger, TriggerAuthResolver, TriggerClient, TriggerClientOptions, TriggerContext, TriggerEventType, TriggerIntegration, TriggerInvokeType, TriggerOptionRecord, TriggerPayload, TriggerPreprocessContext, TypedEventSpecificationExample, VerifyResult, WaitForEventResult, WebhookConfig, WebhookDeliveryContext, WebhookHandlerEvent, WebhookSource, WebhookTrigger, WebhookTriggerOptions, cronTrigger, eventTrigger, intervalTrigger, invokeTrigger, isTriggerError, missingConnectionNotification, missingConnectionResolvedNotification, omit, redactString, retry, slugifyId, verifyHmacSha256, verifyRequestSignature, waitForEventSchema };