@trigger.dev/sdk 2.3.0 → 2.3.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.d.mts +20 -18
- package/dist/index.d.ts +20 -18
- package/dist/index.js +26 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
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';
|
|
@@ -1083,6 +1085,22 @@ type EndpointOptions = {
|
|
|
1083
1085
|
verify: VerifyCallback;
|
|
1084
1086
|
};
|
|
1085
1087
|
|
|
1088
|
+
declare class KeyValueStore {
|
|
1089
|
+
#private;
|
|
1090
|
+
private apiClient;
|
|
1091
|
+
private type;
|
|
1092
|
+
private namespace;
|
|
1093
|
+
constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
|
|
1094
|
+
delete(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1095
|
+
delete(key: string): Promise<boolean>;
|
|
1096
|
+
get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T | undefined>;
|
|
1097
|
+
get<T extends Json<T> = any>(key: string): Promise<T | undefined>;
|
|
1098
|
+
has(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1099
|
+
has(key: string): Promise<boolean>;
|
|
1100
|
+
set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
|
|
1101
|
+
set<T extends Json<T>>(key: string, value: T): Promise<T>;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1086
1104
|
type HttpSourceEvent = {
|
|
1087
1105
|
url: string;
|
|
1088
1106
|
method: string;
|
|
@@ -1427,22 +1445,6 @@ declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
|
|
|
1427
1445
|
toJSON(): TriggerMetadata;
|
|
1428
1446
|
}
|
|
1429
1447
|
|
|
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
1448
|
type WebhookCRUDContext<TParams extends any, TConfig extends Record<string, string[]>> = {
|
|
1447
1449
|
active: boolean;
|
|
1448
1450
|
params: TParams;
|
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';
|
|
@@ -1083,6 +1085,22 @@ type EndpointOptions = {
|
|
|
1083
1085
|
verify: VerifyCallback;
|
|
1084
1086
|
};
|
|
1085
1087
|
|
|
1088
|
+
declare class KeyValueStore {
|
|
1089
|
+
#private;
|
|
1090
|
+
private apiClient;
|
|
1091
|
+
private type;
|
|
1092
|
+
private namespace;
|
|
1093
|
+
constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
|
|
1094
|
+
delete(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1095
|
+
delete(key: string): Promise<boolean>;
|
|
1096
|
+
get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T | undefined>;
|
|
1097
|
+
get<T extends Json<T> = any>(key: string): Promise<T | undefined>;
|
|
1098
|
+
has(cacheKey: string | any[], key: string): Promise<boolean>;
|
|
1099
|
+
has(key: string): Promise<boolean>;
|
|
1100
|
+
set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
|
|
1101
|
+
set<T extends Json<T>>(key: string, value: T): Promise<T>;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1086
1104
|
type HttpSourceEvent = {
|
|
1087
1105
|
url: string;
|
|
1088
1106
|
method: string;
|
|
@@ -1427,22 +1445,6 @@ declare class DynamicSchedule implements Trigger<ScheduledEventSpecification> {
|
|
|
1427
1445
|
toJSON(): TriggerMetadata;
|
|
1428
1446
|
}
|
|
1429
1447
|
|
|
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
1448
|
type WebhookCRUDContext<TParams extends any, TConfig extends Record<string, string[]>> = {
|
|
1447
1449
|
active: boolean;
|
|
1448
1450
|
params: TParams;
|
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;
|
|
@@ -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 = "2.3.1";
|
|
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) {
|
|
@@ -2386,6 +2389,21 @@ function exponentialBackoff(retryCount, exponential, minDelay, maxDelay, jitter)
|
|
|
2386
2389
|
}
|
|
2387
2390
|
__name(exponentialBackoff, "exponentialBackoff");
|
|
2388
2391
|
|
|
2392
|
+
// src/concurrencyLimit.ts
|
|
2393
|
+
var _ConcurrencyLimit = class _ConcurrencyLimit {
|
|
2394
|
+
constructor(options) {
|
|
2395
|
+
this.options = options;
|
|
2396
|
+
}
|
|
2397
|
+
get id() {
|
|
2398
|
+
return this.options.id;
|
|
2399
|
+
}
|
|
2400
|
+
get limit() {
|
|
2401
|
+
return this.options.limit;
|
|
2402
|
+
}
|
|
2403
|
+
};
|
|
2404
|
+
__name(_ConcurrencyLimit, "ConcurrencyLimit");
|
|
2405
|
+
var ConcurrencyLimit = _ConcurrencyLimit;
|
|
2406
|
+
|
|
2389
2407
|
// src/utils/formatSchemaErrors.ts
|
|
2390
2408
|
function formatSchemaErrors(errors) {
|
|
2391
2409
|
return errors.map((error) => {
|
|
@@ -2929,24 +2947,6 @@ var _DynamicSchedule = class _DynamicSchedule {
|
|
|
2929
2947
|
__name(_DynamicSchedule, "DynamicSchedule");
|
|
2930
2948
|
var DynamicSchedule = _DynamicSchedule;
|
|
2931
2949
|
|
|
2932
|
-
// package.json
|
|
2933
|
-
var version = "2.3.0";
|
|
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
2950
|
// src/triggerClient.ts
|
|
2951
2951
|
var registerWebhookEvent = /* @__PURE__ */ __name((key) => ({
|
|
2952
2952
|
name: `${core.REGISTER_WEBHOOK}.${key}`,
|
|
@@ -3003,7 +3003,7 @@ var _TriggerClient = class _TriggerClient {
|
|
|
3003
3003
|
this.id = options.id;
|
|
3004
3004
|
__privateSet(this, _options4, options);
|
|
3005
3005
|
__privateSet(this, _client2, new ApiClient(__privateGet(this, _options4)));
|
|
3006
|
-
__privateSet(this, _internalLogger, new
|
|
3006
|
+
__privateSet(this, _internalLogger, new coreBackend.Logger("trigger.dev", __privateGet(this, _options4).verbose ? "debug" : "log", [
|
|
3007
3007
|
"output",
|
|
3008
3008
|
"noopTasksSet"
|
|
3009
3009
|
]));
|
|
@@ -3751,7 +3751,7 @@ executeJob_fn = /* @__PURE__ */ __name(async function(body1, job1, timeOrigin, t
|
|
|
3751
3751
|
client: this,
|
|
3752
3752
|
context,
|
|
3753
3753
|
jobLogLevel: job1.logLevel ?? __privateGet(this, _options4).logLevel ?? "info",
|
|
3754
|
-
jobLogger: __privateGet(this, _options4).ioLogLocalEnabled ? new
|
|
3754
|
+
jobLogger: __privateGet(this, _options4).ioLogLocalEnabled ? new coreBackend.Logger(job1.id, job1.logLevel ?? __privateGet(this, _options4).logLevel ?? "info") : void 0,
|
|
3755
3755
|
serverVersion: triggerVersion,
|
|
3756
3756
|
timeOrigin,
|
|
3757
3757
|
executionTimeout: body1.runChunkExecutionLimit
|