diff --git a/docs/guides/frameworks/supabase-edge-functions-basic.mdx b/docs/guides/frameworks/supabase-edge-functions-basic.mdx index db050292ff..2608740160 100644 --- a/docs/guides/frameworks/supabase-edge-functions-basic.mdx +++ b/docs/guides/frameworks/supabase-edge-functions-basic.mdx @@ -77,7 +77,7 @@ Replace the placeholder code in your `edge-function-trigger/index.ts` file with // Setup type definitions for built-in Supabase Runtime APIs import "jsr:@supabase/functions-js/edge-runtime.d.ts"; // Import the Trigger.dev SDK - replace "" with the version of the SDK you are using, e.g. "3.0.0". You can find this in your package.json file. -import { tasks } from "npm:@trigger.dev/sdk@3.0.0/v3"; +import { tasks } from "npm:@trigger.dev/sdk@3.0.0"; // Import your task type from your /trigger folder import type { helloWorldTask } from "../../../src/trigger/example.ts"; // 👆 **type-only** import diff --git a/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx b/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx index 81b04cae6d..4114e95ef9 100644 --- a/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx +++ b/docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx @@ -330,7 +330,7 @@ supabase functions new video-processing-handler ```ts functions/video-processing-handler/index.ts // Setup type definitions for built-in Supabase Runtime APIs import "jsr:@supabase/functions-js/edge-runtime.d.ts"; -import { tasks } from "npm:@trigger.dev/sdk@latest/v3"; +import { tasks } from "npm:@trigger.dev/sdk@latest"; // Import the videoProcessAndUpdate task from the trigger folder import type { videoProcessAndUpdate } from "../../../src/trigger/videoProcessAndUpdate.ts"; // 👆 type only import diff --git a/docs/guides/python/python-crawl4ai.mdx b/docs/guides/python/python-crawl4ai.mdx index 8cb0d7f210..d66aeb1e2b 100644 --- a/docs/guides/python/python-crawl4ai.mdx +++ b/docs/guides/python/python-crawl4ai.mdx @@ -62,7 +62,7 @@ After you've initialized your project with Trigger.dev, add these build settings ```ts trigger.config.ts import { defineConfig } from "@trigger.dev/sdk"; import { pythonExtension } from "@trigger.dev/python/extension"; -import type { BuildContext, BuildExtension } from "@trigger.dev/core/v3/build"; +import type { BuildContext, BuildExtension } from "@trigger.dev/core/build"; export default defineConfig({ project: "", diff --git a/docs/how-to-reduce-your-spend.mdx b/docs/how-to-reduce-your-spend.mdx index a65af5ce47..0fc8949fe9 100644 --- a/docs/how-to-reduce-your-spend.mdx +++ b/docs/how-to-reduce-your-spend.mdx @@ -6,6 +6,7 @@ description: "Tips and best practices to reduce your costs on Trigger.dev" ## Check out your usage page regularly Monitor your usage dashboard to understand your spending patterns. You can see: + - Your most expensive tasks - Your total duration by task - Number of runs by task @@ -18,6 +19,7 @@ You can view your usage page by clicking the "Organization" menu in the top left ## Create billing alerts Configure billing alerts in your dashboard to get notified when you approach spending thresholds. This helps you: + - Catch unexpected cost increases early - Identify runaway tasks before they become expensive @@ -43,7 +45,7 @@ export const lightTask = task({ // Only use larger machines when necessary export const heavyTask = task({ - id: "heavy-task", + id: "heavy-task", machine: "medium-1x", // 1 vCPU, 2 GB RAM run: async (payload) => { // CPU/memory intensive operations @@ -64,11 +66,14 @@ export const expensiveApiCall = task({ id: "expensive-api-call", run: async (payload: { userId: string }) => { // This expensive operation will only run once per user - await wait.for({ seconds: 30 }, { - idempotencyKey: `user-processing-${payload.userId}`, - idempotencyKeyTTL: "1h" - }); - + await wait.for( + { seconds: 30 }, + { + idempotencyKey: `user-processing-${payload.userId}`, + idempotencyKeyTTL: "1h", + } + ); + const result = await processUserData(payload.userId); return result; }, @@ -105,7 +110,7 @@ export const processItems = task({ id: "process-items", run: async (payload: { items: string[] }) => { // Process all items in parallel - const promises = payload.items.map(item => processItem(item)); + const promises = payload.items.map((item) => processItem(item)); // This works very well for API calls await Promise.all(promises); }, @@ -133,7 +138,7 @@ export const apiTask = task({ This is very useful for intermittent errors, but if there's a permanent error you don't want to retry because you will just keep failing and waste compute. Use [AbortTaskRunError](/errors-retrying#using-aborttaskrunerror) to prevent a retry: ```ts -import { task, AbortTaskRunError } from "@trigger.dev/sdk/v3"; +import { task, AbortTaskRunError } from "@trigger.dev/sdk"; export const someTask = task({ id: "some-task", @@ -145,13 +150,11 @@ export const someTask = task({ throw new AbortTaskRunError(result.error); } - return result + return result; }, }); ``` - - ## Use appropriate maxDuration settings Set realistic maxDurations to prevent runs from executing for too long: diff --git a/docs/realtime/auth.mdx b/docs/realtime/auth.mdx index e574d07e6b..80634b82a8 100644 --- a/docs/realtime/auth.mdx +++ b/docs/realtime/auth.mdx @@ -23,7 +23,7 @@ You can create a Public Access Token using the `auth.createPublicToken` function ```tsx // Somewhere in your backend code -import { auth } from "@trigger.dev/sdk/v3"; +import { auth } from "@trigger.dev/sdk"; const publicToken = await auth.createPublicToken(); // 👈 this public access token has no permissions, so is pretty useless! ``` @@ -33,7 +33,7 @@ const publicToken = await auth.createPublicToken(); // 👈 this public access t By default a Public Access Token has no permissions. You must specify the scopes you need when creating a Public Access Token: ```ts -import { auth } from "@trigger.dev/sdk/v3"; +import { auth } from "@trigger.dev/sdk"; const publicToken = await auth.createPublicToken({ scopes: { @@ -47,7 +47,7 @@ const publicToken = await auth.createPublicToken({ This will allow the token to read all runs, which is probably not what you want. You can specify only certain runs by passing an array of run IDs: ```ts -import { auth } from "@trigger.dev/sdk/v3"; +import { auth } from "@trigger.dev/sdk"; const publicToken = await auth.createPublicToken({ scopes: { @@ -61,7 +61,7 @@ const publicToken = await auth.createPublicToken({ You can scope the token to only read certain tasks: ```ts -import { auth } from "@trigger.dev/sdk/v3"; +import { auth } from "@trigger.dev/sdk"; const publicToken = await auth.createPublicToken({ scopes: { @@ -75,7 +75,7 @@ const publicToken = await auth.createPublicToken({ Or tags: ```ts -import { auth } from "@trigger.dev/sdk/v3"; +import { auth } from "@trigger.dev/sdk"; const publicToken = await auth.createPublicToken({ scopes: { @@ -89,7 +89,7 @@ const publicToken = await auth.createPublicToken({ Or a specific batch of runs: ```ts -import { auth } from "@trigger.dev/sdk/v3"; +import { auth } from "@trigger.dev/sdk"; const publicToken = await auth.createPublicToken({ scopes: { @@ -103,7 +103,7 @@ const publicToken = await auth.createPublicToken({ You can also combine scopes. For example, to read runs with specific tags and for specific tasks: ```ts -import { auth } from "@trigger.dev/sdk/v3"; +import { auth } from "@trigger.dev/sdk"; const publicToken = await auth.createPublicToken({ scopes: { @@ -120,7 +120,7 @@ const publicToken = await auth.createPublicToken({ By default, Public Access Token's expire after 15 minutes. You can specify a different expiration time when creating a Public Access Token: ```ts -import { auth } from "@trigger.dev/sdk/v3"; +import { auth } from "@trigger.dev/sdk"; const publicToken = await auth.createPublicToken({ expirationTime: "1hr", @@ -156,7 +156,7 @@ For triggering tasks from your frontend, you need special "trigger" tokens. Thes ### Creating Trigger Tokens ```ts -import { auth } from "@trigger.dev/sdk/v3"; +import { auth } from "@trigger.dev/sdk"; // Somewhere in your backend code const triggerToken = await auth.createTriggerPublicToken("my-task"); @@ -167,7 +167,7 @@ const triggerToken = await auth.createTriggerPublicToken("my-task"); You can pass multiple tasks to create a token that can trigger multiple tasks: ```ts -import { auth } from "@trigger.dev/sdk/v3"; +import { auth } from "@trigger.dev/sdk"; // Somewhere in your backend code const triggerToken = await auth.createTriggerPublicToken(["my-task-1", "my-task-2"]); @@ -178,7 +178,7 @@ const triggerToken = await auth.createTriggerPublicToken(["my-task-1", "my-task- You can also create tokens that can be used multiple times: ```ts -import { auth } from "@trigger.dev/sdk/v3"; +import { auth } from "@trigger.dev/sdk"; // Somewhere in your backend code const triggerToken = await auth.createTriggerPublicToken("my-task", { @@ -191,7 +191,7 @@ const triggerToken = await auth.createTriggerPublicToken("my-task", { These tokens also expire, with the default expiration time being 15 minutes. You can specify a custom expiration time: ```ts -import { auth } from "@trigger.dev/sdk/v3"; +import { auth } from "@trigger.dev/sdk"; // Somewhere in your backend code const triggerToken = await auth.createTriggerPublicToken("my-task", { diff --git a/docs/realtime/backend/overview.mdx b/docs/realtime/backend/overview.mdx index 079004e923..de13fd70ec 100644 --- a/docs/realtime/backend/overview.mdx +++ b/docs/realtime/backend/overview.mdx @@ -30,7 +30,7 @@ See our [authentication guide](/realtime/auth) for detailed information on creat Subscribe to a run: ```ts -import { runs, tasks } from "@trigger.dev/sdk/v3"; +import { runs, tasks } from "@trigger.dev/sdk"; // Trigger a task const handle = await tasks.trigger("my-task", { some: "data" }); diff --git a/docs/realtime/backend/streams.mdx b/docs/realtime/backend/streams.mdx index 7a5ae28d51..9593578da1 100644 --- a/docs/realtime/backend/streams.mdx +++ b/docs/realtime/backend/streams.mdx @@ -20,7 +20,7 @@ Streams use the metadata system to send data chunks in real-time. You register a Here's how to stream data from OpenAI in your task: ```ts -import { task, metadata } from "@trigger.dev/sdk/v3"; +import { task, metadata } from "@trigger.dev/sdk"; import OpenAI from "openai"; const openai = new OpenAI({ @@ -64,7 +64,7 @@ export const myTask = task({ You can subscribe to the stream using the `runs.subscribeToRun` method with `.withStreams()`: ```ts -import { runs } from "@trigger.dev/sdk/v3"; +import { runs } from "@trigger.dev/sdk"; import type { myTask, STREAMS } from "./trigger/my-task"; // Somewhere in your backend @@ -91,7 +91,7 @@ async function subscribeToStream(runId: string) { You can register and subscribe to multiple streams in the same task: ```ts -import { task, metadata } from "@trigger.dev/sdk/v3"; +import { task, metadata } from "@trigger.dev/sdk"; import OpenAI from "openai"; const openai = new OpenAI({ @@ -138,7 +138,7 @@ export const myTask = task({ Then subscribe to both streams: ```ts -import { runs } from "@trigger.dev/sdk/v3"; +import { runs } from "@trigger.dev/sdk"; import type { myTask, STREAMS } from "./trigger/my-task"; // Somewhere in your backend @@ -170,7 +170,7 @@ The [AI SDK](https://sdk.vercel.ai/docs/introduction) provides a higher-level AP ```ts import { openai } from "@ai-sdk/openai"; -import { logger, metadata, runs, schemaTask } from "@trigger.dev/sdk/v3"; +import { logger, metadata, runs, schemaTask } from "@trigger.dev/sdk"; import { streamText } from "ai"; import { z } from "zod"; @@ -215,7 +215,7 @@ When using tools with the AI SDK, you can access tool calls and results using th ```ts import { openai } from "@ai-sdk/openai"; -import { logger, metadata, runs, schemaTask } from "@trigger.dev/sdk/v3"; +import { logger, metadata, runs, schemaTask } from "@trigger.dev/sdk"; import { streamText, tool, type TextStreamPart } from "ai"; import { z } from "zod"; @@ -283,7 +283,7 @@ You can define a Trigger.dev task that can be used as a tool, and will automatic ```ts import { openai } from "@ai-sdk/openai"; -import { logger, metadata, runs, schemaTask, toolTask } from "@trigger.dev/sdk/v3"; +import { logger, metadata, runs, schemaTask, toolTask } from "@trigger.dev/sdk"; import { streamText, tool, type TextStreamPart } from "ai"; import { z } from "zod"; diff --git a/docs/realtime/backend/subscribe.mdx b/docs/realtime/backend/subscribe.mdx index 973ce1414c..ffa46532bf 100644 --- a/docs/realtime/backend/subscribe.mdx +++ b/docs/realtime/backend/subscribe.mdx @@ -11,7 +11,7 @@ These functions allow you to subscribe to run updates from your backend code. Ea Subscribes to all changes to a specific run. ```ts Example -import { runs } from "@trigger.dev/sdk/v3"; +import { runs } from "@trigger.dev/sdk"; for await (const run of runs.subscribeToRun("run_1234")) { console.log(run); @@ -29,7 +29,7 @@ This function subscribes to all changes to a run. It returns an async iterator t Subscribes to all changes to runs with a specific tag. ```ts Example -import { runs } from "@trigger.dev/sdk/v3"; +import { runs } from "@trigger.dev/sdk"; for await (const run of runs.subscribeToRunsWithTag("user:1234")) { console.log(run); @@ -47,7 +47,7 @@ This function subscribes to all changes to runs with a specific tag. It returns Subscribes to all changes for runs in a batch. ```ts Example -import { runs } from "@trigger.dev/sdk/v3"; +import { runs } from "@trigger.dev/sdk"; for await (const run of runs.subscribeToBatch("batch_1234")) { console.log(run); @@ -65,7 +65,7 @@ This function subscribes to all changes for runs in a batch. It returns an async You can infer the types of the run's payload and output by passing the type of the task to the subscribe functions: ```ts -import { runs, tasks } from "@trigger.dev/sdk/v3"; +import { runs, tasks } from "@trigger.dev/sdk"; import type { myTask } from "./trigger/my-task"; async function myBackend() { @@ -85,7 +85,7 @@ async function myBackend() { When using `subscribeToRunsWithTag`, you can pass a union of task types: ```ts -import { runs } from "@trigger.dev/sdk/v3"; +import { runs } from "@trigger.dev/sdk"; import type { myTask, myOtherTask } from "./trigger/my-task"; for await (const run of runs.subscribeToRunsWithTag("my-tag")) { @@ -130,7 +130,7 @@ This example task updates the progress of a task as it processes items. ```ts // Your task code -import { task, metadata } from "@trigger.dev/sdk/v3"; +import { task, metadata } from "@trigger.dev/sdk"; export const progressTask = task({ id: "progress-task", @@ -165,7 +165,7 @@ We can now subscribe to the runs and receive real-time metadata updates. ```ts // Somewhere in your backend code -import { runs } from "@trigger.dev/sdk/v3"; +import { runs } from "@trigger.dev/sdk"; import type { progressTask } from "./trigger/progress-task"; async function monitorProgress(runId: string) { @@ -199,7 +199,7 @@ For more information on how to write tasks that use the metadata API, as well as You can get type safety for your metadata by defining types: ```ts -import { runs } from "@trigger.dev/sdk/v3"; +import { runs } from "@trigger.dev/sdk"; import type { progressTask } from "./trigger/progress-task"; interface ProgressMetadata { diff --git a/docs/realtime/how-it-works.mdx b/docs/realtime/how-it-works.mdx index 594b9da926..04dd13dada 100644 --- a/docs/realtime/how-it-works.mdx +++ b/docs/realtime/how-it-works.mdx @@ -25,7 +25,7 @@ The run object returned by Realtime subscriptions is optimized for streaming upd After you trigger a task, you can subscribe to the run using the `runs.subscribeToRun` function. This function returns an async iterator that you can use to get updates on the run status. ```ts -import { runs, tasks } from "@trigger.dev/sdk/v3"; +import { runs, tasks } from "@trigger.dev/sdk"; // Somewhere in your backend code async function myBackend() { @@ -43,7 +43,7 @@ Every time the run changes, the async iterator will yield the updated run. You c Alternatively, you can subscribe to changes to any run that includes a specific tag (or tags) using the `runs.subscribeToRunsWithTag` function. ```ts -import { runs } from "@trigger.dev/sdk/v3"; +import { runs } from "@trigger.dev/sdk"; // Somewhere in your backend code for await (const run of runs.subscribeToRunsWithTag("user:1234")) { @@ -55,7 +55,7 @@ for await (const run of runs.subscribeToRunsWithTag("user:1234")) { If you've used `batchTrigger` to trigger multiple runs, you can also subscribe to changes to all the runs triggered in the batch using the `runs.subscribeToBatch` function. ```ts -import { runs } from "@trigger.dev/sdk/v3"; +import { runs } from "@trigger.dev/sdk"; // Somewhere in your backend code for await (const run of runs.subscribeToBatch("batch-id")) { diff --git a/docs/realtime/run-object.mdx b/docs/realtime/run-object.mdx index e5a7b654d7..a7b16447e3 100644 --- a/docs/realtime/run-object.mdx +++ b/docs/realtime/run-object.mdx @@ -126,7 +126,7 @@ Type-safety is supported for the run object, so you can infer the types of the r You can infer the types of the run's payload and output by passing the type of the task to the `subscribeToRun` function. This will give you type-safe access to the run's payload and output. ```ts -import { runs, tasks } from "@trigger.dev/sdk/v3"; +import { runs, tasks } from "@trigger.dev/sdk"; import type { myTask } from "./trigger/my-task"; // Somewhere in your backend code @@ -148,7 +148,7 @@ async function myBackend() { When using `subscribeToRunsWithTag`, you can pass a union of task types for all the possible tasks that can have the tag. ```ts -import { runs } from "@trigger.dev/sdk/v3"; +import { runs } from "@trigger.dev/sdk"; import type { myTask, myOtherTask } from "./trigger/my-task"; // Somewhere in your backend code diff --git a/docs/runs/metadata.mdx b/docs/runs/metadata.mdx index 04542dfed4..2b6f6955a7 100644 --- a/docs/runs/metadata.mdx +++ b/docs/runs/metadata.mdx @@ -523,7 +523,7 @@ Using metadata updates in conjunction with our [Realtime React hooks](/realtime/ Track progress with percentage and current step: ```ts -import { task, metadata } from "@trigger.dev/sdk/v3"; +import { task, metadata } from "@trigger.dev/sdk"; export const batchProcessingTask = task({ id: "batch-processing", @@ -550,7 +550,7 @@ export const batchProcessingTask = task({ Append log entries while maintaining status: ```ts -import { task, metadata } from "@trigger.dev/sdk/v3"; +import { task, metadata } from "@trigger.dev/sdk"; export const deploymentTask = task({ id: "deployment", @@ -584,7 +584,7 @@ export const deploymentTask = task({ Store user information and notification preferences: ```ts -import { task, metadata } from "@trigger.dev/sdk/v3"; +import { task, metadata } from "@trigger.dev/sdk"; export const userTask = task({ id: "user-task", diff --git a/docs/snippets/node-versions.mdx b/docs/snippets/node-versions.mdx index 70a173d5a2..b82e0a9c59 100644 --- a/docs/snippets/node-versions.mdx +++ b/docs/snippets/node-versions.mdx @@ -13,7 +13,7 @@ Trigger.dev runs your tasks on specific Node.js versions: You can change the runtime by setting the `runtime` field in your `trigger.config.ts` file. ```ts -import { defineConfig } from "@trigger.dev/sdk/v3"; +import { defineConfig } from "@trigger.dev/sdk"; export default defineConfig({ // "node", "node-22" or "bun" diff --git a/docs/troubleshooting.mdx b/docs/troubleshooting.mdx index 30a5fe526f..d8ed3d095a 100644 --- a/docs/troubleshooting.mdx +++ b/docs/troubleshooting.mdx @@ -39,7 +39,7 @@ Ensure you have stopped your local dev server then locate the hidden `.trigger` If you see errors like this when running `trigger.dev dev`: ``` -Could not resolve "@trigger.dev/core/v3" +Could not resolve "@trigger.dev/core" The Yarn Plug'n'Play manifest forbids importing "@trigger.dev/core" here because it's not listed as a dependency of this package ``` @@ -118,7 +118,6 @@ export default defineConfig({ - ## Project setup issues ### `The requested module 'node:events' does not provide an export named 'addAbortListener'` diff --git a/docs/v3-openapi.yaml b/docs/v3-openapi.yaml index b94280419b..acc40088a8 100644 --- a/docs/v3-openapi.yaml +++ b/docs/v3-openapi.yaml @@ -43,7 +43,7 @@ paths: x-codeSamples: - lang: typescript source: |- - import { schedules } from "@trigger.dev/sdk/v3"; + import { schedules } from "@trigger.dev/sdk"; const schedule = await schedules.create({ task: 'my-task', @@ -85,7 +85,7 @@ paths: x-codeSamples: - lang: typescript source: |- - import { schedules } from "@trigger.dev/sdk/v3"; + import { schedules } from "@trigger.dev/sdk"; const allSchedules = await schedules.list(); @@ -120,7 +120,7 @@ paths: x-codeSamples: - lang: typescript source: |- - import { schedules } from "@trigger.dev/sdk/v3"; + import { schedules } from "@trigger.dev/sdk"; const schedule = await schedules.retrieve(scheduleId); @@ -163,7 +163,7 @@ paths: x-codeSamples: - lang: typescript source: |- - import { schedules } from "@trigger.dev/sdk/v3"; + import { schedules } from "@trigger.dev/sdk"; const updatedSchedule = await schedules.update(scheduleId, { task: 'my-updated-task', @@ -195,7 +195,7 @@ paths: x-codeSamples: - lang: typescript source: |- - import { schedules } from "@trigger.dev/sdk/v3"; + import { schedules } from "@trigger.dev/sdk"; await schedules.del(scheduleId); @@ -229,7 +229,7 @@ paths: x-codeSamples: - lang: typescript source: |- - import { schedules } from "@trigger.dev/sdk/v3"; + import { schedules } from "@trigger.dev/sdk"; const schedule = await schedules.deactivate(scheduleId); @@ -263,7 +263,7 @@ paths: x-codeSamples: - lang: typescript source: |- - import { schedules } from "@trigger.dev/sdk/v3"; + import { schedules } from "@trigger.dev/sdk"; const schedule = await schedules.activate(scheduleId); @@ -292,7 +292,7 @@ paths: x-codeSamples: - lang: typescript source: |- - import { schedules } from "@trigger.dev/sdk/v3"; + import { schedules } from "@trigger.dev/sdk"; const { timezones } = await schedules.timezones(); @@ -356,7 +356,7 @@ paths: x-codeSamples: - lang: typescript source: |- - import { runs } from "@trigger.dev/sdk/v3"; + import { runs } from "@trigger.dev/sdk"; const handle = await runs.replay("run_1234"); @@ -431,7 +431,7 @@ paths: - lang: typescript label: Save metadata source: |- - import { metadata, task } from "@trigger.dev/sdk/v3"; + import { metadata, task } from "@trigger.dev/sdk"; export const myTask = task({ id: "my-task", @@ -501,7 +501,7 @@ paths: x-codeSamples: - lang: typescript source: |- - import { runs } from "@trigger.dev/sdk/v3"; + import { runs } from "@trigger.dev/sdk"; await runs.cancel("run_1234"); @@ -566,11 +566,11 @@ paths: x-codeSamples: - lang: typescript source: |- - import { runs } from "@trigger.dev/sdk/v3"; + import { runs } from "@trigger.dev/sdk"; const handle = await runs.reschedule("run_1234", { delay: new Date("2024-06-29T20:45:56.340Z") }); - "/api/v3/runs/{runId}": + "/api/runs/{runId}": parameters: - $ref: "#/components/parameters/runId" get: @@ -625,7 +625,7 @@ paths: x-codeSamples: - lang: typescript source: |- - import { runs } from "@trigger.dev/sdk/v3"; + import { runs } from "@trigger.dev/sdk"; const result = await runs.retrieve("run_1234"); @@ -680,7 +680,7 @@ paths: - lang: typescript label: List runs source: |- - import { runs } from "@trigger.dev/sdk/v3"; + import { runs } from "@trigger.dev/sdk"; // Get the first page of runs let page = await runs.list({ limit: 20 }); @@ -704,7 +704,7 @@ paths: - lang: typescript label: Filter runs source: |- - import { runs } from "@trigger.dev/sdk/v3"; + import { runs } from "@trigger.dev/sdk"; const response = await runs.list({ status: ["QUEUED", "EXECUTING"], @@ -750,7 +750,7 @@ paths: - lang: typescript label: List runs source: |- - import { runs, configure } from "@trigger.dev/sdk/v3"; + import { runs, configure } from "@trigger.dev/sdk"; configure({ accessToken: "tr_pat_1234" // always use an environment variable for this @@ -778,7 +778,7 @@ paths: - lang: typescript label: Filter runs source: |- - import { runs, configure } from "@trigger.dev/sdk/v3"; + import { runs, configure } from "@trigger.dev/sdk"; configure({ accessToken: "tr_pat_1234" // always use an environment variable for this @@ -838,7 +838,7 @@ paths: - lang: typescript label: Outside of a task source: |- - import { envvars, configure } from "@trigger.dev/sdk/v3"; + import { envvars, configure } from "@trigger.dev/sdk"; const variables = await envvars.list("proj_yubjwjsfkxnylobaqvqz", "dev"); @@ -848,7 +848,7 @@ paths: - lang: typescript label: Inside a task source: |- - import { envvars, task } from "@trigger.dev/sdk/v3"; + import { envvars, task } from "@trigger.dev/sdk"; export const myTask = task({ id: "my-task", @@ -911,7 +911,7 @@ paths: - lang: typescript label: Outside of a task source: |- - import { envvars } from "@trigger.dev/sdk/v3"; + import { envvars } from "@trigger.dev/sdk"; await envvars.create("proj_yubjwjsfkxnylobaqvqz", "dev", { name: "SLACK_API_KEY", @@ -920,7 +920,7 @@ paths: - lang: typescript label: Inside a task source: |- - import { envvars, task } from "@trigger.dev/sdk/v3"; + import { envvars, task } from "@trigger.dev/sdk"; export const myTask = task({ id: "my-task", @@ -998,7 +998,7 @@ paths: - lang: typescript label: Import variables from an array source: |- - import { envvars } from "@trigger.dev/sdk/v3"; + import { envvars } from "@trigger.dev/sdk"; await envvars.upload("proj_yubjwjsfkxnylobaqvqz", "dev", { variables: { SLACK_API_KEY: "slack_key_1234" }, @@ -1048,7 +1048,7 @@ paths: - lang: typescript label: Outside of a task source: |- - import { envvars } from "@trigger.dev/sdk/v3"; + import { envvars } from "@trigger.dev/sdk"; const variable = await envvars.retrieve("proj_yubjwjsfkxnylobaqvqz", "dev", "SLACK_API_KEY"); @@ -1056,7 +1056,7 @@ paths: - lang: typescript label: Inside a task source: |- - import { envvars, task } from "@trigger.dev/sdk/v3"; + import { envvars, task } from "@trigger.dev/sdk"; export const myTask = task({ id: "my-task", @@ -1106,13 +1106,13 @@ paths: - lang: typescript label: Outside of a task source: |- - import { envvars } from "@trigger.dev/sdk/v3"; + import { envvars } from "@trigger.dev/sdk"; await envvars.del("proj_yubjwjsfkxnylobaqvqz", "dev", "SLACK_API_KEY"); - lang: typescript label: Inside a task source: |- - import { envvars, task } from "@trigger.dev/sdk/v3"; + import { envvars, task } from "@trigger.dev/sdk"; export const myTask = task({ id: "my-task", @@ -1165,7 +1165,7 @@ paths: - lang: typescript label: Outside of a task source: |- - import { envvars } from "@trigger.dev/sdk/v3"; + import { envvars } from "@trigger.dev/sdk"; await envvars.update("proj_yubjwjsfkxnylobaqvqz", "dev", "SLACK_API_KEY", { value: "slack_123456" @@ -1173,7 +1173,7 @@ paths: - lang: typescript label: Inside a task source: |- - import { envvars, task } from "@trigger.dev/sdk/v3"; + import { envvars, task } from "@trigger.dev/sdk"; export const myTask = task({ id: "my-task", @@ -1229,7 +1229,7 @@ paths: x-codeSamples: - lang: typescript source: |- - import { task } from "@trigger.dev/sdk/v3"; + import { task } from "@trigger.dev/sdk"; export const myTask = await task({ id: "my-task", @@ -1340,7 +1340,7 @@ paths: x-codeSamples: - lang: typescript source: |- - import { task } from "@trigger.dev/sdk/v3"; + import { task } from "@trigger.dev/sdk"; export const myTask = await task({ id: "my-task", @@ -1498,7 +1498,7 @@ components: Our TypeScript SDK will default to using the value of the `TRIGGER_SECRET_KEY` environment variable if it is set. If you are using the SDK in a different environment, you can set the key using the `configure` function. ```typescript - import { configure } from "@trigger.dev/sdk/v3"; + import { configure } from "@trigger.dev/sdk"; configure({ accessToken: "tr_dev_1234" }); ``` @@ -1512,7 +1512,7 @@ components: Our TypeScript SDK will default to using the value of the `TRIGGER_ACCESS_TOKEN` environment variable if it is set. If you are using the SDK in a different environment, you can set the key using the `configure` function. ```typescript - import { configure } from "@trigger.dev/sdk/v3"; + import { configure } from "@trigger.dev/sdk"; configure({ accessToken: "tr_pat_1234" }); ```