@trigger.dev/sdk 3.0.0-beta.35 → 3.0.0-beta.37

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/v3/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { TriggerTracer, SemanticInternalAttributes, runtime, accessoryAttributes, apiClientManager, taskCatalog, taskContext, defaultRetryOptions, calculateNextRetryDelay, defaultFetchRetryOptions, calculateResetAt, eventFilterMatches, flattenAttributes, stringifyIO, logger, conditionallyImportPacket, parsePacket, createErrorTaskError } from '@trigger.dev/core/v3';
2
- export { APIError, AuthenticationError, BadRequestError, ConflictError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, UnprocessableEntityError, logger } from '@trigger.dev/core/v3';
2
+ export { ApiError, AuthenticationError, BadRequestError, ConflictError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, UnprocessableEntityError, logger } from '@trigger.dev/core/v3';
3
3
  import { trace, context, SpanStatusCode, SpanKind } from '@opentelemetry/api';
4
4
  import { SEMATTRS_HTTP_STATUS_CODE, SEMATTRS_HTTP_METHOD, SEMATTRS_HTTP_URL, SEMATTRS_HTTP_HOST, SEMATTRS_HTTP_SCHEME, SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH, SEMATTRS_MESSAGING_OPERATION, SEMATTRS_MESSAGING_DESTINATION, SEMATTRS_MESSAGING_SYSTEM } from '@opentelemetry/semantic-conventions';
5
5
  import { AsyncLocalStorage } from 'node:async_hooks';
@@ -17,7 +17,7 @@ var __publicField = (obj, key, value) => {
17
17
  };
18
18
 
19
19
  // package.json
20
- var version = "3.0.0-beta.35";
20
+ var version = "3.0.0-beta.37";
21
21
 
22
22
  // src/v3/tracer.ts
