@trigger.dev/sdk 0.0.0-cross-runtime-20231204083620 → 0.0.0-cross-runtime-20231204115010
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.js +147 -254
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -118
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
import { currentDate, REGISTER_SOURCE_EVENT_V2, RegisterSourceEventSchemaV2, Logger, 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';
|
|
3
|
+
import { env } from 'node:process';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { BloomFilter } from '@trigger.dev/core-backend';
|
|
6
|
+
import crypto, { webcrypto, createHash } from 'node:crypto';
|
|
7
|
+
import { Buffer } from 'node:buffer';
|
|
8
|
+
import cronstrue from 'cronstrue';
|
|
9
|
+
import EventEmitter from 'node:events';
|
|
10
|
+
|
|
1
11
|
var __defProp = Object.defineProperty;
|
|
2
12
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
13
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -35,9 +45,6 @@ function slugifyId(input) {
|
|
|
35
45
|
return removeNonUrlSafeChars;
|
|
36
46
|
}
|
|
37
47
|
__name(slugifyId, "slugifyId");
|
|
38
|
-
|
|
39
|
-
// src/utils/typedAsyncLocalStorage.ts
|
|
40
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
41
48
|
var _TypedAsyncLocalStorage = class _TypedAsyncLocalStorage {
|
|
42
49
|
constructor() {
|
|
43
50
|
this.storage = new AsyncLocalStorage();
|
|
@@ -237,21 +244,6 @@ validate_fn = /* @__PURE__ */ __name(function() {
|
|
|
237
244
|
__name(_Job, "Job");
|
|
238
245
|
var Job = _Job;
|
|
239
246
|
|
|
240
|
-
// src/triggerClient.ts
|
|
241
|
-
import { API_VERSIONS as API_VERSIONS3, DELIVER_WEBHOOK_REQUEST, ErrorWithStackSchema as ErrorWithStackSchema2, HttpEndpointRequestHeadersSchema, HttpSourceRequestHeadersSchema, InitializeTriggerBodySchema, Logger as Logger3, PreprocessRunBodySchema, REGISTER_SOURCE_EVENT_V2, REGISTER_WEBHOOK, RegisterSourceEventSchemaV2 as RegisterSourceEventSchemaV22, RegisterWebhookPayloadSchema, RequestWithRawBodySchema as RequestWithRawBodySchema2, RunJobBodySchema, WebhookSourceRequestHeadersSchema } from "@trigger.dev/core";
|
|
242
|
-
import { env as env2 } from "node:process";
|
|
243
|
-
|
|
244
|
-
// src/apiClient.ts
|
|
245
|
-
import { API_VERSIONS as API_VERSIONS2, ApiEventLogSchema, CancelRunsForEventSchema, ConnectionAuthSchema, EphemeralEventDispatcherResponseBodySchema, GetEventSchema, GetRunSchema, GetRunStatusesSchema, GetRunsSchema, InvokeJobResponseSchema, JobRunStatusRecordSchema, KeyValueStoreResponseBodySchema, Logger as Logger2, RegisterScheduleResponseBodySchema, RegisterSourceEventSchemaV2, RunTaskResponseWithCachedTasksBodySchema, ServerTaskSchema, TriggerSourceSchema, assertExhaustive, urlWithSearchParams } from "@trigger.dev/core";
|
|
246
|
-
import { env } from "node:process";
|
|
247
|
-
import { z as z3 } from "zod";
|
|
248
|
-
|
|
249
|
-
// src/io.ts
|
|
250
|
-
import { API_VERSIONS, ErrorWithStackSchema, Logger, supportsFeature } from "@trigger.dev/core";
|
|
251
|
-
import { BloomFilter } from "@trigger.dev/core-backend";
|
|
252
|
-
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
253
|
-
import { webcrypto } from "node:crypto";
|
|
254
|
-
|
|
255
247
|
// src/errors.ts
|
|
256
248
|
var _ResumeWithTaskError = class _ResumeWithTaskError {
|
|
257
249
|
constructor(task) {
|
|
@@ -329,9 +321,6 @@ var _ErrorWithTask = class _ErrorWithTask extends Error {
|
|
|
329
321
|
};
|
|
330
322
|
__name(_ErrorWithTask, "ErrorWithTask");
|
|
331
323
|
var ErrorWithTask = _ErrorWithTask;
|
|
332
|
-
|
|
333
|
-
// src/retry.ts
|
|
334
|
-
import { calculateRetryAt } from "@trigger.dev/core";
|
|
335
324
|
var retry = {
|
|
336
325
|
standardBackoff: {
|
|
337
326
|
limit: 8,
|
|
@@ -383,9 +372,6 @@ var _TriggerStatus = class _TriggerStatus {
|
|
|
383
372
|
};
|
|
384
373
|
__name(_TriggerStatus, "TriggerStatus");
|
|
385
374
|
var TriggerStatus = _TriggerStatus;
|
|
386
|
-
|
|
387
|
-
// src/types.ts
|
|
388
|
-
import { z } from "zod";
|
|
389
375
|
var EventSpecificationExampleSchema = z.object({
|
|
390
376
|
id: z.string(),
|
|
391
377
|
name: z.string(),
|
|
@@ -405,9 +391,6 @@ function waitForEventSchema(schema) {
|
|
|
405
391
|
}
|
|
406
392
|
__name(waitForEventSchema, "waitForEventSchema");
|
|
407
393
|
|
|
408
|
-
// src/io.ts
|
|
409
|
-
import { z as z2 } from "zod";
|
|
410
|
-
|
|
411
394
|
// src/store/keyValueStore.ts
|
|
412
395
|
var _namespacedKey, namespacedKey_fn, _sharedProperties, sharedProperties_fn;
|
|
413
396
|
var _KeyValueStore = class _KeyValueStore {
|
|
@@ -560,9 +543,6 @@ sharedProperties_fn = /* @__PURE__ */ __name(function(key1) {
|
|
|
560
543
|
}, "#sharedProperties");
|
|
561
544
|
__name(_KeyValueStore, "KeyValueStore");
|
|
562
545
|
var KeyValueStore = _KeyValueStore;
|
|
563
|
-
|
|
564
|
-
// src/io.ts
|
|
565
|
-
import { Buffer as Buffer2 } from "node:buffer";
|
|
566
546
|
var _JSONOutputSerializer = class _JSONOutputSerializer {
|
|
567
547
|
serialize(value) {
|
|
568
548
|
return JSON.stringify(value);
|
|
@@ -615,7 +595,7 @@ var _IO = class _IO {
|
|
|
615
595
|
});
|
|
616
596
|
this._stats.initialCachedTasks = options.cachedTasks.length;
|
|
617
597
|
}
|
|
618
|
-
this._taskStorage = new
|
|
598
|
+
this._taskStorage = new AsyncLocalStorage();
|
|
619
599
|
this._context = options.context;
|
|
620
600
|
this._yieldedExecutions = options.yieldedExecutions ?? [];
|
|
621
601
|
if (options.noopTasksSet) {
|
|
@@ -819,7 +799,7 @@ var _IO = class _IO {
|
|
|
819
799
|
] : []
|
|
820
800
|
],
|
|
821
801
|
parseOutput: (output) => {
|
|
822
|
-
return waitForEventSchema(event.schema ??
|
|
802
|
+
return waitForEventSchema(event.schema ?? z.any()).parse(output);
|
|
823
803
|
}
|
|
824
804
|
});
|
|
825
805
|
}
|
|
@@ -1682,8 +1662,8 @@ async function generateIdempotencyKey(keyMaterial) {
|
|
|
1682
1662
|
return stableStringify(key2);
|
|
1683
1663
|
});
|
|
1684
1664
|
const key = keys.join(":");
|
|
1685
|
-
const hash = await webcrypto.subtle.digest("SHA-256",
|
|
1686
|
-
return
|
|
1665
|
+
const hash = await webcrypto.subtle.digest("SHA-256", Buffer.from(key));
|
|
1666
|
+
return Buffer.from(hash).toString("hex");
|
|
1687
1667
|
}
|
|
1688
1668
|
__name(generateIdempotencyKey, "generateIdempotencyKey");
|
|
1689
1669
|
function stableStringify(obj) {
|
|
@@ -1839,7 +1819,7 @@ var _ApiClient = class _ApiClient {
|
|
|
1839
1819
|
__privateAdd(this, _storeClient, void 0);
|
|
1840
1820
|
__privateSet(this, _options, options);
|
|
1841
1821
|
__privateSet(this, _apiUrl, __privateGet(this, _options).apiUrl ?? env.TRIGGER_API_URL ?? "https://api.trigger.dev");
|
|
1842
|
-
__privateSet(this, _logger, new
|
|
1822
|
+
__privateSet(this, _logger, new Logger("trigger.dev", __privateGet(this, _options).logLevel));
|
|
1843
1823
|
__privateSet(this, _storeClient, new KeyValueStoreClient(__privateMethod(this, _queryKeyValueStore, queryKeyValueStore_fn).bind(this)));
|
|
1844
1824
|
}
|
|
1845
1825
|
async registerEndpoint(options) {
|
|
@@ -1874,7 +1854,7 @@ var _ApiClient = class _ApiClient {
|
|
|
1874
1854
|
task
|
|
1875
1855
|
});
|
|
1876
1856
|
return await zodfetchWithVersions({
|
|
1877
|
-
[
|
|
1857
|
+
[API_VERSIONS.LAZY_LOADED_CACHED_TASKS]: RunTaskResponseWithCachedTasksBodySchema
|
|
1878
1858
|
}, ServerTaskSchema, `${__privateGet(this, _apiUrl)}/api/v1/runs/${runId}/tasks`, {
|
|
1879
1859
|
method: "POST",
|
|
1880
1860
|
headers: {
|
|
@@ -1882,7 +1862,7 @@ var _ApiClient = class _ApiClient {
|
|
|
1882
1862
|
Authorization: `Bearer ${apiKey}`,
|
|
1883
1863
|
"Idempotency-Key": task.idempotencyKey,
|
|
1884
1864
|
"X-Cached-Tasks-Cursor": options.cachedTasksCursor ?? "",
|
|
1885
|
-
"Trigger-Version":
|
|
1865
|
+
"Trigger-Version": API_VERSIONS.LAZY_LOADED_CACHED_TASKS
|
|
1886
1866
|
},
|
|
1887
1867
|
body: JSON.stringify(task)
|
|
1888
1868
|
});
|
|
@@ -1897,7 +1877,7 @@ var _ApiClient = class _ApiClient {
|
|
|
1897
1877
|
headers: {
|
|
1898
1878
|
"Content-Type": "application/json",
|
|
1899
1879
|
Authorization: `Bearer ${apiKey}`,
|
|
1900
|
-
"Trigger-Version":
|
|
1880
|
+
"Trigger-Version": API_VERSIONS.SERIALIZED_TASK_OUTPUT
|
|
1901
1881
|
},
|
|
1902
1882
|
body: JSON.stringify(task)
|
|
1903
1883
|
});
|
|
@@ -2067,8 +2047,8 @@ var _ApiClient = class _ApiClient {
|
|
|
2067
2047
|
__privateGet(this, _logger).debug("unregistering schedule", {
|
|
2068
2048
|
id
|
|
2069
2049
|
});
|
|
2070
|
-
const response = await zodfetch(
|
|
2071
|
-
ok:
|
|
2050
|
+
const response = await zodfetch(z.object({
|
|
2051
|
+
ok: z.boolean()
|
|
2072
2052
|
}), `${__privateGet(this, _apiUrl)}/api/v1/${client}/schedules/${id}/registrations/${encodeURIComponent(key)}`, {
|
|
2073
2053
|
method: "DELETE",
|
|
2074
2054
|
headers: {
|
|
@@ -2385,9 +2365,6 @@ function exponentialBackoff(retryCount, exponential, minDelay, maxDelay, jitter)
|
|
|
2385
2365
|
}
|
|
2386
2366
|
__name(exponentialBackoff, "exponentialBackoff");
|
|
2387
2367
|
|
|
2388
|
-
// src/httpEndpoint.ts
|
|
2389
|
-
import { RequestWithRawBodySchema } from "@trigger.dev/core";
|
|
2390
|
-
|
|
2391
2368
|
// src/utils/formatSchemaErrors.ts
|
|
2392
2369
|
function formatSchemaErrors(errors) {
|
|
2393
2370
|
return errors.map((error) => {
|
|
@@ -2551,9 +2528,6 @@ function createIOWithIntegrations(io, auths, integrations) {
|
|
|
2551
2528
|
});
|
|
2552
2529
|
}
|
|
2553
2530
|
__name(createIOWithIntegrations, "createIOWithIntegrations");
|
|
2554
|
-
|
|
2555
|
-
// src/triggers/dynamic.ts
|
|
2556
|
-
import { deepMergeFilters } from "@trigger.dev/core";
|
|
2557
2531
|
var _client, _options2;
|
|
2558
2532
|
var _DynamicTrigger = class _DynamicTrigger {
|
|
2559
2533
|
/** `DynamicTrigger` allows you to define a trigger that can be configured dynamically at runtime.
|
|
@@ -2659,9 +2633,6 @@ _client = new WeakMap();
|
|
|
2659
2633
|
_options2 = new WeakMap();
|
|
2660
2634
|
__name(_DynamicTrigger, "DynamicTrigger");
|
|
2661
2635
|
var DynamicTrigger = _DynamicTrigger;
|
|
2662
|
-
|
|
2663
|
-
// src/triggers/eventTrigger.ts
|
|
2664
|
-
import { deepMergeFilters as deepMergeFilters2 } from "@trigger.dev/core";
|
|
2665
2636
|
var _options3;
|
|
2666
2637
|
var _EventTrigger = class _EventTrigger {
|
|
2667
2638
|
constructor(options) {
|
|
@@ -2675,7 +2646,7 @@ var _EventTrigger = class _EventTrigger {
|
|
|
2675
2646
|
rule: {
|
|
2676
2647
|
event: __privateGet(this, _options3).name ?? __privateGet(this, _options3).event.name,
|
|
2677
2648
|
source: __privateGet(this, _options3).source ?? "trigger.dev",
|
|
2678
|
-
payload:
|
|
2649
|
+
payload: deepMergeFilters(__privateGet(this, _options3).filter ?? {}, __privateGet(this, _options3).event.filter ?? {})
|
|
2679
2650
|
}
|
|
2680
2651
|
};
|
|
2681
2652
|
}
|
|
@@ -2726,10 +2697,6 @@ function eventTrigger(options) {
|
|
|
2726
2697
|
});
|
|
2727
2698
|
}
|
|
2728
2699
|
__name(eventTrigger, "eventTrigger");
|
|
2729
|
-
|
|
2730
|
-
// src/triggers/scheduled.ts
|
|
2731
|
-
import { ScheduledPayloadSchema, currentDate } from "@trigger.dev/core";
|
|
2732
|
-
import cronstrue from "cronstrue";
|
|
2733
2700
|
var examples = [
|
|
2734
2701
|
{
|
|
2735
2702
|
id: "now",
|
|
@@ -2941,11 +2908,8 @@ var _DynamicSchedule = class _DynamicSchedule {
|
|
|
2941
2908
|
__name(_DynamicSchedule, "DynamicSchedule");
|
|
2942
2909
|
var DynamicSchedule = _DynamicSchedule;
|
|
2943
2910
|
|
|
2944
|
-
// src/triggerClient.ts
|
|
2945
|
-
import EventEmitter from "node:events";
|
|
2946
|
-
|
|
2947
2911
|
// package.json
|
|
2948
|
-
var version = "0.0.0-cross-runtime-
|
|
2912
|
+
var version = "0.0.0-cross-runtime-20231204115010";
|
|
2949
2913
|
|
|
2950
2914
|
// src/concurrencyLimit.ts
|
|
2951
2915
|
var _ConcurrencyLimit = class _ConcurrencyLimit {
|
|
@@ -2975,7 +2939,7 @@ var registerSourceEvent = {
|
|
|
2975
2939
|
title: "Register Source",
|
|
2976
2940
|
source: "internal",
|
|
2977
2941
|
icon: "register-source",
|
|
2978
|
-
parsePayload:
|
|
2942
|
+
parsePayload: RegisterSourceEventSchemaV2.parse
|
|
2979
2943
|
};
|
|
2980
2944
|
var _options4, _registeredJobs, _registeredSources, _registeredWebhooks, _registeredHttpSourceHandlers, _registeredWebhookSourceHandlers, _registeredDynamicTriggers, _jobMetadataByDynamicTriggers, _registeredSchedules, _registeredHttpEndpoints, _authResolvers, _envStore, _eventEmitter, _client2, _internalLogger, _preprocessRun, preprocessRun_fn, _executeJob, executeJob_fn, _convertErrorToExecutionResponse, convertErrorToExecutionResponse_fn, _createRunContext, createRunContext_fn, _createPreprocessRunContext, createPreprocessRunContext_fn, _handleHttpSourceRequest, handleHttpSourceRequest_fn, _handleHttpEndpointRequestForResponse, handleHttpEndpointRequestForResponse_fn, _handleWebhookRequest, handleWebhookRequest_fn, _resolveConnections, resolveConnections_fn, _resolveConnection, resolveConnection_fn, _buildJobsIndex, buildJobsIndex_fn, _buildJobIndex, buildJobIndex_fn, _buildJobIntegrations, buildJobIntegrations_fn, _buildJobIntegration, buildJobIntegration_fn, _logIOStats, logIOStats_fn, _standardResponseHeaders, standardResponseHeaders_fn, _serializeRunMetadata, serializeRunMetadata_fn, _deliverSuccessfulRunNotification, deliverSuccessfulRunNotification_fn, _deliverFailedRunNotification, deliverFailedRunNotification_fn;
|
|
2981
2945
|
var _TriggerClient = class _TriggerClient {
|
|
@@ -3018,7 +2982,7 @@ var _TriggerClient = class _TriggerClient {
|
|
|
3018
2982
|
this.id = options.id;
|
|
3019
2983
|
__privateSet(this, _options4, options);
|
|
3020
2984
|
__privateSet(this, _client2, new ApiClient(__privateGet(this, _options4)));
|
|
3021
|
-
__privateSet(this, _internalLogger, new
|
|
2985
|
+
__privateSet(this, _internalLogger, new Logger("trigger.dev", __privateGet(this, _options4).verbose ? "debug" : "log", [
|
|
3022
2986
|
"output",
|
|
3023
2987
|
"noopTasksSet"
|
|
3024
2988
|
]));
|
|
@@ -3708,14 +3672,14 @@ var _TriggerClient = class _TriggerClient {
|
|
|
3708
3672
|
if (typeof apiKey !== "string") {
|
|
3709
3673
|
return "missing-header";
|
|
3710
3674
|
}
|
|
3711
|
-
const localApiKey = __privateGet(this, _options4).apiKey ??
|
|
3675
|
+
const localApiKey = __privateGet(this, _options4).apiKey ?? env.TRIGGER_API_KEY;
|
|
3712
3676
|
if (!localApiKey) {
|
|
3713
3677
|
return "missing-client";
|
|
3714
3678
|
}
|
|
3715
3679
|
return apiKey === localApiKey ? "authorized" : "unauthorized";
|
|
3716
3680
|
}
|
|
3717
3681
|
apiKey() {
|
|
3718
|
-
return __privateGet(this, _options4).apiKey ??
|
|
3682
|
+
return __privateGet(this, _options4).apiKey ?? env.TRIGGER_API_KEY;
|
|
3719
3683
|
}
|
|
3720
3684
|
};
|
|
3721
3685
|
_options4 = new WeakMap();
|
|
@@ -3735,7 +3699,7 @@ _client2 = new WeakMap();
|
|
|
3735
3699
|
_internalLogger = new WeakMap();
|
|
3736
3700
|
_preprocessRun = new WeakSet();
|
|
3737
3701
|
preprocessRun_fn = /* @__PURE__ */ __name(async function(body, job) {
|
|
3738
|
-
|
|
3702
|
+
__privateMethod(this, _createPreprocessRunContext, createPreprocessRunContext_fn).call(this, body);
|
|
3739
3703
|
const parsedPayload = job.trigger.event.parsePayload(body.event.payload ?? {});
|
|
3740
3704
|
const properties = job.trigger.event.runProperties?.(parsedPayload) ?? [];
|
|
3741
3705
|
return {
|
|
@@ -3764,7 +3728,7 @@ executeJob_fn = /* @__PURE__ */ __name(async function(body1, job1, timeOrigin, t
|
|
|
3764
3728
|
client: this,
|
|
3765
3729
|
context,
|
|
3766
3730
|
jobLogLevel: job1.logLevel ?? __privateGet(this, _options4).logLevel ?? "info",
|
|
3767
|
-
jobLogger: __privateGet(this, _options4).ioLogLocalEnabled ? new
|
|
3731
|
+
jobLogger: __privateGet(this, _options4).ioLogLocalEnabled ? new Logger(job1.id, job1.logLevel ?? __privateGet(this, _options4).logLevel ?? "info") : void 0,
|
|
3768
3732
|
serverVersion: triggerVersion,
|
|
3769
3733
|
timeOrigin,
|
|
3770
3734
|
executionTimeout: body1.runChunkExecutionLimit
|
|
@@ -3875,7 +3839,7 @@ convertErrorToExecutionResponse_fn = /* @__PURE__ */ __name(function(error, body
|
|
|
3875
3839
|
};
|
|
3876
3840
|
}
|
|
3877
3841
|
if (error instanceof ErrorWithTask) {
|
|
3878
|
-
const errorWithStack2 =
|
|
3842
|
+
const errorWithStack2 = ErrorWithStackSchema.safeParse(error.cause.output);
|
|
3879
3843
|
if (errorWithStack2.success) {
|
|
3880
3844
|
return {
|
|
3881
3845
|
status: "ERROR",
|
|
@@ -3892,7 +3856,7 @@ convertErrorToExecutionResponse_fn = /* @__PURE__ */ __name(function(error, body
|
|
|
3892
3856
|
};
|
|
3893
3857
|
}
|
|
3894
3858
|
if (error instanceof RetryWithTaskError) {
|
|
3895
|
-
const errorWithStack2 =
|
|
3859
|
+
const errorWithStack2 = ErrorWithStackSchema.safeParse(error.cause);
|
|
3896
3860
|
if (errorWithStack2.success) {
|
|
3897
3861
|
return {
|
|
3898
3862
|
status: "ERROR",
|
|
@@ -3908,7 +3872,7 @@ convertErrorToExecutionResponse_fn = /* @__PURE__ */ __name(function(error, body
|
|
|
3908
3872
|
task: error.task
|
|
3909
3873
|
};
|
|
3910
3874
|
}
|
|
3911
|
-
const errorWithStack =
|
|
3875
|
+
const errorWithStack = ErrorWithStackSchema.safeParse(error);
|
|
3912
3876
|
if (errorWithStack.success) {
|
|
3913
3877
|
return {
|
|
3914
3878
|
status: "ERROR",
|
|
@@ -4296,7 +4260,7 @@ logIOStats_fn = /* @__PURE__ */ __name(function(stats) {
|
|
|
4296
4260
|
_standardResponseHeaders = new WeakSet();
|
|
4297
4261
|
standardResponseHeaders_fn = /* @__PURE__ */ __name(function(start) {
|
|
4298
4262
|
return {
|
|
4299
|
-
"Trigger-Version":
|
|
4263
|
+
"Trigger-Version": API_VERSIONS.LAZY_LOADED_CACHED_TASKS,
|
|
4300
4264
|
"Trigger-SDK-Version": version,
|
|
4301
4265
|
"X-Trigger-Request-Timing": `dur=${performance.now() - start / 1e3}`
|
|
4302
4266
|
};
|
|
@@ -4365,9 +4329,6 @@ function deepMergeOptions(obj1, obj2) {
|
|
|
4365
4329
|
return mergedOptions;
|
|
4366
4330
|
}
|
|
4367
4331
|
__name(deepMergeOptions, "deepMergeOptions");
|
|
4368
|
-
|
|
4369
|
-
// src/triggers/externalSource.ts
|
|
4370
|
-
import { deepMergeFilters as deepMergeFilters3 } from "@trigger.dev/core";
|
|
4371
4332
|
var _ExternalSource = class _ExternalSource {
|
|
4372
4333
|
constructor(channel, options) {
|
|
4373
4334
|
this.options = options;
|
|
@@ -4442,7 +4403,7 @@ var _ExternalSourceTrigger = class _ExternalSourceTrigger {
|
|
|
4442
4403
|
title: "External Source",
|
|
4443
4404
|
rule: {
|
|
4444
4405
|
event: this.event.name,
|
|
4445
|
-
payload:
|
|
4406
|
+
payload: deepMergeFilters(this.options.source.filter(this.options.params, this.options.options), this.event.filter ?? {}, this.options.params.filter ?? {}),
|
|
4446
4407
|
source: this.event.source
|
|
4447
4408
|
},
|
|
4448
4409
|
properties: this.options.source.properties(this.options.params)
|
|
@@ -4481,9 +4442,6 @@ function omit(obj, key) {
|
|
|
4481
4442
|
};
|
|
4482
4443
|
}
|
|
4483
4444
|
__name(omit, "omit");
|
|
4484
|
-
|
|
4485
|
-
// src/triggers/notifications.ts
|
|
4486
|
-
import { MISSING_CONNECTION_NOTIFICATION, MISSING_CONNECTION_RESOLVED_NOTIFICATION, MissingConnectionNotificationPayloadSchema, MissingConnectionResolvedNotificationPayloadSchema } from "@trigger.dev/core";
|
|
4487
4445
|
function missingConnectionNotification(integrations) {
|
|
4488
4446
|
return new MissingConnectionNotification({
|
|
4489
4447
|
integrations
|
|
@@ -4650,10 +4608,6 @@ function invokeTrigger(options) {
|
|
|
4650
4608
|
return new InvokeTrigger(options ?? {});
|
|
4651
4609
|
}
|
|
4652
4610
|
__name(invokeTrigger, "invokeTrigger");
|
|
4653
|
-
|
|
4654
|
-
// src/triggers/webhook.ts
|
|
4655
|
-
import { deepMergeFilters as deepMergeFilters4 } from "@trigger.dev/core";
|
|
4656
|
-
import { createHash } from "node:crypto";
|
|
4657
4611
|
var _shortHash, shortHash_fn;
|
|
4658
4612
|
var _WebhookSource = class _WebhookSource {
|
|
4659
4613
|
constructor(options) {
|
|
@@ -4749,7 +4703,7 @@ var _WebhookTrigger = class _WebhookTrigger {
|
|
|
4749
4703
|
title: "Webhook",
|
|
4750
4704
|
rule: {
|
|
4751
4705
|
event: this.event.name,
|
|
4752
|
-
payload:
|
|
4706
|
+
payload: deepMergeFilters(this.options.source.filter(this.options.params, this.options.config), this.event.filter ?? {}),
|
|
4753
4707
|
source: this.event.source
|
|
4754
4708
|
},
|
|
4755
4709
|
properties: this.options.source.properties(this.options.params),
|
|
@@ -4763,7 +4717,7 @@ var _WebhookTrigger = class _WebhookTrigger {
|
|
|
4763
4717
|
...optionsWithoutEvent,
|
|
4764
4718
|
event: {
|
|
4765
4719
|
...eventWithoutFilter,
|
|
4766
|
-
filter:
|
|
4720
|
+
filter: deepMergeFilters(filter ?? {}, eventFilter)
|
|
4767
4721
|
}
|
|
4768
4722
|
});
|
|
4769
4723
|
}
|
|
@@ -4795,9 +4749,6 @@ var _WebhookTrigger = class _WebhookTrigger {
|
|
|
4795
4749
|
};
|
|
4796
4750
|
__name(_WebhookTrigger, "WebhookTrigger");
|
|
4797
4751
|
var WebhookTrigger = _WebhookTrigger;
|
|
4798
|
-
|
|
4799
|
-
// src/security.ts
|
|
4800
|
-
import crypto from "node:crypto";
|
|
4801
4752
|
async function verifyRequestSignature({ request, headerName, headerEncoding = "hex", secret, algorithm }) {
|
|
4802
4753
|
if (!secret) {
|
|
4803
4754
|
return {
|
|
@@ -4846,38 +4797,7 @@ function redactString(strings, ...interpolations) {
|
|
|
4846
4797
|
};
|
|
4847
4798
|
}
|
|
4848
4799
|
__name(redactString, "redactString");
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
DynamicTrigger,
|
|
4853
|
-
EventSpecificationExampleSchema,
|
|
4854
|
-
EventTrigger,
|
|
4855
|
-
ExternalSource,
|
|
4856
|
-
ExternalSourceTrigger,
|
|
4857
|
-
IO,
|
|
4858
|
-
IOLogger,
|
|
4859
|
-
IntervalTrigger,
|
|
4860
|
-
InvokeTrigger,
|
|
4861
|
-
JSONOutputSerializer,
|
|
4862
|
-
Job,
|
|
4863
|
-
MissingConnectionNotification,
|
|
4864
|
-
MissingConnectionResolvedNotification,
|
|
4865
|
-
TriggerClient,
|
|
4866
|
-
WebhookSource,
|
|
4867
|
-
WebhookTrigger,
|
|
4868
|
-
cronTrigger,
|
|
4869
|
-
eventTrigger,
|
|
4870
|
-
intervalTrigger,
|
|
4871
|
-
invokeTrigger,
|
|
4872
|
-
isTriggerError,
|
|
4873
|
-
missingConnectionNotification,
|
|
4874
|
-
missingConnectionResolvedNotification,
|
|
4875
|
-
omit,
|
|
4876
|
-
redactString,
|
|
4877
|
-
retry,
|
|
4878
|
-
slugifyId,
|
|
4879
|
-
verifyHmacSha256,
|
|
4880
|
-
verifyRequestSignature,
|
|
4881
|
-
waitForEventSchema
|
|
4882
|
-
};
|
|
4800
|
+
|
|
4801
|
+
export { CronTrigger, DynamicSchedule, DynamicTrigger, EventSpecificationExampleSchema, EventTrigger, ExternalSource, ExternalSourceTrigger, IO, IOLogger, IntervalTrigger, InvokeTrigger, JSONOutputSerializer, Job, MissingConnectionNotification, MissingConnectionResolvedNotification, TriggerClient, WebhookSource, WebhookTrigger, cronTrigger, eventTrigger, intervalTrigger, invokeTrigger, isTriggerError, missingConnectionNotification, missingConnectionResolvedNotification, omit, redactString, retry, slugifyId, verifyHmacSha256, verifyRequestSignature, waitForEventSchema };
|
|
4802
|
+
//# sourceMappingURL=out.js.map
|
|
4883
4803
|
//# sourceMappingURL=index.mjs.map
|