@trigger.dev/core 0.0.0-cliframeworks-20230929110149 → 0.0.0-invoke-trigger-20231103104037
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 +5432 -293
- package/dist/index.js +230 -19
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -43,11 +43,16 @@ var __privateMethod = (obj, member, method) => {
|
|
|
43
43
|
// src/index.ts
|
|
44
44
|
var src_exports = {};
|
|
45
45
|
__export(src_exports, {
|
|
46
|
+
API_VERSIONS: () => API_VERSIONS,
|
|
46
47
|
ApiEventLogSchema: () => ApiEventLogSchema,
|
|
48
|
+
AutoYieldConfigSchema: () => AutoYieldConfigSchema,
|
|
49
|
+
AutoYieldMetadataSchema: () => AutoYieldMetadataSchema,
|
|
47
50
|
CachedTaskSchema: () => CachedTaskSchema,
|
|
51
|
+
CancelRunsForEventSchema: () => CancelRunsForEventSchema,
|
|
48
52
|
CommonMissingConnectionNotificationPayloadSchema: () => CommonMissingConnectionNotificationPayloadSchema,
|
|
49
53
|
CommonMissingConnectionNotificationResolvedPayloadSchema: () => CommonMissingConnectionNotificationResolvedPayloadSchema,
|
|
50
54
|
CompleteTaskBodyInputSchema: () => CompleteTaskBodyInputSchema,
|
|
55
|
+
CompleteTaskBodyV2InputSchema: () => CompleteTaskBodyV2InputSchema,
|
|
51
56
|
ConnectionAuthSchema: () => ConnectionAuthSchema,
|
|
52
57
|
CreateExternalConnectionBodySchema: () => CreateExternalConnectionBodySchema,
|
|
53
58
|
CreateRunResponseBodySchema: () => CreateRunResponseBodySchema,
|
|
@@ -59,6 +64,8 @@ __export(src_exports, {
|
|
|
59
64
|
DisplayPropertySchema: () => DisplayPropertySchema,
|
|
60
65
|
DynamicTriggerEndpointMetadataSchema: () => DynamicTriggerEndpointMetadataSchema,
|
|
61
66
|
DynamicTriggerMetadataSchema: () => DynamicTriggerMetadataSchema,
|
|
67
|
+
EndpointHeadersSchema: () => EndpointHeadersSchema,
|
|
68
|
+
EndpointIndexErrorSchema: () => EndpointIndexErrorSchema,
|
|
62
69
|
ErrorWithStackSchema: () => ErrorWithStackSchema,
|
|
63
70
|
EventExampleSchema: () => EventExampleSchema,
|
|
64
71
|
EventFilterSchema: () => EventFilterSchema,
|
|
@@ -71,6 +78,8 @@ __export(src_exports, {
|
|
|
71
78
|
FetchRetryHeadersStrategySchema: () => FetchRetryHeadersStrategySchema,
|
|
72
79
|
FetchRetryOptionsSchema: () => FetchRetryOptionsSchema,
|
|
73
80
|
FetchRetryStrategySchema: () => FetchRetryStrategySchema,
|
|
81
|
+
FetchTimeoutOptionsSchema: () => FetchTimeoutOptionsSchema,
|
|
82
|
+
GetEndpointIndexResponseSchema: () => GetEndpointIndexResponseSchema,
|
|
74
83
|
GetEventSchema: () => GetEventSchema,
|
|
75
84
|
GetRunSchema: () => GetRunSchema,
|
|
76
85
|
GetRunStatusesSchema: () => GetRunStatusesSchema,
|
|
@@ -86,6 +95,10 @@ __export(src_exports, {
|
|
|
86
95
|
IntegrationMetadataSchema: () => IntegrationMetadataSchema,
|
|
87
96
|
IntervalMetadataSchema: () => IntervalMetadataSchema,
|
|
88
97
|
IntervalOptionsSchema: () => IntervalOptionsSchema,
|
|
98
|
+
InvokeJobRequestBodySchema: () => InvokeJobRequestBodySchema,
|
|
99
|
+
InvokeJobResponseSchema: () => InvokeJobResponseSchema,
|
|
100
|
+
InvokeOptionsSchema: () => InvokeOptionsSchema,
|
|
101
|
+
InvokeTriggerMetadataSchema: () => InvokeTriggerMetadataSchema,
|
|
89
102
|
JobMetadataSchema: () => JobMetadataSchema,
|
|
90
103
|
JobRunStatusRecordSchema: () => JobRunStatusRecordSchema,
|
|
91
104
|
LogMessageSchema: () => LogMessageSchema,
|
|
@@ -100,6 +113,7 @@ __export(src_exports, {
|
|
|
100
113
|
MissingExternalConnectionResolvedNotificationPayloadSchema: () => MissingExternalConnectionResolvedNotificationPayloadSchema,
|
|
101
114
|
NormalizedRequestSchema: () => NormalizedRequestSchema,
|
|
102
115
|
NormalizedResponseSchema: () => NormalizedResponseSchema,
|
|
116
|
+
PLATFORM_FEATURES: () => PLATFORM_FEATURES,
|
|
103
117
|
PongErrorResponseSchema: () => PongErrorResponseSchema,
|
|
104
118
|
PongResponseSchema: () => PongResponseSchema,
|
|
105
119
|
PongSuccessResponseSchema: () => PongSuccessResponseSchema,
|
|
@@ -125,20 +139,26 @@ __export(src_exports, {
|
|
|
125
139
|
RegisterTriggerBodySchemaV2: () => RegisterTriggerBodySchemaV2,
|
|
126
140
|
RegisterTriggerSourceSchema: () => RegisterTriggerSourceSchema,
|
|
127
141
|
RetryOptionsSchema: () => RetryOptionsSchema,
|
|
142
|
+
RunJobAutoYieldExecutionErrorSchema: () => RunJobAutoYieldExecutionErrorSchema,
|
|
143
|
+
RunJobAutoYieldWithCompletedTaskExecutionErrorSchema: () => RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
|
|
128
144
|
RunJobBodySchema: () => RunJobBodySchema,
|
|
129
145
|
RunJobCanceledWithTaskSchema: () => RunJobCanceledWithTaskSchema,
|
|
146
|
+
RunJobErrorResponseSchema: () => RunJobErrorResponseSchema,
|
|
130
147
|
RunJobErrorSchema: () => RunJobErrorSchema,
|
|
131
148
|
RunJobInvalidPayloadErrorSchema: () => RunJobInvalidPayloadErrorSchema,
|
|
132
149
|
RunJobResponseSchema: () => RunJobResponseSchema,
|
|
150
|
+
RunJobResumeWithParallelTaskSchema: () => RunJobResumeWithParallelTaskSchema,
|
|
133
151
|
RunJobResumeWithTaskSchema: () => RunJobResumeWithTaskSchema,
|
|
134
152
|
RunJobRetryWithTaskSchema: () => RunJobRetryWithTaskSchema,
|
|
135
153
|
RunJobSuccessSchema: () => RunJobSuccessSchema,
|
|
136
154
|
RunJobUnresolvedAuthErrorSchema: () => RunJobUnresolvedAuthErrorSchema,
|
|
155
|
+
RunJobYieldExecutionErrorSchema: () => RunJobYieldExecutionErrorSchema,
|
|
137
156
|
RunSourceContextSchema: () => RunSourceContextSchema,
|
|
138
157
|
RunStatusSchema: () => RunStatusSchema,
|
|
139
158
|
RunTaskBodyInputSchema: () => RunTaskBodyInputSchema,
|
|
140
159
|
RunTaskBodyOutputSchema: () => RunTaskBodyOutputSchema,
|
|
141
160
|
RunTaskOptionsSchema: () => RunTaskOptionsSchema,
|
|
161
|
+
RunTaskResponseWithCachedTasksBodySchema: () => RunTaskResponseWithCachedTasksBodySchema,
|
|
142
162
|
RunTaskSchema: () => RunTaskSchema,
|
|
143
163
|
RuntimeEnvironmentTypeSchema: () => RuntimeEnvironmentTypeSchema,
|
|
144
164
|
SCHEDULED_EVENT: () => SCHEDULED_EVENT,
|
|
@@ -172,7 +192,9 @@ __export(src_exports, {
|
|
|
172
192
|
currentTimestampSeconds: () => currentTimestampSeconds,
|
|
173
193
|
deepMergeFilters: () => deepMergeFilters,
|
|
174
194
|
eventFilterMatches: () => eventFilterMatches,
|
|
195
|
+
parseEndpointIndexStats: () => parseEndpointIndexStats,
|
|
175
196
|
replacements: () => replacements,
|
|
197
|
+
supportsFeature: () => supportsFeature,
|
|
176
198
|
urlWithSearchParams: () => urlWithSearchParams
|
|
177
199
|
});
|
|
178
200
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -209,27 +231,27 @@ var _Logger = class _Logger {
|
|
|
209
231
|
log(message, ...args) {
|
|
210
232
|
if (__privateGet(this, _level) < 0)
|
|
211
233
|
return;
|
|
212
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.log, message, ...args);
|
|
234
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.log, message, "log", ...args);
|
|
213
235
|
}
|
|
214
236
|
error(message, ...args) {
|
|
215
237
|
if (__privateGet(this, _level) < 1)
|
|
216
238
|
return;
|
|
217
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.error, message, ...args);
|
|
239
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.error, message, "error", ...args);
|
|
218
240
|
}
|
|
219
241
|
warn(message, ...args) {
|
|
220
242
|
if (__privateGet(this, _level) < 2)
|
|
221
243
|
return;
|
|
222
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.warn, message, ...args);
|
|
244
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.warn, message, "warn", ...args);
|
|
223
245
|
}
|
|
224
246
|
info(message, ...args) {
|
|
225
247
|
if (__privateGet(this, _level) < 3)
|
|
226
248
|
return;
|
|
227
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.info, message, ...args);
|
|
249
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.info, message, "info", ...args);
|
|
228
250
|
}
|
|
229
251
|
debug(message, ...args) {
|
|
230
252
|
if (__privateGet(this, _level) < 4)
|
|
231
253
|
return;
|
|
232
|
-
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.debug, message, ...args);
|
|
254
|
+
__privateMethod(this, _structuredLog, structuredLog_fn).call(this, console.debug, message, "debug", ...args);
|
|
233
255
|
}
|
|
234
256
|
};
|
|
235
257
|
_name = new WeakMap();
|
|
@@ -237,12 +259,13 @@ _level = new WeakMap();
|
|
|
237
259
|
_filteredKeys = new WeakMap();
|
|
238
260
|
_jsonReplacer = new WeakMap();
|
|
239
261
|
_structuredLog = new WeakSet();
|
|
240
|
-
structuredLog_fn = /* @__PURE__ */ __name(function(loggerFunction, message, ...args) {
|
|
262
|
+
structuredLog_fn = /* @__PURE__ */ __name(function(loggerFunction, message, level, ...args) {
|
|
241
263
|
const structuredLog = {
|
|
242
264
|
...structureArgs(safeJsonClone(args), __privateGet(this, _filteredKeys)),
|
|
243
265
|
timestamp: /* @__PURE__ */ new Date(),
|
|
244
266
|
name: __privateGet(this, _name),
|
|
245
|
-
message
|
|
267
|
+
message,
|
|
268
|
+
level
|
|
246
269
|
};
|
|
247
270
|
loggerFunction(JSON.stringify(structuredLog, createReplacer(__privateGet(this, _jsonReplacer))));
|
|
248
271
|
}, "#structuredLog");
|
|
@@ -578,11 +601,17 @@ var TaskSchema = import_zod7.z.object({
|
|
|
578
601
|
error: import_zod7.z.string().optional().nullable(),
|
|
579
602
|
parentId: import_zod7.z.string().optional().nullable(),
|
|
580
603
|
style: StyleSchema.optional().nullable(),
|
|
581
|
-
operation: import_zod7.z.string().optional().nullable()
|
|
604
|
+
operation: import_zod7.z.string().optional().nullable(),
|
|
605
|
+
callbackUrl: import_zod7.z.string().optional().nullable(),
|
|
606
|
+
childExecutionMode: import_zod7.z.enum([
|
|
607
|
+
"SEQUENTIAL",
|
|
608
|
+
"PARALLEL"
|
|
609
|
+
]).optional().nullable()
|
|
582
610
|
});
|
|
583
611
|
var ServerTaskSchema = TaskSchema.extend({
|
|
584
612
|
idempotencyKey: import_zod7.z.string(),
|
|
585
|
-
attempts: import_zod7.z.number()
|
|
613
|
+
attempts: import_zod7.z.number(),
|
|
614
|
+
forceYield: import_zod7.z.boolean().optional().nullable()
|
|
586
615
|
});
|
|
587
616
|
var CachedTaskSchema = import_zod7.z.object({
|
|
588
617
|
id: import_zod7.z.string(),
|
|
@@ -624,6 +653,9 @@ var StaticTriggerMetadataSchema = import_zod8.z.object({
|
|
|
624
653
|
properties: import_zod8.z.array(DisplayPropertySchema).optional(),
|
|
625
654
|
rule: EventRuleSchema
|
|
626
655
|
});
|
|
656
|
+
var InvokeTriggerMetadataSchema = import_zod8.z.object({
|
|
657
|
+
type: import_zod8.z.literal("invoke")
|
|
658
|
+
});
|
|
627
659
|
var ScheduledTriggerMetadataSchema = import_zod8.z.object({
|
|
628
660
|
type: import_zod8.z.literal("scheduled"),
|
|
629
661
|
schedule: ScheduleMetadataSchema
|
|
@@ -631,7 +663,8 @@ var ScheduledTriggerMetadataSchema = import_zod8.z.object({
|
|
|
631
663
|
var TriggerMetadataSchema = import_zod8.z.discriminatedUnion("type", [
|
|
632
664
|
DynamicTriggerMetadataSchema,
|
|
633
665
|
StaticTriggerMetadataSchema,
|
|
634
|
-
ScheduledTriggerMetadataSchema
|
|
666
|
+
ScheduledTriggerMetadataSchema,
|
|
667
|
+
InvokeTriggerMetadataSchema
|
|
635
668
|
]);
|
|
636
669
|
|
|
637
670
|
// src/schemas/runs.ts
|
|
@@ -851,11 +884,15 @@ var HttpSourceRequestHeadersSchema = import_zod11.z.object({
|
|
|
851
884
|
})
|
|
852
885
|
});
|
|
853
886
|
var PongSuccessResponseSchema = import_zod11.z.object({
|
|
854
|
-
ok: import_zod11.z.literal(true)
|
|
887
|
+
ok: import_zod11.z.literal(true),
|
|
888
|
+
triggerVersion: import_zod11.z.string().optional(),
|
|
889
|
+
triggerSdkVersion: import_zod11.z.string().optional()
|
|
855
890
|
});
|
|
856
891
|
var PongErrorResponseSchema = import_zod11.z.object({
|
|
857
892
|
ok: import_zod11.z.literal(false),
|
|
858
|
-
error: import_zod11.z.string()
|
|
893
|
+
error: import_zod11.z.string(),
|
|
894
|
+
triggerVersion: import_zod11.z.string().optional(),
|
|
895
|
+
triggerSdkVersion: import_zod11.z.string().optional()
|
|
859
896
|
});
|
|
860
897
|
var PongResponseSchema = import_zod11.z.discriminatedUnion("ok", [
|
|
861
898
|
PongSuccessResponseSchema,
|
|
@@ -863,11 +900,13 @@ var PongResponseSchema = import_zod11.z.discriminatedUnion("ok", [
|
|
|
863
900
|
]);
|
|
864
901
|
var ValidateSuccessResponseSchema = import_zod11.z.object({
|
|
865
902
|
ok: import_zod11.z.literal(true),
|
|
866
|
-
endpointId: import_zod11.z.string()
|
|
903
|
+
endpointId: import_zod11.z.string(),
|
|
904
|
+
triggerVersion: import_zod11.z.string().optional()
|
|
867
905
|
});
|
|
868
906
|
var ValidateErrorResponseSchema = import_zod11.z.object({
|
|
869
907
|
ok: import_zod11.z.literal(false),
|
|
870
|
-
error: import_zod11.z.string()
|
|
908
|
+
error: import_zod11.z.string(),
|
|
909
|
+
triggerVersion: import_zod11.z.string().optional()
|
|
871
910
|
});
|
|
872
911
|
var ValidateResponseSchema = import_zod11.z.discriminatedUnion("ok", [
|
|
873
912
|
ValidateSuccessResponseSchema,
|
|
@@ -945,6 +984,48 @@ var IndexEndpointResponseSchema = import_zod11.z.object({
|
|
|
945
984
|
dynamicTriggers: import_zod11.z.array(DynamicTriggerEndpointMetadataSchema),
|
|
946
985
|
dynamicSchedules: import_zod11.z.array(RegisterDynamicSchedulePayloadSchema)
|
|
947
986
|
});
|
|
987
|
+
var EndpointIndexErrorSchema = import_zod11.z.object({
|
|
988
|
+
message: import_zod11.z.string(),
|
|
989
|
+
raw: import_zod11.z.any().optional()
|
|
990
|
+
});
|
|
991
|
+
var IndexEndpointStatsSchema = import_zod11.z.object({
|
|
992
|
+
jobs: import_zod11.z.number(),
|
|
993
|
+
sources: import_zod11.z.number(),
|
|
994
|
+
dynamicTriggers: import_zod11.z.number(),
|
|
995
|
+
dynamicSchedules: import_zod11.z.number(),
|
|
996
|
+
disabledJobs: import_zod11.z.number().default(0)
|
|
997
|
+
});
|
|
998
|
+
function parseEndpointIndexStats(stats) {
|
|
999
|
+
if (stats === null || stats === void 0) {
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
return IndexEndpointStatsSchema.parse(stats);
|
|
1003
|
+
}
|
|
1004
|
+
__name(parseEndpointIndexStats, "parseEndpointIndexStats");
|
|
1005
|
+
var GetEndpointIndexResponseSchema = import_zod11.z.discriminatedUnion("status", [
|
|
1006
|
+
import_zod11.z.object({
|
|
1007
|
+
status: import_zod11.z.literal("PENDING"),
|
|
1008
|
+
updatedAt: import_zod11.z.coerce.date()
|
|
1009
|
+
}),
|
|
1010
|
+
import_zod11.z.object({
|
|
1011
|
+
status: import_zod11.z.literal("STARTED"),
|
|
1012
|
+
updatedAt: import_zod11.z.coerce.date()
|
|
1013
|
+
}),
|
|
1014
|
+
import_zod11.z.object({
|
|
1015
|
+
status: import_zod11.z.literal("SUCCESS"),
|
|
1016
|
+
stats: IndexEndpointStatsSchema,
|
|
1017
|
+
updatedAt: import_zod11.z.coerce.date()
|
|
1018
|
+
}),
|
|
1019
|
+
import_zod11.z.object({
|
|
1020
|
+
status: import_zod11.z.literal("FAILURE"),
|
|
1021
|
+
error: EndpointIndexErrorSchema,
|
|
1022
|
+
updatedAt: import_zod11.z.coerce.date()
|
|
1023
|
+
})
|
|
1024
|
+
]);
|
|
1025
|
+
var EndpointHeadersSchema = import_zod11.z.object({
|
|
1026
|
+
"trigger-version": import_zod11.z.string().optional(),
|
|
1027
|
+
"trigger-sdk-version": import_zod11.z.string().optional()
|
|
1028
|
+
});
|
|
948
1029
|
var RawEventSchema = import_zod11.z.object({
|
|
949
1030
|
/** The `name` property must exactly match any subscriptions you want to
|
|
950
1031
|
trigger. */
|
|
@@ -1024,6 +1105,12 @@ var RunSourceContextSchema = import_zod11.z.object({
|
|
|
1024
1105
|
id: import_zod11.z.string(),
|
|
1025
1106
|
metadata: import_zod11.z.any()
|
|
1026
1107
|
});
|
|
1108
|
+
var AutoYieldConfigSchema = import_zod11.z.object({
|
|
1109
|
+
startTaskThreshold: import_zod11.z.number(),
|
|
1110
|
+
beforeExecuteTaskThreshold: import_zod11.z.number(),
|
|
1111
|
+
beforeCompleteTaskThreshold: import_zod11.z.number(),
|
|
1112
|
+
afterCompleteTaskThreshold: import_zod11.z.number()
|
|
1113
|
+
});
|
|
1027
1114
|
var RunJobBodySchema = import_zod11.z.object({
|
|
1028
1115
|
event: ApiEventLogSchema,
|
|
1029
1116
|
job: import_zod11.z.object({
|
|
@@ -1046,19 +1133,49 @@ var RunJobBodySchema = import_zod11.z.object({
|
|
|
1046
1133
|
title: import_zod11.z.string(),
|
|
1047
1134
|
slug: import_zod11.z.string()
|
|
1048
1135
|
}),
|
|
1136
|
+
project: import_zod11.z.object({
|
|
1137
|
+
id: import_zod11.z.string(),
|
|
1138
|
+
name: import_zod11.z.string(),
|
|
1139
|
+
slug: import_zod11.z.string()
|
|
1140
|
+
}).optional(),
|
|
1049
1141
|
account: import_zod11.z.object({
|
|
1050
1142
|
id: import_zod11.z.string(),
|
|
1051
1143
|
metadata: import_zod11.z.any()
|
|
1052
1144
|
}).optional(),
|
|
1053
1145
|
source: RunSourceContextSchema.optional(),
|
|
1054
1146
|
tasks: import_zod11.z.array(CachedTaskSchema).optional(),
|
|
1055
|
-
|
|
1147
|
+
cachedTaskCursor: import_zod11.z.string().optional(),
|
|
1148
|
+
noopTasksSet: import_zod11.z.string().optional(),
|
|
1149
|
+
connections: import_zod11.z.record(ConnectionAuthSchema).optional(),
|
|
1150
|
+
yieldedExecutions: import_zod11.z.string().array().optional(),
|
|
1151
|
+
runChunkExecutionLimit: import_zod11.z.number().optional(),
|
|
1152
|
+
autoYieldConfig: AutoYieldConfigSchema.optional()
|
|
1056
1153
|
});
|
|
1057
1154
|
var RunJobErrorSchema = import_zod11.z.object({
|
|
1058
1155
|
status: import_zod11.z.literal("ERROR"),
|
|
1059
1156
|
error: ErrorWithStackSchema,
|
|
1060
1157
|
task: TaskSchema.optional()
|
|
1061
1158
|
});
|
|
1159
|
+
var RunJobYieldExecutionErrorSchema = import_zod11.z.object({
|
|
1160
|
+
status: import_zod11.z.literal("YIELD_EXECUTION"),
|
|
1161
|
+
key: import_zod11.z.string()
|
|
1162
|
+
});
|
|
1163
|
+
var AutoYieldMetadataSchema = import_zod11.z.object({
|
|
1164
|
+
location: import_zod11.z.string(),
|
|
1165
|
+
timeRemaining: import_zod11.z.number(),
|
|
1166
|
+
timeElapsed: import_zod11.z.number(),
|
|
1167
|
+
limit: import_zod11.z.number().optional()
|
|
1168
|
+
});
|
|
1169
|
+
var RunJobAutoYieldExecutionErrorSchema = AutoYieldMetadataSchema.extend({
|
|
1170
|
+
status: import_zod11.z.literal("AUTO_YIELD_EXECUTION")
|
|
1171
|
+
});
|
|
1172
|
+
var RunJobAutoYieldWithCompletedTaskExecutionErrorSchema = import_zod11.z.object({
|
|
1173
|
+
status: import_zod11.z.literal("AUTO_YIELD_EXECUTION_WITH_COMPLETED_TASK"),
|
|
1174
|
+
id: import_zod11.z.string(),
|
|
1175
|
+
properties: import_zod11.z.array(DisplayPropertySchema).optional(),
|
|
1176
|
+
output: import_zod11.z.string().optional(),
|
|
1177
|
+
data: AutoYieldMetadataSchema
|
|
1178
|
+
});
|
|
1062
1179
|
var RunJobInvalidPayloadErrorSchema = import_zod11.z.object({
|
|
1063
1180
|
status: import_zod11.z.literal("INVALID_PAYLOAD"),
|
|
1064
1181
|
errors: import_zod11.z.array(SchemaErrorSchema)
|
|
@@ -1088,11 +1205,31 @@ var RunJobSuccessSchema = import_zod11.z.object({
|
|
|
1088
1205
|
status: import_zod11.z.literal("SUCCESS"),
|
|
1089
1206
|
output: DeserializedJsonSchema.optional()
|
|
1090
1207
|
});
|
|
1208
|
+
var RunJobErrorResponseSchema = import_zod11.z.union([
|
|
1209
|
+
RunJobAutoYieldExecutionErrorSchema,
|
|
1210
|
+
RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
|
|
1211
|
+
RunJobYieldExecutionErrorSchema,
|
|
1212
|
+
RunJobErrorSchema,
|
|
1213
|
+
RunJobUnresolvedAuthErrorSchema,
|
|
1214
|
+
RunJobInvalidPayloadErrorSchema,
|
|
1215
|
+
RunJobResumeWithTaskSchema,
|
|
1216
|
+
RunJobRetryWithTaskSchema,
|
|
1217
|
+
RunJobCanceledWithTaskSchema
|
|
1218
|
+
]);
|
|
1219
|
+
var RunJobResumeWithParallelTaskSchema = import_zod11.z.object({
|
|
1220
|
+
status: import_zod11.z.literal("RESUME_WITH_PARALLEL_TASK"),
|
|
1221
|
+
task: TaskSchema,
|
|
1222
|
+
childErrors: import_zod11.z.array(RunJobErrorResponseSchema)
|
|
1223
|
+
});
|
|
1091
1224
|
var RunJobResponseSchema = import_zod11.z.discriminatedUnion("status", [
|
|
1225
|
+
RunJobAutoYieldExecutionErrorSchema,
|
|
1226
|
+
RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
|
|
1227
|
+
RunJobYieldExecutionErrorSchema,
|
|
1092
1228
|
RunJobErrorSchema,
|
|
1093
1229
|
RunJobUnresolvedAuthErrorSchema,
|
|
1094
1230
|
RunJobInvalidPayloadErrorSchema,
|
|
1095
1231
|
RunJobResumeWithTaskSchema,
|
|
1232
|
+
RunJobResumeWithParallelTaskSchema,
|
|
1096
1233
|
RunJobRetryWithTaskSchema,
|
|
1097
1234
|
RunJobCanceledWithTaskSchema,
|
|
1098
1235
|
RunJobSuccessSchema
|
|
@@ -1179,7 +1316,7 @@ var RunTaskOptionsSchema = import_zod11.z.object({
|
|
|
1179
1316
|
retry: RetryOptionsSchema.optional(),
|
|
1180
1317
|
/** The icon for the Task, it will appear in the logs.
|
|
1181
1318
|
* You can use the name of a company in lowercase, e.g. "github".
|
|
1182
|
-
* Or any icon name that [
|
|
1319
|
+
* Or any icon name that [Tabler Icons](https://tabler-icons.io/) supports. */
|
|
1183
1320
|
icon: import_zod11.z.string().optional(),
|
|
1184
1321
|
/** The key for the Task that you want to appear in the logs */
|
|
1185
1322
|
displayKey: import_zod11.z.string().optional(),
|
|
@@ -1191,6 +1328,13 @@ var RunTaskOptionsSchema = import_zod11.z.object({
|
|
|
1191
1328
|
params: import_zod11.z.any(),
|
|
1192
1329
|
/** The style of the log entry. */
|
|
1193
1330
|
style: StyleSchema.optional(),
|
|
1331
|
+
/** Allows you to expose a `task.callbackUrl` to use in your tasks. Enabling this feature will cause the task to return the data sent to the callbackUrl instead of the usual async callback result. */
|
|
1332
|
+
callback: import_zod11.z.object({
|
|
1333
|
+
/** Causes the task to wait for and return the data of the first request sent to `task.callbackUrl`. */
|
|
1334
|
+
enabled: import_zod11.z.boolean(),
|
|
1335
|
+
/** Time to wait for the first request to `task.callbackUrl`. Default: One hour. */
|
|
1336
|
+
timeoutInSeconds: import_zod11.z.number()
|
|
1337
|
+
}).partial().optional(),
|
|
1194
1338
|
/** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
|
|
1195
1339
|
connectionKey: import_zod11.z.string().optional(),
|
|
1196
1340
|
/** 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. */
|
|
@@ -1200,14 +1344,27 @@ var RunTaskOptionsSchema = import_zod11.z.object({
|
|
|
1200
1344
|
/** 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). */
|
|
1201
1345
|
noop: import_zod11.z.boolean().default(false),
|
|
1202
1346
|
redact: RedactSchema.optional(),
|
|
1203
|
-
trigger: TriggerMetadataSchema.optional()
|
|
1347
|
+
trigger: TriggerMetadataSchema.optional(),
|
|
1348
|
+
parallel: import_zod11.z.boolean().optional()
|
|
1204
1349
|
});
|
|
1205
1350
|
var RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({
|
|
1206
1351
|
idempotencyKey: import_zod11.z.string(),
|
|
1207
1352
|
parentId: import_zod11.z.string().optional()
|
|
1208
1353
|
});
|
|
1209
1354
|
var RunTaskBodyOutputSchema = RunTaskBodyInputSchema.extend({
|
|
1210
|
-
|
|
1355
|
+
properties: import_zod11.z.array(DisplayPropertySchema.partial()).optional(),
|
|
1356
|
+
params: DeserializedJsonSchema.optional().nullable(),
|
|
1357
|
+
callback: import_zod11.z.object({
|
|
1358
|
+
enabled: import_zod11.z.boolean(),
|
|
1359
|
+
timeoutInSeconds: import_zod11.z.number().default(3600)
|
|
1360
|
+
}).optional()
|
|
1361
|
+
});
|
|
1362
|
+
var RunTaskResponseWithCachedTasksBodySchema = import_zod11.z.object({
|
|
1363
|
+
task: ServerTaskSchema,
|
|
1364
|
+
cachedTasks: import_zod11.z.object({
|
|
1365
|
+
tasks: import_zod11.z.array(CachedTaskSchema),
|
|
1366
|
+
cursor: import_zod11.z.string().optional()
|
|
1367
|
+
}).optional()
|
|
1211
1368
|
});
|
|
1212
1369
|
var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
|
|
1213
1370
|
properties: true,
|
|
@@ -1216,6 +1373,13 @@ var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
|
|
|
1216
1373
|
}).extend({
|
|
1217
1374
|
output: SerializableJsonSchema.optional().transform((v) => v ? DeserializedJsonSchema.parse(JSON.parse(JSON.stringify(v))) : {})
|
|
1218
1375
|
});
|
|
1376
|
+
var CompleteTaskBodyV2InputSchema = RunTaskBodyInputSchema.pick({
|
|
1377
|
+
properties: true,
|
|
1378
|
+
description: true,
|
|
1379
|
+
params: true
|
|
1380
|
+
}).extend({
|
|
1381
|
+
output: import_zod11.z.string().optional()
|
|
1382
|
+
});
|
|
1219
1383
|
var FailTaskBodyInputSchema = import_zod11.z.object({
|
|
1220
1384
|
error: ErrorWithStackSchema
|
|
1221
1385
|
});
|
|
@@ -1287,6 +1451,23 @@ var GetRunStatusesSchema = import_zod11.z.object({
|
|
|
1287
1451
|
}),
|
|
1288
1452
|
statuses: import_zod11.z.array(JobRunStatusRecordSchema)
|
|
1289
1453
|
});
|
|
1454
|
+
var InvokeJobResponseSchema = import_zod11.z.object({
|
|
1455
|
+
id: import_zod11.z.string()
|
|
1456
|
+
});
|
|
1457
|
+
var InvokeJobRequestBodySchema = import_zod11.z.object({
|
|
1458
|
+
payload: import_zod11.z.any(),
|
|
1459
|
+
context: import_zod11.z.any().optional(),
|
|
1460
|
+
options: import_zod11.z.object({
|
|
1461
|
+
accountId: import_zod11.z.string().optional(),
|
|
1462
|
+
callbackUrl: import_zod11.z.string().optional()
|
|
1463
|
+
}).optional()
|
|
1464
|
+
});
|
|
1465
|
+
var InvokeOptionsSchema = import_zod11.z.object({
|
|
1466
|
+
accountId: import_zod11.z.string().optional(),
|
|
1467
|
+
idempotencyKey: import_zod11.z.string().optional(),
|
|
1468
|
+
context: import_zod11.z.any().optional(),
|
|
1469
|
+
callbackUrl: import_zod11.z.string().optional()
|
|
1470
|
+
});
|
|
1290
1471
|
|
|
1291
1472
|
// src/schemas/notifications.ts
|
|
1292
1473
|
var import_zod12 = require("zod");
|
|
@@ -1380,10 +1561,15 @@ var FetchRequestInitSchema = import_zod13.z.object({
|
|
|
1380
1561
|
]).optional()
|
|
1381
1562
|
});
|
|
1382
1563
|
var FetchRetryOptionsSchema = import_zod13.z.record(FetchRetryStrategySchema);
|
|
1564
|
+
var FetchTimeoutOptionsSchema = import_zod13.z.object({
|
|
1565
|
+
durationInMs: import_zod13.z.number(),
|
|
1566
|
+
retry: RetryOptionsSchema.optional()
|
|
1567
|
+
});
|
|
1383
1568
|
var FetchOperationSchema = import_zod13.z.object({
|
|
1384
1569
|
url: import_zod13.z.string(),
|
|
1385
1570
|
requestInit: FetchRequestInitSchema.optional(),
|
|
1386
|
-
retry: import_zod13.z.record(FetchRetryStrategySchema).optional()
|
|
1571
|
+
retry: import_zod13.z.record(FetchRetryStrategySchema).optional(),
|
|
1572
|
+
timeout: FetchTimeoutOptionsSchema.optional()
|
|
1387
1573
|
});
|
|
1388
1574
|
|
|
1389
1575
|
// src/schemas/events.ts
|
|
@@ -1409,6 +1595,10 @@ var GetEventSchema = import_zod14.z.object({
|
|
|
1409
1595
|
completedAt: import_zod14.z.coerce.date().optional().nullable()
|
|
1410
1596
|
}))
|
|
1411
1597
|
});
|
|
1598
|
+
var CancelRunsForEventSchema = import_zod14.z.object({
|
|
1599
|
+
cancelledRunIds: import_zod14.z.array(import_zod14.z.string()),
|
|
1600
|
+
failedToCancelRunIds: import_zod14.z.array(import_zod14.z.string())
|
|
1601
|
+
});
|
|
1412
1602
|
|
|
1413
1603
|
// src/utils.ts
|
|
1414
1604
|
function deepMergeFilters(...filters) {
|
|
@@ -1633,4 +1823,25 @@ function contentFilterMatches(actualValue, contentFilter) {
|
|
|
1633
1823
|
return true;
|
|
1634
1824
|
}
|
|
1635
1825
|
__name(contentFilterMatches, "contentFilterMatches");
|
|
1826
|
+
|
|
1827
|
+
// src/index.ts
|
|
1828
|
+
var API_VERSIONS = {
|
|
1829
|
+
LAZY_LOADED_CACHED_TASKS: "2023-09-29",
|
|
1830
|
+
SERIALIZED_TASK_OUTPUT: "2023-11-01"
|
|
1831
|
+
};
|
|
1832
|
+
var PLATFORM_FEATURES = {
|
|
1833
|
+
yieldExecution: API_VERSIONS.LAZY_LOADED_CACHED_TASKS,
|
|
1834
|
+
lazyLoadedCachedTasks: API_VERSIONS.LAZY_LOADED_CACHED_TASKS
|
|
1835
|
+
};
|
|
1836
|
+
function supportsFeature(featureName, version) {
|
|
1837
|
+
if (version === "unversioned" || version === "unknown") {
|
|
1838
|
+
return false;
|
|
1839
|
+
}
|
|
1840
|
+
const supportedVersion = PLATFORM_FEATURES[featureName];
|
|
1841
|
+
if (!supportedVersion) {
|
|
1842
|
+
return false;
|
|
1843
|
+
}
|
|
1844
|
+
return version >= supportedVersion;
|
|
1845
|
+
}
|
|
1846
|
+
__name(supportsFeature, "supportsFeature");
|
|
1636
1847
|
//# sourceMappingURL=index.js.map
|