@trigger.dev/sdk 2.0.0-next.1 → 2.0.0-next.10
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 +776 -291
- package/dist/index.js +365 -163
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
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;
|
|
@@ -537,32 +550,35 @@ declare const JobMetadataSchema: z.ZodObject<{
|
|
|
537
550
|
integrations: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
538
551
|
id: z.ZodString;
|
|
539
552
|
metadata: z.ZodObject<{
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
553
|
+
id: z.ZodString;
|
|
554
|
+
name: z.ZodString;
|
|
555
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
543
556
|
}, "strip", z.ZodTypeAny, {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
557
|
+
instructions?: string | undefined;
|
|
558
|
+
id: string;
|
|
559
|
+
name: string;
|
|
547
560
|
}, {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
561
|
+
instructions?: string | undefined;
|
|
562
|
+
id: string;
|
|
563
|
+
name: string;
|
|
551
564
|
}>;
|
|
565
|
+
authSource: z.ZodEnum<["HOSTED", "LOCAL"]>;
|
|
552
566
|
}, "strip", z.ZodTypeAny, {
|
|
553
567
|
id: string;
|
|
554
568
|
metadata: {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
569
|
+
instructions?: string | undefined;
|
|
570
|
+
id: string;
|
|
571
|
+
name: string;
|
|
558
572
|
};
|
|
573
|
+
authSource: "HOSTED" | "LOCAL";
|
|
559
574
|
}, {
|
|
560
575
|
id: string;
|
|
561
576
|
metadata: {
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
577
|
+
instructions?: string | undefined;
|
|
578
|
+
id: string;
|
|
579
|
+
name: string;
|
|
565
580
|
};
|
|
581
|
+
authSource: "HOSTED" | "LOCAL";
|
|
566
582
|
}>>;
|
|
567
583
|
internal: z.ZodDefault<z.ZodBoolean>;
|
|
568
584
|
queue: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
@@ -641,10 +657,11 @@ declare const JobMetadataSchema: z.ZodObject<{
|
|
|
641
657
|
integrations: Record<string, {
|
|
642
658
|
id: string;
|
|
643
659
|
metadata: {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
660
|
+
instructions?: string | undefined;
|
|
661
|
+
id: string;
|
|
662
|
+
name: string;
|
|
647
663
|
};
|
|
664
|
+
authSource: "HOSTED" | "LOCAL";
|
|
648
665
|
}>;
|
|
649
666
|
internal: boolean;
|
|
650
667
|
startPosition: "initial" | "latest";
|
|
@@ -714,10 +731,11 @@ declare const JobMetadataSchema: z.ZodObject<{
|
|
|
714
731
|
integrations: Record<string, {
|
|
715
732
|
id: string;
|
|
716
733
|
metadata: {
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
734
|
+
instructions?: string | undefined;
|
|
735
|
+
id: string;
|
|
736
|
+
name: string;
|
|
720
737
|
};
|
|
738
|
+
authSource: "HOSTED" | "LOCAL";
|
|
721
739
|
}>;
|
|
722
740
|
startPosition: "initial" | "latest";
|
|
723
741
|
enabled: boolean;
|
|
@@ -725,17 +743,34 @@ declare const JobMetadataSchema: z.ZodObject<{
|
|
|
725
743
|
}>;
|
|
726
744
|
type JobMetadata = z.infer<typeof JobMetadataSchema>;
|
|
727
745
|
declare const RawEventSchema: z.ZodObject<{
|
|
728
|
-
|
|
746
|
+
/** The `name` property must exactly match any subscriptions you want to
|
|
747
|
+
trigger. */
|
|
729
748
|
name: z.ZodString;
|
|
730
|
-
|
|
749
|
+
/** The `payload` property will be sent to any matching Jobs and will appear
|
|
750
|
+
as the `payload` param of the `run()` function. You can leave this
|
|
751
|
+
parameter out if you just want to trigger a Job without any input data. */
|
|
731
752
|
payload: z.ZodAny;
|
|
753
|
+
/** The optional `context` property will be sent to any matching Jobs and will
|
|
754
|
+
be passed through as the `context.event.context` param of the `run()`
|
|
755
|
+
function. This is optional but can be useful if you want to pass through
|
|
756
|
+
some additional context to the Job. */
|
|
732
757
|
context: z.ZodOptional<z.ZodAny>;
|
|
733
|
-
|
|
758
|
+
/** The `id` property uniquely identify this particular event. If unset it
|
|
759
|
+
will be set automatically using `ulid`. */
|
|
760
|
+
id: z.ZodDefault<z.ZodString>;
|
|
761
|
+
/** This is optional, it defaults to the current timestamp. Usually you would
|
|
762
|
+
only set this if you have a timestamp that you wish to pass through, e.g.
|
|
763
|
+
you receive a timestamp from a service and you want the same timestamp to
|
|
764
|
+
be used in your Job. */
|
|
765
|
+
timestamp: z.ZodOptional<z.ZodDate>;
|
|
766
|
+
/** This is optional, it defaults to "trigger.dev". It can be useful to set
|
|
767
|
+
this as you can filter events using this in the `eventTrigger()`. */
|
|
768
|
+
source: z.ZodOptional<z.ZodString>;
|
|
734
769
|
}, "strip", z.ZodTypeAny, {
|
|
735
770
|
source?: string | undefined;
|
|
736
771
|
payload?: any;
|
|
737
772
|
context?: any;
|
|
738
|
-
timestamp?:
|
|
773
|
+
timestamp?: Date | undefined;
|
|
739
774
|
id: string;
|
|
740
775
|
name: string;
|
|
741
776
|
}, {
|
|
@@ -743,20 +778,30 @@ declare const RawEventSchema: z.ZodObject<{
|
|
|
743
778
|
source?: string | undefined;
|
|
744
779
|
payload?: any;
|
|
745
780
|
context?: any;
|
|
746
|
-
timestamp?:
|
|
781
|
+
timestamp?: Date | undefined;
|
|
747
782
|
name: string;
|
|
748
783
|
}>;
|
|
784
|
+
/** The event you wish to send to Trigger a Job */
|
|
749
785
|
type SendEvent = z.input<typeof RawEventSchema>;
|
|
786
|
+
/** Options to control the delivery of the event */
|
|
750
787
|
declare const SendEventOptionsSchema: z.ZodObject<{
|
|
751
|
-
|
|
788
|
+
/** An optional Date when you want the event to trigger Jobs. The event will
|
|
789
|
+
be sent to the platform immediately but won't be acted upon until the
|
|
790
|
+
specified time. */
|
|
791
|
+
deliverAt: z.ZodOptional<z.ZodDate>;
|
|
792
|
+
/** An optional number of seconds you want to wait for the event to trigger
|
|
793
|
+
any relevant Jobs. The event will be sent to the platform immediately but
|
|
794
|
+
won't be delivered until after the elapsed number of seconds. */
|
|
752
795
|
deliverAfter: z.ZodOptional<z.ZodNumber>;
|
|
796
|
+
/** This optional param will be used by Trigger.dev Connect, which
|
|
797
|
+
is coming soon. */
|
|
753
798
|
accountId: z.ZodOptional<z.ZodString>;
|
|
754
799
|
}, "strip", z.ZodTypeAny, {
|
|
755
|
-
deliverAt?:
|
|
800
|
+
deliverAt?: Date | undefined;
|
|
756
801
|
deliverAfter?: number | undefined;
|
|
757
802
|
accountId?: string | undefined;
|
|
758
803
|
}, {
|
|
759
|
-
deliverAt?:
|
|
804
|
+
deliverAt?: Date | undefined;
|
|
760
805
|
deliverAfter?: number | undefined;
|
|
761
806
|
accountId?: string | undefined;
|
|
762
807
|
}>;
|
|
@@ -992,32 +1037,35 @@ declare const CreateRunBodySchema: z.ZodObject<{
|
|
|
992
1037
|
integrations: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
993
1038
|
id: z.ZodString;
|
|
994
1039
|
metadata: z.ZodObject<{
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1040
|
+
id: z.ZodString;
|
|
1041
|
+
name: z.ZodString;
|
|
1042
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
998
1043
|
}, "strip", z.ZodTypeAny, {
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1044
|
+
instructions?: string | undefined;
|
|
1045
|
+
id: string;
|
|
1046
|
+
name: string;
|
|
1002
1047
|
}, {
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1048
|
+
instructions?: string | undefined;
|
|
1049
|
+
id: string;
|
|
1050
|
+
name: string;
|
|
1006
1051
|
}>;
|
|
1052
|
+
authSource: z.ZodEnum<["HOSTED", "LOCAL"]>;
|
|
1007
1053
|
}, "strip", z.ZodTypeAny, {
|
|
1008
1054
|
id: string;
|
|
1009
1055
|
metadata: {
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1056
|
+
instructions?: string | undefined;
|
|
1057
|
+
id: string;
|
|
1058
|
+
name: string;
|
|
1013
1059
|
};
|
|
1060
|
+
authSource: "HOSTED" | "LOCAL";
|
|
1014
1061
|
}, {
|
|
1015
1062
|
id: string;
|
|
1016
1063
|
metadata: {
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1064
|
+
instructions?: string | undefined;
|
|
1065
|
+
id: string;
|
|
1066
|
+
name: string;
|
|
1020
1067
|
};
|
|
1068
|
+
authSource: "HOSTED" | "LOCAL";
|
|
1021
1069
|
}>>;
|
|
1022
1070
|
internal: z.ZodDefault<z.ZodBoolean>;
|
|
1023
1071
|
queue: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
@@ -1096,10 +1144,11 @@ declare const CreateRunBodySchema: z.ZodObject<{
|
|
|
1096
1144
|
integrations: Record<string, {
|
|
1097
1145
|
id: string;
|
|
1098
1146
|
metadata: {
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1147
|
+
instructions?: string | undefined;
|
|
1148
|
+
id: string;
|
|
1149
|
+
name: string;
|
|
1102
1150
|
};
|
|
1151
|
+
authSource: "HOSTED" | "LOCAL";
|
|
1103
1152
|
}>;
|
|
1104
1153
|
internal: boolean;
|
|
1105
1154
|
startPosition: "initial" | "latest";
|
|
@@ -1169,22 +1218,35 @@ declare const CreateRunBodySchema: z.ZodObject<{
|
|
|
1169
1218
|
integrations: Record<string, {
|
|
1170
1219
|
id: string;
|
|
1171
1220
|
metadata: {
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1221
|
+
instructions?: string | undefined;
|
|
1222
|
+
id: string;
|
|
1223
|
+
name: string;
|
|
1175
1224
|
};
|
|
1225
|
+
authSource: "HOSTED" | "LOCAL";
|
|
1176
1226
|
}>;
|
|
1177
1227
|
startPosition: "initial" | "latest";
|
|
1178
1228
|
enabled: boolean;
|
|
1179
1229
|
preprocessRuns: boolean;
|
|
1180
1230
|
}>;
|
|
1181
1231
|
event: z.ZodObject<{
|
|
1232
|
+
/** The `id` of the event that was sent.
|
|
1233
|
+
*/
|
|
1182
1234
|
id: z.ZodString;
|
|
1235
|
+
/** The `name` of the event that was sent. */
|
|
1183
1236
|
name: z.ZodString;
|
|
1237
|
+
/** The `payload` of the event that was sent */
|
|
1184
1238
|
payload: z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>;
|
|
1239
|
+
/** The `context` of the event that was sent. Is `undefined` if no context was
|
|
1240
|
+
set when sending the event. */
|
|
1185
1241
|
context: z.ZodNullable<z.ZodOptional<z.ZodType<DeserializedJson, z.ZodTypeDef, DeserializedJson>>>;
|
|
1242
|
+
/** The `timestamp` of the event that was sent */
|
|
1186
1243
|
timestamp: z.ZodDate;
|
|
1244
|
+
/** The timestamp when the event will be delivered to any matching Jobs. Is
|
|
1245
|
+
`undefined` if `deliverAt` or `deliverAfter` wasn't set when sending the
|
|
1246
|
+
event. */
|
|
1187
1247
|
deliverAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
1248
|
+
/** The timestamp when the event was delivered. Is `undefined` if `deliverAt`
|
|
1249
|
+
or `deliverAfter` were set when sending the event. */
|
|
1188
1250
|
deliveredAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
|
|
1189
1251
|
}, "strip", z.ZodTypeAny, {
|
|
1190
1252
|
context?: DeserializedJson | undefined;
|
|
@@ -1294,10 +1356,11 @@ declare const CreateRunBodySchema: z.ZodObject<{
|
|
|
1294
1356
|
integrations: Record<string, {
|
|
1295
1357
|
id: string;
|
|
1296
1358
|
metadata: {
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1359
|
+
instructions?: string | undefined;
|
|
1360
|
+
id: string;
|
|
1361
|
+
name: string;
|
|
1300
1362
|
};
|
|
1363
|
+
authSource: "HOSTED" | "LOCAL";
|
|
1301
1364
|
}>;
|
|
1302
1365
|
internal: boolean;
|
|
1303
1366
|
startPosition: "initial" | "latest";
|
|
@@ -1384,10 +1447,11 @@ declare const CreateRunBodySchema: z.ZodObject<{
|
|
|
1384
1447
|
integrations: Record<string, {
|
|
1385
1448
|
id: string;
|
|
1386
1449
|
metadata: {
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1450
|
+
instructions?: string | undefined;
|
|
1451
|
+
id: string;
|
|
1452
|
+
name: string;
|
|
1390
1453
|
};
|
|
1454
|
+
authSource: "HOSTED" | "LOCAL";
|
|
1391
1455
|
}>;
|
|
1392
1456
|
startPosition: "initial" | "latest";
|
|
1393
1457
|
enabled: boolean;
|
|
@@ -1396,28 +1460,60 @@ declare const CreateRunBodySchema: z.ZodObject<{
|
|
|
1396
1460
|
client: string;
|
|
1397
1461
|
}>;
|
|
1398
1462
|
type CreateRunBody = z.infer<typeof CreateRunBodySchema>;
|
|
1399
|
-
declare const
|
|
1400
|
-
|
|
1463
|
+
declare const RedactStringSchema: z.ZodObject<{
|
|
1464
|
+
__redactedString: z.ZodLiteral<true>;
|
|
1401
1465
|
strings: z.ZodArray<z.ZodString, "many">;
|
|
1402
1466
|
interpolations: z.ZodArray<z.ZodString, "many">;
|
|
1403
1467
|
}, "strip", z.ZodTypeAny, {
|
|
1404
|
-
|
|
1468
|
+
__redactedString: true;
|
|
1405
1469
|
strings: string[];
|
|
1406
1470
|
interpolations: string[];
|
|
1407
1471
|
}, {
|
|
1408
|
-
|
|
1472
|
+
__redactedString: true;
|
|
1409
1473
|
strings: string[];
|
|
1410
1474
|
interpolations: string[];
|
|
1411
1475
|
}>;
|
|
1412
|
-
type
|
|
1476
|
+
type RedactString = z.infer<typeof RedactStringSchema>;
|
|
1413
1477
|
type CachedTask = z.infer<typeof CachedTaskSchema>;
|
|
1414
1478
|
declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
1479
|
+
/** The name of the Task is required. This is displayed on the Task in the logs. */
|
|
1415
1480
|
name: z.ZodString;
|
|
1481
|
+
/** The Task will wait and only start at the specified Date */
|
|
1482
|
+
delayUntil: z.ZodOptional<z.ZodDate>;
|
|
1483
|
+
/** Retry options */
|
|
1484
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
1485
|
+
/** The maximum number of times to retry the request. */
|
|
1486
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
1487
|
+
/** The exponential factor to use when calculating the next retry time. */
|
|
1488
|
+
factor: z.ZodOptional<z.ZodNumber>;
|
|
1489
|
+
/** The minimum amount of time to wait before retrying the request. */
|
|
1490
|
+
minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
1491
|
+
/** The maximum amount of time to wait before retrying the request. */
|
|
1492
|
+
maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
1493
|
+
/** Whether to randomize the retry time. */
|
|
1494
|
+
randomize: z.ZodOptional<z.ZodBoolean>;
|
|
1495
|
+
}, "strip", z.ZodTypeAny, {
|
|
1496
|
+
limit?: number | undefined;
|
|
1497
|
+
factor?: number | undefined;
|
|
1498
|
+
minTimeoutInMs?: number | undefined;
|
|
1499
|
+
maxTimeoutInMs?: number | undefined;
|
|
1500
|
+
randomize?: boolean | undefined;
|
|
1501
|
+
}, {
|
|
1502
|
+
limit?: number | undefined;
|
|
1503
|
+
factor?: number | undefined;
|
|
1504
|
+
minTimeoutInMs?: number | undefined;
|
|
1505
|
+
maxTimeoutInMs?: number | undefined;
|
|
1506
|
+
randomize?: boolean | undefined;
|
|
1507
|
+
}>>;
|
|
1508
|
+
/** The icon for the Task, it will appear in the logs.
|
|
1509
|
+
* You can use the name of a company in lowercase, e.g. "github".
|
|
1510
|
+
* Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
|
|
1416
1511
|
icon: z.ZodOptional<z.ZodString>;
|
|
1512
|
+
/** The key for the Task that you want to appear in the logs */
|
|
1417
1513
|
displayKey: z.ZodOptional<z.ZodString>;
|
|
1418
|
-
|
|
1419
|
-
delayUntil: z.ZodOptional<z.ZodDate>;
|
|
1514
|
+
/** A description of the Task */
|
|
1420
1515
|
description: z.ZodOptional<z.ZodString>;
|
|
1516
|
+
/** Properties that are displayed in the logs */
|
|
1421
1517
|
properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1422
1518
|
label: z.ZodString;
|
|
1423
1519
|
text: z.ZodString;
|
|
@@ -1431,7 +1527,32 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1431
1527
|
label: string;
|
|
1432
1528
|
text: string;
|
|
1433
1529
|
}>, "many">>;
|
|
1434
|
-
params
|
|
1530
|
+
/** The input params to the Task, will be displayed in the logs */
|
|
1531
|
+
params: z.ZodAny;
|
|
1532
|
+
/** The style of the log entry. */
|
|
1533
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
1534
|
+
style: z.ZodEnum<["normal", "minimal"]>;
|
|
1535
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
1536
|
+
}, "strip", z.ZodTypeAny, {
|
|
1537
|
+
variant?: string | undefined;
|
|
1538
|
+
style: "normal" | "minimal";
|
|
1539
|
+
}, {
|
|
1540
|
+
variant?: string | undefined;
|
|
1541
|
+
style: "normal" | "minimal";
|
|
1542
|
+
}>>;
|
|
1543
|
+
/** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
|
|
1544
|
+
connectionKey: z.ZodOptional<z.ZodString>;
|
|
1545
|
+
/** 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. */
|
|
1546
|
+
operation: z.ZodOptional<z.ZodEnum<["fetch"]>>;
|
|
1547
|
+
/** 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). */
|
|
1548
|
+
noop: z.ZodDefault<z.ZodBoolean>;
|
|
1549
|
+
redact: z.ZodOptional<z.ZodObject<{
|
|
1550
|
+
paths: z.ZodArray<z.ZodString, "many">;
|
|
1551
|
+
}, "strip", z.ZodTypeAny, {
|
|
1552
|
+
paths: string[];
|
|
1553
|
+
}, {
|
|
1554
|
+
paths: string[];
|
|
1555
|
+
}>>;
|
|
1435
1556
|
trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
1436
1557
|
type: z.ZodLiteral<"dynamic">;
|
|
1437
1558
|
id: z.ZodString;
|
|
@@ -1579,48 +1700,11 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1579
1700
|
type: "interval";
|
|
1580
1701
|
};
|
|
1581
1702
|
}>]>>;
|
|
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
1703
|
}, "strip", z.ZodTypeAny, {
|
|
1620
1704
|
icon?: string | undefined;
|
|
1621
1705
|
delayUntil?: Date | undefined;
|
|
1622
1706
|
description?: string | undefined;
|
|
1623
|
-
params?:
|
|
1707
|
+
params?: any;
|
|
1624
1708
|
properties?: {
|
|
1625
1709
|
url?: string | undefined;
|
|
1626
1710
|
label: string;
|
|
@@ -1630,6 +1714,7 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1630
1714
|
variant?: string | undefined;
|
|
1631
1715
|
style: "normal" | "minimal";
|
|
1632
1716
|
} | undefined;
|
|
1717
|
+
operation?: "fetch" | undefined;
|
|
1633
1718
|
trigger?: {
|
|
1634
1719
|
id: string;
|
|
1635
1720
|
type: "dynamic";
|
|
@@ -1663,11 +1748,6 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1663
1748
|
type: "interval";
|
|
1664
1749
|
};
|
|
1665
1750
|
} | undefined;
|
|
1666
|
-
displayKey?: string | undefined;
|
|
1667
|
-
redact?: {
|
|
1668
|
-
paths: string[];
|
|
1669
|
-
} | undefined;
|
|
1670
|
-
connectionKey?: string | undefined;
|
|
1671
1751
|
retry?: {
|
|
1672
1752
|
limit?: number | undefined;
|
|
1673
1753
|
factor?: number | undefined;
|
|
@@ -1675,6 +1755,11 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1675
1755
|
maxTimeoutInMs?: number | undefined;
|
|
1676
1756
|
randomize?: boolean | undefined;
|
|
1677
1757
|
} | undefined;
|
|
1758
|
+
displayKey?: string | undefined;
|
|
1759
|
+
connectionKey?: string | undefined;
|
|
1760
|
+
redact?: {
|
|
1761
|
+
paths: string[];
|
|
1762
|
+
} | undefined;
|
|
1678
1763
|
name: string;
|
|
1679
1764
|
noop: boolean;
|
|
1680
1765
|
}, {
|
|
@@ -1682,7 +1767,7 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1682
1767
|
noop?: boolean | undefined;
|
|
1683
1768
|
delayUntil?: Date | undefined;
|
|
1684
1769
|
description?: string | undefined;
|
|
1685
|
-
params?:
|
|
1770
|
+
params?: any;
|
|
1686
1771
|
properties?: {
|
|
1687
1772
|
url?: string | undefined;
|
|
1688
1773
|
label: string;
|
|
@@ -1692,6 +1777,7 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1692
1777
|
variant?: string | undefined;
|
|
1693
1778
|
style: "normal" | "minimal";
|
|
1694
1779
|
} | undefined;
|
|
1780
|
+
operation?: "fetch" | undefined;
|
|
1695
1781
|
trigger?: {
|
|
1696
1782
|
id: string;
|
|
1697
1783
|
type: "dynamic";
|
|
@@ -1725,11 +1811,6 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1725
1811
|
type: "interval";
|
|
1726
1812
|
};
|
|
1727
1813
|
} | undefined;
|
|
1728
|
-
displayKey?: string | undefined;
|
|
1729
|
-
redact?: {
|
|
1730
|
-
paths: string[];
|
|
1731
|
-
} | undefined;
|
|
1732
|
-
connectionKey?: string | undefined;
|
|
1733
1814
|
retry?: {
|
|
1734
1815
|
limit?: number | undefined;
|
|
1735
1816
|
factor?: number | undefined;
|
|
@@ -1737,16 +1818,53 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
|
|
|
1737
1818
|
maxTimeoutInMs?: number | undefined;
|
|
1738
1819
|
randomize?: boolean | undefined;
|
|
1739
1820
|
} | undefined;
|
|
1821
|
+
displayKey?: string | undefined;
|
|
1822
|
+
connectionKey?: string | undefined;
|
|
1823
|
+
redact?: {
|
|
1824
|
+
paths: string[];
|
|
1825
|
+
} | undefined;
|
|
1740
1826
|
name: string;
|
|
1741
1827
|
}>;
|
|
1742
1828
|
type RunTaskOptions = z.input<typeof RunTaskOptionsSchema>;
|
|
1743
1829
|
declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
1830
|
+
/** The name of the Task is required. This is displayed on the Task in the logs. */
|
|
1744
1831
|
name: z.ZodString;
|
|
1832
|
+
/** The Task will wait and only start at the specified Date */
|
|
1833
|
+
delayUntil: z.ZodOptional<z.ZodDate>;
|
|
1834
|
+
/** Retry options */
|
|
1835
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
1836
|
+
/** The maximum number of times to retry the request. */
|
|
1837
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
1838
|
+
/** The exponential factor to use when calculating the next retry time. */
|
|
1839
|
+
factor: z.ZodOptional<z.ZodNumber>;
|
|
1840
|
+
/** The minimum amount of time to wait before retrying the request. */
|
|
1841
|
+
minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
1842
|
+
/** The maximum amount of time to wait before retrying the request. */
|
|
1843
|
+
maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
1844
|
+
/** Whether to randomize the retry time. */
|
|
1845
|
+
randomize: z.ZodOptional<z.ZodBoolean>;
|
|
1846
|
+
}, "strip", z.ZodTypeAny, {
|
|
1847
|
+
limit?: number | undefined;
|
|
1848
|
+
factor?: number | undefined;
|
|
1849
|
+
minTimeoutInMs?: number | undefined;
|
|
1850
|
+
maxTimeoutInMs?: number | undefined;
|
|
1851
|
+
randomize?: boolean | undefined;
|
|
1852
|
+
}, {
|
|
1853
|
+
limit?: number | undefined;
|
|
1854
|
+
factor?: number | undefined;
|
|
1855
|
+
minTimeoutInMs?: number | undefined;
|
|
1856
|
+
maxTimeoutInMs?: number | undefined;
|
|
1857
|
+
randomize?: boolean | undefined;
|
|
1858
|
+
}>>;
|
|
1859
|
+
/** The icon for the Task, it will appear in the logs.
|
|
1860
|
+
* You can use the name of a company in lowercase, e.g. "github".
|
|
1861
|
+
* Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
|
|
1745
1862
|
icon: z.ZodOptional<z.ZodString>;
|
|
1863
|
+
/** The key for the Task that you want to appear in the logs */
|
|
1746
1864
|
displayKey: z.ZodOptional<z.ZodString>;
|
|
1747
|
-
|
|
1748
|
-
delayUntil: z.ZodOptional<z.ZodDate>;
|
|
1865
|
+
/** A description of the Task */
|
|
1749
1866
|
description: z.ZodOptional<z.ZodString>;
|
|
1867
|
+
/** Properties that are displayed in the logs */
|
|
1750
1868
|
properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1751
1869
|
label: z.ZodString;
|
|
1752
1870
|
text: z.ZodString;
|
|
@@ -1760,7 +1878,32 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
1760
1878
|
label: string;
|
|
1761
1879
|
text: string;
|
|
1762
1880
|
}>, "many">>;
|
|
1763
|
-
params
|
|
1881
|
+
/** The input params to the Task, will be displayed in the logs */
|
|
1882
|
+
params: z.ZodAny;
|
|
1883
|
+
/** The style of the log entry. */
|
|
1884
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
1885
|
+
style: z.ZodEnum<["normal", "minimal"]>;
|
|
1886
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
1887
|
+
}, "strip", z.ZodTypeAny, {
|
|
1888
|
+
variant?: string | undefined;
|
|
1889
|
+
style: "normal" | "minimal";
|
|
1890
|
+
}, {
|
|
1891
|
+
variant?: string | undefined;
|
|
1892
|
+
style: "normal" | "minimal";
|
|
1893
|
+
}>>;
|
|
1894
|
+
/** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
|
|
1895
|
+
connectionKey: z.ZodOptional<z.ZodString>;
|
|
1896
|
+
/** 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. */
|
|
1897
|
+
operation: z.ZodOptional<z.ZodEnum<["fetch"]>>;
|
|
1898
|
+
/** 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). */
|
|
1899
|
+
noop: z.ZodDefault<z.ZodBoolean>;
|
|
1900
|
+
redact: z.ZodOptional<z.ZodObject<{
|
|
1901
|
+
paths: z.ZodArray<z.ZodString, "many">;
|
|
1902
|
+
}, "strip", z.ZodTypeAny, {
|
|
1903
|
+
paths: string[];
|
|
1904
|
+
}, {
|
|
1905
|
+
paths: string[];
|
|
1906
|
+
}>>;
|
|
1764
1907
|
trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
1765
1908
|
type: z.ZodLiteral<"dynamic">;
|
|
1766
1909
|
id: z.ZodString;
|
|
@@ -1908,43 +2051,6 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
1908
2051
|
type: "interval";
|
|
1909
2052
|
};
|
|
1910
2053
|
}>]>>;
|
|
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
2054
|
}, {
|
|
1949
2055
|
idempotencyKey: z.ZodString;
|
|
1950
2056
|
parentId: z.ZodOptional<z.ZodString>;
|
|
@@ -1952,7 +2058,7 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
1952
2058
|
icon?: string | undefined;
|
|
1953
2059
|
delayUntil?: Date | undefined;
|
|
1954
2060
|
description?: string | undefined;
|
|
1955
|
-
params?:
|
|
2061
|
+
params?: any;
|
|
1956
2062
|
properties?: {
|
|
1957
2063
|
url?: string | undefined;
|
|
1958
2064
|
label: string;
|
|
@@ -1963,6 +2069,7 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
1963
2069
|
variant?: string | undefined;
|
|
1964
2070
|
style: "normal" | "minimal";
|
|
1965
2071
|
} | undefined;
|
|
2072
|
+
operation?: "fetch" | undefined;
|
|
1966
2073
|
trigger?: {
|
|
1967
2074
|
id: string;
|
|
1968
2075
|
type: "dynamic";
|
|
@@ -1996,11 +2103,6 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
1996
2103
|
type: "interval";
|
|
1997
2104
|
};
|
|
1998
2105
|
} | undefined;
|
|
1999
|
-
displayKey?: string | undefined;
|
|
2000
|
-
redact?: {
|
|
2001
|
-
paths: string[];
|
|
2002
|
-
} | undefined;
|
|
2003
|
-
connectionKey?: string | undefined;
|
|
2004
2106
|
retry?: {
|
|
2005
2107
|
limit?: number | undefined;
|
|
2006
2108
|
factor?: number | undefined;
|
|
@@ -2008,6 +2110,11 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
2008
2110
|
maxTimeoutInMs?: number | undefined;
|
|
2009
2111
|
randomize?: boolean | undefined;
|
|
2010
2112
|
} | undefined;
|
|
2113
|
+
displayKey?: string | undefined;
|
|
2114
|
+
connectionKey?: string | undefined;
|
|
2115
|
+
redact?: {
|
|
2116
|
+
paths: string[];
|
|
2117
|
+
} | undefined;
|
|
2011
2118
|
name: string;
|
|
2012
2119
|
noop: boolean;
|
|
2013
2120
|
idempotencyKey: string;
|
|
@@ -2016,7 +2123,7 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
2016
2123
|
noop?: boolean | undefined;
|
|
2017
2124
|
delayUntil?: Date | undefined;
|
|
2018
2125
|
description?: string | undefined;
|
|
2019
|
-
params?:
|
|
2126
|
+
params?: any;
|
|
2020
2127
|
properties?: {
|
|
2021
2128
|
url?: string | undefined;
|
|
2022
2129
|
label: string;
|
|
@@ -2027,6 +2134,7 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
2027
2134
|
variant?: string | undefined;
|
|
2028
2135
|
style: "normal" | "minimal";
|
|
2029
2136
|
} | undefined;
|
|
2137
|
+
operation?: "fetch" | undefined;
|
|
2030
2138
|
trigger?: {
|
|
2031
2139
|
id: string;
|
|
2032
2140
|
type: "dynamic";
|
|
@@ -2060,11 +2168,6 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
2060
2168
|
type: "interval";
|
|
2061
2169
|
};
|
|
2062
2170
|
} | undefined;
|
|
2063
|
-
displayKey?: string | undefined;
|
|
2064
|
-
redact?: {
|
|
2065
|
-
paths: string[];
|
|
2066
|
-
} | undefined;
|
|
2067
|
-
connectionKey?: string | undefined;
|
|
2068
2171
|
retry?: {
|
|
2069
2172
|
limit?: number | undefined;
|
|
2070
2173
|
factor?: number | undefined;
|
|
@@ -2072,17 +2175,54 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
|
|
|
2072
2175
|
maxTimeoutInMs?: number | undefined;
|
|
2073
2176
|
randomize?: boolean | undefined;
|
|
2074
2177
|
} | undefined;
|
|
2178
|
+
displayKey?: string | undefined;
|
|
2179
|
+
connectionKey?: string | undefined;
|
|
2180
|
+
redact?: {
|
|
2181
|
+
paths: string[];
|
|
2182
|
+
} | undefined;
|
|
2075
2183
|
name: string;
|
|
2076
2184
|
idempotencyKey: string;
|
|
2077
2185
|
}>;
|
|
2078
2186
|
type RunTaskBodyInput = z.infer<typeof RunTaskBodyInputSchema>;
|
|
2079
2187
|
declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.extendShape<{
|
|
2188
|
+
/** The name of the Task is required. This is displayed on the Task in the logs. */
|
|
2080
2189
|
name: z.ZodString;
|
|
2190
|
+
/** The Task will wait and only start at the specified Date */
|
|
2191
|
+
delayUntil: z.ZodOptional<z.ZodDate>;
|
|
2192
|
+
/** Retry options */
|
|
2193
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
2194
|
+
/** The maximum number of times to retry the request. */
|
|
2195
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
2196
|
+
/** The exponential factor to use when calculating the next retry time. */
|
|
2197
|
+
factor: z.ZodOptional<z.ZodNumber>;
|
|
2198
|
+
/** The minimum amount of time to wait before retrying the request. */
|
|
2199
|
+
minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
2200
|
+
/** The maximum amount of time to wait before retrying the request. */
|
|
2201
|
+
maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
2202
|
+
/** Whether to randomize the retry time. */
|
|
2203
|
+
randomize: z.ZodOptional<z.ZodBoolean>;
|
|
2204
|
+
}, "strip", z.ZodTypeAny, {
|
|
2205
|
+
limit?: number | undefined;
|
|
2206
|
+
factor?: number | undefined;
|
|
2207
|
+
minTimeoutInMs?: number | undefined;
|
|
2208
|
+
maxTimeoutInMs?: number | undefined;
|
|
2209
|
+
randomize?: boolean | undefined;
|
|
2210
|
+
}, {
|
|
2211
|
+
limit?: number | undefined;
|
|
2212
|
+
factor?: number | undefined;
|
|
2213
|
+
minTimeoutInMs?: number | undefined;
|
|
2214
|
+
maxTimeoutInMs?: number | undefined;
|
|
2215
|
+
randomize?: boolean | undefined;
|
|
2216
|
+
}>>;
|
|
2217
|
+
/** The icon for the Task, it will appear in the logs.
|
|
2218
|
+
* You can use the name of a company in lowercase, e.g. "github".
|
|
2219
|
+
* Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
|
|
2081
2220
|
icon: z.ZodOptional<z.ZodString>;
|
|
2221
|
+
/** The key for the Task that you want to appear in the logs */
|
|
2082
2222
|
displayKey: z.ZodOptional<z.ZodString>;
|
|
2083
|
-
|
|
2084
|
-
delayUntil: z.ZodOptional<z.ZodDate>;
|
|
2223
|
+
/** A description of the Task */
|
|
2085
2224
|
description: z.ZodOptional<z.ZodString>;
|
|
2225
|
+
/** Properties that are displayed in the logs */
|
|
2086
2226
|
properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2087
2227
|
label: z.ZodString;
|
|
2088
2228
|
text: z.ZodString;
|
|
@@ -2096,7 +2236,32 @@ declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.exte
|
|
|
2096
2236
|
label: string;
|
|
2097
2237
|
text: string;
|
|
2098
2238
|
}>, "many">>;
|
|
2099
|
-
params
|
|
2239
|
+
/** The input params to the Task, will be displayed in the logs */
|
|
2240
|
+
params: z.ZodAny;
|
|
2241
|
+
/** The style of the log entry. */
|
|
2242
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
2243
|
+
style: z.ZodEnum<["normal", "minimal"]>;
|
|
2244
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
2245
|
+
}, "strip", z.ZodTypeAny, {
|
|
2246
|
+
variant?: string | undefined;
|
|
2247
|
+
style: "normal" | "minimal";
|
|
2248
|
+
}, {
|
|
2249
|
+
variant?: string | undefined;
|
|
2250
|
+
style: "normal" | "minimal";
|
|
2251
|
+
}>>;
|
|
2252
|
+
/** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
|
|
2253
|
+
connectionKey: z.ZodOptional<z.ZodString>;
|
|
2254
|
+
/** 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. */
|
|
2255
|
+
operation: z.ZodOptional<z.ZodEnum<["fetch"]>>;
|
|
2256
|
+
/** 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). */
|
|
2257
|
+
noop: z.ZodDefault<z.ZodBoolean>;
|
|
2258
|
+
redact: z.ZodOptional<z.ZodObject<{
|
|
2259
|
+
paths: z.ZodArray<z.ZodString, "many">;
|
|
2260
|
+
}, "strip", z.ZodTypeAny, {
|
|
2261
|
+
paths: string[];
|
|
2262
|
+
}, {
|
|
2263
|
+
paths: string[];
|
|
2264
|
+
}>>;
|
|
2100
2265
|
trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
2101
2266
|
type: z.ZodLiteral<"dynamic">;
|
|
2102
2267
|
id: z.ZodString;
|
|
@@ -2244,43 +2409,6 @@ declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.exte
|
|
|
2244
2409
|
type: "interval";
|
|
2245
2410
|
};
|
|
2246
2411
|
}>]>>;
|
|
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
2412
|
}, {
|
|
2285
2413
|
idempotencyKey: z.ZodString;
|
|
2286
2414
|
parentId: z.ZodOptional<z.ZodString>;
|
|
@@ -2290,7 +2418,7 @@ declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.exte
|
|
|
2290
2418
|
} | DeserializedJson[] | null, SerializableJson>;
|
|
2291
2419
|
}>, "strip", z.ZodTypeAny, {
|
|
2292
2420
|
description?: string | undefined;
|
|
2293
|
-
params?:
|
|
2421
|
+
params?: any;
|
|
2294
2422
|
properties?: {
|
|
2295
2423
|
url?: string | undefined;
|
|
2296
2424
|
label: string;
|
|
@@ -2301,7 +2429,7 @@ declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.exte
|
|
|
2301
2429
|
} | DeserializedJson[] | null;
|
|
2302
2430
|
}, {
|
|
2303
2431
|
description?: string | undefined;
|
|
2304
|
-
params?:
|
|
2432
|
+
params?: any;
|
|
2305
2433
|
properties?: {
|
|
2306
2434
|
url?: string | undefined;
|
|
2307
2435
|
label: string;
|
|
@@ -2391,30 +2519,86 @@ declare const RegisterTriggerBodySchema: z.ZodObject<{
|
|
|
2391
2519
|
}>;
|
|
2392
2520
|
source: z.ZodObject<{
|
|
2393
2521
|
channel: z.ZodEnum<["HTTP", "SQS", "SMTP"]>;
|
|
2522
|
+
integration: z.ZodObject<{
|
|
2523
|
+
id: z.ZodString;
|
|
2524
|
+
metadata: z.ZodObject<{
|
|
2525
|
+
id: z.ZodString;
|
|
2526
|
+
name: z.ZodString;
|
|
2527
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
2528
|
+
}, "strip", z.ZodTypeAny, {
|
|
2529
|
+
instructions?: string | undefined;
|
|
2530
|
+
id: string;
|
|
2531
|
+
name: string;
|
|
2532
|
+
}, {
|
|
2533
|
+
instructions?: string | undefined;
|
|
2534
|
+
id: string;
|
|
2535
|
+
name: string;
|
|
2536
|
+
}>;
|
|
2537
|
+
authSource: z.ZodEnum<["HOSTED", "LOCAL"]>;
|
|
2538
|
+
}, "strip", z.ZodTypeAny, {
|
|
2539
|
+
id: string;
|
|
2540
|
+
metadata: {
|
|
2541
|
+
instructions?: string | undefined;
|
|
2542
|
+
id: string;
|
|
2543
|
+
name: string;
|
|
2544
|
+
};
|
|
2545
|
+
authSource: "HOSTED" | "LOCAL";
|
|
2546
|
+
}, {
|
|
2547
|
+
id: string;
|
|
2548
|
+
metadata: {
|
|
2549
|
+
instructions?: string | undefined;
|
|
2550
|
+
id: string;
|
|
2551
|
+
name: string;
|
|
2552
|
+
};
|
|
2553
|
+
authSource: "HOSTED" | "LOCAL";
|
|
2554
|
+
}>;
|
|
2394
2555
|
key: z.ZodString;
|
|
2395
2556
|
params: z.ZodAny;
|
|
2396
2557
|
events: z.ZodArray<z.ZodString, "many">;
|
|
2397
|
-
clientId: z.ZodOptional<z.ZodString>;
|
|
2398
2558
|
}, "strip", z.ZodTypeAny, {
|
|
2399
2559
|
params?: any;
|
|
2400
|
-
clientId?: string | undefined;
|
|
2401
2560
|
key: string;
|
|
2402
2561
|
channel: "HTTP" | "SMTP" | "SQS";
|
|
2403
2562
|
events: string[];
|
|
2563
|
+
integration: {
|
|
2564
|
+
id: string;
|
|
2565
|
+
metadata: {
|
|
2566
|
+
instructions?: string | undefined;
|
|
2567
|
+
id: string;
|
|
2568
|
+
name: string;
|
|
2569
|
+
};
|
|
2570
|
+
authSource: "HOSTED" | "LOCAL";
|
|
2571
|
+
};
|
|
2404
2572
|
}, {
|
|
2405
2573
|
params?: any;
|
|
2406
|
-
clientId?: string | undefined;
|
|
2407
2574
|
key: string;
|
|
2408
2575
|
channel: "HTTP" | "SMTP" | "SQS";
|
|
2409
2576
|
events: string[];
|
|
2577
|
+
integration: {
|
|
2578
|
+
id: string;
|
|
2579
|
+
metadata: {
|
|
2580
|
+
instructions?: string | undefined;
|
|
2581
|
+
id: string;
|
|
2582
|
+
name: string;
|
|
2583
|
+
};
|
|
2584
|
+
authSource: "HOSTED" | "LOCAL";
|
|
2585
|
+
};
|
|
2410
2586
|
}>;
|
|
2411
2587
|
}, "strip", z.ZodTypeAny, {
|
|
2412
2588
|
source: {
|
|
2413
2589
|
params?: any;
|
|
2414
|
-
clientId?: string | undefined;
|
|
2415
2590
|
key: string;
|
|
2416
2591
|
channel: "HTTP" | "SMTP" | "SQS";
|
|
2417
2592
|
events: string[];
|
|
2593
|
+
integration: {
|
|
2594
|
+
id: string;
|
|
2595
|
+
metadata: {
|
|
2596
|
+
instructions?: string | undefined;
|
|
2597
|
+
id: string;
|
|
2598
|
+
name: string;
|
|
2599
|
+
};
|
|
2600
|
+
authSource: "HOSTED" | "LOCAL";
|
|
2601
|
+
};
|
|
2418
2602
|
};
|
|
2419
2603
|
rule: {
|
|
2420
2604
|
payload?: EventFilter | undefined;
|
|
@@ -2425,10 +2609,18 @@ declare const RegisterTriggerBodySchema: z.ZodObject<{
|
|
|
2425
2609
|
}, {
|
|
2426
2610
|
source: {
|
|
2427
2611
|
params?: any;
|
|
2428
|
-
clientId?: string | undefined;
|
|
2429
2612
|
key: string;
|
|
2430
2613
|
channel: "HTTP" | "SMTP" | "SQS";
|
|
2431
2614
|
events: string[];
|
|
2615
|
+
integration: {
|
|
2616
|
+
id: string;
|
|
2617
|
+
metadata: {
|
|
2618
|
+
instructions?: string | undefined;
|
|
2619
|
+
id: string;
|
|
2620
|
+
name: string;
|
|
2621
|
+
};
|
|
2622
|
+
authSource: "HOSTED" | "LOCAL";
|
|
2623
|
+
};
|
|
2432
2624
|
};
|
|
2433
2625
|
rule: {
|
|
2434
2626
|
payload?: EventFilter | undefined;
|
|
@@ -2603,9 +2795,13 @@ declare const ErrorWithStackSchema: z.ZodObject<{
|
|
|
2603
2795
|
}>;
|
|
2604
2796
|
type ErrorWithStack = z.infer<typeof ErrorWithStackSchema>;
|
|
2605
2797
|
|
|
2798
|
+
/** A property that is displayed in the logs */
|
|
2606
2799
|
declare const DisplayPropertySchema: z.ZodObject<{
|
|
2800
|
+
/** The label for the property */
|
|
2607
2801
|
label: z.ZodString;
|
|
2802
|
+
/** The value of the property */
|
|
2608
2803
|
text: z.ZodString;
|
|
2804
|
+
/** The URL to link to when the property is clicked */
|
|
2609
2805
|
url: z.ZodOptional<z.ZodString>;
|
|
2610
2806
|
}, "strip", z.ZodTypeAny, {
|
|
2611
2807
|
url?: string | undefined;
|
|
@@ -2636,48 +2832,51 @@ declare const ConnectionAuthSchema: z.ZodObject<{
|
|
|
2636
2832
|
}>;
|
|
2637
2833
|
type ConnectionAuth = z.infer<typeof ConnectionAuthSchema>;
|
|
2638
2834
|
declare const IntegrationMetadataSchema: z.ZodObject<{
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2835
|
+
id: z.ZodString;
|
|
2836
|
+
name: z.ZodString;
|
|
2837
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
2642
2838
|
}, "strip", z.ZodTypeAny, {
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2839
|
+
instructions?: string | undefined;
|
|
2840
|
+
id: string;
|
|
2841
|
+
name: string;
|
|
2646
2842
|
}, {
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2843
|
+
instructions?: string | undefined;
|
|
2844
|
+
id: string;
|
|
2845
|
+
name: string;
|
|
2650
2846
|
}>;
|
|
2651
2847
|
type IntegrationMetadata = z.infer<typeof IntegrationMetadataSchema>;
|
|
2652
2848
|
declare const IntegrationConfigSchema: z.ZodObject<{
|
|
2653
2849
|
id: z.ZodString;
|
|
2654
2850
|
metadata: z.ZodObject<{
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2851
|
+
id: z.ZodString;
|
|
2852
|
+
name: z.ZodString;
|
|
2853
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
2658
2854
|
}, "strip", z.ZodTypeAny, {
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2855
|
+
instructions?: string | undefined;
|
|
2856
|
+
id: string;
|
|
2857
|
+
name: string;
|
|
2662
2858
|
}, {
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2859
|
+
instructions?: string | undefined;
|
|
2860
|
+
id: string;
|
|
2861
|
+
name: string;
|
|
2666
2862
|
}>;
|
|
2863
|
+
authSource: z.ZodEnum<["HOSTED", "LOCAL"]>;
|
|
2667
2864
|
}, "strip", z.ZodTypeAny, {
|
|
2668
2865
|
id: string;
|
|
2669
2866
|
metadata: {
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2867
|
+
instructions?: string | undefined;
|
|
2868
|
+
id: string;
|
|
2869
|
+
name: string;
|
|
2673
2870
|
};
|
|
2871
|
+
authSource: "HOSTED" | "LOCAL";
|
|
2674
2872
|
}, {
|
|
2675
2873
|
id: string;
|
|
2676
2874
|
metadata: {
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2875
|
+
instructions?: string | undefined;
|
|
2876
|
+
id: string;
|
|
2877
|
+
name: string;
|
|
2680
2878
|
};
|
|
2879
|
+
authSource: "HOSTED" | "LOCAL";
|
|
2681
2880
|
}>;
|
|
2682
2881
|
type IntegrationConfig = z.infer<typeof IntegrationConfigSchema>;
|
|
2683
2882
|
|
|
@@ -2693,14 +2892,19 @@ declare const ScheduledPayloadSchema: z.ZodObject<{
|
|
|
2693
2892
|
}>;
|
|
2694
2893
|
type ScheduledPayload = z.infer<typeof ScheduledPayloadSchema>;
|
|
2695
2894
|
declare const IntervalOptionsSchema: z.ZodObject<{
|
|
2895
|
+
/** The number of seconds for the interval. Min = 60, Max = 86400 (1 day) */
|
|
2696
2896
|
seconds: z.ZodNumber;
|
|
2697
2897
|
}, "strip", z.ZodTypeAny, {
|
|
2698
2898
|
seconds: number;
|
|
2699
2899
|
}, {
|
|
2700
2900
|
seconds: number;
|
|
2701
2901
|
}>;
|
|
2902
|
+
/** Interval options */
|
|
2702
2903
|
type IntervalOptions = z.infer<typeof IntervalOptionsSchema>;
|
|
2703
2904
|
declare const CronOptionsSchema: z.ZodObject<{
|
|
2905
|
+
/** A CRON expression that defines the schedule. A useful tool when writing CRON
|
|
2906
|
+
expressions is [crontab guru](https://crontab.guru). Note that the timezone
|
|
2907
|
+
used is UTC. */
|
|
2704
2908
|
cron: z.ZodString;
|
|
2705
2909
|
}, "strip", z.ZodTypeAny, {
|
|
2706
2910
|
cron: string;
|
|
@@ -2709,14 +2913,18 @@ declare const CronOptionsSchema: z.ZodObject<{
|
|
|
2709
2913
|
}>;
|
|
2710
2914
|
type CronOptions = z.infer<typeof CronOptionsSchema>;
|
|
2711
2915
|
declare const ScheduleMetadataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
2916
|
+
/** An interval reoccurs at the specified number of seconds */
|
|
2712
2917
|
type: z.ZodLiteral<"interval">;
|
|
2918
|
+
/** An object containing options about the interval. */
|
|
2713
2919
|
options: z.ZodObject<{
|
|
2920
|
+
/** The number of seconds for the interval. Min = 60, Max = 86400 (1 day) */
|
|
2714
2921
|
seconds: z.ZodNumber;
|
|
2715
2922
|
}, "strip", z.ZodTypeAny, {
|
|
2716
2923
|
seconds: number;
|
|
2717
2924
|
}, {
|
|
2718
2925
|
seconds: number;
|
|
2719
2926
|
}>;
|
|
2927
|
+
/** Any additional metadata about the schedule. */
|
|
2720
2928
|
metadata: z.ZodAny;
|
|
2721
2929
|
}, "strip", z.ZodTypeAny, {
|
|
2722
2930
|
metadata?: any;
|
|
@@ -2733,6 +2941,9 @@ declare const ScheduleMetadataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
2733
2941
|
}>, z.ZodObject<{
|
|
2734
2942
|
type: z.ZodLiteral<"cron">;
|
|
2735
2943
|
options: z.ZodObject<{
|
|
2944
|
+
/** A CRON expression that defines the schedule. A useful tool when writing CRON
|
|
2945
|
+
expressions is [crontab guru](https://crontab.guru). Note that the timezone
|
|
2946
|
+
used is UTC. */
|
|
2736
2947
|
cron: z.ZodString;
|
|
2737
2948
|
}, "strip", z.ZodTypeAny, {
|
|
2738
2949
|
cron: string;
|
|
@@ -2763,24 +2974,18 @@ declare const MissingConnectionNotificationPayloadSchema: z.ZodDiscriminatedUnio
|
|
|
2763
2974
|
scopes: z.ZodArray<z.ZodString, "many">;
|
|
2764
2975
|
createdAt: z.ZodDate;
|
|
2765
2976
|
updatedAt: z.ZodDate;
|
|
2766
|
-
integrationIdentifier: z.ZodString;
|
|
2767
|
-
integrationAuthMethod: z.ZodString;
|
|
2768
2977
|
}, "strip", z.ZodTypeAny, {
|
|
2769
2978
|
id: string;
|
|
2770
2979
|
scopes: string[];
|
|
2771
2980
|
title: string;
|
|
2772
2981
|
createdAt: Date;
|
|
2773
2982
|
updatedAt: Date;
|
|
2774
|
-
integrationIdentifier: string;
|
|
2775
|
-
integrationAuthMethod: string;
|
|
2776
2983
|
}, {
|
|
2777
2984
|
id: string;
|
|
2778
2985
|
scopes: string[];
|
|
2779
2986
|
title: string;
|
|
2780
2987
|
createdAt: Date;
|
|
2781
2988
|
updatedAt: Date;
|
|
2782
|
-
integrationIdentifier: string;
|
|
2783
|
-
integrationAuthMethod: string;
|
|
2784
2989
|
}>;
|
|
2785
2990
|
authorizationUrl: z.ZodString;
|
|
2786
2991
|
}, {
|
|
@@ -2794,8 +2999,6 @@ declare const MissingConnectionNotificationPayloadSchema: z.ZodDiscriminatedUnio
|
|
|
2794
2999
|
title: string;
|
|
2795
3000
|
createdAt: Date;
|
|
2796
3001
|
updatedAt: Date;
|
|
2797
|
-
integrationIdentifier: string;
|
|
2798
|
-
integrationAuthMethod: string;
|
|
2799
3002
|
};
|
|
2800
3003
|
authorizationUrl: string;
|
|
2801
3004
|
}, {
|
|
@@ -2807,8 +3010,6 @@ declare const MissingConnectionNotificationPayloadSchema: z.ZodDiscriminatedUnio
|
|
|
2807
3010
|
title: string;
|
|
2808
3011
|
createdAt: Date;
|
|
2809
3012
|
updatedAt: Date;
|
|
2810
|
-
integrationIdentifier: string;
|
|
2811
|
-
integrationAuthMethod: string;
|
|
2812
3013
|
};
|
|
2813
3014
|
authorizationUrl: string;
|
|
2814
3015
|
}>, z.ZodObject<z.extendShape<{
|
|
@@ -2819,24 +3020,18 @@ declare const MissingConnectionNotificationPayloadSchema: z.ZodDiscriminatedUnio
|
|
|
2819
3020
|
scopes: z.ZodArray<z.ZodString, "many">;
|
|
2820
3021
|
createdAt: z.ZodDate;
|
|
2821
3022
|
updatedAt: z.ZodDate;
|
|
2822
|
-
integrationIdentifier: z.ZodString;
|
|
2823
|
-
integrationAuthMethod: z.ZodString;
|
|
2824
3023
|
}, "strip", z.ZodTypeAny, {
|
|
2825
3024
|
id: string;
|
|
2826
3025
|
scopes: string[];
|
|
2827
3026
|
title: string;
|
|
2828
3027
|
createdAt: Date;
|
|
2829
3028
|
updatedAt: Date;
|
|
2830
|
-
integrationIdentifier: string;
|
|
2831
|
-
integrationAuthMethod: string;
|
|
2832
3029
|
}, {
|
|
2833
3030
|
id: string;
|
|
2834
3031
|
scopes: string[];
|
|
2835
3032
|
title: string;
|
|
2836
3033
|
createdAt: Date;
|
|
2837
3034
|
updatedAt: Date;
|
|
2838
|
-
integrationIdentifier: string;
|
|
2839
|
-
integrationAuthMethod: string;
|
|
2840
3035
|
}>;
|
|
2841
3036
|
authorizationUrl: z.ZodString;
|
|
2842
3037
|
}, {
|
|
@@ -2864,8 +3059,6 @@ declare const MissingConnectionNotificationPayloadSchema: z.ZodDiscriminatedUnio
|
|
|
2864
3059
|
title: string;
|
|
2865
3060
|
createdAt: Date;
|
|
2866
3061
|
updatedAt: Date;
|
|
2867
|
-
integrationIdentifier: string;
|
|
2868
|
-
integrationAuthMethod: string;
|
|
2869
3062
|
};
|
|
2870
3063
|
authorizationUrl: string;
|
|
2871
3064
|
}, {
|
|
@@ -2881,8 +3074,6 @@ declare const MissingConnectionNotificationPayloadSchema: z.ZodDiscriminatedUnio
|
|
|
2881
3074
|
title: string;
|
|
2882
3075
|
createdAt: Date;
|
|
2883
3076
|
updatedAt: Date;
|
|
2884
|
-
integrationIdentifier: string;
|
|
2885
|
-
integrationAuthMethod: string;
|
|
2886
3077
|
};
|
|
2887
3078
|
authorizationUrl: string;
|
|
2888
3079
|
}>]>;
|
|
@@ -3020,6 +3211,99 @@ declare const MissingConnectionResolvedNotificationPayloadSchema: z.ZodDiscrimin
|
|
|
3020
3211
|
}>]>;
|
|
3021
3212
|
type MissingConnectionResolvedNotificationPayload = z.infer<typeof MissingConnectionResolvedNotificationPayloadSchema>;
|
|
3022
3213
|
|
|
3214
|
+
/** The options for a fetch request */
|
|
3215
|
+
declare const FetchRequestInitSchema: z.ZodObject<{
|
|
3216
|
+
/** The HTTP method to use for the request. */
|
|
3217
|
+
method: z.ZodOptional<z.ZodString>;
|
|
3218
|
+
/** 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. */
|
|
3219
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
3220
|
+
__redactedString: z.ZodLiteral<true>;
|
|
3221
|
+
strings: z.ZodArray<z.ZodString, "many">;
|
|
3222
|
+
interpolations: z.ZodArray<z.ZodString, "many">;
|
|
3223
|
+
}, "strip", z.ZodTypeAny, {
|
|
3224
|
+
__redactedString: true;
|
|
3225
|
+
strings: string[];
|
|
3226
|
+
interpolations: string[];
|
|
3227
|
+
}, {
|
|
3228
|
+
__redactedString: true;
|
|
3229
|
+
strings: string[];
|
|
3230
|
+
interpolations: string[];
|
|
3231
|
+
}>]>>>;
|
|
3232
|
+
/** The body of the request. */
|
|
3233
|
+
body: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>]>>;
|
|
3234
|
+
}, "strip", z.ZodTypeAny, {
|
|
3235
|
+
method?: string | undefined;
|
|
3236
|
+
headers?: Record<string, string | {
|
|
3237
|
+
__redactedString: true;
|
|
3238
|
+
strings: string[];
|
|
3239
|
+
interpolations: string[];
|
|
3240
|
+
}> | undefined;
|
|
3241
|
+
body?: string | ArrayBuffer | undefined;
|
|
3242
|
+
}, {
|
|
3243
|
+
method?: string | undefined;
|
|
3244
|
+
headers?: Record<string, string | {
|
|
3245
|
+
__redactedString: true;
|
|
3246
|
+
strings: string[];
|
|
3247
|
+
interpolations: string[];
|
|
3248
|
+
}> | undefined;
|
|
3249
|
+
body?: string | ArrayBuffer | undefined;
|
|
3250
|
+
}>;
|
|
3251
|
+
/** The options for a fetch request */
|
|
3252
|
+
type FetchRequestInit = z.infer<typeof FetchRequestInitSchema>;
|
|
3253
|
+
declare const FetchRetryOptionsSchema: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<"strategy", [z.ZodObject<{
|
|
3254
|
+
/** The `headers` strategy retries the request using info from the response headers. */
|
|
3255
|
+
strategy: z.ZodLiteral<"headers">;
|
|
3256
|
+
/** The header to use to determine the maximum number of times to retry the request. */
|
|
3257
|
+
limitHeader: z.ZodString;
|
|
3258
|
+
/** The header to use to determine the number of remaining retries. */
|
|
3259
|
+
remainingHeader: z.ZodString;
|
|
3260
|
+
/** The header to use to determine the time when the number of remaining retries will be reset. */
|
|
3261
|
+
resetHeader: z.ZodString;
|
|
3262
|
+
}, "strip", z.ZodTypeAny, {
|
|
3263
|
+
strategy: "headers";
|
|
3264
|
+
limitHeader: string;
|
|
3265
|
+
remainingHeader: string;
|
|
3266
|
+
resetHeader: string;
|
|
3267
|
+
}, {
|
|
3268
|
+
strategy: "headers";
|
|
3269
|
+
limitHeader: string;
|
|
3270
|
+
remainingHeader: string;
|
|
3271
|
+
resetHeader: string;
|
|
3272
|
+
}>, z.ZodObject<z.extendShape<{
|
|
3273
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
3274
|
+
factor: z.ZodOptional<z.ZodNumber>;
|
|
3275
|
+
minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
3276
|
+
maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
|
|
3277
|
+
randomize: z.ZodOptional<z.ZodBoolean>;
|
|
3278
|
+
}, {
|
|
3279
|
+
/** The `backoff` strategy retries the request with an exponential backoff. */
|
|
3280
|
+
strategy: z.ZodLiteral<"backoff">;
|
|
3281
|
+
}>, "strip", z.ZodTypeAny, {
|
|
3282
|
+
limit?: number | undefined;
|
|
3283
|
+
factor?: number | undefined;
|
|
3284
|
+
minTimeoutInMs?: number | undefined;
|
|
3285
|
+
maxTimeoutInMs?: number | undefined;
|
|
3286
|
+
randomize?: boolean | undefined;
|
|
3287
|
+
strategy: "backoff";
|
|
3288
|
+
}, {
|
|
3289
|
+
limit?: number | undefined;
|
|
3290
|
+
factor?: number | undefined;
|
|
3291
|
+
minTimeoutInMs?: number | undefined;
|
|
3292
|
+
maxTimeoutInMs?: number | undefined;
|
|
3293
|
+
randomize?: boolean | undefined;
|
|
3294
|
+
strategy: "backoff";
|
|
3295
|
+
}>]>>;
|
|
3296
|
+
/** An object where the key is a status code pattern and the value is a retrying strategy. Supported patterns are:
|
|
3297
|
+
- Specific status codes: 429
|
|
3298
|
+
- Ranges: 500-599
|
|
3299
|
+
- Wildcards: 2xx, 3xx, 4xx, 5xx
|
|
3300
|
+
*/
|
|
3301
|
+
type FetchRetryOptions = z.infer<typeof FetchRetryOptionsSchema>;
|
|
3302
|
+
|
|
3303
|
+
type Prettify<T> = {
|
|
3304
|
+
[K in keyof T]: T[K];
|
|
3305
|
+
} & {};
|
|
3306
|
+
|
|
3023
3307
|
type ApiClientOptions = {
|
|
3024
3308
|
apiKey?: string;
|
|
3025
3309
|
apiUrl?: string;
|
|
@@ -3065,6 +3349,7 @@ declare class ApiClient {
|
|
|
3065
3349
|
variant?: string | undefined;
|
|
3066
3350
|
style: "normal" | "minimal";
|
|
3067
3351
|
} | null | undefined;
|
|
3352
|
+
operation?: string | null | undefined;
|
|
3068
3353
|
id: string;
|
|
3069
3354
|
name: string;
|
|
3070
3355
|
noop: boolean;
|
|
@@ -3091,6 +3376,7 @@ declare class ApiClient {
|
|
|
3091
3376
|
variant?: string | undefined;
|
|
3092
3377
|
style: "normal" | "minimal";
|
|
3093
3378
|
} | null | undefined;
|
|
3379
|
+
operation?: string | null | undefined;
|
|
3094
3380
|
id: string;
|
|
3095
3381
|
name: string;
|
|
3096
3382
|
noop: boolean;
|
|
@@ -3117,6 +3403,7 @@ declare class ApiClient {
|
|
|
3117
3403
|
variant?: string | undefined;
|
|
3118
3404
|
style: "normal" | "minimal";
|
|
3119
3405
|
} | null | undefined;
|
|
3406
|
+
operation?: string | null | undefined;
|
|
3120
3407
|
id: string;
|
|
3121
3408
|
name: string;
|
|
3122
3409
|
noop: boolean;
|
|
@@ -3165,31 +3452,42 @@ declare class ApiClient {
|
|
|
3165
3452
|
}
|
|
3166
3453
|
|
|
3167
3454
|
interface TriggerContext {
|
|
3455
|
+
/** Job metadata */
|
|
3168
3456
|
job: {
|
|
3169
3457
|
id: string;
|
|
3170
3458
|
version: string;
|
|
3171
3459
|
};
|
|
3460
|
+
/** Environment metadata */
|
|
3172
3461
|
environment: {
|
|
3173
3462
|
slug: string;
|
|
3174
3463
|
id: string;
|
|
3175
3464
|
type: RuntimeEnvironmentType;
|
|
3176
3465
|
};
|
|
3466
|
+
/** Organization metadata */
|
|
3177
3467
|
organization: {
|
|
3178
3468
|
slug: string;
|
|
3179
3469
|
id: string;
|
|
3180
3470
|
title: string;
|
|
3181
3471
|
};
|
|
3472
|
+
/** Run metadata */
|
|
3182
3473
|
run: {
|
|
3183
3474
|
id: string;
|
|
3184
3475
|
isTest: boolean;
|
|
3185
3476
|
startedAt: Date;
|
|
3186
3477
|
};
|
|
3478
|
+
/** Event metadata */
|
|
3187
3479
|
event: {
|
|
3188
3480
|
id: string;
|
|
3189
3481
|
name: string;
|
|
3190
3482
|
context: any;
|
|
3191
3483
|
timestamp: Date;
|
|
3192
3484
|
};
|
|
3485
|
+
/** Source metadata */
|
|
3486
|
+
source?: {
|
|
3487
|
+
id: string;
|
|
3488
|
+
metadata?: any;
|
|
3489
|
+
};
|
|
3490
|
+
/** Account metadata */
|
|
3193
3491
|
account?: {
|
|
3194
3492
|
id: string;
|
|
3195
3493
|
metadata?: any;
|
|
@@ -3242,6 +3540,12 @@ interface Trigger<TEventSpec extends EventSpecification<any>> {
|
|
|
3242
3540
|
attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpec>, any>): void;
|
|
3243
3541
|
preprocessRuns: boolean;
|
|
3244
3542
|
}
|
|
3543
|
+
type EventSpecificationExample = {
|
|
3544
|
+
id: string;
|
|
3545
|
+
name: string;
|
|
3546
|
+
icon?: string;
|
|
3547
|
+
payload: any;
|
|
3548
|
+
};
|
|
3245
3549
|
interface EventSpecification<TEvent extends any> {
|
|
3246
3550
|
name: string;
|
|
3247
3551
|
title: string;
|
|
@@ -3249,12 +3553,7 @@ interface EventSpecification<TEvent extends any> {
|
|
|
3249
3553
|
icon: string;
|
|
3250
3554
|
properties?: DisplayProperty[];
|
|
3251
3555
|
schema?: any;
|
|
3252
|
-
examples?: Array<
|
|
3253
|
-
id: string;
|
|
3254
|
-
name: string;
|
|
3255
|
-
icon?: string;
|
|
3256
|
-
payload: TEvent;
|
|
3257
|
-
}>;
|
|
3556
|
+
examples?: Array<EventSpecificationExample>;
|
|
3258
3557
|
filter?: EventFilter;
|
|
3259
3558
|
parsePayload: (payload: unknown) => TEvent;
|
|
3260
3559
|
runProperties?: (payload: TEvent) => DisplayProperty[];
|
|
@@ -3340,7 +3639,7 @@ declare class ExternalSource<TIntegration extends TriggerIntegration<Integration
|
|
|
3340
3639
|
source?: string | undefined;
|
|
3341
3640
|
payload?: any;
|
|
3342
3641
|
context?: any;
|
|
3343
|
-
timestamp?:
|
|
3642
|
+
timestamp?: Date | undefined;
|
|
3344
3643
|
name: string;
|
|
3345
3644
|
}[];
|
|
3346
3645
|
response?: {
|
|
@@ -3361,9 +3660,9 @@ declare class ExternalSource<TIntegration extends TriggerIntegration<Integration
|
|
|
3361
3660
|
get integrationConfig(): {
|
|
3362
3661
|
id: string;
|
|
3363
3662
|
metadata: {
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3663
|
+
instructions?: string | undefined;
|
|
3664
|
+
id: string;
|
|
3665
|
+
name: string;
|
|
3367
3666
|
};
|
|
3368
3667
|
};
|
|
3369
3668
|
get id(): string;
|
|
@@ -3407,22 +3706,29 @@ declare class DynamicTrigger<TEventSpec extends EventSpecification<any>, TExtern
|
|
|
3407
3706
|
}
|
|
3408
3707
|
|
|
3409
3708
|
type TriggerClientOptions = {
|
|
3709
|
+
/** The `id` property is used to uniquely identify the client.
|
|
3710
|
+
*/
|
|
3410
3711
|
id: string;
|
|
3411
|
-
|
|
3712
|
+
/** The `apiKey` property is the API Key for your Trigger.dev environment. We
|
|
3713
|
+
recommend using an environment variable to store your API Key. */
|
|
3412
3714
|
apiKey?: string;
|
|
3715
|
+
/** The `apiUrl` property is an optional property that specifies the API URL. You
|
|
3716
|
+
only need to specify this if you are not using Trigger.dev Cloud and are
|
|
3717
|
+
running your own Trigger.dev instance. */
|
|
3413
3718
|
apiUrl?: string;
|
|
3719
|
+
/** The `logLevel` property is an optional property that specifies the level of
|
|
3720
|
+
logging for the TriggerClient. The level is inherited by all Jobs that use this Client, unless they also specify a `logLevel`. */
|
|
3414
3721
|
logLevel?: LogLevel;
|
|
3722
|
+
/** Very verbose log messages, defaults to false. */
|
|
3723
|
+
verbose?: boolean;
|
|
3724
|
+
/** Default is unset and off. If set to true it will log to the server's console as well as the Trigger.dev platform */
|
|
3725
|
+
ioLogLocalEnabled?: boolean;
|
|
3415
3726
|
};
|
|
3416
|
-
|
|
3417
|
-
url: string;
|
|
3418
|
-
};
|
|
3727
|
+
/** 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
3728
|
declare class TriggerClient {
|
|
3420
3729
|
#private;
|
|
3421
|
-
private _url;
|
|
3422
3730
|
id: string;
|
|
3423
|
-
|
|
3424
|
-
constructor(options: TriggerClientOptions);
|
|
3425
|
-
get url(): string;
|
|
3731
|
+
constructor(options: Prettify<TriggerClientOptions>);
|
|
3426
3732
|
handleRequest(request: Request): Promise<NormalizedResponse>;
|
|
3427
3733
|
attach(job: Job<Trigger<any>, any>): void;
|
|
3428
3734
|
attachDynamicTrigger(trigger: DynamicTrigger<any, any>): void;
|
|
@@ -3463,6 +3769,11 @@ declare class TriggerClient {
|
|
|
3463
3769
|
type: "oauth2";
|
|
3464
3770
|
accessToken: string;
|
|
3465
3771
|
} | undefined>;
|
|
3772
|
+
/** 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.
|
|
3773
|
+
* @param event The event to send.
|
|
3774
|
+
* @param options Options for sending the event.
|
|
3775
|
+
* @returns A promise that resolves to the event details
|
|
3776
|
+
*/
|
|
3466
3777
|
sendEvent(event: SendEvent, options?: SendEventOptions): Promise<{
|
|
3467
3778
|
context?: DeserializedJson | undefined;
|
|
3468
3779
|
deliverAt?: Date | null | undefined;
|
|
@@ -3493,9 +3804,8 @@ declare class TriggerClient {
|
|
|
3493
3804
|
unregisterSchedule(id: string, key: string): Promise<{
|
|
3494
3805
|
ok: boolean;
|
|
3495
3806
|
}>;
|
|
3496
|
-
authorized(apiKey?: string | null):
|
|
3807
|
+
authorized(apiKey?: string | null): "authorized" | "unauthorized" | "missing-client" | "missing-header";
|
|
3497
3808
|
apiKey(): string | undefined;
|
|
3498
|
-
listen(): Promise<void>;
|
|
3499
3809
|
}
|
|
3500
3810
|
|
|
3501
3811
|
type ScheduledEventSpecification = EventSpecification<ScheduledPayload>;
|
|
@@ -3507,6 +3817,15 @@ declare class IntervalTrigger implements Trigger<ScheduledEventSpecification> {
|
|
|
3507
3817
|
title: string;
|
|
3508
3818
|
source: string;
|
|
3509
3819
|
icon: string;
|
|
3820
|
+
examples: {
|
|
3821
|
+
id: string;
|
|
3822
|
+
name: string;
|
|
3823
|
+
icon: string;
|
|
3824
|
+
payload: {
|
|
3825
|
+
ts: string;
|
|
3826
|
+
lastTimestamp: string;
|
|
3827
|
+
};
|
|
3828
|
+
}[];
|
|
3510
3829
|
parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
|
|
3511
3830
|
lastTimestamp?: Date | undefined;
|
|
3512
3831
|
ts: Date;
|
|
@@ -3529,6 +3848,15 @@ declare class CronTrigger implements Trigger<ScheduledEventSpecification> {
|
|
|
3529
3848
|
title: string;
|
|
3530
3849
|
source: string;
|
|
3531
3850
|
icon: string;
|
|
3851
|
+
examples: {
|
|
3852
|
+
id: string;
|
|
3853
|
+
name: string;
|
|
3854
|
+
icon: string;
|
|
3855
|
+
payload: {
|
|
3856
|
+
ts: string;
|
|
3857
|
+
lastTimestamp: string;
|
|
3858
|
+
};
|
|
3859
|
+
}[];
|
|
3532
3860
|
parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
|
|
3533
3861
|
lastTimestamp?: Date | undefined;
|
|
3534
3862
|
ts: Date;
|
|
@@ -3556,6 +3884,15 @@ declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
|
|
|
3556
3884
|
title: string;
|
|
3557
3885
|
source: string;
|
|
3558
3886
|
icon: string;
|
|
3887
|
+
examples: {
|
|
3888
|
+
id: string;
|
|
3889
|
+
name: string;
|
|
3890
|
+
icon: string;
|
|
3891
|
+
payload: {
|
|
3892
|
+
ts: string;
|
|
3893
|
+
lastTimestamp: string;
|
|
3894
|
+
};
|
|
3895
|
+
}[];
|
|
3559
3896
|
parsePayload: (data: unknown, params?: Partial<zod.ParseParams> | undefined) => {
|
|
3560
3897
|
lastTimestamp?: Date | undefined;
|
|
3561
3898
|
ts: Date;
|
|
@@ -3595,6 +3932,8 @@ type IOOptions = {
|
|
|
3595
3932
|
context: TriggerContext;
|
|
3596
3933
|
logger?: Logger;
|
|
3597
3934
|
logLevel?: LogLevel;
|
|
3935
|
+
jobLogger?: Logger;
|
|
3936
|
+
jobLogLevel: LogLevel;
|
|
3598
3937
|
cachedTasks?: Array<CachedTask>;
|
|
3599
3938
|
};
|
|
3600
3939
|
declare class IO {
|
|
@@ -3603,12 +3942,36 @@ declare class IO {
|
|
|
3603
3942
|
private _apiClient;
|
|
3604
3943
|
private _triggerClient;
|
|
3605
3944
|
private _logger;
|
|
3945
|
+
private _jobLogger?;
|
|
3946
|
+
private _jobLogLevel;
|
|
3606
3947
|
private _cachedTasks;
|
|
3607
3948
|
private _taskStorage;
|
|
3608
3949
|
private _context;
|
|
3609
3950
|
constructor(options: IOOptions);
|
|
3951
|
+
/** Used to send log messages to the [Run log](https://trigger.dev/docs/documentation/guides/viewing-runs). */
|
|
3610
3952
|
get logger(): IOLogger;
|
|
3953
|
+
/** `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.
|
|
3954
|
+
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
|
3955
|
+
* @param seconds The number of seconds to wait. This can be very long, serverless timeouts are not an issue.
|
|
3956
|
+
*/
|
|
3611
3957
|
wait(key: string | any[], seconds: number): Promise<void>;
|
|
3958
|
+
/** `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.
|
|
3959
|
+
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
|
3960
|
+
* @param url The URL to fetch from.
|
|
3961
|
+
* @param requestInit The options for the request
|
|
3962
|
+
* @param retry The options for retrying the request if it fails
|
|
3963
|
+
* An object where the key is a status code pattern and the value is a retrying strategy.
|
|
3964
|
+
* Supported patterns are:
|
|
3965
|
+
* - Specific status codes: 429
|
|
3966
|
+
* - Ranges: 500-599
|
|
3967
|
+
* - Wildcards: 2xx, 3xx, 4xx, 5xx
|
|
3968
|
+
*/
|
|
3969
|
+
backgroundFetch<TResponseData>(key: string | any[], url: string, requestInit?: FetchRequestInit, retry?: FetchRetryOptions): Promise<TResponseData>;
|
|
3970
|
+
/** `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).
|
|
3971
|
+
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
|
3972
|
+
* @param event The event to send. The event name must match the name of the event that your Jobs are listening for.
|
|
3973
|
+
* @param options Options for sending the event.
|
|
3974
|
+
*/
|
|
3612
3975
|
sendEvent(key: string | any[], event: SendEvent, options?: SendEventOptions): Promise<{
|
|
3613
3976
|
context?: DeserializedJson | undefined;
|
|
3614
3977
|
deliverAt?: Date | null | undefined;
|
|
@@ -3624,6 +3987,13 @@ declare class IO {
|
|
|
3624
3987
|
id: string;
|
|
3625
3988
|
key: string;
|
|
3626
3989
|
}>;
|
|
3990
|
+
/** `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.
|
|
3991
|
+
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
|
3992
|
+
* @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to register a new schedule on.
|
|
3993
|
+
* @param id A unique id for the interval. This is used to identify and unregister the interval later.
|
|
3994
|
+
* @param options The options for the interval.
|
|
3995
|
+
* @returns A promise that has information about the interval.
|
|
3996
|
+
*/
|
|
3627
3997
|
registerInterval(key: string | any[], dynamicSchedule: DynamicSchedule, id: string, options: IntervalOptions): Promise<{
|
|
3628
3998
|
metadata?: any;
|
|
3629
3999
|
id: string;
|
|
@@ -3642,9 +4012,20 @@ declare class IO {
|
|
|
3642
4012
|
};
|
|
3643
4013
|
active: boolean;
|
|
3644
4014
|
}>;
|
|
4015
|
+
/** `io.unregisterInterval()` allows you to unregister a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that was previously registered with `io.registerInterval()`.
|
|
4016
|
+
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
|
4017
|
+
* @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to unregister a schedule on.
|
|
4018
|
+
* @param id A unique id for the interval. This is used to identify and unregister the interval later.
|
|
4019
|
+
*/
|
|
3645
4020
|
unregisterInterval(key: string | any[], dynamicSchedule: DynamicSchedule, id: string): Promise<{
|
|
3646
4021
|
ok: boolean;
|
|
3647
4022
|
}>;
|
|
4023
|
+
/** `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.
|
|
4024
|
+
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
|
4025
|
+
* @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to register a new schedule on.
|
|
4026
|
+
* @param id A unique id for the schedule. This is used to identify and unregister the schedule later.
|
|
4027
|
+
* @param options The options for the CRON schedule.
|
|
4028
|
+
*/
|
|
3648
4029
|
registerCron(key: string | any[], dynamicSchedule: DynamicSchedule, id: string, options: CronOptions): Promise<{
|
|
3649
4030
|
metadata?: any;
|
|
3650
4031
|
id: string;
|
|
@@ -3663,27 +4044,59 @@ declare class IO {
|
|
|
3663
4044
|
};
|
|
3664
4045
|
active: boolean;
|
|
3665
4046
|
}>;
|
|
4047
|
+
/** `io.unregisterCron()` allows you to unregister a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that was previously registered with `io.registerCron()`.
|
|
4048
|
+
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
|
4049
|
+
* @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to unregister a schedule on.
|
|
4050
|
+
* @param id A unique id for the interval. This is used to identify and unregister the interval later.
|
|
4051
|
+
*/
|
|
3666
4052
|
unregisterCron(key: string | any[], dynamicSchedule: DynamicSchedule, id: string): Promise<{
|
|
3667
4053
|
ok: boolean;
|
|
3668
4054
|
}>;
|
|
4055
|
+
/** `io.registerTrigger()` allows you to register a [DynamicTrigger](https://trigger.dev/docs/sdk/dynamictrigger) with the specified trigger params.
|
|
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 trigger The [DynamicTrigger](https://trigger.dev/docs/sdk/dynamictrigger) to register.
|
|
4058
|
+
* @param id A unique id for the trigger. This is used to identify and unregister the trigger later.
|
|
4059
|
+
* @param params The params for the trigger.
|
|
4060
|
+
*/
|
|
3669
4061
|
registerTrigger<TTrigger extends DynamicTrigger<EventSpecification<any>, ExternalSource<any, any, any>>>(key: string | any[], trigger: TTrigger, id: string, params: ExternalSourceParams<TTrigger["source"]>): Promise<{
|
|
3670
4062
|
id: string;
|
|
3671
4063
|
key: string;
|
|
3672
4064
|
} | undefined>;
|
|
3673
4065
|
getAuth(key: string | any[], clientId?: string): Promise<ConnectionAuth | undefined>;
|
|
4066
|
+
/** `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.
|
|
4067
|
+
*
|
|
4068
|
+
* @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
|
|
4069
|
+
* @param options The options of how you'd like to run and log the Task. Name is required.
|
|
4070
|
+
* @param callback The callback that will be called when the Task is run. The callback receives the Task and the IO as parameters.
|
|
4071
|
+
= * @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.
|
|
4072
|
+
* @returns A Promise that resolves with the returned value of the callback.
|
|
4073
|
+
*/
|
|
3674
4074
|
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
4075
|
retryAt: Date;
|
|
3676
4076
|
error?: Error;
|
|
4077
|
+
jitter?: number;
|
|
3677
4078
|
} | undefined | void): Promise<TResult>;
|
|
4079
|
+
/** `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).
|
|
4080
|
+
* 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.
|
|
4081
|
+
* @param tryCallback The code you wish to run
|
|
4082
|
+
* @param catchCallback Thhis will be called if the Task fails. The callback receives the error
|
|
4083
|
+
* @returns A Promise that resolves with the returned value or the error
|
|
4084
|
+
*/
|
|
3678
4085
|
try<TResult, TCatchResult>(tryCallback: () => Promise<TResult>, catchCallback: (error: unknown) => Promise<TCatchResult>): Promise<TResult | TCatchResult>;
|
|
3679
4086
|
}
|
|
3680
|
-
type CallbackFunction = (level: "DEBUG" | "INFO" | "WARN" | "ERROR", message: string, properties?: Record<string, any>) => Promise<void>;
|
|
4087
|
+
type CallbackFunction = (level: "DEBUG" | "INFO" | "WARN" | "ERROR" | "LOG", message: string, properties?: Record<string, any>) => Promise<void>;
|
|
3681
4088
|
declare class IOLogger implements TaskLogger {
|
|
3682
4089
|
private callback;
|
|
3683
4090
|
constructor(callback: CallbackFunction);
|
|
4091
|
+
/** Log: essential messages */
|
|
4092
|
+
log(message: string, properties?: Record<string, any>): Promise<void>;
|
|
4093
|
+
/** For debugging: the least important log level */
|
|
3684
4094
|
debug(message: string, properties?: Record<string, any>): Promise<void>;
|
|
4095
|
+
/** Info: the second least important log level */
|
|
3685
4096
|
info(message: string, properties?: Record<string, any>): Promise<void>;
|
|
4097
|
+
/** Warnings: the third most important log level */
|
|
3686
4098
|
warn(message: string, properties?: Record<string, any>): Promise<void>;
|
|
4099
|
+
/** Error: The second most important log level */
|
|
3687
4100
|
error(message: string, properties?: Record<string, any>): Promise<void>;
|
|
3688
4101
|
}
|
|
3689
4102
|
|
|
@@ -3693,17 +4106,18 @@ interface TriggerIntegration<TIntegrationClient extends IntegrationClient<any, a
|
|
|
3693
4106
|
id: string;
|
|
3694
4107
|
metadata: IntegrationMetadata;
|
|
3695
4108
|
}
|
|
3696
|
-
type IntegrationClient<TClient, TTasks extends Record<string, AuthenticatedTask<TClient, any, any>>> = {
|
|
4109
|
+
type IntegrationClient<TClient, TTasks extends Record<string, AuthenticatedTask<TClient, any, any, any>>> = {
|
|
3697
4110
|
usesLocalAuth: true;
|
|
3698
4111
|
client: TClient;
|
|
3699
4112
|
tasks?: TTasks;
|
|
4113
|
+
auth: any;
|
|
3700
4114
|
} | {
|
|
3701
4115
|
usesLocalAuth: false;
|
|
3702
4116
|
clientFactory: ClientFactory<TClient>;
|
|
3703
4117
|
tasks?: TTasks;
|
|
3704
4118
|
};
|
|
3705
|
-
type AuthenticatedTask<TClient, TParams, TResult> = {
|
|
3706
|
-
run: (params: TParams, client: TClient, task: ServerTask, io: IO) => Promise<TResult>;
|
|
4119
|
+
type AuthenticatedTask<TClient, TParams, TResult, TAuth = ConnectionAuth> = {
|
|
4120
|
+
run: (params: TParams, client: TClient, task: ServerTask, io: IO, auth: TAuth) => Promise<TResult>;
|
|
3707
4121
|
init: (params: TParams) => RunTaskOptions;
|
|
3708
4122
|
onError?: (error: unknown, task: ServerTask) => {
|
|
3709
4123
|
retryAt: Date;
|
|
@@ -3714,8 +4128,8 @@ declare function authenticatedTask<TClient, TParams, TResult>(options: {
|
|
|
3714
4128
|
run: (params: TParams, client: TClient, task: ServerTask, io: IO) => Promise<TResult>;
|
|
3715
4129
|
init: (params: TParams) => RunTaskOptions;
|
|
3716
4130
|
}): 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>>> = {
|
|
4131
|
+
type ExtractRunFunction<T> = T extends AuthenticatedTask<any, infer TParams, infer TResult, infer TAuth> ? (key: string, params: TParams) => Promise<TResult> : never;
|
|
4132
|
+
type ExtractTasks<TTasks extends Record<string, AuthenticatedTask<any, any, any, any>>> = {
|
|
3719
4133
|
[key in keyof TTasks]: ExtractRunFunction<TTasks[key]>;
|
|
3720
4134
|
};
|
|
3721
4135
|
type ExtractIntegrationClientClient<TIntegrationClient extends IntegrationClient<any, any>> = TIntegrationClient extends {
|
|
@@ -3736,28 +4150,69 @@ type ExtractIntegrations<TIntegrations extends Record<string, TriggerIntegration
|
|
|
3736
4150
|
type IOWithIntegrations<TIntegrations extends Record<string, TriggerIntegration<IntegrationClient<any, any>>>> = IO & ExtractIntegrations<TIntegrations>;
|
|
3737
4151
|
|
|
3738
4152
|
type JobOptions<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration<IntegrationClient<any, any>>> = {}> = {
|
|
4153
|
+
/** The `id` property is used to uniquely identify the Job. Only change this if you want to create a new Job. */
|
|
3739
4154
|
id: string;
|
|
4155
|
+
/** 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
4156
|
name: string;
|
|
4157
|
+
/** 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
4158
|
version: string;
|
|
4159
|
+
/** The `trigger` property is used to define when the Job should run. There are currently the following Trigger types:
|
|
4160
|
+
- [cronTrigger](https://trigger.dev/docs/sdk/crontrigger)
|
|
4161
|
+
- [intervalTrigger](https://trigger.dev/docs/sdk/intervaltrigger)
|
|
4162
|
+
- [eventTrigger](https://trigger.dev/docs/sdk/eventtrigger)
|
|
4163
|
+
- [DynamicTrigger](https://trigger.dev/docs/sdk/dynamictrigger)
|
|
4164
|
+
- [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule)
|
|
4165
|
+
- integration Triggers, like webhooks. See the [integrations](https://trigger.dev/docs/integrations) page for more information. */
|
|
3742
4166
|
trigger: TTrigger;
|
|
4167
|
+
/** The `logLevel` property is an optional property that specifies the level of
|
|
4168
|
+
logging for the Job. The level is inherited from the client if you omit this property. */
|
|
3743
4169
|
logLevel?: LogLevel;
|
|
4170
|
+
/** 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:
|
|
4171
|
+
```ts
|
|
4172
|
+
new Job(client, {
|
|
4173
|
+
//... other options
|
|
4174
|
+
integrations: {
|
|
4175
|
+
slack,
|
|
4176
|
+
gh: github,
|
|
4177
|
+
},
|
|
4178
|
+
run: async (payload, io, ctx) => {
|
|
4179
|
+
//slack is available on io.slack
|
|
4180
|
+
io.slack.postMessage(...);
|
|
4181
|
+
//github is available on io.gh
|
|
4182
|
+
io.gh.addIssueLabels(...);
|
|
4183
|
+
}
|
|
4184
|
+
});
|
|
4185
|
+
``` */
|
|
3744
4186
|
integrations?: TIntegrations;
|
|
4187
|
+
/** 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
4188
|
queue?: QueueOptions | string;
|
|
3746
4189
|
startPosition?: "initial" | "latest";
|
|
4190
|
+
/** The `enabled` property is used to enable or disable the Job. If you disable a Job, it will not run. */
|
|
3747
4191
|
enabled?: boolean;
|
|
3748
|
-
|
|
4192
|
+
/** This function gets called automatically when a Run is Triggered.
|
|
4193
|
+
* 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.
|
|
4194
|
+
* @param payload The payload of the event
|
|
4195
|
+
* @param io An object that contains the integrations that you specified in the `integrations` property and other useful functions like delays and running Tasks.
|
|
4196
|
+
* @param context An object that contains information about the Organization, Job, Run and more.
|
|
4197
|
+
*/
|
|
4198
|
+
run: (payload: TriggerEventType<TTrigger>, io: IOWithIntegrations<TIntegrations>, context: TriggerContext) => Promise<any>;
|
|
3749
4199
|
};
|
|
4200
|
+
/** 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
4201
|
declare class Job<TTrigger extends Trigger<EventSpecification<any>>, TIntegrations extends Record<string, TriggerIntegration<IntegrationClient<any, any>>> = {}> {
|
|
3751
4202
|
#private;
|
|
3752
4203
|
readonly options: JobOptions<TTrigger, TIntegrations>;
|
|
3753
4204
|
client: TriggerClient;
|
|
3754
|
-
constructor(
|
|
4205
|
+
constructor(
|
|
4206
|
+
/** An instance of [TriggerClient](/sdk/triggerclient) that is used to send events
|
|
4207
|
+
to the Trigger API. */
|
|
4208
|
+
client: TriggerClient, options: JobOptions<TTrigger, TIntegrations>);
|
|
3755
4209
|
get id(): string;
|
|
3756
4210
|
get enabled(): boolean;
|
|
3757
4211
|
get name(): string;
|
|
3758
4212
|
get trigger(): TTrigger;
|
|
3759
4213
|
get version(): string;
|
|
3760
4214
|
get integrations(): Record<string, IntegrationConfig>;
|
|
4215
|
+
get logLevel(): LogLevel | undefined;
|
|
3761
4216
|
toJSON(): JobMetadata;
|
|
3762
4217
|
}
|
|
3763
4218
|
|
|
@@ -3775,12 +4230,40 @@ declare class EventTrigger<TEventSpecification extends EventSpecification<any>>
|
|
|
3775
4230
|
attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpecification>, any>): void;
|
|
3776
4231
|
get preprocessRuns(): boolean;
|
|
3777
4232
|
}
|
|
4233
|
+
/** Configuration options for an EventTrigger */
|
|
3778
4234
|
type TriggerOptions<TEvent> = {
|
|
4235
|
+
/** The name of the event you are subscribing to. Must be an exact match (case sensitive). */
|
|
3779
4236
|
name: string;
|
|
4237
|
+
/** A [Zod](https://trigger.dev/docs/documentation/guides/zod) schema that defines the shape of the event payload.
|
|
4238
|
+
* The default is `z.any()` which is `any`.
|
|
4239
|
+
* */
|
|
3780
4240
|
schema?: z.Schema<TEvent>;
|
|
4241
|
+
/** You can use this to filter events based on the source. */
|
|
3781
4242
|
source?: string;
|
|
4243
|
+
/** Used to filter which events trigger the Job
|
|
4244
|
+
* @example
|
|
4245
|
+
* filter:
|
|
4246
|
+
* ```ts
|
|
4247
|
+
* {
|
|
4248
|
+
* name: ["John", "Jane"],
|
|
4249
|
+
* age: [18, 21]
|
|
4250
|
+
* }
|
|
4251
|
+
* ```
|
|
4252
|
+
*
|
|
4253
|
+
* This filter would match against an event with the following data:
|
|
4254
|
+
* ```json
|
|
4255
|
+
* {
|
|
4256
|
+
* "name": "Jane",
|
|
4257
|
+
* "age": 18,
|
|
4258
|
+
* "location": "San Francisco"
|
|
4259
|
+
* }
|
|
4260
|
+
* ```
|
|
4261
|
+
*/
|
|
3782
4262
|
filter?: EventFilter;
|
|
3783
4263
|
};
|
|
4264
|
+
/** `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)
|
|
4265
|
+
* @param options options for the EventTrigger
|
|
4266
|
+
*/
|
|
3784
4267
|
declare function eventTrigger<TEvent extends any = any>(options: TriggerOptions<TEvent>): Trigger<EventSpecification<TEvent>>;
|
|
3785
4268
|
|
|
3786
4269
|
declare function missingConnectionNotification(integrations: Array<TriggerIntegration>): MissingConnectionNotification;
|
|
@@ -3806,8 +4289,6 @@ declare class MissingConnectionNotification implements Trigger<MissingConnection
|
|
|
3806
4289
|
title: string;
|
|
3807
4290
|
createdAt: Date;
|
|
3808
4291
|
updatedAt: Date;
|
|
3809
|
-
integrationIdentifier: string;
|
|
3810
|
-
integrationAuthMethod: string;
|
|
3811
4292
|
};
|
|
3812
4293
|
authorizationUrl: string;
|
|
3813
4294
|
} | {
|
|
@@ -3823,8 +4304,6 @@ declare class MissingConnectionNotification implements Trigger<MissingConnection
|
|
|
3823
4304
|
title: string;
|
|
3824
4305
|
createdAt: Date;
|
|
3825
4306
|
updatedAt: Date;
|
|
3826
|
-
integrationIdentifier: string;
|
|
3827
|
-
integrationAuthMethod: string;
|
|
3828
4307
|
};
|
|
3829
4308
|
authorizationUrl: string;
|
|
3830
4309
|
};
|
|
@@ -3897,9 +4376,15 @@ declare class RetryWithTaskError {
|
|
|
3897
4376
|
retryAt: Date;
|
|
3898
4377
|
constructor(cause: ErrorWithStack, task: ServerTask, retryAt: Date);
|
|
3899
4378
|
}
|
|
4379
|
+
/** Use this function if you're using a `try/catch` block to catch errors.
|
|
4380
|
+
* It checks if a thrown error is a special internal error that you should ignore.
|
|
4381
|
+
* If this returns `true` then you must rethrow the error: `throw err;`
|
|
4382
|
+
* @param err The error to check
|
|
4383
|
+
* @returns `true` if the error is a Trigger Error, `false` otherwise.
|
|
4384
|
+
*/
|
|
3900
4385
|
declare function isTriggerError(err: unknown): err is ResumeWithTaskError | RetryWithTaskError;
|
|
3901
4386
|
|
|
3902
4387
|
type Task = ServerTask;
|
|
3903
|
-
declare function
|
|
4388
|
+
declare function redactString(strings: TemplateStringsArray, ...interpolations: string[]): RedactString;
|
|
3904
4389
|
|
|
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,
|
|
4390
|
+
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 };
|