23
23
  var tracer = new TriggerTracer({
@@ -518,7 +518,7 @@ function createTask(params) {
518
518
  const response = await apiClient.triggerTask(params.id, {
519
519
  payload: payloadPacket.data,
520
520
  options: {
521
- queue: params.queue,
521
+ queue: options?.queue ?? params.queue,
522
522
  concurrencyKey: options?.concurrencyKey,
523
523
  test: taskContext.ctx?.run.isTest,
524
524
  payloadType: payloadPacket.dataType,
@@ -615,7 +615,7 @@ function createTask(params) {
615
615
  options: {
616
616
  dependentAttempt: ctx.attempt.id,
617
617
  lockToVersion: taskContext.worker?.version,
618
- queue: params.queue,
618
+ queue: options?.queue ?? params.queue,
619
619
  concurrencyKey: options?.concurrencyKey,
620
620
  test: taskContext.ctx?.run.isTest,
621
621
  payloadType: payloadPacket.dataType,
@@ -933,30 +933,42 @@ __name(calculateDurationInMs, "calculateDurationInMs");
933
933
  var runs = {
934
934
  replay: replayRun,
935
935
  cancel: cancelRun,
936
- retrieve: retrieveRun
936
+ retrieve: retrieveRun,
937
+ list: listRuns
937
938
  };
938
- async function retrieveRun(runId) {
939
+ function listRuns(paramsOrProjectRef, params) {
939
940
  const apiClient = apiClientManager.client;
940
941
  if (!apiClient) {
941
942
  throw apiClientMissingError();
942
943
  }
943
- return await apiClient.retrieveRun(runId);
944
+ if (typeof paramsOrProjectRef === "string") {
945
+ return apiClient.listProjectRuns(paramsOrProjectRef, params);
946
+ }
947
+ return apiClient.listRuns(params);
948
+ }
949
+ __name(listRuns, "listRuns");
950
+ function retrieveRun(runId) {
951
+ const apiClient = apiClientManager.client;
952
+ if (!apiClient) {
953
+ throw apiClientMissingError();
954
+ }
955
+ return apiClient.retrieveRun(runId);
944
956
  }
945
957
  __name(retrieveRun, "retrieveRun");
946
- async function replayRun(runId) {
958
+ function replayRun(runId) {
947
959
  const apiClient = apiClientManager.client;
948
960
  if (!apiClient) {
949
961
  throw apiClientMissingError();
950
962
  }
951
- return await apiClient.replayRun(runId);
963
+ return apiClient.replayRun(runId);
952
964
  }
953
965
  __name(replayRun, "replayRun");
954
- async function cancelRun(runId) {
966
+ function cancelRun(runId) {
955
967
  const apiClient = apiClientManager.client;
956
968
  if (!apiClient) {
957
969
  throw apiClientMissingError();
958
970
  }
959
- return await apiClient.cancelRun(runId);
971
+ return apiClient.cancelRun(runId);
960
972
  }
961
973
  __name(cancelRun, "cancelRun");
962
974
 
@@ -980,7 +992,7 @@ function task2(params) {
980
992
  return task3;
981
993
  }
982
994
  __name(task2, "task");
983
- async function create(options) {
995
+ function create(options) {
984
996
  const apiClient = apiClientManager.client;
985
997
  if (!apiClient) {
986
998
  throw apiClientMissingError();
@@ -988,7 +1000,7 @@ async function create(options) {
988
1000
  return apiClient.createSchedule(options);
989
1001
  }
990
1002
  __name(create, "create");
991
- async function retrieve(scheduleId) {
1003
+ function retrieve(scheduleId) {
992
1004
  const apiClient = apiClientManager.client;
993
1005
  if (!apiClient) {
994
1006
  throw apiClientMissingError();
@@ -996,7 +1008,7 @@ async function retrieve(scheduleId) {
996
1008
  return apiClient.retrieveSchedule(scheduleId);
997
1009
  }
998
1010
  __name(retrieve, "retrieve");
999
- async function update(scheduleId, options) {
1011
+ function update(scheduleId, options) {
1000
1012
  const apiClient = apiClientManager.client;
1001
1013
  if (!apiClient) {
1002
1014
  throw apiClientMissingError();
@@ -1004,7 +1016,7 @@ async function update(scheduleId, options) {
1004
1016
  return apiClient.updateSchedule(scheduleId, options);
1005
1017
  }
1006
1018
  __name(update, "update");
1007
- async function del(scheduleId) {
1019
+ function del(scheduleId) {
1008
1020
  const apiClient = apiClientManager.client;
1009
1021
  if (!apiClient) {
1010
1022
  throw apiClientMissingError();
@@ -1012,7 +1024,7 @@ async function del(scheduleId) {
1012
1024
  return apiClient.deleteSchedule(scheduleId);
1013
1025
  }
1014
1026
  __name(del, "del");
1015
- async function deactivate(scheduleId) {
1027
+ function deactivate(scheduleId) {
1016
1028
  const apiClient = apiClientManager.client;
1017
1029
  if (!apiClient) {
1018
1030
  throw apiClientMissingError();
@@ -1020,7 +1032,7 @@ async function deactivate(scheduleId) {
1020
1032
  return apiClient.deactivateSchedule(scheduleId);
1021
1033
  }
1022
1034
  __name(deactivate, "deactivate");
1023
- async function activate(scheduleId) {
1035
+ function activate(scheduleId) {
1024
1036
  const apiClient = apiClientManager.client;
1025
1037
  if (!apiClient) {
1026
1038
  throw apiClientMissingError();
@@ -1028,7 +1040,7 @@ async function activate(scheduleId) {
1028
1040
  return apiClient.activateSchedule(scheduleId);
1029
1041
  }
1030
1042
  __name(activate, "activate");
1031
- async function list(options) {
1043
+ function list(options) {
1032
1044
  const apiClient = apiClientManager.client;
1033
1045
  if (!apiClient) {
1034
1046
  throw apiClientMissingError();
@@ -1047,7 +1059,7 @@ __export(envvars_exports, {
1047
1059
  update: () => update2,
1048
1060
  upload: () => upload
1049
1061
  });
1050
- async function upload(projectRefOrParams, slug, params) {
1062
+ function upload(projectRefOrParams, slug, params) {
1051
1063
  let $projectRef;
1052
1064
  let $params;
1053
1065
  let $slug;
@@ -1082,16 +1094,10 @@ async function upload(projectRefOrParams, slug, params) {
1082
1094
  if (!apiClient) {
1083
1095
  throw apiClientMissingError();
1084
1096
  }
1085
- return await tracer.startActiveSpan("envvars.upload", async (span) => {
1086
- return await apiClient.importEnvVars($projectRef, $slug, $params);
1087
- }, {
1088
- attributes: {
1089
- [SemanticInternalAttributes.STYLE_ICON]: "file-upload"
1090
- }
1091
- });
1097
+ return apiClient.importEnvVars($projectRef, $slug, $params);
1092
1098
  }
1093
1099
  __name(upload, "upload");
1094
- async function list2(projectRef, slug) {
1100
+ function list2(projectRef, slug) {
1095
1101
  const $projectRef = projectRef ?? taskContext.ctx?.project.ref;
1096
1102
  const $slug = slug ?? taskContext.ctx?.environment.slug;
1097
1103
  if (!$projectRef) {
@@ -1104,16 +1110,10 @@ async function list2(projectRef, slug) {
1104
1110
  if (!apiClient) {
1105
1111
  throw apiClientMissingError();
1106
1112
  }
1107
- return await tracer.startActiveSpan("envvars.list", async (span) => {
1108
- return await apiClient.listEnvVars($projectRef, $slug);
1109
- }, {
1110
- attributes: {
1111
- [SemanticInternalAttributes.STYLE_ICON]: "id"
1112
- }
1113
- });
1113
+ return apiClient.listEnvVars($projectRef, $slug);
1114
1114
  }
1115
1115
  __name(list2, "list");
1116
- async function create2(projectRefOrParams, slug, params) {
1116
+ function create2(projectRefOrParams, slug, params) {
1117
1117
  let $projectRef;
1118
1118
  let $slug;
1119
1119
  let $params;
@@ -1148,16 +1148,10 @@ async function create2(projectRefOrParams, slug, params) {
1148
1148
  if (!apiClient) {
1149
1149
  throw apiClientMissingError();
1150
1150
  }
1151
- return await tracer.startActiveSpan("envvars.create", async (span) => {
1152
- return await apiClient.createEnvVar($projectRef, $slug, $params);
1153
- }, {
1154
- attributes: {
1155
- [SemanticInternalAttributes.STYLE_ICON]: "id"
1156
- }
1157
- });
1151
+ return apiClient.createEnvVar($projectRef, $slug, $params);
1158
1152
  }
1159
1153
  __name(create2, "create");
1160
- async function retrieve2(projectRefOrName, slug, name) {
1154
+ function retrieve2(projectRefOrName, slug, name) {
1161
1155
  let $projectRef;
1162
1156
  let $slug;
1163
1157
  let $name;
@@ -1180,16 +1174,10 @@ async function retrieve2(projectRefOrName, slug, name) {
1180
1174
  if (!apiClient) {
1181
1175
  throw apiClientMissingError();
1182
1176
  }
1183
- return await tracer.startActiveSpan("envvars.retrieve", async (span) => {
1184
- return await apiClient.retrieveEnvVar($projectRef, $slug, $name);
1185
- }, {
1186
- attributes: {
1187
- [SemanticInternalAttributes.STYLE_ICON]: "id"
1188
- }
1189
- });
1177
+ return apiClient.retrieveEnvVar($projectRef, $slug, $name);
1190
1178
  }
1191
1179
  __name(retrieve2, "retrieve");
1192
- async function del2(projectRefOrName, slug, name) {
1180
+ function del2(projectRefOrName, slug, name) {
1193
1181
  let $projectRef;
1194
1182
  let $slug;
1195
1183
  let $name;
@@ -1212,16 +1200,10 @@ async function del2(projectRefOrName, slug, name) {
1212
1200
  if (!apiClient) {
1213
1201
  throw apiClientMissingError();
1214
1202
  }
1215
- return await tracer.startActiveSpan("envvars.delete", async (span) => {
1216
- return await apiClient.deleteEnvVar($projectRef, $slug, $name);
1217
- }, {
1218
- attributes: {
1219
- [SemanticInternalAttributes.STYLE_ICON]: "id"
1220
- }
1221
- });
1203
+ return apiClient.deleteEnvVar($projectRef, $slug, $name);
1222
1204
  }
1223
1205
  __name(del2, "del");
1224
- async function update2(projectRefOrName, slugOrParams, name, params) {
1206
+ function update2(projectRefOrName, slugOrParams, name, params) {
1225
1207
  let $projectRef;
1226
1208
  let $slug;
1227
1209
  let $name;
@@ -1260,13 +1242,7 @@ async function update2(projectRefOrName, slugOrParams, name, params) {
1260
1242
  if (!apiClient) {
1261
1243
  throw apiClientMissingError();
1262
1244
  }
1263
- return await tracer.startActiveSpan("envvars.update", async (span) => {
1264
- return await apiClient.updateEnvVar($projectRef, $slug, $name, $params);
1265
- }, {
1266
- attributes: {
1267
- [SemanticInternalAttributes.STYLE_ICON]: "id"
1268
- }
1269
- });
1245
+ return apiClient.updateEnvVar($projectRef, $slug, $name, $params);
1270
1246
  }
1271
1247
  __name(update2, "update");
1272
1248