@trigger.dev/core 0.0.0-v3-decorators-20240424152300 → 0.0.0-v3-prerelease-20240425102616
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-huF1UvYY.d.ts → catalog-KJXg8k3W.d.ts} +21 -4
- package/dist/{catalog-04wPlpvu.d.mts → catalog-PA64uhhi.d.mts} +21 -4
- package/dist/v3/index.d.mts +2 -2
- package/dist/v3/index.d.ts +2 -2
- package/dist/v3/index.js.map +1 -1
- 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 +99 -15
- package/dist/v3/workers/index.js.map +1 -1
- package/dist/v3/workers/index.mjs +99 -15
- package/dist/v3/workers/index.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -1969,12 +1969,18 @@ function accessoryAttributes(accessory) {
|
|
|
1969
1969
|
__name(accessoryAttributes, "accessoryAttributes");
|
|
1970
1970
|
|
|
1971
1971
|
// src/v3/workers/taskExecutor.ts
|
|
1972
|
-
var _callRun, callRun_fn,
|
|
1972
|
+
var _callRun, callRun_fn, _callInitFunctions, callInitFunctions_fn, _callConfigInit, callConfigInit_fn, _callOnSuccessFunctions, callOnSuccessFunctions_fn, _callOnSuccessFunction, callOnSuccessFunction_fn, _callOnFailureFunctions, callOnFailureFunctions_fn, _callOnFailureFunction, callOnFailureFunction_fn, _callOnStartFunctions, callOnStartFunctions_fn, _callOnStartFunction, callOnStartFunction_fn, _callTaskCleanup, callTaskCleanup_fn, _handleError, handleError_fn;
|
|
1973
1973
|
var _TaskExecutor = class _TaskExecutor {
|
|
1974
1974
|
constructor(task, options) {
|
|
1975
1975
|
__privateAdd(this, _callRun);
|
|
1976
|
-
__privateAdd(this,
|
|
1976
|
+
__privateAdd(this, _callInitFunctions);
|
|
1977
1977
|
__privateAdd(this, _callConfigInit);
|
|
1978
|
+
__privateAdd(this, _callOnSuccessFunctions);
|
|
1979
|
+
__privateAdd(this, _callOnSuccessFunction);
|
|
1980
|
+
__privateAdd(this, _callOnFailureFunctions);
|
|
1981
|
+
__privateAdd(this, _callOnFailureFunction);
|
|
1982
|
+
__privateAdd(this, _callOnStartFunctions);
|
|
1983
|
+
__privateAdd(this, _callOnStartFunction);
|
|
1978
1984
|
__privateAdd(this, _callTaskCleanup);
|
|
1979
1985
|
__privateAdd(this, _handleError);
|
|
1980
1986
|
this.task = task;
|
|
@@ -2008,9 +2014,12 @@ var _TaskExecutor = class _TaskExecutor {
|
|
|
2008
2014
|
try {
|
|
2009
2015
|
const payloadPacket = await conditionallyImportPacket(originalPacket, this._tracer);
|
|
2010
2016
|
parsedPayload = await parsePacket(payloadPacket);
|
|
2011
|
-
|
|
2012
|
-
|
|
2017
|
+
if (execution.attempt.number === 1) {
|
|
2018
|
+
await __privateMethod(this, _callOnStartFunctions, callOnStartFunctions_fn).call(this, parsedPayload, ctx);
|
|
2019
|
+
}
|
|
2020
|
+
initOutput = await __privateMethod(this, _callInitFunctions, callInitFunctions_fn).call(this, parsedPayload, ctx);
|
|
2013
2021
|
const output = await __privateMethod(this, _callRun, callRun_fn).call(this, parsedPayload, ctx, initOutput);
|
|
2022
|
+
await __privateMethod(this, _callOnSuccessFunctions, callOnSuccessFunctions_fn).call(this, parsedPayload, output, ctx, initOutput);
|
|
2014
2023
|
try {
|
|
2015
2024
|
const stringifiedOutput = await stringifyIO(output);
|
|
2016
2025
|
const finalOutput = await conditionallyExportPacket(stringifiedOutput, `${execution.attempt.id}/output`, this._tracer);
|
|
@@ -2040,6 +2049,9 @@ var _TaskExecutor = class _TaskExecutor {
|
|
|
2040
2049
|
try {
|
|
2041
2050
|
const handleErrorResult = await __privateMethod(this, _handleError, handleError_fn).call(this, execution, runError, parsedPayload, ctx);
|
|
2042
2051
|
recordSpanException(span, handleErrorResult.error ?? runError);
|
|
2052
|
+
if (handleErrorResult.status !== "retry") {
|
|
2053
|
+
await __privateMethod(this, _callOnFailureFunctions, callOnFailureFunctions_fn).call(this, parsedPayload, handleErrorResult.error ?? runError, ctx, initOutput);
|
|
2054
|
+
}
|
|
2043
2055
|
return {
|
|
2044
2056
|
id: execution.run.id,
|
|
2045
2057
|
ok: false,
|
|
@@ -2103,8 +2115,9 @@ callRun_fn = /* @__PURE__ */ __name(async function(payload, ctx, init) {
|
|
|
2103
2115
|
})
|
|
2104
2116
|
});
|
|
2105
2117
|
}, "#callRun");
|
|
2106
|
-
|
|
2107
|
-
|
|
2118
|
+
_callInitFunctions = new WeakSet();
|
|
2119
|
+
callInitFunctions_fn = /* @__PURE__ */ __name(async function(payload1, ctx1) {
|
|
2120
|
+
await __privateMethod(this, _callConfigInit, callConfigInit_fn).call(this, payload1, ctx1);
|
|
2108
2121
|
const initFn = this.task.fns.init;
|
|
2109
2122
|
if (!initFn) {
|
|
2110
2123
|
return {};
|
|
@@ -2118,7 +2131,7 @@ callTaskInit_fn = /* @__PURE__ */ __name(async function(payload1, ctx1) {
|
|
|
2118
2131
|
[SemanticInternalAttributes.STYLE_ICON]: "function"
|
|
2119
2132
|
}
|
|
2120
2133
|
});
|
|
2121
|
-
}, "#
|
|
2134
|
+
}, "#callInitFunctions");
|
|
2122
2135
|
_callConfigInit = new WeakSet();
|
|
2123
2136
|
callConfigInit_fn = /* @__PURE__ */ __name(async function(payload2, ctx2) {
|
|
2124
2137
|
const initFn = this._importedConfig?.init;
|
|
@@ -2135,21 +2148,92 @@ callConfigInit_fn = /* @__PURE__ */ __name(async function(payload2, ctx2) {
|
|
|
2135
2148
|
}
|
|
2136
2149
|
});
|
|
2137
2150
|
}, "#callConfigInit");
|
|
2151
|
+
_callOnSuccessFunctions = new WeakSet();
|
|
2152
|
+
callOnSuccessFunctions_fn = /* @__PURE__ */ __name(async function(payload3, output, ctx3, initOutput) {
|
|
2153
|
+
await __privateMethod(this, _callOnSuccessFunction, callOnSuccessFunction_fn).call(this, this.task.fns.onSuccess, "task.onSuccess", payload3, output, ctx3, initOutput);
|
|
2154
|
+
await __privateMethod(this, _callOnSuccessFunction, callOnSuccessFunction_fn).call(this, this._importedConfig?.onSuccess, "config.onSuccess", payload3, output, ctx3, initOutput);
|
|
2155
|
+
}, "#callOnSuccessFunctions");
|
|
2156
|
+
_callOnSuccessFunction = new WeakSet();
|
|
2157
|
+
callOnSuccessFunction_fn = /* @__PURE__ */ __name(async function(onSuccessFn, name, payload4, output1, ctx4, initOutput1) {
|
|
2158
|
+
if (!onSuccessFn) {
|
|
2159
|
+
return;
|
|
2160
|
+
}
|
|
2161
|
+
try {
|
|
2162
|
+
await this._tracer.startActiveSpan(name, async (span) => {
|
|
2163
|
+
return await onSuccessFn(payload4, output1, {
|
|
2164
|
+
ctx: ctx4,
|
|
2165
|
+
init: initOutput1
|
|
2166
|
+
});
|
|
2167
|
+
}, {
|
|
2168
|
+
attributes: {
|
|
2169
|
+
[SemanticInternalAttributes.STYLE_ICON]: "function"
|
|
2170
|
+
}
|
|
2171
|
+
});
|
|
2172
|
+
} catch {
|
|
2173
|
+
}
|
|
2174
|
+
}, "#callOnSuccessFunction");
|
|
2175
|
+
_callOnFailureFunctions = new WeakSet();
|
|
2176
|
+
callOnFailureFunctions_fn = /* @__PURE__ */ __name(async function(payload5, error, ctx5, initOutput2) {
|
|
2177
|
+
await __privateMethod(this, _callOnFailureFunction, callOnFailureFunction_fn).call(this, this.task.fns.onFailure, "task.onFailure", payload5, error, ctx5, initOutput2);
|
|
2178
|
+
await __privateMethod(this, _callOnFailureFunction, callOnFailureFunction_fn).call(this, this._importedConfig?.onFailure, "config.onFailure", payload5, error, ctx5, initOutput2);
|
|
2179
|
+
}, "#callOnFailureFunctions");
|
|
2180
|
+
_callOnFailureFunction = new WeakSet();
|
|
2181
|
+
callOnFailureFunction_fn = /* @__PURE__ */ __name(async function(onFailureFn, name1, payload6, error1, ctx6, initOutput3) {
|
|
2182
|
+
if (!onFailureFn) {
|
|
2183
|
+
return;
|
|
2184
|
+
}
|
|
2185
|
+
try {
|
|
2186
|
+
return await this._tracer.startActiveSpan(name1, async (span) => {
|
|
2187
|
+
return await onFailureFn(payload6, error1, {
|
|
2188
|
+
ctx: ctx6,
|
|
2189
|
+
init: initOutput3
|
|
2190
|
+
});
|
|
2191
|
+
}, {
|
|
2192
|
+
attributes: {
|
|
2193
|
+
[SemanticInternalAttributes.STYLE_ICON]: "function"
|
|
2194
|
+
}
|
|
2195
|
+
});
|
|
2196
|
+
} catch (e) {
|
|
2197
|
+
}
|
|
2198
|
+
}, "#callOnFailureFunction");
|
|
2199
|
+
_callOnStartFunctions = new WeakSet();
|
|
2200
|
+
callOnStartFunctions_fn = /* @__PURE__ */ __name(async function(payload7, ctx7) {
|
|
2201
|
+
await __privateMethod(this, _callOnStartFunction, callOnStartFunction_fn).call(this, this._importedConfig?.onStart, "config.onStart", payload7, ctx7, {});
|
|
2202
|
+
await __privateMethod(this, _callOnStartFunction, callOnStartFunction_fn).call(this, this.task.fns.onStart, "task.onStart", payload7, ctx7, {});
|
|
2203
|
+
}, "#callOnStartFunctions");
|
|
2204
|
+
_callOnStartFunction = new WeakSet();
|
|
2205
|
+
callOnStartFunction_fn = /* @__PURE__ */ __name(async function(onStartFn, name2, payload8, ctx8, initOutput4) {
|
|
2206
|
+
if (!onStartFn) {
|
|
2207
|
+
return;
|
|
2208
|
+
}
|
|
2209
|
+
try {
|
|
2210
|
+
await this._tracer.startActiveSpan(name2, async (span) => {
|
|
2211
|
+
return await onStartFn(payload8, {
|
|
2212
|
+
ctx: ctx8
|
|
2213
|
+
});
|
|
2214
|
+
}, {
|
|
2215
|
+
attributes: {
|
|
2216
|
+
[SemanticInternalAttributes.STYLE_ICON]: "function"
|
|
2217
|
+
}
|
|
2218
|
+
});
|
|
2219
|
+
} catch {
|
|
2220
|
+
}
|
|
2221
|
+
}, "#callOnStartFunction");
|
|
2138
2222
|
_callTaskCleanup = new WeakSet();
|
|
2139
|
-
callTaskCleanup_fn = /* @__PURE__ */ __name(async function(
|
|
2223
|
+
callTaskCleanup_fn = /* @__PURE__ */ __name(async function(payload9, ctx9, init1) {
|
|
2140
2224
|
const cleanupFn = this.task.fns.cleanup;
|
|
2141
2225
|
if (!cleanupFn) {
|
|
2142
2226
|
return;
|
|
2143
2227
|
}
|
|
2144
2228
|
return this._tracer.startActiveSpan("cleanup", async (span) => {
|
|
2145
|
-
return await cleanupFn(
|
|
2146
|
-
ctx:
|
|
2229
|
+
return await cleanupFn(payload9, {
|
|
2230
|
+
ctx: ctx9,
|
|
2147
2231
|
init: init1
|
|
2148
2232
|
});
|
|
2149
2233
|
});
|
|
2150
2234
|
}, "#callTaskCleanup");
|
|
2151
2235
|
_handleError = new WeakSet();
|
|
2152
|
-
handleError_fn = /* @__PURE__ */ __name(async function(execution,
|
|
2236
|
+
handleError_fn = /* @__PURE__ */ __name(async function(execution, error2, payload10, ctx10) {
|
|
2153
2237
|
const retriesConfig = this._importedConfig?.retries ?? this._config.retries;
|
|
2154
2238
|
const retry = this.task.retry ?? retriesConfig?.default;
|
|
2155
2239
|
if (!retry) {
|
|
@@ -2164,13 +2248,13 @@ handleError_fn = /* @__PURE__ */ __name(async function(execution, error, payload
|
|
|
2164
2248
|
};
|
|
2165
2249
|
}
|
|
2166
2250
|
return this._tracer.startActiveSpan("handleError()", async (span) => {
|
|
2167
|
-
const handleErrorResult = this.task.fns.handleError ? await this.task.fns.handleError(
|
|
2168
|
-
ctx:
|
|
2251
|
+
const handleErrorResult = this.task.fns.handleError ? await this.task.fns.handleError(payload10, error2, {
|
|
2252
|
+
ctx: ctx10,
|
|
2169
2253
|
retry,
|
|
2170
2254
|
retryDelayInMs: delay,
|
|
2171
2255
|
retryAt: delay ? new Date(Date.now() + delay) : void 0
|
|
2172
|
-
}) : this._importedConfig ? await this._handleErrorFn?.(
|
|
2173
|
-
ctx:
|
|
2256
|
+
}) : this._importedConfig ? await this._handleErrorFn?.(payload10, error2, {
|
|
2257
|
+
ctx: ctx10,
|
|
2174
2258
|
retry,
|
|
2175
2259
|
retryDelayInMs: delay,
|
|
2176
2260
|
retryAt: delay ? new Date(Date.now() + delay) : void 0
|