@trigger.dev/sdk 2.2.11 → 2.3.0

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
@@ -3,8 +3,20 @@ import { AsyncMap, KeyValueStoreResponseBody, RunTaskBodyInput, CompleteTaskBody
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 { Buffer } from 'buffer';
6
7
  import { BinaryToTextEncoding, BinaryLike, KeyObject } from 'crypto';
7
8
 
9
+ type ConcurrencyLimitOptions = {
10
+ id: string;
11
+ limit: number;
12
+ };
13
+ declare class ConcurrencyLimit {
14
+ private options;
15
+ constructor(options: ConcurrencyLimitOptions);
16
+ get id(): string;
17
+ get limit(): number;
18
+ }
19
+
8
20
  type QueryKeyValueStoreFunction = (action: "DELETE" | "GET" | "HAS" | "SET", data: {
9
21
  key: string;
10
22
  value?: string;
@@ -1415,15 +1427,20 @@ declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
1415
1427
  toJSON(): TriggerMetadata;
1416
1428
  }
1417
1429
 
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;
1430
+ declare class KeyValueStore {
1431
+ #private;
1432
+ private apiClient;
1433
+ private type;
1434
+ private namespace;
1435
+ constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
1436
+ delete(cacheKey: string | any[], key: string): Promise<boolean>;
1437
+ delete(key: string): Promise<boolean>;
1438
+ get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T | undefined>;
1439
+ get<T extends Json<T> = any>(key: string): Promise<T | undefined>;
1440
+ has(cacheKey: string | any[], key: string): Promise<boolean>;
1441
+ has(key: string): Promise<boolean>;
1442
+ set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
1443
+ set<T extends Json<T>>(key: string, value: T): Promise<T>;
1427
1444
  }
1428
1445
 
1429
1446
  type WebhookCRUDContext<TParams extends any, TConfig extends Record<string, string[]>> = {
@@ -1561,22 +1578,6 @@ declare class WebhookTrigger<TEventSpecification extends EventSpecification<any>
1561
1578
  }>;
1562
1579
  }
1563
1580
 
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 | undefined>;
1573
- get<T extends Json<T> = any>(key: string): Promise<T | undefined>;
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
-
1580
1581
  type TriggerClientOptions = {
1581
1582
  /** The `id` property is used to uniquely identify the client.
1582
1583
  */
@@ -2374,11 +2375,12 @@ type JobIO<TJob> = TJob extends Job<any, infer TIntegrations> ? IOWithIntegratio
2374
2375
  declare class Job<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration> = {}, TOutput extends any = any> {
2375
2376
  #private;
2376
2377
  readonly options: JobOptions<TTrigger, TIntegrations, TOutput>;
2377
- client: TriggerClient;
2378
- constructor(
2379
- /** An instance of [TriggerClient](/sdk/triggerclient) that is used to send events
2380
- to the Trigger API. */
2381
- client: TriggerClient, options: JobOptions<TTrigger, TIntegrations, TOutput>);
2378
+ client?: TriggerClient;
2379
+ constructor(options: JobOptions<TTrigger, TIntegrations, TOutput>);
2380
+ /**
2381
+ * Attaches the job to a client. This is called automatically when you define a job using `client.defineJob()`.
2382
+ */
2383
+ attachToClient(client: TriggerClient): void;
2382
2384
  get id(): string;
2383
2385
  get enabled(): boolean;
2384
2386
  get name(): string;
@@ -2689,4 +2691,4 @@ type Task = ServerTask;
2689
2691
  type SentEvent = ApiEventLog;
2690
2692
  declare function redactString(strings: TemplateStringsArray, ...interpolations: string[]): RedactString;
2691
2693
 
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 };
2694
+ export { type AuthResolverResult, type BackgroundFetchResponse, CronTrigger, type DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, type DynamicTriggerOptions, type EventSpecification, type EventSpecificationExample, EventSpecificationExampleSchema, EventTrigger, type EventTypeFromSpecification, ExternalSource, type ExternalSourceParams, ExternalSourceTrigger, type ExternalSourceTriggerOptions, type GetWebhookConfig, type GetWebhookParams, type HandlerEvent, type HttpSourceEvent, IO, IOLogger, type IOOptions, type IOStats, type IOTask, type IOWithIntegrations, type IntegrationTaskKey, IntervalTrigger, InvokeTrigger, JSONOutputSerializer, Job, type JobIO, type JobOptions, type JobPayload, type Json, MissingConnectionNotification, MissingConnectionResolvedNotification, type NotificationEvents, type NotificationsEventEmitter, type OutputSerializer, type PreprocessResults, type RunTaskErrorCallback, type SchemaParser, type SchemaParserIssue, type SchemaParserResult, type SentEvent, type Task, type TaskLogger, type Trigger, type TriggerAuthResolver, TriggerClient, type TriggerClientOptions, type TriggerContext, type TriggerEventType, type TriggerIntegration, type TriggerInvokeType, type TriggerOptionRecord, type TriggerPayload, type TriggerPreprocessContext, type TypedEventSpecificationExample, type VerifyResult, type WaitForEventResult, type WebhookConfig, type WebhookDeliveryContext, type WebhookHandlerEvent, WebhookSource, WebhookTrigger, type WebhookTriggerOptions, cronTrigger, eventTrigger, intervalTrigger, invokeTrigger, isTriggerError, missingConnectionNotification, missingConnectionResolvedNotification, omit, redactString, retry, slugifyId, verifyHmacSha256, verifyRequestSignature, waitForEventSchema };