@trigger.dev/core 0.0.0-v3-deploy-fix-20240506100153 → 0.0.0-v3-prerelease-20240513155118

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.
@@ -30,7 +30,7 @@ declare class TriggerTracer {
30
30
  startSpan(name: string, options?: SpanOptions, ctx?: Context$1): Span;
31
31
  }
32
32
 
33
- type LogLevel = "none" | "error" | "warn" | "info" | "debug";
33
+ type LogLevel = "none" | "error" | "warn" | "info" | "debug" | "log";
34
34
  declare const logLevels: Array<LogLevel>;
35
35
  type TaskLoggerConfig = {
36
36
  logger: Logger;
@@ -30,7 +30,7 @@ declare class TriggerTracer {
30
30
  startSpan(name: string, options?: SpanOptions, ctx?: Context$1): Span;
31
31
  }
32
32
 
33
- type LogLevel = "none" | "error" | "warn" | "info" | "debug";
33
+ type LogLevel = "none" | "error" | "warn" | "info" | "debug" | "log";
34
34
  declare const logLevels: Array<LogLevel>;
35
35
  type TaskLoggerConfig = {
36
36
  logger: Logger;
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
2
  import { T as TaskRunExecutionResult, B as BatchTaskRunExecutionResult, a as TaskRunError, b as TaskRunContext, R as RuntimeManager } from '../manager-WNMVbgHf.mjs';
3
3
  export { h as TaskRun, c as TaskRunBuiltInError, d as TaskRunCustomErrorObject, f as TaskRunErrorCodes, p as TaskRunExecution, j as TaskRunExecutionAttempt, o as TaskRunExecutionBatch, k as TaskRunExecutionEnvironment, l as TaskRunExecutionOrganization, m as TaskRunExecutionProject, n as TaskRunExecutionQueue, q as TaskRunExecutionRetry, i as TaskRunExecutionTask, r as TaskRunFailedExecutionResult, g as TaskRunInternalError, e as TaskRunStringError, s as TaskRunSuccessfulExecutionResult } from '../manager-WNMVbgHf.mjs';
4
- import { P as Prettify, C as Clock, a as ClockTime, T as TaskLogger, b as TaskCatalog, c as TaskMetadataWithFunctions, d as TaskFileMetadata, e as TaskMetadataWithFilePath, R as RetryOptions, f as TriggerTracer } from '../catalog-Bh7P1hZc.mjs';
5
- export { p as Config, v as Context, E as EnvironmentType, x as FailureFnParams, F as FixedWindowRateLimit, A as HandleErrorArgs, H as HandleErrorFnParams, B as HandleErrorFunction, y as HandleErrorModificationOptions, z as HandleErrorResult, t as InitFnParams, I as InitOutput, L as LogLevel, h as Machine, M as MachineCpu, g as MachineMemory, s as MiddlewareFnParams, n as PostStartCauses, o as PreStopCauses, j as ProdTaskRunExecution, k as ProdTaskRunExecutionPayload, G as ProjectConfig, Q as QueueOptions, l as RateLimitOptions, D as RequireKeys, q as ResolvedConfig, r as RunFnParams, S as SlidingWindowRateLimit, u as StartFnParams, w as SuccessFnParams, m as TaskMetadata, i as TaskRunExecutionPayload, W as WaitReason } from '../catalog-Bh7P1hZc.mjs';
4
+ import { P as Prettify, C as Clock, a as ClockTime, T as TaskLogger, b as TaskCatalog, c as TaskMetadataWithFunctions, d as TaskFileMetadata, e as TaskMetadataWithFilePath, R as RetryOptions, f as TriggerTracer } from '../catalog-ck7x04PV.mjs';
5
+ export { p as Config, v as Context, E as EnvironmentType, x as FailureFnParams, F as FixedWindowRateLimit, A as HandleErrorArgs, H as HandleErrorFnParams, B as HandleErrorFunction, y as HandleErrorModificationOptions, z as HandleErrorResult, t as InitFnParams, I as InitOutput, L as LogLevel, h as Machine, M as MachineCpu, g as MachineMemory, s as MiddlewareFnParams, n as PostStartCauses, o as PreStopCauses, j as ProdTaskRunExecution, k as ProdTaskRunExecutionPayload, G as ProjectConfig, Q as QueueOptions, l as RateLimitOptions, D as RequireKeys, q as ResolvedConfig, r as RunFnParams, S as SlidingWindowRateLimit, u as StartFnParams, w as SuccessFnParams, m as TaskMetadata, i as TaskRunExecutionPayload, W as WaitReason } from '../catalog-ck7x04PV.mjs';
6
6
  import { Attributes, Span } from '@opentelemetry/api';
7
7
  import { B as BackgroundWorkerProperties } from '../messages-vq7Bk4Ap.mjs';
8
8
  export { b as BackgroundWorkerClientMessages, a as BackgroundWorkerServerMessages, i as ClientToSharedQueueMessages, C as CoordinatorToPlatformMessages, k as CoordinatorToProdWorkerMessages, h as PlatformToCoordinatorMessages, g as PlatformToProviderMessages, P as ProdChildToWorkerMessages, l as ProdWorkerSocketData, e as ProdWorkerToChildMessages, j as ProdWorkerToCoordinatorMessages, f as ProviderToPlatformMessages, S as SharedQueueToClientMessages, T as TaskMetadataFailedToParseData, U as UncaughtExceptionMessage, d as childToWorkerMessages, c as clientWebsocketMessages, s as serverWebsocketMessages, w as workerToChildMessages } from '../messages-vq7Bk4Ap.mjs';
@@ -1715,10 +1715,13 @@ declare const GetEnvironmentVariablesResponseBody: z.ZodObject<{
1715
1715
  type GetEnvironmentVariablesResponseBody = z.infer<typeof GetEnvironmentVariablesResponseBody>;
1716
1716
  declare const StartDeploymentIndexingRequestBody: z.ZodObject<{
1717
1717
  imageReference: z.ZodString;
1718
+ selfHosted: z.ZodOptional<z.ZodBoolean>;
1718
1719
  }, "strip", z.ZodTypeAny, {
1719
1720
  imageReference: string;
1721
+ selfHosted?: boolean | undefined;
1720
1722
  }, {
1721
1723
  imageReference: string;
1724
+ selfHosted?: boolean | undefined;
1722
1725
  }>;
1723
1726
  type StartDeploymentIndexingRequestBody = z.infer<typeof StartDeploymentIndexingRequestBody>;
1724
1727
  declare const StartDeploymentIndexingResponseBody: z.ZodObject<{
@@ -4186,19 +4189,6 @@ declare class ApiClient {
4186
4189
  id: string;
4187
4190
  }>;
4188
4191
  }
4189
- type ApiClientContext = {
4190
- baseURL: string;
4191
- accessToken: string;
4192
- };
4193
- declare class ApiClientManager {
4194
- #private;
4195
- private _storage;
4196
- get baseURL(): string | undefined;
4197
- get accessToken(): string | undefined;
4198
- get client(): ApiClient | undefined;
4199
- runWith<R extends (...args: any[]) => Promise<any>>(context: ApiClientContext, fn: R): Promise<ReturnType<R>>;
4200
- }
4201
- declare const apiClientManager: ApiClientManager;
4202
4192
 
4203
4193
  type APIHeaders = Record<string, string | null | undefined>;
4204
4194
  declare class APIError extends Error {
@@ -4258,6 +4248,15 @@ declare const clock: ClockAPI;
4258
4248
 
4259
4249
  declare function parseError(error: unknown): TaskRunError;
4260
4250
  declare function createErrorTaskError(error: TaskRunError): any;
4251
+ declare function createJsonErrorObject(error: TaskRunError): {
4252
+ name: string;
4253
+ message: string;
4254
+ stackTrace: string;
4255
+ } | {
4256
+ message: string;
4257
+ name?: undefined;
4258
+ stackTrace?: undefined;
4259
+ };
4261
4260
  declare function correctErrorStackTrace(stackTrace: string, projectDir?: string, options?: {
4262
4261
  removeFirstLine?: boolean;
4263
4262
  }): string;
@@ -4346,6 +4345,26 @@ declare class TaskContextAPI {
4346
4345
  /** Entrypoint for logger API */
4347
4346
  declare const taskContext: TaskContextAPI;
4348
4347
 
4348
+ type ApiClientConfiguration = {
4349
+ baseURL?: string;
4350
+ secretKey?: string;
4351
+ };
4352
+
4353
+ declare class APIClientManagerAPI {
4354
+ #private;
4355
+ private static _instance?;
4356
+ private constructor();
4357
+ static getInstance(): APIClientManagerAPI;
4358
+ disable(): void;
4359
+ setGlobalAPIClientConfiguration(config: ApiClientConfiguration): boolean;
4360
+ get baseURL(): string | undefined;
4361
+ get accessToken(): string | undefined;
4362
+ get client(): ApiClient | undefined;
4363
+ }
4364
+
4365
+ /** Entrypoint for logger API */
4366
+ declare const apiClientManager: APIClientManagerAPI;
4367
+
4349
4368
  declare const SemanticInternalAttributes: {
4350
4369
  ENVIRONMENT_ID: string;
4351
4370
  ENVIRONMENT_TYPE: string;
@@ -4492,4 +4511,4 @@ declare function createPacketAttributes(packet: IOPacket, dataKey: string, dataT
4492
4511
  declare function createPacketAttributesAsJson(data: any, dataType: string): Promise<Attributes>;
4493
4512
  declare function prettyPrintPacket(rawData: any, dataType?: string): Promise<string>;
4494
4513
 
4495
- export { APIConnectionError, APIError, type APIHeaders, Accessory, ApiClient, ApiClientManager, AttemptStatus, AuthenticationError, BackgroundWorkerMetadata, BackgroundWorkerProperties, BadRequestError, BatchTaskRunExecutionResult, BatchTriggerTaskRequestBody, BatchTriggerTaskResponse, CanceledRunResponse, CancellationSpanEvent, ConflictError, type CreateAuthorizationCodeResponse, CreateAuthorizationCodeResponseSchema, CreateBackgroundWorkerRequestBody, CreateBackgroundWorkerResponse, CreateScheduleOptions, CreateUploadPayloadUrlResponseBody, DeletedScheduleObject, DeploymentErrorData, EventFilter, ExceptionEventProperties, ExceptionSpanEvent, ExternalBuildData, FetchRetryBackoffStrategy, FetchRetryByStatusOptions, FetchRetryHeadersStrategy, FetchRetryOptions, FetchRetryStrategy, FetchTimeoutOptions, GetBatchResponseBody, GetDeploymentResponseBody, GetEnvironmentVariablesResponseBody, type GetPersonalAccessTokenRequest, GetPersonalAccessTokenRequestSchema, type GetPersonalAccessTokenResponse, GetPersonalAccessTokenResponseSchema, GetProjectEnvResponse, GetProjectResponseBody, GetProjectsResponseBody, type IOPacket, ImageDetailsMetadata, InitializeDeploymentRequestBody, InitializeDeploymentResponseBody, InternalServerError, ListScheduleOptions, ListSchedulesResult, NULL_SENTINEL, NotFoundError, OFFLOAD_IO_PACKET_LENGTH_LIMIT, OTEL_ATTRIBUTE_PER_EVENT_COUNT_LIMIT, OTEL_ATTRIBUTE_PER_LINK_COUNT_LIMIT, OTEL_LINK_COUNT_LIMIT, OTEL_LOG_ATTRIBUTE_COUNT_LIMIT, OTEL_LOG_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_SPAN_EVENT_COUNT_LIMIT, OtherSpanEvent, PRIMARY_VARIANT, PermissionDeniedError, Prettify, RateLimitError, ReplayRunResponse, RetrieveRunResponse, RetryOptions, RunStatus, ScheduleObject, ScheduledTaskPayload, SemanticInternalAttributes, SpanEvent, SpanEvents, SpanMessagingEvent, StartDeploymentIndexingRequestBody, StartDeploymentIndexingResponseBody, TaskEventStyle, TaskFileMetadata, TaskMetadataWithFilePath, TaskMetadataWithFunctions, TaskResource, TaskRunContext, TaskRunError, TaskRunExecutionResult, type TriggerOptions, TriggerTaskRequestBody, TriggerTaskResponse, TriggerTracer, UnprocessableEntityError, UpdateScheduleOptions, Variant, type WhoAmIResponse, WhoAmIResponseSchema, accessoryAttributes, apiClientManager, calculateNextRetryDelay, calculateResetAt, clock, conditionallyExportPacket, conditionallyImportPacket, correctErrorStackTrace, createErrorTaskError, createPacketAttributes, createPacketAttributesAsJson, defaultFetchRetryOptions, defaultRetryOptions, detectDependencyVersion, flattenAttributes, formatDuration, formatDurationInDays, formatDurationMilliseconds, formatDurationNanoseconds, groupTaskMetadataIssuesByTask, imposeAttributeLimits, isCancellationSpanEvent, isExceptionSpanEvent, logger, millisecondsToNanoseconds, nanosecondsToMilliseconds, omit, packetRequiresOffloading, parseError, parsePacket, prettyPrintPacket, primitiveValueOrflattenedAttributes, runtime, stringPatternMatchers, stringifyIO, taskCatalog, taskContext, unflattenAttributes };
4514
+ export { APIConnectionError, APIError, type APIHeaders, Accessory, ApiClient, type ApiClientConfiguration, AttemptStatus, AuthenticationError, BackgroundWorkerMetadata, BackgroundWorkerProperties, BadRequestError, BatchTaskRunExecutionResult, BatchTriggerTaskRequestBody, BatchTriggerTaskResponse, CanceledRunResponse, CancellationSpanEvent, ConflictError, type CreateAuthorizationCodeResponse, CreateAuthorizationCodeResponseSchema, CreateBackgroundWorkerRequestBody, CreateBackgroundWorkerResponse, CreateScheduleOptions, CreateUploadPayloadUrlResponseBody, DeletedScheduleObject, DeploymentErrorData, EventFilter, ExceptionEventProperties, ExceptionSpanEvent, ExternalBuildData, FetchRetryBackoffStrategy, FetchRetryByStatusOptions, FetchRetryHeadersStrategy, FetchRetryOptions, FetchRetryStrategy, FetchTimeoutOptions, GetBatchResponseBody, GetDeploymentResponseBody, GetEnvironmentVariablesResponseBody, type GetPersonalAccessTokenRequest, GetPersonalAccessTokenRequestSchema, type GetPersonalAccessTokenResponse, GetPersonalAccessTokenResponseSchema, GetProjectEnvResponse, GetProjectResponseBody, GetProjectsResponseBody, type IOPacket, ImageDetailsMetadata, InitializeDeploymentRequestBody, InitializeDeploymentResponseBody, InternalServerError, ListScheduleOptions, ListSchedulesResult, NULL_SENTINEL, NotFoundError, OFFLOAD_IO_PACKET_LENGTH_LIMIT, OTEL_ATTRIBUTE_PER_EVENT_COUNT_LIMIT, OTEL_ATTRIBUTE_PER_LINK_COUNT_LIMIT, OTEL_LINK_COUNT_LIMIT, OTEL_LOG_ATTRIBUTE_COUNT_LIMIT, OTEL_LOG_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_SPAN_EVENT_COUNT_LIMIT, OtherSpanEvent, PRIMARY_VARIANT, PermissionDeniedError, Prettify, RateLimitError, ReplayRunResponse, RetrieveRunResponse, RetryOptions, RunStatus, ScheduleObject, ScheduledTaskPayload, SemanticInternalAttributes, SpanEvent, SpanEvents, SpanMessagingEvent, StartDeploymentIndexingRequestBody, StartDeploymentIndexingResponseBody, TaskEventStyle, TaskFileMetadata, TaskMetadataWithFilePath, TaskMetadataWithFunctions, TaskResource, TaskRunContext, TaskRunError, TaskRunExecutionResult, type TriggerOptions, TriggerTaskRequestBody, TriggerTaskResponse, TriggerTracer, UnprocessableEntityError, UpdateScheduleOptions, Variant, type WhoAmIResponse, WhoAmIResponseSchema, accessoryAttributes, apiClientManager, calculateNextRetryDelay, calculateResetAt, clock, conditionallyExportPacket, conditionallyImportPacket, correctErrorStackTrace, createErrorTaskError, createJsonErrorObject, createPacketAttributes, createPacketAttributesAsJson, defaultFetchRetryOptions, defaultRetryOptions, detectDependencyVersion, flattenAttributes, formatDuration, formatDurationInDays, formatDurationMilliseconds, formatDurationNanoseconds, groupTaskMetadataIssuesByTask, imposeAttributeLimits, isCancellationSpanEvent, isExceptionSpanEvent, logger, millisecondsToNanoseconds, nanosecondsToMilliseconds, omit, packetRequiresOffloading, parseError, parsePacket, prettyPrintPacket, primitiveValueOrflattenedAttributes, runtime, stringPatternMatchers, stringifyIO, taskCatalog, taskContext, unflattenAttributes };
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
2
  import { T as TaskRunExecutionResult, B as BatchTaskRunExecutionResult, a as TaskRunError, b as TaskRunContext, R as RuntimeManager } from '../manager-WNMVbgHf.js';
3
3
  export { h as TaskRun, c as TaskRunBuiltInError, d as TaskRunCustomErrorObject, f as TaskRunErrorCodes, p as TaskRunExecution, j as TaskRunExecutionAttempt, o as TaskRunExecutionBatch, k as TaskRunExecutionEnvironment, l as TaskRunExecutionOrganization, m as TaskRunExecutionProject, n as TaskRunExecutionQueue, q as TaskRunExecutionRetry, i as TaskRunExecutionTask, r as TaskRunFailedExecutionResult, g as TaskRunInternalError, e as TaskRunStringError, s as TaskRunSuccessfulExecutionResult } from '../manager-WNMVbgHf.js';
4
- import { P as Prettify, C as Clock, a as ClockTime, T as TaskLogger, b as TaskCatalog, c as TaskMetadataWithFunctions, d as TaskFileMetadata, e as TaskMetadataWithFilePath, R as RetryOptions, f as TriggerTracer } from '../catalog-akmn1vqt.js';
5
- export { p as Config, v as Context, E as EnvironmentType, x as FailureFnParams, F as FixedWindowRateLimit, A as HandleErrorArgs, H as HandleErrorFnParams, B as HandleErrorFunction, y as HandleErrorModificationOptions, z as HandleErrorResult, t as InitFnParams, I as InitOutput, L as LogLevel, h as Machine, M as MachineCpu, g as MachineMemory, s as MiddlewareFnParams, n as PostStartCauses, o as PreStopCauses, j as ProdTaskRunExecution, k as ProdTaskRunExecutionPayload, G as ProjectConfig, Q as QueueOptions, l as RateLimitOptions, D as RequireKeys, q as ResolvedConfig, r as RunFnParams, S as SlidingWindowRateLimit, u as StartFnParams, w as SuccessFnParams, m as TaskMetadata, i as TaskRunExecutionPayload, W as WaitReason } from '../catalog-akmn1vqt.js';
4
+ import { P as Prettify, C as Clock, a as ClockTime, T as TaskLogger, b as TaskCatalog, c as TaskMetadataWithFunctions, d as TaskFileMetadata, e as TaskMetadataWithFilePath, R as RetryOptions, f as TriggerTracer } from '../catalog-KbyTBoap.js';
5
+ export { p as Config, v as Context, E as EnvironmentType, x as FailureFnParams, F as FixedWindowRateLimit, A as HandleErrorArgs, H as HandleErrorFnParams, B as HandleErrorFunction, y as HandleErrorModificationOptions, z as HandleErrorResult, t as InitFnParams, I as InitOutput, L as LogLevel, h as Machine, M as MachineCpu, g as MachineMemory, s as MiddlewareFnParams, n as PostStartCauses, o as PreStopCauses, j as ProdTaskRunExecution, k as ProdTaskRunExecutionPayload, G as ProjectConfig, Q as QueueOptions, l as RateLimitOptions, D as RequireKeys, q as ResolvedConfig, r as RunFnParams, S as SlidingWindowRateLimit, u as StartFnParams, w as SuccessFnParams, m as TaskMetadata, i as TaskRunExecutionPayload, W as WaitReason } from '../catalog-KbyTBoap.js';
6
6
  import { Attributes, Span } from '@opentelemetry/api';
7
7
  import { B as BackgroundWorkerProperties } from '../messages-vq7Bk4Ap.js';
8
8
  export { b as BackgroundWorkerClientMessages, a as BackgroundWorkerServerMessages, i as ClientToSharedQueueMessages, C as CoordinatorToPlatformMessages, k as CoordinatorToProdWorkerMessages, h as PlatformToCoordinatorMessages, g as PlatformToProviderMessages, P as ProdChildToWorkerMessages, l as ProdWorkerSocketData, e as ProdWorkerToChildMessages, j as ProdWorkerToCoordinatorMessages, f as ProviderToPlatformMessages, S as SharedQueueToClientMessages, T as TaskMetadataFailedToParseData, U as UncaughtExceptionMessage, d as childToWorkerMessages, c as clientWebsocketMessages, s as serverWebsocketMessages, w as workerToChildMessages } from '../messages-vq7Bk4Ap.js';
@@ -1715,10 +1715,13 @@ declare const GetEnvironmentVariablesResponseBody: z.ZodObject<{
1715
1715
  type GetEnvironmentVariablesResponseBody = z.infer<typeof GetEnvironmentVariablesResponseBody>;
1716
1716
  declare const StartDeploymentIndexingRequestBody: z.ZodObject<{
1717
1717
  imageReference: z.ZodString;
1718
+ selfHosted: z.ZodOptional<z.ZodBoolean>;
1718
1719
  }, "strip", z.ZodTypeAny, {
1719
1720
  imageReference: string;
1721
+ selfHosted?: boolean | undefined;
1720
1722
  }, {
1721
1723
  imageReference: string;
1724
+ selfHosted?: boolean | undefined;
1722
1725
  }>;
1723
1726
  type StartDeploymentIndexingRequestBody = z.infer<typeof StartDeploymentIndexingRequestBody>;
1724
1727
  declare const StartDeploymentIndexingResponseBody: z.ZodObject<{
@@ -4186,19 +4189,6 @@ declare class ApiClient {
4186
4189
  id: string;
4187
4190
  }>;
4188
4191
  }
4189
- type ApiClientContext = {
4190
- baseURL: string;
4191
- accessToken: string;
4192
- };
4193
- declare class ApiClientManager {
4194
- #private;
4195
- private _storage;
4196
- get baseURL(): string | undefined;
4197
- get accessToken(): string | undefined;
4198
- get client(): ApiClient | undefined;
4199
- runWith<R extends (...args: any[]) => Promise<any>>(context: ApiClientContext, fn: R): Promise<ReturnType<R>>;
4200
- }
4201
- declare const apiClientManager: ApiClientManager;
4202
4192
 
4203
4193
  type APIHeaders = Record<string, string | null | undefined>;
4204
4194
  declare class APIError extends Error {
@@ -4258,6 +4248,15 @@ declare const clock: ClockAPI;
4258
4248
 
4259
4249
  declare function parseError(error: unknown): TaskRunError;
4260
4250
  declare function createErrorTaskError(error: TaskRunError): any;
4251
+ declare function createJsonErrorObject(error: TaskRunError): {
4252
+ name: string;
4253
+ message: string;
4254
+ stackTrace: string;
4255
+ } | {
4256
+ message: string;
4257
+ name?: undefined;
4258
+ stackTrace?: undefined;
4259
+ };
4261
4260
  declare function correctErrorStackTrace(stackTrace: string, projectDir?: string, options?: {
4262
4261
  removeFirstLine?: boolean;
4263
4262
  }): string;
@@ -4346,6 +4345,26 @@ declare class TaskContextAPI {
4346
4345
  /** Entrypoint for logger API */
4347
4346
  declare const taskContext: TaskContextAPI;
4348
4347
 
4348
+ type ApiClientConfiguration = {
4349
+ baseURL?: string;
4350
+ secretKey?: string;
4351
+ };
4352
+
4353
+ declare class APIClientManagerAPI {
4354
+ #private;
4355
+ private static _instance?;
4356
+ private constructor();
4357
+ static getInstance(): APIClientManagerAPI;
4358
+ disable(): void;
4359
+ setGlobalAPIClientConfiguration(config: ApiClientConfiguration): boolean;
4360
+ get baseURL(): string | undefined;
4361
+ get accessToken(): string | undefined;
4362
+ get client(): ApiClient | undefined;
4363
+ }
4364
+
4365
+ /** Entrypoint for logger API */
4366
+ declare const apiClientManager: APIClientManagerAPI;
4367
+
4349
4368
  declare const SemanticInternalAttributes: {
4350
4369
  ENVIRONMENT_ID: string;
4351
4370
  ENVIRONMENT_TYPE: string;
@@ -4492,4 +4511,4 @@ declare function createPacketAttributes(packet: IOPacket, dataKey: string, dataT
4492
4511
  declare function createPacketAttributesAsJson(data: any, dataType: string): Promise<Attributes>;
4493
4512
  declare function prettyPrintPacket(rawData: any, dataType?: string): Promise<string>;
4494
4513
 
4495
- export { APIConnectionError, APIError, type APIHeaders, Accessory, ApiClient, ApiClientManager, AttemptStatus, AuthenticationError, BackgroundWorkerMetadata, BackgroundWorkerProperties, BadRequestError, BatchTaskRunExecutionResult, BatchTriggerTaskRequestBody, BatchTriggerTaskResponse, CanceledRunResponse, CancellationSpanEvent, ConflictError, type CreateAuthorizationCodeResponse, CreateAuthorizationCodeResponseSchema, CreateBackgroundWorkerRequestBody, CreateBackgroundWorkerResponse, CreateScheduleOptions, CreateUploadPayloadUrlResponseBody, DeletedScheduleObject, DeploymentErrorData, EventFilter, ExceptionEventProperties, ExceptionSpanEvent, ExternalBuildData, FetchRetryBackoffStrategy, FetchRetryByStatusOptions, FetchRetryHeadersStrategy, FetchRetryOptions, FetchRetryStrategy, FetchTimeoutOptions, GetBatchResponseBody, GetDeploymentResponseBody, GetEnvironmentVariablesResponseBody, type GetPersonalAccessTokenRequest, GetPersonalAccessTokenRequestSchema, type GetPersonalAccessTokenResponse, GetPersonalAccessTokenResponseSchema, GetProjectEnvResponse, GetProjectResponseBody, GetProjectsResponseBody, type IOPacket, ImageDetailsMetadata, InitializeDeploymentRequestBody, InitializeDeploymentResponseBody, InternalServerError, ListScheduleOptions, ListSchedulesResult, NULL_SENTINEL, NotFoundError, OFFLOAD_IO_PACKET_LENGTH_LIMIT, OTEL_ATTRIBUTE_PER_EVENT_COUNT_LIMIT, OTEL_ATTRIBUTE_PER_LINK_COUNT_LIMIT, OTEL_LINK_COUNT_LIMIT, OTEL_LOG_ATTRIBUTE_COUNT_LIMIT, OTEL_LOG_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_SPAN_EVENT_COUNT_LIMIT, OtherSpanEvent, PRIMARY_VARIANT, PermissionDeniedError, Prettify, RateLimitError, ReplayRunResponse, RetrieveRunResponse, RetryOptions, RunStatus, ScheduleObject, ScheduledTaskPayload, SemanticInternalAttributes, SpanEvent, SpanEvents, SpanMessagingEvent, StartDeploymentIndexingRequestBody, StartDeploymentIndexingResponseBody, TaskEventStyle, TaskFileMetadata, TaskMetadataWithFilePath, TaskMetadataWithFunctions, TaskResource, TaskRunContext, TaskRunError, TaskRunExecutionResult, type TriggerOptions, TriggerTaskRequestBody, TriggerTaskResponse, TriggerTracer, UnprocessableEntityError, UpdateScheduleOptions, Variant, type WhoAmIResponse, WhoAmIResponseSchema, accessoryAttributes, apiClientManager, calculateNextRetryDelay, calculateResetAt, clock, conditionallyExportPacket, conditionallyImportPacket, correctErrorStackTrace, createErrorTaskError, createPacketAttributes, createPacketAttributesAsJson, defaultFetchRetryOptions, defaultRetryOptions, detectDependencyVersion, flattenAttributes, formatDuration, formatDurationInDays, formatDurationMilliseconds, formatDurationNanoseconds, groupTaskMetadataIssuesByTask, imposeAttributeLimits, isCancellationSpanEvent, isExceptionSpanEvent, logger, millisecondsToNanoseconds, nanosecondsToMilliseconds, omit, packetRequiresOffloading, parseError, parsePacket, prettyPrintPacket, primitiveValueOrflattenedAttributes, runtime, stringPatternMatchers, stringifyIO, taskCatalog, taskContext, unflattenAttributes };
4514
+ export { APIConnectionError, APIError, type APIHeaders, Accessory, ApiClient, type ApiClientConfiguration, AttemptStatus, AuthenticationError, BackgroundWorkerMetadata, BackgroundWorkerProperties, BadRequestError, BatchTaskRunExecutionResult, BatchTriggerTaskRequestBody, BatchTriggerTaskResponse, CanceledRunResponse, CancellationSpanEvent, ConflictError, type CreateAuthorizationCodeResponse, CreateAuthorizationCodeResponseSchema, CreateBackgroundWorkerRequestBody, CreateBackgroundWorkerResponse, CreateScheduleOptions, CreateUploadPayloadUrlResponseBody, DeletedScheduleObject, DeploymentErrorData, EventFilter, ExceptionEventProperties, ExceptionSpanEvent, ExternalBuildData, FetchRetryBackoffStrategy, FetchRetryByStatusOptions, FetchRetryHeadersStrategy, FetchRetryOptions, FetchRetryStrategy, FetchTimeoutOptions, GetBatchResponseBody, GetDeploymentResponseBody, GetEnvironmentVariablesResponseBody, type GetPersonalAccessTokenRequest, GetPersonalAccessTokenRequestSchema, type GetPersonalAccessTokenResponse, GetPersonalAccessTokenResponseSchema, GetProjectEnvResponse, GetProjectResponseBody, GetProjectsResponseBody, type IOPacket, ImageDetailsMetadata, InitializeDeploymentRequestBody, InitializeDeploymentResponseBody, InternalServerError, ListScheduleOptions, ListSchedulesResult, NULL_SENTINEL, NotFoundError, OFFLOAD_IO_PACKET_LENGTH_LIMIT, OTEL_ATTRIBUTE_PER_EVENT_COUNT_LIMIT, OTEL_ATTRIBUTE_PER_LINK_COUNT_LIMIT, OTEL_LINK_COUNT_LIMIT, OTEL_LOG_ATTRIBUTE_COUNT_LIMIT, OTEL_LOG_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_SPAN_EVENT_COUNT_LIMIT, OtherSpanEvent, PRIMARY_VARIANT, PermissionDeniedError, Prettify, RateLimitError, ReplayRunResponse, RetrieveRunResponse, RetryOptions, RunStatus, ScheduleObject, ScheduledTaskPayload, SemanticInternalAttributes, SpanEvent, SpanEvents, SpanMessagingEvent, StartDeploymentIndexingRequestBody, StartDeploymentIndexingResponseBody, TaskEventStyle, TaskFileMetadata, TaskMetadataWithFilePath, TaskMetadataWithFunctions, TaskResource, TaskRunContext, TaskRunError, TaskRunExecutionResult, type TriggerOptions, TriggerTaskRequestBody, TriggerTaskResponse, TriggerTracer, UnprocessableEntityError, UpdateScheduleOptions, Variant, type WhoAmIResponse, WhoAmIResponseSchema, accessoryAttributes, apiClientManager, calculateNextRetryDelay, calculateResetAt, clock, conditionallyExportPacket, conditionallyImportPacket, correctErrorStackTrace, createErrorTaskError, createJsonErrorObject, createPacketAttributes, createPacketAttributesAsJson, defaultFetchRetryOptions, defaultRetryOptions, detectDependencyVersion, flattenAttributes, formatDuration, formatDurationInDays, formatDurationMilliseconds, formatDurationNanoseconds, groupTaskMetadataIssuesByTask, imposeAttributeLimits, isCancellationSpanEvent, isExceptionSpanEvent, logger, millisecondsToNanoseconds, nanosecondsToMilliseconds, omit, packetRequiresOffloading, parseError, parsePacket, prettyPrintPacket, primitiveValueOrflattenedAttributes, runtime, stringPatternMatchers, stringifyIO, taskCatalog, taskContext, unflattenAttributes };
package/dist/v3/index.js CHANGED
@@ -3,7 +3,6 @@
3
3
  var api = require('@opentelemetry/api');
4
4
  var zodValidationError = require('zod-validation-error');
5
5
  var zod = require('zod');
6
- var async_hooks = require('async_hooks');
7
6
  var preciseDate = require('@google-cloud/precise-date');
8
7
  var apiLogs = require('@opentelemetry/api-logs');
9
8
  var humanizeDuration = require('humanize-duration');
@@ -865,7 +864,8 @@ var GetEnvironmentVariablesResponseBody = zod.z.object({
865
864
  variables: zod.z.record(zod.z.string())
866
865
  });
867
866
  var StartDeploymentIndexingRequestBody = zod.z.object({
868
- imageReference: zod.z.string()
867
+ imageReference: zod.z.string(),
868
+ selfHosted: zod.z.boolean().optional()
869
869
  });
870
870
  var StartDeploymentIndexingResponseBody = zod.z.object({
871
871
  id: zod.z.string(),
@@ -2106,27 +2106,6 @@ var TaskContextAPI = _TaskContextAPI;
2106
2106
  // src/v3/task-context-api.ts
2107
2107
  var taskContext = TaskContextAPI.getInstance();
2108
2108
 
2109
- // src/v3/utils/getEnv.ts
2110
- function getEnvVar(name) {
2111
- if (typeof process !== "undefined" && typeof process.env === "object" && process.env !== null) {
2112
- return process.env[name];
2113
- }
2114
- }
2115
- __name(getEnvVar, "getEnvVar");
2116
- var _SafeAsyncLocalStorage = class _SafeAsyncLocalStorage {
2117
- constructor() {
2118
- this.storage = new async_hooks.AsyncLocalStorage();
2119
- }
2120
- runWith(context3, fn) {
2121
- return this.storage.run(context3, fn);
2122
- }
2123
- getStore() {
2124
- return this.storage.getStore();
2125
- }
2126
- };
2127
- __name(_SafeAsyncLocalStorage, "SafeAsyncLocalStorage");
2128
- var SafeAsyncLocalStorage = _SafeAsyncLocalStorage;
2129
-
2130
2109
  // src/v3/apiClient/index.ts
2131
2110
  var zodFetchOptions = {
2132
2111
  retry: {
@@ -2277,37 +2256,6 @@ getHeaders_fn = /* @__PURE__ */ __name(function(spanParentAsLink) {
2277
2256
  }, "#getHeaders");
2278
2257
  __name(_ApiClient, "ApiClient");
2279
2258
  var ApiClient = _ApiClient;
2280
- var _getStore, getStore_fn;
2281
- var _ApiClientManager = class _ApiClientManager {
2282
- constructor() {
2283
- __privateAdd(this, _getStore);
2284
- __publicField(this, "_storage", new SafeAsyncLocalStorage());
2285
- }
2286
- get baseURL() {
2287
- const store = __privateMethod(this, _getStore, getStore_fn).call(this);
2288
- return store?.baseURL ?? getEnvVar("TRIGGER_API_URL") ?? "https://api.trigger.dev";
2289
- }
2290
- get accessToken() {
2291
- const store = __privateMethod(this, _getStore, getStore_fn).call(this);
2292
- return store?.accessToken ?? getEnvVar("TRIGGER_SECRET_KEY");
2293
- }
2294
- get client() {
2295
- if (!this.baseURL || !this.accessToken) {
2296
- return void 0;
2297
- }
2298
- return new ApiClient(this.baseURL, this.accessToken);
2299
- }
2300
- runWith(context3, fn) {
2301
- return this._storage.runWith(context3, fn);
2302
- }
2303
- };
2304
- _getStore = new WeakSet();
2305
- getStore_fn = /* @__PURE__ */ __name(function() {
2306
- return this._storage.getStore();
2307
- }, "#getStore");
2308
- __name(_ApiClientManager, "ApiClientManager");
2309
- var ApiClientManager = _ApiClientManager;
2310
- var apiClientManager = new ApiClientManager();
2311
2259
  var _SimpleClock = class _SimpleClock {
2312
2260
  preciseNow() {
2313
2261
  const now = new preciseDate.PreciseDate();
@@ -2406,6 +2354,33 @@ function createErrorTaskError(error) {
2406
2354
  }
2407
2355
  }
2408
2356
  __name(createErrorTaskError, "createErrorTaskError");
2357
+ function createJsonErrorObject(error) {
2358
+ switch (error.type) {
2359
+ case "BUILT_IN_ERROR": {
2360
+ return {
2361
+ name: error.name,
2362
+ message: error.message,
2363
+ stackTrace: error.stackTrace
2364
+ };
2365
+ }
2366
+ case "STRING_ERROR": {
2367
+ return {
2368
+ message: error.raw
2369
+ };
2370
+ }
2371
+ case "CUSTOM_ERROR": {
2372
+ return {
2373
+ message: error.raw
2374
+ };
2375
+ }
2376
+ case "INTERNAL_ERROR": {
2377
+ return {
2378
+ message: `trigger.dev internal error (${error.code})`
2379
+ };
2380
+ }
2381
+ }
2382
+ }
2383
+ __name(createJsonErrorObject, "createJsonErrorObject");
2409
2384
  function correctErrorStackTrace(stackTrace, projectDir, options) {
2410
2385
  const [errorLine, ...traceLines] = stackTrace.split("\n");
2411
2386
  return [
@@ -2775,6 +2750,58 @@ var RuntimeAPI = _RuntimeAPI;
2775
2750
  // src/v3/runtime-api.ts
2776
2751
  var runtime = RuntimeAPI.getInstance();
2777
2752
 
2753
+ // src/v3/utils/getEnv.ts
2754
+ function getEnvVar(name) {
2755
+ if (typeof process !== "undefined" && typeof process.env === "object" && process.env !== null) {
2756
+ return process.env[name];
2757
+ }
2758
+ }
2759
+ __name(getEnvVar, "getEnvVar");
2760
+
2761
+ // src/v3/apiClientManager/index.ts
2762
+ var API_NAME5 = "api-client";
2763
+ var _getConfig, getConfig_fn;
2764
+ var _APIClientManagerAPI = class _APIClientManagerAPI {
2765
+ constructor() {
2766
+ __privateAdd(this, _getConfig);
2767
+ }
2768
+ static getInstance() {
2769
+ if (!this._instance) {
2770
+ this._instance = new _APIClientManagerAPI();
2771
+ }
2772
+ return this._instance;
2773
+ }
2774
+ disable() {
2775
+ unregisterGlobal(API_NAME5);
2776
+ }
2777
+ setGlobalAPIClientConfiguration(config) {
2778
+ return registerGlobal(API_NAME5, config);
2779
+ }
2780
+ get baseURL() {
2781
+ const store = __privateMethod(this, _getConfig, getConfig_fn).call(this);
2782
+ return store?.baseURL ?? getEnvVar("TRIGGER_API_URL") ?? "https://api.trigger.dev";
2783
+ }
2784
+ get accessToken() {
2785
+ const store = __privateMethod(this, _getConfig, getConfig_fn).call(this);
2786
+ return store?.secretKey ?? getEnvVar("TRIGGER_SECRET_KEY");
2787
+ }
2788
+ get client() {
2789
+ if (!this.baseURL || !this.accessToken) {
2790
+ return void 0;
2791
+ }
2792
+ return new ApiClient(this.baseURL, this.accessToken);
2793
+ }
2794
+ };
2795
+ _getConfig = new WeakSet();
2796
+ getConfig_fn = /* @__PURE__ */ __name(function() {
2797
+ return getGlobal(API_NAME5);
2798
+ }, "#getConfig");
2799
+ __name(_APIClientManagerAPI, "APIClientManagerAPI");
2800
+ var APIClientManagerAPI = _APIClientManagerAPI;
2801
+
2802
+ // src/v3/apiClientManager-api.ts
2803
+ var apiClientManager = APIClientManagerAPI.getInstance();
2804
+
2778
2805
  // src/v3/task-catalog/noopTaskCatalog.ts
2779
2806
  var _NoopTaskCatalog = class _NoopTaskCatalog {
2780
2807
  registerTaskMetadata(task) {
@@ -2802,7 +2829,7 @@ __name(_NoopTaskCatalog, "NoopTaskCatalog");
2802
2829
  var NoopTaskCatalog = _NoopTaskCatalog;
2803
2830
 
2804
2831
  // src/v3/task-catalog/index.ts
2805
- var API_NAME5 = "task-catalog";
2832
+ var API_NAME6 = "task-catalog";
2806
2833
  var NOOP_TASK_CATALOG = new NoopTaskCatalog();
2807
2834
  var _getCatalog, getCatalog_fn;
2808
2835
  var _TaskCatalogAPI = class _TaskCatalogAPI {
@@ -2816,10 +2843,10 @@ var _TaskCatalogAPI = class _TaskCatalogAPI {
2816
2843
  return this._instance;
2817
2844
  }
2818
2845
  setGlobalTaskCatalog(taskCatalog2) {
2819
- return registerGlobal(API_NAME5, taskCatalog2);
2846
+ return registerGlobal(API_NAME6, taskCatalog2);
2820
2847
  }
2821
2848
  disable() {
2822
- unregisterGlobal(API_NAME5);
2849
+ unregisterGlobal(API_NAME6);
2823
2850
  }
2824
2851
  registerTaskMetadata(task) {
2825
2852
  __privateMethod(this, _getCatalog, getCatalog_fn).call(this).registerTaskMetadata(task);
@@ -2845,7 +2872,7 @@ var _TaskCatalogAPI = class _TaskCatalogAPI {
2845
2872
  };
2846
2873
  _getCatalog = new WeakSet();
2847
2874
  getCatalog_fn = /* @__PURE__ */ __name(function() {
2848
- return getGlobal(API_NAME5) ?? NOOP_TASK_CATALOG;
2875
+ return getGlobal(API_NAME6) ?? NOOP_TASK_CATALOG;
2849
2876
  }, "#getCatalog");
2850
2877
  __name(_TaskCatalogAPI, "TaskCatalogAPI");
2851
2878
  var TaskCatalogAPI = _TaskCatalogAPI;
@@ -3474,7 +3501,6 @@ __name(safeJsonParse2, "safeJsonParse");
3474
3501
  exports.APIConnectionError = APIConnectionError;
3475
3502
  exports.APIError = APIError;
3476
3503
  exports.ApiClient = ApiClient;
3477
- exports.ApiClientManager = ApiClientManager;
3478
3504
  exports.AttemptStatus = AttemptStatus;
3479
3505
  exports.AuthenticationError = AuthenticationError;
3480
3506
  exports.BackgroundWorkerClientMessages = BackgroundWorkerClientMessages;
@@ -3616,6 +3642,7 @@ exports.conditionallyExportPacket = conditionallyExportPacket;
3616
3642
  exports.conditionallyImportPacket = conditionallyImportPacket;
3617
3643
  exports.correctErrorStackTrace = correctErrorStackTrace;
3618
3644
  exports.createErrorTaskError = createErrorTaskError;
3645
+ exports.createJsonErrorObject = createJsonErrorObject;
3619
3646
  exports.createPacketAttributes = createPacketAttributes;
3620
3647
  exports.createPacketAttributesAsJson = createPacketAttributesAsJson;
3621
3648
  exports.defaultFetchRetryOptions = defaultFetchRetryOptions;