@trigger.dev/sdk 2.0.0-next.1 → 2.0.0-next.11
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/LICENSE +201 -25
- package/dist/index.d.ts +817 -292
- package/dist/index.js +366 -164
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Represents different log levels.
|
|
6
|
+
* - `"log"`: Only essential messages.
|
|
7
|
+
* - `"error"`: Errors and essential messages.
|
|
8
|
+
* - `"warn"`: Warnings, Errors and essential messages.
|
|
9
|
+
* - `"info"`: Info, Warnings, Errors and essential messages.
|
|
10
|
+
* - `"debug"`: Everything.
|
|
11
|
+
*/
|
|
4
12
|
type LogLevel = "log" | "error" | "warn" | "info" | "debug";
|
|
5
13
|
declare class Logger {
|
|
6
14
|
#private;
|
|
7
|
-
constructor(name: string, level?: LogLevel, filteredKeys?: string[]);
|
|
15
|
+
constructor(name: string, level?: LogLevel, filteredKeys?: string[], jsonReplacer?: (key: string, value: unknown) => unknown);
|
|
8
16
|
filter(...keys: string[]): Logger;
|
|
17
|
+
static satisfiesLogLevel(logLevel: LogLevel, setLevel: LogLevel): boolean;
|
|
9
18
|
log(...args: any[]): void;
|
|
10
19
|
error(...args: any[]): void;
|
|
11
20
|
warn(...args: any[]): void;
|
|
@@ -15,6 +24,7 @@ declare class Logger {
|
|
|
15
24
|
|
|
16
25
|
declare const EventMatcherSchema: z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodNumber, "many">, z.ZodArray<z.ZodBoolean, "many">]>;
|
|
17
26
|
type EventMatcher = z.infer<typeof EventMatcherSchema>;
|
|
27
|
+
/** A filter for matching against data */
|
|
18
28
|
type EventFilter = {
|
|
19
29
|
[key: string]: EventMatcher | EventFilter;
|
|
20
30
|
};
|
|
@@ -67,6 +77,7 @@ declare const ServerTaskSchema: z.ZodObject<z.extendShape<{
|
|
|
67
77
|
variant?: string | undefined;
|
|
68
78
|
style: "normal" | "minimal";
|
|
69
79
|
}>>>;
|
|
80
|
+
operation: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
70
81
|
}, {
|
|
71
82
|
idempotencyKey: z.ZodString;
|
|
72
83
|
attempts: z.ZodNumber;
|
|
@@ -89,6 +100,7 @@ declare const ServerTaskSchema: z.ZodObject<z.extendShape<{
|
|
|
89
100
|
variant?: string | undefined;
|
|
90
101
|
style: "normal" | "minimal";
|
|
91
102
|
} | null | undefined;
|
|
103
|
+
operation?: string | null | undefined;
|
|
92
104
|
id: string;
|
|
93
105
|
name: string;
|
|
94
106
|
noop: boolean;
|
|
@@ -114,6 +126,7 @@ declare const ServerTaskSchema: z.ZodObject<z.extendShape<{
|
|
|
114
126
|
variant?: string | undefined;
|
|
115
127
|
style: "normal" | "minimal";
|
|
116
128
|
} | null | undefined;
|
|
129
|
+
operation?: string | null | undefined;
|
|
117
130
|
id: string;
|
|
118
131
|
name: string;
|
|
119
132
|
noop: boolean;
|
|
@@ -160,6 +173,7 @@ declare const UpdateTriggerSourceBodySchema: z.ZodObject<{
|
|
|
160
173
|
}>;
|
|
161
174
|
type UpdateTriggerSourceBody = z.infer<typeof UpdateTriggerSourceBodySchema>;
|
|
162
175
|
declare const RegisterSourceEventSchema: z.ZodObject<{
|
|
176
|
+
/** The id of the source */
|
|
163
177
|
id: z.ZodString;
|
|
164
178
|
source: z.ZodObject<{
|
|
165
179
|
key: z.ZodString;
|
|
@@ -537,32 +551,35 @@ declare const JobMetadataSchema: z.ZodObject<{
|
|
|
537
551
|
integrations: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
538
552
|
id: z.ZodString;
|
|
539
553
|
metadata: z.ZodObject<{
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
554
|
+
id: z.ZodString;
|
|
555
|
+
name: z.ZodString;
|
|
556
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
543
557
|
}, "strip", z.ZodTypeAny, {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
558
|
+
instructions?: string | undefined;
|
|
559
|
+
id: string;
|
|
560
|
+
name: string;
|
|
547
561
|
}, {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
562
|
+
instructions?: string | undefined;
|
|
563
|
+
id: string;
|
|
564
|
+
name: string;
|
|
551
565
|
}>;
|
|
566
|
+
authSource: z.ZodEnum<["HOSTED", "LOCAL"]>;
|
|
552
567
|
}, "strip", z.ZodTypeAny, {
|
|
553
568
|
id: string;
|
|
554
569
|
metadata: {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
570
|
+
instructions?: string | undefined;
|
|
571
|
+
id: string;
|
|
572
|
+
name: string;
|
|
558
573
|
};
|
|
574
|
+
authSource: "HOSTED" | "LOCAL";
|
|
559
575
|
}, {
|
|
560
576
|
id: string;
|
|
561
577
|
metadata: {
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
578
|
+
instructions?: string | undefined;
|
|
579
|
+
id: string;
|
|
580
|
+
name: string;
|
|
565
581
|
};
|
|
582
|
+
authSource: "HOSTED" | "LOCAL";
|
|
566
583
|
}>>;
|
|
567
584
|
internal: z.ZodDefault<z.ZodBoolean>;
|
|
568
585
|
queue: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
@@ -641,10 +658,11 @@ declare const JobMetadataSchema: z.ZodObject<{
|
|
|
641
658
|
integrations: Record<string, {
|
|
642
659
|
id: string;
|
|
643
660
|
metadata: {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
661
|
+
instructions?: string | undefined;
|
|
662
|
+
id: string;
|
|
663
|
+
name: string;
|
|
647
664
|
};
|
|
665
|
+
authSource: "HOSTED" | "LOCAL";
|
|
648
666
|
}>;
|
|
649
667
|
internal: boolean;
|
|
650
668
|
startPosition: "initial" | "latest";
|
|
@@ -714,10 +732,11 @@ declare const JobMetadataSchema: z.ZodObject<{
|
|
|
714
732
|
integrations: Record<string, {
|
|
715
733
|
id: string;
|
|
716
734
|
metadata: {
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
735
|
+
instructions?: string | undefined;
|
|
736
|
+
id: string;
|
|
737
|
+
name: string;
|
|
720
738
|
};
|
|
739
|
+
authSource: "HOSTED" | "LOCAL";
|
|
721
740
|
}>;
|
|
722
741
|
startPosition: "initial" | "latest";
|
|
723
742
|
enabled: boolean;
|
|
@@ -725,17 +744,34 @@ declare const JobMetadataSchema: z.ZodObject<{
|
|
|
725
744
|
}>;
|
|
726
745
|
type JobMetadata = z.infer<typeof JobMetadataSchema>;
|
|
727
746
|
declare const RawEventSchema: z.ZodObject<{
|
|
728
|
-
|
|
747
|
+
/** The `name` property must exactly match any subscriptions you want to
|
|
748
|
+
trigger. */
|
|
729
749
|
name: z.ZodString;
|
|
730
|
-
|
|
750
|
+
/** The `payload` property will be sent to any matching Jobs and will appear
|
|
751
|
+
as the `payload` param of the `run()` function. You can leave this
|
|
752
|
+
parameter out if you just want to trigger a Job without any input data. */
|
|
731
753
|
payload: z.ZodAny;
|
|
754
|
+
/** The optional `context` property will be sent to any matching Jobs and will
|
|
755
|
+
be passed through as the `context.event.context` param of the `run()`
|
|
756
|
+
function. This is optional but can be useful if you want to pass through
|
|
757
|
+
some additional context to the Job. */
|
|
732
758
|
context: z.ZodOptional<z.ZodAny>;
|
|
733
|
-
|
|
759
|
+
/** The `id` property uniquely identify this particular event. If unset it
|
|
760
|
+
will be set automatically using `ulid`. */
|
|
761
|
+
id: z.ZodDefault<z.ZodString>;
|
|
762
|
+
/** This is optional, it defaults to the current timestamp. Usually you would
|
|
763
|
+
only set this if you have a timestamp that you wish to pass through, e.g.
|
|
764
|
+
you receive a timestamp from a service and you want the same timestamp to
|
|
765
|
+
be used in your Job. */
|
|
766
|
+
timestamp: z.ZodOptional<z.ZodDate>;
|
|
767
|
+
/** This is optional, it defaults to "trigger.dev". It can be useful to set
|
|
768
|
+
this as you can filter events using this in the `eventTrigger()`. */
|
|
769
|
+
source: z.ZodOptional<z.ZodString>;
|
|
734
770
|
}, "strip", z.ZodTypeAny, {
|
|
735
771
|
source?: string | undefined;
|
|
736
772
|
payload?: any;
|
|
737
773
|
context?: any;
|
|
738
|
-
timestamp?:
|
|
774
|
+
timestamp?: Date | undefined;
|
|
739
775
|
id: string;
|
|
740
776
|
name: string;
|
|
741
777
|
}, {
|
|
@@ -743,20 +779,30 @@ declare const RawEventSchema: z.ZodObject<{
|
|
|
743
779
|
source?: string | undefined;
|
|
744
780
|
payload?: any;
|
|
745
781
|
context?: any;
|
|
746
|
-
timestamp?:
|
|
782
|
+
timestamp?: Date | undefined;
|
|
747
783
|
name: string;
|
|
748
784
|
}>;
|
|
785
|
+
/** The event you wish to send to Trigger a Job */
|
|
749
786
|
type SendEvent = z.input<typeof RawEventSchema>;
|
|
787
|
+
/** Options to control the delivery of the event */
|
|
750
788
|
declare const SendEventOptionsSchema: z.ZodObject<{
|
|
751
|
-
|
|
789
|
+
/** An optional Date when you want the event to trigger Jobs. The event will
|
|
790
|
+
be sent to the platform immediately but won't be acted upon until the
|
|
791
|
+
specified time. */
|
|
792
|
+
deliverAt: z.ZodOptional<z.ZodDate>;
|
|
793
|
+
/** An optional number of seconds you want to wait for the event to trigger
|
|
794
|
+
any relevant Jobs. The event will be sent to the platform immediately but
|
|
795
|
+
won't be delivered until after the elapsed number of seconds. */
|
|
752
796
|
deliverAfter: z.ZodOptional<z.ZodNumber>;
|
|
797
|
+
/** This optional param will be used by Trigger.dev Connect, which
|
|
798
|
+
is coming soon. */
|
|
753
799
|
accountId: z.ZodOptional<z.ZodString>;
|
|
754
800
|
}, "strip", z.ZodTypeAny, {
|
|
755
|
-
deliverAt?:
|
|
801
|
+
deliverAt?: Date | undefined;
|
|
756
802
|
deliverAfter?: number | undefined;
|
|
757
803
|
accountId?: string | undefined;
|
|
758
804
|
}, {
|
|
759
|
-
deliverAt?:
|
|
805
|
+
deliverAt?: Date | undefined;
|
|
760
806
|
deliverAfter?: number | undefined;
|
|
761
807
|
accountId?: string | undefined;
|
|
762
808
|
}>;
|
|
@@ -992,32 +1038,35 @@ declare const CreateRunBodySchema: z.ZodObject<{
|
|
|
992
1038
|
integrations: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
993
1039
|
id: z.ZodString;
|
|
994
1040
|
metadata: z.ZodObject<{
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1041
|
+
id: z.ZodString;
|
|
1042
|
+
name: z.ZodString;
|
|
1043
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
998
1044
|
}, "strip", z.ZodTypeAny, {
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1045
|
+
instructions?: string | undefined;
|
|
1046
|
+
id: string;
|
|
1047
|
+
name: string;
|
|
1002
1048
|
}, {
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1049
|
+
instructions?: string | undefined;
|
|
1050
|
+
id: string;
|
|
1051
|
+
name: string;
|
|
1006
1052
|
}>;
|
|
1053
|
+
authSource: z.ZodEnum<["HOSTED", "LOCAL"]>;
|
|
1007
1054
|
}, "strip", z.ZodTypeAny, {
|
|
1008
1055
|
id: string;
|
|
1009
1056
|
metadata: {
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1057
|
+
instructions?: string | undefined;
|
|
1058
|
+
id: string;
|
|
1059
|
+
name: string;
|
|
1013
1060
|
};
|
|
1061
|
+
authSource: "HOSTED" | "LOCAL";
|
|
1014
1062
|
}, {
|
|
1015
1063
|
id: string;
|
|
1016
1064
|
metadata: {
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1065
|
+
instructions?: string | undefined;
|
|
1066
|
+
id: string;
|
|
1067
|
+
name: string;
|
|
1020
1068
|
};
|
|
1069
|
+
authSource: "HOSTED" | "LOCAL";
|
|
1021
1070
|
}>>;
|
|
1022
1071
|
internal: z.ZodDefault<z.ZodBoolean>;
|
|
1023
1072
|
queue: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
@@ -1096,10 +1145,11 @@ declare const CreateRunBodySchema: z.ZodObject<{
|
|
|
1096
1145
|
integrations: Record<string, {
|
|
1097
1146
|
id: string;
|
|
1098
1147
|
metadata: {
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1148
|
+
instructions?: string | undefined;
|
|
1149
|
+
id: string;
|
|
1150
|
+
name: string;
|
|
1102
1151
|
};
|
|
1152
|
+
authSource: "HOSTED" | "LOCAL";
|
|
1103
1153
|
}>;
|
|
1104
1154
|
internal: boolean;
|
|
1105
1155
|
startPosition: "initial" | "latest";
|
|
@@ -1169,22 +1219,35 @@ declare const CreateRunBodySchema: z.ZodObject<{
|
|
|
1169
1219
|
integrations: Record<string, {
|
|
1170
1220
|
id: string;
|
|
1171
1221
|
metadata: {
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1222
|
+
instructions?: string | undefined;
|
|
1223
|
+
id: string;
|
|
1224
|
+
name: string;
|
|
1175
1225
|
};
|
|
1226
|
+
authSource: "HOSTED" | "LOCAL";
|
|
1176
1227
|
}>;
|
|
1177
1228
|
startPosition: "initial" | "latest";
|
|
1178
1229
|
enabled: boolean;
|
|
1179
1230
|
preprocessRuns: boolean;
|
|
1180
1231
|
}>;
|
|
1181
1232
|
event: z.ZodObject<{
|
|
1233
|
+
/** The `id` of the event that was sent.
|
|
1234
|
+
*/
|
|
1182
1235
|
id: z.ZodString;
|
|
1236
|
+
/** The `name` of the event that was sent. */
|
|
1183
1237
|
name: z.ZodString;
|
|
1238
|
+
/** The `payload` of the event that was sent */
|
|
1184
1239
|
payload: z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>;
|
|
1240
|
+
/** The `context` of the event that was sent. Is `undefined` if no context was
|
|
1241
|
+
set when sending the event. */
|
|
1185
1242
|
context: z.ZodNullable<z.ZodOptional<z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>>>;
|
|
1243
|
+
/** The `timestamp` of the event that was sent */
|
|
1186
1244
|
timestamp: z.ZodDate;
|
|
1245
|
+
/** The timestamp when the event will be delivered to any matching Jobs. Is
|
|
1246
|
+
`undefined` if `deliverAt` or `deliverAfter` wasn't set when sending the
|
|
1247
|
+
event. */
|
|
1187
1248
|
deliverAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
1249
|
+
/** The timestamp when the event was delivered. Is `undefined` if `deliverAt`
|
|
1250
|
+
or `deliverAfter` were set when sending the event. */
|
|
1188
1251
|
deliveredAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
1189
1252
|
}, "strip", z.ZodTypeAny, {
|
|
1190
1253
|
context?: DeserializedJson | undefined;
|
|
@@ -1294,10 +1357,11 @@ declare const CreateRunBodySchema: z.ZodObject<{
|
|
|
1294
1357
|
integrations: Record<string, {
|
|
1295
1358
|
id: string;
|
|
1296
1359
|
metadata: {
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1360
|
+
instructions?: string | undefined;
|
|
1361
|
+
id: string;
|
|
1362
|
+
name: string;
|
|
1300
1363
|
};
|
|
1364
|
+
authSource: "HOSTED" | "LOCAL";
|
|
1301
1365
|
}>;
|
|
1302
1366
|
internal: boolean;
|
|
1303
1367
|
startPosition: "initial" | "latest";
|
|
@@ -1384,10 +1448,11 @@ declare const CreateRunBodySchema: z.ZodObject<{
|
|
|
1384
1448
|
integrations: Record<string, {
|
|
1385
1449
|
id: string;
|
|
1386
1450
|
metadata: {
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1451
|
+
instructions?: string | undefined;
|
|
1452
|
+
id: string;
|
|
1453
|
+
name: string;
|
|
1390
1454
|
};
|
|
1455
|
+
authSource: "HOSTED" | "LOCAL";
|
|
1391
1456
|
}>;
|
|
1392
1457
|
startPosition: "initial" | "latest";
|
|
1393
1458
|
enabled: boolean;
|
|
@@ -1396,28 +1461,60 @@ declare const CreateRunBodySchema: z.ZodObject<{
|
|
|
1396
1461
|
client: string;
|
|
1397
1462
|
}>;
|
|
1398
1463
|
type CreateRunBody = z.infer<typeof CreateRunBodySchema>;
|
|
1399
|
-
declare const
|
|
1400
|
-
|
|
1464
|
+
declare const RedactStringSchema: z.ZodObject<{
|
|
1465
|
+
__redactedString: z.ZodLiteral<true>;
|
|
1401
1466
|
strings: z.ZodArray<z.ZodString, "many">;
|
|
1402
1467
|
interpolations: z.ZodArray<z.ZodString, "many">;
|
|
1403
1468
|
}, "strip", z.ZodTypeAny, {
|
|
1404
|
-
|
|
1469
|
+
__redactedString: true;
|
|
1405
1470
|
strings: string[];
|
|
1406
1471
|
interpolations: string[];
|
|
1407
1472
|
}, {
|
|
1408
|
-
|
|
1473
|
+
__redactedString: true;
|
|
1409
1474
|
strings: string[];
|
|
1410
1475
|
interpolations: string[];
|
|
1411
1476
|
}>;
|
|
1412
|
-
type
|
|
1477
|
+
type RedactString = z.infer<typeof RedactStringSchema>;
|
|
1413
1478
|
type CachedTask = z.infer<typeof CachedTaskSchema>;
|
|
1414
1479
|
declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
1480
|
+
/** The name of the Task is required. This is displayed on the Task in the logs. */
|
|
1415
1481
|
name: z.ZodString;
|
|
1482
|
+
/** The Task will wait and only start at the specified Date */
|
|
1483
|
+
delayUntil: z.ZodOptional<z.ZodDate>;
|
|
1484
|
+
/** Retry options */
|
|
1485
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
1486
|
+
/** The maximum number of times to retry the request. */
|
|
1487
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
1488
|
+
/** The exponential factor to use when calculating the next retry time. */
|
|
1489
|
+
factor: z.ZodOptional<z.ZodNumber>;
|
|
1490
|
+
/** The minimum amount of time to wait before retrying the request. */
|
|
1491
|
+
minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
1492
|
+
/** The maximum amount of time to wait before retrying the request. */
|
|
1493
|
+
maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
1494
|
+
/** Whether to randomize the retry time. */
|
|
1495
|
+
randomize: z.ZodOptional<z.ZodBoolean>;
|
|
1496
|
+
}, "strip", z.ZodTypeAny, {
|
|
1497
|
+
limit?: number | undefined;
|
|
1498
|
+
factor?: number | undefined;
|
|
1499
|
+
minTimeoutInMs?: number | undefined;
|
|
1500
|
+
maxTimeoutInMs?: number | undefined;
|
|
1501
|
+
randomize?: boolean | undefined;
|
|
1502
|
+
}, {
|
|
1503
|
+
limit?: number | undefined;
|
|
1504
|
+
factor?: number | undefined;
|
|
1505
|
+
minTimeoutInMs?: number | undefined;
|
|
1506
|
+
maxTimeoutInMs?: number | undefined;
|
|
1507
|
+
randomize?: boolean | undefined;
|
|
1508
|
+
}>>;
|
|
1509
|
+
/** The icon for the Task, it will appear in the logs.
|
|
1510
|
+
* You can use the name of a company in lowercase, e.g. "github".
|
|
1511
|
+
* Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
|
|
1416
1512
|
icon: z.ZodOptional<z.ZodString>;
|
|
1513
|
+
/** The key for the Task that you want to appear in the logs */
|
|
1417
1514
|
displayKey: z.ZodOptional<z.ZodString>;
|
|
1418
|
-
|
|
1419
|
-
delayUntil: z.ZodOptional<z.ZodDate>;
|
|
1515
|
+
/** A description of the Task */
|
|
1420
1516
|
description: z.ZodOptional<z.ZodString>;
|
|
1517
|
+
/** Properties that are displayed in the logs */
|
|
1421
1518
|
properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1422
1519
|
label: z.ZodString;
|
|
1423
1520
|
text: z.ZodString;
|
|
@@ -1431,7 +1528,32 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1431
1528
|
label: string;
|
|
1432
1529
|
text: string;
|
|
1433
1530
|
}>, "many">>;
|
|
1434
|
-
params
|
|
1531
|
+
/** The input params to the Task, will be displayed in the logs */
|
|
1532
|
+
params: z.ZodAny;
|
|
1533
|
+
/** The style of the log entry. */
|
|
1534
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
1535
|
+
style: z.ZodEnum<["normal", "minimal"]>;
|
|
1536
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
1537
|
+
}, "strip", z.ZodTypeAny, {
|
|
1538
|
+
variant?: string | undefined;
|
|
1539
|
+
style: "normal" | "minimal";
|
|
1540
|
+
}, {
|
|
1541
|
+
variant?: string | undefined;
|
|
1542
|
+
style: "normal" | "minimal";
|
|
1543
|
+
}>>;
|
|
1544
|
+
/** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
|
|
1545
|
+
connectionKey: z.ZodOptional<z.ZodString>;
|
|
1546
|
+
/** An operation you want to perform on the Trigger.dev platform, current only "fetch" is supported. If you wish to `fetch` use [`io.backgroundFetch()`](https://trigger.dev/docs/sdk/io/backgroundfetch) instead. */
|
|
1547
|
+
operation: z.ZodOptional<z.ZodEnum<["fetch"]>>;
|
|
1548
|
+
/** A No Operation means that the code won't be executed. This is used internally to implement features like [io.wait()](https://trigger.dev/docs/sdk/io/wait). */
|
|
1549
|
+
noop: z.ZodDefault<z.ZodBoolean>;
|
|
1550
|
+
redact: z.ZodOptional<z.ZodObject<{
|
|
1551
|
+
paths: z.ZodArray<z.ZodString, "many">;
|
|
1552
|
+
}, "strip", z.ZodTypeAny, {
|
|
1553
|
+
paths: string[];
|
|
1554
|
+
}, {
|
|
1555
|
+
paths: string[];
|
|
1556
|
+
}>>;
|
|
1435
1557
|
trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
1436
1558
|
type: z.ZodLiteral<"dynamic">;
|
|
1437
1559
|
id: z.ZodString;
|
|
@@ -1579,48 +1701,11 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1579
1701
|
type: "interval";
|
|
1580
1702
|
};
|
|
1581
1703
|
}>]>>;
|
|
1582
|
-
redact: z.ZodOptional<z.ZodObject<{
|
|
1583
|
-
paths: z.ZodArray<z.ZodString, "many">;
|
|
1584
|
-
}, "strip", z.ZodTypeAny, {
|
|
1585
|
-
paths: string[];
|
|
1586
|
-
}, {
|
|
1587
|
-
paths: string[];
|
|
1588
|
-
}>>;
|
|
1589
|
-
connectionKey: z.ZodOptional<z.ZodString>;
|
|
1590
|
-
style: z.ZodOptional<z.ZodObject<{
|
|
1591
|
-
style: z.ZodEnum<["normal", "minimal"]>;
|
|
1592
|
-
variant: z.ZodOptional<z.ZodString>;
|
|
1593
|
-
}, "strip", z.ZodTypeAny, {
|
|
1594
|
-
variant?: string | undefined;
|
|
1595
|
-
style: "normal" | "minimal";
|
|
1596
|
-
}, {
|
|
1597
|
-
variant?: string | undefined;
|
|
1598
|
-
style: "normal" | "minimal";
|
|
1599
|
-
}>>;
|
|
1600
|
-
retry: z.ZodOptional<z.ZodObject<{
|
|
1601
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
1602
|
-
factor: z.ZodOptional<z.ZodNumber>;
|
|
1603
|
-
minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
1604
|
-
maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
1605
|
-
randomize: z.ZodOptional<z.ZodBoolean>;
|
|
1606
|
-
}, "strip", z.ZodTypeAny, {
|
|
1607
|
-
limit?: number | undefined;
|
|
1608
|
-
factor?: number | undefined;
|
|
1609
|
-
minTimeoutInMs?: number | undefined;
|
|
1610
|
-
maxTimeoutInMs?: number | undefined;
|
|
1611
|
-
randomize?: boolean | undefined;
|
|
1612
|
-
}, {
|
|
1613
|
-
limit?: number | undefined;
|
|
1614
|
-
factor?: number | undefined;
|
|
1615
|
-
minTimeoutInMs?: number | undefined;
|
|
1616
|
-
maxTimeoutInMs?: number | undefined;
|
|
1617
|
-
randomize?: boolean | undefined;
|
|
1618
|
-
}>>;
|
|
1619
1704
|
}, "strip", z.ZodTypeAny, {
|
|
1620
1705
|
icon?: string | undefined;
|
|
1621
1706
|
delayUntil?: Date | undefined;
|
|
1622
1707
|
description?: string | undefined;
|
|
1623
|
-
params?:
|
|
1708
|
+
params?: any;
|
|
1624
1709
|
properties?: {
|
|
1625
1710
|
url?: string | undefined;
|
|
1626
1711
|
label: string;
|
|
@@ -1630,6 +1715,7 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1630
1715
|
variant?: string | undefined;
|
|
1631
1716
|
style: "normal" | "minimal";
|
|
1632
1717
|
} | undefined;
|
|
1718
|
+
operation?: "fetch" | undefined;
|
|
1633
1719
|
trigger?: {
|
|
1634
1720
|
id: string;
|
|
1635
1721
|
type: "dynamic";
|
|
@@ -1663,11 +1749,6 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1663
1749
|
type: "interval";
|
|
1664
1750
|
};
|
|
1665
1751
|
} | undefined;
|
|
1666
|
-
displayKey?: string | undefined;
|
|
1667
|
-
redact?: {
|
|
1668
|
-
paths: string[];
|
|
1669
|
-
} | undefined;
|
|
1670
|
-
connectionKey?: string | undefined;
|
|
1671
1752
|
retry?: {
|
|
1672
1753
|
limit?: number | undefined;
|
|
1673
1754
|
factor?: number | undefined;
|
|
@@ -1675,6 +1756,11 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1675
1756
|
maxTimeoutInMs?: number | undefined;
|
|
1676
1757
|
randomize?: boolean | undefined;
|
|
1677
1758
|
} | undefined;
|
|
1759
|
+
displayKey?: string | undefined;
|
|
1760
|
+
connectionKey?: string | undefined;
|
|
1761
|
+
redact?: {
|
|
1762
|
+
paths: string[];
|
|
1763
|
+
} | undefined;
|
|
1678
1764
|
name: string;
|
|
1679
1765
|
noop: boolean;
|
|
1680
1766
|
}, {
|
|
@@ -1682,7 +1768,7 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1682
1768
|
noop?: boolean | undefined;
|
|
1683
1769
|
delayUntil?: Date | undefined;
|
|
1684
1770
|
description?: string | undefined;
|
|
1685
|
-
params?:
|
|
1771
|
+
params?: any;
|
|
1686
1772
|
properties?: {
|
|
1687
1773
|
url?: string | undefined;
|
|
1688
1774
|
label: string;
|
|
@@ -1692,6 +1778,7 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1692
1778
|
variant?: string | undefined;
|
|
1693
1779
|
style: "normal" | "minimal";
|
|
1694
1780
|
} | undefined;
|
|
1781
|
+
operation?: "fetch" | undefined;
|
|
1695
1782
|
trigger?: {
|
|
1696
1783
|
id: string;
|
|
1697
1784
|
type: "dynamic";
|
|
@@ -1725,11 +1812,6 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1725
1812
|
type: "interval";
|
|
1726
1813
|
};
|
|
1727
1814
|
} | undefined;
|
|
1728
|
-
displayKey?: string | undefined;
|
|
1729
|
-
redact?: {
|
|
1730
|
-
paths: string[];
|
|
1731
|
-
} | undefined;
|
|
1732
|
-
connectionKey?: string | undefined;
|
|
1733
1815
|
retry?: {
|
|
1734
1816
|
limit?: number | undefined;
|
|
1735
1817
|
factor?: number | undefined;
|
|
@@ -1737,16 +1819,53 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1737
1819
|
maxTimeoutInMs?: number | undefined;
|
|
1738
1820
|
randomize?: boolean | undefined;
|
|
1739
1821
|
} | undefined;
|
|
1822
|
+
displayKey?: string | undefined;
|
|
1823
|
+
connectionKey?: string | undefined;
|
|
1824
|
+
redact?: {
|
|
1825
|
+
paths: string[];
|
|
1826
|
+
} | undefined;
|
|
1740
1827
|
name: string;
|
|
1741
1828
|
}>;
|
|
1742
1829
|
type RunTaskOptions = z.input<typeof RunTaskOptionsSchema>;
|
|
1743
1830
|
declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
1831
|
+
/** The name of the Task is required. This is displayed on the Task in the logs. */
|
|
1744
1832
|
name: z.ZodString;
|
|
1833
|
+
/** The Task will wait and only start at the specified Date */
|
|
1834
|
+
delayUntil: z.ZodOptional<z.ZodDate>;
|
|
1835
|
+
/** Retry options */
|
|
1836
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
1837
|
+
/** The maximum number of times to retry the request. */
|
|
1838
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
1839
|
+
/** The exponential factor to use when calculating the next retry time. */
|
|
1840
|
+
factor: z.ZodOptional<z.ZodNumber>;
|
|
1841
|
+
/** The minimum amount of time to wait before retrying the request. */
|
|
1842
|
+
minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
1843
|
+
/** The maximum amount of time to wait before retrying the request. */
|
|
1844
|
+
maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
1845
|
+
/** Whether to randomize the retry time. */
|
|
1846
|
+
randomize: z.ZodOptional<z.ZodBoolean>;
|
|
1847
|
+
}, "strip", z.ZodTypeAny, {
|
|
1848
|
+
limit?: number | undefined;
|
|
1849
|
+
factor?: number | undefined;
|
|
1850
|
+
minTimeoutInMs?: number | undefined;
|
|
1851
|
+
maxTimeoutInMs?: number | undefined;
|
|
1852
|
+
randomize?: boolean | undefined;
|
|
1853
|
+
}, {
|
|
1854
|
+
limit?: number | undefined;
|
|
1855
|
+
factor?: number | undefined;
|
|
1856
|
+
minTimeoutInMs?: number | undefined;
|
|
1857
|
+
maxTimeoutInMs?: number | undefined;
|
|
1858
|
+
randomize?: boolean | undefined;
|
|
1859
|
+
}>>;
|
|
1860
|
+
/** The icon for the Task, it will appear in the logs.
|
|
1861
|
+
* You can use the name of a company in lowercase, e.g. "github".
|
|
1862
|
+
* Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
|
|
1745
1863
|
icon: z.ZodOptional<z.ZodString>;
|
|
1864
|
+
/** The key for the Task that you want to appear in the logs */
|
|
1746
1865
|
displayKey: z.ZodOptional<z.ZodString>;
|
|
1747
|
-
|
|
1748
|
-
delayUntil: z.ZodOptional<z.ZodDate>;
|
|
1866
|
+
/** A description of the Task */
|
|
1749
1867
|
description: z.ZodOptional<z.ZodString>;
|
|
1868
|
+
/** Properties that are displayed in the logs */
|
|
1750
1869
|
properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1751
1870
|
label: z.ZodString;
|
|
1752
1871
|
text: z.ZodString;
|
|
@@ -1760,7 +1879,32 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
1760
1879
|
label: string;
|
|
1761
1880
|
text: string;
|
|
1762
1881
|
}>, "many">>;
|
|
1763
|
-
params
|
|
1882
|
+
/** The input params to the Task, will be displayed in the logs */
|
|
1883
|
+
params: z.ZodAny;
|
|
1884
|
+
/** The style of the log entry. */
|
|
1885
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
1886
|
+
style: z.ZodEnum<["normal", "minimal"]>;
|
|
1887
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
1888
|
+
}, "strip", z.ZodTypeAny, {
|
|
1889
|
+
variant?: string | undefined;
|
|
1890
|
+
style: "normal" | "minimal";
|
|
1891
|
+
}, {
|
|
1892
|
+
variant?: string | undefined;
|
|
1893
|
+
style: "normal" | "minimal";
|
|
1894
|
+
}>>;
|
|
1895
|
+
/** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
|
|
1896
|
+
connectionKey: z.ZodOptional<z.ZodString>;
|
|
1897
|
+
/** An operation you want to perform on the Trigger.dev platform, current only "fetch" is supported. If you wish to `fetch` use [`io.backgroundFetch()`](https://trigger.dev/docs/sdk/io/backgroundfetch) instead. */
|
|
1898
|
+
operation: z.ZodOptional<z.ZodEnum<["fetch"]>>;
|
|
1899
|
+
/** A No Operation means that the code won't be executed. This is used internally to implement features like [io.wait()](https://trigger.dev/docs/sdk/io/wait). */
|
|
1900
|
+
noop: z.ZodDefault<z.ZodBoolean>;
|
|
1901
|
+
redact: z.ZodOptional<z.ZodObject<{
|
|
1902
|
+
paths: z.ZodArray<z.ZodString, "many">;
|
|
1903
|
+
}, "strip", z.ZodTypeAny, {
|
|
1904
|
+
paths: string[];
|
|
1905
|
+
}, {
|
|
1906
|
+
paths: string[];
|
|
1907
|
+
}>>;
|
|
1764
1908
|
trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
1765
1909
|
type: z.ZodLiteral<"dynamic">;
|
|
1766
1910
|
id: z.ZodString;
|
|
@@ -1908,43 +2052,6 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
1908
2052
|
type: "interval";
|
|
1909
2053
|
};
|
|
1910
2054
|
}>]>>;
|
|
1911
|
-
redact: z.ZodOptional<z.ZodObject<{
|
|
1912
|
-
paths: z.ZodArray<z.ZodString, "many">;
|
|
1913
|
-
}, "strip", z.ZodTypeAny, {
|
|
1914
|
-
paths: string[];
|
|
1915
|
-
}, {
|
|
1916
|
-
paths: string[];
|
|
1917
|
-
}>>;
|
|
1918
|
-
connectionKey: z.ZodOptional<z.ZodString>;
|
|
1919
|
-
style: z.ZodOptional<z.ZodObject<{
|
|
1920
|
-
style: z.ZodEnum<["normal", "minimal"]>;
|
|
1921
|
-
variant: z.ZodOptional<z.ZodString>;
|
|
1922
|
-
}, "strip", z.ZodTypeAny, {
|
|
1923
|
-
variant?: string | undefined;
|
|
1924
|
-
style: "normal" | "minimal";
|
|
1925
|
-
}, {
|
|
1926
|
-
variant?: string | undefined;
|
|
1927
|
-
style: "normal" | "minimal";
|
|
1928
|
-
}>>;
|
|
1929
|
-
retry: z.ZodOptional<z.ZodObject<{
|
|
1930
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
1931
|
-
factor: z.ZodOptional<z.ZodNumber>;
|
|
1932
|
-
minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
1933
|
-
maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
1934
|
-
randomize: z.ZodOptional<z.ZodBoolean>;
|
|
1935
|
-
}, "strip", z.ZodTypeAny, {
|
|
1936
|
-
limit?: number | undefined;
|
|
1937
|
-
factor?: number | undefined;
|
|
1938
|
-
minTimeoutInMs?: number | undefined;
|
|
1939
|
-
maxTimeoutInMs?: number | undefined;
|
|
1940
|
-
randomize?: boolean | undefined;
|
|
1941
|
-
}, {
|
|
1942
|
-
limit?: number | undefined;
|
|
1943
|
-
factor?: number | undefined;
|
|
1944
|
-
minTimeoutInMs?: number | undefined;
|
|
1945
|
-
maxTimeoutInMs?: number | undefined;
|
|
1946
|
-
randomize?: boolean | undefined;
|
|
1947
|
-
}>>;
|
|
1948
2055
|
}, {
|
|
1949
2056
|
idempotencyKey: z.ZodString;
|
|
1950
2057
|
parentId: z.ZodOptional<z.ZodString>;
|
|
@@ -1952,7 +2059,7 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
1952
2059
|
icon?: string | undefined;
|
|
1953
2060
|
delayUntil?: Date | undefined;
|
|
1954
2061
|
description?: string | undefined;
|
|
1955
|
-
params?:
|
|
2062
|
+
params?: any;
|
|
1956
2063
|
properties?: {
|
|
1957
2064
|
url?: string | undefined;
|
|
1958
2065
|
label: string;
|
|
@@ -1963,6 +2070,7 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
1963
2070
|
variant?: string | undefined;
|
|
1964
2071
|
style: "normal" | "minimal";
|
|
1965
2072
|
} | undefined;
|
|
2073
|
+
operation?: "fetch" | undefined;
|
|
1966
2074
|
trigger?: {
|
|
1967
2075
|
id: string;
|
|
1968
2076
|
type: "dynamic";
|
|
@@ -1996,11 +2104,6 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
1996
2104
|
type: "interval";
|
|
1997
2105
|
};
|
|
1998
2106
|
} | undefined;
|
|
1999
|
-
displayKey?: string | undefined;
|
|
2000
|
-
redact?: {
|
|
2001
|
-
paths: string[];
|
|
2002
|
-
} | undefined;
|
|
2003
|
-
connectionKey?: string | undefined;
|
|
2004
2107
|
retry?: {
|
|
2005
2108
|
limit?: number | undefined;
|
|
2006
2109
|
factor?: number | undefined;
|
|
@@ -2008,6 +2111,11 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
2008
2111
|
maxTimeoutInMs?: number | undefined;
|
|
2009
2112
|
randomize?: boolean | undefined;
|
|
2010
2113
|
} | undefined;
|
|
2114
|
+
displayKey?: string | undefined;
|
|
2115
|
+
connectionKey?: string | undefined;
|
|
2116
|
+
redact?: {
|
|
2117
|
+
paths: string[];
|
|
2118
|
+
} | undefined;
|
|
2011
2119
|
name: string;
|
|
2012
2120
|
noop: boolean;
|
|
2013
2121
|
idempotencyKey: string;
|
|
@@ -2016,7 +2124,7 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
2016
2124
|
noop?: boolean | undefined;
|
|
2017
2125
|
delayUntil?: Date | undefined;
|
|
2018
2126
|
description?: string | undefined;
|
|
2019
|
-
params?:
|
|
2127
|
+
params?: any;
|
|
2020
2128
|
properties?: {
|
|
2021
2129
|
url?: string | undefined;
|
|
2022
2130
|
label: string;
|
|
@@ -2027,6 +2135,7 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
2027
2135
|
variant?: string | undefined;
|
|
2028
2136
|
style: "normal" | "minimal";
|
|
2029
2137
|
} | undefined;
|
|
2138
|
+
operation?: "fetch" | undefined;
|
|
2030
2139
|
trigger?: {
|
|
2031
2140
|
id: string;
|
|
2032
2141
|
type: "dynamic";
|
|
@@ -2060,11 +2169,6 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
2060
2169
|
type: "interval";
|
|
2061
2170
|
};
|
|
2062
2171
|
} | undefined;
|
|
2063
|
-
displayKey?: string | undefined;
|
|
2064
|
-
redact?: {
|
|
2065
|
-
paths: string[];
|
|
2066
|
-
} | undefined;
|
|
2067
|
-
connectionKey?: string | undefined;
|
|
2068
2172
|
retry?: {
|
|
2069
2173
|
limit?: number | undefined;
|
|
2070
2174
|
factor?: number | undefined;
|
|
@@ -2072,17 +2176,54 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
2072
2176
|
maxTimeoutInMs?: number | undefined;
|
|
2073
2177
|
randomize?: boolean | undefined;
|
|
2074
2178
|
} | undefined;
|
|
2179
|
+
displayKey?: string | undefined;
|
|
2180
|
+
connectionKey?: string | undefined;
|
|
2181
|
+
redact?: {
|
|
2182
|
+
paths: string[];
|
|
2183
|
+
} | undefined;
|
|
2075
2184
|
name: string;
|
|
2076
2185
|
idempotencyKey: string;
|
|
2077
2186
|
}>;
|
|
2078
2187
|
type RunTaskBodyInput = z.infer<typeof RunTaskBodyInputSchema>;
|
|
2079
2188
|
declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.extendShape<{
|
|
2189
|
+
/** The name of the Task is required. This is displayed on the Task in the logs. */
|
|
2080
2190
|
name: z.ZodString;
|
|
2191
|
+
/** The Task will wait and only start at the specified Date */
|
|
2192
|
+
delayUntil: z.ZodOptional<z.ZodDate>;
|
|
2193
|
+
/** Retry options */
|
|
2194
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
2195
|
+
/** The maximum number of times to retry the request. */
|
|
2196
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
2197
|
+
/** The exponential factor to use when calculating the next retry time. */
|
|
2198
|
+
factor: z.ZodOptional<z.ZodNumber>;
|
|
2199
|
+
/** The minimum amount of time to wait before retrying the request. */
|
|
2200
|
+
minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
2201
|
+
/** The maximum amount of time to wait before retrying the request. */
|
|
2202
|
+
maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
2203
|
+
/** Whether to randomize the retry time. */
|
|
2204
|
+
randomize: z.ZodOptional<z.ZodBoolean>;
|
|
2205
|
+
}, "strip", z.ZodTypeAny, {
|
|
2206
|
+
limit?: number | undefined;
|
|
2207
|
+
factor?: number | undefined;
|
|
2208
|
+
minTimeoutInMs?: number | undefined;
|
|
2209
|
+
maxTimeoutInMs?: number | undefined;
|
|
2210
|
+
randomize?: boolean | undefined;
|
|
2211
|
+
}, {
|
|
2212
|
+
limit?: number | undefined;
|
|
2213
|
+
factor?: number | undefined;
|
|
2214
|
+
minTimeoutInMs?: number | undefined;
|
|
2215
|
+
maxTimeoutInMs?: number | undefined;
|
|
2216
|
+
randomize?: boolean | undefined;
|
|
2217
|
+
}>>;
|
|
2218
|
+
/** The icon for the Task, it will appear in the logs.
|
|
2219
|
+
* You can use the name of a company in lowercase, e.g. "github".
|
|
2220
|
+
* Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
|
|
2081
2221
|
icon: z.ZodOptional<z.ZodString>;
|
|
2222
|
+
/** The key for the Task that you want to appear in the logs */
|
|
2082
2223
|
displayKey: z.ZodOptional<z.ZodString>;
|
|
2083
|
-
|
|
2084
|
-
delayUntil: z.ZodOptional<z.ZodDate>;
|
|
2224
|
+
/** A description of the Task */
|
|
2085
2225
|
description: z.ZodOptional<z.ZodString>;
|
|
2226
|
+
/** Properties that are displayed in the logs */
|
|
2086
2227
|
properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2087
2228
|
label: z.ZodString;
|
|
2088
2229
|
text: z.ZodString;
|
|
@@ -2096,7 +2237,32 @@ declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.exte
|
|
|
2096
2237
|
label: string;
|
|
2097
2238
|
text: string;
|
|
2098
2239
|
}>, "many">>;
|
|
2099
|
-
params
|
|
2240
|
+
/** The input params to the Task, will be displayed in the logs */
|
|
2241
|
+
params: z.ZodAny;
|
|
2242
|
+
/** The style of the log entry. */
|
|
2243
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
2244
|
+
style: z.ZodEnum<["normal", "minimal"]>;
|
|
2245
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
2246
|
+
}, "strip", z.ZodTypeAny, {
|
|
2247
|
+
variant?: string | undefined;
|
|
2248
|
+
style: "normal" | "minimal";
|
|
2249
|
+
}, {
|
|
2250
|
+
variant?: string | undefined;
|
|
2251
|
+
style: "normal" | "minimal";
|
|
2252
|
+
}>>;
|
|
2253
|
+
/** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
|
|
2254
|
+
connectionKey: z.ZodOptional<z.ZodString>;
|
|
2255
|
+
/** An operation you want to perform on the Trigger.dev platform, current only "fetch" is supported. If you wish to `fetch` use [`io.backgroundFetch()`](https://trigger.dev/docs/sdk/io/backgroundfetch) instead. */
|
|
2256
|
+
operation: z.ZodOptional<z.ZodEnum<["fetch"]>>;
|
|
2257
|
+
/** A No Operation means that the code won't be executed. This is used internally to implement features like [io.wait()](https://trigger.dev/docs/sdk/io/wait). */
|
|
2258
|
+
noop: z.ZodDefault<z.ZodBoolean>;
|
|
2259
|
+
redact: z.ZodOptional<z.ZodObject<{
|
|
2260
|
+
paths: z.ZodArray<z.ZodString, "many">;
|
|
2261
|
+
}, "strip", z.ZodTypeAny, {
|
|
2262
|
+
paths: string[];
|
|
2263
|
+
}, {
|
|
2264
|
+
paths: string[];
|
|
2265
|
+
}>>;
|
|
2100
2266
|
trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
2101
2267
|
type: z.ZodLiteral<"dynamic">;
|
|
2102
2268
|
id: z.ZodString;
|
|
@@ -2244,43 +2410,6 @@ declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.exte
|
|
|
2244
2410
|
type: "interval";
|
|
2245
2411
|
};
|
|
2246
2412
|
}>]>>;
|
|
2247
|
-
redact: z.ZodOptional<z.ZodObject<{
|
|
2248
|
-
paths: z.ZodArray<z.ZodString, "many">;
|
|
2249
|
-
}, "strip", z.ZodTypeAny, {
|
|
2250
|
-
paths: string[];
|
|
2251
|
-
}, {
|
|
2252
|
-
paths: string[];
|
|
2253
|
-
}>>;
|
|
2254
|
-
connectionKey: z.ZodOptional<z.ZodString>;
|
|
2255
|
-
style: z.ZodOptional<z.ZodObject<{
|
|
2256
|
-
style: z.ZodEnum<["normal", "minimal"]>;
|
|
2257
|
-
variant: z.ZodOptional<z.ZodString>;
|
|
2258
|
-
}, "strip", z.ZodTypeAny, {
|
|
2259
|
-
variant?: string | undefined;
|
|
2260
|
-
style: "normal" | "minimal";
|
|
2261
|
-
}, {
|
|
2262
|
-
variant?: string | undefined;
|
|
2263
|
-
style: "normal" | "minimal";
|
|
2264
|
-
}>>;
|
|
2265
|
-
retry: z.ZodOptional<z.ZodObject<{
|
|
2266
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
2267
|
-
factor: z.ZodOptional<z.ZodNumber>;
|
|
2268
|
-
minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
2269
|
-
maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
2270
|
-
randomize: z.ZodOptional<z.ZodBoolean>;
|
|
2271
|
-
}, "strip", z.ZodTypeAny, {
|
|
2272
|
-
limit?: number | undefined;
|
|
2273
|
-
factor?: number | undefined;
|
|
2274
|
-
minTimeoutInMs?: number | undefined;
|
|
2275
|
-
maxTimeoutInMs?: number | undefined;
|
|
2276
|
-
randomize?: boolean | undefined;
|
|
2277
|
-
}, {
|
|
2278
|
-
limit?: number | undefined;
|
|
2279
|
-
factor?: number | undefined;
|
|
2280
|
-
minTimeoutInMs?: number | undefined;
|
|
2281
|
-
maxTimeoutInMs?: number | undefined;
|
|
2282
|
-
randomize?: boolean | undefined;
|
|
2283
|
-
}>>;
|
|
2284
2413
|
}, {
|
|
2285
2414
|
idempotencyKey: z.ZodString;
|
|
2286
2415
|
parentId: z.ZodOptional<z.ZodString>;
|
|
@@ -2290,7 +2419,7 @@ declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.exte
|
|
|
2290
2419
|
} | DeserializedJson[] | null, SerializableJson>;
|
|
2291
2420
|
}>, "strip", z.ZodTypeAny, {
|
|
2292
2421
|
description?: string | undefined;
|
|
2293
|
-
params?:
|
|
2422
|
+
params?: any;
|
|
2294
2423
|
properties?: {
|
|
2295
2424
|
url?: string | undefined;
|
|
2296
2425
|
label: string;
|
|
@@ -2301,7 +2430,7 @@ declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.exte
|
|
|
2301
2430
|
} | DeserializedJson[] | null;
|
|
2302
2431
|
}, {
|
|
2303
2432
|
description?: string | undefined;
|
|
2304
|
-
params?:
|
|
2433
|
+
params?: any;
|
|
2305
2434
|
properties?: {
|
|
2306
2435
|
url?: string | undefined;
|
|
2307
2436
|
label: string;
|
|
@@ -2391,30 +2520,86 @@ declare const RegisterTriggerBodySchema: z.ZodObject<{
|
|
|
2391
2520
|
}>;
|
|
2392
2521
|
source: z.ZodObject<{
|
|
2393
2522
|
channel: z.ZodEnum<["HTTP", "SQS", "SMTP"]>;
|
|
2523
|
+
integration: z.ZodObject<{
|
|
2524
|
+
id: z.ZodString;
|
|
2525
|
+
metadata: z.ZodObject<{
|
|
2526
|
+
id: z.ZodString;
|
|
2527
|
+
name: z.ZodString;
|
|
2528
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
2529
|
+
}, "strip", z.ZodTypeAny, {
|
|
2530
|
+
instructions?: string | undefined;
|
|
2531
|
+
id: string;
|
|
2532
|
+
name: string;
|
|
2533
|
+
}, {
|
|
2534
|
+
instructions?: string | undefined;
|
|
2535
|
+
id: string;
|
|
2536
|
+
name: string;
|
|
2537
|
+
}>;
|
|
2538
|
+
authSource: z.ZodEnum<["HOSTED", "LOCAL"]>;
|
|
2539
|
+
}, "strip", z.ZodTypeAny, {
|
|
2540
|
+
id: string;
|
|
2541
|
+
metadata: {
|
|
2542
|
+
instructions?: string | undefined;
|
|
2543
|
+
id: string;
|
|
2544
|
+
name: string;
|
|
2545
|
+
};
|
|
2546
|
+
authSource: "HOSTED" | "LOCAL";
|
|
2547
|
+
}, {
|
|
2548
|
+
id: string;
|
|
2549
|
+
metadata: {
|
|
2550
|
+
instructions?: string | undefined;
|
|
2551
|
+
id: string;
|
|
2552
|
+
name: string;
|
|
2553
|
+
};
|
|
2554
|
+
authSource: "HOSTED" | "LOCAL";
|
|
2555
|
+
}>;
|
|
2394
2556
|
key: z.ZodString;
|
|
2395
2557
|
params: z.ZodAny;
|
|
2396
2558
|
events: z.ZodArray<z.ZodString, "many">;
|
|
2397
|
-
clientId: z.ZodOptional<z.ZodString>;
|
|
2398
2559
|
}, "strip", z.ZodTypeAny, {
|
|
2399
2560
|
params?: any;
|
|
2400
|
-
clientId?: string | undefined;
|
|
2401
2561
|
key: string;
|
|
2402
2562
|
channel: "HTTP" | "SMTP" | "SQS";
|
|
2403
2563
|
events: string[];
|
|
2564
|
+
integration: {
|
|
2565
|
+
id: string;
|
|
2566
|
+
metadata: {
|
|
2567
|
+
instructions?: string | undefined;
|
|
2568
|
+
id: string;
|
|
2569
|
+
name: string;
|
|
2570
|
+
};
|
|
2571
|
+
authSource: "HOSTED" | "LOCAL";
|
|
2572
|
+
};
|
|
2404
2573
|
}, {
|
|
2405
2574
|
params?: any;
|
|
2406
|
-
clientId?: string | undefined;
|
|
2407
2575
|
key: string;
|
|
2408
2576
|
channel: "HTTP" | "SMTP" | "SQS";
|
|
2409
2577
|
events: string[];
|
|
2578
|
+
integration: {
|
|
2579
|
+
id: string;
|
|
2580
|
+
metadata: {
|
|
2581
|
+
instructions?: string | undefined;
|
|
2582
|
+
id: string;
|
|
2583
|
+
name: string;
|
|
2584
|
+
};
|
|
2585
|
+
authSource: "HOSTED" | "LOCAL";
|
|
2586
|
+
};
|
|
2410
2587
|
}>;
|
|
2411
2588
|
}, "strip", z.ZodTypeAny, {
|
|
2412
2589
|
source: {
|
|
2413
2590
|
params?: any;
|
|
2414
|
-
clientId?: string | undefined;
|
|
2415
2591
|
key: string;
|
|
2416
2592
|
channel: "HTTP" | "SMTP" | "SQS";
|
|
2417
2593
|
events: string[];
|
|
2594
|
+
integration: {
|
|
2595
|
+
id: string;
|
|
2596
|
+
metadata: {
|
|
2597
|
+
instructions?: string | undefined;
|
|
2598
|
+
id: string;
|
|
2599
|
+
name: string;
|
|
2600
|
+
};
|
|
2601
|
+
authSource: "HOSTED" | "LOCAL";
|
|
2602
|
+
};
|
|
2418
2603
|
};
|
|
2419
2604
|
rule: {
|
|
2420
2605
|
payload?: EventFilter | undefined;
|
|
@@ -2425,10 +2610,18 @@ declare const RegisterTriggerBodySchema: z.ZodObject<{
|
|
|
2425
2610
|
}, {
|
|
2426
2611
|
source: {
|
|
2427
2612
|
params?: any;
|
|
2428
|
-
clientId?: string | undefined;
|
|
2429
2613
|
key: string;
|
|
2430
2614
|
channel: "HTTP" | "SMTP" | "SQS";
|
|
2431
2615
|
events: string[];
|
|
2616
|
+
integration: {
|
|
2617
|
+
id: string;
|
|
2618
|
+
metadata: {
|
|
2619
|
+
instructions?: string | undefined;
|
|
2620
|
+
id: string;
|
|
2621
|
+
name: string;
|
|
2622
|
+
};
|
|
2623
|
+
authSource: "HOSTED" | "LOCAL";
|
|
2624
|
+
};
|
|
2432
2625
|
};
|
|
2433
2626
|
rule: {
|
|
2434
2627
|
payload?: EventFilter | undefined;
|
|
@@ -2603,9 +2796,13 @@ declare const ErrorWithStackSchema: z.ZodObject<{
|
|
|
2603
2796
|
}>;
|
|
2604
2797
|
type ErrorWithStack = z.infer<typeof ErrorWithStackSchema>;
|
|
2605
2798
|
|
|
2799
|
+
/** A property that is displayed in the logs */
|
|
2606
2800
|
declare const DisplayPropertySchema: z.ZodObject<{
|
|
2801
|
+
/** The label for the property */
|
|
2607
2802
|
label: z.ZodString;
|
|
2803
|
+
/** The value of the property */
|
|
2608
2804
|
text: z.ZodString;
|
|
2805
|
+
/** The URL to link to when the property is clicked */
|
|
2609
2806
|
url: z.ZodOptional<z.ZodString>;
|
|
2610
2807
|
}, "strip", z.ZodTypeAny, {
|
|
2611
2808
|
url?: string | undefined;
|
|
@@ -2636,48 +2833,51 @@ declare const ConnectionAuthSchema: z.ZodObject<{
|
|
|
2636
2833
|
}>;
|
|
2637
2834
|
type ConnectionAuth = z.infer<typeof ConnectionAuthSchema>;
|
|
2638
2835
|
declare const IntegrationMetadataSchema: z.ZodObject<{
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2836
|
+
id: z.ZodString;
|
|
2837
|
+
name: z.ZodString;
|
|
2838
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
2642
2839
|
}, "strip", z.ZodTypeAny, {
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2840
|
+
instructions?: string | undefined;
|
|
2841
|
+
id: string;
|
|
2842
|
+
name: string;
|
|
2646
2843
|
}, {
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2844
|
+
instructions?: string | undefined;
|
|
2845
|
+
id: string;
|
|
2846
|
+
name: string;
|
|
2650
2847
|
}>;
|
|
2651
2848
|
type IntegrationMetadata = z.infer<typeof IntegrationMetadataSchema>;
|
|
2652
2849
|
declare const IntegrationConfigSchema: z.ZodObject<{
|
|
2653
2850
|
id: z.ZodString;
|
|
2654
2851
|
metadata: z.ZodObject<{
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2852
|
+
id: z.ZodString;
|
|
2853
|
+
name: z.ZodString;
|
|
2854
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
2658
2855
|
}, "strip", z.ZodTypeAny, {
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2856
|
+
instructions?: string | undefined;
|
|
2857
|
+
id: string;
|
|
2858
|
+
name: string;
|
|
2662
2859
|
}, {
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2860
|
+
instructions?: string | undefined;
|
|
2861
|
+
id: string;
|
|
2862
|
+
name: string;
|
|
2666
2863
|
}>;
|
|
2864
|
+
authSource: z.ZodEnum<["HOSTED", "LOCAL"]>;
|
|
2667
2865
|
}, "strip", z.ZodTypeAny, {
|
|
2668
2866
|
id: string;
|
|
2669
2867
|
metadata: {
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2868
|
+
instructions?: string | undefined;
|
|
2869
|
+
id: string;
|
|
2870
|
+
name: string;
|
|
2673
2871
|
};
|
|
2872
|
+
authSource: "HOSTED" | "LOCAL";
|
|
2674
2873
|
}, {
|
|
2675
2874
|
id: string;
|
|
2676
2875
|
metadata: {
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2876
|
+
instructions?: string | undefined;
|
|
2877
|
+
id: string;
|
|
2878
|
+
name: string;
|
|
2680
2879
|
};
|
|
2880
|
+
authSource: "HOSTED" | "LOCAL";
|
|
2681
2881
|
}>;
|
|
2682
2882
|
type IntegrationConfig = z.infer<typeof IntegrationConfigSchema>;
|
|
2683
2883
|
|
|
@@ -2693,30 +2893,40 @@ declare const ScheduledPayloadSchema: z.ZodObject<{
|
|
|
2693
2893
|
}>;
|
|
2694
2894
|
type ScheduledPayload = z.infer<typeof ScheduledPayloadSchema>;
|
|
2695
2895
|
declare const IntervalOptionsSchema: z.ZodObject<{
|
|
2896
|
+
/** The number of seconds for the interval. Min = 60, Max = 86400 (1 day) */
|
|
2696
2897
|
seconds: z.ZodNumber;
|
|
2697
2898
|
}, "strip", z.ZodTypeAny, {
|
|
2698
2899
|
seconds: number;
|
|
2699
2900
|
}, {
|
|
2700
2901
|
seconds: number;
|
|
2701
2902
|
}>;
|
|
2903
|
+
/** Interval options */
|
|
2702
2904
|
type IntervalOptions = z.infer<typeof IntervalOptionsSchema>;
|
|
2703
2905
|
declare const CronOptionsSchema: z.ZodObject<{
|
|
2906
|
+
/** A CRON expression that defines the schedule. A useful tool when writing CRON
|
|
2907
|
+
expressions is [crontab guru](https://crontab.guru). Note that the timezone
|
|
2908
|
+
used is UTC. */
|
|
2704
2909
|
cron: z.ZodString;
|
|
2705
2910
|
}, "strip", z.ZodTypeAny, {
|
|
2706
2911
|
cron: string;
|
|
2707
2912
|
}, {
|
|
2708
2913
|
cron: string;
|
|
2709
2914
|
}>;
|
|
2915
|
+
/** The options for a `cronTrigger()` */
|
|
2710
2916
|
type CronOptions = z.infer<typeof CronOptionsSchema>;
|
|
2711
2917
|
declare const ScheduleMetadataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
2918
|
+
/** An interval reoccurs at the specified number of seconds */
|
|
2712
2919
|
type: z.ZodLiteral<"interval">;
|
|
2920
|
+
/** An object containing options about the interval. */
|
|
2713
2921
|
options: z.ZodObject<{
|
|
2922
|
+
/** The number of seconds for the interval. Min = 60, Max = 86400 (1 day) */
|
|
2714
2923
|
seconds: z.ZodNumber;
|
|
2715
2924
|
}, "strip", z.ZodTypeAny, {
|
|
2716
2925
|
seconds: number;
|
|
2717
2926
|
}, {
|
|
2718
2927
|
seconds: number;
|
|
2719
2928
|
}>;
|
|
2929
|
+
/** Any additional metadata about the schedule. */
|
|
2720
2930
|
metadata: z.ZodAny;
|
|
2721
2931
|
}, "strip", z.ZodTypeAny, {
|
|
2722
2932
|
metadata?: any;
|
|
@@ -2733,6 +2943,9 @@ declare const ScheduleMetadataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
2733
2943
|
}>, z.ZodObject<{
|
|
2734
2944
|
type: z.ZodLiteral<"cron">;
|
|
2735
2945
|
options: z.ZodObject<{
|
|
2946
|
+
/** A CRON expression that defines the schedule. A useful tool when writing CRON
|
|
2947
|
+
expressions is [crontab guru](https://crontab.guru). Note that the timezone
|
|
2948
|
+
used is UTC. */
|
|
2736
2949
|
cron: z.ZodString;
|
|
2737
2950
|
}, "strip", z.ZodTypeAny, {
|
|
2738
2951
|
cron: string;
|
|
@@ -2763,24 +2976,18 @@ declare const MissingConnectionNotificationPayloadSchema: z.ZodDiscriminatedUnio
|
|
|
2763
2976
|
scopes: z.ZodArray<z.ZodString, "many">;
|
|
2764
2977
|
createdAt: z.ZodDate;
|
|
2765
2978
|
updatedAt: z.ZodDate;
|
|
2766
|
-
integrationIdentifier: z.ZodString;
|
|
2767
|
-
integrationAuthMethod: z.ZodString;
|
|
2768
2979
|
}, "strip", z.ZodTypeAny, {
|
|
2769
2980
|
id: string;
|
|
2770
2981
|
scopes: string[];
|
|
2771
2982
|
title: string;
|
|
2772
2983
|
createdAt: Date;
|
|
2773
2984
|
updatedAt: Date;
|
|
2774
|
-
integrationIdentifier: string;
|
|
2775
|
-
integrationAuthMethod: string;
|
|
2776
2985
|
}, {
|
|
2777
2986
|
id: string;
|
|
2778
2987
|
scopes: string[];
|
|
2779
2988
|
title: string;
|
|
2780
2989
|
createdAt: Date;
|
|
2781
2990
|
updatedAt: Date;
|
|
2782
|
-
integrationIdentifier: string;
|
|
2783
|
-
integrationAuthMethod: string;
|
|
2784
2991
|
}>;
|
|
2785
2992
|
authorizationUrl: z.ZodString;
|
|
2786
2993
|
}, {
|
|
@@ -2794,8 +3001,6 @@ declare const MissingConnectionNotificationPayloadSchema: z.ZodDiscriminatedUnio
|
|
|
2794
3001
|
title: string;
|
|
2795
3002
|
createdAt: Date;
|
|
2796
3003
|
updatedAt: Date;
|
|
2797
|
-
integrationIdentifier: string;
|
|
2798
|
-
integrationAuthMethod: string;
|
|
2799
3004
|
};
|
|
2800
3005
|
authorizationUrl: string;
|
|
2801
3006
|
}, {
|
|
@@ -2807,8 +3012,6 @@ declare const MissingConnectionNotificationPayloadSchema: z.ZodDiscriminatedUnio
|
|
|
2807
3012
|
title: string;
|
|
2808
3013
|
createdAt: Date;
|
|
2809
3014
|
updatedAt: Date;
|
|
2810
|
-
integrationIdentifier: string;
|
|
2811
|
-
integrationAuthMethod: string;
|
|
2812
3015
|
};
|
|
2813
3016
|
authorizationUrl: string;
|
|
2814
3017
|
}>, z.ZodObject<z.extendShape<{
|
|
@@ -2819,24 +3022,18 @@ declare const MissingConnectionNotificationPayloadSchema: z.ZodDiscriminatedUnio
|
|
|
2819
3022
|
scopes: z.ZodArray<z.ZodString, "many">;
|
|
2820
3023
|
createdAt: z.ZodDate;
|
|
2821
3024
|
updatedAt: z.ZodDate;
|
|
2822
|
-
integrationIdentifier: z.ZodString;
|
|
2823
|
-
integrationAuthMethod: z.ZodString;
|
|
2824
3025
|
}, "strip", z.ZodTypeAny, {
|
|
2825
3026
|
id: string;
|
|
2826
3027
|
scopes: string[];
|
|
2827
3028
|
title: string;
|
|
2828
3029
|
createdAt: Date;
|
|
2829
3030
|
updatedAt: Date;
|
|
2830
|
-
integrationIdentifier: string;
|
|
2831
|
-
integrationAuthMethod: string;
|
|
2832
3031
|
}, {
|
|
2833
3032
|
id: string;
|
|
2834
3033
|
scopes: string[];
|
|
2835
3034
|
title: string;
|
|
2836
3035
|
createdAt: Date;
|
|
2837
3036
|
updatedAt: Date;
|
|
2838
|
-
integrationIdentifier: string;
|
|
2839
|
-
integrationAuthMethod: string;
|
|
2840
3037
|
}>;
|
|
2841
3038
|
authorizationUrl: z.ZodString;
|
|
2842
3039
|
}, {
|
|
@@ -2864,8 +3061,6 @@ declare const MissingConnectionNotificationPayloadSchema: z.ZodDiscriminatedUnio
|
|
|
2864
3061
|
title: string;
|
|
2865
3062
|
createdAt: Date;
|
|
2866
3063
|
updatedAt: Date;
|
|
2867
|
-
integrationIdentifier: string;
|
|
2868
|
-
integrationAuthMethod: string;
|
|
2869
3064
|
};
|
|
2870
3065
|
authorizationUrl: string;
|
|
2871
3066
|
}, {
|
|
@@ -2881,8 +3076,6 @@ declare const MissingConnectionNotificationPayloadSchema: z.ZodDiscriminatedUnio
|
|
|
2881
3076
|
title: string;
|
|
2882
3077
|
createdAt: Date;
|
|
2883
3078
|
updatedAt: Date;
|
|
2884
|
-
integrationIdentifier: string;
|
|
2885
|
-
integrationAuthMethod: string;
|
|
2886
3079
|
};
|
|
2887
3080
|
authorizationUrl: string;
|
|
2888
3081
|
}>]>;
|
|
@@ -3020,6 +3213,99 @@ declare const MissingConnectionResolvedNotificationPayloadSchema: z.ZodDiscrimin
|
|
|
3020
3213
|
}>]>;
|
|
3021
3214
|
type MissingConnectionResolvedNotificationPayload = z.infer<typeof MissingConnectionResolvedNotificationPayloadSchema>;
|
|
3022
3215
|
|
|
3216
|
+
/** The options for a fetch request */
|
|
3217
|
+
declare const FetchRequestInitSchema: z.ZodObject<{
|
|
3218
|
+
/** The HTTP method to use for the request. */
|
|
3219
|
+
method: z.ZodOptional<z.ZodString>;
|
|
3220
|
+
/** Any headers to send with the request. Note that you can use [redactString](https://trigger.dev/docs/sdk/redactString) to prevent sensitive information from being stored (e.g. in the logs), like API keys and tokens. */
|
|
3221
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
3222
|
+
__redactedString: z.ZodLiteral<true>;
|
|
3223
|
+
strings: z.ZodArray<z.ZodString, "many">;
|
|
3224
|
+
interpolations: z.ZodArray<z.ZodString, "many">;
|
|
3225
|
+
}, "strip", z.ZodTypeAny, {
|
|
3226
|
+
__redactedString: true;
|
|
3227
|
+
strings: string[];
|
|
3228
|
+
interpolations: string[];
|
|
3229
|
+
}, {
|
|
3230
|
+
__redactedString: true;
|
|
3231
|
+
strings: string[];
|
|
3232
|
+
interpolations: string[];
|
|
3233
|
+
}>]>>>;
|
|
3234
|
+
/** The body of the request. */
|
|
3235
|
+
body: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>]>>;
|
|
3236
|
+
}, "strip", z.ZodTypeAny, {
|
|
3237
|
+
method?: string | undefined;
|
|
3238
|
+
headers?: Record<string, string | {
|
|
3239
|
+
__redactedString: true;
|
|
3240
|
+
strings: string[];
|
|
3241
|
+
interpolations: string[];
|
|
3242
|
+
}> | undefined;
|
|
3243
|
+
body?: string | ArrayBuffer | undefined;
|
|
3244
|
+
}, {
|
|
3245
|
+
method?: string | undefined;
|
|
3246
|
+
headers?: Record<string, string | {
|
|
3247
|
+
__redactedString: true;
|
|
3248
|
+
strings: string[];
|
|
3249
|
+
interpolations: string[];
|
|
3250
|
+
}> | undefined;
|
|
3251
|
+
body?: string | ArrayBuffer | undefined;
|
|
3252
|
+
}>;
|
|
3253
|
+
/** The options for a fetch request */
|
|
3254
|
+
type FetchRequestInit = z.infer<typeof FetchRequestInitSchema>;
|
|
3255
|
+
declare const FetchRetryOptionsSchema: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<"strategy", [z.ZodObject<{
|
|
3256
|
+
/** The `headers` strategy retries the request using info from the response headers. */
|
|
3257
|
+
strategy: z.ZodLiteral<"headers">;
|
|
3258
|
+
/** The header to use to determine the maximum number of times to retry the request. */
|
|
3259
|
+
limitHeader: z.ZodString;
|
|
3260
|
+
/** The header to use to determine the number of remaining retries. */
|
|
3261
|
+
remainingHeader: z.ZodString;
|
|
3262
|
+
/** The header to use to determine the time when the number of remaining retries will be reset. */
|
|
3263
|
+
resetHeader: z.ZodString;
|
|
3264
|
+
}, "strip", z.ZodTypeAny, {
|
|
3265
|
+
strategy: "headers";
|
|
3266
|
+
limitHeader: string;
|
|
3267
|
+
remainingHeader: string;
|
|
3268
|
+
resetHeader: string;
|
|
3269
|
+
}, {
|
|
3270
|
+
strategy: "headers";
|
|
3271
|
+
limitHeader: string;
|
|
3272
|
+
remainingHeader: string;
|
|
3273
|
+
resetHeader: string;
|
|
3274
|
+
}>, z.ZodObject<z.extendShape<{
|
|
3275
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
3276
|
+
factor: z.ZodOptional<z.ZodNumber>;
|
|
3277
|
+
minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
3278
|
+
maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
3279
|
+
randomize: z.ZodOptional<z.ZodBoolean>;
|
|
3280
|
+
}, {
|
|
3281
|
+
/** The `backoff` strategy retries the request with an exponential backoff. */
|
|
3282
|
+
strategy: z.ZodLiteral<"backoff">;
|
|
3283
|
+
}>, "strip", z.ZodTypeAny, {
|
|
3284
|
+
limit?: number | undefined;
|
|
3285
|
+
factor?: number | undefined;
|
|
3286
|
+
minTimeoutInMs?: number | undefined;
|
|
3287
|
+
maxTimeoutInMs?: number | undefined;
|
|
3288
|
+
randomize?: boolean | undefined;
|
|
3289
|
+
strategy: "backoff";
|
|
3290
|
+
}, {
|
|
3291
|
+
limit?: number | undefined;
|
|
3292
|
+
factor?: number | undefined;
|
|
3293
|
+
minTimeoutInMs?: number | undefined;
|
|
3294
|
+
maxTimeoutInMs?: number | undefined;
|
|
3295
|
+
randomize?: boolean | undefined;
|
|
3296
|
+
strategy: "backoff";
|
|
3297
|
+
}>]>>;
|
|
3298
|
+
/** An object where the key is a status code pattern and the value is a retrying strategy. Supported patterns are:
|
|
3299
|
+
- Specific status codes: 429
|
|
3300
|
+
- Ranges: 500-599
|
|
3301
|
+
- Wildcards: 2xx, 3xx, 4xx, 5xx
|
|
3302
|
+
*/
|
|
3303
|
+
type FetchRetryOptions = z.infer<typeof FetchRetryOptionsSchema>;
|
|
3304
|
+
|
|
3305
|
+
type Prettify<T> = {
|
|
3306
|
+
[K in keyof T]: T[K];
|
|
3307
|
+
} & {};
|
|
3308
|
+
|
|
3023
3309
|
type ApiClientOptions = {
|
|
3024
3310
|
apiKey?: string;
|
|
3025
3311
|
apiUrl?: string;
|
|
@@ -3065,6 +3351,7 @@ declare class ApiClient {
|
|
|
3065
3351
|
variant?: string | undefined;
|
|
3066
3352
|
style: "normal" | "minimal";
|
|
3067
3353
|
} | null | undefined;
|
|
3354
|
+
operation?: string | null | undefined;
|
|
3068
3355
|
id: string;
|
|
3069
3356
|
name: string;
|
|
3070
3357
|
noop: boolean;
|
|
@@ -3091,6 +3378,7 @@ declare class ApiClient {
|
|
|
3091
3378
|
variant?: string | undefined;
|
|
3092
3379
|
style: "normal" | "minimal";
|
|
3093
3380
|
} | null | undefined;
|
|
3381
|
+
operation?: string | null | undefined;
|
|
3094
3382
|
id: string;
|
|
3095
3383
|
name: string;
|
|
3096
3384
|
noop: boolean;
|
|
@@ -3117,6 +3405,7 @@ declare class ApiClient {
|
|
|
3117
3405
|
variant?: string | undefined;
|
|
3118
3406
|
style: "normal" | "minimal";
|
|
3119
3407
|
} | null | undefined;
|
|
3408
|
+
operation?: string | null | undefined;
|
|
3120
3409
|
id: string;
|
|
3121
3410
|
name: string;
|
|
3122
3411
|
noop: boolean;
|
|
@@ -3165,31 +3454,42 @@ declare class ApiClient {
|
|
|
3165
3454
|
}
|
|
3166
3455
|
|
|
3167
3456
|
interface TriggerContext {
|
|
3457
|
+
/** Job metadata */
|
|
3168
3458
|
job: {
|
|
3169
3459
|
id: string;
|
|
3170
3460
|
version: string;
|
|
3171
3461
|
};
|
|
3462
|
+
/** Environment metadata */
|
|
3172
3463
|
environment: {
|
|
3173
3464
|
slug: string;
|
|
3174
3465
|
id: string;
|
|
3175
3466
|
type: RuntimeEnvironmentType;
|
|
3176
3467
|
};
|
|
3468
|
+
/** Organization metadata */
|
|
3177
3469
|
organization: {
|
|
3178
3470
|
slug: string;
|
|
3179
3471
|
id: string;
|
|
3180
3472
|
title: string;
|
|
3181
3473
|
};
|
|
3474
|
+
/** Run metadata */
|
|
3182
3475
|
run: {
|
|
3183
3476
|
id: string;
|
|
3184
3477
|
isTest: boolean;
|
|
3185
3478
|
startedAt: Date;
|
|
3186
3479
|
};
|
|
3480
|
+
/** Event metadata */
|
|
3187
3481
|
event: {
|
|
3188
3482
|
id: string;
|
|
3189
3483
|
name: string;
|
|
3190
3484
|
context: any;
|
|
3191
3485
|
timestamp: Date;
|
|
3192
3486
|
};
|
|
3487
|
+
/** Source metadata */
|
|
3488
|
+
source?: {
|
|
3489
|
+
id: string;
|
|
3490
|
+
metadata?: any;
|
|
3491
|
+
};
|
|
3492
|
+
/** Account metadata */
|
|
3193
3493
|
account?: {
|
|
3194
3494
|
id: string;
|
|
3195
3495
|
metadata?: any;
|
|
@@ -3242,6 +3542,12 @@ interface Trigger<TEventSpec extends EventSpecification<any>> {
|
|
|
3242
3542
|
attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpec>, any>): void;
|
|
3243
3543
|
preprocessRuns: boolean;
|
|
3244
3544
|
}
|
|
3545
|
+
type EventSpecificationExample = {
|
|
3546
|
+
id: string;
|
|
3547
|
+
name: string;
|
|
3548
|
+
icon?: string;
|
|
3549
|
+
payload: any;
|
|
3550
|
+
};
|
|
3245
3551
|
interface EventSpecification<TEvent extends any> {
|
|
3246
3552
|
name: string;
|
|
3247
3553
|
title: string;
|
|
@@ -3249,12 +3555,7 @@ interface EventSpecification<TEvent extends any> {
|
|
|
3249
3555
|
icon: string;
|
|
3250
3556
|
properties?: DisplayProperty[];
|
|
3251
3557
|
schema?: any;
|
|
3252
|
-
examples?: Array<
|
|
3253
|
-
id: string;
|
|
3254
|
-
name: string;
|
|
3255
|
-
icon?: string;
|
|
3256
|
-
payload: TEvent;
|
|
3257
|
-
}>;
|
|
3558
|
+
examples?: Array<EventSpecificationExample>;
|
|
3258
3559
|
filter?: EventFilter;
|
|
3259
3560
|
parsePayload: (payload: unknown) => TEvent;
|
|
3260
3561
|
runProperties?: (payload: TEvent) => DisplayProperty[];
|
|
@@ -3325,7 +3626,7 @@ type ExternalSourceOptions<TChannel extends ChannelNames, TIntegration extends T
|
|
|
3325
3626
|
schema: z.Schema<TParams>;
|
|
3326
3627
|
integration: TIntegration;
|
|
3327
3628
|
register: RegisterFunction<TIntegration, TParams, TChannel>;
|
|
3328
|
-
filter
|
|
3629
|
+
filter?: FilterFunction<TParams>;
|
|
3329
3630
|
handler: HandlerFunction<TChannel, TParams>;
|
|
3330
3631
|
key: KeyFunction<TParams>;
|
|
3331
3632
|
properties?: (params: TParams) => DisplayProperty[];
|
|
@@ -3340,7 +3641,7 @@ declare class ExternalSource<TIntegration extends TriggerIntegration<Integration
|
|
|
3340
3641
|
source?: string | undefined;
|
|
3341
3642
|
payload?: any;
|
|
3342
3643
|
context?: any;
|
|
3343
|
-
timestamp?:
|
|
3644
|
+
timestamp?: Date | undefined;
|
|
3344
3645
|
name: string;
|
|
3345
3646
|
}[];
|
|
3346
3647
|
response?: {
|
|
@@ -3361,9 +3662,9 @@ declare class ExternalSource<TIntegration extends TriggerIntegration<Integration
|
|
|
3361
3662
|
get integrationConfig(): {
|
|
3362
3663
|
id: string;
|
|
3363
3664
|
metadata: {
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3665
|
+
instructions?: string | undefined;
|
|
3666
|
+
id: string;
|
|
3667
|
+
name: string;
|
|
3367
3668
|
};
|
|
3368
3669
|
};
|
|
3369
3670
|
get id(): string;
|
|
@@ -3388,41 +3689,72 @@ declare function omit<T extends Record<string, unknown>, K extends keyof T>(obj:
|
|
|
3388
3689
|
ommited: T[K];
|
|
3389
3690
|
};
|
|
3390
3691
|
|
|
3692
|
+
/** Options for a DynamicTrigger */
|
|
3391
3693
|
type DynamicTriggerOptions<TEventSpec extends EventSpecification<any>, TExternalSource extends ExternalSource<any, any, any>> = {
|
|
3694
|
+
/** Used to uniquely identify a DynamicTrigger */
|
|
3392
3695
|
id: string;
|
|
3696
|
+
/** An event from an [Integration](https://trigger.dev/docs/integrations) package that you want to attach to the DynamicTrigger. The event types will come through to the payload in your Job's run. */
|
|
3393
3697
|
event: TEventSpec;
|
|
3698
|
+
/** An external source fron an [Integration](https://trigger.dev/docs/integrations) package
|
|
3699
|
+
* @example
|
|
3700
|
+
* ```ts
|
|
3701
|
+
* import { events } from "@trigger.dev/github";
|
|
3702
|
+
*
|
|
3703
|
+
* const dynamicOnIssueOpened = new DynamicTrigger(client, {
|
|
3704
|
+
id: "github-issue-opened",
|
|
3705
|
+
event: events.onIssueOpened,
|
|
3706
|
+
source: github.sources.repo,
|
|
3707
|
+
});
|
|
3708
|
+
* ```
|
|
3709
|
+
*/
|
|
3394
3710
|
source: TExternalSource;
|
|
3395
3711
|
};
|
|
3712
|
+
/** `DynamicTrigger` allows you to define a trigger that can be configured dynamically at runtime. */
|
|
3396
3713
|
declare class DynamicTrigger<TEventSpec extends EventSpecification<any>, TExternalSource extends ExternalSource<any, any, any>> implements Trigger<TEventSpec> {
|
|
3397
3714
|
#private;
|
|
3398
3715
|
source: TExternalSource;
|
|
3716
|
+
/** `DynamicTrigger` allows you to define a trigger that can be configured dynamically at runtime.
|
|
3717
|
+
* @param client The `TriggerClient` instance to use for registering the trigger.
|
|
3718
|
+
* @param options The options for the dynamic trigger.
|
|
3719
|
+
* */
|
|
3399
3720
|
constructor(client: TriggerClient, options: DynamicTriggerOptions<TEventSpec, TExternalSource>);
|
|
3400
3721
|
toJSON(): TriggerMetadata;
|
|
3401
3722
|
get id(): string;
|
|
3402
3723
|
get event(): TEventSpec;
|
|
3403
3724
|
registeredTriggerForParams(params: ExternalSourceParams<TExternalSource>): RegisterTriggerBody;
|
|
3725
|
+
/** Use this method to register a new configuration with the DynamicTrigger.
|
|
3726
|
+
* @param key The key for the configuration. This will be used to identify the configuration when it is triggered.
|
|
3727
|
+
* @param params The params for the configuration.
|
|
3728
|
+
*/
|
|
3404
3729
|
register(key: string, params: ExternalSourceParams<TExternalSource>): Promise<RegisterSourceEvent>;
|
|
3405
3730
|
attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpec>, any>): void;
|
|
3406
3731
|
get preprocessRuns(): boolean;
|
|
3407
3732
|
}
|
|
3408
3733
|
|
|
3409
3734
|
type TriggerClientOptions = {
|
|
3735
|
+
/** The `id` property is used to uniquely identify the client.
|
|
3736
|
+
*/
|
|
3410
3737
|
id: string;
|
|
3411
|
-
|
|
3738
|
+
/** The `apiKey` property is the API Key for your Trigger.dev environment. We
|
|
3739
|
+
recommend using an environment variable to store your API Key. */
|
|
3412
3740
|
apiKey?: string;
|
|
3741
|
+
/** The `apiUrl` property is an optional property that specifies the API URL. You
|
|
3742
|
+
only need to specify this if you are not using Trigger.dev Cloud and are
|
|
3743
|
+
running your own Trigger.dev instance. */
|
|
3413
3744
|
apiUrl?: string;
|
|
3745
|
+
/** The `logLevel` property is an optional property that specifies the level of
|
|
3746
|
+
logging for the TriggerClient. The level is inherited by all Jobs that use this Client, unless they also specify a `logLevel`. */
|
|
3414
3747
|
logLevel?: LogLevel;
|
|
3748
|
+
/** Very verbose log messages, defaults to false. */
|
|
3749
|
+
verbose?: boolean;
|
|
3750
|
+
/** Default is unset and off. If set to true it will log to the server's console as well as the Trigger.dev platform */
|
|
3751
|
+
ioLogLocalEnabled?: boolean;
|
|
3415
3752
|
};
|
|
3416
|
-
|
|
3417
|
-
url: string;
|
|
3418
|
-
};
|
|
3753
|
+
/** 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). */
|
|
3419
3754
|
declare class TriggerClient {
|
|
3420
3755
|
#private;
|
|
3421
|
-
private _url;
|
|
3422
3756
|
id: string;
|
|
3423
|
-
|
|
3424
|
-
constructor(options: TriggerClientOptions);
|
|
3425
|
-
get url(): string;
|
|
3757
|
+
constructor(options: Prettify<TriggerClientOptions>);
|
|
3426
3758
|
handleRequest(request: Request): Promise<NormalizedResponse>;
|
|
3427
3759
|
attach(job: Job<Trigger<any>, any>): void;
|
|
3428
3760
|
attachDynamicTrigger(trigger: DynamicTrigger<any, any>): void;
|
|
@@ -3463,6 +3795,11 @@ declare class TriggerClient {
|
|
|
3463
3795
|
type: "oauth2";
|
|
3464
3796
|
accessToken: string;
|
|
3465
3797
|
} | undefined>;
|
|
3798
|
+
/** You can call this function from anywhere in your code to send an event. The other way to send an event is by using [`io.sendEvent()`](https://trigger.dev/docs/sdk/io/sendevent) from inside a `run()` function.
|
|
3799
|
+
* @param event The event to send.
|
|
3800
|
+
* @param options Options for sending the event.
|
|
3801
|
+
* @returns A promise that resolves to the event details
|
|
3802
|
+
*/
|
|
3466
3803
|
sendEvent(event: SendEvent, options?: SendEventOptions): Promise<{
|
|
3467
3804
|
context?: DeserializedJson | undefined;
|
|
3468
3805
|
deliverAt?: Date | null | undefined;
|
|
@@ -3493,9 +3830,8 @@ declare class TriggerClient {
|
|
|
3493
3830
|
unregisterSchedule(id: string, key: string): Promise<{
|
|
3494
3831
|
ok: boolean;
|
|
3495
3832
|
}>;
|
|
3496
|
-
authorized(apiKey?: string | null):
|
|
3833
|
+
authorized(apiKey?: string | null): "authorized" | "unauthorized" | "missing-client" | "missing-header";
|
|
3497
3834
|
apiKey(): string | undefined;
|
|
3498
|
-
listen(): Promise<void>;
|
|
3499
3835
|
}
|
|
3500
3836
|
|
|
3501
3837
|
type ScheduledEventSpecification = EventSpecification<ScheduledPayload>;
|
|
@@ -3507,6 +3843,15 @@ declare class IntervalTrigger implements Trigger<ScheduledEventSpecification> {
|
|
|
3507
3843
|
title: string;
|
|
3508
3844
|
source: string;
|
|
3509
3845
|
icon: string;
|
|
3846
|
+
examples: {
|
|
3847
|
+
id: string;
|
|
3848
|
+
name: string;
|
|
3849
|
+
icon: string;
|
|
3850
|
+
payload: {
|
|
3851
|
+
ts: string;
|
|
3852
|
+
lastTimestamp: string;
|
|
3853
|
+
};
|
|
3854
|
+
}[];
|
|
3510
3855
|
parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
|
|
3511
3856
|
lastTimestamp?: Date | undefined;
|
|
3512
3857
|
ts: Date;
|
|
@@ -3520,6 +3865,9 @@ declare class IntervalTrigger implements Trigger<ScheduledEventSpecification> {
|
|
|
3520
3865
|
get preprocessRuns(): boolean;
|
|
3521
3866
|
toJSON(): TriggerMetadata;
|
|
3522
3867
|
}
|
|
3868
|
+
/** `intervalTrigger()` is set as a [Job's trigger](/sdk/job) to trigger a Job at a recurring interval.
|
|
3869
|
+
* @param options An object containing options about the interval.
|
|
3870
|
+
*/
|
|
3523
3871
|
declare function intervalTrigger(options: IntervalOptions): IntervalTrigger;
|
|
3524
3872
|
declare class CronTrigger implements Trigger<ScheduledEventSpecification> {
|
|
3525
3873
|
private options;
|
|
@@ -3529,6 +3877,15 @@ declare class CronTrigger implements Trigger<ScheduledEventSpecification> {
|
|
|
3529
3877
|
title: string;
|
|
3530
3878
|
source: string;
|
|
3531
3879
|
icon: string;
|
|
3880
|
+
examples: {
|
|
3881
|
+
id: string;
|
|
3882
|
+
name: string;
|
|
3883
|
+
icon: string;
|
|
3884
|
+
payload: {
|
|
3885
|
+
ts: string;
|
|
3886
|
+
lastTimestamp: string;
|
|
3887
|
+
};
|
|
3888
|
+
}[];
|
|
3532
3889
|
parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
|
|
3533
3890
|
lastTimestamp?: Date | undefined;
|
|
3534
3891
|
ts: Date;
|
|
@@ -3542,13 +3899,24 @@ declare class CronTrigger implements Trigger<ScheduledEventSpecification> {
|
|
|
3542
3899
|
get preprocessRuns(): boolean;
|
|
3543
3900
|
toJSON(): TriggerMetadata;
|
|
3544
3901
|
}
|
|
3902
|
+
/** `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.
|
|
3903
|
+
* @param options An object containing options about the CRON schedule.
|
|
3904
|
+
*/
|
|
3545
3905
|
declare function cronTrigger(options: CronOptions): CronTrigger;
|
|
3906
|
+
/** DynamicSchedule options
|
|
3907
|
+
* @param id Used to uniquely identify a DynamicSchedule
|
|
3908
|
+
*/
|
|
3546
3909
|
type DynamicIntervalOptions = {
|
|
3547
3910
|
id: string;
|
|
3548
3911
|
};
|
|
3912
|
+
/** DynamicSchedule` allows you to define a scheduled trigger that can be configured dynamically at runtime. */
|
|
3549
3913
|
declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
|
|
3550
3914
|
private client;
|
|
3551
3915
|
private options;
|
|
3916
|
+
/**
|
|
3917
|
+
* @param client The `TriggerClient` instance to use for registering the trigger.
|
|
3918
|
+
* @param options The options for the schedule.
|
|
3919
|
+
*/
|
|
3552
3920
|
constructor(client: TriggerClient, options: DynamicIntervalOptions);
|
|
3553
3921
|
get id(): string;
|
|
3554
3922
|
get event(): {
|
|
@@ -3556,6 +3924,15 @@ declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
|
|
|
3556
3924
|
title: string;
|
|
3557
3925
|
source: string;
|
|
3558
3926
|
icon: string;
|
|
3927
|
+
examples: {
|
|
3928
|
+
id: string;
|
|
3929
|
+
name: string;
|
|
3930
|
+
icon: string;
|
|
3931
|
+
payload: {
|
|
3932
|
+
ts: string;
|
|
3933
|
+
lastTimestamp: string;
|
|
3934
|
+
};
|
|
3935
|
+
}[];
|
|
3559
3936
|
parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
|
|
3560
3937
|
lastTimestamp?: Date | undefined;
|
|
3561
3938
|
ts: Date;
|
|
@@ -3595,6 +3972,8 @@ type IOOptions = {
|
|
|
3595
3972
|
context: TriggerContext;
|
|
3596
3973
|
logger?: Logger;
|
|
3597
3974
|
logLevel?: LogLevel;
|
|
3975
|
+
jobLogger?: Logger;
|
|
3976
|
+
jobLogLevel: LogLevel;
|
|
3598
3977
|
cachedTasks?: Array<CachedTask>;
|
|
3599
3978
|
};
|
|
3600
3979
|
declare class IO {
|
|
@@ -3603,12 +3982,36 @@ declare class IO {
|
|
|
3603
3982
|
private _apiClient;
|
|
3604
3983
|
private _triggerClient;
|
|
3605
3984
|
private _logger;
|
|
3985
|
+
private _jobLogger?;
|
|
3986
|
+
private _jobLogLevel;
|
|
3606
3987
|
private _cachedTasks;
|
|
3607
3988
|
private _taskStorage;
|
|
3608
3989
|
private _context;
|
|
3609
3990
|
constructor(options: IOOptions);
|
|
3991
|
+
/** Used to send log messages to the [Run log](https://trigger.dev/docs/documentation/guides/viewing-runs). */
|
|
3610
3992
|
get logger(): IOLogger;
|
|
3993
|
+
/** `io.wait()` waits for the specified amount of time before continuing the Job. Delays work even if you're on a serverless platform with timeouts, or if your server goes down. They utilize [resumability](https://trigger.dev/docs/documentation/concepts/resumability) to ensure that the Run can be resumed after the delay.
|
|
3994
|
+
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
|
3995
|
+
* @param seconds The number of seconds to wait. This can be very long, serverless timeouts are not an issue.
|
|
3996
|
+
*/
|
|
3611
3997
|
wait(key: string | any[], seconds: number): Promise<void>;
|
|
3998
|
+
/** `io.backgroundFetch()` fetches data from a URL that can take longer that the serverless timeout. The actual `fetch` request is performed on the Trigger.dev platform, and the response is sent back to you.
|
|
3999
|
+
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
|
4000
|
+
* @param url The URL to fetch from.
|
|
4001
|
+
* @param requestInit The options for the request
|
|
4002
|
+
* @param retry The options for retrying the request if it fails
|
|
4003
|
+
* An object where the key is a status code pattern and the value is a retrying strategy.
|
|
4004
|
+
* Supported patterns are:
|
|
4005
|
+
* - Specific status codes: 429
|
|
4006
|
+
* - Ranges: 500-599
|
|
4007
|
+
* - Wildcards: 2xx, 3xx, 4xx, 5xx
|
|
4008
|
+
*/
|
|
4009
|
+
backgroundFetch<TResponseData>(key: string | any[], url: string, requestInit?: FetchRequestInit, retry?: FetchRetryOptions): Promise<TResponseData>;
|
|
4010
|
+
/** `io.sendEvent()` allows you to send an event from inside a Job run. The sent even will trigger any Jobs that are listening for that event (based on the name).
|
|
4011
|
+
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
|
4012
|
+
* @param event The event to send. The event name must match the name of the event that your Jobs are listening for.
|
|
4013
|
+
* @param options Options for sending the event.
|
|
4014
|
+
*/
|
|
3612
4015
|
sendEvent(key: string | any[], event: SendEvent, options?: SendEventOptions): Promise<{
|
|
3613
4016
|
context?: DeserializedJson | undefined;
|
|
3614
4017
|
deliverAt?: Date | null | undefined;
|
|
@@ -3624,6 +4027,13 @@ declare class IO {
|
|
|
3624
4027
|
id: string;
|
|
3625
4028
|
key: string;
|
|
3626
4029
|
}>;
|
|
4030
|
+
/** `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.
|
|
4031
|
+
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
|
4032
|
+
* @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to register a new schedule on.
|
|
4033
|
+
* @param id A unique id for the interval. This is used to identify and unregister the interval later.
|
|
4034
|
+
* @param options The options for the interval.
|
|
4035
|
+
* @returns A promise that has information about the interval.
|
|
4036
|
+
*/
|
|
3627
4037
|
registerInterval(key: string | any[], dynamicSchedule: DynamicSchedule, id: string, options: IntervalOptions): Promise<{
|
|
3628
4038
|
metadata?: any;
|
|
3629
4039
|
id: string;
|
|
@@ -3642,9 +4052,20 @@ declare class IO {
|
|
|
3642
4052
|
};
|
|
3643
4053
|
active: boolean;
|
|
3644
4054
|
}>;
|
|
4055
|
+
/** `io.unregisterInterval()` allows you to unregister a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that was previously registered with `io.registerInterval()`.
|
|
4056
|
+
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
|
4057
|
+
* @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to unregister a schedule on.
|
|
4058
|
+
* @param id A unique id for the interval. This is used to identify and unregister the interval later.
|
|
4059
|
+
*/
|
|
3645
4060
|
unregisterInterval(key: string | any[], dynamicSchedule: DynamicSchedule, id: string): Promise<{
|
|
3646
4061
|
ok: boolean;
|
|
3647
4062
|
}>;
|
|
4063
|
+
/** `io.registerCron()` allows you to register a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that will trigger any jobs it's attached to on a regular CRON schedule.
|
|
4064
|
+
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
|
4065
|
+
* @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to register a new schedule on.
|
|
4066
|
+
* @param id A unique id for the schedule. This is used to identify and unregister the schedule later.
|
|
4067
|
+
* @param options The options for the CRON schedule.
|
|
4068
|
+
*/
|
|
3648
4069
|
registerCron(key: string | any[], dynamicSchedule: DynamicSchedule, id: string, options: CronOptions): Promise<{
|
|
3649
4070
|
metadata?: any;
|
|
3650
4071
|
id: string;
|
|
@@ -3663,27 +4084,59 @@ declare class IO {
|
|
|
3663
4084
|
};
|
|
3664
4085
|
active: boolean;
|
|
3665
4086
|
}>;
|
|
4087
|
+
/** `io.unregisterCron()` allows you to unregister a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that was previously registered with `io.registerCron()`.
|
|
4088
|
+
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
|
4089
|
+
* @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to unregister a schedule on.
|
|
4090
|
+
* @param id A unique id for the interval. This is used to identify and unregister the interval later.
|
|
4091
|
+
*/
|
|
3666
4092
|
unregisterCron(key: string | any[], dynamicSchedule: DynamicSchedule, id: string): Promise<{
|
|
3667
4093
|
ok: boolean;
|
|
3668
4094
|
}>;
|
|
4095
|
+
/** `io.registerTrigger()` allows you to register a [DynamicTrigger](https://trigger.dev/docs/sdk/dynamictrigger) with the specified trigger params.
|
|
4096
|
+
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
|
4097
|
+
* @param trigger The [DynamicTrigger](https://trigger.dev/docs/sdk/dynamictrigger) to register.
|
|
4098
|
+
* @param id A unique id for the trigger. This is used to identify and unregister the trigger later.
|
|
4099
|
+
* @param params The params for the trigger.
|
|
4100
|
+
*/
|
|
3669
4101
|
registerTrigger<TTrigger extends DynamicTrigger<EventSpecification<any>, ExternalSource<any, any, any>>>(key: string | any[], trigger: TTrigger, id: string, params: ExternalSourceParams<TTrigger["source"]>): Promise<{
|
|
3670
4102
|
id: string;
|
|
3671
4103
|
key: string;
|
|
3672
4104
|
} | undefined>;
|
|
3673
4105
|
getAuth(key: string | any[], clientId?: string): Promise<ConnectionAuth | undefined>;
|
|
4106
|
+
/** `io.runTask()` allows you to run a [Task](https://trigger.dev/docs/documentation/concepts/tasks) from inside a Job run. A Task is a resumable unit of a Run that can be retried, resumed and is logged. [Integrations](https://trigger.dev/docs/integrations) use Tasks internally to perform their actions.
|
|
4107
|
+
*
|
|
4108
|
+
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
|
4109
|
+
* @param options The options of how you'd like to run and log the Task. Name is required.
|
|
4110
|
+
* @param callback The callback that will be called when the Task is run. The callback receives the Task and the IO as parameters.
|
|
4111
|
+
= * @param onError The callback that will be called when the Task fails. The callback receives the error, the Task and the IO as parameters. If you wish to retry then return an object with a `retryAt` property.
|
|
4112
|
+
* @returns A Promise that resolves with the returned value of the callback.
|
|
4113
|
+
*/
|
|
3674
4114
|
runTask<TResult extends SerializableJson | void = void>(key: string | any[], options: RunTaskOptions, callback: (task: IOTask, io: IO) => Promise<TResult>, onError?: (error: unknown, task: IOTask, io: IO) => {
|
|
3675
4115
|
retryAt: Date;
|
|
3676
4116
|
error?: Error;
|
|
4117
|
+
jitter?: number;
|
|
3677
4118
|
} | undefined | void): Promise<TResult>;
|
|
4119
|
+
/** `io.try()` allows you to run Tasks and catch any errors that are thrown, it's similar to a normal `try/catch` block but works with [io.runTask()](/sdk/io/runtask).
|
|
4120
|
+
* A regular `try/catch` block on its own won't work as expected with Tasks. Internally `runTask()` throws some special errors to control flow execution. This is necessary to deal with resumability, serverless timeouts, and retrying Tasks.
|
|
4121
|
+
* @param tryCallback The code you wish to run
|
|
4122
|
+
* @param catchCallback Thhis will be called if the Task fails. The callback receives the error
|
|
4123
|
+
* @returns A Promise that resolves with the returned value or the error
|
|
4124
|
+
*/
|
|
3678
4125
|
try<TResult, TCatchResult>(tryCallback: () => Promise<TResult>, catchCallback: (error: unknown) => Promise<TCatchResult>): Promise<TResult | TCatchResult>;
|
|
3679
4126
|
}
|
|
3680
|
-
type CallbackFunction = (level: "DEBUG" | "INFO" | "WARN" | "ERROR", message: string, properties?: Record<string, any>) => Promise<void>;
|
|
4127
|
+
type CallbackFunction = (level: "DEBUG" | "INFO" | "WARN" | "ERROR" | "LOG", message: string, properties?: Record<string, any>) => Promise<void>;
|
|
3681
4128
|
declare class IOLogger implements TaskLogger {
|
|
3682
4129
|
private callback;
|
|
3683
4130
|
constructor(callback: CallbackFunction);
|
|
4131
|
+
/** Log: essential messages */
|
|
4132
|
+
log(message: string, properties?: Record<string, any>): Promise<void>;
|
|
4133
|
+
/** For debugging: the least important log level */
|
|
3684
4134
|
debug(message: string, properties?: Record<string, any>): Promise<void>;
|
|
4135
|
+
/** Info: the second least important log level */
|
|
3685
4136
|
info(message: string, properties?: Record<string, any>): Promise<void>;
|
|
4137
|
+
/** Warnings: the third most important log level */
|
|
3686
4138
|
warn(message: string, properties?: Record<string, any>): Promise<void>;
|
|
4139
|
+
/** Error: The second most important log level */
|
|
3687
4140
|
error(message: string, properties?: Record<string, any>): Promise<void>;
|
|
3688
4141
|
}
|
|
3689
4142
|
|
|
@@ -3693,17 +4146,18 @@ interface TriggerIntegration<TIntegrationClient extends IntegrationClient<any, a
|
|
|
3693
4146
|
id: string;
|
|
3694
4147
|
metadata: IntegrationMetadata;
|
|
3695
4148
|
}
|
|
3696
|
-
type IntegrationClient<TClient, TTasks extends Record<string, AuthenticatedTask<TClient, any, any>>> = {
|
|
4149
|
+
type IntegrationClient<TClient, TTasks extends Record<string, AuthenticatedTask<TClient, any, any, any>>> = {
|
|
3697
4150
|
usesLocalAuth: true;
|
|
3698
4151
|
client: TClient;
|
|
3699
4152
|
tasks?: TTasks;
|
|
4153
|
+
auth: any;
|
|
3700
4154
|
} | {
|
|
3701
4155
|
usesLocalAuth: false;
|
|
3702
4156
|
clientFactory: ClientFactory<TClient>;
|
|
3703
4157
|
tasks?: TTasks;
|
|
3704
4158
|
};
|
|
3705
|
-
type AuthenticatedTask<TClient, TParams, TResult> = {
|
|
3706
|
-
run: (params: TParams, client: TClient, task: ServerTask, io: IO) => Promise<TResult>;
|
|
4159
|
+
type AuthenticatedTask<TClient, TParams, TResult, TAuth = ConnectionAuth> = {
|
|
4160
|
+
run: (params: TParams, client: TClient, task: ServerTask, io: IO, auth: TAuth) => Promise<TResult>;
|
|
3707
4161
|
init: (params: TParams) => RunTaskOptions;
|
|
3708
4162
|
onError?: (error: unknown, task: ServerTask) => {
|
|
3709
4163
|
retryAt: Date;
|
|
@@ -3714,8 +4168,8 @@ declare function authenticatedTask<TClient, TParams, TResult>(options: {
|
|
|
3714
4168
|
run: (params: TParams, client: TClient, task: ServerTask, io: IO) => Promise<TResult>;
|
|
3715
4169
|
init: (params: TParams) => RunTaskOptions;
|
|
3716
4170
|
}): AuthenticatedTask<TClient, TParams, TResult>;
|
|
3717
|
-
type ExtractRunFunction<T> = T extends AuthenticatedTask<any, infer TParams, infer TResult> ? (key: string, params: TParams) => Promise<TResult> : never;
|
|
3718
|
-
type ExtractTasks<TTasks extends Record<string, AuthenticatedTask<any, any, any>>> = {
|
|
4171
|
+
type ExtractRunFunction<T> = T extends AuthenticatedTask<any, infer TParams, infer TResult, infer TAuth> ? (key: string, params: TParams) => Promise<TResult> : never;
|
|
4172
|
+
type ExtractTasks<TTasks extends Record<string, AuthenticatedTask<any, any, any, any>>> = {
|
|
3719
4173
|
[key in keyof TTasks]: ExtractRunFunction<TTasks[key]>;
|
|
3720
4174
|
};
|
|
3721
4175
|
type ExtractIntegrationClientClient<TIntegrationClient extends IntegrationClient<any, any>> = TIntegrationClient extends {
|
|
@@ -3736,28 +4190,69 @@ type ExtractIntegrations<TIntegrations extends Record<string, TriggerIntegration
|
|
|
3736
4190
|
type IOWithIntegrations<TIntegrations extends Record<string, TriggerIntegration<IntegrationClient<any, any>>>> = IO & ExtractIntegrations<TIntegrations>;
|
|
3737
4191
|
|
|
3738
4192
|
type JobOptions<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration<IntegrationClient<any, any>>> = {}> = {
|
|
4193
|
+
/** The `id` property is used to uniquely identify the Job. Only change this if you want to create a new Job. */
|
|
3739
4194
|
id: string;
|
|
4195
|
+
/** The `name` of the Job that you want to appear in the dashboard and logs. You can change this without creating a new Job. */
|
|
3740
4196
|
name: string;
|
|
4197
|
+
/** The `version` property is used to version your Job. A new version will be created if you change this property. We recommend using [semantic versioning](https://www.baeldung.com/cs/semantic-versioning), e.g. `1.0.3`. */
|
|
3741
4198
|
version: string;
|
|
4199
|
+
/** The `trigger` property is used to define when the Job should run. There are currently the following Trigger types:
|
|
4200
|
+
- [cronTrigger](https://trigger.dev/docs/sdk/crontrigger)
|
|
4201
|
+
- [intervalTrigger](https://trigger.dev/docs/sdk/intervaltrigger)
|
|
4202
|
+
- [eventTrigger](https://trigger.dev/docs/sdk/eventtrigger)
|
|
4203
|
+
- [DynamicTrigger](https://trigger.dev/docs/sdk/dynamictrigger)
|
|
4204
|
+
- [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule)
|
|
4205
|
+
- integration Triggers, like webhooks. See the [integrations](https://trigger.dev/docs/integrations) page for more information. */
|
|
3742
4206
|
trigger: TTrigger;
|
|
4207
|
+
/** The `logLevel` property is an optional property that specifies the level of
|
|
4208
|
+
logging for the Job. The level is inherited from the client if you omit this property. */
|
|
3743
4209
|
logLevel?: LogLevel;
|
|
4210
|
+
/** Imports the specified integrations into the Job. The integrations will be available on the `io` object in the `run()` function with the same name as the key. For example:
|
|
4211
|
+
```ts
|
|
4212
|
+
new Job(client, {
|
|
4213
|
+
//... other options
|
|
4214
|
+
integrations: {
|
|
4215
|
+
slack,
|
|
4216
|
+
gh: github,
|
|
4217
|
+
},
|
|
4218
|
+
run: async (payload, io, ctx) => {
|
|
4219
|
+
//slack is available on io.slack
|
|
4220
|
+
io.slack.postMessage(...);
|
|
4221
|
+
//github is available on io.gh
|
|
4222
|
+
io.gh.addIssueLabels(...);
|
|
4223
|
+
}
|
|
4224
|
+
});
|
|
4225
|
+
``` */
|
|
3744
4226
|
integrations?: TIntegrations;
|
|
4227
|
+
/** The `queue` property is used to specify a custom queue. If you use an Object and specify the `maxConcurrent` option, you can control how many simulataneous runs can happen. */
|
|
3745
4228
|
queue?: QueueOptions | string;
|
|
3746
4229
|
startPosition?: "initial" | "latest";
|
|
4230
|
+
/** The `enabled` property is used to enable or disable the Job. If you disable a Job, it will not run. */
|
|
3747
4231
|
enabled?: boolean;
|
|
3748
|
-
|
|
4232
|
+
/** This function gets called automatically when a Run is Triggered.
|
|
4233
|
+
* This is where you put the code you want to run for a Job. You can use normal code in here and you can also use Tasks. You can return a value from this function and it will be sent back to the Trigger API.
|
|
4234
|
+
* @param payload The payload of the event
|
|
4235
|
+
* @param io An object that contains the integrations that you specified in the `integrations` property and other useful functions like delays and running Tasks.
|
|
4236
|
+
* @param context An object that contains information about the Organization, Job, Run and more.
|
|
4237
|
+
*/
|
|
4238
|
+
run: (payload: TriggerEventType<TTrigger>, io: IOWithIntegrations<TIntegrations>, context: TriggerContext) => Promise<any>;
|
|
3749
4239
|
};
|
|
4240
|
+
/** A [Job](https://trigger.dev/docs/documentation/concepts/jobs) is used to define the [Trigger](https://trigger.dev/docs/documentation/concepts/triggers), metadata, and what happens when it runs. */
|
|
3750
4241
|
declare class Job<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration<IntegrationClient<any, any>>> = {}> {
|
|
3751
4242
|
#private;
|
|
3752
4243
|
readonly options: JobOptions<TTrigger, TIntegrations>;
|
|
3753
4244
|
client: TriggerClient;
|
|
3754
|
-
constructor(
|
|
4245
|
+
constructor(
|
|
4246
|
+
/** An instance of [TriggerClient](/sdk/triggerclient) that is used to send events
|
|
4247
|
+
to the Trigger API. */
|
|
4248
|
+
client: TriggerClient, options: JobOptions<TTrigger, TIntegrations>);
|
|
3755
4249
|
get id(): string;
|
|
3756
4250
|
get enabled(): boolean;
|
|
3757
4251
|
get name(): string;
|
|
3758
4252
|
get trigger(): TTrigger;
|
|
3759
4253
|
get version(): string;
|
|
3760
4254
|
get integrations(): Record<string, IntegrationConfig>;
|
|
4255
|
+
get logLevel(): LogLevel | undefined;
|
|
3761
4256
|
toJSON(): JobMetadata;
|
|
3762
4257
|
}
|
|
3763
4258
|
|
|
@@ -3775,12 +4270,40 @@ declare class EventTrigger<TEventSpecification extends EventSpecification<any>>
|
|
|
3775
4270
|
attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpecification>, any>): void;
|
|
3776
4271
|
get preprocessRuns(): boolean;
|
|
3777
4272
|
}
|
|
4273
|
+
/** Configuration options for an EventTrigger */
|
|
3778
4274
|
type TriggerOptions<TEvent> = {
|
|
4275
|
+
/** The name of the event you are subscribing to. Must be an exact match (case sensitive). */
|
|
3779
4276
|
name: string;
|
|
4277
|
+
/** A [Zod](https://trigger.dev/docs/documentation/guides/zod) schema that defines the shape of the event payload.
|
|
4278
|
+
* The default is `z.any()` which is `any`.
|
|
4279
|
+
* */
|
|
3780
4280
|
schema?: z.Schema<TEvent>;
|
|
4281
|
+
/** You can use this to filter events based on the source. */
|
|
3781
4282
|
source?: string;
|
|
4283
|
+
/** Used to filter which events trigger the Job
|
|
4284
|
+
* @example
|
|
4285
|
+
* filter:
|
|
4286
|
+
* ```ts
|
|
4287
|
+
* {
|
|
4288
|
+
* name: ["John", "Jane"],
|
|
4289
|
+
* age: [18, 21]
|
|
4290
|
+
* }
|
|
4291
|
+
* ```
|
|
4292
|
+
*
|
|
4293
|
+
* This filter would match against an event with the following data:
|
|
4294
|
+
* ```json
|
|
4295
|
+
* {
|
|
4296
|
+
* "name": "Jane",
|
|
4297
|
+
* "age": 18,
|
|
4298
|
+
* "location": "San Francisco"
|
|
4299
|
+
* }
|
|
4300
|
+
* ```
|
|
4301
|
+
*/
|
|
3782
4302
|
filter?: EventFilter;
|
|
3783
4303
|
};
|
|
4304
|
+
/** `eventTrigger()` is set as a [Job's trigger](https://trigger.dev/docs/sdk/job) to subscribe to an event a Job from [a sent event](https://trigger.dev/docs/sdk/triggerclient/instancemethods/sendevent)
|
|
4305
|
+
* @param options options for the EventTrigger
|
|
4306
|
+
*/
|
|
3784
4307
|
declare function eventTrigger<TEvent extends any = any>(options: TriggerOptions<TEvent>): Trigger<EventSpecification<TEvent>>;
|
|
3785
4308
|
|
|
3786
4309
|
declare function missingConnectionNotification(integrations: Array<TriggerIntegration>): MissingConnectionNotification;
|
|
@@ -3806,8 +4329,6 @@ declare class MissingConnectionNotification implements Trigger<MissingConnection
|
|
|
3806
4329
|
title: string;
|
|
3807
4330
|
createdAt: Date;
|
|
3808
4331
|
updatedAt: Date;
|
|
3809
|
-
integrationIdentifier: string;
|
|
3810
|
-
integrationAuthMethod: string;
|
|
3811
4332
|
};
|
|
3812
4333
|
authorizationUrl: string;
|
|
3813
4334
|
} | {
|
|
@@ -3823,8 +4344,6 @@ declare class MissingConnectionNotification implements Trigger<MissingConnection
|
|
|
3823
4344
|
title: string;
|
|
3824
4345
|
createdAt: Date;
|
|
3825
4346
|
updatedAt: Date;
|
|
3826
|
-
integrationIdentifier: string;
|
|
3827
|
-
integrationAuthMethod: string;
|
|
3828
4347
|
};
|
|
3829
4348
|
authorizationUrl: string;
|
|
3830
4349
|
};
|
|
@@ -3897,9 +4416,15 @@ declare class RetryWithTaskError {
|
|
|
3897
4416
|
retryAt: Date;
|
|
3898
4417
|
constructor(cause: ErrorWithStack, task: ServerTask, retryAt: Date);
|
|
3899
4418
|
}
|
|
4419
|
+
/** Use this function if you're using a `try/catch` block to catch errors.
|
|
4420
|
+
* It checks if a thrown error is a special internal error that you should ignore.
|
|
4421
|
+
* If this returns `true` then you must rethrow the error: `throw err;`
|
|
4422
|
+
* @param err The error to check
|
|
4423
|
+
* @returns `true` if the error is a Trigger Error, `false` otherwise.
|
|
4424
|
+
*/
|
|
3900
4425
|
declare function isTriggerError(err: unknown): err is ResumeWithTaskError | RetryWithTaskError;
|
|
3901
4426
|
|
|
3902
4427
|
type Task = ServerTask;
|
|
3903
|
-
declare function
|
|
4428
|
+
declare function redactString(strings: TemplateStringsArray, ...interpolations: string[]): RedactString;
|
|
3904
4429
|
|
|
3905
|
-
export { AuthenticatedTask, ClientFactory, CronTrigger, DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, DynamicTriggerOptions, EventFilter, EventSpecification, EventTrigger, EventTypeFromSpecification, ExternalSource, ExternalSourceParams, ExternalSourceTrigger, ExternalSourceTriggerOptions, HandlerEvent, HttpSourceEvent, IO, IOLogger, IOOptions, IOTask, IOWithIntegrations, IntegrationClient, IntervalTrigger, Job, JobOptions,
|
|
4430
|
+
export { AuthenticatedTask, ClientFactory, CronTrigger, DynamicIntervalOptions, DynamicSchedule, DynamicTrigger, DynamicTriggerOptions, EventFilter, EventSpecification, EventSpecificationExample, EventTrigger, EventTypeFromSpecification, ExternalSource, ExternalSourceParams, ExternalSourceTrigger, ExternalSourceTriggerOptions, HandlerEvent, HttpSourceEvent, IO, IOLogger, IOOptions, IOTask, IOWithIntegrations, IntegrationClient, IntervalTrigger, Job, JobOptions, Logger, MissingConnectionNotification, MissingConnectionResolvedNotification, NormalizedRequest, PreprocessResults, RedactString, Task, TaskLogger, Trigger, TriggerClient, TriggerClientOptions, TriggerContext, TriggerEventType, TriggerIntegration, TriggerPreprocessContext, authenticatedTask, cronTrigger, eventTrigger, intervalTrigger, isTriggerError, missingConnectionNotification, missingConnectionResolvedNotification, omit, redactString };
|