@trigger.dev/core 2.1.9 → 2.2.1

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.js CHANGED
@@ -50,6 +50,7 @@ var src_exports = {};
50
50
  __export(src_exports, {
51
51
  API_VERSIONS: () => API_VERSIONS,
52
52
  ApiEventLogSchema: () => ApiEventLogSchema,
53
+ AutoYieldConfigSchema: () => AutoYieldConfigSchema,
53
54
  BloomFilter: () => BloomFilter,
54
55
  CachedTaskSchema: () => CachedTaskSchema,
55
56
  CommonMissingConnectionNotificationPayloadSchema: () => CommonMissingConnectionNotificationPayloadSchema,
@@ -67,6 +68,7 @@ __export(src_exports, {
67
68
  DynamicTriggerEndpointMetadataSchema: () => DynamicTriggerEndpointMetadataSchema,
68
69
  DynamicTriggerMetadataSchema: () => DynamicTriggerMetadataSchema,
69
70
  EndpointHeadersSchema: () => EndpointHeadersSchema,
71
+ EndpointIndexErrorSchema: () => EndpointIndexErrorSchema,
70
72
  ErrorWithStackSchema: () => ErrorWithStackSchema,
71
73
  EventExampleSchema: () => EventExampleSchema,
72
74
  EventFilterSchema: () => EventFilterSchema,
@@ -79,6 +81,7 @@ __export(src_exports, {
79
81
  FetchRetryHeadersStrategySchema: () => FetchRetryHeadersStrategySchema,
80
82
  FetchRetryOptionsSchema: () => FetchRetryOptionsSchema,
81
83
  FetchRetryStrategySchema: () => FetchRetryStrategySchema,
84
+ GetEndpointIndexResponseSchema: () => GetEndpointIndexResponseSchema,
82
85
  GetEventSchema: () => GetEventSchema,
83
86
  GetRunSchema: () => GetRunSchema,
84
87
  GetRunStatusesSchema: () => GetRunStatusesSchema,
@@ -134,6 +137,8 @@ __export(src_exports, {
134
137
  RegisterTriggerBodySchemaV2: () => RegisterTriggerBodySchemaV2,
135
138
  RegisterTriggerSourceSchema: () => RegisterTriggerSourceSchema,
136
139
  RetryOptionsSchema: () => RetryOptionsSchema,
140
+ RunJobAutoYieldExecutionErrorSchema: () => RunJobAutoYieldExecutionErrorSchema,
141
+ RunJobAutoYieldWithCompletedTaskExecutionErrorSchema: () => RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
137
142
  RunJobBodySchema: () => RunJobBodySchema,
138
143
  RunJobCanceledWithTaskSchema: () => RunJobCanceledWithTaskSchema,
139
144
  RunJobErrorSchema: () => RunJobErrorSchema,
@@ -183,6 +188,7 @@ __export(src_exports, {
183
188
  currentTimestampSeconds: () => currentTimestampSeconds,
184
189
  deepMergeFilters: () => deepMergeFilters,
185
190
  eventFilterMatches: () => eventFilterMatches,
191
+ parseEndpointIndexStats: () => parseEndpointIndexStats,
186
192
  replacements: () => replacements,
187
193
  supportsFeature: () => supportsFeature,
188
194
  urlWithSearchParams: () => urlWithSearchParams
@@ -595,7 +601,8 @@ var TaskSchema = import_zod7.z.object({
595
601
  });
596
602
  var ServerTaskSchema = TaskSchema.extend({
597
603
  idempotencyKey: import_zod7.z.string(),
598
- attempts: import_zod7.z.number()
604
+ attempts: import_zod7.z.number(),
605
+ forceYield: import_zod7.z.boolean().optional().nullable()
599
606
  });
600
607
  var CachedTaskSchema = import_zod7.z.object({
601
608
  id: import_zod7.z.string(),
@@ -865,12 +872,14 @@ var HttpSourceRequestHeadersSchema = import_zod11.z.object({
865
872
  });
866
873
  var PongSuccessResponseSchema = import_zod11.z.object({
867
874
  ok: import_zod11.z.literal(true),
868
- triggerVersion: import_zod11.z.string().optional()
875
+ triggerVersion: import_zod11.z.string().optional(),
876
+ triggerSdkVersion: import_zod11.z.string().optional()
869
877
  });
870
878
  var PongErrorResponseSchema = import_zod11.z.object({
871
879
  ok: import_zod11.z.literal(false),
872
880
  error: import_zod11.z.string(),
873
- triggerVersion: import_zod11.z.string().optional()
881
+ triggerVersion: import_zod11.z.string().optional(),
882
+ triggerSdkVersion: import_zod11.z.string().optional()
874
883
  });
875
884
  var PongResponseSchema = import_zod11.z.discriminatedUnion("ok", [
876
885
  PongSuccessResponseSchema,
@@ -962,8 +971,47 @@ var IndexEndpointResponseSchema = import_zod11.z.object({
962
971
  dynamicTriggers: import_zod11.z.array(DynamicTriggerEndpointMetadataSchema),
963
972
  dynamicSchedules: import_zod11.z.array(RegisterDynamicSchedulePayloadSchema)
964
973
  });
974
+ var EndpointIndexErrorSchema = import_zod11.z.object({
975
+ message: import_zod11.z.string(),
976
+ raw: import_zod11.z.any().optional()
977
+ });
978
+ var IndexEndpointStatsSchema = import_zod11.z.object({
979
+ jobs: import_zod11.z.number(),
980
+ sources: import_zod11.z.number(),
981
+ dynamicTriggers: import_zod11.z.number(),
982
+ dynamicSchedules: import_zod11.z.number(),
983
+ disabledJobs: import_zod11.z.number().default(0)
984
+ });
985
+ function parseEndpointIndexStats(stats) {
986
+ if (stats === null || stats === void 0) {
987
+ return;
988
+ }
989
+ return IndexEndpointStatsSchema.parse(stats);
990
+ }
991
+ __name(parseEndpointIndexStats, "parseEndpointIndexStats");
992
+ var GetEndpointIndexResponseSchema = import_zod11.z.discriminatedUnion("status", [
993
+ import_zod11.z.object({
994
+ status: import_zod11.z.literal("PENDING"),
995
+ updatedAt: import_zod11.z.coerce.date()
996
+ }),
997
+ import_zod11.z.object({
998
+ status: import_zod11.z.literal("STARTED"),
999
+ updatedAt: import_zod11.z.coerce.date()
1000
+ }),
1001
+ import_zod11.z.object({
1002
+ status: import_zod11.z.literal("SUCCESS"),
1003
+ stats: IndexEndpointStatsSchema,
1004
+ updatedAt: import_zod11.z.coerce.date()
1005
+ }),
1006
+ import_zod11.z.object({
1007
+ status: import_zod11.z.literal("FAILURE"),
1008
+ error: EndpointIndexErrorSchema,
1009
+ updatedAt: import_zod11.z.coerce.date()
1010
+ })
1011
+ ]);
965
1012
  var EndpointHeadersSchema = import_zod11.z.object({
966
- "trigger-version": import_zod11.z.string().optional()
1013
+ "trigger-version": import_zod11.z.string().optional(),
1014
+ "trigger-sdk-version": import_zod11.z.string().optional()
967
1015
  });
968
1016
  var RawEventSchema = import_zod11.z.object({
969
1017
  /** The `name` property must exactly match any subscriptions you want to
@@ -1044,6 +1092,12 @@ var RunSourceContextSchema = import_zod11.z.object({
1044
1092
  id: import_zod11.z.string(),
1045
1093
  metadata: import_zod11.z.any()
1046
1094
  });
1095
+ var AutoYieldConfigSchema = import_zod11.z.object({
1096
+ startTaskThreshold: import_zod11.z.number(),
1097
+ beforeExecuteTaskThreshold: import_zod11.z.number(),
1098
+ beforeCompleteTaskThreshold: import_zod11.z.number(),
1099
+ afterCompleteTaskThreshold: import_zod11.z.number()
1100
+ });
1047
1101
  var RunJobBodySchema = import_zod11.z.object({
1048
1102
  event: ApiEventLogSchema,
1049
1103
  job: import_zod11.z.object({
@@ -1075,7 +1129,9 @@ var RunJobBodySchema = import_zod11.z.object({
1075
1129
  cachedTaskCursor: import_zod11.z.string().optional(),
1076
1130
  noopTasksSet: import_zod11.z.string().optional(),
1077
1131
  connections: import_zod11.z.record(ConnectionAuthSchema).optional(),
1078
- yieldedExecutions: import_zod11.z.string().array().optional()
1132
+ yieldedExecutions: import_zod11.z.string().array().optional(),
1133
+ runChunkExecutionLimit: import_zod11.z.number().optional(),
1134
+ autoYieldConfig: AutoYieldConfigSchema.optional()
1079
1135
  });
1080
1136
  var RunJobErrorSchema = import_zod11.z.object({
1081
1137
  status: import_zod11.z.literal("ERROR"),
@@ -1086,6 +1142,25 @@ var RunJobYieldExecutionErrorSchema = import_zod11.z.object({
1086
1142
  status: import_zod11.z.literal("YIELD_EXECUTION"),
1087
1143
  key: import_zod11.z.string()
1088
1144
  });
1145
+ var RunJobAutoYieldExecutionErrorSchema = import_zod11.z.object({
1146
+ status: import_zod11.z.literal("AUTO_YIELD_EXECUTION"),
1147
+ location: import_zod11.z.string(),
1148
+ timeRemaining: import_zod11.z.number(),
1149
+ timeElapsed: import_zod11.z.number(),
1150
+ limit: import_zod11.z.number().optional()
1151
+ });
1152
+ var RunJobAutoYieldWithCompletedTaskExecutionErrorSchema = import_zod11.z.object({
1153
+ status: import_zod11.z.literal("AUTO_YIELD_EXECUTION_WITH_COMPLETED_TASK"),
1154
+ id: import_zod11.z.string(),
1155
+ properties: import_zod11.z.array(DisplayPropertySchema).optional(),
1156
+ output: import_zod11.z.any(),
1157
+ data: import_zod11.z.object({
1158
+ location: import_zod11.z.string(),
1159
+ timeRemaining: import_zod11.z.number(),
1160
+ timeElapsed: import_zod11.z.number(),
1161
+ limit: import_zod11.z.number().optional()
1162
+ })
1163
+ });
1089
1164
  var RunJobInvalidPayloadErrorSchema = import_zod11.z.object({
1090
1165
  status: import_zod11.z.literal("INVALID_PAYLOAD"),
1091
1166
  errors: import_zod11.z.array(SchemaErrorSchema)
@@ -1116,6 +1191,8 @@ var RunJobSuccessSchema = import_zod11.z.object({
1116
1191
  output: DeserializedJsonSchema.optional()
1117
1192
  });
1118
1193
  var RunJobResponseSchema = import_zod11.z.discriminatedUnion("status", [
1194
+ RunJobAutoYieldExecutionErrorSchema,
1195
+ RunJobAutoYieldWithCompletedTaskExecutionErrorSchema,
1119
1196
  RunJobYieldExecutionErrorSchema,
1120
1197
  RunJobErrorSchema,
1121
1198
  RunJobUnresolvedAuthErrorSchema,
@@ -1207,7 +1284,7 @@ var RunTaskOptionsSchema = import_zod11.z.object({
1207
1284
  retry: RetryOptionsSchema.optional(),
1208
1285
  /** The icon for the Task, it will appear in the logs.
1209
1286
  * You can use the name of a company in lowercase, e.g. "github".
1210
- * Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
1287
+ * Or any icon name that [Tabler Icons](https://tabler-icons.io/) supports. */
1211
1288
  icon: import_zod11.z.string().optional(),
1212
1289
  /** The key for the Task that you want to appear in the logs */
1213
1290
  displayKey: import_zod11.z.string().optional(),
@@ -1242,6 +1319,7 @@ var RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({
1242
1319
  parentId: import_zod11.z.string().optional()
1243
1320
  });
1244
1321
  var RunTaskBodyOutputSchema = RunTaskBodyInputSchema.extend({
1322
+ properties: import_zod11.z.array(DisplayPropertySchema.partial()).optional(),
1245
1323
  params: DeserializedJsonSchema.optional().nullable(),
1246
1324
  callback: import_zod11.z.object({
1247
1325
  enabled: import_zod11.z.boolean(),