Skip to content

Commit ef100ad

Browse files
committed
Merge branch 'main' into v3/worker-attempt-creation
2 parents 02ae3f8 + cec20b9 commit ef100ad

File tree

187 files changed

+5722
-2196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+5722
-2196
lines changed

.changeset/cool-comics-burn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
Fixing missing logs when importing client @opentelemetry/api

.changeset/five-toes-destroy.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
"trigger.dev": patch
4+
"@trigger.dev/core": patch
5+
---
6+
7+
v3: Environment variable management API and SDK, along with resolveEnvVars CLI hook

.changeset/hot-fishes-retire.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
trigger.dev: patch
3+
---
4+
5+
Fix TypeScript inclusion in tsconfig.json for `cli-v3 init`

.changeset/pre.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"clever-apes-collect",
5656
"clever-carrots-travel",
5757
"clever-donkeys-hunt",
58+
"cool-comics-burn",
5859
"cool-glasses-bake",
5960
"cuddly-feet-approve",
6061
"dry-walls-check",
@@ -63,9 +64,11 @@
6364
"eleven-paws-join",
6465
"famous-boats-tease",
6566
"few-students-share",
67+
"five-toes-destroy",
6668
"funny-swans-destroy",
6769
"gorgeous-gorillas-compete",
6870
"green-bags-wink",
71+
"hot-fishes-retire",
6972
"khaki-apricots-design",
7073
"khaki-poems-lay",
7174
"late-icons-lie",
@@ -109,7 +112,9 @@
109112
"smart-olives-eat",
110113
"spicy-lamps-smoke",
111114
"strange-ghosts-matter",
115+
"strange-sheep-pull",
112116
"strong-lemons-add",
117+
"strong-owls-know",
113118
"stupid-bulldogs-applaud",
114119
"sweet-lizards-press",
115120
"swift-dragons-peel",
@@ -126,6 +131,7 @@
126131
"tiny-elephants-scream",
127132
"tricky-bulldogs-heal",
128133
"tricky-ladybugs-unite",
129-
"two-pumas-wait"
134+
"two-pumas-wait",
135+
"warm-planes-taste"
130136
]
131137
}

.changeset/strange-sheep-pull.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
"@trigger.dev/core": patch
4+
---
5+
6+
v2: Better handle recovering from platform communication errors by auto-yielding back to the platform in case of temporary API failures

.changeset/strong-owls-know.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
"@trigger.dev/core": patch
4+
---
5+
6+
When a v2 run hits the rate limit, reschedule with the reset date

.changeset/warm-planes-taste.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
v3: Prevent legacy-peer-deps=true from breaking deploys
6+
7+
When a global `.npmrc` file includes `legacy-peer-deps=true`, deploys would fail on the `npm ci` step because the package-lock.json wouldn't match the `package.json` file. This is because inside the image build, the `.npmrc` file would not be picked up and so `legacy-peer-deps` would end up being false (which is the default). This change forces the `package-lock.json` file to be created using `legacy-peer-deps=false`

