@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.
@@ -4,8 +4,8 @@ export { TracingDiagnosticLogLevel, recordSpanException } from '../otel/index.mj
4
4
  import { p as TaskRunExecution, T as TaskRunExecutionResult } from '../../manager-M9GLDnhJ.mjs';
5
5
  export { R as RuntimeManager } from '../../manager-M9GLDnhJ.mjs';
6
6
  import { B as BackgroundWorkerProperties, T as TaskFileMetadata, a as TaskMetadataWithFilePath } from '../../messages-AriaDDm0.mjs';
7
- import { d as TriggerTracer, g as Config, y as ProjectConfig, w as HandleErrorFunction, c as TaskMetadataWithFunctions, C as Clock, a as ClockTime, b as TaskCatalog } from '../../catalog-A-D3UC6S.mjs';
8
- export { O as OtelTaskLogger, z as logLevels } from '../../catalog-A-D3UC6S.mjs';
7
+ import { d as TriggerTracer, g as Config, y as ProjectConfig, w as HandleErrorFunction, c as TaskMetadataWithFunctions, C as Clock, a as ClockTime, b as TaskCatalog } from '../../catalog-04wPlpvu.mjs';
8
+ export { O as OtelTaskLogger, z as logLevels } from '../../catalog-04wPlpvu.mjs';
9
9
  import { PreciseDate } from '@google-cloud/precise-date';
10
10
  import { LogRecordProcessor, LogRecord } from '@opentelemetry/sdk-logs';
11
11
  import { SpanProcessor, Span } from '@opentelemetry/sdk-trace-base';
@@ -4,8 +4,8 @@ export { TracingDiagnosticLogLevel, recordSpanException } from '../otel/index.js
4
4
  import { p as TaskRunExecution, T as TaskRunExecutionResult } from '../../manager-M9GLDnhJ.js';
5
5
  export { R as RuntimeManager } from '../../manager-M9GLDnhJ.js';
6
6
  import { B as BackgroundWorkerProperties, T as TaskFileMetadata, a as TaskMetadataWithFilePath } from '../../messages-AriaDDm0.js';
7
- import { d as TriggerTracer, g as Config, y as ProjectConfig, w as HandleErrorFunction, c as TaskMetadataWithFunctions, C as Clock, a as ClockTime, b as TaskCatalog } from '../../catalog-TAZd4-TP.js';
8
- export { O as OtelTaskLogger, z as logLevels } from '../../catalog-TAZd4-TP.js';
7
+ import { d as TriggerTracer, g as Config, y as ProjectConfig, w as HandleErrorFunction, c as TaskMetadataWithFunctions, C as Clock, a as ClockTime, b as TaskCatalog } from '../../catalog-huF1UvYY.js';
8
+ export { O as OtelTaskLogger, z as logLevels } from '../../catalog-huF1UvYY.js';
9
9
  import { PreciseDate } from '@google-cloud/precise-date';
10
10
  import { LogRecordProcessor, LogRecord } from '@opentelemetry/sdk-logs';
11
11
  import { SpanProcessor, Span } from '@opentelemetry/sdk-trace-base';
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var api = require('@opentelemetry/api');
4
- require('path');
5
4
  var apiLogs = require('@opentelemetry/api-logs');
6
5
  var exporterLogsOtlpHttp = require('@opentelemetry/exporter-logs-otlp-http');
7
6
  var exporterTraceOtlpHttp = require('@opentelemetry/exporter-trace-otlp-http');
@@ -44,6 +43,8 @@ var __privateMethod = (obj, member, method) => {
44
43
  __accessCheck(obj, member, "access private method");
45
44
  return method;
46
45
  };
