@trigger.dev/sdk 0.0.0-prerelease-20231206103411 → 0.0.0-prerelease-20240112134133
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.mts +30 -20
- package/dist/index.d.ts +30 -20
- package/dist/index.js +47 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as _trigger_dev_core from '@trigger.dev/core';
|
|
2
|
-
import { AsyncMap, KeyValueStoreResponseBody, RunTaskBodyInput, CompleteTaskBodyV2Input, FailTaskBodyInput, SendEvent, SendEventOptions, StatusUpdate, UpdateTriggerSourceBodyV2, TriggerSource, UpdateWebhookBody, RegisterTriggerBodyV2, RegisterSourceEventV2, ScheduleMetadata, GetRunOptionsWithTaskDetails, GetRunsOptions, InvokeOptions, EphemeralEventDispatcherRequestBody,
|
|
3
|
-
export { ConnectionAuth, DisplayProperty, EventFilter,
|
|
2
|
+
import { AsyncMap, KeyValueStoreResponseBody, RunTaskBodyInput, CompleteTaskBodyV2Input, FailTaskBodyInput, SendEvent, SendEventOptions, StatusUpdate, UpdateTriggerSourceBodyV2, TriggerSource, UpdateWebhookBody, RegisterTriggerBodyV2, RegisterSourceEventV2, ScheduleMetadata, GetRunOptionsWithTaskDetails, GetRunsOptions, InvokeOptions, EphemeralEventDispatcherRequestBody, RuntimeEnvironmentType, DisplayProperty, TriggerMetadata, EventFilter, SuccessfulRunNotification, FailedRunNotification, HttpEndpointMetadata, RequestFilter, Prettify, HandleTriggerSource, RegisterTriggerSource, SerializableJson, ConnectionAuth, NormalizedResponse, HttpSourceResponseMetadata, IntervalOptions, CronOptions, ScheduledPayload, RegisterWebhookSource, DeserializedJson, ServerTask, CachedTask, InitialStatusUpdate, FetchRequestInit, FetchRetryOptions, FetchTimeoutOptions, FetchPollOperation, RunTaskOptions, IntegrationMetadata, IntegrationConfig, JobMetadata, RunNotification, MissingConnectionNotificationPayload, MissingConnectionResolvedNotificationPayload, ErrorWithStack, ApiEventLog, RedactString } from '@trigger.dev/core';
|
|
3
|
+
export { ConnectionAuth, DisplayProperty, EventFilter, NormalizedRequest, OverridableRunTaskOptions, Prettify, RedactString, RegisteredOptionsDiff, RunTaskOptions, SourceEventOption } from '@trigger.dev/core';
|
|
4
|
+
import { LogLevel, Logger } from '@trigger.dev/core-backend';
|
|
5
|
+
export { Logger } from '@trigger.dev/core-backend';
|
|
4
6
|
import * as zod from 'zod';
|
|
5
7
|
import { z, ZodType, TypeOf } from 'zod';
|
|
6
8
|
import { Buffer } from 'buffer';
|
|
@@ -726,6 +728,10 @@ declare class ApiClient {
|
|
|
726
728
|
invokeJob(jobId: string, payload: any, options?: InvokeOptions): Promise<{
|
|
727
729
|
id: string;
|
|
728
730
|
}>;
|
|
731
|
+
cancelRunsForJob(jobId: string): Promise<{
|
|
732
|
+
cancelledRunIds: string[];
|
|
733
|
+
failedToCancelRunIds: string[];
|
|
734
|
+
}>;
|
|
729
735
|
createEphemeralEventDispatcher(payload: EphemeralEventDispatcherRequestBody): Promise<{
|
|
730
736
|
id: string;
|
|
731
737
|
}>;
|
|
@@ -893,7 +899,7 @@ type PreprocessResults = {
|
|
|
893
899
|
properties: DisplayProperty[];
|
|
894
900
|
};
|
|
895
901
|
type TriggerEventType<TTrigger extends Trigger<any>> = TTrigger extends Trigger<infer TEventSpec> ? ReturnType<TEventSpec["parsePayload"]> : never;
|
|
896
|
-
type TriggerInvokeType<TTrigger extends Trigger<any>> = TTrigger extends Trigger<
|
|
902
|
+
type TriggerInvokeType<TTrigger extends Trigger<any>> = TTrigger extends Trigger<EventSpecification<any, infer TInvoke>> ? TInvoke : any;
|
|
897
903
|
type VerifyResult = {
|
|
898
904
|
success: true;
|
|
899
905
|
} | {
|
|
@@ -1083,6 +1089,22 @@ type EndpointOptions = {
|
|
|
1083
1089
|
verify: VerifyCallback;
|
|
1084
1090
|
};
|
|
1085
1091
|
|
|
1092
|
+
declare class KeyValueStore {
|
|
1093
|
+
#private;
|
|
1094
|
+
private apiClient;
|
|
1095
|
+
private type;
|
|
1096
|
+
private namespace;
|
|
1097
|
+
constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
|
|
1098
|
+
delete(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1099
|
+
delete(key: string): Promise<boolean>;
|
|
1100
|
+
get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T | undefined>;
|
|
1101
|
+
get<T extends Json<T> = any>(key: string): Promise<T | undefined>;
|
|
1102
|
+
has(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1103
|
+
has(key: string): Promise<boolean>;
|
|
1104
|
+
set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
|
|
1105
|
+
set<T extends Json<T>>(key: string, value: T): Promise<T>;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1086
1108
|
type HttpSourceEvent = {
|
|
1087
1109
|
url: string;
|
|
1088
1110
|
method: string;
|
|
@@ -1427,22 +1449,6 @@ declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
|
|
|
1427
1449
|
toJSON(): TriggerMetadata;
|
|
1428
1450
|
}
|
|
1429
1451
|
|
|
1430
|
-
declare class KeyValueStore {
|
|
1431
|
-
#private;
|
|
1432
|
-
private apiClient;
|
|
1433
|
-
private type;
|
|
1434
|
-
private namespace;
|
|
1435
|
-
constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
|
|
1436
|
-
delete(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1437
|
-
delete(key: string): Promise<boolean>;
|
|
1438
|
-
get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T | undefined>;
|
|
1439
|
-
get<T extends Json<T> = any>(key: string): Promise<T | undefined>;
|
|
1440
|
-
has(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1441
|
-
has(key: string): Promise<boolean>;
|
|
1442
|
-
set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
|
|
1443
|
-
set<T extends Json<T>>(key: string, value: T): Promise<T>;
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
1452
|
type WebhookCRUDContext<TParams extends any, TConfig extends Record<string, string[]>> = {
|
|
1447
1453
|
active: boolean;
|
|
1448
1454
|
params: TParams;
|
|
@@ -1853,6 +1859,10 @@ declare class TriggerClient {
|
|
|
1853
1859
|
invokeJob(jobId: string, payload: any, options?: InvokeOptions): Promise<{
|
|
1854
1860
|
id: string;
|
|
1855
1861
|
}>;
|
|
1862
|
+
cancelRunsForJob(jobId: string): Promise<{
|
|
1863
|
+
cancelledRunIds: string[];
|
|
1864
|
+
failedToCancelRunIds: string[];
|
|
1865
|
+
}>;
|
|
1856
1866
|
createEphemeralEventDispatcher(payload: EphemeralEventDispatcherRequestBody): Promise<{
|
|
1857
1867
|
id: string;
|
|
1858
1868
|
}>;
|
|
@@ -2380,7 +2390,7 @@ declare class Job<TTrigger extends Trigger<EventSpecification<any>>, TIntegratio
|
|
|
2380
2390
|
/**
|
|
2381
2391
|
* Attaches the job to a client. This is called automatically when you define a job using `client.defineJob()`.
|
|
2382
2392
|
*/
|
|
2383
|
-
attachToClient(client: TriggerClient):
|
|
2393
|
+
attachToClient(client: TriggerClient): this;
|
|
2384
2394
|
get id(): string;
|
|
2385
2395
|
get enabled(): boolean;
|
|
2386
2396
|
get name(): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as _trigger_dev_core from '@trigger.dev/core';
|
|
2
|
-
import { AsyncMap, KeyValueStoreResponseBody, RunTaskBodyInput, CompleteTaskBodyV2Input, FailTaskBodyInput, SendEvent, SendEventOptions, StatusUpdate, UpdateTriggerSourceBodyV2, TriggerSource, UpdateWebhookBody, RegisterTriggerBodyV2, RegisterSourceEventV2, ScheduleMetadata, GetRunOptionsWithTaskDetails, GetRunsOptions, InvokeOptions, EphemeralEventDispatcherRequestBody,
|
|
3
|
-
export { ConnectionAuth, DisplayProperty, EventFilter,
|
|
2
|
+
import { AsyncMap, KeyValueStoreResponseBody, RunTaskBodyInput, CompleteTaskBodyV2Input, FailTaskBodyInput, SendEvent, SendEventOptions, StatusUpdate, UpdateTriggerSourceBodyV2, TriggerSource, UpdateWebhookBody, RegisterTriggerBodyV2, RegisterSourceEventV2, ScheduleMetadata, GetRunOptionsWithTaskDetails, GetRunsOptions, InvokeOptions, EphemeralEventDispatcherRequestBody, RuntimeEnvironmentType, DisplayProperty, TriggerMetadata, EventFilter, SuccessfulRunNotification, FailedRunNotification, HttpEndpointMetadata, RequestFilter, Prettify, HandleTriggerSource, RegisterTriggerSource, SerializableJson, ConnectionAuth, NormalizedResponse, HttpSourceResponseMetadata, IntervalOptions, CronOptions, ScheduledPayload, RegisterWebhookSource, DeserializedJson, ServerTask, CachedTask, InitialStatusUpdate, FetchRequestInit, FetchRetryOptions, FetchTimeoutOptions, FetchPollOperation, RunTaskOptions, IntegrationMetadata, IntegrationConfig, JobMetadata, RunNotification, MissingConnectionNotificationPayload, MissingConnectionResolvedNotificationPayload, ErrorWithStack, ApiEventLog, RedactString } from '@trigger.dev/core';
|
|
3
|
+
export { ConnectionAuth, DisplayProperty, EventFilter, NormalizedRequest, OverridableRunTaskOptions, Prettify, RedactString, RegisteredOptionsDiff, RunTaskOptions, SourceEventOption } from '@trigger.dev/core';
|
|
4
|
+
import { LogLevel, Logger } from '@trigger.dev/core-backend';
|
|
5
|
+
export { Logger } from '@trigger.dev/core-backend';
|
|
4
6
|
import * as zod from 'zod';
|
|
5
7
|
import { z, ZodType, TypeOf } from 'zod';
|
|
6
8
|
import { Buffer } from 'buffer';
|
|
@@ -726,6 +728,10 @@ declare class ApiClient {
|
|
|
726
728
|
invokeJob(jobId: string, payload: any, options?: InvokeOptions): Promise<{
|
|
727
729
|
id: string;
|
|
728
730
|
}>;
|
|
731
|
+
cancelRunsForJob(jobId: string): Promise<{
|
|
732
|
+
cancelledRunIds: string[];
|
|
733
|
+
failedToCancelRunIds: string[];
|
|
734
|
+
}>;
|
|
729
735
|
createEphemeralEventDispatcher(payload: EphemeralEventDispatcherRequestBody): Promise<{
|
|
730
736
|
id: string;
|
|
731
737
|
}>;
|
|
@@ -893,7 +899,7 @@ type PreprocessResults = {
|
|
|
893
899
|
properties: DisplayProperty[];
|
|
894
900
|
};
|
|
895
901
|
type TriggerEventType<TTrigger extends Trigger<any>> = TTrigger extends Trigger<infer TEventSpec> ? ReturnType<TEventSpec["parsePayload"]> : never;
|
|
896
|
-
type TriggerInvokeType<TTrigger extends Trigger<any>> = TTrigger extends Trigger<
|
|
902
|
+
type TriggerInvokeType<TTrigger extends Trigger<any>> = TTrigger extends Trigger<EventSpecification<any, infer TInvoke>> ? TInvoke : any;
|
|
897
903
|
type VerifyResult = {
|
|
898
904
|
success: true;
|
|
899
905
|
} | {
|
|
@@ -1083,6 +1089,22 @@ type EndpointOptions = {
|
|
|
1083
1089
|
verify: VerifyCallback;
|
|
1084
1090
|
};
|
|
1085
1091
|
|
|
1092
|
+
declare class KeyValueStore {
|
|
1093
|
+
#private;
|
|
1094
|
+
private apiClient;
|
|
1095
|
+
private type;
|
|
1096
|
+
private namespace;
|
|
1097
|
+
constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
|
|
1098
|
+
delete(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1099
|
+
delete(key: string): Promise<boolean>;
|
|
1100
|
+
get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T | undefined>;
|
|
1101
|
+
get<T extends Json<T> = any>(key: string): Promise<T | undefined>;
|
|
1102
|
+
has(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1103
|
+
has(key: string): Promise<boolean>;
|
|
1104
|
+
set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
|
|
1105
|
+
set<T extends Json<T>>(key: string, value: T): Promise<T>;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1086
1108
|
type HttpSourceEvent = {
|
|
1087
1109
|
url: string;
|
|
1088
1110
|
method: string;
|
|
@@ -1427,22 +1449,6 @@ declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
|
|
|
1427
1449
|
toJSON(): TriggerMetadata;
|
|
1428
1450
|
}
|
|
1429
1451
|
|
|
1430
|
-
declare class KeyValueStore {
|
|
1431
|
-
#private;
|
|
1432
|
-
private apiClient;
|
|
1433
|
-
private type;
|
|
1434
|
-
private namespace;
|
|
1435
|
-
constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
|
|
1436
|
-
delete(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1437
|
-
delete(key: string): Promise<boolean>;
|
|
1438
|
-
get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T | undefined>;
|
|
1439
|
-
get<T extends Json<T> = any>(key: string): Promise<T | undefined>;
|
|
1440
|
-
has(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1441
|
-
has(key: string): Promise<boolean>;
|
|
1442
|
-
set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
|
|
1443
|
-
set<T extends Json<T>>(key: string, value: T): Promise<T>;
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
1452
|
type WebhookCRUDContext<TParams extends any, TConfig extends Record<string, string[]>> = {
|
|
1447
1453
|
active: boolean;
|
|
1448
1454
|
params: TParams;
|
|
@@ -1853,6 +1859,10 @@ declare class TriggerClient {
|
|
|
1853
1859
|
invokeJob(jobId: string, payload: any, options?: InvokeOptions): Promise<{
|
|
1854
1860
|
id: string;
|
|
1855
1861
|
}>;
|
|
1862
|
+
cancelRunsForJob(jobId: string): Promise<{
|
|
1863
|
+
cancelledRunIds: string[];
|
|
1864
|
+
failedToCancelRunIds: string[];
|
|
1865
|
+
}>;
|
|
1856
1866
|
createEphemeralEventDispatcher(payload: EphemeralEventDispatcherRequestBody): Promise<{
|
|
1857
1867
|
id: string;
|
|
1858
1868
|
}>;
|
|
@@ -2380,7 +2390,7 @@ declare class Job<TTrigger extends Trigger<EventSpecification<any>>, TIntegratio
|
|
|
2380
2390
|
/**
|
|
2381
2391
|
* Attaches the job to a client. This is called automatically when you define a job using `client.defineJob()`.
|
|
2382
2392
|
*/
|
|
2383
|
-
attachToClient(client: TriggerClient):
|
|
2393
|
+
attachToClient(client: TriggerClient): this;
|
|
2384
2394
|
get id(): string;
|
|
2385
2395
|
get enabled(): boolean;
|
|
2386
2396
|
get name(): string;
|
package/dist/index.js
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
var node_async_hooks = require('node:async_hooks');
|
|
4
4
|
var core = require('@trigger.dev/core');
|
|
5
|
+
var coreBackend = require('@trigger.dev/core-backend');
|
|
6
|
+
var EventEmitter = require('node:events');
|
|
5
7
|
var node_process = require('node:process');
|
|
6
8
|
var zod = require('zod');
|
|
7
|
-
var coreBackend = require('@trigger.dev/core-backend');
|
|
8
9
|
var crypto = require('node:crypto');
|
|
9
10
|
var node_buffer = require('node:buffer');
|
|
10
11
|
var cronstrue = require('cronstrue');
|
|
11
|
-
var EventEmitter = require('node:events');
|
|
12
12
|
|
|
13
13
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
|
|
15
|
+
var EventEmitter__default = /*#__PURE__*/_interopDefault(EventEmitter);
|
|
15
16
|
var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
16
17
|
var cronstrue__default = /*#__PURE__*/_interopDefault(cronstrue);
|
|
17
|
-
var EventEmitter__default = /*#__PURE__*/_interopDefault(EventEmitter);
|
|
18
18
|
|
|
19
19
|
var __defProp = Object.defineProperty;
|
|
20
20
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -84,8 +84,8 @@ var _Job = class _Job {
|
|
|
84
84
|
* Attaches the job to a client. This is called automatically when you define a job using `client.defineJob()`.
|
|
85
85
|
*/
|
|
86
86
|
attachToClient(client) {
|
|
87
|
-
this
|
|
88
|
-
|
|
87
|
+
client.attach(this);
|
|
88
|
+
return this;
|
|
89
89
|
}
|
|
90
90
|
get id() {
|
|
91
91
|
return slugifyId(this.options.id);
|
|
@@ -178,7 +178,7 @@ var _Job = class _Job {
|
|
|
178
178
|
if (runStore) {
|
|
179
179
|
throw new Error("Cannot invoke a job from within a run without a cacheKey.");
|
|
180
180
|
}
|
|
181
|
-
return await triggerClient.invokeJob(this.id, param1,
|
|
181
|
+
return await triggerClient.invokeJob(this.id, param1, param2);
|
|
182
182
|
}
|
|
183
183
|
async invokeAndWaitForCompletion(cacheKey, payload, timeoutInSeconds = 60 * 60, options = {}) {
|
|
184
184
|
const triggerClient = this.client;
|
|
@@ -265,6 +265,9 @@ validate_fn = /* @__PURE__ */ __name(function() {
|
|
|
265
265
|
__name(_Job, "Job");
|
|
266
266
|
var Job = _Job;
|
|
267
267
|
|
|
268
|
+
// package.json
|
|
269
|
+
var version = "0.0.0-prerelease-20240112134133";
|
|
270
|
+
|
|
268
271
|
// src/errors.ts
|
|
269
272
|
var _ResumeWithTaskError = class _ResumeWithTaskError {
|
|
270
273
|
constructor(task) {
|
|
@@ -592,7 +595,7 @@ var _IO = class _IO {
|
|
|
592
595
|
this._jobId = options.jobId;
|
|
593
596
|
this._apiClient = options.apiClient;
|
|
594
597
|
this._triggerClient = options.client;
|
|
595
|
-
this._logger = options.logger ?? new
|
|
598
|
+
this._logger = options.logger ?? new coreBackend.Logger("trigger.dev", options.logLevel);
|
|
596
599
|
this._cachedTasks = /* @__PURE__ */ new Map();
|
|
597
600
|
this._jobLogger = options.jobLogger;
|
|
598
601
|
this._jobLogLevel = options.jobLogLevel;
|
|
@@ -640,7 +643,7 @@ var _IO = class _IO {
|
|
|
640
643
|
get logger() {
|
|
641
644
|
return new IOLogger(async (level, message, data) => {
|
|
642
645
|
let logLevel = "info";
|
|
643
|
-
if (
|
|
646
|
+
if (coreBackend.Logger.satisfiesLogLevel(logLevel, this._jobLogLevel)) {
|
|
644
647
|
await this.runTask([
|
|
645
648
|
message,
|
|
646
649
|
level
|
|
@@ -1840,7 +1843,7 @@ var _ApiClient = class _ApiClient {
|
|
|
1840
1843
|
__privateAdd(this, _storeClient, void 0);
|
|
1841
1844
|
__privateSet(this, _options, options);
|
|
1842
1845
|
__privateSet(this, _apiUrl, __privateGet(this, _options).apiUrl ?? node_process.env.TRIGGER_API_URL ?? "https://api.trigger.dev");
|
|
1843
|
-
__privateSet(this, _logger, new
|
|
1846
|
+
__privateSet(this, _logger, new coreBackend.Logger("trigger.dev", __privateGet(this, _options).logLevel));
|
|
1844
1847
|
__privateSet(this, _storeClient, new KeyValueStoreClient(__privateMethod(this, _queryKeyValueStore, queryKeyValueStore_fn).bind(this)));
|
|
1845
1848
|
}
|
|
1846
1849
|
async registerEndpoint(options) {
|
|
@@ -2181,6 +2184,19 @@ var _ApiClient = class _ApiClient {
|
|
|
2181
2184
|
body: JSON.stringify(body)
|
|
2182
2185
|
});
|
|
2183
2186
|
}
|
|
2187
|
+
async cancelRunsForJob(jobId) {
|
|
2188
|
+
const apiKey = await __privateMethod(this, _apiKey, apiKey_fn).call(this);
|
|
2189
|
+
__privateGet(this, _logger).debug("Cancelling Runs for Job", {
|
|
2190
|
+
jobId
|
|
2191
|
+
});
|
|
2192
|
+
return await zodfetch(core.CancelRunsForJobSchema, `${__privateGet(this, _apiUrl)}/api/v1/jobs/${jobId}/cancel-runs`, {
|
|
2193
|
+
method: "POST",
|
|
2194
|
+
headers: {
|
|
2195
|
+
"Content-Type": "application/json",
|
|
2196
|
+
Authorization: `Bearer ${apiKey}`
|
|
2197
|
+
}
|
|
2198
|
+
});
|
|
2199
|
+
}
|
|
2184
2200
|
async createEphemeralEventDispatcher(payload) {
|
|
2185
2201
|
const apiKey = await __privateMethod(this, _apiKey, apiKey_fn).call(this);
|
|
2186
2202
|
__privateGet(this, _logger).debug("Creating ephemeral event dispatcher", {
|
|
@@ -2386,6 +2402,21 @@ function exponentialBackoff(retryCount, exponential, minDelay, maxDelay, jitter)
|
|
|
2386
2402
|
}
|
|
2387
2403
|
__name(exponentialBackoff, "exponentialBackoff");
|
|
2388
2404
|
|
|
2405
|
+
// src/concurrencyLimit.ts
|
|
2406
|
+
var _ConcurrencyLimit = class _ConcurrencyLimit {
|
|
2407
|
+
constructor(options) {
|
|
2408
|
+
this.options = options;
|
|
2409
|
+
}
|
|
2410
|
+
get id() {
|
|
2411
|
+
return this.options.id;
|
|
2412
|
+
}
|
|
2413
|
+
get limit() {
|
|
2414
|
+
return this.options.limit;
|
|
2415
|
+
}
|
|
2416
|
+
};
|
|
2417
|
+
__name(_ConcurrencyLimit, "ConcurrencyLimit");
|
|
2418
|
+
var ConcurrencyLimit = _ConcurrencyLimit;
|
|
2419
|
+
|
|
2389
2420
|
// src/utils/formatSchemaErrors.ts
|
|
2390
2421
|
function formatSchemaErrors(errors) {
|
|
2391
2422
|
return errors.map((error) => {
|
|
@@ -2929,24 +2960,6 @@ var _DynamicSchedule = class _DynamicSchedule {
|
|
|
2929
2960
|
__name(_DynamicSchedule, "DynamicSchedule");
|
|
2930
2961
|
var DynamicSchedule = _DynamicSchedule;
|
|
2931
2962
|
|
|
2932
|
-
// package.json
|
|
2933
|
-
var version = "0.0.0-prerelease-20231206103411";
|
|
2934
|
-
|
|
2935
|
-
// src/concurrencyLimit.ts
|
|
2936
|
-
var _ConcurrencyLimit = class _ConcurrencyLimit {
|
|
2937
|
-
constructor(options) {
|
|
2938
|
-
this.options = options;
|
|
2939
|
-
}
|
|
2940
|
-
get id() {
|
|
2941
|
-
return this.options.id;
|
|
2942
|
-
}
|
|
2943
|
-
get limit() {
|
|
2944
|
-
return this.options.limit;
|
|
2945
|
-
}
|
|
2946
|
-
};
|
|
2947
|
-
__name(_ConcurrencyLimit, "ConcurrencyLimit");
|
|
2948
|
-
var ConcurrencyLimit = _ConcurrencyLimit;
|
|
2949
|
-
|
|
2950
2963
|
// src/triggerClient.ts
|
|
2951
2964
|
var registerWebhookEvent = /* @__PURE__ */ __name((key) => ({
|
|
2952
2965
|
name: `${core.REGISTER_WEBHOOK}.${key}`,
|
|
@@ -3003,7 +3016,7 @@ var _TriggerClient = class _TriggerClient {
|
|
|
3003
3016
|
this.id = options.id;
|
|
3004
3017
|
__privateSet(this, _options4, options);
|
|
3005
3018
|
__privateSet(this, _client2, new ApiClient(__privateGet(this, _options4)));
|
|
3006
|
-
__privateSet(this, _internalLogger, new
|
|
3019
|
+
__privateSet(this, _internalLogger, new coreBackend.Logger("trigger.dev", __privateGet(this, _options4).verbose ? "debug" : "log", [
|
|
3007
3020
|
"output",
|
|
3008
3021
|
"noopTasksSet"
|
|
3009
3022
|
]));
|
|
@@ -3427,7 +3440,8 @@ var _TriggerClient = class _TriggerClient {
|
|
|
3427
3440
|
}
|
|
3428
3441
|
attach(job) {
|
|
3429
3442
|
__privateGet(this, _registeredJobs)[job.id] = job;
|
|
3430
|
-
job.
|
|
3443
|
+
job.trigger.attachToJob(this, job);
|
|
3444
|
+
job.client = this;
|
|
3431
3445
|
}
|
|
3432
3446
|
attachDynamicTrigger(trigger) {
|
|
3433
3447
|
__privateGet(this, _registeredDynamicTriggers)[trigger.id] = trigger;
|
|
@@ -3683,6 +3697,9 @@ var _TriggerClient = class _TriggerClient {
|
|
|
3683
3697
|
async invokeJob(jobId, payload, options) {
|
|
3684
3698
|
return __privateGet(this, _client2).invokeJob(jobId, payload, options);
|
|
3685
3699
|
}
|
|
3700
|
+
async cancelRunsForJob(jobId) {
|
|
3701
|
+
return __privateGet(this, _client2).cancelRunsForJob(jobId);
|
|
3702
|
+
}
|
|
3686
3703
|
async createEphemeralEventDispatcher(payload) {
|
|
3687
3704
|
return __privateGet(this, _client2).createEphemeralEventDispatcher(payload);
|
|
3688
3705
|
}
|
|
@@ -3751,7 +3768,7 @@ executeJob_fn = /* @__PURE__ */ __name(async function(body1, job1, timeOrigin, t
|
|
|
3751
3768
|
client: this,
|
|
3752
3769
|
context,
|
|
3753
3770
|
jobLogLevel: job1.logLevel ?? __privateGet(this, _options4).logLevel ?? "info",
|
|
3754
|
-
jobLogger: __privateGet(this, _options4).ioLogLocalEnabled ? new
|
|
3771
|
+
jobLogger: __privateGet(this, _options4).ioLogLocalEnabled ? new coreBackend.Logger(job1.id, job1.logLevel ?? __privateGet(this, _options4).logLevel ?? "info") : void 0,
|
|
3755
3772
|
serverVersion: triggerVersion,
|
|
3756
3773
|
timeOrigin,
|
|
3757
3774
|
executionTimeout: body1.runChunkExecutionLimit
|