.vscode/launch.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@
4545
"cwd": "${workspaceFolder}/references/v3-catalog",
4646
"sourceMaps": true
4747
},
48+
{
49+
"type": "node-terminal",
50+
"request": "launch",
51+
"name": "Debug V3 Management",
52+
"command": "pnpm run management",
53+
"cwd": "${workspaceFolder}/references/v3-catalog",
54+
"sourceMaps": true
55+
},
4856
{
4957
"type": "node",
5058
"request": "attach",

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ branch are tagged into a release periodically.
1717
- [Node.js](https://nodejs.org/en) version 20.11.1
1818
- [pnpm package manager](https://pnpm.io/installation) version 8.15.5
1919
- [Docker](https://www.docker.com/get-started/)
20+
- [protobuf](https://github.com/protocolbuffers/protobuf)
2021

2122
### Setup
2223

@@ -102,13 +103,17 @@ First, make sure you are running the webapp according to the instructions above.
102103
4. Build the CLI
103104
104105
```sh
106+
# Build the CLI
105107
pnpm run build --filter trigger.dev
108+
# Make it accessible to `pnpm exec`
109+
pnpm i
106110
```
107111

108112
5. Change into the `<root>/references/v3-catalog` directory and authorize the CLI to the local server:
109113

110114
```sh
111115
cd references/v3-catalog
116+
cp .env.example .env
112117
pnpm exec triggerdev login -a http://localhost:3030
113118
```
114119

apps/webapp/app/assets/icons/v3.svg

Lines changed: 4 additions & 0 deletions
Loading

apps/webapp/app/components/code/CodeBlock.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
import { Clipboard, ClipboardCheck } from "lucide-react";
22
import type { Language, PrismTheme } from "prism-react-renderer";
3-
import Highlight, { defaultProps } from "prism-react-renderer";
3+
import { Highlight, Prism } from "prism-react-renderer";
44
import { forwardRef, useCallback, useState } from "react";
55
import { cn } from "~/utils/cn";
6-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../primitives/Tooltip";
76
import { Paragraph } from "../primitives/Paragraph";
7+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../primitives/Tooltip";
88

99
//This is a fork of https://github.com/mantinedev/mantine/blob/master/src/mantine-prism/src/Prism/Prism.tsx
1010
//it didn't support highlighting lines by dimming the rest of the code, or animations on the highlighting
1111

12+
async function setup() {
13+
(typeof global !== "undefined" ? global : window).Prism = Prism;
14+
//@ts-ignore
15+
await import("prismjs/components/prism-json");
16+
//@ts-ignore
17+
await import("prismjs/components/prism-typescript");
18+
}
19+
setup();
20+
1221
type CodeBlockProps = {
1322
/** Code which will be highlighted */
1423
code: string;
@@ -238,7 +247,7 @@ export const CodeBlock = forwardRef<HTMLDivElement, CodeBlockProps>(
238247
)}
239248

240249
{shouldHighlight ? (
241-
<Highlight {...defaultProps} theme={theme} code={code} language={language}>
250+
<Highlight theme={theme} code={code} language={language}>
242251
{({
243252
className: inheritedClassName,
244253
style: inheritedStyle,
@@ -283,7 +292,7 @@ export const CodeBlock = forwardRef<HTMLDivElement, CodeBlockProps>(
283292

284293
return (
285294
<div
286-
key={lineProps.key}
295+
key={lineNumber}
287296
{...lineProps}
288297
className={cn(
289298
"flex w-full justify-start transition-opacity duration-500",
@@ -312,7 +321,7 @@ export const CodeBlock = forwardRef<HTMLDivElement, CodeBlockProps>(
312321
const tokenProps = getTokenProps({ token, key });
313322
return (
314323
<span
315-
key={tokenProps.key}
324+
key={key}
316325
{...tokenProps}
317326
style={{
318327
color: tokenProps?.style?.color as string,

apps/webapp/app/components/runs/v3/RunFilters.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ import {
77
XMarkIcon,
88
} from "@heroicons/react/20/solid";
99
import { Form } from "@remix-run/react";
10-
import {
11-
BulkActionType,
10+
import type {
1211
RuntimeEnvironment,
13-
TaskRunStatus,
1412
TaskTriggerSource,
13+
TaskRunStatus,
14+
BulkActionType,
1515
} from "@trigger.dev/database";
1616
import { ListFilterIcon } from "lucide-react";
17-
import { ReactNode, startTransition, useCallback, useMemo, useState } from "react";
17+
import type { ReactNode } from "react";
18+
import { startTransition, useCallback, useMemo, useState } from "react";
1819
import { z } from "zod";
1920
import { TaskIcon } from "~/assets/icons/TaskIcon";
2021
import { EnvironmentLabel, environmentTitle } from "~/components/environments/EnvironmentLabel";
@@ -43,14 +44,15 @@ import { Button } from "../../primitives/Buttons";
4344
import {
4445
TaskRunStatusCombo,
4546
allTaskRunStatuses,
47+
filterableTaskRunStatuses,
4648
descriptionForTaskRunStatus,
4749
runStatusTitle,
4850
} from "./TaskRunStatus";
4951
import { TaskTriggerSourceIcon } from "./TaskTriggerSource";
5052
import { DateTime } from "~/components/primitives/DateTime";
5153
import { BulkActionStatusCombo } from "./BulkAction";
5254

53-
export const TaskAttemptStatus = z.nativeEnum(TaskRunStatus);
55+
export const TaskAttemptStatus = z.enum(allTaskRunStatuses);
5456

5557
export const TaskRunListSearchFilters = z.object({
5658
cursor: z.string().optional(),
@@ -271,7 +273,7 @@ function MainMenu({ searchValue, trigger, clearSearchValue, setFilterType }: Men
271273
);
272274
}
273275

274-
const statuses = allTaskRunStatuses.map((status) => ({
276+
const statuses = filterableTaskRunStatuses.map((status) => ({
275277
title: runStatusTitle(status),
276278
value: status,
277279
}));

apps/webapp/app/components/runs/v3/TaskRunAttemptStatus.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
XCircleIcon,
88
} from "@heroicons/react/20/solid";
99
import type { TaskRunAttemptStatus as TaskRunAttemptStatusType } from "@trigger.dev/database";
10-
import { TaskRunAttemptStatus } from "@trigger.dev/database";
10+
import { TaskRunAttemptStatus } from "~/database-types";
1111
import assertNever from "assert-never";
1212
import { SnowflakeIcon } from "lucide-react";
1313
import { Spinner } from "~/components/primitives/Spinner";
@@ -17,7 +17,7 @@ export const allTaskRunAttemptStatuses = Object.values(
1717
TaskRunAttemptStatus
1818
) as TaskRunAttemptStatusType[];
1919

20-
export type ExtendedTaskAttemptStatus = (typeof allTaskRunAttemptStatuses)[number] | "ENQUEUED";
20+
export type ExtendedTaskAttemptStatus = TaskRunAttemptStatusType | "ENQUEUED";
2121

2222
export function TaskRunAttemptStatusCombo({
2323
status,

apps/webapp/app/components/runs/v3/TaskRunStatus.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,24 @@ export const allTaskRunStatuses = [
2525
"CANCELED",
2626
"COMPLETED_WITH_ERRORS",
2727
"CRASHED",
28+
"PAUSED",
2829
"INTERRUPTED",
2930
"SYSTEM_FAILURE",
30-
] as TaskRunStatus[];
31+
] as const satisfies Readonly<Array<TaskRunStatus>>;
32+
33+
export const filterableTaskRunStatuses = [
34+
"WAITING_FOR_DEPLOY",
35+
"PENDING",
36+
"EXECUTING",
37+
"RETRYING_AFTER_FAILURE",
38+
"WAITING_TO_RESUME",
39+
"COMPLETED_SUCCESSFULLY",
40+
"CANCELED",
41+
"COMPLETED_WITH_ERRORS",
42+
"CRASHED",
43+
"INTERRUPTED",
44+
"SYSTEM_FAILURE",
45+
] as const satisfies Readonly<Array<TaskRunStatus>>;
3146

3247
const taskRunStatusDescriptions: Record<TaskRunStatus, string> = {
3348
PENDING: "Task is waiting to be executed",

apps/webapp/app/database-types.ts

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// There's a weird issue with importing values from the prisma client
2+
// when using Remix Vite + pnpm + prisma
3+
// As long as they're only used as types it's ok
4+
// Import types here and validate hardcoded enums
5+
6+
import type {
7+
BatchTaskRunItemStatus as BatchTaskRunItemStatusType,
8+
TaskRunAttemptStatus as TaskRunAttemptStatusType,
9+
TaskRunStatus as TaskRunStatusType,
10+
JobRunStatus as JobRunStatusType,
11+
RuntimeEnvironmentType as RuntimeEnvironmentTypeType,
12+
} from "@trigger.dev/database";
13+
14+
export const BatchTaskRunItemStatus = {
15+
PENDING: "PENDING",
16+
FAILED: "FAILED",
17+
CANCELED: "CANCELED",
18+
COMPLETED: "COMPLETED",
19+
} as const satisfies Record<BatchTaskRunItemStatusType, BatchTaskRunItemStatusType>;
20+
21+
export const TaskRunAttemptStatus = {
22+
PENDING: "PENDING",
23+
EXECUTING: "EXECUTING",
24+
PAUSED: "PAUSED",
25+
FAILED: "FAILED",
26+
CANCELED: "CANCELED",
27+
COMPLETED: "COMPLETED",
28+
} as const satisfies Record<TaskRunAttemptStatusType, TaskRunAttemptStatusType>;
29+
30+
export const TaskRunStatus = {
31+
PENDING: "PENDING",
32+
WAITING_FOR_DEPLOY: "WAITING_FOR_DEPLOY",
33+
EXECUTING: "EXECUTING",
34+
WAITING_TO_RESUME: "WAITING_TO_RESUME",
35+
RETRYING_AFTER_FAILURE: "RETRYING_AFTER_FAILURE",
36+
PAUSED: "PAUSED",
37+
CANCELED: "CANCELED",
38+
INTERRUPTED: "INTERRUPTED",
39+
COMPLETED_SUCCESSFULLY: "COMPLETED_SUCCESSFULLY",
40+
COMPLETED_WITH_ERRORS: "COMPLETED_WITH_ERRORS",
41+
SYSTEM_FAILURE: "SYSTEM_FAILURE",
42+
CRASHED: "CRASHED",
43+
} as const satisfies Record<TaskRunStatusType, TaskRunStatusType>;
44+
45+
export const JobRunStatus = {
46+
PENDING: "PENDING",
47+
QUEUED: "QUEUED",
48+
WAITING_ON_CONNECTIONS: "WAITING_ON_CONNECTIONS",
49+
PREPROCESSING: "PREPROCESSING",
50+
STARTED: "STARTED",
51+
EXECUTING: "EXECUTING",
52+
WAITING_TO_CONTINUE: "WAITING_TO_CONTINUE",
53+
WAITING_TO_EXECUTE: "WAITING_TO_EXECUTE",
54+
SUCCESS: "SUCCESS",
55+
FAILURE: "FAILURE",
56+
TIMED_OUT: "TIMED_OUT",
57+
ABORTED: "ABORTED",
58+
CANCELED: "CANCELED",
59+
UNRESOLVED_AUTH: "UNRESOLVED_AUTH",
60+
INVALID_PAYLOAD: "INVALID_PAYLOAD",
61+
} as const satisfies Record<JobRunStatusType, JobRunStatusType>;
62+
63+
export const RuntimeEnvironmentType = {
64+
PRODUCTION: "PRODUCTION",
65+
STAGING: "STAGING",
66+
DEVELOPMENT: "DEVELOPMENT",
67+
PREVIEW: "PREVIEW",
68+
} as const satisfies Record<RuntimeEnvironmentTypeType, RuntimeEnvironmentTypeType>;

apps/webapp/app/db.server.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ export { Prisma };
7070

7171
export const prisma = singleton("prisma", getClient);
7272

73-
export const $replica: Omit<PrismaClient, "$transaction"> = singleton(
73+
export type PrismaReplicaClient = Omit<PrismaClient, "$transaction">;
74+
75+
export const $replica: PrismaReplicaClient = singleton(
7476
"replica",
7577
() => getReplicaClient() ?? prisma
7678
);

apps/webapp/app/env.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { z } from "zod";
2-
import { SecretStoreOptionsSchema } from "./services/secrets/secretStore.server";
2+
import { SecretStoreOptionsSchema } from "./services/secrets/secretStoreOptionsSchema.server";
33
import { isValidRegex } from "./utils/regex";
44
import { isValidDatabaseUrl } from "./utils/db";
55

apps/webapp/app/models/api-key.server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { RuntimeEnvironmentType, type RuntimeEnvironment } from "@trigger.dev/database";
1+
import type { RuntimeEnvironment } from "@trigger.dev/database";
22
import { prisma } from "~/db.server";
33
import { customAlphabet } from "nanoid";
4+
import { RuntimeEnvironmentType } from "~/database-types";
45

56
const apiKeyId = customAlphabet(
67
"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",

0 commit comments

Comments
 (0)