@trigger.dev/core 0.0.0-v3-prerelease-20240424094958 → 0.0.0-v3-decorators-20240424152300
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/{catalog-A-D3UC6S.d.mts → catalog-04wPlpvu.d.mts} +4 -0
- package/dist/{catalog-TAZd4-TP.d.ts → catalog-huF1UvYY.d.ts} +4 -0
- package/dist/v3/index.d.mts +2 -2
- package/dist/v3/index.d.ts +2 -2
- package/dist/v3/index.js +14 -14
- package/dist/v3/index.js.map +1 -1
- package/dist/v3/index.mjs +14 -13
- package/dist/v3/index.mjs.map +1 -1
- package/dist/v3/workers/index.d.mts +2 -2
- package/dist/v3/workers/index.d.ts +2 -2
- package/dist/v3/workers/index.js +33 -10
- package/dist/v3/workers/index.js.map +1 -1
- package/dist/v3/workers/index.mjs +33 -10
- package/dist/v3/workers/index.mjs.map +1 -1
- package/dist/v3/zodMessageHandler.d.mts +1 -1
- package/dist/v3/zodMessageHandler.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SpanStatusCode, DiagLogLevel, diag, DiagConsoleLogger, propagation, context, SpanKind } from '@opentelemetry/api';
|
|
2
|
-
import 'node:path';
|
|
3
2
|
import { logs, SeverityNumber } from '@opentelemetry/api-logs';
|
|
4
3
|
import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http';
|
|
5
4
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
@@ -38,6 +37,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
38
37
|
__accessCheck(obj, member, "access private method");
|
|
39
38
|
return method;
|
|
40
39
|
};
|
|
40
|
+
|
|
41
|
+
// src/v3/errors.ts
|
|
41
42
|
function parseError(error) {
|
|
42
43
|
if (error instanceof Error) {
|
|
43
44
|
return {
|
|
@@ -1968,11 +1969,12 @@ function accessoryAttributes(accessory) {
|
|
|
1968
1969
|
__name(accessoryAttributes, "accessoryAttributes");
|
|
1969
1970
|
|
|
1970
1971
|
// src/v3/workers/taskExecutor.ts
|
|
1971
|
-
var _callRun, callRun_fn, _callTaskInit, callTaskInit_fn, _callTaskCleanup, callTaskCleanup_fn, _handleError, handleError_fn;
|
|
1972
|
+
var _callRun, callRun_fn, _callTaskInit, callTaskInit_fn, _callConfigInit, callConfigInit_fn, _callTaskCleanup, callTaskCleanup_fn, _handleError, handleError_fn;
|
|
1972
1973
|
var _TaskExecutor = class _TaskExecutor {
|
|
1973
1974
|
constructor(task, options) {
|
|
1974
1975
|
__privateAdd(this, _callRun);
|
|
1975
1976
|
__privateAdd(this, _callTaskInit);
|
|
1977
|
+
__privateAdd(this, _callConfigInit);
|
|
1976
1978
|
__privateAdd(this, _callTaskCleanup);
|
|
1977
1979
|
__privateAdd(this, _handleError);
|
|
1978
1980
|
this.task = task;
|
|
@@ -2006,6 +2008,7 @@ var _TaskExecutor = class _TaskExecutor {
|
|
|
2006
2008
|
try {
|
|
2007
2009
|
const payloadPacket = await conditionallyImportPacket(originalPacket, this._tracer);
|
|
2008
2010
|
parsedPayload = await parsePacket(payloadPacket);
|
|
2011
|
+
await __privateMethod(this, _callConfigInit, callConfigInit_fn).call(this, parsedPayload, ctx);
|
|
2009
2012
|
initOutput = await __privateMethod(this, _callTaskInit, callTaskInit_fn).call(this, parsedPayload, ctx);
|
|
2010
2013
|
const output = await __privateMethod(this, _callRun, callRun_fn).call(this, parsedPayload, ctx, initOutput);
|
|
2011
2014
|
try {
|
|
@@ -2110,23 +2113,43 @@ callTaskInit_fn = /* @__PURE__ */ __name(async function(payload1, ctx1) {
|
|
|
2110
2113
|
return await initFn(payload1, {
|
|
2111
2114
|
ctx: ctx1
|
|
2112
2115
|
});
|
|
2116
|
+
}, {
|
|
2117
|
+
attributes: {
|
|
2118
|
+
[SemanticInternalAttributes.STYLE_ICON]: "function"
|
|
2119
|
+
}
|
|
2113
2120
|
});
|
|
2114
2121
|
}, "#callTaskInit");
|
|
2122
|
+
_callConfigInit = new WeakSet();
|
|
2123
|
+
callConfigInit_fn = /* @__PURE__ */ __name(async function(payload2, ctx2) {
|
|
2124
|
+
const initFn = this._importedConfig?.init;
|
|
2125
|
+
if (!initFn) {
|
|
2126
|
+
return {};
|
|
2127
|
+
}
|
|
2128
|
+
return this._tracer.startActiveSpan("config.init", async (span) => {
|
|
2129
|
+
return await initFn(payload2, {
|
|
2130
|
+
ctx: ctx2
|
|
2131
|
+
});
|
|
2132
|
+
}, {
|
|
2133
|
+
attributes: {
|
|
2134
|
+
[SemanticInternalAttributes.STYLE_ICON]: "function"
|
|
2135
|
+
}
|
|
2136
|
+
});
|
|
2137
|
+
}, "#callConfigInit");
|
|
2115
2138
|
_callTaskCleanup = new WeakSet();
|
|
2116
|
-
callTaskCleanup_fn = /* @__PURE__ */ __name(async function(
|
|
2139
|
+
callTaskCleanup_fn = /* @__PURE__ */ __name(async function(payload3, ctx3, init1) {
|
|
2117
2140
|
const cleanupFn = this.task.fns.cleanup;
|
|
2118
2141
|
if (!cleanupFn) {
|
|
2119
2142
|
return;
|
|
2120
2143
|
}
|
|
2121
2144
|
return this._tracer.startActiveSpan("cleanup", async (span) => {
|
|
2122
|
-
return await cleanupFn(
|
|
2123
|
-
ctx:
|
|
2145
|
+
return await cleanupFn(payload3, {
|
|
2146
|
+
ctx: ctx3,
|
|
2124
2147
|
init: init1
|
|
2125
2148
|
});
|
|
2126
2149
|
});
|
|
2127
2150
|
}, "#callTaskCleanup");
|
|
2128
2151
|
_handleError = new WeakSet();
|
|
2129
|
-
handleError_fn = /* @__PURE__ */ __name(async function(execution, error,
|
|
2152
|
+
handleError_fn = /* @__PURE__ */ __name(async function(execution, error, payload4, ctx4) {
|
|
2130
2153
|
const retriesConfig = this._importedConfig?.retries ?? this._config.retries;
|
|
2131
2154
|
const retry = this.task.retry ?? retriesConfig?.default;
|
|
2132
2155
|
if (!retry) {
|
|
@@ -2141,13 +2164,13 @@ handleError_fn = /* @__PURE__ */ __name(async function(execution, error, payload
|
|
|
2141
2164
|
};
|
|
2142
2165
|
}
|
|
2143
2166
|
return this._tracer.startActiveSpan("handleError()", async (span) => {
|
|
2144
|
-
const handleErrorResult = this.task.fns.handleError ? await this.task.fns.handleError(
|
|
2145
|
-
ctx:
|
|
2167
|
+
const handleErrorResult = this.task.fns.handleError ? await this.task.fns.handleError(payload4, error, {
|
|
2168
|
+
ctx: ctx4,
|
|
2146
2169
|
retry,
|
|
2147
2170
|
retryDelayInMs: delay,
|
|
2148
2171
|
retryAt: delay ? new Date(Date.now() + delay) : void 0
|
|
2149
|
-
}) : this._importedConfig ? await this._handleErrorFn?.(
|
|
2150
|
-
ctx:
|
|
2172
|
+
}) : this._importedConfig ? await this._handleErrorFn?.(payload4, error, {
|
|
2173
|
+
ctx: ctx4,
|
|
2151
2174
|
retry,
|
|
2152
2175
|
retryDelayInMs: delay,
|
|
2153
2176
|
retryAt: delay ? new Date(Date.now() + delay) : void 0
|