v3: Various fixes for Next.js projects and projects that use v2 and v3 together (#1051)
* Fixes an issue that was treating v2 trigger directories as v3 * Make msw a normal dependency (for now) to fix Module Not Found error in Next.js. * Extract out all the zod* stuff from core so the SDK does not import it * Add a changeset * Fixing typecheck errors in the webapp * Export the Task and TaskOptions types * Extract additional exports from core/v3 that aren’t used in the SDK * Move to our global system from AsyncLocalStorage for the current task context storage * Update the esbuild core bundling plugin for the new core v3 exports * Fix v3 CLI telemetry * Add support for tasks located in subdirectories inside trigger dirs * Remove the env var check during deploy (too many false negatives)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"trigger.dev": patch
|
||||
---
|
||||
|
||||
Remove the env var check during deploy (too many false negatives)
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
"@trigger.dev/sdk": patch
|
||||
---
|
||||
|
||||
Make msw a normal dependency (for now) to fix Module Not Found error in Next.js.
|
||||
|
||||
It turns out that webpack will "hoist" dynamically imported modules and attempt to resolve them at build time, even though it's an optional peer dep:
|
||||
|
||||
https://x.com/maverickdotdev/status/1782465214308319404
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"trigger.dev": patch
|
||||
---
|
||||
|
||||
Fixes an issue that was treating v2 trigger directories as v3
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
"@trigger.dev/sdk": patch
|
||||
"trigger.dev": patch
|
||||
"@trigger.dev/core": patch
|
||||
"@trigger.dev/cli": patch
|
||||
---
|
||||
|
||||
Move to our global system from AsyncLocalStorage for the current task context storage
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
"@trigger.dev/sdk": patch
|
||||
"@trigger.dev/core-apps": patch
|
||||
"trigger.dev": patch
|
||||
"@trigger.dev/core": patch
|
||||
---
|
||||
|
||||
Extracting out all the non-SDK related features from the main @trigger.dev/core/v3 export
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"trigger.dev": patch
|
||||
"@trigger.dev/cli": patch
|
||||
---
|
||||
|
||||
Add support for tasks located in subdirectories inside trigger dirs
|
||||
@@ -21,8 +21,8 @@
|
||||
"execa": "^8.0.1",
|
||||
"nanoid": "^5.0.6",
|
||||
"prom-client": "^15.1.0",
|
||||
"socket.io": "^4.7.4",
|
||||
"socket.io-client": "^4.7.4"
|
||||
"socket.io": "4.7.4",
|
||||
"socket.io-client": "4.7.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18",
|
||||
|
||||
@@ -8,9 +8,9 @@ import {
|
||||
PlatformToCoordinatorMessages,
|
||||
ProdWorkerSocketData,
|
||||
ProdWorkerToCoordinatorMessages,
|
||||
ZodNamespace,
|
||||
ZodSocketConnection,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import { ZodNamespace } from "@trigger.dev/core/v3/zodNamespace";
|
||||
import { ZodSocketConnection } from "@trigger.dev/core/v3/zodSocket";
|
||||
import { HttpReply, getTextBody, SimpleLogger } from "@trigger.dev/core-apps";
|
||||
|
||||
import { collectDefaultMetrics, register, Gauge } from "prom-client";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ActionFunctionArgs } from "@remix-run/server-runtime";
|
||||
import { json } from "@remix-run/server-runtime";
|
||||
import { parseBatchTriggerTaskRequestBody } from "@trigger.dev/core/v3";
|
||||
import { BatchTriggerTaskRequestBody } from "@trigger.dev/core/v3";
|
||||
import { z } from "zod";
|
||||
import { MAX_BATCH_TRIGGER_ITEMS } from "~/consts";
|
||||
import { authenticateApiRequest } from "~/services/apiAuth.server";
|
||||
@@ -46,7 +46,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
|
||||
// Now parse the request body
|
||||
const anyBody = await request.json();
|
||||
|
||||
const body = parseBatchTriggerTaskRequestBody(anyBody);
|
||||
const body = BatchTriggerTaskRequestBody.safeParse(anyBody);
|
||||
|
||||
if (!body.success) {
|
||||
return json({ error: "Invalid request body" }, { status: 400 });
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ActionFunctionArgs } from "@remix-run/server-runtime";
|
||||
import { json } from "@remix-run/server-runtime";
|
||||
import { parseTriggerTaskRequestBody } from "@trigger.dev/core/v3";
|
||||
import { TriggerTaskRequestBody } from "@trigger.dev/core/v3";
|
||||
import { z } from "zod";
|
||||
import { authenticateApiRequest } from "~/services/apiAuth.server";
|
||||
import { logger } from "~/services/logger.server";
|
||||
@@ -52,7 +52,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
|
||||
// Now parse the request body
|
||||
const anyBody = await request.json();
|
||||
|
||||
const body = parseTriggerTaskRequestBody(anyBody);
|
||||
const body = TriggerTaskRequestBody.safeParse(anyBody);
|
||||
|
||||
if (!body.success) {
|
||||
return json({ error: "Invalid request body" }, { status: 400 });
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import {
|
||||
ZodMessageHandler,
|
||||
ZodMessageSender,
|
||||
clientWebsocketMessages,
|
||||
serverWebsocketMessages,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import { clientWebsocketMessages, serverWebsocketMessages } from "@trigger.dev/core/v3";
|
||||
import { ZodMessageHandler, ZodMessageSender } from "@trigger.dev/core/v3/zodMessageHandler";
|
||||
import { Evt } from "evt";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import type { CloseEvent, ErrorEvent, MessageEvent, WebSocket } from "ws";
|
||||
|
||||
@@ -5,8 +5,8 @@ import {
|
||||
PlatformToProviderMessages,
|
||||
ProviderToPlatformMessages,
|
||||
SharedQueueToClientMessages,
|
||||
ZodNamespace,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import { ZodNamespace } from "@trigger.dev/core/v3/zodNamespace";
|
||||
import { Server } from "socket.io";
|
||||
import { env } from "~/env.server";
|
||||
import { singleton } from "~/utils/singleton";
|
||||
@@ -71,6 +71,7 @@ function initializeSocketIOServerInstance() {
|
||||
|
||||
function createCoordinatorNamespace(io: Server) {
|
||||
const coordinator = new ZodNamespace({
|
||||
// @ts-ignore - for some reason the built ZodNamespace Server type is not compatible with the Server type here, but only when doing typechecking
|
||||
io,
|
||||
name: "coordinator",
|
||||
authToken: env.COORDINATOR_SECRET,
|
||||
@@ -147,6 +148,7 @@ function createCoordinatorNamespace(io: Server) {
|
||||
|
||||
function createProviderNamespace(io: Server) {
|
||||
const provider = new ZodNamespace({
|
||||
// @ts-ignore - for some reason the built ZodNamespace Server type is not compatible with the Server type here, but only when doing typechecking
|
||||
io,
|
||||
name: "provider",
|
||||
authToken: env.PROVIDER_SECRET,
|
||||
@@ -181,6 +183,7 @@ function createProviderNamespace(io: Server) {
|
||||
|
||||
function createSharedQueueConsumerNamespace(io: Server) {
|
||||
const sharedQueue = new ZodNamespace({
|
||||
// @ts-ignore - for some reason the built ZodNamespace Server type is not compatible with the Server type here, but only when doing typechecking
|
||||
io,
|
||||
name: "shared-queue",
|
||||
authToken: env.PROVIDER_SECRET,
|
||||
@@ -188,7 +191,9 @@ function createSharedQueueConsumerNamespace(io: Server) {
|
||||
serverMessages: SharedQueueToClientMessages,
|
||||
onConnection: async (socket, handler, sender, logger) => {
|
||||
const sharedSocketConnection = new SharedSocketConnection({
|
||||
// @ts-ignore - for some reason the built ZodNamespace Server type is not compatible with the Server type here, but only when doing typechecking
|
||||
namespace: sharedQueue.namespace,
|
||||
// @ts-ignore - for some reason the built ZodNamespace Server type is not compatible with the Server type here, but only when doing typechecking
|
||||
socket,
|
||||
logger,
|
||||
poolSize: env.SHARED_QUEUE_CONSUMER_POOL_SIZE,
|
||||
|
||||
@@ -3,9 +3,9 @@ import {
|
||||
TaskRunExecution,
|
||||
TaskRunExecutionPayload,
|
||||
TaskRunExecutionResult,
|
||||
ZodMessageSender,
|
||||
serverWebsocketMessages,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import { ZodMessageSender } from "@trigger.dev/core/v3/zodMessageHandler";
|
||||
import { BackgroundWorker, BackgroundWorkerTask } from "@trigger.dev/database";
|
||||
import { z } from "zod";
|
||||
import { prisma } from "~/db.server";
|
||||
|
||||
@@ -8,9 +8,9 @@ import {
|
||||
TaskRunExecutionResult,
|
||||
TaskRunFailedExecutionResult,
|
||||
TaskRunSuccessfulExecutionResult,
|
||||
ZodMessageSender,
|
||||
serverWebsocketMessages,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import { ZodMessageSender } from "@trigger.dev/core/v3/zodMessageHandler";
|
||||
import {
|
||||
BackgroundWorker,
|
||||
BackgroundWorkerTask,
|
||||
@@ -26,7 +26,6 @@ import { EnvironmentVariablesRepository } from "../environmentVariables/environm
|
||||
import { generateFriendlyId } from "../friendlyIdentifiers";
|
||||
import { socketIo } from "../handleSocketIo.server";
|
||||
import { findCurrentWorkerDeployment } from "../models/workerDeployment.server";
|
||||
import { CancelAttemptService } from "../services/cancelAttempt.server";
|
||||
import { RestoreCheckpointService } from "../services/restoreCheckpoint.server";
|
||||
import { tracer } from "../tracer.server";
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { CoordinatorToPlatformMessages, InferSocketMessageSchema } from "@trigger.dev/core/v3";
|
||||
import { CoordinatorToPlatformMessages } from "@trigger.dev/core/v3";
|
||||
import type { InferSocketMessageSchema } from "@trigger.dev/core/v3/zodSocket";
|
||||
import type {
|
||||
CheckpointRestoreEvent,
|
||||
TaskRunAttemptStatus,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
CoordinatorToPlatformMessages,
|
||||
InferSocketMessageSchema,
|
||||
TaskRunExecution,
|
||||
TaskRunExecutionResult,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import type { InferSocketMessageSchema } from "@trigger.dev/core/v3/zodSocket";
|
||||
import { $transaction, PrismaClientOrTransaction } from "~/db.server";
|
||||
import { logger } from "~/services/logger.server";
|
||||
import { marqs } from "~/v3/marqs/index.server";
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { clientWebsocketMessages, serverWebsocketMessages } from "@trigger.dev/core/v3";
|
||||
import {
|
||||
MessageCatalogToSocketIoEvents,
|
||||
StructuredLogger,
|
||||
ZodMessageHandler,
|
||||
ZodMessageSender,
|
||||
clientWebsocketMessages,
|
||||
serverWebsocketMessages,
|
||||
} from "@trigger.dev/core/v3";
|
||||
MessageCatalogToSocketIoEvents,
|
||||
} from "@trigger.dev/core/v3/zodMessageHandler";
|
||||
import type { StructuredLogger } from "@trigger.dev/core/v3/utils/structuredLogger";
|
||||
import { Evt } from "evt";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { logger } from "~/services/logger.server";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Logger } from "@trigger.dev/core-backend";
|
||||
import { ZodMessageCatalogSchema, ZodMessageHandler, ZodMessageSender } from "@trigger.dev/core/v3";
|
||||
import { ZodMessageCatalogSchema, ZodMessageHandler } from "@trigger.dev/core/v3/zodMessageHandler";
|
||||
import { Evt } from "evt";
|
||||
import Redis, { RedisOptions } from "ioredis";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
"simple-oauth2": "^5.0.0",
|
||||
"simplur": "^3.0.1",
|
||||
"slug": "^6.0.0",
|
||||
"socket.io": "^4.7.4",
|
||||
"socket.io": "4.7.4",
|
||||
"socket.io-adapter": "^2.5.4",
|
||||
"sonner": "^1.0.3",
|
||||
"sqs-consumer": "^7.4.0",
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -68,7 +68,8 @@
|
||||
"pnpm": {
|
||||
"patchedDependencies": {
|
||||
"@changesets/assemble-release-plan@5.2.4": "patches/@changesets__assemble-release-plan@5.2.4.patch",
|
||||
"tsup@8.0.1": "patches/tsup@8.0.1.patch"
|
||||
"tsup@8.0.1": "patches/tsup@8.0.1.patch",
|
||||
"engine.io-parser@5.2.2": "patches/engine.io-parser@5.2.2.patch"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { flattenAttributes, recordSpanException } from "@trigger.dev/core/v3";
|
||||
import { flattenAttributes } from "@trigger.dev/core/v3";
|
||||
import { recordSpanException } from "@trigger.dev/core/v3/workers";
|
||||
import { Command } from "commander";
|
||||
import { z } from "zod";
|
||||
import { getTracer, provider } from "../telemetry/tracing";
|
||||
|
||||
@@ -6,8 +6,8 @@ import {
|
||||
TaskMetadataFailedToParseData,
|
||||
detectDependencyVersion,
|
||||
flattenAttributes,
|
||||
recordSpanException,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import { recordSpanException } from "@trigger.dev/core/v3/workers";
|
||||
import chalk from "chalk";
|
||||
import { Command, Option as CommandOption } from "commander";
|
||||
import { Metafile, build } from "esbuild";
|
||||
@@ -63,7 +63,6 @@ import { docs, getInTouch } from "../utilities/links";
|
||||
const DeployCommandOptions = CommonCommandOptions.extend({
|
||||
skipTypecheck: z.boolean().default(false),
|
||||
skipDeploy: z.boolean().default(false),
|
||||
ignoreEnvVarCheck: z.boolean().default(false),
|
||||
env: z.enum(["prod", "staging"]),
|
||||
loadImage: z.boolean().default(false),
|
||||
buildPlatform: z.enum(["linux/amd64", "linux/arm64"]).default("linux/amd64"),
|
||||
@@ -93,10 +92,6 @@ export function configureDeployCommand(program: Command) {
|
||||
)
|
||||
.option("--skip-typecheck", "Whether to skip the pre-build typecheck")
|
||||
.option("--skip-update-check", "Skip checking for @trigger.dev package updates")
|
||||
.option(
|
||||
"--ignore-env-var-check",
|
||||
"Detected missing environment variables won't block deployment"
|
||||
)
|
||||
.option("-c, --config <config file>", "The name of the config file, found at [path]")
|
||||
.option(
|
||||
"-p, --project-ref <project ref>",
|
||||
@@ -127,6 +122,12 @@ export function configureDeployCommand(program: Command) {
|
||||
"(Coming soon) Specify the tag to use when pushing the image to the registry"
|
||||
).hideHelp()
|
||||
)
|
||||
.addOption(
|
||||
new CommandOption(
|
||||
"--ignore-env-var-check",
|
||||
"(deprecated) Detected missing environment variables won't block deployment"
|
||||
).hideHelp()
|
||||
)
|
||||
.addOption(new CommandOption("-D, --skip-deploy", "Skip deploying the image").hideHelp())
|
||||
.addOption(
|
||||
new CommandOption("--load-image", "Load the built image into your local docker").hideHelp()
|
||||
@@ -239,16 +240,6 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
|
||||
|
||||
logger.debug("Compilation result", { compilation });
|
||||
|
||||
if (compilation.envVars.length > 0) {
|
||||
await checkEnvVars(
|
||||
compilation.envVars ?? [],
|
||||
resolvedConfig.config,
|
||||
options,
|
||||
environmentClient,
|
||||
authorization.dashboardUrl
|
||||
);
|
||||
}
|
||||
|
||||
// Step 2: Initialize a deployment on the server (response will have everything we need to build an image)
|
||||
const deploymentResponse = await environmentClient.initializeDeployment({
|
||||
contentHash: compilation.contentHash,
|
||||
@@ -680,73 +671,6 @@ async function failDeploy(
|
||||
// TODO: Let platform know so it can fail the deploy with an appropriate error
|
||||
}
|
||||
|
||||
async function checkEnvVars(
|
||||
envVars: string[],
|
||||
config: ResolvedConfig,
|
||||
options: DeployCommandOptions,
|
||||
environmentClient: CliApiClient,
|
||||
apiUrl: string
|
||||
) {
|
||||
return await tracer.startActiveSpan("detectEnvVars", async (span) => {
|
||||
try {
|
||||
span.setAttribute("envVars.check", envVars);
|
||||
|
||||
const environmentVariablesSpinner = spinner();
|
||||
|
||||
environmentVariablesSpinner.start("Checking environment variables");
|
||||
|
||||
const environmentVariables = await environmentClient.getEnvironmentVariables(config.project);
|
||||
|
||||
if (!environmentVariables.success) {
|
||||
environmentVariablesSpinner.stop(`Failed to fetch environment variables, skipping check`);
|
||||
} else {
|
||||
// Check to see if all the environment variables in the compilation exist
|
||||
const missingEnvironmentVariables = envVars.filter(
|
||||
(envVar) => environmentVariables.data.variables[envVar] === undefined
|
||||
);
|
||||
|
||||
if (missingEnvironmentVariables.length > 0) {
|
||||
environmentVariablesSpinner.stop(
|
||||
`Found missing env vars in ${options.env}: ${arrayToSentence(
|
||||
missingEnvironmentVariables
|
||||
)}. ${
|
||||
options.ignoreEnvVarCheck
|
||||
? "Continuing deployment because of --ignore-env-var-check. "
|
||||
: "Aborting deployment. "
|
||||
}${chalk.bgBlueBright(
|
||||
terminalLink(
|
||||
"Manage env vars",
|
||||
`${apiUrl}/projects/v3/${config.project}/environment-variables`
|
||||
)
|
||||
)}`
|
||||
);
|
||||
|
||||
span.setAttributes({
|
||||
"envVars.missing": missingEnvironmentVariables,
|
||||
});
|
||||
|
||||
if (!options.ignoreEnvVarCheck) {
|
||||
throw new SkipLoggingError("Found missing environment variables");
|
||||
} else {
|
||||
span.end();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
environmentVariablesSpinner.stop(`Environment variable check passed`);
|
||||
}
|
||||
|
||||
span.end();
|
||||
} catch (e) {
|
||||
recordSpanException(span, e);
|
||||
|
||||
span.end();
|
||||
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Poll every 1 second for the deployment to finish
|
||||
async function waitForDeploymentToFinish(
|
||||
deploymentId: string,
|
||||
@@ -1396,25 +1320,13 @@ async function compileProject(
|
||||
|
||||
const contentHash = contentHasher.digest("hex");
|
||||
|
||||
const workerSetupEnvVars = await findAllEnvironmentVariableReferencesInFile(workerSetupPath);
|
||||
|
||||
const workerFacadeEnvVars = findAllEnvironmentVariableReferences(workerContents);
|
||||
|
||||
const envVars = findAllEnvironmentVariableReferences(workerOutputFile.text);
|
||||
|
||||
// Remove workerFacadeEnvVars and workerSetupEnvVars from envVars
|
||||
const finalEnvVars = envVars.filter(
|
||||
(envVar) => !workerFacadeEnvVars.includes(envVar) && !workerSetupEnvVars.includes(envVar)
|
||||
);
|
||||
|
||||
span.setAttributes({
|
||||
contentHash: contentHash,
|
||||
envVars: finalEnvVars,
|
||||
});
|
||||
|
||||
span.end();
|
||||
|
||||
return { path: tempDir, contentHash, envVars: finalEnvVars };
|
||||
return { path: tempDir, contentHash };
|
||||
} catch (e) {
|
||||
recordSpanException(span, e);
|
||||
|
||||
@@ -1808,36 +1720,3 @@ async function ensureLoggedIntoDockerRegistry(
|
||||
|
||||
return tmpDir;
|
||||
}
|
||||
|
||||
async function findAllEnvironmentVariableReferencesInFile(filePath: string) {
|
||||
const fileContents = await readFile(filePath, "utf-8");
|
||||
|
||||
return findAllEnvironmentVariableReferences(fileContents);
|
||||
}
|
||||
|
||||
const IGNORED_ENV_VARS = ["NODE_ENV", "SHELL", "HOME", "PWD", "LOGNAME", "USER", "PATH", "DEBUG"];
|
||||
|
||||
function findAllEnvironmentVariableReferences(code: string): string[] {
|
||||
const regex = /\bprocess\.env\.([a-zA-Z_][a-zA-Z0-9_]*)\b/g;
|
||||
|
||||
const matches = code.matchAll(regex);
|
||||
|
||||
const matchesArray = Array.from(matches, (match) => match[1]).filter(Boolean) as string[];
|
||||
|
||||
const filteredMatches = matchesArray.filter((match) => !IGNORED_ENV_VARS.includes(match));
|
||||
|
||||
// Make sure and remove duplicates
|
||||
return Array.from(new Set(filteredMatches));
|
||||
}
|
||||
|
||||
function arrayToSentence(items: string[]): string {
|
||||
if (items.length === 1 && typeof items[0] === "string") {
|
||||
return items[0];
|
||||
}
|
||||
|
||||
if (items.length === 2) {
|
||||
return `${items[0]} and ${items[1]}`;
|
||||
}
|
||||
|
||||
return `${items.slice(0, -1).join(", ")}, and ${items[items.length - 1]}`;
|
||||
}
|
||||
|
||||
@@ -2,12 +2,11 @@ import {
|
||||
CreateBackgroundWorkerRequestBody,
|
||||
ResolvedConfig,
|
||||
TaskResource,
|
||||
ZodMessageHandler,
|
||||
ZodMessageSender,
|
||||
clientWebsocketMessages,
|
||||
detectDependencyVersion,
|
||||
serverWebsocketMessages,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import { ZodMessageHandler, ZodMessageSender } from "@trigger.dev/core/v3/zodMessageHandler";
|
||||
import { watch } from "chokidar";
|
||||
import { Command } from "commander";
|
||||
import { BuildContext, Metafile, context } from "esbuild";
|
||||
@@ -425,10 +424,6 @@ function useDev({
|
||||
|
||||
const metaOutputKey = join("out", `stdin.js`).replace(/\\/g, "/");
|
||||
|
||||
logger.debug("Metafile", {
|
||||
metafileOutputs: JSON.stringify(result.metafile?.outputs),
|
||||
});
|
||||
|
||||
const metaOutput = result.metafile!.outputs[metaOutputKey];
|
||||
|
||||
if (!metaOutput) {
|
||||
@@ -509,8 +504,15 @@ function useDev({
|
||||
|
||||
const taskResources: Array<TaskResource> = [];
|
||||
|
||||
if (!backgroundWorker.tasks) {
|
||||
throw new Error(`Background Worker started without tasks`);
|
||||
if (!backgroundWorker.tasks || backgroundWorker.tasks.length === 0) {
|
||||
logger.log(
|
||||
`${chalkError(
|
||||
"X Error:"
|
||||
)} Worker failed to build: no tasks found. Searched in ${config.triggerDirectories.join(
|
||||
", "
|
||||
)}`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
for (const task of backgroundWorker.tasks) {
|
||||
@@ -536,6 +538,10 @@ function useDev({
|
||||
return;
|
||||
}
|
||||
|
||||
logger.debug("Creating background worker with tasks", {
|
||||
tasks: taskResources,
|
||||
});
|
||||
|
||||
const backgroundWorkerBody: CreateBackgroundWorkerRequestBody = {
|
||||
localOnly: true,
|
||||
metadata: {
|
||||
@@ -638,7 +644,7 @@ function useDev({
|
||||
const throttledRebuild = pDebounce(runBuild, 250, { before: true });
|
||||
|
||||
const taskFileWatcher = watch(
|
||||
config.triggerDirectories.map((triggerDir) => `${triggerDir}/*.ts`),
|
||||
config.triggerDirectories.map((triggerDir) => `${triggerDir}/**/*.ts`),
|
||||
{
|
||||
ignoreInitial: true,
|
||||
}
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { intro, isCancel, log, outro, select, text } from "@clack/prompts";
|
||||
import { context, trace } from "@opentelemetry/api";
|
||||
import {
|
||||
GetProjectResponseBody,
|
||||
flattenAttributes,
|
||||
recordSpanException,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import { GetProjectResponseBody, flattenAttributes } from "@trigger.dev/core/v3";
|
||||
import { recordSpanException } from "@trigger.dev/core/v3/workers";
|
||||
import chalk from "chalk";
|
||||
import { Command } from "commander";
|
||||
import { execa } from "execa";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { intro, log, outro, select } from "@clack/prompts";
|
||||
import { recordSpanException } from "@trigger.dev/core/v3";
|
||||
import { recordSpanException } from "@trigger.dev/core/v3/workers";
|
||||
import { Command } from "commander";
|
||||
import open from "open";
|
||||
import pRetry, { AbortError } from "p-retry";
|
||||
|
||||
@@ -5,6 +5,10 @@ import { NodeTracerProvider, SimpleSpanProcessor } from "@opentelemetry/sdk-trac
|
||||
import { FetchInstrumentation } from "@opentelemetry/instrumentation-fetch";
|
||||
import { DiagConsoleLogger, DiagLogLevel, diag, trace } from "@opentelemetry/api";
|
||||
import * as packageJson from "../../package.json";
|
||||
import {
|
||||
SEMRESATTRS_SERVICE_NAME,
|
||||
SEMRESATTRS_SERVICE_VERSION,
|
||||
} from "@opentelemetry/semantic-conventions";
|
||||
|
||||
function initializeTracing(): NodeTracerProvider | undefined {
|
||||
if (process.argv.includes("--skip-telemetry") || process.env.TRIGGER_DEV_SKIP_TELEMETRY) {
|
||||
@@ -19,7 +23,8 @@ function initializeTracing(): NodeTracerProvider | undefined {
|
||||
detectors: [processDetectorSync],
|
||||
}).merge(
|
||||
new Resource({
|
||||
service: "trigger.dev cli v3",
|
||||
[SEMRESATTRS_SERVICE_NAME]: "trigger.dev cli v3",
|
||||
[SEMRESATTRS_SERVICE_VERSION]: packageJson.version,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -38,9 +43,9 @@ function initializeTracing(): NodeTracerProvider | undefined {
|
||||
|
||||
const spanExporter = new OTLPTraceExporter({
|
||||
url: "https://otel.baselime.io/v1",
|
||||
timeoutMillis: 500,
|
||||
timeoutMillis: 5000,
|
||||
headers: {
|
||||
"x-api-key": "e9f963244f8b092850d42e34a5339b2d5e68070b".split("").reverse().join(""), // this is a joke
|
||||
"x-api-key": "b6e0fbbaf8dc2524773d2152ae2e9eb5c7fbaa52",
|
||||
},
|
||||
});
|
||||
|
||||
@@ -59,5 +64,5 @@ function initializeTracing(): NodeTracerProvider | undefined {
|
||||
export const provider = initializeTracing();
|
||||
|
||||
export function getTracer() {
|
||||
return trace.getTracer("trigger.dev cli", packageJson.version);
|
||||
return trace.getTracer("trigger.dev cli v3", packageJson.version);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export function bundleTriggerDevCore(buildIdentifier: string, tsconfigPath?: str
|
||||
name: "trigger-bundle-core",
|
||||
setup(build) {
|
||||
build.onResolve({ filter: /.*/ }, (args) => {
|
||||
if (args.path !== "@trigger.dev/core/v3") {
|
||||
if (!args.path.startsWith("@trigger.dev/core/v3")) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -22,18 +22,15 @@ export function bundleTriggerDevCore(buildIdentifier: string, tsconfigPath?: str
|
||||
triggerSdkPath,
|
||||
});
|
||||
|
||||
const resolvedPath = require.resolve("@trigger.dev/core/v3", {
|
||||
const resolvedPath = require.resolve(args.path, {
|
||||
paths: [triggerSdkPath],
|
||||
});
|
||||
|
||||
logger.debug(
|
||||
`[${buildIdentifier}][trigger-bundle-core] Externalizing @trigger.dev/core/v3`,
|
||||
{
|
||||
...args,
|
||||
triggerSdkPath,
|
||||
resolvedPath,
|
||||
}
|
||||
);
|
||||
logger.debug(`[${buildIdentifier}][trigger-bundle-core] Externalizing ${args.path}`, {
|
||||
...args,
|
||||
triggerSdkPath,
|
||||
resolvedPath,
|
||||
});
|
||||
|
||||
return {
|
||||
path: resolvedPath,
|
||||
|
||||
@@ -99,6 +99,18 @@ async function getConfigPath(dir: string, fileName?: string): Promise<string | u
|
||||
return await findUp(fileName ? [fileName] : CONFIG_FILES, { cwd: dir });
|
||||
}
|
||||
|
||||
async function findFilePath(dir: string, fileName: string): Promise<string | undefined> {
|
||||
const result = await findUp([fileName], { cwd: dir });
|
||||
|
||||
logger.debug("Searched for the file", {
|
||||
dir,
|
||||
fileName,
|
||||
result,
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export type ReadConfigOptions = {
|
||||
projectRef?: string;
|
||||
configFile?: string;
|
||||
@@ -187,6 +199,8 @@ export async function resolveConfig(path: string, config: Config): Promise<Resol
|
||||
|
||||
config.triggerDirectories = resolveTriggerDirectories(config.triggerDirectories);
|
||||
|
||||
logger.debug("Resolved trigger directories", { triggerDirectories: config.triggerDirectories });
|
||||
|
||||
if (!config.triggerUrl) {
|
||||
config.triggerUrl = CLOUD_API_URL;
|
||||
}
|
||||
@@ -196,7 +210,7 @@ export async function resolveConfig(path: string, config: Config): Promise<Resol
|
||||
}
|
||||
|
||||
if (!config.tsconfigPath) {
|
||||
config.tsconfigPath = await getConfigPath(path, "tsconfig.json");
|
||||
config.tsconfigPath = await findFilePath(path, "tsconfig.json");
|
||||
}
|
||||
|
||||
return config as ResolvedConfig;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { recordSpanException } from "@trigger.dev/core/v3";
|
||||
import { recordSpanException } from "@trigger.dev/core/v3/workers";
|
||||
import { CliApiClient } from "../apiClient.js";
|
||||
import { readAuthConfigProfile } from "./configFiles.js";
|
||||
import { getTracer } from "../telemetry/tracing.js";
|
||||
@@ -7,24 +7,24 @@ const tracer = getTracer();
|
||||
|
||||
export type LoginResult =
|
||||
| {
|
||||
ok: true;
|
||||
profile: string,
|
||||
userId: string;
|
||||
email: string;
|
||||
dashboardUrl: string;
|
||||
auth: {
|
||||
apiUrl: string;
|
||||
accessToken: string;
|
||||
};
|
||||
}
|
||||
ok: true;
|
||||
profile: string;
|
||||
userId: string;
|
||||
email: string;
|
||||
dashboardUrl: string;
|
||||
auth: {
|
||||
apiUrl: string;
|
||||
accessToken: string;
|
||||
};
|
||||
}
|
||||
| {
|
||||
ok: false;
|
||||
error: string;
|
||||
auth?: {
|
||||
apiUrl: string;
|
||||
accessToken: string;
|
||||
ok: false;
|
||||
error: string;
|
||||
auth?: {
|
||||
apiUrl: string;
|
||||
accessToken: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
export async function isLoggedIn(profile: string = "default"): Promise<LoginResult> {
|
||||
return await tracer.startActiveSpan("isLoggedIn", async (span) => {
|
||||
|
||||
@@ -21,9 +21,27 @@ export async function gatherTaskFiles(config: ResolvedConfig): Promise<Array<Tas
|
||||
const taskFiles: Array<TaskFile> = [];
|
||||
|
||||
for (const triggerDir of config.triggerDirectories) {
|
||||
const files = await fs.promises.readdir(triggerDir, { withFileTypes: true });
|
||||
for (const file of files) {
|
||||
if (!file.isFile()) continue;
|
||||
const files = await gatherTaskFilesFromDir(triggerDir, triggerDir, config);
|
||||
taskFiles.push(...files);
|
||||
}
|
||||
|
||||
return taskFiles;
|
||||
}
|
||||
|
||||
async function gatherTaskFilesFromDir(
|
||||
dirPath: string,
|
||||
triggerDir: string,
|
||||
config: ResolvedConfig
|
||||
): Promise<TaskFile[]> {
|
||||
const taskFiles: TaskFile[] = [];
|
||||
|
||||
const files = await fs.promises.readdir(dirPath, { withFileTypes: true });
|
||||
for (const file of files) {
|
||||
if (!file.isFile()) {
|
||||
// Recurse into subdirectories
|
||||
const fullPath = join(dirPath, file.name);
|
||||
taskFiles.push(...(await gatherTaskFilesFromDir(fullPath, triggerDir, config)));
|
||||
} else {
|
||||
if (
|
||||
!file.name.endsWith(".js") &&
|
||||
!file.name.endsWith(".ts") &&
|
||||
@@ -33,7 +51,7 @@ export async function gatherTaskFiles(config: ResolvedConfig): Promise<Array<Tas
|
||||
continue;
|
||||
}
|
||||
|
||||
const fullPath = join(triggerDir, file.name);
|
||||
const fullPath = join(dirPath, file.name);
|
||||
const filePath = relative(config.projectDir, fullPath);
|
||||
|
||||
//remove the file extension and replace any invalid characters with underscores
|
||||
@@ -64,10 +82,16 @@ async function getTriggerDirectories(dirPath: string): Promise<string[]> {
|
||||
const triggerDirectories: string[] = [];
|
||||
|
||||
for (const entry of entries) {
|
||||
if (!entry.isDirectory() || IGNORED_DIRS.includes(entry.name)) continue;
|
||||
if (!entry.isDirectory() || IGNORED_DIRS.includes(entry.name) || entry.name.startsWith("."))
|
||||
continue;
|
||||
|
||||
const fullPath = join(dirPath, entry.name);
|
||||
|
||||
// Ignore the directory if it's <any>/app/api/trigger
|
||||
if (fullPath.endsWith("app/api/trigger")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entry.name === "trigger") {
|
||||
triggerDirectories.push(fullPath);
|
||||
}
|
||||
|
||||
@@ -11,13 +11,12 @@ import {
|
||||
TaskRunExecution,
|
||||
TaskRunExecutionPayload,
|
||||
TaskRunExecutionResult,
|
||||
ZodMessageHandler,
|
||||
ZodMessageSender,
|
||||
childToWorkerMessages,
|
||||
correctErrorStackTrace,
|
||||
formatDurationMilliseconds,
|
||||
workerToChildMessages,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import { ZodMessageHandler, ZodMessageSender } from "@trigger.dev/core/v3/zodMessageHandler";
|
||||
import dotenv from "dotenv";
|
||||
import { Evt } from "evt";
|
||||
import { ChildProcess, fork } from "node:child_process";
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
import {
|
||||
Config,
|
||||
DurableClock,
|
||||
LogLevel,
|
||||
ProjectConfig,
|
||||
TaskExecutor,
|
||||
ZodSchemaParsedError,
|
||||
clock,
|
||||
getEnvVar,
|
||||
logLevels,
|
||||
taskCatalog,
|
||||
type HandleErrorFunction,
|
||||
type TracingSDK,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import {
|
||||
TaskExecutor,
|
||||
DurableClock,
|
||||
getEnvVar,
|
||||
logLevels,
|
||||
OtelTaskLogger,
|
||||
ConsoleInterceptor,
|
||||
type TracingSDK,
|
||||
} from "@trigger.dev/core/v3/workers";
|
||||
|
||||
__WORKER_SETUP__;
|
||||
declare const __WORKER_SETUP__: unknown;
|
||||
@@ -28,19 +31,20 @@ const otelTracer = tracingSDK.getTracer("trigger-dev-worker", packageJson.versio
|
||||
const otelLogger = tracingSDK.getLogger("trigger-dev-worker", packageJson.version);
|
||||
|
||||
import {
|
||||
ConsoleInterceptor,
|
||||
DevRuntimeManager,
|
||||
OtelTaskLogger,
|
||||
TaskRunErrorCodes,
|
||||
TaskRunExecution,
|
||||
TriggerTracer,
|
||||
ZodMessageHandler,
|
||||
ZodMessageSender,
|
||||
childToWorkerMessages,
|
||||
logger,
|
||||
runtime,
|
||||
workerToChildMessages,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import { DevRuntimeManager } from "@trigger.dev/core/v3/dev";
|
||||
import {
|
||||
ZodMessageHandler,
|
||||
ZodMessageSender,
|
||||
ZodSchemaParsedError,
|
||||
} from "@trigger.dev/core/v3/zodMessageHandler";
|
||||
import * as packageJson from "../../../package.json";
|
||||
|
||||
declare const sender: ZodMessageSender<typeof childToWorkerMessages>;
|
||||
@@ -94,10 +98,12 @@ declare const __TASKS__: Record<string, string>;
|
||||
"id" in task &&
|
||||
typeof task.id === "string"
|
||||
) {
|
||||
taskCatalog.registerTaskFileMetadata(task.id, {
|
||||
exportName,
|
||||
filePath: (taskFile as any).filePath,
|
||||
});
|
||||
if (taskCatalog.taskExists(task.id)) {
|
||||
taskCatalog.registerTaskFileMetadata(task.id, {
|
||||
exportName,
|
||||
filePath: (taskFile as any).filePath,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,15 @@ import { Resource } from "@opentelemetry/resources";
|
||||
import {
|
||||
ProjectConfig,
|
||||
SemanticInternalAttributes,
|
||||
StandardTaskCatalog,
|
||||
TracingDiagnosticLogLevel,
|
||||
TracingSDK,
|
||||
ZodMessageSender,
|
||||
childToWorkerMessages,
|
||||
taskCatalog,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import {
|
||||
TracingDiagnosticLogLevel,
|
||||
TracingSDK,
|
||||
StandardTaskCatalog,
|
||||
} from "@trigger.dev/core/v3/workers";
|
||||
import { ZodMessageSender } from "@trigger.dev/core/v3/zodMessageHandler";
|
||||
|
||||
__SETUP_IMPORTED_PROJECT_CONFIG__;
|
||||
declare const __SETUP_IMPORTED_PROJECT_CONFIG__: unknown;
|
||||
|
||||
@@ -2,7 +2,6 @@ import {
|
||||
BackgroundWorkerProperties,
|
||||
Config,
|
||||
CreateBackgroundWorkerResponse,
|
||||
InferSocketMessageSchema,
|
||||
ProdChildToWorkerMessages,
|
||||
ProdTaskRunExecution,
|
||||
ProdTaskRunExecutionPayload,
|
||||
@@ -14,9 +13,10 @@ import {
|
||||
TaskRunExecution,
|
||||
TaskRunExecutionPayload,
|
||||
TaskRunExecutionResult,
|
||||
ZodIpcConnection,
|
||||
correctErrorStackTrace,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import { ZodIpcConnection } from "@trigger.dev/core/v3/zodIpc";
|
||||
import type { InferSocketMessageSchema } from "@trigger.dev/core/v3/zodSocket";
|
||||
import { Evt } from "evt";
|
||||
import { ChildProcess, fork } from "node:child_process";
|
||||
import { TaskMetadataParseError, UncaughtExceptionError } from "../common/errors";
|
||||
|
||||
@@ -6,8 +6,8 @@ import {
|
||||
ProdWorkerToCoordinatorMessages,
|
||||
TaskResource,
|
||||
WaitReason,
|
||||
ZodSocketConnection,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import { ZodSocketConnection } from "@trigger.dev/core/v3/zodSocket";
|
||||
import { HttpReply, SimpleLogger, getRandomPortNumber } from "@trigger.dev/core-apps";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { createServer } from "node:http";
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
import {
|
||||
Config,
|
||||
DurableClock,
|
||||
HandleErrorFunction,
|
||||
LogLevel,
|
||||
ProdChildToWorkerMessages,
|
||||
ProdWorkerToChildMessages,
|
||||
ProjectConfig,
|
||||
TaskExecutor,
|
||||
ZodIpcConnection,
|
||||
ZodSchemaParsedError,
|
||||
clock,
|
||||
taskCatalog,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import {
|
||||
TaskExecutor,
|
||||
DurableClock,
|
||||
getEnvVar,
|
||||
logLevels,
|
||||
taskCatalog,
|
||||
OtelTaskLogger,
|
||||
ConsoleInterceptor,
|
||||
type TracingSDK,
|
||||
} from "@trigger.dev/core/v3";
|
||||
} from "@trigger.dev/core/v3/workers";
|
||||
import { ZodIpcConnection } from "@trigger.dev/core/v3/zodIpc";
|
||||
import { ZodSchemaParsedError } from "@trigger.dev/core/v3/zodMessageHandler";
|
||||
import "source-map-support/register.js";
|
||||
|
||||
__WORKER_SETUP__;
|
||||
@@ -32,22 +36,20 @@ const otelTracer = tracingSDK.getTracer("trigger-prod-worker", packageJson.versi
|
||||
const otelLogger = tracingSDK.getLogger("trigger-prod-worker", packageJson.version);
|
||||
|
||||
import {
|
||||
ConsoleInterceptor,
|
||||
OtelTaskLogger,
|
||||
ProdRuntimeManager,
|
||||
TaskRunErrorCodes,
|
||||
TaskRunExecution,
|
||||
TriggerTracer,
|
||||
logger,
|
||||
runtime,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import { ProdRuntimeManager } from "@trigger.dev/core/v3/prod";
|
||||
import * as packageJson from "../../../package.json";
|
||||
|
||||
const durableClock = new DurableClock();
|
||||
clock.setGlobalClock(durableClock);
|
||||
|
||||
const tracer = new TriggerTracer({ tracer: otelTracer, logger: otelLogger });
|
||||
const consoleInterceptor = new ConsoleInterceptor(otelLogger, false);
|
||||
const consoleInterceptor = new ConsoleInterceptor(otelLogger, true);
|
||||
|
||||
const triggerLogLevel = getEnvVar("TRIGGER_LOG_LEVEL");
|
||||
|
||||
@@ -85,10 +87,12 @@ declare const __TASKS__: Record<string, string>;
|
||||
"id" in task &&
|
||||
typeof task.id === "string"
|
||||
) {
|
||||
taskCatalog.registerTaskFileMetadata(task.id, {
|
||||
exportName,
|
||||
filePath: (taskFile as any).filePath,
|
||||
});
|
||||
if (taskCatalog.taskExists(task.id)) {
|
||||
taskCatalog.registerTaskFileMetadata(task.id, {
|
||||
exportName,
|
||||
filePath: (taskFile as any).filePath,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import { Resource } from "@opentelemetry/resources";
|
||||
import { ProjectConfig, SemanticInternalAttributes, taskCatalog } from "@trigger.dev/core/v3";
|
||||
import {
|
||||
ProjectConfig,
|
||||
SemanticInternalAttributes,
|
||||
StandardTaskCatalog,
|
||||
TracingDiagnosticLogLevel,
|
||||
TracingSDK,
|
||||
taskCatalog,
|
||||
} from "@trigger.dev/core/v3";
|
||||
StandardTaskCatalog,
|
||||
} from "@trigger.dev/core/v3/workers";
|
||||
|
||||
__SETUP_IMPORTED_PROJECT_CONFIG__;
|
||||
declare const __SETUP_IMPORTED_PROJECT_CONFIG__: unknown;
|
||||
|
||||
@@ -21,7 +21,7 @@ import { logger } from "../utils/logger";
|
||||
import { resolvePath } from "../utils/parseNameAndPath";
|
||||
import { readPackageJson } from "../utils/readPackageJson";
|
||||
import { renderTitle } from "../utils/renderTitle";
|
||||
import { TriggerApi, WhoamiResponse } from "../utils/triggerApi";
|
||||
import { TriggerApi } from "../utils/triggerApi";
|
||||
import { getJsRuntime } from "../utils/jsRuntime";
|
||||
|
||||
export type InitCommandOptions = {
|
||||
@@ -165,7 +165,9 @@ async function printNextSteps(
|
||||
framework: Framework
|
||||
) {
|
||||
logger.success(`✔ Successfully initialized Trigger.dev!`);
|
||||
logger.warn(`⚠️ Warning: We don't currently support long-running servers! For more details, check out https://github.com/triggerdotdev/trigger.dev/issues/244.`);
|
||||
logger.warn(
|
||||
`⚠️ Warning: We don't currently support long-running servers! For more details, check out https://github.com/triggerdotdev/trigger.dev/issues/244.`
|
||||
);
|
||||
logger.info("Next steps:");
|
||||
logger.info(` 1. Run your ${framework.name} project locally with '${packageManager} run dev'`);
|
||||
logger.info(
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
"@trigger.dev/core": "workspace:*",
|
||||
"@trigger.dev/tsconfig": "workspace:*",
|
||||
"@types/node": "18",
|
||||
"typescript": "^5.3.0"
|
||||
"typescript": "^5.3.0",
|
||||
"socket.io-client": "^4.7.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
|
||||
@@ -7,9 +7,9 @@ import {
|
||||
PlatformToProviderMessages,
|
||||
ProviderToPlatformMessages,
|
||||
SharedQueueToClientMessages,
|
||||
ZodMessageSender,
|
||||
ZodSocketConnection,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import { ZodMessageSender } from "@trigger.dev/core/v3/zodMessageHandler";
|
||||
import { ZodSocketConnection } from "@trigger.dev/core/v3/zodSocket";
|
||||
import { getRandomPortNumber, HttpReply, getTextBody } from "./http";
|
||||
import { SimpleLogger } from "./logger";
|
||||
|
||||
|
||||
@@ -37,6 +37,70 @@
|
||||
"require": "./dist/v3/otel/index.js",
|
||||
"types": "./dist/v3/otel/index.d.ts"
|
||||
},
|
||||
"./v3/zodMessageHandler": {
|
||||
"import": {
|
||||
"types": "./dist/v3/zodMessageHandler.d.mts",
|
||||
"default": "./dist/v3/zodMessageHandler.mjs"
|
||||
},
|
||||
"require": "./dist/v3/zodMessageHandler.js",
|
||||
"types": "./dist/v3/zodMessageHandler.d.ts"
|
||||
},
|
||||
"./v3/zodNamespace": {
|
||||
"import": {
|
||||
"types": "./dist/v3/zodNamespace.d.mts",
|
||||
"default": "./dist/v3/zodNamespace.mjs"
|
||||
},
|
||||
"require": "./dist/v3/zodNamespace.js",
|
||||
"types": "./dist/v3/zodNamespace.d.ts"
|
||||
},
|
||||
"./v3/zodSocket": {
|
||||
"import": {
|
||||
"types": "./dist/v3/zodSocket.d.mts",
|
||||
"default": "./dist/v3/zodSocket.mjs"
|
||||
},
|
||||
"require": "./dist/v3/zodSocket.js",
|
||||
"types": "./dist/v3/zodSocket.d.ts"
|
||||
},
|
||||
"./v3/zodIpc": {
|
||||
"import": {
|
||||
"types": "./dist/v3/zodIpc.d.mts",
|
||||
"default": "./dist/v3/zodIpc.mjs"
|
||||
},
|
||||
"require": "./dist/v3/zodIpc.js",
|
||||
"types": "./dist/v3/zodIpc.d.ts"
|
||||
},
|
||||
"./v3/utils/structuredLogger": {
|
||||
"import": {
|
||||
"types": "./dist/v3/utils/structuredLogger.d.mts",
|
||||
"default": "./dist/v3/utils/structuredLogger.mjs"
|
||||
},
|
||||
"require": "./dist/v3/utils/structuredLogger.js",
|
||||
"types": "./dist/v3/utils/structuredLogger.d.ts"
|
||||
},
|
||||
"./v3/dev": {
|
||||
"import": {
|
||||
"types": "./dist/v3/dev/index.d.mts",
|
||||
"default": "./dist/v3/dev/index.mjs"
|
||||
},
|
||||
"require": "./dist/v3/dev/index.js",
|
||||
"types": "./dist/v3/dev/index.d.ts"
|
||||
},
|
||||
"./v3/prod": {
|
||||
"import": {
|
||||
"types": "./dist/v3/prod/index.d.mts",
|
||||
"default": "./dist/v3/prod/index.mjs"
|
||||
},
|
||||
"require": "./dist/v3/prod/index.js",
|
||||
"types": "./dist/v3/prod/index.d.ts"
|
||||
},
|
||||
"./v3/workers": {
|
||||
"import": {
|
||||
"types": "./dist/v3/workers/index.d.mts",
|
||||
"default": "./dist/v3/workers/index.mjs"
|
||||
},
|
||||
"require": "./dist/v3/workers/index.js",
|
||||
"types": "./dist/v3/workers/index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"typesVersions": {
|
||||
@@ -71,25 +135,25 @@
|
||||
"@opentelemetry/sdk-trace-node": "^1.22.0",
|
||||
"@opentelemetry/semantic-conventions": "^1.22.0",
|
||||
"humanize-duration": "^3.27.3",
|
||||
"socket.io": "^4.7.4",
|
||||
"socket.io-client": "^4.7.4",
|
||||
"superjson": "^2.2.1",
|
||||
"ulidx": "^2.2.1",
|
||||
"zod": "3.22.3",
|
||||
"zod-error": "1.5.0",
|
||||
"zod-validation-error": "^1.5.0"
|
||||
"zod-validation-error": "^1.5.0",
|
||||
"socket.io-client": "4.7.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@trigger.dev/tsconfig": "workspace:*",
|
||||
"@trigger.dev/tsup": "workspace:*",
|
||||
"@types/humanize-duration": "^3.27.1",
|
||||
"@types/jest": "^29.5.3",
|
||||
"@types/node": "^18",
|
||||
"@types/node": "20.12.7",
|
||||
"jest": "^29.6.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"ts-jest": "^29.1.1",
|
||||
"tsup": "^8.0.1",
|
||||
"typescript": "^5.3.0"
|
||||
"typescript": "^5.3.0",
|
||||
"socket.io": "4.7.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
TriggerTaskResponse,
|
||||
UpdateScheduleOptions,
|
||||
} from "../schemas";
|
||||
import { taskContextManager } from "../tasks/taskContextManager";
|
||||
import { taskContext } from "../task-context-api";
|
||||
import { getEnvVar } from "../utils/getEnv";
|
||||
import { SafeAsyncLocalStorage } from "../utils/safeAsyncLocalStorage";
|
||||
import { APIError } from "../apiErrors";
|
||||
@@ -229,7 +229,7 @@ export class ApiClient {
|
||||
};
|
||||
|
||||
// Only inject the context if we are inside a task
|
||||
if (taskContextManager.isInsideTask) {
|
||||
if (taskContext.isInsideTask) {
|
||||
propagation.inject(context.active(), headers);
|
||||
|
||||
if (spanParentAsLink) {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export { DevRuntimeManager } from "../runtime/devRuntimeManager";
|
||||
@@ -1,76 +1,52 @@
|
||||
import { BatchTriggerTaskRequestBody, TriggerTaskRequestBody } from "./schemas";
|
||||
|
||||
export * from "./schemas";
|
||||
export * from "./apiClient";
|
||||
export * from "./zodMessageHandler";
|
||||
export * from "./zodNamespace";
|
||||
export * from "./zodSocket";
|
||||
export * from "./zodIpc";
|
||||
export * from "./errors";
|
||||
export * from "./apiErrors";
|
||||
export * from "./runtime-api";
|
||||
export * from "./logger-api";
|
||||
export * from "./clock-api";
|
||||
export * from "./errors";
|
||||
export * from "./limits";
|
||||
export * from "./logger-api";
|
||||
export * from "./runtime-api";
|
||||
export * from "./task-context-api";
|
||||
export * from "./schemas";
|
||||
export { SemanticInternalAttributes } from "./semanticInternalAttributes";
|
||||
export * from "./task-catalog-api";
|
||||
export * from "./types";
|
||||
export * from "./limits";
|
||||
export { SemanticInternalAttributes } from "./semanticInternalAttributes";
|
||||
export { iconStringForSeverity } from "./icons";
|
||||
export {
|
||||
formatDuration,
|
||||
formatDurationInDays,
|
||||
formatDurationMilliseconds,
|
||||
formatDurationNanoseconds,
|
||||
formatDurationInDays,
|
||||
nanosecondsToMilliseconds,
|
||||
millisecondsToNanoseconds,
|
||||
nanosecondsToMilliseconds,
|
||||
} from "./utils/durations";
|
||||
export { getEnvVar } from "./utils/getEnv";
|
||||
|
||||
export function parseTriggerTaskRequestBody(body: unknown) {
|
||||
return TriggerTaskRequestBody.safeParse(body);
|
||||
}
|
||||
|
||||
export function parseBatchTriggerTaskRequestBody(body: unknown) {
|
||||
return BatchTriggerTaskRequestBody.safeParse(body);
|
||||
}
|
||||
|
||||
export { taskContextManager, TaskContextSpanProcessor } from "./tasks/taskContextManager";
|
||||
export type { RuntimeManager } from "./runtime/manager";
|
||||
export { DevRuntimeManager } from "./runtime/devRuntimeManager";
|
||||
export { ProdRuntimeManager } from "./runtime/prodRuntimeManager";
|
||||
export { PreciseWallClock as DurableClock } from "./clock/preciseWallClock";
|
||||
export { TriggerTracer } from "./tracer";
|
||||
|
||||
export type { TaskLogger, LogLevel } from "./logger/taskLogger";
|
||||
export { OtelTaskLogger, logLevels } from "./logger/taskLogger";
|
||||
export { ConsoleInterceptor } from "./consoleInterceptor";
|
||||
export type { LogLevel } from "./logger/taskLogger";
|
||||
|
||||
export { eventFilterMatches } from "../eventFilterMatches";
|
||||
export {
|
||||
flattenAttributes,
|
||||
unflattenAttributes,
|
||||
primitiveValueOrflattenedAttributes,
|
||||
unflattenAttributes,
|
||||
} from "./utils/flattenAttributes";
|
||||
export { omit } from "./utils/omit";
|
||||
export {
|
||||
defaultRetryOptions,
|
||||
defaultFetchRetryOptions,
|
||||
calculateNextRetryDelay,
|
||||
calculateResetAt,
|
||||
defaultFetchRetryOptions,
|
||||
defaultRetryOptions,
|
||||
} from "./utils/retries";
|
||||
export { accessoryAttributes } from "./utils/styleAttributes";
|
||||
export { eventFilterMatches } from "../eventFilterMatches";
|
||||
export { omit } from "./utils/omit";
|
||||
export { TracingSDK, type TracingDiagnosticLogLevel, recordSpanException } from "./otel";
|
||||
export { TaskExecutor, type TaskExecutorOptions } from "./workers/taskExecutor";
|
||||
|
||||
export { detectDependencyVersion } from "./utils/detectDependencyVersion";
|
||||
export {
|
||||
parsePacket,
|
||||
stringifyIO,
|
||||
prettyPrintPacket,
|
||||
createPacketAttributes,
|
||||
createPacketAttributesAsJson,
|
||||
conditionallyExportPacket,
|
||||
conditionallyImportPacket,
|
||||
createPacketAttributes,
|
||||
createPacketAttributesAsJson,
|
||||
packetRequiresOffloading,
|
||||
parsePacket,
|
||||
prettyPrintPacket,
|
||||
stringifyIO,
|
||||
type IOPacket,
|
||||
} from "./utils/ioSerialization";
|
||||
|
||||
export { StandardTaskCatalog } from "./task-catalog/standardTaskCatalog";
|
||||
|
||||
@@ -38,7 +38,7 @@ import {
|
||||
OTEL_SPAN_EVENT_COUNT_LIMIT,
|
||||
} from "../limits";
|
||||
import { SemanticInternalAttributes } from "../semanticInternalAttributes";
|
||||
import { TaskContextLogProcessor, TaskContextSpanProcessor } from "../tasks/taskContextManager";
|
||||
import { TaskContextLogProcessor, TaskContextSpanProcessor } from "../taskContext/otelProcessors";
|
||||
import { getEnvVar } from "../utils/getEnv";
|
||||
|
||||
class AsyncResourceDetector implements DetectorSync {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export { ProdRuntimeManager } from "../runtime/prodRuntimeManager";
|
||||
@@ -1,13 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import { TaskRunExecution, TaskRunExecutionResult } from "./common";
|
||||
import {
|
||||
RunFnParams,
|
||||
InitFnParams,
|
||||
InitOutput,
|
||||
MiddlewareFnParams,
|
||||
HandleErrorFnParams,
|
||||
HandleErrorResult,
|
||||
} from "../types";
|
||||
|
||||
export const EnvironmentType = z.enum(["PRODUCTION", "STAGING", "DEVELOPMENT", "PREVIEW"]);
|
||||
export type EnvironmentType = z.infer<typeof EnvironmentType>;
|
||||
|
||||
@@ -8,4 +8,5 @@ export interface TaskCatalog {
|
||||
getAllTaskMetadata(): Array<TaskMetadataWithFilePath>;
|
||||
getTaskMetadata(id: string): TaskMetadataWithFilePath | undefined;
|
||||
getTask(id: string): TaskMetadataWithFunctions | undefined;
|
||||
taskExists(id: string): boolean;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,10 @@ export class TaskCatalogAPI {
|
||||
return this.#getCatalog().getTask(id);
|
||||
}
|
||||
|
||||
public taskExists(id: string): boolean {
|
||||
return this.#getCatalog().taskExists(id);
|
||||
}
|
||||
|
||||
#getCatalog(): TaskCatalog {
|
||||
return getGlobal(API_NAME) ?? NOOP_TASK_CATALOG;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,10 @@ export class NoopTaskCatalog implements TaskCatalog {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
taskExists(id: string): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
disable() {
|
||||
// noop
|
||||
}
|
||||
|
||||
@@ -90,6 +90,10 @@ export class StandardTaskCatalog implements TaskCatalog {
|
||||
};
|
||||
}
|
||||
|
||||
taskExists(id: string): boolean {
|
||||
return this._taskMetadata.has(id);
|
||||
}
|
||||
|
||||
disable() {
|
||||
// noop
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// Split module-level variable definition into separate files to allow
|
||||
// tree-shaking on each api instance.
|
||||
import { TaskContextAPI } from "./taskContext";
|
||||
/** Entrypoint for logger API */
|
||||
export const taskContext = TaskContextAPI.getInstance();
|
||||
@@ -0,0 +1,95 @@
|
||||
import { Attributes } from "@opentelemetry/api";
|
||||
import { BackgroundWorkerProperties, TaskRunContext } from "../schemas";
|
||||
import { getGlobal, registerGlobal, unregisterGlobal } from "../utils/globals";
|
||||
import { TaskContext } from "./types";
|
||||
import { SemanticInternalAttributes } from "../semanticInternalAttributes";
|
||||
|
||||
const API_NAME = "task-context";
|
||||
|
||||
export class TaskContextAPI {
|
||||
private static _instance?: TaskContextAPI;
|
||||
|
||||
private constructor() {}
|
||||
|
||||
public static getInstance(): TaskContextAPI {
|
||||
if (!this._instance) {
|
||||
this._instance = new TaskContextAPI();
|
||||
}
|
||||
|
||||
return this._instance;
|
||||
}
|
||||
|
||||
get isInsideTask(): boolean {
|
||||
return this.#getTaskContext() !== undefined;
|
||||
}
|
||||
|
||||
get ctx(): TaskRunContext | undefined {
|
||||
return this.#getTaskContext()?.ctx;
|
||||
}
|
||||
|
||||
get worker(): BackgroundWorkerProperties | undefined {
|
||||
return this.#getTaskContext()?.worker;
|
||||
}
|
||||
|
||||
get attributes(): Attributes {
|
||||
if (this.ctx) {
|
||||
return {
|
||||
...this.contextAttributes,
|
||||
...this.workerAttributes,
|
||||
};
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
get workerAttributes(): Attributes {
|
||||
if (this.worker) {
|
||||
return {
|
||||
[SemanticInternalAttributes.WORKER_ID]: this.worker.id,
|
||||
[SemanticInternalAttributes.WORKER_VERSION]: this.worker.version,
|
||||
};
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
get contextAttributes(): Attributes {
|
||||
if (this.ctx) {
|
||||
return {
|
||||
[SemanticInternalAttributes.ATTEMPT_ID]: this.ctx.attempt.id,
|
||||
[SemanticInternalAttributes.ATTEMPT_NUMBER]: this.ctx.attempt.number,
|
||||
[SemanticInternalAttributes.TASK_SLUG]: this.ctx.task.id,
|
||||
[SemanticInternalAttributes.TASK_PATH]: this.ctx.task.filePath,
|
||||
[SemanticInternalAttributes.TASK_EXPORT_NAME]: this.ctx.task.exportName,
|
||||
[SemanticInternalAttributes.QUEUE_NAME]: this.ctx.queue.name,
|
||||
[SemanticInternalAttributes.QUEUE_ID]: this.ctx.queue.id,
|
||||
[SemanticInternalAttributes.ENVIRONMENT_ID]: this.ctx.environment.id,
|
||||
[SemanticInternalAttributes.ENVIRONMENT_TYPE]: this.ctx.environment.type,
|
||||
[SemanticInternalAttributes.ORGANIZATION_ID]: this.ctx.organization.id,
|
||||
[SemanticInternalAttributes.PROJECT_ID]: this.ctx.project.id,
|
||||
[SemanticInternalAttributes.PROJECT_REF]: this.ctx.project.ref,
|
||||
[SemanticInternalAttributes.PROJECT_NAME]: this.ctx.project.name,
|
||||
[SemanticInternalAttributes.RUN_ID]: this.ctx.run.id,
|
||||
[SemanticInternalAttributes.RUN_IS_TEST]: this.ctx.run.isTest,
|
||||
[SemanticInternalAttributes.ORGANIZATION_SLUG]: this.ctx.organization.slug,
|
||||
[SemanticInternalAttributes.ORGANIZATION_NAME]: this.ctx.organization.name,
|
||||
[SemanticInternalAttributes.BATCH_ID]: this.ctx.batch?.id,
|
||||
[SemanticInternalAttributes.IDEMPOTENCY_KEY]: this.ctx.run.idempotencyKey,
|
||||
};
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
public disable() {
|
||||
unregisterGlobal(API_NAME);
|
||||
}
|
||||
|
||||
public setGlobalTaskContext(taskContext: TaskContext): boolean {
|
||||
return registerGlobal(API_NAME, taskContext);
|
||||
}
|
||||
|
||||
#getTaskContext(): TaskContext | undefined {
|
||||
return getGlobal(API_NAME);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
import { LogRecord, LogRecordProcessor } from "@opentelemetry/sdk-logs";
|
||||
import { Span, SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
||||
import { SemanticInternalAttributes } from "../semanticInternalAttributes";
|
||||
import { Context } from "@opentelemetry/api";
|
||||
import { flattenAttributes } from "../utils/flattenAttributes";
|
||||
import { taskContext } from "../task-context-api";
|
||||
|
||||
export class TaskContextSpanProcessor implements SpanProcessor {
|
||||
private _innerProcessor: SpanProcessor;
|
||||
|
||||
constructor(innerProcessor: SpanProcessor) {
|
||||
this._innerProcessor = innerProcessor;
|
||||
}
|
||||
|
||||
// Called when a span starts
|
||||
onStart(span: Span, parentContext: Context): void {
|
||||
if (taskContext.ctx) {
|
||||
span.setAttributes(
|
||||
flattenAttributes(
|
||||
{
|
||||
[SemanticInternalAttributes.ATTEMPT_ID]: taskContext.ctx.attempt.id,
|
||||
[SemanticInternalAttributes.ATTEMPT_NUMBER]: taskContext.ctx.attempt.number,
|
||||
},
|
||||
SemanticInternalAttributes.METADATA
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
this._innerProcessor.onStart(span, parentContext);
|
||||
}
|
||||
|
||||
// Delegate the rest of the methods to the wrapped processor
|
||||
|
||||
onEnd(span: Span): void {
|
||||
this._innerProcessor.onEnd(span);
|
||||
}
|
||||
|
||||
shutdown(): Promise<void> {
|
||||
return this._innerProcessor.shutdown();
|
||||
}
|
||||
|
||||
forceFlush(): Promise<void> {
|
||||
return this._innerProcessor.forceFlush();
|
||||
}
|
||||
}
|
||||
|
||||
export class TaskContextLogProcessor implements LogRecordProcessor {
|
||||
private _innerProcessor: LogRecordProcessor;
|
||||
|
||||
constructor(innerProcessor: LogRecordProcessor) {
|
||||
this._innerProcessor = innerProcessor;
|
||||
}
|
||||
forceFlush(): Promise<void> {
|
||||
return this._innerProcessor.forceFlush();
|
||||
}
|
||||
onEmit(logRecord: LogRecord, context?: Context | undefined): void {
|
||||
// Adds in the context attributes to the log record
|
||||
if (taskContext.ctx) {
|
||||
logRecord.setAttributes(
|
||||
flattenAttributes(
|
||||
{
|
||||
[SemanticInternalAttributes.ATTEMPT_ID]: taskContext.ctx.attempt.id,
|
||||
[SemanticInternalAttributes.ATTEMPT_NUMBER]: taskContext.ctx.attempt.number,
|
||||
},
|
||||
SemanticInternalAttributes.METADATA
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
this._innerProcessor.onEmit(logRecord, context);
|
||||
}
|
||||
shutdown(): Promise<void> {
|
||||
return this._innerProcessor.shutdown();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { BackgroundWorkerProperties, TaskRunContext } from "../schemas";
|
||||
|
||||
export type TaskContext = {
|
||||
ctx: TaskRunContext;
|
||||
worker: BackgroundWorkerProperties;
|
||||
};
|
||||
@@ -1,163 +0,0 @@
|
||||
import { Attributes, Context } from "@opentelemetry/api";
|
||||
import { TaskRunContext, type BackgroundWorkerProperties } from "../schemas";
|
||||
import { flattenAttributes } from "../utils/flattenAttributes";
|
||||
import { SafeAsyncLocalStorage } from "../utils/safeAsyncLocalStorage";
|
||||
|
||||
type TaskContext = {
|
||||
ctx: TaskRunContext;
|
||||
worker: BackgroundWorkerProperties;
|
||||
};
|
||||
|
||||
export class TaskContextManager {
|
||||
private _storage: SafeAsyncLocalStorage<TaskContext> = new SafeAsyncLocalStorage<TaskContext>();
|
||||
|
||||
get isInsideTask(): boolean {
|
||||
return this.#getStore() !== undefined;
|
||||
}
|
||||
|
||||
get ctx(): TaskRunContext | undefined {
|
||||
const store = this.#getStore();
|
||||
return store?.ctx;
|
||||
}
|
||||
|
||||
get worker(): BackgroundWorkerProperties | undefined {
|
||||
const store = this.#getStore();
|
||||
return store?.worker;
|
||||
}
|
||||
|
||||
get attributes(): Attributes {
|
||||
if (this.ctx) {
|
||||
return {
|
||||
...this.contextAttributes,
|
||||
...this.workerAttributes,
|
||||
};
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
get workerAttributes(): Attributes {
|
||||
if (this.worker) {
|
||||
return {
|
||||
[SemanticInternalAttributes.WORKER_ID]: this.worker.id,
|
||||
[SemanticInternalAttributes.WORKER_VERSION]: this.worker.version,
|
||||
};
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
get contextAttributes(): Attributes {
|
||||
if (this.ctx) {
|
||||
return {
|
||||
[SemanticInternalAttributes.ATTEMPT_ID]: this.ctx.attempt.id,
|
||||
[SemanticInternalAttributes.ATTEMPT_NUMBER]: this.ctx.attempt.number,
|
||||
[SemanticInternalAttributes.TASK_SLUG]: this.ctx.task.id,
|
||||
[SemanticInternalAttributes.TASK_PATH]: this.ctx.task.filePath,
|
||||
[SemanticInternalAttributes.TASK_EXPORT_NAME]: this.ctx.task.exportName,
|
||||
[SemanticInternalAttributes.QUEUE_NAME]: this.ctx.queue.name,
|
||||
[SemanticInternalAttributes.QUEUE_ID]: this.ctx.queue.id,
|
||||
[SemanticInternalAttributes.ENVIRONMENT_ID]: this.ctx.environment.id,
|
||||
[SemanticInternalAttributes.ENVIRONMENT_TYPE]: this.ctx.environment.type,
|
||||
[SemanticInternalAttributes.ORGANIZATION_ID]: this.ctx.organization.id,
|
||||
[SemanticInternalAttributes.PROJECT_ID]: this.ctx.project.id,
|
||||
[SemanticInternalAttributes.PROJECT_REF]: this.ctx.project.ref,
|
||||
[SemanticInternalAttributes.PROJECT_NAME]: this.ctx.project.name,
|
||||
[SemanticInternalAttributes.RUN_ID]: this.ctx.run.id,
|
||||
[SemanticInternalAttributes.RUN_IS_TEST]: this.ctx.run.isTest,
|
||||
[SemanticInternalAttributes.ORGANIZATION_SLUG]: this.ctx.organization.slug,
|
||||
[SemanticInternalAttributes.ORGANIZATION_NAME]: this.ctx.organization.name,
|
||||
[SemanticInternalAttributes.BATCH_ID]: this.ctx.batch?.id,
|
||||
[SemanticInternalAttributes.IDEMPOTENCY_KEY]: this.ctx.run.idempotencyKey,
|
||||
};
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
runWith<R extends (...args: any[]) => Promise<any>>(
|
||||
context: TaskContext,
|
||||
fn: R
|
||||
): Promise<ReturnType<R>> {
|
||||
return this._storage.runWith(context, fn);
|
||||
}
|
||||
|
||||
#getStore(): TaskContext | undefined {
|
||||
return this._storage.getStore();
|
||||
}
|
||||
}
|
||||
|
||||
export const taskContextManager = new TaskContextManager();
|
||||
|
||||
import { LogRecord, LogRecordProcessor } from "@opentelemetry/sdk-logs";
|
||||
import { Span, SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
||||
import { SemanticInternalAttributes } from "../semanticInternalAttributes";
|
||||
|
||||
export class TaskContextSpanProcessor implements SpanProcessor {
|
||||
private _innerProcessor: SpanProcessor;
|
||||
|
||||
constructor(innerProcessor: SpanProcessor) {
|
||||
this._innerProcessor = innerProcessor;
|
||||
}
|
||||
|
||||
// Called when a span starts
|
||||
onStart(span: Span, parentContext: Context): void {
|
||||
if (taskContextManager.ctx) {
|
||||
span.setAttributes(
|
||||
flattenAttributes(
|
||||
{
|
||||
[SemanticInternalAttributes.ATTEMPT_ID]: taskContextManager.ctx.attempt.id,
|
||||
[SemanticInternalAttributes.ATTEMPT_NUMBER]: taskContextManager.ctx.attempt.number,
|
||||
},
|
||||
SemanticInternalAttributes.METADATA
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
this._innerProcessor.onStart(span, parentContext);
|
||||
}
|
||||
|
||||
// Delegate the rest of the methods to the wrapped processor
|
||||
|
||||
onEnd(span: Span): void {
|
||||
this._innerProcessor.onEnd(span);
|
||||
}
|
||||
|
||||
shutdown(): Promise<void> {
|
||||
return this._innerProcessor.shutdown();
|
||||
}
|
||||
|
||||
forceFlush(): Promise<void> {
|
||||
return this._innerProcessor.forceFlush();
|
||||
}
|
||||
}
|
||||
|
||||
export class TaskContextLogProcessor implements LogRecordProcessor {
|
||||
private _innerProcessor: LogRecordProcessor;
|
||||
|
||||
constructor(innerProcessor: LogRecordProcessor) {
|
||||
this._innerProcessor = innerProcessor;
|
||||
}
|
||||
forceFlush(): Promise<void> {
|
||||
return this._innerProcessor.forceFlush();
|
||||
}
|
||||
onEmit(logRecord: LogRecord, context?: Context | undefined): void {
|
||||
// Adds in the context attributes to the log record
|
||||
if (taskContextManager.ctx) {
|
||||
logRecord.setAttributes(
|
||||
flattenAttributes(
|
||||
{
|
||||
[SemanticInternalAttributes.ATTEMPT_ID]: taskContextManager.ctx.attempt.id,
|
||||
[SemanticInternalAttributes.ATTEMPT_NUMBER]: taskContextManager.ctx.attempt.number,
|
||||
},
|
||||
SemanticInternalAttributes.METADATA
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
this._innerProcessor.onEmit(logRecord, context);
|
||||
}
|
||||
shutdown(): Promise<void> {
|
||||
return this._innerProcessor.shutdown();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Clock } from "../clock/clock";
|
||||
import type { RuntimeManager } from "../runtime/manager";
|
||||
import { TaskCatalog } from "../task-catalog/catalog";
|
||||
import { TaskContext } from "../taskContext/types";
|
||||
import { _globalThis } from "./platform";
|
||||
|
||||
const GLOBAL_TRIGGER_DOT_DEV_KEY = Symbol.for(`dev.trigger.ts.api`);
|
||||
@@ -48,4 +49,5 @@ type TriggerDotDevGlobalAPI = {
|
||||
logger?: any;
|
||||
clock?: Clock;
|
||||
["task-catalog"]?: TaskCatalog;
|
||||
["task-context"]?: TaskContext;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
type StructuredArgs = (Record<string, unknown> | undefined)[];
|
||||
|
||||
export interface StructuredLogger {
|
||||
log: (message: string, ...args: StructuredArgs) => any;
|
||||
error: (message: string, ...args: StructuredArgs) => any;
|
||||
warn: (message: string, ...args: StructuredArgs) => any;
|
||||
info: (message: string, ...args: StructuredArgs) => any;
|
||||
debug: (message: string, ...args: StructuredArgs) => any;
|
||||
child: (fields: Record<string, unknown>) => StructuredLogger;
|
||||
}
|
||||
|
||||
export enum LogLevel {
|
||||
"log",
|
||||
"error",
|
||||
"warn",
|
||||
"info",
|
||||
"debug",
|
||||
}
|
||||
|
||||
export class SimpleStructuredLogger implements StructuredLogger {
|
||||
constructor(
|
||||
private name: string,
|
||||
private level: LogLevel = ["1", "true"].includes(process.env.DEBUG ?? "")
|
||||
? LogLevel.debug
|
||||
: LogLevel.info,
|
||||
private fields?: Record<string, unknown>
|
||||
) {}
|
||||
|
||||
child(fields: Record<string, unknown>, level?: LogLevel) {
|
||||
return new SimpleStructuredLogger(this.name, level, { ...this.fields, ...fields });
|
||||
}
|
||||
|
||||
log(message: string, ...args: StructuredArgs) {
|
||||
if (this.level < LogLevel.log) return;
|
||||
|
||||
this.#structuredLog(console.log, message, "log", ...args);
|
||||
}
|
||||
|
||||
error(message: string, ...args: StructuredArgs) {
|
||||
if (this.level < LogLevel.error) return;
|
||||
|
||||
this.#structuredLog(console.error, message, "error", ...args);
|
||||
}
|
||||
|
||||
warn(message: string, ...args: StructuredArgs) {
|
||||
if (this.level < LogLevel.warn) return;
|
||||
|
||||
this.#structuredLog(console.warn, message, "warn", ...args);
|
||||
}
|
||||
|
||||
info(message: string, ...args: StructuredArgs) {
|
||||
if (this.level < LogLevel.info) return;
|
||||
|
||||
this.#structuredLog(console.info, message, "info", ...args);
|
||||
}
|
||||
|
||||
debug(message: string, ...args: StructuredArgs) {
|
||||
if (this.level < LogLevel.debug) return;
|
||||
|
||||
this.#structuredLog(console.debug, message, "debug", ...args);
|
||||
}
|
||||
|
||||
#structuredLog(
|
||||
loggerFunction: (message: string, ...args: any[]) => void,
|
||||
message: string,
|
||||
level: string,
|
||||
...args: StructuredArgs
|
||||
) {
|
||||
const structuredLog = {
|
||||
...(args.length === 1 ? args[0] : args),
|
||||
...this.fields,
|
||||
timestamp: new Date(),
|
||||
name: this.name,
|
||||
message,
|
||||
level,
|
||||
};
|
||||
|
||||
loggerFunction(JSON.stringify(structuredLog));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
export { TaskExecutor, type TaskExecutorOptions } from "./taskExecutor";
|
||||
export type { RuntimeManager } from "../runtime/manager";
|
||||
export { PreciseWallClock as DurableClock } from "../clock/preciseWallClock";
|
||||
export { getEnvVar } from "../utils/getEnv";
|
||||
export { OtelTaskLogger, logLevels } from "../logger/taskLogger";
|
||||
export { ConsoleInterceptor } from "../consoleInterceptor";
|
||||
export { TracingSDK, type TracingDiagnosticLogLevel, recordSpanException } from "../otel";
|
||||
export { StandardTaskCatalog } from "../task-catalog/standardTaskCatalog";
|
||||
export { TaskContextSpanProcessor, TaskContextLogProcessor } from "../taskContext/otelProcessors";
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
TaskRunExecutionRetry,
|
||||
} from "../schemas";
|
||||
import { SemanticInternalAttributes } from "../semanticInternalAttributes";
|
||||
import { taskContextManager } from "../tasks/taskContextManager";
|
||||
import { taskContext } from "../task-context-api";
|
||||
import { TriggerTracer } from "../tracer";
|
||||
import { HandleErrorFunction, ProjectConfig, TaskMetadataWithFunctions } from "../types";
|
||||
import {
|
||||
@@ -67,141 +67,137 @@ export class TaskExecutor {
|
||||
dataType: execution.run.payloadType,
|
||||
};
|
||||
|
||||
const result = await taskContextManager.runWith(
|
||||
{
|
||||
ctx,
|
||||
worker,
|
||||
},
|
||||
async () => {
|
||||
this._tracingSDK.asyncResourceDetector.resolveWithAttributes({
|
||||
...taskContextManager.attributes,
|
||||
[SemanticInternalAttributes.SDK_VERSION]: this.task.packageVersion,
|
||||
[SemanticInternalAttributes.SDK_LANGUAGE]: "typescript",
|
||||
});
|
||||
taskContext.setGlobalTaskContext({
|
||||
ctx,
|
||||
worker,
|
||||
});
|
||||
|
||||
return await this._tracer.startActiveSpan(
|
||||
attemptMessage,
|
||||
async (span) => {
|
||||
return await this._consoleInterceptor.intercept(console, async () => {
|
||||
let parsedPayload: any;
|
||||
let initOutput: any;
|
||||
this._tracingSDK.asyncResourceDetector.resolveWithAttributes({
|
||||
...taskContext.attributes,
|
||||
[SemanticInternalAttributes.SDK_VERSION]: this.task.packageVersion,
|
||||
[SemanticInternalAttributes.SDK_LANGUAGE]: "typescript",
|
||||
});
|
||||
|
||||
try {
|
||||
const payloadPacket = await conditionallyImportPacket(originalPacket, this._tracer);
|
||||
const result = await this._tracer.startActiveSpan(
|
||||
attemptMessage,
|
||||
async (span) => {
|
||||
return await this._consoleInterceptor.intercept(console, async () => {
|
||||
let parsedPayload: any;
|
||||
let initOutput: any;
|
||||
|
||||
parsedPayload = await parsePacket(payloadPacket);
|
||||
try {
|
||||
const payloadPacket = await conditionallyImportPacket(originalPacket, this._tracer);
|
||||
|
||||
initOutput = await this.#callTaskInit(parsedPayload, ctx);
|
||||
parsedPayload = await parsePacket(payloadPacket);
|
||||
|
||||
const output = await this.#callRun(parsedPayload, ctx, initOutput);
|
||||
initOutput = await this.#callTaskInit(parsedPayload, ctx);
|
||||
|
||||
try {
|
||||
const stringifiedOutput = await stringifyIO(output);
|
||||
const output = await this.#callRun(parsedPayload, ctx, initOutput);
|
||||
|
||||
const finalOutput = await conditionallyExportPacket(
|
||||
stringifiedOutput,
|
||||
`${execution.attempt.id}/output`,
|
||||
this._tracer
|
||||
);
|
||||
try {
|
||||
const stringifiedOutput = await stringifyIO(output);
|
||||
|
||||
const attributes = await createPacketAttributes(
|
||||
finalOutput,
|
||||
SemanticInternalAttributes.OUTPUT,
|
||||
SemanticInternalAttributes.OUTPUT_TYPE
|
||||
);
|
||||
const finalOutput = await conditionallyExportPacket(
|
||||
stringifiedOutput,
|
||||
`${execution.attempt.id}/output`,
|
||||
this._tracer
|
||||
);
|
||||
|
||||
if (attributes) {
|
||||
span.setAttributes(attributes);
|
||||
}
|
||||
const attributes = await createPacketAttributes(
|
||||
finalOutput,
|
||||
SemanticInternalAttributes.OUTPUT,
|
||||
SemanticInternalAttributes.OUTPUT_TYPE
|
||||
);
|
||||
|
||||
return {
|
||||
ok: true,
|
||||
id: execution.run.id,
|
||||
output: finalOutput.data,
|
||||
outputType: finalOutput.dataType,
|
||||
} satisfies TaskRunExecutionResult;
|
||||
} catch (stringifyError) {
|
||||
recordSpanException(span, stringifyError);
|
||||
|
||||
return {
|
||||
ok: false,
|
||||
id: execution.run.id,
|
||||
error: {
|
||||
type: "INTERNAL_ERROR",
|
||||
code: TaskRunErrorCodes.TASK_OUTPUT_ERROR,
|
||||
message:
|
||||
stringifyError instanceof Error
|
||||
? stringifyError.message
|
||||
: typeof stringifyError === "string"
|
||||
? stringifyError
|
||||
: undefined,
|
||||
},
|
||||
} satisfies TaskRunExecutionResult;
|
||||
}
|
||||
} catch (runError) {
|
||||
try {
|
||||
const handleErrorResult = await this.#handleError(
|
||||
execution,
|
||||
runError,
|
||||
parsedPayload,
|
||||
ctx
|
||||
);
|
||||
|
||||
recordSpanException(span, handleErrorResult.error ?? runError);
|
||||
|
||||
return {
|
||||
id: execution.run.id,
|
||||
ok: false,
|
||||
error: handleErrorResult.error
|
||||
? parseError(handleErrorResult.error)
|
||||
: parseError(runError),
|
||||
retry:
|
||||
handleErrorResult.status === "retry" ? handleErrorResult.retry : undefined,
|
||||
skippedRetrying: handleErrorResult.status === "skipped",
|
||||
} satisfies TaskRunExecutionResult;
|
||||
} catch (handleErrorError) {
|
||||
recordSpanException(span, handleErrorError);
|
||||
|
||||
return {
|
||||
ok: false,
|
||||
id: execution.run.id,
|
||||
error: {
|
||||
type: "INTERNAL_ERROR",
|
||||
code: TaskRunErrorCodes.HANDLE_ERROR_ERROR,
|
||||
message:
|
||||
handleErrorError instanceof Error
|
||||
? handleErrorError.message
|
||||
: typeof handleErrorError === "string"
|
||||
? handleErrorError
|
||||
: undefined,
|
||||
},
|
||||
} satisfies TaskRunExecutionResult;
|
||||
}
|
||||
} finally {
|
||||
await this.#callTaskCleanup(parsedPayload, ctx, initOutput);
|
||||
if (attributes) {
|
||||
span.setAttributes(attributes);
|
||||
}
|
||||
});
|
||||
},
|
||||
{
|
||||
kind: SpanKind.CONSUMER,
|
||||
attributes: {
|
||||
[SemanticInternalAttributes.STYLE_ICON]: "attempt",
|
||||
...accessoryAttributes({
|
||||
items: [
|
||||
{
|
||||
text: ctx.task.filePath,
|
||||
},
|
||||
{
|
||||
text: `${ctx.task.exportName}.run()`,
|
||||
},
|
||||
],
|
||||
style: "codepath",
|
||||
}),
|
||||
},
|
||||
},
|
||||
this._tracer.extractContext(traceContext)
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
ok: true,
|
||||
id: execution.run.id,
|
||||
output: finalOutput.data,
|
||||
outputType: finalOutput.dataType,
|
||||
} satisfies TaskRunExecutionResult;
|
||||
} catch (stringifyError) {
|
||||
recordSpanException(span, stringifyError);
|
||||
|
||||
return {
|
||||
ok: false,
|
||||
id: execution.run.id,
|
||||
error: {
|
||||
type: "INTERNAL_ERROR",
|
||||
code: TaskRunErrorCodes.TASK_OUTPUT_ERROR,
|
||||
message:
|
||||
stringifyError instanceof Error
|
||||
? stringifyError.message
|
||||
: typeof stringifyError === "string"
|
||||
? stringifyError
|
||||
: undefined,
|
||||
},
|
||||
} satisfies TaskRunExecutionResult;
|
||||
}
|
||||
} catch (runError) {
|
||||
try {
|
||||
const handleErrorResult = await this.#handleError(
|
||||
execution,
|
||||
runError,
|
||||
parsedPayload,
|
||||
ctx
|
||||
);
|
||||
|
||||
recordSpanException(span, handleErrorResult.error ?? runError);
|
||||
|
||||
return {
|
||||
id: execution.run.id,
|
||||
ok: false,
|
||||
error: handleErrorResult.error
|
||||
? parseError(handleErrorResult.error)
|
||||
: parseError(runError),
|
||||
retry: handleErrorResult.status === "retry" ? handleErrorResult.retry : undefined,
|
||||
skippedRetrying: handleErrorResult.status === "skipped",
|
||||
} satisfies TaskRunExecutionResult;
|
||||
} catch (handleErrorError) {
|
||||
recordSpanException(span, handleErrorError);
|
||||
|
||||
return {
|
||||
ok: false,
|
||||
id: execution.run.id,
|
||||
error: {
|
||||
type: "INTERNAL_ERROR",
|
||||
code: TaskRunErrorCodes.HANDLE_ERROR_ERROR,
|
||||
message:
|
||||
handleErrorError instanceof Error
|
||||
? handleErrorError.message
|
||||
: typeof handleErrorError === "string"
|
||||
? handleErrorError
|
||||
: undefined,
|
||||
},
|
||||
} satisfies TaskRunExecutionResult;
|
||||
}
|
||||
} finally {
|
||||
await this.#callTaskCleanup(parsedPayload, ctx, initOutput);
|
||||
}
|
||||
});
|
||||
},
|
||||
{
|
||||
kind: SpanKind.CONSUMER,
|
||||
attributes: {
|
||||
[SemanticInternalAttributes.STYLE_ICON]: "attempt",
|
||||
...accessoryAttributes({
|
||||
items: [
|
||||
{
|
||||
text: ctx.task.filePath,
|
||||
},
|
||||
{
|
||||
text: `${ctx.task.exportName}.run()`,
|
||||
},
|
||||
],
|
||||
style: "codepath",
|
||||
}),
|
||||
},
|
||||
},
|
||||
this._tracer.extractContext(traceContext)
|
||||
);
|
||||
|
||||
return result;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import { StructuredLogger } from "./zodNamespace";
|
||||
import { StructuredLogger } from "./utils/structuredLogger";
|
||||
|
||||
export class ZodSchemaParsedError extends Error {
|
||||
constructor(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DisconnectReason, Namespace, Server, Socket } from "socket.io";
|
||||
import type { DisconnectReason, Namespace, Server, Socket } from "socket.io";
|
||||
import { ZodMessageSender } from "./zodMessageHandler";
|
||||
import {
|
||||
ZodMessageCatalogToSocketIoEvents,
|
||||
@@ -6,8 +6,9 @@ import {
|
||||
ZodSocketMessageHandler,
|
||||
ZodSocketMessageHandlers,
|
||||
} from "./zodSocket";
|
||||
import { DefaultEventsMap, EventsMap } from "socket.io/dist/typed-events";
|
||||
import type { DefaultEventsMap, EventsMap } from "socket.io/dist/typed-events";
|
||||
import { z } from "zod";
|
||||
import { SimpleStructuredLogger, StructuredLogger } from "./utils/structuredLogger";
|
||||
|
||||
interface ExtendedError extends Error {
|
||||
data?: any;
|
||||
@@ -25,87 +26,6 @@ export type ZodNamespaceSocket<
|
||||
z.infer<TSocketData>
|
||||
>;
|
||||
|
||||
type StructuredArgs = (Record<string, unknown> | undefined)[];
|
||||
|
||||
export interface StructuredLogger {
|
||||
log: (message: string, ...args: StructuredArgs) => any;
|
||||
error: (message: string, ...args: StructuredArgs) => any;
|
||||
warn: (message: string, ...args: StructuredArgs) => any;
|
||||
info: (message: string, ...args: StructuredArgs) => any;
|
||||
debug: (message: string, ...args: StructuredArgs) => any;
|
||||
child: (fields: Record<string, unknown>) => StructuredLogger;
|
||||
}
|
||||
|
||||
export enum LogLevel {
|
||||
"log",
|
||||
"error",
|
||||
"warn",
|
||||
"info",
|
||||
"debug",
|
||||
}
|
||||
|
||||
export class SimpleStructuredLogger implements StructuredLogger {
|
||||
constructor(
|
||||
private name: string,
|
||||
private level: LogLevel = ["1", "true"].includes(process.env.DEBUG ?? "")
|
||||
? LogLevel.debug
|
||||
: LogLevel.info,
|
||||
private fields?: Record<string, unknown>
|
||||
) {}
|
||||
|
||||
child(fields: Record<string, unknown>, level?: LogLevel) {
|
||||
return new SimpleStructuredLogger(this.name, level, { ...this.fields, ...fields });
|
||||
}
|
||||
|
||||
log(message: string, ...args: StructuredArgs) {
|
||||
if (this.level < LogLevel.log) return;
|
||||
|
||||
this.#structuredLog(console.log, message, "log", ...args);
|
||||
}
|
||||
|
||||
error(message: string, ...args: StructuredArgs) {
|
||||
if (this.level < LogLevel.error) return;
|
||||
|
||||
this.#structuredLog(console.error, message, "error", ...args);
|
||||
}
|
||||
|
||||
warn(message: string, ...args: StructuredArgs) {
|
||||
if (this.level < LogLevel.warn) return;
|
||||
|
||||
this.#structuredLog(console.warn, message, "warn", ...args);
|
||||
}
|
||||
|
||||
info(message: string, ...args: StructuredArgs) {
|
||||
if (this.level < LogLevel.info) return;
|
||||
|
||||
this.#structuredLog(console.info, message, "info", ...args);
|
||||
}
|
||||
|
||||
debug(message: string, ...args: StructuredArgs) {
|
||||
if (this.level < LogLevel.debug) return;
|
||||
|
||||
this.#structuredLog(console.debug, message, "debug", ...args);
|
||||
}
|
||||
|
||||
#structuredLog(
|
||||
loggerFunction: (message: string, ...args: any[]) => void,
|
||||
message: string,
|
||||
level: string,
|
||||
...args: StructuredArgs
|
||||
) {
|
||||
const structuredLog = {
|
||||
...(args.length === 1 ? args[0] : args),
|
||||
...this.fields,
|
||||
timestamp: new Date(),
|
||||
name: this.name,
|
||||
message,
|
||||
level,
|
||||
};
|
||||
|
||||
loggerFunction(JSON.stringify(structuredLog));
|
||||
}
|
||||
}
|
||||
|
||||
interface ZodNamespaceOptions<
|
||||
TClientMessages extends ZodSocketMessageCatalogSchema,
|
||||
TServerMessages extends ZodSocketMessageCatalogSchema,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { io, Socket } from "socket.io-client";
|
||||
import type { Socket } from "socket.io-client";
|
||||
import { io } from "socket.io-client";
|
||||
import { z } from "zod";
|
||||
import { EventEmitterLike, ZodMessageValueSchema } from "./zodMessageHandler";
|
||||
import { LogLevel, SimpleStructuredLogger, StructuredLogger } from "./zodNamespace";
|
||||
import { LogLevel, SimpleStructuredLogger, StructuredLogger } from "./utils/structuredLogger";
|
||||
|
||||
export interface ZodSocketMessageCatalogSchema {
|
||||
[key: string]:
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"declaration": false,
|
||||
"declarationMap": false
|
||||
"declarationMap": false,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
||||
@@ -3,5 +3,17 @@ import { packageOptions, defineConfig } from "@trigger.dev/tsup";
|
||||
export default defineConfig({
|
||||
...packageOptions,
|
||||
config: "tsconfig.build.json",
|
||||
entry: ["./src/index.ts", "./src/v3/index.ts", "./src/v3/otel/index.ts"],
|
||||
entry: [
|
||||
"./src/index.ts",
|
||||
"./src/v3/index.ts",
|
||||
"./src/v3/otel/index.ts",
|
||||
"./src/v3/zodMessageHandler.ts",
|
||||
"./src/v3/zodNamespace.ts",
|
||||
"./src/v3/zodSocket.ts",
|
||||
"./src/v3/zodIpc.ts",
|
||||
"./src/v3/utils/structuredLogger.ts",
|
||||
"./src/v3/dev/index.ts",
|
||||
"./src/v3/prod/index.ts",
|
||||
"./src/v3/workers/index.ts",
|
||||
],
|
||||
});
|
||||
|
||||
@@ -49,4 +49,4 @@
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
"module": "./dist/index.mjs"
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,8 @@
|
||||
"ulid": "^2.3.0",
|
||||
"uuid": "^9.0.0",
|
||||
"ws": "^8.11.0",
|
||||
"zod": "3.22.3"
|
||||
"zod": "3.22.3",
|
||||
"msw": "^2.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@trigger.dev/tsconfig": "workspace:*",
|
||||
@@ -79,15 +80,7 @@
|
||||
"typed-emitter": "^2.1.0",
|
||||
"typescript": "^5.3.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"msw": "^2.2.1"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"msw": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
runtime,
|
||||
stringifyIO,
|
||||
taskCatalog,
|
||||
taskContextManager,
|
||||
taskContext,
|
||||
} from "@trigger.dev/core/v3";
|
||||
import * as packageJson from "../../package.json";
|
||||
import { tracer } from "./tracer";
|
||||
@@ -293,7 +293,7 @@ export function createTask<TInput = void, TOutput = unknown, TInitOutput extends
|
||||
options: {
|
||||
queue: params.queue,
|
||||
concurrencyKey: options?.concurrencyKey,
|
||||
test: taskContextManager.ctx?.run.isTest,
|
||||
test: taskContext.ctx?.run.isTest,
|
||||
payloadType: payloadPacket.dataType,
|
||||
idempotencyKey: options?.idempotencyKey,
|
||||
},
|
||||
@@ -310,7 +310,7 @@ export function createTask<TInput = void, TOutput = unknown, TInitOutput extends
|
||||
attributes: {
|
||||
[SEMATTRS_MESSAGING_OPERATION]: "publish",
|
||||
[SemanticInternalAttributes.STYLE_ICON]: "trigger",
|
||||
["messaging.client_id"]: taskContextManager.worker?.id,
|
||||
["messaging.client_id"]: taskContext.worker?.id,
|
||||
[SEMATTRS_MESSAGING_DESTINATION]: params.queue?.name ?? params.id,
|
||||
[SEMATTRS_MESSAGING_SYSTEM]: "trigger.dev",
|
||||
...(taskMetadata
|
||||
@@ -354,7 +354,7 @@ export function createTask<TInput = void, TOutput = unknown, TInitOutput extends
|
||||
options: {
|
||||
queue: item.options?.queue ?? params.queue,
|
||||
concurrencyKey: item.options?.concurrencyKey,
|
||||
test: taskContextManager.ctx?.run.isTest,
|
||||
test: taskContext.ctx?.run.isTest,
|
||||
payloadType: payloadPacket.dataType,
|
||||
idempotencyKey: item.options?.idempotencyKey,
|
||||
},
|
||||
@@ -374,7 +374,7 @@ export function createTask<TInput = void, TOutput = unknown, TInitOutput extends
|
||||
attributes: {
|
||||
[SEMATTRS_MESSAGING_OPERATION]: "publish",
|
||||
["messaging.batch.message_count"]: items.length,
|
||||
["messaging.client_id"]: taskContextManager.worker?.id,
|
||||
["messaging.client_id"]: taskContext.worker?.id,
|
||||
[SEMATTRS_MESSAGING_DESTINATION]: params.queue?.name ?? params.id,
|
||||
[SEMATTRS_MESSAGING_SYSTEM]: "trigger.dev",
|
||||
[SemanticInternalAttributes.STYLE_ICON]: "trigger",
|
||||
@@ -396,7 +396,7 @@ export function createTask<TInput = void, TOutput = unknown, TInitOutput extends
|
||||
return response;
|
||||
},
|
||||
triggerAndWait: async (payload, options) => {
|
||||
const ctx = taskContextManager.ctx;
|
||||
const ctx = taskContext.ctx;
|
||||
|
||||
if (!ctx) {
|
||||
throw new Error("triggerAndWait can only be used from inside a task.run()");
|
||||
@@ -419,10 +419,10 @@ export function createTask<TInput = void, TOutput = unknown, TInitOutput extends
|
||||
payload: payloadPacket.data,
|
||||
options: {
|
||||
dependentAttempt: ctx.attempt.id,
|
||||
lockToVersion: taskContextManager.worker?.version, // Lock to current version because we're waiting for it to finish
|
||||
lockToVersion: taskContext.worker?.version, // Lock to current version because we're waiting for it to finish
|
||||
queue: params.queue,
|
||||
concurrencyKey: options?.concurrencyKey,
|
||||
test: taskContextManager.ctx?.run.isTest,
|
||||
test: taskContext.ctx?.run.isTest,
|
||||
payloadType: payloadPacket.dataType,
|
||||
idempotencyKey: options?.idempotencyKey,
|
||||
},
|
||||
@@ -459,7 +459,7 @@ export function createTask<TInput = void, TOutput = unknown, TInitOutput extends
|
||||
attributes: {
|
||||
[SemanticInternalAttributes.STYLE_ICON]: "trigger",
|
||||
[SEMATTRS_MESSAGING_OPERATION]: "publish",
|
||||
["messaging.client_id"]: taskContextManager.worker?.id,
|
||||
["messaging.client_id"]: taskContext.worker?.id,
|
||||
[SEMATTRS_MESSAGING_DESTINATION]: params.queue?.name ?? params.id,
|
||||
[SEMATTRS_MESSAGING_SYSTEM]: "trigger.dev",
|
||||
...(taskMetadata
|
||||
@@ -478,7 +478,7 @@ export function createTask<TInput = void, TOutput = unknown, TInitOutput extends
|
||||
);
|
||||
},
|
||||
batchTriggerAndWait: async (items) => {
|
||||
const ctx = taskContextManager.ctx;
|
||||
const ctx = taskContext.ctx;
|
||||
|
||||
if (!ctx) {
|
||||
throw new Error("batchTriggerAndWait can only be used from inside a task.run()");
|
||||
@@ -503,10 +503,10 @@ export function createTask<TInput = void, TOutput = unknown, TInitOutput extends
|
||||
return {
|
||||
payload: payloadPacket.data,
|
||||
options: {
|
||||
lockToVersion: taskContextManager.worker?.version,
|
||||
lockToVersion: taskContext.worker?.version,
|
||||
queue: item.options?.queue ?? params.queue,
|
||||
concurrencyKey: item.options?.concurrencyKey,
|
||||
test: taskContextManager.ctx?.run.isTest,
|
||||
test: taskContext.ctx?.run.isTest,
|
||||
payloadType: payloadPacket.dataType,
|
||||
idempotencyKey: item.options?.idempotencyKey,
|
||||
},
|
||||
@@ -591,7 +591,7 @@ export function createTask<TInput = void, TOutput = unknown, TInitOutput extends
|
||||
attributes: {
|
||||
[SEMATTRS_MESSAGING_OPERATION]: "publish",
|
||||
["messaging.batch.message_count"]: items.length,
|
||||
["messaging.client_id"]: taskContextManager.worker?.id,
|
||||
["messaging.client_id"]: taskContext.worker?.id,
|
||||
[SEMATTRS_MESSAGING_DESTINATION]: params.queue?.name ?? params.id,
|
||||
[SEMATTRS_MESSAGING_SYSTEM]: "trigger.dev",
|
||||
[SemanticInternalAttributes.STYLE_ICON]: "trigger",
|
||||
|
||||
@@ -24,3 +24,5 @@ export function task<TInput = void, TOutput = unknown, TInitOutput extends InitO
|
||||
): Task<TInput, TOutput> {
|
||||
return createTask<TInput, TOutput, TInitOutput>(options);
|
||||
}
|
||||
|
||||
export type { TaskOptions, Task };
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
diff --git a/build/esm/index.d.ts b/build/esm/index.d.ts
|
||||
index f126d758bb0d2216fc2a3759c538fa15a741217b..54d6893aac1285fb1d78d854c1ab400496327570 100644
|
||||
--- a/build/esm/index.d.ts
|
||||
+++ b/build/esm/index.d.ts
|
||||
@@ -2,7 +2,6 @@
|
||||
import { encodePacket } from "./encodePacket.js";
|
||||
import { decodePacket } from "./decodePacket.js";
|
||||
import { Packet, PacketType, RawData, BinaryType } from "./commons.js";
|
||||
-import type { TransformStream } from "node:stream/web";
|
||||
declare const encodePayload: (packets: Packet[], callback: (encodedPayload: string) => void) => void;
|
||||
declare const decodePayload: (encodedPayload: string, binaryType?: BinaryType) => Packet[];
|
||||
export declare function createPacketEncoderStream(): TransformStream<Packet, any>;
|
||||
Generated
+191
-70
@@ -8,6 +8,9 @@ patchedDependencies:
|
||||
'@changesets/assemble-release-plan@5.2.4':
|
||||
hash: 3wuhjtl4hjck4itk3w32z4cd5u
|
||||
path: patches/@changesets__assemble-release-plan@5.2.4.patch
|
||||
engine.io-parser@5.2.2:
|
||||
hash: e6nctogrhpxoivwiwy37ersfu4
|
||||
path: patches/engine.io-parser@5.2.2.patch
|
||||
tsup@8.0.1:
|
||||
hash: a5ztaafw5l4qfghy2hjjuynb34
|
||||
path: patches/tsup@8.0.1.patch
|
||||
@@ -84,10 +87,10 @@ importers:
|
||||
specifier: ^15.1.0
|
||||
version: 15.1.0
|
||||
socket.io:
|
||||
specifier: ^4.7.4
|
||||
specifier: 4.7.4
|
||||
version: 4.7.4
|
||||
socket.io-client:
|
||||
specifier: ^4.7.4
|
||||
specifier: 4.7.4
|
||||
version: 4.7.4
|
||||
devDependencies:
|
||||
'@types/node':
|
||||
@@ -565,7 +568,7 @@ importers:
|
||||
specifier: ^6.0.0
|
||||
version: 6.1.0
|
||||
socket.io:
|
||||
specifier: ^4.7.4
|
||||
specifier: 4.7.4
|
||||
version: 4.7.4
|
||||
socket.io-adapter:
|
||||
specifier: ^2.5.4
|
||||
@@ -1721,11 +1724,8 @@ importers:
|
||||
humanize-duration:
|
||||
specifier: ^3.27.3
|
||||
version: 3.27.3
|
||||
socket.io:
|
||||
specifier: ^4.7.4
|
||||
version: 4.7.4
|
||||
socket.io-client:
|
||||
specifier: ^4.7.4
|
||||
specifier: 4.7.4
|
||||
version: 4.7.4
|
||||
superjson:
|
||||
specifier: ^2.2.1
|
||||
@@ -1756,14 +1756,17 @@ importers:
|
||||
specifier: ^29.5.3
|
||||
version: 29.5.3
|
||||
'@types/node':
|
||||
specifier: ^18
|
||||
version: 18.17.1
|
||||
specifier: 20.12.7
|
||||
version: 20.12.7
|
||||
jest:
|
||||
specifier: ^29.6.2
|
||||
version: 29.6.2(@types/node@18.17.1)
|
||||
version: 29.6.2(@types/node@20.12.7)
|
||||
rimraf:
|
||||
specifier: ^3.0.2
|
||||
version: 3.0.2
|
||||
socket.io:
|
||||
specifier: 4.7.4
|
||||
version: 4.7.4
|
||||
ts-jest:
|
||||
specifier: ^29.1.1
|
||||
version: 29.1.1(@babel/core@7.22.17)(esbuild@0.19.11)(jest@29.6.2)(typescript@5.3.2)
|
||||
@@ -1785,6 +1788,9 @@ importers:
|
||||
'@types/node':
|
||||
specifier: '18'
|
||||
version: 18.17.1
|
||||
socket.io-client:
|
||||
specifier: ^4.7.4
|
||||
version: 4.7.4
|
||||
typescript:
|
||||
specifier: ^5.3.0
|
||||
version: 5.3.3
|
||||
@@ -2332,6 +2338,9 @@ importers:
|
||||
git-repo-info:
|
||||
specifier: ^2.1.1
|
||||
version: 2.1.1
|
||||
msw:
|
||||
specifier: ^2.2.1
|
||||
version: 2.2.1(typescript@5.3.2)
|
||||
slug:
|
||||
specifier: ^6.0.0
|
||||
version: 6.1.0
|
||||
@@ -2375,9 +2384,6 @@ importers:
|
||||
encoding:
|
||||
specifier: ^0.1.13
|
||||
version: 0.1.13
|
||||
msw:
|
||||
specifier: ^2.2.1
|
||||
version: 2.2.1(typescript@5.3.2)
|
||||
rimraf:
|
||||
specifier: ^3.0.2
|
||||
version: 3.0.2
|
||||
@@ -5236,11 +5242,13 @@ packages:
|
||||
resolution: {integrity: sha512-Or6YHg/kamKHpxULAdSqhGqnWFneIXu1NKvvfBBzKGwpVsYuFIQ5aBPHDnnoR3ghW1nvSkALd+EF9iMtY7Vjxw==}
|
||||
dependencies:
|
||||
cookie: 0.5.0
|
||||
dev: false
|
||||
|
||||
/@bundled-es-modules/statuses@1.0.1:
|
||||
resolution: {integrity: sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg==}
|
||||
dependencies:
|
||||
statuses: 2.0.1
|
||||
dev: false
|
||||
|
||||
/@changesets/apply-release-plan@6.1.4:
|
||||
resolution: {integrity: sha512-FMpKF1fRlJyCZVYHr3CbinpZZ+6MwvOtWUuO8uo+svcATEoc1zRDcj23pAurJ2TZ/uVz1wFHH6K3NlACy0PLew==}
|
||||
@@ -7683,6 +7691,7 @@ packages:
|
||||
dependencies:
|
||||
'@inquirer/core': 7.0.0
|
||||
'@inquirer/type': 1.2.0
|
||||
dev: false
|
||||
|
||||
/@inquirer/core@7.0.0:
|
||||
resolution: {integrity: sha512-g13W5yEt9r1sEVVriffJqQ8GWy94OnfxLCreNSOTw0HPVcszmc/If1KIf7YBmlwtX4klmvwpZHnQpl3N7VX2xA==}
|
||||
@@ -7690,7 +7699,7 @@ packages:
|
||||
dependencies:
|
||||
'@inquirer/type': 1.2.0
|
||||
'@types/mute-stream': 0.0.4
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 20.12.7
|
||||
'@types/wrap-ansi': 3.0.0
|
||||
ansi-escapes: 4.3.2
|
||||
chalk: 4.1.2
|
||||
@@ -7702,10 +7711,12 @@ packages:
|
||||
signal-exit: 4.1.0
|
||||
strip-ansi: 6.0.1
|
||||
wrap-ansi: 6.2.0
|
||||
dev: false
|
||||
|
||||
/@inquirer/type@1.2.0:
|
||||
resolution: {integrity: sha512-/vvkUkYhrjbm+RolU7V1aUFDydZVKNKqKHR5TsE+j5DXgXFwrsOPcoGUJ02K0O7q7O53CU2DOTMYCHeGZ25WHA==}
|
||||
engines: {node: '>=18'}
|
||||
dev: false
|
||||
|
||||
/@internationalized/date@3.5.1:
|
||||
resolution: {integrity: sha512-LUQIfwU9e+Fmutc/DpRTGXSdgYZLBegi4wygCWDSVmUdLTaMHsQyASDiJtREwanwKuQLq0hY76fCJ9J/9I2xOQ==}
|
||||
@@ -7789,14 +7800,14 @@ packages:
|
||||
'@jest/test-result': 29.6.2
|
||||
'@jest/transform': 29.6.2
|
||||
'@jest/types': 29.6.1
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 18.19.20
|
||||
ansi-escapes: 4.3.2
|
||||
chalk: 4.1.2
|
||||
ci-info: 3.8.0
|
||||
exit: 0.1.2
|
||||
graceful-fs: 4.2.10
|
||||
jest-changed-files: 29.5.0
|
||||
jest-config: 29.6.2(@types/node@20.11.22)
|
||||
jest-config: 29.6.2(@types/node@18.19.20)
|
||||
jest-haste-map: 29.6.2
|
||||
jest-message-util: 29.6.2
|
||||
jest-regex-util: 29.4.3
|
||||
@@ -7978,7 +7989,7 @@ packages:
|
||||
'@jest/schemas': 29.6.0
|
||||
'@types/istanbul-lib-coverage': 2.0.4
|
||||
'@types/istanbul-reports': 3.0.1
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 18.19.20
|
||||
'@types/yargs': 17.0.32
|
||||
chalk: 4.1.2
|
||||
dev: true
|
||||
@@ -8029,7 +8040,7 @@ packages:
|
||||
resolution: {integrity: sha512-xxlv5GLX4FVR/dDKEsmi4SPeuB49aRc35stndyxcC73XnUEEwF39vXbROpHOirmDse8WE9vxOjABnSVS+jb7EA==}
|
||||
dependencies:
|
||||
'@types/js-yaml': 4.0.9
|
||||
'@types/node': 20.6.0
|
||||
'@types/node': 20.11.22
|
||||
'@types/request': 2.48.12
|
||||
'@types/ws': 8.5.10
|
||||
byline: 5.0.0
|
||||
@@ -8187,6 +8198,7 @@ packages:
|
||||
/@mswjs/cookies@1.1.0:
|
||||
resolution: {integrity: sha512-0ZcCVQxifZmhwNBoQIrystCb+2sWBY2Zw8lpfJBPCHGCA/HWqehITeCRVIv4VMy8MPlaHo2w2pTHFV2pFfqKPw==}
|
||||
engines: {node: '>=18'}
|
||||
dev: false
|
||||
|
||||
/@mswjs/interceptors@0.17.6:
|
||||
resolution: {integrity: sha512-201pBIWehTURb6q8Gheu4Zhvd3Ox1U4BJq5KiOQsYzkWyfiOG4pwcz5hPZIEryztgrf8/sdwABpvY757xMmfrQ==}
|
||||
@@ -8214,6 +8226,7 @@ packages:
|
||||
is-node-process: 1.2.0
|
||||
outvariant: 1.4.2
|
||||
strict-event-emitter: 0.5.1
|
||||
dev: false
|
||||
|
||||
/@nestjs/cli@10.1.18:
|
||||
resolution: {integrity: sha512-jQtG47keLsACt7b4YwJbTBYRm90n82gJpMaiR1HGAyQ9pccbctjSYu592eT4bxqkUWxPgBE3mpNynXj7dWAfrw==}
|
||||
@@ -9013,12 +9026,14 @@ packages:
|
||||
|
||||
/@open-draft/deferred-promise@2.2.0:
|
||||
resolution: {integrity: sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA==}
|
||||
dev: false
|
||||
|
||||
/@open-draft/logger@0.3.0:
|
||||
resolution: {integrity: sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ==}
|
||||
dependencies:
|
||||
is-node-process: 1.2.0
|
||||
outvariant: 1.4.2
|
||||
dev: false
|
||||
|
||||
/@open-draft/until@1.0.3:
|
||||
resolution: {integrity: sha512-Aq58f5HiWdyDlFffbbSjAlv596h/cOnt2DO1w3DOC7OJ5EHs0hd/nycJfiu9RJbT6Yk6F1knnRRXNSpxoIVZ9Q==}
|
||||
@@ -9026,6 +9041,7 @@ packages:
|
||||
|
||||
/@open-draft/until@2.1.0:
|
||||
resolution: {integrity: sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==}
|
||||
dev: false
|
||||
|
||||
/@opentelemetry/api-logs@0.48.0:
|
||||
resolution: {integrity: sha512-1/aMiU4Eqo3Zzpfwu51uXssp5pzvHFObk8S9pKAiXb1ne8pvg1qxBQitYL1XUiAMEXFzgjaidYG2V6624DRhhw==}
|
||||
@@ -9448,7 +9464,7 @@ packages:
|
||||
engines: {node: '>=16'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@types/node': 20.6.0
|
||||
'@types/node': 18.19.20
|
||||
playwright-core: 1.37.0
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.2
|
||||
@@ -12707,7 +12723,7 @@ packages:
|
||||
resolution: {integrity: sha512-DTuBFbqu4gGfajREEMrkq5jBhcnskinhr4+AnfJEk48zhVeEv3XnUKGIX98B74kxhYsIMfApGGySTn7V3b5yBA==}
|
||||
engines: {node: '>= 12.13.0', npm: '>= 6.12.0'}
|
||||
dependencies:
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 18.19.20
|
||||
dev: false
|
||||
|
||||
/@slack/types@2.8.0:
|
||||
@@ -12722,7 +12738,7 @@ packages:
|
||||
'@slack/logger': 3.0.0
|
||||
'@slack/types': 2.8.0
|
||||
'@types/is-stream': 1.1.0
|
||||
'@types/node': 20.6.0
|
||||
'@types/node': 18.19.20
|
||||
axios: 0.27.2
|
||||
eventemitter3: 3.1.2
|
||||
form-data: 2.5.1
|
||||
@@ -13099,7 +13115,6 @@ packages:
|
||||
|
||||
/@socket.io/component-emitter@3.1.0:
|
||||
resolution: {integrity: sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==}
|
||||
dev: false
|
||||
|
||||
/@socket.io/redis-adapter@8.3.0(socket.io-adapter@2.5.4):
|
||||
resolution: {integrity: sha512-ly0cra+48hDmChxmIpnESKrc94LjRL80TEmZVscuQ/WWkRP81nNj8W8cCGMqbI4L6NCuAaPRSzZF1a9GlAxxnA==}
|
||||
@@ -13671,7 +13686,7 @@ packages:
|
||||
resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==}
|
||||
dependencies:
|
||||
'@types/connect': 3.4.35
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 18.19.20
|
||||
dev: true
|
||||
|
||||
/@types/btoa-lite@1.0.0:
|
||||
@@ -13711,7 +13726,7 @@ packages:
|
||||
/@types/connect@3.4.35:
|
||||
resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 18.19.20
|
||||
dev: true
|
||||
|
||||
/@types/cookie@0.4.1:
|
||||
@@ -13723,6 +13738,7 @@ packages:
|
||||
|
||||
/@types/cookie@0.6.0:
|
||||
resolution: {integrity: sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==}
|
||||
dev: false
|
||||
|
||||
/@types/cookiejar@2.1.2:
|
||||
resolution: {integrity: sha512-t73xJJrvdTjXrn4jLS9VSGRbz0nUY3cl2DMGDU48lKl+HR9dbbjW2A9r3g40VA++mQpy6uuHg33gy7du2BKpog==}
|
||||
@@ -13731,7 +13747,7 @@ packages:
|
||||
/@types/cors@2.8.17:
|
||||
resolution: {integrity: sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 18.19.20
|
||||
|
||||
/@types/d3-array@3.0.8:
|
||||
resolution: {integrity: sha512-2xAVyAUgaXHX9fubjcCbGAUOqYfRJN1em1EKR2HfzWBpObZhwfnZKvofTN4TplMqJdFQao61I+NVSai/vnBvDQ==}
|
||||
@@ -13824,7 +13840,7 @@ packages:
|
||||
/@types/express-serve-static-core@4.17.32:
|
||||
resolution: {integrity: sha512-aI5h/VOkxOF2Z1saPy0Zsxs5avets/iaiAJYznQFm5By/pamU31xWKL//epiF4OfUA2qTOc9PV6tCUjhO8wlZA==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 18.19.20
|
||||
'@types/qs': 6.9.7
|
||||
'@types/range-parser': 1.2.4
|
||||
dev: true
|
||||
@@ -13832,7 +13848,7 @@ packages:
|
||||
/@types/express-serve-static-core@4.17.37:
|
||||
resolution: {integrity: sha512-ZohaCYTgGFcOP7u6aJOhY9uIZQgZ2vxC2yWoArY+FeDXlqeH66ZVBjgvg+RLVAS/DWNq4Ap9ZXu1+SUQiiWYMg==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 18.19.20
|
||||
'@types/qs': 6.9.7
|
||||
'@types/range-parser': 1.2.4
|
||||
'@types/send': 0.17.2
|
||||
@@ -13902,7 +13918,7 @@ packages:
|
||||
/@types/is-stream@1.1.0:
|
||||
resolution: {integrity: sha512-jkZatu4QVbR60mpIzjINmtS1ZF4a/FqdTUTBeQDVOQ2PYyidtwFKr0B5G6ERukKwliq+7mIXvxyppwzG5EgRYg==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 18.19.20
|
||||
dev: false
|
||||
|
||||
/@types/istanbul-lib-coverage@2.0.4:
|
||||
@@ -14018,13 +14034,13 @@ packages:
|
||||
/@types/mock-fs@4.13.1:
|
||||
resolution: {integrity: sha512-m6nFAJ3lBSnqbvDZioawRvpLXSaPyn52Srf7OfzjubYbYX8MTUdIgDxQl0wEapm4m/pNYSd9TXocpQ0TvZFlYA==}
|
||||
dependencies:
|
||||
'@types/node': 20.6.0
|
||||
'@types/node': 18.19.20
|
||||
dev: true
|
||||
|
||||
/@types/morgan@1.9.4:
|
||||
resolution: {integrity: sha512-cXoc4k+6+YAllH3ZHmx4hf7La1dzUk6keTR4bF4b4Sc0mZxU/zK4wO7l+ZzezXm/jkYj/qC+uYGZrarZdIVvyQ==}
|
||||
dependencies:
|
||||
'@types/node': 20.6.0
|
||||
'@types/node': 18.19.20
|
||||
dev: true
|
||||
|
||||
/@types/ms@0.7.31:
|
||||
@@ -14034,6 +14050,7 @@ packages:
|
||||
resolution: {integrity: sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==}
|
||||
dependencies:
|
||||
'@types/node': 18.19.20
|
||||
dev: false
|
||||
|
||||
/@types/nlcst@1.0.1:
|
||||
resolution: {integrity: sha512-aVIyXt6pZiiMOtVByE4Y0gf+BLm1Cxc4ZLSK8VRHn1CgkO+kXbQwN/EBhQmhPdBMjFJCMBKtmNW2zWQuFywz8Q==}
|
||||
@@ -14043,7 +14060,7 @@ packages:
|
||||
/@types/node-fetch@2.6.2:
|
||||
resolution: {integrity: sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==}
|
||||
dependencies:
|
||||
'@types/node': 20.6.0
|
||||
'@types/node': 18.19.20
|
||||
form-data: 3.0.1
|
||||
dev: true
|
||||
|
||||
@@ -14093,6 +14110,12 @@ packages:
|
||||
resolution: {integrity: sha512-/G+IxWxma6V3E+pqK1tSl2Fo1kl41pK1yeCyDsgkF9WlVAme4j5ISYM2zR11bgLFJGLN5sVK40T4RJNuiZbEjA==}
|
||||
dependencies:
|
||||
undici-types: 5.26.5
|
||||
dev: false
|
||||
|
||||
/@types/node@20.12.7:
|
||||
resolution: {integrity: sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==}
|
||||
dependencies:
|
||||
undici-types: 5.26.5
|
||||
|
||||
/@types/node@20.4.2:
|
||||
resolution: {integrity: sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==}
|
||||
@@ -14107,6 +14130,7 @@ packages:
|
||||
|
||||
/@types/node@20.6.0:
|
||||
resolution: {integrity: sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg==}
|
||||
dev: true
|
||||
|
||||
/@types/normalize-package-data@2.4.1:
|
||||
resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==}
|
||||
@@ -14125,7 +14149,7 @@ packages:
|
||||
/@types/pg@8.6.6:
|
||||
resolution: {integrity: sha512-O2xNmXebtwVekJDD+02udOncjVcMZQuTEQEMpKJ0ZRf5E7/9JJX3izhKUcUifBkyKpljyUM6BTgy2trmviKlpw==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 18.19.20
|
||||
pg-protocol: 1.6.0
|
||||
pg-types: 2.2.0
|
||||
dev: false
|
||||
@@ -14189,7 +14213,7 @@ packages:
|
||||
resolution: {integrity: sha512-G3sY+NpsA9jnwm0ixhAFQSJ3Q9JkpLZpJbI3GMv0mIAT0y3mRabYeINzal5WOChIiaTEGQYlHOKgkaM9EisWHw==}
|
||||
dependencies:
|
||||
'@types/caseless': 0.12.5
|
||||
'@types/node': 20.6.0
|
||||
'@types/node': 18.19.20
|
||||
'@types/tough-cookie': 4.0.5
|
||||
form-data: 2.5.1
|
||||
dev: false
|
||||
@@ -14238,7 +14262,7 @@ packages:
|
||||
resolution: {integrity: sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==}
|
||||
dependencies:
|
||||
'@types/mime': 3.0.1
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 18.19.20
|
||||
dev: true
|
||||
|
||||
/@types/set-cookie-parser@2.4.2:
|
||||
@@ -14265,12 +14289,13 @@ packages:
|
||||
|
||||
/@types/statuses@2.0.4:
|
||||
resolution: {integrity: sha512-eqNDvZsCNY49OAXB0Firg/Sc2BgoWsntsLUdybGFOhAfCD6QJ2n9HXUIHGqt5qjrxmMv4wS8WLAw43ZkKcJ8Pw==}
|
||||
dev: false
|
||||
|
||||
/@types/superagent@4.1.19:
|
||||
resolution: {integrity: sha512-McM1mlc7PBZpCaw0fw/36uFqo0YeA6m8JqoyE4OfqXsZCIg0hPP2xdE6FM7r6fdprDZHlJwDpydUj1R++93hCA==}
|
||||
dependencies:
|
||||
'@types/cookiejar': 2.1.2
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 18.19.20
|
||||
dev: true
|
||||
|
||||
/@types/supertest@2.0.14:
|
||||
@@ -14282,14 +14307,14 @@ packages:
|
||||
/@types/tar@6.1.4:
|
||||
resolution: {integrity: sha512-Cp4oxpfIzWt7mr2pbhHT2OTXGMAL0szYCzuf8lRWyIMCgsx6/Hfc3ubztuhvzXHXgraTQxyOCmmg7TDGIMIJJQ==}
|
||||
dependencies:
|
||||
'@types/node': 20.6.0
|
||||
'@types/node': 18.19.20
|
||||
minipass: 4.0.0
|
||||
dev: true
|
||||
|
||||
/@types/through@0.0.30:
|
||||
resolution: {integrity: sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==}
|
||||
dependencies:
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 18.19.20
|
||||
dev: true
|
||||
|
||||
/@types/tinycolor2@1.4.3:
|
||||
@@ -14314,17 +14339,18 @@ packages:
|
||||
|
||||
/@types/wrap-ansi@3.0.0:
|
||||
resolution: {integrity: sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==}
|
||||
dev: false
|
||||
|
||||
/@types/ws@8.5.10:
|
||||
resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==}
|
||||
dependencies:
|
||||
'@types/node': 20.6.0
|
||||
'@types/node': 18.19.20
|
||||
dev: false
|
||||
|
||||
/@types/ws@8.5.4:
|
||||
resolution: {integrity: sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==}
|
||||
dependencies:
|
||||
'@types/node': 20.6.0
|
||||
'@types/node': 18.19.20
|
||||
dev: true
|
||||
|
||||
/@types/yargs-parser@21.0.0:
|
||||
@@ -17054,6 +17080,7 @@ packages:
|
||||
/cli-spinners@2.9.2:
|
||||
resolution: {integrity: sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==}
|
||||
engines: {node: '>=6'}
|
||||
dev: false
|
||||
|
||||
/cli-table3@0.6.3:
|
||||
resolution: {integrity: sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==}
|
||||
@@ -17083,6 +17110,7 @@ packages:
|
||||
/cli-width@4.1.0:
|
||||
resolution: {integrity: sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==}
|
||||
engines: {node: '>= 12'}
|
||||
dev: false
|
||||
|
||||
/client-only@0.0.1:
|
||||
resolution: {integrity: sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==}
|
||||
@@ -18427,18 +18455,18 @@ packages:
|
||||
dependencies:
|
||||
'@socket.io/component-emitter': 3.1.0
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
engine.io-parser: 5.2.2
|
||||
engine.io-parser: 5.2.2(patch_hash=e6nctogrhpxoivwiwy37ersfu4)
|
||||
ws: 8.11.0
|
||||
xmlhttprequest-ssl: 2.0.0
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- supports-color
|
||||
- utf-8-validate
|
||||
dev: false
|
||||
|
||||
/engine.io-parser@5.2.2:
|
||||
/engine.io-parser@5.2.2(patch_hash=e6nctogrhpxoivwiwy37ersfu4):
|
||||
resolution: {integrity: sha512-RcyUFKA93/CXH20l4SoVvzZfrSDMOTUS3bWVpTt2FuFP+XYrL8i8oonHP7WInRyVHXh0n/ORtoeiE1os+8qkSw==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
patched: true
|
||||
|
||||
/engine.io@6.5.4:
|
||||
resolution: {integrity: sha512-KdVSDKhVKyOi+r5uEabrDLZw2qXStVvCsEB/LN3mw4WFi6Gx50jTyuxYVCwAAC0U46FdnzP/ScKRBTXb/NiEOg==}
|
||||
@@ -18446,13 +18474,13 @@ packages:
|
||||
dependencies:
|
||||
'@types/cookie': 0.4.1
|
||||
'@types/cors': 2.8.17
|
||||
'@types/node': 20.6.0
|
||||
'@types/node': 18.19.20
|
||||
accepts: 1.3.8
|
||||
base64id: 2.0.0
|
||||
cookie: 0.4.2
|
||||
cors: 2.8.5
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
engine.io-parser: 5.2.2
|
||||
engine.io-parser: 5.2.2(patch_hash=e6nctogrhpxoivwiwy37ersfu4)
|
||||
ws: 8.11.0
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
@@ -20445,7 +20473,7 @@ packages:
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
dependencies:
|
||||
'@jest/expect-utils': 29.6.2
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 18.19.20
|
||||
jest-get-type: 29.4.3
|
||||
jest-matcher-utils: 29.6.2
|
||||
jest-message-util: 29.6.2
|
||||
@@ -21615,6 +21643,7 @@ packages:
|
||||
/graphql@16.8.1:
|
||||
resolution: {integrity: sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==}
|
||||
engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0}
|
||||
dev: false
|
||||
|
||||
/gray-matter@4.0.3:
|
||||
resolution: {integrity: sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==}
|
||||
@@ -21845,6 +21874,7 @@ packages:
|
||||
|
||||
/headers-polyfill@4.0.2:
|
||||
resolution: {integrity: sha512-EWGTfnTqAO2L/j5HZgoM/3z82L7necsJ0pO9Tp0X1wil3PDLrkypTBRgVO2ExehEEvUycejZD3FuRaXpZZc3kw==}
|
||||
dev: false
|
||||
|
||||
/hexoid@1.0.0:
|
||||
resolution: {integrity: sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==}
|
||||
@@ -22631,6 +22661,7 @@ packages:
|
||||
|
||||
/is-node-process@1.2.0:
|
||||
resolution: {integrity: sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==}
|
||||
dev: false
|
||||
|
||||
/is-npm@6.0.0:
|
||||
resolution: {integrity: sha512-JEjxbSmtPSt1c8XTkVrlujcXdKV1/tvuQ7GwKcAlyiVLeYFQ2VHat8xfrDJsIkhCdF/tZ7CiIR3sy141c6+gPQ==}
|
||||
@@ -23056,6 +23087,35 @@ packages:
|
||||
- ts-node
|
||||
dev: true
|
||||
|
||||
/jest-cli@29.6.2(@types/node@20.12.7):
|
||||
resolution: {integrity: sha512-TT6O247v6dCEX2UGHGyflMpxhnrL0DNqP2fRTKYm3nJJpCTfXX3GCMQPGFjXDoj0i5/Blp3jriKXFgdfmbYB6Q==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0
|
||||
peerDependenciesMeta:
|
||||
node-notifier:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@jest/core': 29.6.2
|
||||
'@jest/test-result': 29.6.2
|
||||
'@jest/types': 29.6.1
|
||||
chalk: 4.1.2
|
||||
exit: 0.1.2
|
||||
graceful-fs: 4.2.10
|
||||
import-local: 3.1.0
|
||||
jest-config: 29.6.2(@types/node@20.12.7)
|
||||
jest-util: 29.6.2
|
||||
jest-validate: 29.6.2
|
||||
prompts: 2.4.2
|
||||
yargs: 17.7.2
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- babel-plugin-macros
|
||||
- supports-color
|
||||
- ts-node
|
||||
dev: true
|
||||
|
||||
/jest-config@29.6.2(@types/node@18.15.13):
|
||||
resolution: {integrity: sha512-VxwFOC8gkiJbuodG9CPtMRjBUNZEHxwfQXmIudSTzFWxaci3Qub1ddTRbFNQlD/zUeaifLndh/eDccFX4wCMQw==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
@@ -23136,7 +23196,7 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/jest-config@29.6.2(@types/node@20.11.22):
|
||||
/jest-config@29.6.2(@types/node@18.19.20):
|
||||
resolution: {integrity: sha512-VxwFOC8gkiJbuodG9CPtMRjBUNZEHxwfQXmIudSTzFWxaci3Qub1ddTRbFNQlD/zUeaifLndh/eDccFX4wCMQw==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
peerDependencies:
|
||||
@@ -23151,7 +23211,47 @@ packages:
|
||||
'@babel/core': 7.22.17
|
||||
'@jest/test-sequencer': 29.6.2
|
||||
'@jest/types': 29.6.1
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 18.19.20
|
||||
babel-jest: 29.6.2(@babel/core@7.22.17)
|
||||
chalk: 4.1.2
|
||||
ci-info: 3.8.0
|
||||
deepmerge: 4.3.1
|
||||
glob: 7.2.3
|
||||
graceful-fs: 4.2.10
|
||||
jest-circus: 29.6.2
|
||||
jest-environment-node: 29.6.2
|
||||
jest-get-type: 29.4.3
|
||||
jest-regex-util: 29.4.3
|
||||
jest-resolve: 29.6.2
|
||||
jest-runner: 29.6.2
|
||||
jest-util: 29.6.2
|
||||
jest-validate: 29.6.2
|
||||
micromatch: 4.0.5
|
||||
parse-json: 5.2.0
|
||||
pretty-format: 29.6.2
|
||||
slash: 3.0.0
|
||||
strip-json-comments: 3.1.1
|
||||
transitivePeerDependencies:
|
||||
- babel-plugin-macros
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/jest-config@29.6.2(@types/node@20.12.7):
|
||||
resolution: {integrity: sha512-VxwFOC8gkiJbuodG9CPtMRjBUNZEHxwfQXmIudSTzFWxaci3Qub1ddTRbFNQlD/zUeaifLndh/eDccFX4wCMQw==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
peerDependencies:
|
||||
'@types/node': '*'
|
||||
ts-node: '>=9.0.0'
|
||||
peerDependenciesMeta:
|
||||
'@types/node':
|
||||
optional: true
|
||||
ts-node:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/core': 7.22.17
|
||||
'@jest/test-sequencer': 29.6.2
|
||||
'@jest/types': 29.6.1
|
||||
'@types/node': 20.12.7
|
||||
babel-jest: 29.6.2(@babel/core@7.22.17)
|
||||
chalk: 4.1.2
|
||||
ci-info: 3.8.0
|
||||
@@ -23416,7 +23516,7 @@ packages:
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
dependencies:
|
||||
'@jest/types': 29.6.1
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 18.19.20
|
||||
chalk: 4.1.2
|
||||
ci-info: 3.8.0
|
||||
graceful-fs: 4.2.10
|
||||
@@ -23510,6 +23610,27 @@ packages:
|
||||
- ts-node
|
||||
dev: true
|
||||
|
||||
/jest@29.6.2(@types/node@20.12.7):
|
||||
resolution: {integrity: sha512-8eQg2mqFbaP7CwfsTpCxQ+sHzw1WuNWL5UUvjnWP4hx2riGz9fPSzYOaU5q8/GqWn1TfgZIVTqYJygbGbWAANg==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0
|
||||
peerDependenciesMeta:
|
||||
node-notifier:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@jest/core': 29.6.2
|
||||
'@jest/types': 29.6.1
|
||||
import-local: 3.1.0
|
||||
jest-cli: 29.6.2(@types/node@20.12.7)
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- babel-plugin-macros
|
||||
- supports-color
|
||||
- ts-node
|
||||
dev: true
|
||||
|
||||
/jiti@1.18.2:
|
||||
resolution: {integrity: sha512-QAdOptna2NYiSSpv0O/BwoHBSmz4YhpzJHyi+fnMRTXFjp7B8i/YG5Z8IfusxB1ufjcD2Sre1F3R+nX3fvy7gg==}
|
||||
hasBin: true
|
||||
@@ -25359,7 +25480,7 @@ packages:
|
||||
type-fest: 4.10.3
|
||||
typescript: 5.3.2
|
||||
yargs: 17.7.2
|
||||
dev: true
|
||||
dev: false
|
||||
|
||||
/msw@2.2.1(typescript@5.3.3):
|
||||
resolution: {integrity: sha512-DCsZAQwan+2onEcpD86fiEnCKW4IvYzqcwDq/2TIoeNrmBqNp/mJW4wHQyxcoYrRPwgujin7wDFflqiSO1iT/w==}
|
||||
@@ -25415,6 +25536,7 @@ packages:
|
||||
/mute-stream@1.0.0:
|
||||
resolution: {integrity: sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==}
|
||||
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
|
||||
dev: false
|
||||
|
||||
/mz@2.7.0:
|
||||
resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==}
|
||||
@@ -26440,6 +26562,7 @@ packages:
|
||||
|
||||
/outvariant@1.4.2:
|
||||
resolution: {integrity: sha512-Ou3dJ6bA/UJ5GVHxah4LnqDwZRwAmWxrG3wtrHrbGnP4RnLCtA64A4F+ae7Y8ww660JaddSoArUR5HjipWSHAQ==}
|
||||
dev: false
|
||||
|
||||
/p-all@2.1.0:
|
||||
resolution: {integrity: sha512-HbZxz5FONzz/z2gJfk6bFca0BCiSRF8jU3yCsWOen/vR6lZjfPOu/e7L3uFzTW1i0H8TlC3vqQstEJPQL4/uLA==}
|
||||
@@ -27826,7 +27949,7 @@ packages:
|
||||
'@protobufjs/path': 1.1.2
|
||||
'@protobufjs/pool': 1.1.0
|
||||
'@protobufjs/utf8': 1.1.0
|
||||
'@types/node': 20.11.22
|
||||
'@types/node': 18.19.20
|
||||
long: 5.2.3
|
||||
|
||||
/proxy-addr@2.0.7:
|
||||
@@ -29262,6 +29385,7 @@ packages:
|
||||
/run-async@3.0.0:
|
||||
resolution: {integrity: sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==}
|
||||
engines: {node: '>=0.12.0'}
|
||||
dev: false
|
||||
|
||||
/run-exclusive@2.2.18:
|
||||
resolution: {integrity: sha512-TXr1Gkl1iEAOCCpBTRm/2m0+1KGjORcWpZZ+VGGTe7dYX8E4y8/fMvrHk0zf+kclec2R//tpvdBxgG0bDgaJfw==}
|
||||
@@ -29799,7 +29923,6 @@ packages:
|
||||
- bufferutil
|
||||
- supports-color
|
||||
- utf-8-validate
|
||||
dev: false
|
||||
|
||||
/socket.io-client@4.7.4:
|
||||
resolution: {integrity: sha512-wh+OkeF0rAVCrABWQBaEjLfb7DVPotMbu0cgWgyR0v6eA4EoVnAwcIeIbcdTE3GT/H3kbdLl7OoH2+asoDRIIg==}
|
||||
@@ -29813,7 +29936,6 @@ packages:
|
||||
- bufferutil
|
||||
- supports-color
|
||||
- utf-8-validate
|
||||
dev: false
|
||||
|
||||
/socket.io-parser@4.2.4:
|
||||
resolution: {integrity: sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==}
|
||||
@@ -29823,7 +29945,6 @@ packages:
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/socket.io@4.7.4:
|
||||
resolution: {integrity: sha512-DcotgfP1Zg9iP/dH9zvAQcWrE0TtbMVwXmlV4T4mqsvY+gw+LqUGPfx2AoVyRk0FLME+GQhufDMyacFmw7ksqw==}
|
||||
@@ -29840,7 +29961,6 @@ packages:
|
||||
- bufferutil
|
||||
- supports-color
|
||||
- utf-8-validate
|
||||
dev: false
|
||||
|
||||
/socks-proxy-agent@7.0.0:
|
||||
resolution: {integrity: sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww==}
|
||||
@@ -30188,6 +30308,7 @@ packages:
|
||||
|
||||
/strict-event-emitter@0.5.1:
|
||||
resolution: {integrity: sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==}
|
||||
dev: false
|
||||
|
||||
/string-hash@1.1.3:
|
||||
resolution: {integrity: sha512-kJUvRUFK49aub+a7T1nNE66EJbZBMnBgoC1UbCZ5n6bsZKBRga4KgBRTMn/pFkeCZSYtNeSyMxPDM0AXWELk2A==}
|
||||
@@ -30357,7 +30478,7 @@ packages:
|
||||
resolution: {integrity: sha512-WrDlYH1p5jliY7uzSU5nLDY7OCIeRe6FkC0hhScpTGwMthP/Muk38WXGeggjDHKeXAGCs43jUheZ7Ud/NEAJdg==}
|
||||
engines: {node: '>=12.*'}
|
||||
dependencies:
|
||||
'@types/node': 20.6.0
|
||||
'@types/node': 18.19.20
|
||||
qs: 6.11.0
|
||||
|
||||
/striptags@2.2.1:
|
||||
@@ -31891,6 +32012,7 @@ packages:
|
||||
/type-fest@4.10.3:
|
||||
resolution: {integrity: sha512-JLXyjizi072smKGGcZiAJDCNweT8J+AuRxmPZ1aG7TERg4ijx9REl8CNhbr36RV4qXqL1gO1FF9HL8OkVmmrsA==}
|
||||
engines: {node: '>=16'}
|
||||
dev: false
|
||||
|
||||
/type-fest@4.3.1:
|
||||
resolution: {integrity: sha512-pphNW/msgOUSkJbH58x8sqpq8uQj6b0ZKGxEsLKMUnGorRcDjrUaLS+39+/ub41JNTwrrMyJcUB8+YZs3mbwqw==}
|
||||
@@ -32580,7 +32702,7 @@ packages:
|
||||
- terser
|
||||
dev: true
|
||||
|
||||
/vite-node@0.28.5(@types/node@20.6.0):
|
||||
/vite-node@0.28.5(@types/node@18.19.20):
|
||||
resolution: {integrity: sha512-LmXb9saMGlrMZbXTvOveJKwMTBTNUH66c8rJnQ0ZPNX+myPEol64+szRzXtV5ORb0Hb/91yq+/D3oERoyAt6LA==}
|
||||
engines: {node: '>=v14.16.0'}
|
||||
hasBin: true
|
||||
@@ -32592,7 +32714,7 @@ packages:
|
||||
picocolors: 1.0.0
|
||||
source-map: 0.6.1
|
||||
source-map-support: 0.5.21
|
||||
vite: 4.4.9(@types/node@20.6.0)
|
||||
vite: 4.4.9(@types/node@18.19.20)
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- less
|
||||
@@ -32604,7 +32726,7 @@ packages:
|
||||
- terser
|
||||
dev: true
|
||||
|
||||
/vite-node@0.34.4(@types/node@20.6.0):
|
||||
/vite-node@0.34.4(@types/node@18.19.20):
|
||||
resolution: {integrity: sha512-ho8HtiLc+nsmbwZMw8SlghESEE3KxJNp04F/jPUCLVvaURwt0d+r9LxEqCX5hvrrOQ0GSyxbYr5ZfRYhQ0yVKQ==}
|
||||
engines: {node: '>=v14.18.0'}
|
||||
hasBin: true
|
||||
@@ -32614,7 +32736,7 @@ packages:
|
||||
mlly: 1.4.2
|
||||
pathe: 1.1.1
|
||||
picocolors: 1.0.0
|
||||
vite: 4.4.9(@types/node@20.6.0)
|
||||
vite: 4.4.9(@types/node@18.19.20)
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- less
|
||||
@@ -32691,7 +32813,7 @@ packages:
|
||||
fsevents: 2.3.3
|
||||
dev: true
|
||||
|
||||
/vite@4.1.4(@types/node@20.6.0):
|
||||
/vite@4.1.4(@types/node@18.19.20):
|
||||
resolution: {integrity: sha512-3knk/HsbSTKEin43zHu7jTwYWv81f8kgAL99G5NWBcA1LKvtvcVAC4JjBH1arBunO9kQka+1oGbrMKOjk4ZrBg==}
|
||||
engines: {node: ^14.18.0 || >=16.0.0}
|
||||
hasBin: true
|
||||
@@ -32716,7 +32838,7 @@ packages:
|
||||
terser:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@types/node': 20.6.0
|
||||
'@types/node': 18.19.20
|
||||
esbuild: 0.16.17
|
||||
postcss: 8.4.29
|
||||
resolve: 1.22.1
|
||||
@@ -32796,7 +32918,7 @@ packages:
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.3
|
||||
|
||||
/vite@4.4.9(@types/node@20.6.0):
|
||||
/vite@4.4.9(@types/node@18.19.20):
|
||||
resolution: {integrity: sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==}
|
||||
engines: {node: ^14.18.0 || >=16.0.0}
|
||||
hasBin: true
|
||||
@@ -32824,7 +32946,7 @@ packages:
|
||||
terser:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@types/node': 20.6.0
|
||||
'@types/node': 18.19.20
|
||||
esbuild: 0.18.11
|
||||
postcss: 8.4.29
|
||||
rollup: 3.29.1
|
||||
@@ -32901,7 +33023,7 @@ packages:
|
||||
dependencies:
|
||||
'@types/chai': 4.3.4
|
||||
'@types/chai-subset': 1.3.3
|
||||
'@types/node': 20.6.0
|
||||
'@types/node': 18.19.20
|
||||
'@vitest/expect': 0.28.5
|
||||
'@vitest/runner': 0.28.5
|
||||
'@vitest/spy': 0.28.5
|
||||
@@ -32920,8 +33042,8 @@ packages:
|
||||
tinybench: 2.3.1
|
||||
tinypool: 0.3.1
|
||||
tinyspy: 1.0.2
|
||||
vite: 4.1.4(@types/node@20.6.0)
|
||||
vite-node: 0.28.5(@types/node@20.6.0)
|
||||
vite: 4.1.4(@types/node@18.19.20)
|
||||
vite-node: 0.28.5(@types/node@18.19.20)
|
||||
why-is-node-running: 2.2.2
|
||||
transitivePeerDependencies:
|
||||
- less
|
||||
@@ -32966,7 +33088,7 @@ packages:
|
||||
dependencies:
|
||||
'@types/chai': 4.3.6
|
||||
'@types/chai-subset': 1.3.3
|
||||
'@types/node': 20.6.0
|
||||
'@types/node': 18.19.20
|
||||
'@vitest/expect': 0.34.4
|
||||
'@vitest/runner': 0.34.4
|
||||
'@vitest/snapshot': 0.34.4
|
||||
@@ -32985,8 +33107,8 @@ packages:
|
||||
strip-literal: 1.0.1
|
||||
tinybench: 2.5.0
|
||||
tinypool: 0.7.0
|
||||
vite: 4.4.9(@types/node@20.6.0)
|
||||
vite-node: 0.34.4(@types/node@20.6.0)
|
||||
vite: 4.4.9(@types/node@18.19.20)
|
||||
vite-node: 0.34.4(@types/node@18.19.20)
|
||||
why-is-node-running: 2.2.2
|
||||
transitivePeerDependencies:
|
||||
- less
|
||||
@@ -33597,7 +33719,6 @@ packages:
|
||||
/xmlhttprequest-ssl@2.0.0:
|
||||
resolution: {integrity: sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
dev: false
|
||||
|
||||
/xtend@4.0.2:
|
||||
resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { task } from "@trigger.dev/sdk/v3";
|
||||
|
||||
export const byeWorldSubdir = task({
|
||||
id: "bye-world-subdir-2",
|
||||
run: async (payload: { message: string }) => {
|
||||
return {
|
||||
bye: "worlds",
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
import { task } from "@trigger.dev/sdk/v3";
|
||||
|
||||
export const helloWorldSubdir = task({
|
||||
id: "hello-world-subdir-2",
|
||||
run: async (payload: { message: string }) => {
|
||||
return {
|
||||
hello: "worlds",
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -4,7 +4,7 @@ import { taskWithRetries } from "./retries";
|
||||
export const simpleParentTask = task({
|
||||
id: "simple-parent-task",
|
||||
run: async (payload: { message: string }) => {
|
||||
await simpleChildTask.trigger({
|
||||
const result = await simpleChildTask.trigger({
|
||||
message: `${payload.message} - 2.a`,
|
||||
});
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import { InMemoryCache, createCache } from "@trigger.dev/sdk/v3";
|
||||
|
||||
export const cache = createCache(new InMemoryCache());
|
||||
|
||||
export const fakeTask = {
|
||||
id: "this-task-doesnt-exist",
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user