@trigger.dev/core 0.0.0-v3-prerelease-20240703181409 → 0.0.0-v3-prerelease-20240705100038

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.
Files changed (45) hide show
  1. package/dist/{catalog-9G8AqnI9.d.ts → catalog-N-X0Te3W.d.mts} +5 -23
  2. package/dist/{catalog-Y0mRLMtJ.d.mts → catalog-NxVZnWZh.d.ts} +5 -23
  3. package/dist/{common-55Mqj8JP.d.mts → common-fIyU5pmz.d.mts} +13 -0
  4. package/dist/{common-55Mqj8JP.d.ts → common-fIyU5pmz.d.ts} +13 -0
  5. package/dist/{manager-6NRInm7C.d.ts → manager-2ZQ3_twq.d.ts} +1 -1
  6. package/dist/{manager-2AqSY67c.d.mts → manager-X_HrWQ7_.d.mts} +1 -1
  7. package/dist/{messages-nXkzt5CT.d.mts → messages-Sggr4tid.d.mts} +162 -0
  8. package/dist/{messages-nXkzt5CT.d.ts → messages-Sggr4tid.d.ts} +162 -0
  9. package/dist/{schemas-CeAee_C2.d.mts → schemas-Zy7mGFgD.d.mts} +19 -0
  10. package/dist/{schemas-CeAee_C2.d.ts → schemas-Zy7mGFgD.d.ts} +19 -0
  11. package/dist/tracer-N0p2Fuuv.d.mts +23 -0
  12. package/dist/tracer-N0p2Fuuv.d.ts +23 -0
  13. package/dist/v3/dev/index.d.mts +2 -2
  14. package/dist/v3/dev/index.d.ts +2 -2
  15. package/dist/v3/index.d.mts +49 -38
  16. package/dist/v3/index.d.ts +49 -38
  17. package/dist/v3/index.js +432 -303
  18. package/dist/v3/index.js.map +1 -1
  19. package/dist/v3/index.mjs +430 -304
  20. package/dist/v3/index.mjs.map +1 -1
  21. package/dist/v3/otel/index.js +5 -2
  22. package/dist/v3/otel/index.js.map +1 -1
  23. package/dist/v3/otel/index.mjs +5 -2
  24. package/dist/v3/otel/index.mjs.map +1 -1
  25. package/dist/v3/prod/index.d.mts +3 -3
  26. package/dist/v3/prod/index.d.ts +3 -3
  27. package/dist/v3/schemas/index.d.mts +16 -4
  28. package/dist/v3/schemas/index.d.ts +16 -4
  29. package/dist/v3/schemas/index.js +3 -1
  30. package/dist/v3/schemas/index.js.map +1 -1
  31. package/dist/v3/schemas/index.mjs +3 -1
  32. package/dist/v3/schemas/index.mjs.map +1 -1
  33. package/dist/v3/workers/index.d.mts +7 -6
  34. package/dist/v3/workers/index.d.ts +7 -6
  35. package/dist/v3/workers/index.js +202 -92
  36. package/dist/v3/workers/index.js.map +1 -1
  37. package/dist/v3/workers/index.mjs +202 -92
  38. package/dist/v3/workers/index.mjs.map +1 -1
  39. package/dist/v3/zodfetch.d.mts +14 -2
  40. package/dist/v3/zodfetch.d.ts +14 -2
  41. package/dist/v3/zodfetch.js +244 -28
  42. package/dist/v3/zodfetch.js.map +1 -1
  43. package/dist/v3/zodfetch.mjs +242 -29
  44. package/dist/v3/zodfetch.mjs.map +1 -1
  45. package/package.json +1 -1
