@trigger.dev/sdk 0.0.0-background-tasks-20230906212613 → 0.0.0-byo-auth-20230921153903
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 +157 -174
- package/dist/index.js +392 -254
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _trigger_dev_core from '@trigger.dev/core';
|
|
2
|
-
import { RunTaskBodyInput, CompleteTaskBodyInput, FailTaskBodyInput, SendEvent, SendEventOptions, UpdateTriggerSourceBodyV2, TriggerSource, RegisterTriggerBodyV2, RegisterSourceEventV2, ScheduleMetadata, GetRunOptionsWithTaskDetails, GetRunsOptions, LogLevel, RuntimeEnvironmentType, DisplayProperty, TriggerMetadata, EventFilter, Prettify, HandleTriggerSource, Logger, RegisterTriggerSource, SerializableJson, ConnectionAuth, NormalizedResponse, HttpSourceResponseMetadata,
|
|
2
|
+
import { RunTaskBodyInput, CompleteTaskBodyInput, FailTaskBodyInput, SendEvent, SendEventOptions, UpdateTriggerSourceBodyV2, TriggerSource, RegisterTriggerBodyV2, RegisterSourceEventV2, ScheduleMetadata, GetRunOptionsWithTaskDetails, GetRunsOptions, LogLevel, RuntimeEnvironmentType, DisplayProperty, TriggerMetadata, EventFilter, Prettify, HandleTriggerSource, Logger, RegisterTriggerSource, SerializableJson, ConnectionAuth, NormalizedResponse, HttpSourceResponseMetadata, IntervalOptions, CronOptions, ScheduledPayload, DeserializedJson, ServerTask, CachedTask, FetchRequestInit, FetchRetryOptions, RunTaskOptions, IntegrationMetadata, QueueOptions, 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 } from 'zod';
|
|
@@ -154,12 +154,14 @@ declare class ApiClient {
|
|
|
154
154
|
cron: string;
|
|
155
155
|
};
|
|
156
156
|
type: "cron";
|
|
157
|
+
accountId?: string | undefined;
|
|
157
158
|
metadata?: any;
|
|
158
159
|
} | {
|
|
159
160
|
options: {
|
|
160
161
|
seconds: number;
|
|
161
162
|
};
|
|
162
163
|
type: "interval";
|
|
164
|
+
accountId?: string | undefined;
|
|
163
165
|
metadata?: any;
|
|
164
166
|
};
|
|
165
167
|
active: boolean;
|
|
@@ -169,7 +171,7 @@ declare class ApiClient {
|
|
|
169
171
|
ok: boolean;
|
|
170
172
|
}>;
|
|
171
173
|
getAuth(client: string, id: string): Promise<{
|
|
172
|
-
type: "oauth2";
|
|
174
|
+
type: "oauth2" | "apiKey";
|
|
173
175
|
accessToken: string;
|
|
174
176
|
scopes?: string[] | undefined;
|
|
175
177
|
additionalFields?: Record<string, string> | undefined;
|
|
@@ -181,7 +183,7 @@ declare class ApiClient {
|
|
|
181
183
|
updatedAt: Date;
|
|
182
184
|
runs: {
|
|
183
185
|
id: string;
|
|
184
|
-
status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED";
|
|
186
|
+
status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH";
|
|
185
187
|
startedAt?: Date | null | undefined;
|
|
186
188
|
completedAt?: Date | null | undefined;
|
|
187
189
|
}[];
|
|
@@ -190,7 +192,7 @@ declare class ApiClient {
|
|
|
190
192
|
id: string;
|
|
191
193
|
startedAt: Date | null;
|
|
192
194
|
completedAt: Date | null;
|
|
193
|
-
status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED";
|
|
195
|
+
status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH";
|
|
194
196
|
tasks: _trigger_dev_core.RunTaskWithSubtasks[];
|
|
195
197
|
updatedAt: Date | null;
|
|
196
198
|
output?: any;
|
|
@@ -201,7 +203,7 @@ declare class ApiClient {
|
|
|
201
203
|
id: string;
|
|
202
204
|
startedAt: Date | null;
|
|
203
205
|
completedAt: Date | null;
|
|
204
|
-
status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED";
|
|
206
|
+
status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH";
|
|
205
207
|
updatedAt: Date | null;
|
|
206
208
|
}[];
|
|
207
209
|
nextCursor?: string | undefined;
|
|
@@ -498,10 +500,8 @@ declare class DynamicTrigger<TEventSpec extends EventSpecification<any>, TExtern
|
|
|
498
500
|
* @param options The options for the dynamic trigger.
|
|
499
501
|
* */
|
|
500
502
|
constructor(client: TriggerClient, options: DynamicTriggerOptions<TEventSpec, TExternalSource>);
|
|
501
|
-
toJSON(): TriggerMetadata;
|
|
502
503
|
get id(): string;
|
|
503
504
|
get event(): TEventSpec;
|
|
504
|
-
registeredTriggerForParams(params: ExternalSourceParams<TExternalSource>): RegisterTriggerBodyV2;
|
|
505
505
|
/** Use this method to register a new configuration with the DynamicTrigger.
|
|
506
506
|
* @param key The key for the configuration. This will be used to identify the configuration when it is triggered.
|
|
507
507
|
* @param params The params for the configuration.
|
|
@@ -511,34 +511,136 @@ declare class DynamicTrigger<TEventSpec extends EventSpecification<any>, TExtern
|
|
|
511
511
|
get preprocessRuns(): boolean;
|
|
512
512
|
}
|
|
513
513
|
|
|
514
|
-
type
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
514
|
+
type ScheduledEventSpecification = EventSpecification<ScheduledPayload>;
|
|
515
|
+
declare class IntervalTrigger implements Trigger<ScheduledEventSpecification> {
|
|
516
|
+
private options;
|
|
517
|
+
constructor(options: IntervalOptions);
|
|
518
|
+
get event(): {
|
|
519
|
+
name: string;
|
|
520
|
+
title: string;
|
|
521
|
+
source: string;
|
|
522
|
+
icon: string;
|
|
523
|
+
examples: {
|
|
524
|
+
id: string;
|
|
525
|
+
name: string;
|
|
526
|
+
icon: string;
|
|
527
|
+
payload: {
|
|
528
|
+
ts: string;
|
|
529
|
+
lastTimestamp: string;
|
|
530
|
+
};
|
|
531
|
+
}[];
|
|
532
|
+
parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
|
|
533
|
+
ts: Date;
|
|
534
|
+
lastTimestamp?: Date | undefined;
|
|
535
|
+
};
|
|
536
|
+
properties: {
|
|
537
|
+
label: string;
|
|
538
|
+
text: string;
|
|
539
|
+
}[];
|
|
525
540
|
};
|
|
526
|
-
|
|
527
|
-
|
|
541
|
+
attachToJob(triggerClient: TriggerClient, job: Job<Trigger<ScheduledEventSpecification>, any>): void;
|
|
542
|
+
get preprocessRuns(): boolean;
|
|
543
|
+
toJSON(): TriggerMetadata;
|
|
544
|
+
}
|
|
545
|
+
/** `intervalTrigger()` is set as a [Job's trigger](/sdk/job) to trigger a Job at a recurring interval.
|
|
546
|
+
* @param options An object containing options about the interval.
|
|
547
|
+
*/
|
|
548
|
+
declare function intervalTrigger(options: IntervalOptions): IntervalTrigger;
|
|
549
|
+
declare class CronTrigger implements Trigger<ScheduledEventSpecification> {
|
|
550
|
+
private options;
|
|
551
|
+
constructor(options: CronOptions);
|
|
552
|
+
get event(): {
|
|
553
|
+
name: string;
|
|
554
|
+
title: string;
|
|
555
|
+
source: string;
|
|
556
|
+
icon: string;
|
|
557
|
+
examples: {
|
|
558
|
+
id: string;
|
|
559
|
+
name: string;
|
|
560
|
+
icon: string;
|
|
561
|
+
payload: {
|
|
562
|
+
ts: string;
|
|
563
|
+
lastTimestamp: string;
|
|
564
|
+
};
|
|
565
|
+
}[];
|
|
566
|
+
parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
|
|
567
|
+
ts: Date;
|
|
568
|
+
lastTimestamp?: Date | undefined;
|
|
569
|
+
};
|
|
570
|
+
properties: {
|
|
571
|
+
label: string;
|
|
572
|
+
text: string;
|
|
573
|
+
}[];
|
|
574
|
+
};
|
|
575
|
+
attachToJob(triggerClient: TriggerClient, job: Job<Trigger<ScheduledEventSpecification>, any>): void;
|
|
576
|
+
get preprocessRuns(): boolean;
|
|
577
|
+
toJSON(): TriggerMetadata;
|
|
578
|
+
}
|
|
579
|
+
/** `cronTrigger()` is set as a [Job's trigger](https://trigger.dev/docs/sdk/job) to trigger a Job on a recurring schedule using a CRON expression.
|
|
580
|
+
* @param options An object containing options about the CRON schedule.
|
|
581
|
+
*/
|
|
582
|
+
declare function cronTrigger(options: CronOptions): CronTrigger;
|
|
583
|
+
/** DynamicSchedule options
|
|
584
|
+
* @param id Used to uniquely identify a DynamicSchedule
|
|
585
|
+
*/
|
|
586
|
+
type DynamicIntervalOptions = {
|
|
587
|
+
id: string;
|
|
528
588
|
};
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
589
|
+
/** DynamicSchedule` allows you to define a scheduled trigger that can be configured dynamically at runtime. */
|
|
590
|
+
declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
|
|
591
|
+
private client;
|
|
592
|
+
private options;
|
|
593
|
+
/**
|
|
594
|
+
* @param client The `TriggerClient` instance to use for registering the trigger.
|
|
595
|
+
* @param options The options for the schedule.
|
|
596
|
+
*/
|
|
597
|
+
constructor(client: TriggerClient, options: DynamicIntervalOptions);
|
|
534
598
|
get id(): string;
|
|
535
|
-
get
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
599
|
+
get event(): {
|
|
600
|
+
name: string;
|
|
601
|
+
title: string;
|
|
602
|
+
source: string;
|
|
603
|
+
icon: string;
|
|
604
|
+
examples: {
|
|
605
|
+
id: string;
|
|
606
|
+
name: string;
|
|
607
|
+
icon: string;
|
|
608
|
+
payload: {
|
|
609
|
+
ts: string;
|
|
610
|
+
lastTimestamp: string;
|
|
611
|
+
};
|
|
612
|
+
}[];
|
|
613
|
+
parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
|
|
614
|
+
ts: Date;
|
|
615
|
+
lastTimestamp?: Date | undefined;
|
|
616
|
+
};
|
|
617
|
+
};
|
|
618
|
+
register(key: string, metadata: ScheduleMetadata): Promise<{
|
|
619
|
+
id: string;
|
|
620
|
+
schedule: {
|
|
621
|
+
options: {
|
|
622
|
+
cron: string;
|
|
623
|
+
};
|
|
624
|
+
type: "cron";
|
|
625
|
+
accountId?: string | undefined;
|
|
626
|
+
metadata?: any;
|
|
627
|
+
} | {
|
|
628
|
+
options: {
|
|
629
|
+
seconds: number;
|
|
630
|
+
};
|
|
631
|
+
type: "interval";
|
|
632
|
+
accountId?: string | undefined;
|
|
633
|
+
metadata?: any;
|
|
634
|
+
};
|
|
635
|
+
active: boolean;
|
|
636
|
+
metadata?: any;
|
|
637
|
+
}>;
|
|
638
|
+
unregister(key: string): Promise<{
|
|
639
|
+
ok: boolean;
|
|
640
|
+
}>;
|
|
641
|
+
attachToJob(triggerClient: TriggerClient, job: Job<Trigger<ScheduledEventSpecification>, any>): void;
|
|
642
|
+
get preprocessRuns(): boolean;
|
|
643
|
+
toJSON(): TriggerMetadata;
|
|
542
644
|
}
|
|
543
645
|
|
|
544
646
|
type TriggerClientOptions = {
|
|
@@ -560,14 +662,22 @@ type TriggerClientOptions = {
|
|
|
560
662
|
/** Default is unset and off. If set to true it will log to the server's console as well as the Trigger.dev platform */
|
|
561
663
|
ioLogLocalEnabled?: boolean;
|
|
562
664
|
};
|
|
665
|
+
type AuthResolverResult = {
|
|
666
|
+
type: "apiKey" | "oauth";
|
|
667
|
+
token: string;
|
|
668
|
+
additionalFields?: Record<string, string>;
|
|
669
|
+
};
|
|
670
|
+
type TriggerAuthResolver = (ctx: TriggerContext, integration: TriggerIntegration) => Promise<AuthResolverResult | undefined>;
|
|
563
671
|
/** A [TriggerClient](https://trigger.dev/docs/documentation/concepts/client-adaptors) is used to connect to a specific [Project](https://trigger.dev/docs/documentation/concepts/projects) by using an [API Key](https://trigger.dev/docs/documentation/concepts/environments-apikeys). */
|
|
564
672
|
declare class TriggerClient {
|
|
565
673
|
#private;
|
|
566
674
|
id: string;
|
|
567
675
|
constructor(options: Prettify<TriggerClientOptions>);
|
|
568
676
|
handleRequest(request: Request): Promise<NormalizedResponse>;
|
|
677
|
+
defineJob<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration> = {}>(options: JobOptions<TTrigger, TIntegrations>): Job<TTrigger, TIntegrations>;
|
|
678
|
+
defineAuthResolver(integration: TriggerIntegration, resolver: TriggerAuthResolver): TriggerClient;
|
|
679
|
+
defineDynamicSchedule(options: DynamicIntervalOptions): DynamicSchedule;
|
|
569
680
|
attach(job: Job<Trigger<any>, any>): void;
|
|
570
|
-
attachBackgroundTask(task: BackgroundTask<any>): void;
|
|
571
681
|
attachDynamicTrigger(trigger: DynamicTrigger<any, any>): void;
|
|
572
682
|
attachJobToDynamicTrigger(job: Job<Trigger<any>, any>, trigger: DynamicTrigger<any, any>): void;
|
|
573
683
|
attachSource(options: {
|
|
@@ -577,7 +687,8 @@ declare class TriggerClient {
|
|
|
577
687
|
params: any;
|
|
578
688
|
options?: Record<string, string[]>;
|
|
579
689
|
}): void;
|
|
580
|
-
attachDynamicSchedule(key: string
|
|
690
|
+
attachDynamicSchedule(key: string): void;
|
|
691
|
+
attachDynamicScheduleToJob(key: string, job: Job<Trigger<any>, any>): void;
|
|
581
692
|
registerTrigger(id: string, key: string, options: RegisterTriggerBodyV2): Promise<{
|
|
582
693
|
id: string;
|
|
583
694
|
options: {
|
|
@@ -610,7 +721,7 @@ declare class TriggerClient {
|
|
|
610
721
|
dynamicTriggerId?: string | undefined;
|
|
611
722
|
}>;
|
|
612
723
|
getAuth(id: string): Promise<{
|
|
613
|
-
type: "oauth2";
|
|
724
|
+
type: "oauth2" | "apiKey";
|
|
614
725
|
accessToken: string;
|
|
615
726
|
scopes?: string[] | undefined;
|
|
616
727
|
additionalFields?: Record<string, string> | undefined;
|
|
@@ -655,12 +766,14 @@ declare class TriggerClient {
|
|
|
655
766
|
cron: string;
|
|
656
767
|
};
|
|
657
768
|
type: "cron";
|
|
769
|
+
accountId?: string | undefined;
|
|
658
770
|
metadata?: any;
|
|
659
771
|
} | {
|
|
660
772
|
options: {
|
|
661
773
|
seconds: number;
|
|
662
774
|
};
|
|
663
775
|
type: "interval";
|
|
776
|
+
accountId?: string | undefined;
|
|
664
777
|
metadata?: any;
|
|
665
778
|
};
|
|
666
779
|
active: boolean;
|
|
@@ -676,7 +789,7 @@ declare class TriggerClient {
|
|
|
676
789
|
updatedAt: Date;
|
|
677
790
|
runs: {
|
|
678
791
|
id: string;
|
|
679
|
-
status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED";
|
|
792
|
+
status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH";
|
|
680
793
|
startedAt?: Date | null | undefined;
|
|
681
794
|
completedAt?: Date | null | undefined;
|
|
682
795
|
}[];
|
|
@@ -685,7 +798,7 @@ declare class TriggerClient {
|
|
|
685
798
|
id: string;
|
|
686
799
|
startedAt: Date | null;
|
|
687
800
|
completedAt: Date | null;
|
|
688
|
-
status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED";
|
|
801
|
+
status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH";
|
|
689
802
|
tasks: _trigger_dev_core.RunTaskWithSubtasks[];
|
|
690
803
|
updatedAt: Date | null;
|
|
691
804
|
output?: any;
|
|
@@ -696,145 +809,13 @@ declare class TriggerClient {
|
|
|
696
809
|
id: string;
|
|
697
810
|
startedAt: Date | null;
|
|
698
811
|
completedAt: Date | null;
|
|
699
|
-
status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED";
|
|
812
|
+
status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH";
|
|
700
813
|
updatedAt: Date | null;
|
|
701
814
|
}[];
|
|
702
815
|
nextCursor?: string | undefined;
|
|
703
816
|
}>;
|
|
704
817
|
authorized(apiKey?: string | null): "authorized" | "unauthorized" | "missing-client" | "missing-header";
|
|
705
818
|
apiKey(): string | undefined;
|
|
706
|
-
defineJob<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration> = {}>(options: JobOptions<TTrigger, TIntegrations>): Job<TTrigger, TIntegrations>;
|
|
707
|
-
defineBackgroundTask<TPayload = any>(options: BackgroundTaskOptions<TPayload>): BackgroundTask<TPayload>;
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
type ScheduledEventSpecification = EventSpecification<ScheduledPayload>;
|
|
711
|
-
declare class IntervalTrigger implements Trigger<ScheduledEventSpecification> {
|
|
712
|
-
private options;
|
|
713
|
-
constructor(options: IntervalOptions);
|
|
714
|
-
get event(): {
|
|
715
|
-
name: string;
|
|
716
|
-
title: string;
|
|
717
|
-
source: string;
|
|
718
|
-
icon: string;
|
|
719
|
-
examples: {
|
|
720
|
-
id: string;
|
|
721
|
-
name: string;
|
|
722
|
-
icon: string;
|
|
723
|
-
payload: {
|
|
724
|
-
ts: string;
|
|
725
|
-
lastTimestamp: string;
|
|
726
|
-
};
|
|
727
|
-
}[];
|
|
728
|
-
parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
|
|
729
|
-
ts: Date;
|
|
730
|
-
lastTimestamp?: Date | undefined;
|
|
731
|
-
};
|
|
732
|
-
properties: {
|
|
733
|
-
label: string;
|
|
734
|
-
text: string;
|
|
735
|
-
}[];
|
|
736
|
-
};
|
|
737
|
-
attachToJob(triggerClient: TriggerClient, job: Job<Trigger<ScheduledEventSpecification>, any>): void;
|
|
738
|
-
get preprocessRuns(): boolean;
|
|
739
|
-
toJSON(): TriggerMetadata;
|
|
740
|
-
}
|
|
741
|
-
/** `intervalTrigger()` is set as a [Job's trigger](/sdk/job) to trigger a Job at a recurring interval.
|
|
742
|
-
* @param options An object containing options about the interval.
|
|
743
|
-
*/
|
|
744
|
-
declare function intervalTrigger(options: IntervalOptions): IntervalTrigger;
|
|
745
|
-
declare class CronTrigger implements Trigger<ScheduledEventSpecification> {
|
|
746
|
-
private options;
|
|
747
|
-
constructor(options: CronOptions);
|
|
748
|
-
get event(): {
|
|
749
|
-
name: string;
|
|
750
|
-
title: string;
|
|
751
|
-
source: string;
|
|
752
|
-
icon: string;
|
|
753
|
-
examples: {
|
|
754
|
-
id: string;
|
|
755
|
-
name: string;
|
|
756
|
-
icon: string;
|
|
757
|
-
payload: {
|
|
758
|
-
ts: string;
|
|
759
|
-
lastTimestamp: string;
|
|
760
|
-
};
|
|
761
|
-
}[];
|
|
762
|
-
parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
|
|
763
|
-
ts: Date;
|
|
764
|
-
lastTimestamp?: Date | undefined;
|
|
765
|
-
};
|
|
766
|
-
properties: {
|
|
767
|
-
label: string;
|
|
768
|
-
text: string;
|
|
769
|
-
}[];
|
|
770
|
-
};
|
|
771
|
-
attachToJob(triggerClient: TriggerClient, job: Job<Trigger<ScheduledEventSpecification>, any>): void;
|
|
772
|
-
get preprocessRuns(): boolean;
|
|
773
|
-
toJSON(): TriggerMetadata;
|
|
774
|
-
}
|
|
775
|
-
/** `cronTrigger()` is set as a [Job's trigger](https://trigger.dev/docs/sdk/job) to trigger a Job on a recurring schedule using a CRON expression.
|
|
776
|
-
* @param options An object containing options about the CRON schedule.
|
|
777
|
-
*/
|
|
778
|
-
declare function cronTrigger(options: CronOptions): CronTrigger;
|
|
779
|
-
/** DynamicSchedule options
|
|
780
|
-
* @param id Used to uniquely identify a DynamicSchedule
|
|
781
|
-
*/
|
|
782
|
-
type DynamicIntervalOptions = {
|
|
783
|
-
id: string;
|
|
784
|
-
};
|
|
785
|
-
/** DynamicSchedule` allows you to define a scheduled trigger that can be configured dynamically at runtime. */
|
|
786
|
-
declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
|
|
787
|
-
private client;
|
|
788
|
-
private options;
|
|
789
|
-
/**
|
|
790
|
-
* @param client The `TriggerClient` instance to use for registering the trigger.
|
|
791
|
-
* @param options The options for the schedule.
|
|
792
|
-
*/
|
|
793
|
-
constructor(client: TriggerClient, options: DynamicIntervalOptions);
|
|
794
|
-
get id(): string;
|
|
795
|
-
get event(): {
|
|
796
|
-
name: string;
|
|
797
|
-
title: string;
|
|
798
|
-
source: string;
|
|
799
|
-
icon: string;
|
|
800
|
-
examples: {
|
|
801
|
-
id: string;
|
|
802
|
-
name: string;
|
|
803
|
-
icon: string;
|
|
804
|
-
payload: {
|
|
805
|
-
ts: string;
|
|
806
|
-
lastTimestamp: string;
|
|
807
|
-
};
|
|
808
|
-
}[];
|
|
809
|
-
parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
|
|
810
|
-
ts: Date;
|
|
811
|
-
lastTimestamp?: Date | undefined;
|
|
812
|
-
};
|
|
813
|
-
};
|
|
814
|
-
register(key: string, metadata: ScheduleMetadata): Promise<{
|
|
815
|
-
id: string;
|
|
816
|
-
schedule: {
|
|
817
|
-
options: {
|
|
818
|
-
cron: string;
|
|
819
|
-
};
|
|
820
|
-
type: "cron";
|
|
821
|
-
metadata?: any;
|
|
822
|
-
} | {
|
|
823
|
-
options: {
|
|
824
|
-
seconds: number;
|
|
825
|
-
};
|
|
826
|
-
type: "interval";
|
|
827
|
-
metadata?: any;
|
|
828
|
-
};
|
|
829
|
-
active: boolean;
|
|
830
|
-
metadata?: any;
|
|
831
|
-
}>;
|
|
832
|
-
unregister(key: string): Promise<{
|
|
833
|
-
ok: boolean;
|
|
834
|
-
}>;
|
|
835
|
-
attachToJob(triggerClient: TriggerClient, job: Job<Trigger<ScheduledEventSpecification>, any>): void;
|
|
836
|
-
get preprocessRuns(): boolean;
|
|
837
|
-
toJSON(): TriggerMetadata;
|
|
838
819
|
}
|
|
839
820
|
|
|
840
821
|
type IOTask = ServerTask;
|
|
@@ -917,7 +898,7 @@ declare class IO {
|
|
|
917
898
|
updatedAt: Date;
|
|
918
899
|
runs: {
|
|
919
900
|
id: string;
|
|
920
|
-
status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED";
|
|
901
|
+
status: "PENDING" | "CANCELED" | "SUCCESS" | "QUEUED" | "WAITING_ON_CONNECTIONS" | "PREPROCESSING" | "STARTED" | "FAILURE" | "TIMED_OUT" | "ABORTED" | "UNRESOLVED_AUTH";
|
|
921
902
|
startedAt?: Date | null | undefined;
|
|
922
903
|
completedAt?: Date | null | undefined;
|
|
923
904
|
}[];
|
|
@@ -961,12 +942,14 @@ declare class IO {
|
|
|
961
942
|
cron: string;
|
|
962
943
|
};
|
|
963
944
|
type: "cron";
|
|
945
|
+
accountId?: string | undefined;
|
|
964
946
|
metadata?: any;
|
|
965
947
|
} | {
|
|
966
948
|
options: {
|
|
967
949
|
seconds: number;
|
|
968
950
|
};
|
|
969
951
|
type: "interval";
|
|
952
|
+
accountId?: string | undefined;
|
|
970
953
|
metadata?: any;
|
|
971
954
|
};
|
|
972
955
|
active: boolean;
|
|
@@ -993,12 +976,14 @@ declare class IO {
|
|
|
993
976
|
cron: string;
|
|
994
977
|
};
|
|
995
978
|
type: "cron";
|
|
979
|
+
accountId?: string | undefined;
|
|
996
980
|
metadata?: any;
|
|
997
981
|
} | {
|
|
998
982
|
options: {
|
|
999
983
|
seconds: number;
|
|
1000
984
|
};
|
|
1001
985
|
type: "interval";
|
|
986
|
+
accountId?: string | undefined;
|
|
1002
987
|
metadata?: any;
|
|
1003
988
|
};
|
|
1004
989
|
active: boolean;
|
|
@@ -1129,9 +1114,7 @@ declare class Job<TTrigger extends Trigger<EventSpecification<any>>, TIntegratio
|
|
|
1129
1114
|
get name(): string;
|
|
1130
1115
|
get trigger(): TTrigger;
|
|
1131
1116
|
get version(): string;
|
|
1132
|
-
get integrations(): Record<string, IntegrationConfig>;
|
|
1133
1117
|
get logLevel(): LogLevel | undefined;
|
|
1134
|
-
toJSON(): JobMetadata;
|
|
1135
1118
|
}
|
|
1136
1119
|
|
|
1137
1120
|
type EventTriggerOptions<TEventSpecification extends EventSpecification<any>> = {
|
|
@@ -1322,4 +1305,4 @@ type Task = ServerTask;
|
|
|
1322
1305
|
type SentEvent = ApiEventLog;
|
|
1323
1306
|
declare function redactString(strings: TemplateStringsArray, ...interpolations: string[]): RedactString;
|
|
1324
1307
|
|
|
1325
|
-
export { CronTrigger, DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, DynamicTriggerOptions, EventSpecification, EventSpecificationExample, EventTrigger, EventTypeFromSpecification, ExternalSource, ExternalSourceParams, ExternalSourceTrigger, ExternalSourceTriggerOptions, HandlerEvent, HttpSourceEvent, IO, IOLogger, IOOptions, IOTask, IOWithIntegrations, IntegrationTaskKey, IntervalTrigger, Job, JobIO, JobOptions, JobPayload, Json, MissingConnectionNotification, MissingConnectionResolvedNotification, PreprocessResults, RunTaskErrorCallback, SentEvent, Task, TaskLogger, Trigger, TriggerClient, TriggerClientOptions, TriggerContext, TriggerEventType, TriggerIntegration, TriggerOptionRecord, TriggerPayload, TriggerPreprocessContext, cronTrigger, eventTrigger, intervalTrigger, isTriggerError, missingConnectionNotification, missingConnectionResolvedNotification, omit, redactString, retry };
|
|
1308
|
+
export { AuthResolverResult, CronTrigger, DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, DynamicTriggerOptions, EventSpecification, EventSpecificationExample, EventTrigger, EventTypeFromSpecification, ExternalSource, ExternalSourceParams, ExternalSourceTrigger, ExternalSourceTriggerOptions, HandlerEvent, HttpSourceEvent, IO, IOLogger, IOOptions, IOTask, IOWithIntegrations, IntegrationTaskKey, IntervalTrigger, Job, JobIO, JobOptions, JobPayload, Json, MissingConnectionNotification, MissingConnectionResolvedNotification, PreprocessResults, RunTaskErrorCallback, SentEvent, Task, TaskLogger, Trigger, TriggerAuthResolver, TriggerClient, TriggerClientOptions, TriggerContext, TriggerEventType, TriggerIntegration, TriggerOptionRecord, TriggerPayload, TriggerPreprocessContext, cronTrigger, eventTrigger, intervalTrigger, isTriggerError, missingConnectionNotification, missingConnectionResolvedNotification, omit, redactString, retry };
|