46
+
47
+ // src/v3/errors.ts
47
48
  function parseError(error) {
48
49
  if (error instanceof Error) {
49
50
  return {
@@ -1974,11 +1975,12 @@ function accessoryAttributes(accessory) {
1974
1975
  __name(accessoryAttributes, "accessoryAttributes");
1975
1976
 
1976
1977
  // src/v3/workers/taskExecutor.ts
1977
- var _callRun, callRun_fn, _callTaskInit, callTaskInit_fn, _callTaskCleanup, callTaskCleanup_fn, _handleError, handleError_fn;
1978
+ var _callRun, callRun_fn, _callTaskInit, callTaskInit_fn, _callConfigInit, callConfigInit_fn, _callTaskCleanup, callTaskCleanup_fn, _handleError, handleError_fn;
1978
1979
  var _TaskExecutor = class _TaskExecutor {
1979
1980
  constructor(task, options) {
1980
1981
  __privateAdd(this, _callRun);
1981
1982
  __privateAdd(this, _callTaskInit);
1983
+ __privateAdd(this, _callConfigInit);
1982
1984
  __privateAdd(this, _callTaskCleanup);
1983
1985
  __privateAdd(this, _handleError);
1984
1986
  this.task = task;
@@ -2012,6 +2014,7 @@ var _TaskExecutor = class _TaskExecutor {
2012
2014
  try {
2013
2015
  const payloadPacket = await conditionallyImportPacket(originalPacket, this._tracer);
2014
2016
  parsedPayload = await parsePacket(payloadPacket);
2017
+ await __privateMethod(this, _callConfigInit, callConfigInit_fn).call(this, parsedPayload, ctx);
2015
2018
  initOutput = await __privateMethod(this, _callTaskInit, callTaskInit_fn).call(this, parsedPayload, ctx);
2016
2019
  const output = await __privateMethod(this, _callRun, callRun_fn).call(this, parsedPayload, ctx, initOutput);
2017
2020
  try {
@@ -2116,23 +2119,43 @@ callTaskInit_fn = /* @__PURE__ */ __name(async function(payload1, ctx1) {
2116
2119
  return await initFn(payload1, {
2117
2120
  ctx: ctx1
2118
2121
  });
2122
+ }, {
2123
+ attributes: {
2124
+ [SemanticInternalAttributes.STYLE_ICON]: "function"
2125
+ }
2119
2126
  });
2120
2127
  }, "#callTaskInit");
2128
+ _callConfigInit = new WeakSet();
2129
+ callConfigInit_fn = /* @__PURE__ */ __name(async function(payload2, ctx2) {
2130
+ const initFn = this._importedConfig?.init;
2131
+ if (!initFn) {
2132
+ return {};
2133
+ }
2134
+ return this._tracer.startActiveSpan("config.init", async (span) => {
2135
+ return await initFn(payload2, {
2136
+ ctx: ctx2
2137
+ });
2138
+ }, {
2139
+ attributes: {
2140
+ [SemanticInternalAttributes.STYLE_ICON]: "function"
2141
+ }
2142
+ });
2143
+ }, "#callConfigInit");
2121
2144
  _callTaskCleanup = new WeakSet();
2122
- callTaskCleanup_fn = /* @__PURE__ */ __name(async function(payload2, ctx2, init1) {
2145
+ callTaskCleanup_fn = /* @__PURE__ */ __name(async function(payload3, ctx3, init1) {
2123
2146
  const cleanupFn = this.task.fns.cleanup;
2124
2147
  if (!cleanupFn) {
2125
2148
  return;
2126
2149
  }
2127
2150
  return this._tracer.startActiveSpan("cleanup", async (span) => {
2128
- return await cleanupFn(payload2, {
2129
- ctx: ctx2,
2151
+ return await cleanupFn(payload3, {
2152
+ ctx: ctx3,
2130
2153
  init: init1
2131
2154
  });
2132
2155
  });
2133
2156
  }, "#callTaskCleanup");
2134
2157
  _handleError = new WeakSet();
2135
- handleError_fn = /* @__PURE__ */ __name(async function(execution, error, payload3, ctx3) {
2158
+ handleError_fn = /* @__PURE__ */ __name(async function(execution, error, payload4, ctx4) {
2136
2159
  const retriesConfig = this._importedConfig?.retries ?? this._config.retries;
2137
2160
  const retry = this.task.retry ?? retriesConfig?.default;
2138
2161
  if (!retry) {
@@ -2147,13 +2170,13 @@ handleError_fn = /* @__PURE__ */ __name(async function(execution, error, payload
2147
2170
  };
2148
2171
  }
2149
2172
  return this._tracer.startActiveSpan("handleError()", async (span) => {
2150
- const handleErrorResult = this.task.fns.handleError ? await this.task.fns.handleError(payload3, error, {
2151
- ctx: ctx3,
2173
+ const handleErrorResult = this.task.fns.handleError ? await this.task.fns.handleError(payload4, error, {
2174
+ ctx: ctx4,
2152
2175
  retry,
2153
2176
  retryDelayInMs: delay,
2154
2177
  retryAt: delay ? new Date(Date.now() + delay) : void 0
2155
- }) : this._importedConfig ? await this._handleErrorFn?.(payload3, error, {
2156
- ctx: ctx3,
2178
+ }) : this._importedConfig ? await this._handleErrorFn?.(payload4, error, {
2179
+ ctx: ctx4,
2157
2180
  retry,
2158
2181
  retryDelayInMs: delay,
2159
2182
  retryAt: delay ? new Date(Date.now() + delay) : void 0