@@ -132,7 +132,10 @@ var SemanticInternalAttributes = {
132
132
  LINK_TITLE: "$link.title",
133
133
  IDEMPOTENCY_KEY: "ctx.run.idempotencyKey",
134
134
  USAGE_DURATION_MS: "$usage.durationMs",
135
- USAGE_COST_IN_CENTS: "$usage.costInCents"
135
+ USAGE_COST_IN_CENTS: "$usage.costInCents",
136
+ RATE_LIMIT_LIMIT: "response.rateLimit.limit",
137
+ RATE_LIMIT_REMAINING: "response.rateLimit.remaining",
138
+ RATE_LIMIT_RESET: "response.rateLimit.reset"
136
139
  };
137
140
 
138
141
  // src/v3/utils/flattenAttributes.ts
@@ -364,7 +367,7 @@ function getEnvVar(name) {
364
367
  __name(getEnvVar, "getEnvVar");
365
368
 
366
369
  // package.json
367
- var version = "0.0.0-v3-prerelease-20240703181409";
370
+ var version = "0.0.0-v3-prerelease-20240705100038";
368
371
 
369
372
  // src/v3/otel/tracingSDK.ts
370
373
  var _a;
@@ -615,6 +618,7 @@ var TaskRun = z.object({
615
618
  createdAt: z.coerce.date(),
616
619
  startedAt: z.coerce.date().default(() => /* @__PURE__ */ new Date()),
617
620
  idempotencyKey: z.string().optional(),
621
+ maxAttempts: z.number().optional(),
618
622
  durationMs: z.number().default(0),
619
623
  costInCents: z.number().default(0),
620
624
  baseCostInCents: z.number().default(0)
@@ -982,7 +986,8 @@ var TriggerTaskRequestBody = z.object({
982
986
  test: z.boolean().optional(),
983
987
  payloadType: z.string().optional(),
984
988
  delay: z.string().or(z.coerce.date()).optional(),
985
- ttl: z.string().or(z.number().nonnegative().int()).optional()
989
+ ttl: z.string().or(z.number().nonnegative().int()).optional(),
990
+ maxAttempts: z.number().int().optional()
986
991
  }).optional()
987
992
  });
988
993
  var TriggerTaskResponse = z.object({
@@ -1312,10 +1317,34 @@ var EnvironmentVariable = z.object({
1312
1317
  });
1313
1318
  var EnvironmentVariables = z.array(EnvironmentVariable);
1314
1319
 
1320
+ // src/v3/utils/retries.ts
1321
+ var defaultRetryOptions = {
1322
+ maxAttempts: 3,
1323
+ factor: 2,
1324
+ minTimeoutInMs: 1e3,
1325
+ maxTimeoutInMs: 6e4,
1326
+ randomize: true
1327
+ };
1328
+ function calculateNextRetryDelay(options, attempt) {
1329
+ const opts = {
1330
+ ...defaultRetryOptions,
1331
+ ...options
1332
+ };
1333
+ if (attempt >= opts.maxAttempts) {
1334
+ return;
1335
+ }
1336
+ const { factor, minTimeoutInMs, maxTimeoutInMs, randomize } = opts;
1337
+ const random = randomize ? Math.random() + 1 : 1;
1338
+ const timeout = Math.min(maxTimeoutInMs, random * minTimeoutInMs * Math.pow(factor, attempt - 1));
1339
+ return Math.round(timeout);
1340
+ }
1341
+ __name(calculateNextRetryDelay, "calculateNextRetryDelay");
1342
+
1315
1343
  // src/v3/apiClient/errors.ts
1316
1344
  var _ApiError = class _ApiError extends Error {
1317
1345
  constructor(status, error, message, headers) {
1318
1346
  super(`${_ApiError.makeMessage(status, error, message)}`);
1347
+ this.name = "TriggerApiError";
1319
1348
  this.status = status;
1320
1349
  this.headers = headers;
1321
1350
  const data = error;
@@ -1436,6 +1465,16 @@ var _RateLimitError = class _RateLimitError extends ApiError {
1436
1465
  super(...arguments);
1437
1466
  __publicField(this, "status", 429);
1438
1467
  }
1468
+ get millisecondsUntilReset() {
1469
+ const resetAtUnixEpochMs = (this.headers ?? {})["x-ratelimit-reset"];
1470
+ if (typeof resetAtUnixEpochMs === "string") {
1471
+ const resetAtUnixEpoch = parseInt(resetAtUnixEpochMs, 10);
1472
+ if (isNaN(resetAtUnixEpoch)) {
1473
+ return;
1474
+ }
1475
+ return Math.max(resetAtUnixEpoch - Date.now() + Math.floor(Math.random() * 2e3), 0);
1476
+ }
1477
+ }
1439
1478
  };
1440
1479
  __name(_RateLimitError, "RateLimitError");
1441
1480
  var RateLimitError = _RateLimitError;
@@ -1450,28 +1489,11 @@ function castToError(err) {
1450
1489
  }
1451
1490
  __name(castToError, "castToError");
1452
1491
 
1453
- // src/v3/utils/retries.ts
1454
- var defaultRetryOptions = {
1455
- maxAttempts: 3,
1456
- factor: 2,
1457
- minTimeoutInMs: 1e3,
1458
- maxTimeoutInMs: 6e4,
1459
- randomize: true
1460
- };
1461
- function calculateNextRetryDelay(options, attempt) {
1462
- const opts = {
1463
- ...defaultRetryOptions,
1464
- ...options
1465
- };
1466
- if (attempt >= opts.maxAttempts) {
1467
- return;
1468
- }
1469
- const { factor, minTimeoutInMs, maxTimeoutInMs, randomize } = opts;
1470
- const random = randomize ? Math.random() + 1 : 1;
1471
- const timeout = Math.min(maxTimeoutInMs, random * minTimeoutInMs * Math.pow(factor, attempt - 1));
1472
- return Math.round(timeout);
1492
+ // src/v3/utils/styleAttributes.ts
1493
+ function accessoryAttributes(accessory) {
1494
+ return flattenAttributes(accessory, SemanticInternalAttributes.STYLE_ACCESSORY);
1473
1495
  }
1474
- __name(calculateNextRetryDelay, "calculateNextRetryDelay");
1496
+ __name(accessoryAttributes, "accessoryAttributes");
1475
1497
 
1476
1498
  // src/v3/apiClient/pagination.ts
1477
1499
  var _CursorPage = class _CursorPage {
@@ -1631,16 +1653,43 @@ function zodfetchOffsetLimitPage(schema, url, params, requestInit, options) {
1631
1653
  return new OffsetLimitPagePromise(fetchResult, schema, url, params, requestInit, options);
1632
1654
  }
1633
1655
  __name(zodfetchOffsetLimitPage, "zodfetchOffsetLimitPage");
1634
- async function _doZodFetch(schema, url, requestInit, options, attempt = 1) {
1656
+ async function traceZodFetch(params, callback) {
1657
+ if (!params.options?.tracer) {
1658
+ return callback();
1659
+ }
1660
+ const url = new URL(params.url);
1661
+ const method = params.requestInit?.method ?? "GET";
1662
+ const name = params.options.name ?? `${method} ${url.pathname}`;
1663
+ return await params.options.tracer.startActiveSpan(name, async (span) => {
1664
+ return await callback(span);
1665
+ }, {
1666
+ attributes: {
1667
+ [SemanticInternalAttributes.STYLE_ICON]: params.options?.icon ?? "api",
1668
+ ...params.options.attributes
1669
+ }
1670
+ });
1671
+ }
1672
+ __name(traceZodFetch, "traceZodFetch");
1673
+ async function _doZodFetch(schema, url, requestInit, options) {
1674
+ const $requestInit = await requestInit;
1675
+ return traceZodFetch({
1676
+ url,
1677
+ requestInit: $requestInit,
1678
+ options
1679
+ }, async (span) => {
1680
+ return await _doZodFetchWithRetries(schema, url, $requestInit, options);
1681
+ });
1682
+ }
1683
+ __name(_doZodFetch, "_doZodFetch");
1684
+ async function _doZodFetchWithRetries(schema, url, requestInit, options, attempt = 1) {
1635
1685
  try {
1636
- const $requestInit = await requestInit;
1637
- const response = await fetch(url, requestInitWithCache($requestInit));
1686
+ const response = await fetch(url, requestInitWithCache(requestInit));
1638
1687
  const responseHeaders = createResponseHeaders(response.headers);
1639
1688
  if (!response.ok) {
1640
1689
  const retryResult = shouldRetry(response, attempt, options?.retry);
1641
1690
  if (retryResult.retry) {
1642
- await new Promise((resolve) => setTimeout(resolve, retryResult.delay));
1643
- return await _doZodFetch(schema, url, requestInit, options, attempt + 1);
1691
+ await waitForRetry(url, attempt + 1, retryResult.delay, options, requestInit, response);
1692
+ return await _doZodFetchWithRetries(schema, url, requestInit, options, attempt + 1);
1644
1693
  } else {
1645
1694
  const errText = await response.text().catch((e) => castToError2(e).message);
1646
1695
  const errJSON = safeJsonParse(errText);
@@ -1668,8 +1717,8 @@ async function _doZodFetch(schema, url, requestInit, options, attempt = 1) {
1668
1717
  };
1669
1718
  const delay = calculateNextRetryDelay(retry, attempt);
1670
1719
  if (delay) {
1671
- await new Promise((resolve) => setTimeout(resolve, delay));
1672
- return await _doZodFetch(schema, url, requestInit, options, attempt + 1);
1720
+ await waitForRetry(url, attempt + 1, delay, options, requestInit);
1721
+ return await _doZodFetchWithRetries(schema, url, requestInit, options, attempt + 1);
1673
1722
  }
1674
1723
  }
1675
1724
  throw new ApiConnectionError({
@@ -1677,7 +1726,7 @@ async function _doZodFetch(schema, url, requestInit, options, attempt = 1) {
1677
1726
  });
1678
1727
  }
1679
1728
  }
1680
- __name(_doZodFetch, "_doZodFetch");
1729
+ __name(_doZodFetchWithRetries, "_doZodFetchWithRetries");
1681
1730
  function castToError2(err) {
1682
1731
  if (err instanceof Error)
1683
1732
  return err;
@@ -1714,8 +1763,25 @@ function shouldRetry(response, attempt, retryOptions) {
1714
1763
  return shouldRetryForOptions();
1715
1764
  if (response.status === 409)
1716
1765
  return shouldRetryForOptions();
1717
- if (response.status === 429)
1766
+ if (response.status === 429) {
1767
+ if (attempt >= (typeof retryOptions?.maxAttempts === "number" ? retryOptions?.maxAttempts : 3)) {
1768
+ return {
1769
+ retry: false
1770
+ };
1771
+ }
1772
+ const resetAtUnixEpochMs = response.headers.get("x-ratelimit-reset");
1773
+ if (resetAtUnixEpochMs) {
1774
+ const resetAtUnixEpoch = parseInt(resetAtUnixEpochMs, 10);
1775
+ const delay = resetAtUnixEpoch - Date.now() + Math.floor(Math.random() * 1e3);
1776
+ if (delay > 0) {
1777
+ return {
1778
+ retry: true,
1779
+ delay
1780
+ };
1781
+ }
1782
+ }
1718
1783
  return shouldRetryForOptions();
1784
+ }
1719
1785
  if (response.status >= 500)
1720
1786
  return shouldRetryForOptions();
1721
1787
  return {
@@ -1878,9 +1944,32 @@ fetchPage_fn2 = /* @__PURE__ */ __name(function(params1) {
1878
1944
  }, "#fetchPage");
1879
1945
  __name(_OffsetLimitPagePromise, "OffsetLimitPagePromise");
1880
1946
  var OffsetLimitPagePromise = _OffsetLimitPagePromise;
1947
+ async function waitForRetry(url, attempt, delay, options, requestInit, response) {
1948
+ if (options?.tracer) {
1949
+ const method = requestInit?.method ?? "GET";
1950
+ return options.tracer.startActiveSpan(response ? `wait after ${response.status}` : `wait after error`, async (span) => {
1951
+ await new Promise((resolve) => setTimeout(resolve, delay));
1952
+ }, {
1953
+ attributes: {
1954
+ [SemanticInternalAttributes.STYLE_ICON]: "wait",
1955
+ ...accessoryAttributes({
1956
+ items: [
1957
+ {
1958
+ text: `retrying ${options?.name ?? method.toUpperCase()} in ${delay}ms`,
1959
+ variant: "normal"
1960
+ }
1961
+ ],
1962
+ style: "codepath"
1963
+ })
1964
+ }
1965
+ });
1966
+ }
1967
+ await new Promise((resolve) => setTimeout(resolve, delay));
1968
+ }
1969
+ __name(waitForRetry, "waitForRetry");
1881
1970
 
1882
1971
  // src/v3/apiClient/index.ts
1883
- var zodFetchOptions = {
1972
+ var DEFAULT_ZOD_FETCH_OPTIONS = {
1884
1973
  retry: {
1885
1974
  maxAttempts: 3,
1886
1975
  minTimeoutInMs: 1e3,
@@ -1891,17 +1980,18 @@ var zodFetchOptions = {
1891
1980
  };
1892
1981
  var _getHeaders, getHeaders_fn;
1893
1982
  var _ApiClient = class _ApiClient {
1894
- constructor(baseUrl, accessToken) {
1983
+ constructor(baseUrl, accessToken, requestOptions = {}) {
1895
1984
  __privateAdd(this, _getHeaders);
1896
1985
  this.accessToken = accessToken;
1897
1986
  this.baseUrl = baseUrl.replace(/\/$/, "");
1987
+ this.defaultRequestOptions = mergeRequestOptions(DEFAULT_ZOD_FETCH_OPTIONS, requestOptions);
1898
1988
  }
1899
- async getRunResult(runId) {
1989
+ async getRunResult(runId, requestOptions) {
1900
1990
  try {
1901
1991
  return await zodfetch(TaskRunExecutionResult, `${this.baseUrl}/api/v1/runs/${runId}/result`, {
1902
1992
  method: "GET",
1903
1993
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
1904
- }, zodFetchOptions);
1994
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
1905
1995
  } catch (error) {
1906
1996
  if (error instanceof ApiError) {
1907
1997
  if (error.status === 404) {
@@ -1911,47 +2001,47 @@ var _ApiClient = class _ApiClient {
1911
2001
  throw error;
1912
2002
  }
1913
2003
  }
1914
- async getBatchResults(batchId) {
2004
+ async getBatchResults(batchId, requestOptions) {
1915
2005
  return await zodfetch(BatchTaskRunExecutionResult, `${this.baseUrl}/api/v1/batches/${batchId}/results`, {
1916
2006
  method: "GET",
1917
2007
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
1918
- }, zodFetchOptions);
2008
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
1919
2009
  }
1920
- triggerTask(taskId, body, options) {
2010
+ triggerTask(taskId, body, options, requestOptions) {
1921
2011
  const encodedTaskId = encodeURIComponent(taskId);
1922
2012
  return zodfetch(TriggerTaskResponse, `${this.baseUrl}/api/v1/tasks/${encodedTaskId}/trigger`, {
1923
2013
  method: "POST",
1924
2014
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, options?.spanParentAsLink ?? false),
1925
2015
  body: JSON.stringify(body)
1926
- }, zodFetchOptions);
2016
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
1927
2017
  }
1928
- batchTriggerTask(taskId, body, options) {
2018
+ batchTriggerTask(taskId, body, options, requestOptions) {
1929
2019
  const encodedTaskId = encodeURIComponent(taskId);
1930
2020
  return zodfetch(BatchTriggerTaskResponse, `${this.baseUrl}/api/v1/tasks/${encodedTaskId}/batch`, {
1931
2021
  method: "POST",
1932
2022
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, options?.spanParentAsLink ?? false),
1933
2023
  body: JSON.stringify(body)
1934
- }, zodFetchOptions);
2024
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
1935
2025
  }
1936
- createUploadPayloadUrl(filename) {
2026
+ createUploadPayloadUrl(filename, requestOptions) {
1937
2027
  return zodfetch(CreateUploadPayloadUrlResponseBody, `${this.baseUrl}/api/v1/packets/${filename}`, {
1938
2028
  method: "PUT",
1939
2029
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
1940
- }, zodFetchOptions);
2030
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
1941
2031
  }
1942
- getPayloadUrl(filename) {
2032
+ getPayloadUrl(filename, requestOptions) {
1943
2033
  return zodfetch(CreateUploadPayloadUrlResponseBody, `${this.baseUrl}/api/v1/packets/${filename}`, {
1944
2034
  method: "GET",
1945
2035
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
1946
- }, zodFetchOptions);
2036
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
1947
2037
  }
1948
- retrieveRun(runId) {
2038
+ retrieveRun(runId, requestOptions) {
1949
2039
  return zodfetch(RetrieveRunResponse, `${this.baseUrl}/api/v3/runs/${runId}`, {
1950
2040
  method: "GET",
1951
2041
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
1952
- }, zodFetchOptions);
2042
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
1953
2043
  }
1954
- listRuns(query) {
2044
+ listRuns(query, requestOptions) {
1955
2045
  const searchParams = createSearchQueryForListRuns(query);
1956
2046
  return zodfetchCursorPage(ListRunResponseItem, `${this.baseUrl}/api/v1/runs`, {
1957
2047
  query: searchParams,
@@ -1961,9 +2051,9 @@ var _ApiClient = class _ApiClient {
1961
2051
  }, {
1962
2052
  method: "GET",
1963
2053
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
1964
- }, zodFetchOptions);
2054
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
1965
2055
  }
1966
- listProjectRuns(projectRef, query) {
2056
+ listProjectRuns(projectRef, query, requestOptions) {
1967
2057
  const searchParams = createSearchQueryForListRuns(query);
1968
2058
  if (query?.env) {
1969
2059
  searchParams.append("filter[env]", Array.isArray(query.env) ? query.env.join(",") : query.env);
@@ -1976,35 +2066,35 @@ var _ApiClient = class _ApiClient {
1976
2066
  }, {
1977
2067
  method: "GET",
1978
2068
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
1979
- }, zodFetchOptions);
2069
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
1980
2070
  }
1981
- replayRun(runId) {
2071
+ replayRun(runId, requestOptions) {
1982
2072
  return zodfetch(ReplayRunResponse, `${this.baseUrl}/api/v1/runs/${runId}/replay`, {
1983
2073
  method: "POST",
1984
2074
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
1985
- }, zodFetchOptions);
2075
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
1986
2076
  }
1987
- cancelRun(runId) {
2077
+ cancelRun(runId, requestOptions) {
1988
2078
  return zodfetch(CanceledRunResponse, `${this.baseUrl}/api/v2/runs/${runId}/cancel`, {
1989
2079
  method: "POST",
1990
2080
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
1991
- }, zodFetchOptions);
2081
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
1992
2082
  }
1993
- rescheduleRun(runId, body) {
2083
+ rescheduleRun(runId, body, requestOptions) {
1994
2084
  return zodfetch(RetrieveRunResponse, `${this.baseUrl}/api/v1/runs/${runId}/reschedule`, {
1995
2085
  method: "POST",
1996
2086
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
1997
2087
  body: JSON.stringify(body)
1998
- }, zodFetchOptions);
2088
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
1999
2089
  }
2000
- createSchedule(options) {
2090
+ createSchedule(options, requestOptions) {
2001
2091
  return zodfetch(ScheduleObject, `${this.baseUrl}/api/v1/schedules`, {
2002
2092
  method: "POST",
2003
2093
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
2004
2094
  body: JSON.stringify(options)
2005
- });
2095
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2006
2096
  }
2007
- listSchedules(options) {
2097
+ listSchedules(options, requestOptions) {
2008
2098
  const searchParams = new URLSearchParams();
2009
2099
  if (options?.page) {
2010
2100
  searchParams.append("page", options.page.toString());
@@ -2018,77 +2108,77 @@ var _ApiClient = class _ApiClient {
2018
2108
  }, {
2019
2109
  method: "GET",
2020
2110
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
2021
- });
2111
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2022
2112
  }
2023
- retrieveSchedule(scheduleId) {
2113
+ retrieveSchedule(scheduleId, requestOptions) {
2024
2114
  return zodfetch(ScheduleObject, `${this.baseUrl}/api/v1/schedules/${scheduleId}`, {
2025
2115
  method: "GET",
2026
2116
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
2027
- });
2117
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2028
2118
  }
2029
- updateSchedule(scheduleId, options) {
2119
+ updateSchedule(scheduleId, options, requestOptions) {
2030
2120
  return zodfetch(ScheduleObject, `${this.baseUrl}/api/v1/schedules/${scheduleId}`, {
2031
2121
  method: "PUT",
2032
2122
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
2033
2123
  body: JSON.stringify(options)
2034
- });
2124
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2035
2125
  }
2036
- deactivateSchedule(scheduleId) {
2126
+ deactivateSchedule(scheduleId, requestOptions) {
2037
2127
  return zodfetch(ScheduleObject, `${this.baseUrl}/api/v1/schedules/${scheduleId}/deactivate`, {
2038
2128
  method: "POST",
2039
2129
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
2040
- });
2130
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2041
2131
  }
2042
- activateSchedule(scheduleId) {
2132
+ activateSchedule(scheduleId, requestOptions) {
2043
2133
  return zodfetch(ScheduleObject, `${this.baseUrl}/api/v1/schedules/${scheduleId}/activate`, {
2044
2134
  method: "POST",
2045
2135
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
2046
- });
2136
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2047
2137
  }
2048
- deleteSchedule(scheduleId) {
2138
+ deleteSchedule(scheduleId, requestOptions) {
2049
2139
  return zodfetch(DeletedScheduleObject, `${this.baseUrl}/api/v1/schedules/${scheduleId}`, {
2050
2140
  method: "DELETE",
2051
2141
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
2052
- });
2142
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2053
2143
  }
2054
- listEnvVars(projectRef, slug) {
2144
+ listEnvVars(projectRef, slug, requestOptions) {
2055
2145
  return zodfetch(EnvironmentVariables, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}`, {
2056
2146
  method: "GET",
2057
2147
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
2058
- });
2148
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2059
2149
  }
2060
- importEnvVars(projectRef, slug, body) {
2150
+ importEnvVars(projectRef, slug, body, requestOptions) {
2061
2151
  return zodfetch(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/import`, {
2062
2152
  method: "POST",
2063
2153
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
2064
2154
  body: JSON.stringify(body)
2065
- });
2155
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2066
2156
  }
2067
- retrieveEnvVar(projectRef, slug, key) {
2157
+ retrieveEnvVar(projectRef, slug, key, requestOptions) {
2068
2158
  return zodfetch(EnvironmentVariableValue, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/${key}`, {
2069
2159
  method: "GET",
2070
2160
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
2071
- });
2161
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2072
2162
  }
2073
- createEnvVar(projectRef, slug, body) {
2163
+ createEnvVar(projectRef, slug, body, requestOptions) {
2074
2164
  return zodfetch(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}`, {
2075
2165
  method: "POST",
2076
2166
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
2077
2167
  body: JSON.stringify(body)
2078
- });
2168
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2079
2169
  }
2080
- updateEnvVar(projectRef, slug, key, body) {
2170
+ updateEnvVar(projectRef, slug, key, body, requestOptions) {
2081
2171
  return zodfetch(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/${key}`, {
2082
2172
  method: "PUT",
2083
2173
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
2084
2174
  body: JSON.stringify(body)
2085
- });
2175
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2086
2176
  }
2087
- deleteEnvVar(projectRef, slug, key) {
2177
+ deleteEnvVar(projectRef, slug, key, requestOptions) {
2088
2178
  return zodfetch(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/${key}`, {
2089
2179
  method: "DELETE",
2090
2180
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
2091
- });
2181
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2092
2182
  }
2093
2183
  };
2094
2184
  _getHeaders = new WeakSet();
@@ -2143,6 +2233,20 @@ function createSearchQueryForListRuns(query) {
2143
2233
  return searchParams;
2144
2234
  }
2145
2235
  __name(createSearchQueryForListRuns, "createSearchQueryForListRuns");
2236
+ function mergeRequestOptions(defaultOptions, options) {
2237
+ if (!options) {
2238
+ return defaultOptions;
2239
+ }
2240
+ return {
2241
+ ...defaultOptions,
2242
+ ...options,
2243
+ retry: {
2244
+ ...defaultOptions.retry,
2245
+ ...options.retry
2246
+ }
2247
+ };
2248
+ }
2249
+ __name(mergeRequestOptions, "mergeRequestOptions");
2146
2250
 
2147
2251
  // src/v3/apiClientManager/index.ts
2148
2252
  var API_NAME2 = "api-client";
@@ -2407,12 +2511,6 @@ async function loadSuperJSON() {
2407
2511
  }
2408
2512
  __name(loadSuperJSON, "loadSuperJSON");
2409
2513
 
2410
- // src/v3/utils/styleAttributes.ts
2411
- function accessoryAttributes(accessory) {
2412
- return flattenAttributes(accessory, SemanticInternalAttributes.STYLE_ACCESSORY);
2413
- }
2414
- __name(accessoryAttributes, "accessoryAttributes");
2415
-
2416
2514
  // src/v3/workers/taskExecutor.ts
2417
2515
  var _callRun, callRun_fn, _callInitFunctions, callInitFunctions_fn, _callConfigInit, callConfigInit_fn, _callOnSuccessFunctions, callOnSuccessFunctions_fn, _callOnSuccessFunction, callOnSuccessFunction_fn, _callOnFailureFunctions, callOnFailureFunctions_fn, _callOnFailureFunction, callOnFailureFunction_fn, _callOnStartFunctions, callOnStartFunctions_fn, _callOnStartFunction, callOnStartFunction_fn, _callTaskCleanup, callTaskCleanup_fn, _handleError, handleError_fn;
2418
2516
  var _TaskExecutor = class _TaskExecutor {
@@ -2689,7 +2787,19 @@ handleError_fn = /* @__PURE__ */ __name(async function(execution, error2, payloa
2689
2787
  status: "noop"
2690
2788
  };
2691
2789
  }
2692
- const delay = calculateNextRetryDelay(retry, execution.attempt.number);
2790
+ if (error2 instanceof Error && error2.name === "AbortTaskRunError") {
2791
+ return {
2792
+ status: "skipped"
2793
+ };
2794
+ }
2795
+ if (execution.run.maxAttempts) {
2796
+ retry.maxAttempts = Math.max(execution.run.maxAttempts, 1);
2797
+ }
2798
+ let delay = calculateNextRetryDelay(retry, execution.attempt.number);
2799
+ if (delay && error2 instanceof Error && error2.name === "TriggerApiError" && error2.status === 429) {
2800
+ const rateLimitError = error2;
2801
+ delay = rateLimitError.millisecondsUntilReset;
2802
+ }
2693
2803
  if (execution.environment.type === "DEVELOPMENT" && typeof retriesConfig?.enabledInDev === "boolean" && !retriesConfig.enabledInDev) {
2694
2804
  return {
2695
2805
  status: "skipped"