@trigger.dev/sdk 2.3.8 → 2.3.10

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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AsyncLocalStorage } from 'node:async_hooks';
2
- import { currentDate, REGISTER_SOURCE_EVENT_V2, RegisterSourceEventSchemaV2, API_VERSIONS, supportsFeature, ServerTaskSchema, RunTaskResponseWithCachedTasksBodySchema, ApiEventLogSchema, CancelRunsForEventSchema, JobRunStatusRecordSchema, TriggerSourceSchema, RegisterScheduleResponseBodySchema, ConnectionAuthSchema, GetEventSchema, urlWithSearchParams, GetRunSchema, GetRunStatusesSchema, GetRunsSchema, InvokeJobResponseSchema, EphemeralEventDispatcherResponseBodySchema, RequestWithRawBodySchema, deepMergeFilters, ScheduledPayloadSchema, WebhookSourceRequestHeadersSchema, HttpEndpointRequestHeadersSchema, HttpSourceRequestHeadersSchema, PreprocessRunBodySchema, RunJobBodySchema, InitializeTriggerBodySchema, MISSING_CONNECTION_NOTIFICATION, MissingConnectionNotificationPayloadSchema, MISSING_CONNECTION_RESOLVED_NOTIFICATION, MissingConnectionResolvedNotificationPayloadSchema, ErrorWithStackSchema, calculateRetryAt, assertExhaustive, KeyValueStoreResponseBodySchema, REGISTER_WEBHOOK, RegisterWebhookPayloadSchema } from '@trigger.dev/core';
2
+ import { currentDate, REGISTER_SOURCE_EVENT_V2, RegisterSourceEventSchemaV2, API_VERSIONS, supportsFeature, ServerTaskSchema, RunTaskResponseWithCachedTasksBodySchema, ApiEventLogSchema, CancelRunsForEventSchema, JobRunStatusRecordSchema, TriggerSourceSchema, RegisterScheduleResponseBodySchema, ConnectionAuthSchema, GetEventSchema, urlWithSearchParams, GetRunSchema, GetRunStatusesSchema, GetRunsSchema, InvokeJobResponseSchema, CancelRunsForJobSchema, EphemeralEventDispatcherResponseBodySchema, RequestWithRawBodySchema, deepMergeFilters, ScheduledPayloadSchema, WebhookSourceRequestHeadersSchema, HttpEndpointRequestHeadersSchema, HttpSourceRequestHeadersSchema, PreprocessRunBodySchema, RunJobBodySchema, InitializeTriggerBodySchema, MISSING_CONNECTION_NOTIFICATION, MissingConnectionNotificationPayloadSchema, MISSING_CONNECTION_RESOLVED_NOTIFICATION, MissingConnectionResolvedNotificationPayloadSchema, ErrorWithStackSchema, calculateRetryAt, assertExhaustive, KeyValueStoreResponseBodySchema, REGISTER_WEBHOOK, RegisterWebhookPayloadSchema } from '@trigger.dev/core';
3
3
  import { Logger, BloomFilter } from '@trigger.dev/core-backend';
4
4
  import EventEmitter from 'node:events';
5
5
  import { env } from 'node:process';
@@ -170,7 +170,7 @@ var _Job = class _Job {
170
170
  if (runStore) {
171
171
  throw new Error("Cannot invoke a job from within a run without a cacheKey.");
172
172
  }
173
- return await triggerClient.invokeJob(this.id, param1, param3);
173
+ return await triggerClient.invokeJob(this.id, param1, param2);
174
174
  }
175
175
  async invokeAndWaitForCompletion(cacheKey, payload, timeoutInSeconds = 60 * 60, options = {}) {
176
176
  const triggerClient = this.client;
@@ -258,7 +258,7 @@ __name(_Job, "Job");
258
258
  var Job = _Job;
259
259
 
260
260
  // package.json
261
- var version = "2.3.8";
261
+ var version = "2.3.10";
262
262
 
263
263
  // src/errors.ts
264
264
  var _ResumeWithTaskError = class _ResumeWithTaskError {
@@ -2176,6 +2176,19 @@ var _ApiClient = class _ApiClient {
2176
2176
  body: JSON.stringify(body)
2177
2177
  });
2178
2178
  }
2179
+ async cancelRunsForJob(jobId) {
2180
+ const apiKey = await __privateMethod(this, _apiKey, apiKey_fn).call(this);
2181
+ __privateGet(this, _logger).debug("Cancelling Runs for Job", {
2182
+ jobId
2183
+ });
2184
+ return await zodfetch(CancelRunsForJobSchema, `${__privateGet(this, _apiUrl)}/api/v1/jobs/${jobId}/cancel-runs`, {
2185
+ method: "POST",
2186
+ headers: {
2187
+ "Content-Type": "application/json",
2188
+ Authorization: `Bearer ${apiKey}`
2189
+ }
2190
+ });
2191
+ }
2179
2192
  async createEphemeralEventDispatcher(payload) {
2180
2193
  const apiKey = await __privateMethod(this, _apiKey, apiKey_fn).call(this);
2181
2194
  __privateGet(this, _logger).debug("Creating ephemeral event dispatcher", {
@@ -3676,6 +3689,9 @@ var _TriggerClient = class _TriggerClient {
3676
3689
  async invokeJob(jobId, payload, options) {
3677
3690
  return __privateGet(this, _client2).invokeJob(jobId, payload, options);
3678
3691
  }
3692
+ async cancelRunsForJob(jobId) {
3693
+ return __privateGet(this, _client2).cancelRunsForJob(jobId);
3694
+ }
3679
3695
  async createEphemeralEventDispatcher(payload) {
3680
3696
  return __privateGet(this, _client2).createEphemeralEventDispatcher(payload);
3681
3697
  }