@trigger.dev/core 2.2.7 → 2.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +646 -1046
- package/dist/index.js +112 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -53,11 +53,13 @@ __export(src_exports, {
|
|
|
53
53
|
CommonMissingConnectionNotificationResolvedPayloadSchema: () => CommonMissingConnectionNotificationResolvedPayloadSchema,
|
|
54
54
|
CompleteTaskBodyInputSchema: () => CompleteTaskBodyInputSchema,
|
|
55
55
|
CompleteTaskBodyV2InputSchema: () => CompleteTaskBodyV2InputSchema,
|
|
56
|
+
ConcurrencyLimitOptionsSchema: () => ConcurrencyLimitOptionsSchema,
|
|
56
57
|
ConnectionAuthSchema: () => ConnectionAuthSchema,
|
|
57
58
|
CreateExternalConnectionBodySchema: () => CreateExternalConnectionBodySchema,
|
|
58
59
|
CreateRunResponseBodySchema: () => CreateRunResponseBodySchema,
|
|
59
60
|
CronMetadataSchema: () => CronMetadataSchema,
|
|
60
61
|
CronOptionsSchema: () => CronOptionsSchema,
|
|
62
|
+
DELIVER_WEBHOOK_REQUEST: () => DELIVER_WEBHOOK_REQUEST,
|
|
61
63
|
DeliverEventResponseSchema: () => DeliverEventResponseSchema,
|
|
62
64
|
DeserializedJsonSchema: () => DeserializedJsonSchema,
|
|
63
65
|
DisplayPropertiesSchema: () => DisplayPropertiesSchema,
|
|
@@ -107,6 +109,7 @@ __export(src_exports, {
|
|
|
107
109
|
InvokeTriggerMetadataSchema: () => InvokeTriggerMetadataSchema,
|
|
108
110
|
JobMetadataSchema: () => JobMetadataSchema,
|
|
109
111
|
JobRunStatusRecordSchema: () => JobRunStatusRecordSchema,
|
|
112
|
+
KeyValueStoreResponseBodySchema: () => KeyValueStoreResponseBodySchema,
|
|
110
113
|
LogMessageSchema: () => LogMessageSchema,
|
|
111
114
|
Logger: () => Logger,
|
|
112
115
|
MISSING_CONNECTION_NOTIFICATION: () => MISSING_CONNECTION_NOTIFICATION,
|
|
@@ -128,6 +131,7 @@ __export(src_exports, {
|
|
|
128
131
|
QueueOptionsSchema: () => QueueOptionsSchema,
|
|
129
132
|
REGISTER_SOURCE_EVENT_V1: () => REGISTER_SOURCE_EVENT_V1,
|
|
130
133
|
REGISTER_SOURCE_EVENT_V2: () => REGISTER_SOURCE_EVENT_V2,
|
|
134
|
+
REGISTER_WEBHOOK: () => REGISTER_WEBHOOK,
|
|
131
135
|
RawEventSchema: () => RawEventSchema,
|
|
132
136
|
RedactSchema: () => RedactSchema,
|
|
133
137
|
RedactStringSchema: () => RedactStringSchema,
|
|
@@ -144,6 +148,8 @@ __export(src_exports, {
|
|
|
144
148
|
RegisterTriggerBodySchemaV1: () => RegisterTriggerBodySchemaV1,
|
|
145
149
|
RegisterTriggerBodySchemaV2: () => RegisterTriggerBodySchemaV2,
|
|
146
150
|
RegisterTriggerSourceSchema: () => RegisterTriggerSourceSchema,
|
|
151
|
+
RegisterWebhookPayloadSchema: () => RegisterWebhookPayloadSchema,
|
|
152
|
+
RegisterWebhookSourceSchema: () => RegisterWebhookSourceSchema,
|
|
147
153
|
RequestFilterSchema: () => RequestFilterSchema,
|
|
148
154
|
RequestWithRawBodySchema: () => RequestWithRawBodySchema,
|
|
149
155
|
ResponseFilterSchema: () => ResponseFilterSchema,
|
|
@@ -193,10 +199,16 @@ __export(src_exports, {
|
|
|
193
199
|
TriggerSourceSchema: () => TriggerSourceSchema,
|
|
194
200
|
UpdateTriggerSourceBodyV1Schema: () => UpdateTriggerSourceBodyV1Schema,
|
|
195
201
|
UpdateTriggerSourceBodyV2Schema: () => UpdateTriggerSourceBodyV2Schema,
|
|
202
|
+
UpdateWebhookBodySchema: () => UpdateWebhookBodySchema,
|
|
196
203
|
ValidateErrorResponseSchema: () => ValidateErrorResponseSchema,
|
|
197
204
|
ValidateResponseSchema: () => ValidateResponseSchema,
|
|
198
205
|
ValidateSuccessResponseSchema: () => ValidateSuccessResponseSchema,
|
|
206
|
+
WebhookContextMetadataSchema: () => WebhookContextMetadataSchema,
|
|
207
|
+
WebhookDeliveryResponseSchema: () => WebhookDeliveryResponseSchema,
|
|
208
|
+
WebhookMetadataSchema: () => WebhookMetadataSchema,
|
|
209
|
+
WebhookSourceRequestHeadersSchema: () => WebhookSourceRequestHeadersSchema,
|
|
199
210
|
addMissingVersionField: () => addMissingVersionField,
|
|
211
|
+
assertExhaustive: () => assertExhaustive,
|
|
200
212
|
calculateResetAt: () => calculateResetAt,
|
|
201
213
|
calculateRetryAt: () => calculateRetryAt,
|
|
202
214
|
currentDate: () => currentDate,
|
|
@@ -750,7 +762,10 @@ var RunStatusSchema = import_zod10.z.union([
|
|
|
750
762
|
import_zod10.z.literal("ABORTED"),
|
|
751
763
|
import_zod10.z.literal("CANCELED"),
|
|
752
764
|
import_zod10.z.literal("UNRESOLVED_AUTH"),
|
|
753
|
-
import_zod10.z.literal("INVALID_PAYLOAD")
|
|
765
|
+
import_zod10.z.literal("INVALID_PAYLOAD"),
|
|
766
|
+
import_zod10.z.literal("EXECUTING"),
|
|
767
|
+
import_zod10.z.literal("WAITING_TO_CONTINUE"),
|
|
768
|
+
import_zod10.z.literal("WAITING_TO_EXECUTE")
|
|
754
769
|
]);
|
|
755
770
|
var RunTaskSchema = import_zod10.z.object({
|
|
756
771
|
/** The Task id */
|
|
@@ -889,6 +904,15 @@ var UpdateTriggerSourceBodyV2Schema = import_zod12.z.object({
|
|
|
889
904
|
event: import_zod12.z.array(import_zod12.z.string())
|
|
890
905
|
}).and(import_zod12.z.record(import_zod12.z.string(), import_zod12.z.array(import_zod12.z.string())).optional())
|
|
891
906
|
});
|
|
907
|
+
var UpdateWebhookBodySchema = import_zod12.z.discriminatedUnion("active", [
|
|
908
|
+
import_zod12.z.object({
|
|
909
|
+
active: import_zod12.z.literal(false)
|
|
910
|
+
}),
|
|
911
|
+
import_zod12.z.object({
|
|
912
|
+
active: import_zod12.z.literal(true),
|
|
913
|
+
config: import_zod12.z.record(import_zod12.z.string().array())
|
|
914
|
+
})
|
|
915
|
+
]);
|
|
892
916
|
var RegisterHTTPTriggerSourceBodySchema = import_zod12.z.object({
|
|
893
917
|
type: import_zod12.z.literal("HTTP"),
|
|
894
918
|
url: import_zod12.z.string().url()
|
|
@@ -904,6 +928,29 @@ var RegisterSourceChannelBodySchema = import_zod12.z.discriminatedUnion("type",
|
|
|
904
928
|
RegisterSMTPTriggerSourceBodySchema,
|
|
905
929
|
RegisterSQSTriggerSourceBodySchema
|
|
906
930
|
]);
|
|
931
|
+
var REGISTER_WEBHOOK = "dev.trigger.webhook.register";
|
|
932
|
+
var DELIVER_WEBHOOK_REQUEST = "dev.trigger.webhook.deliver";
|
|
933
|
+
var RegisterWebhookSourceSchema = import_zod12.z.object({
|
|
934
|
+
key: import_zod12.z.string(),
|
|
935
|
+
params: import_zod12.z.any(),
|
|
936
|
+
config: import_zod12.z.any(),
|
|
937
|
+
active: import_zod12.z.boolean(),
|
|
938
|
+
secret: import_zod12.z.string(),
|
|
939
|
+
url: import_zod12.z.string(),
|
|
940
|
+
data: DeserializedJsonSchema.optional(),
|
|
941
|
+
clientId: import_zod12.z.string().optional()
|
|
942
|
+
});
|
|
943
|
+
var RegisterWebhookPayloadSchema = import_zod12.z.object({
|
|
944
|
+
active: import_zod12.z.boolean(),
|
|
945
|
+
params: import_zod12.z.any().optional(),
|
|
946
|
+
config: import_zod12.z.object({
|
|
947
|
+
current: import_zod12.z.record(import_zod12.z.string().array()),
|
|
948
|
+
desired: import_zod12.z.record(import_zod12.z.string().array())
|
|
949
|
+
}),
|
|
950
|
+
// from HTTP Endpoint
|
|
951
|
+
url: import_zod12.z.string(),
|
|
952
|
+
secret: import_zod12.z.string()
|
|
953
|
+
});
|
|
907
954
|
var REGISTER_SOURCE_EVENT_V1 = "dev.trigger.source.register";
|
|
908
955
|
var REGISTER_SOURCE_EVENT_V2 = "dev.trigger.source.register.v2";
|
|
909
956
|
var RegisterTriggerSourceSchema = import_zod12.z.object({
|
|
@@ -984,6 +1031,15 @@ var HttpEndpointRequestHeadersSchema = import_zod12.z.object({
|
|
|
984
1031
|
"x-ts-http-method": import_zod12.z.string(),
|
|
985
1032
|
"x-ts-http-headers": import_zod12.z.string().transform((s) => import_zod12.z.record(import_zod12.z.string()).parse(JSON.parse(s)))
|
|
986
1033
|
});
|
|
1034
|
+
var WebhookSourceRequestHeadersSchema = import_zod12.z.object({
|
|
1035
|
+
"x-ts-key": import_zod12.z.string(),
|
|
1036
|
+
"x-ts-dynamic-id": import_zod12.z.string().optional(),
|
|
1037
|
+
"x-ts-secret": import_zod12.z.string(),
|
|
1038
|
+
"x-ts-params": import_zod12.z.string().transform((s) => JSON.parse(s)),
|
|
1039
|
+
"x-ts-http-url": import_zod12.z.string(),
|
|
1040
|
+
"x-ts-http-method": import_zod12.z.string(),
|
|
1041
|
+
"x-ts-http-headers": import_zod12.z.string().transform((s) => import_zod12.z.record(import_zod12.z.string()).parse(JSON.parse(s)))
|
|
1042
|
+
});
|
|
987
1043
|
var PongSuccessResponseSchema = import_zod12.z.object({
|
|
988
1044
|
ok: import_zod12.z.literal(true),
|
|
989
1045
|
triggerVersion: import_zod12.z.string().optional(),
|
|
@@ -1017,6 +1073,10 @@ var QueueOptionsSchema = import_zod12.z.object({
|
|
|
1017
1073
|
name: import_zod12.z.string(),
|
|
1018
1074
|
maxConcurrent: import_zod12.z.number().optional()
|
|
1019
1075
|
});
|
|
1076
|
+
var ConcurrencyLimitOptionsSchema = import_zod12.z.object({
|
|
1077
|
+
id: import_zod12.z.string(),
|
|
1078
|
+
limit: import_zod12.z.number()
|
|
1079
|
+
});
|
|
1020
1080
|
var JobMetadataSchema = import_zod12.z.object({
|
|
1021
1081
|
id: import_zod12.z.string(),
|
|
1022
1082
|
name: import_zod12.z.string(),
|
|
@@ -1030,7 +1090,8 @@ var JobMetadataSchema = import_zod12.z.object({
|
|
|
1030
1090
|
"initial",
|
|
1031
1091
|
"latest"
|
|
1032
1092
|
]),
|
|
1033
|
-
preprocessRuns: import_zod12.z.boolean()
|
|
1093
|
+
preprocessRuns: import_zod12.z.boolean(),
|
|
1094
|
+
concurrencyLimit: ConcurrencyLimitOptionsSchema.or(import_zod12.z.number().int().positive()).optional()
|
|
1034
1095
|
});
|
|
1035
1096
|
var SourceMetadataV1Schema = import_zod12.z.object({
|
|
1036
1097
|
version: import_zod12.z.literal("1"),
|
|
@@ -1068,6 +1129,20 @@ var SourceMetadataSchema = import_zod12.z.preprocess(addMissingVersionField, imp
|
|
|
1068
1129
|
SourceMetadataV1Schema,
|
|
1069
1130
|
SourceMetadataV2Schema
|
|
1070
1131
|
]));
|
|
1132
|
+
var WebhookMetadataSchema = import_zod12.z.object({
|
|
1133
|
+
key: import_zod12.z.string(),
|
|
1134
|
+
params: import_zod12.z.any(),
|
|
1135
|
+
config: import_zod12.z.record(import_zod12.z.array(import_zod12.z.string())),
|
|
1136
|
+
integration: IntegrationConfigSchema,
|
|
1137
|
+
httpEndpoint: import_zod12.z.object({
|
|
1138
|
+
id: import_zod12.z.string()
|
|
1139
|
+
})
|
|
1140
|
+
});
|
|
1141
|
+
var WebhookContextMetadataSchema = import_zod12.z.object({
|
|
1142
|
+
params: import_zod12.z.any(),
|
|
1143
|
+
config: import_zod12.z.record(import_zod12.z.string().array()),
|
|
1144
|
+
secret: import_zod12.z.string()
|
|
1145
|
+
});
|
|
1071
1146
|
var DynamicTriggerEndpointMetadataSchema = import_zod12.z.object({
|
|
1072
1147
|
id: import_zod12.z.string(),
|
|
1073
1148
|
jobs: import_zod12.z.array(JobMetadataSchema.pick({
|
|
@@ -1094,6 +1169,7 @@ var HttpEndpointMetadataSchema = import_zod12.z.object({
|
|
|
1094
1169
|
var IndexEndpointResponseSchema = import_zod12.z.object({
|
|
1095
1170
|
jobs: import_zod12.z.array(JobMetadataSchema),
|
|
1096
1171
|
sources: import_zod12.z.array(SourceMetadataSchema),
|
|
1172
|
+
webhooks: import_zod12.z.array(WebhookMetadataSchema).optional(),
|
|
1097
1173
|
dynamicTriggers: import_zod12.z.array(DynamicTriggerEndpointMetadataSchema),
|
|
1098
1174
|
dynamicSchedules: import_zod12.z.array(RegisterDynamicSchedulePayloadSchema),
|
|
1099
1175
|
httpEndpoints: import_zod12.z.array(HttpEndpointMetadataSchema).optional()
|
|
@@ -1105,6 +1181,7 @@ var EndpointIndexErrorSchema = import_zod12.z.object({
|
|
|
1105
1181
|
var IndexEndpointStatsSchema = import_zod12.z.object({
|
|
1106
1182
|
jobs: import_zod12.z.number(),
|
|
1107
1183
|
sources: import_zod12.z.number(),
|
|
1184
|
+
webhooks: import_zod12.z.number().optional(),
|
|
1108
1185
|
dynamicTriggers: import_zod12.z.number(),
|
|
1109
1186
|
dynamicSchedules: import_zod12.z.number(),
|
|
1110
1187
|
disabledJobs: import_zod12.z.number().default(0),
|
|
@@ -1478,7 +1555,6 @@ var RunTaskOptionsSchema = import_zod12.z.object({
|
|
|
1478
1555
|
/** 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). */
|
|
1479
1556
|
noop: import_zod12.z.boolean().default(false),
|
|
1480
1557
|
redact: RedactSchema.optional(),
|
|
1481
|
-
trigger: TriggerMetadataSchema.optional(),
|
|
1482
1558
|
parallel: import_zod12.z.boolean().optional()
|
|
1483
1559
|
});
|
|
1484
1560
|
var RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({
|
|
@@ -1534,6 +1610,11 @@ var HttpSourceResponseSchema = import_zod12.z.object({
|
|
|
1534
1610
|
events: import_zod12.z.array(RawEventSchema),
|
|
1535
1611
|
metadata: HttpSourceResponseMetadataSchema.optional()
|
|
1536
1612
|
});
|
|
1613
|
+
var WebhookDeliveryResponseSchema = import_zod12.z.object({
|
|
1614
|
+
response: NormalizedResponseSchema,
|
|
1615
|
+
verified: import_zod12.z.boolean(),
|
|
1616
|
+
error: import_zod12.z.string().optional()
|
|
1617
|
+
});
|
|
1537
1618
|
var RegisterTriggerBodySchemaV1 = import_zod12.z.object({
|
|
1538
1619
|
rule: EventRuleSchema,
|
|
1539
1620
|
source: SourceMetadataV1Schema
|
|
@@ -1614,6 +1695,28 @@ var EphemeralEventDispatcherRequestBodySchema = import_zod12.z.object({
|
|
|
1614
1695
|
var EphemeralEventDispatcherResponseBodySchema = import_zod12.z.object({
|
|
1615
1696
|
id: import_zod12.z.string()
|
|
1616
1697
|
});
|
|
1698
|
+
var KeyValueStoreResponseBodySchema = import_zod12.z.discriminatedUnion("action", [
|
|
1699
|
+
import_zod12.z.object({
|
|
1700
|
+
action: import_zod12.z.literal("DELETE"),
|
|
1701
|
+
key: import_zod12.z.string(),
|
|
1702
|
+
deleted: import_zod12.z.boolean()
|
|
1703
|
+
}),
|
|
1704
|
+
import_zod12.z.object({
|
|
1705
|
+
action: import_zod12.z.literal("GET"),
|
|
1706
|
+
key: import_zod12.z.string(),
|
|
1707
|
+
value: import_zod12.z.string().optional()
|
|
1708
|
+
}),
|
|
1709
|
+
import_zod12.z.object({
|
|
1710
|
+
action: import_zod12.z.literal("HAS"),
|
|
1711
|
+
key: import_zod12.z.string(),
|
|
1712
|
+
has: import_zod12.z.boolean()
|
|
1713
|
+
}),
|
|
1714
|
+
import_zod12.z.object({
|
|
1715
|
+
action: import_zod12.z.literal("SET"),
|
|
1716
|
+
key: import_zod12.z.string(),
|
|
1717
|
+
value: import_zod12.z.string().optional()
|
|
1718
|
+
})
|
|
1719
|
+
]);
|
|
1617
1720
|
|
|
1618
1721
|
// src/schemas/notifications.ts
|
|
1619
1722
|
var import_zod13 = require("zod");
|
|
@@ -1793,6 +1896,10 @@ function deepMergeFilters(...filters) {
|
|
|
1793
1896
|
return result;
|
|
1794
1897
|
}
|
|
1795
1898
|
__name(deepMergeFilters, "deepMergeFilters");
|
|
1899
|
+
function assertExhaustive(x) {
|
|
1900
|
+
throw new Error("Unexpected object: " + x);
|
|
1901
|
+
}
|
|
1902
|
+
__name(assertExhaustive, "assertExhaustive");
|
|
1796
1903
|
|
|
1797
1904
|
// src/retry.ts
|
|
1798
1905
|
var DEFAULT_RETRY_OPTIONS = {
|
|
@@ -2078,7 +2185,8 @@ async function requestFilterMatches(request, filter) {
|
|
|
2078
2185
|
if (!requestMethodMatches(clonedRequest.method, filter.method)) {
|
|
2079
2186
|
return false;
|
|
2080
2187
|
}
|
|
2081
|
-
|
|
2188
|
+
const headersObj = Object.fromEntries(clonedRequest.headers.entries());
|
|
2189
|
+
if (filter.headers && !eventFilterMatches(headersObj, filter.headers)) {
|
|
2082
2190
|
return false;
|
|
2083
2191
|
}
|
|
2084
2192
|
const searchParams = new URL(clonedRequest.url).searchParams;
|