Skip to content

Commit 29ba00a

Browse files
committed
Merge remote-tracking branch 'origin/main' into features/v3-docs
2 parents c0f9266 + 0a33bf7 commit 29ba00a

File tree

72 files changed

+2396
-911
lines changed

Some content is hidden

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

72 files changed

+2396
-911
lines changed

apps/coordinator/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"version": "0.0.1",
55
"description": "",
66
"main": "dist/index.cjs",
7-
"type": "module",
87
"scripts": {
98
"build": "npm run build:bundle",
109
"build:bundle": "esbuild src/index.ts --bundle --outfile=dist/index.mjs --platform=node --format=esm --target=esnext --banner:js=\"const require = createRequire(import.meta.url);\"",
@@ -31,4 +30,4 @@
3130
"tsx": "^4.7.0",
3231
"typescript": "^5.3.3"
3332
}
34-
}
33+
}

apps/coordinator/src/index.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,16 @@ class TaskCoordinator {
301301

302302
taskSocket.emit("RESUME_AFTER_DURATION", message);
303303
},
304+
REQUEST_ATTEMPT_CANCELLATION: async (message) => {
305+
const taskSocket = await this.#getAttemptSocket(message.attemptId);
306+
307+
if (!taskSocket) {
308+
logger.log("Socket for attempt not found", { attemptId: message.attemptId });
309+
return;
310+
}
311+
312+
taskSocket.emit("REQUEST_ATTEMPT_CANCELLATION", message);
313+
},
304314
},
305315
});
306316

@@ -385,11 +395,21 @@ class TaskCoordinator {
385395

386396
if (!executionAck) {
387397
logger.error("no execution ack", { attemptId: socket.data.attemptId });
398+
399+
socket.emit("REQUEST_EXIT", {
400+
version: "v1",
401+
});
402+
388403
return;
389404
}
390405

391406
if (!executionAck.success) {
392407
logger.error("execution unsuccessful", { attemptId: socket.data.attemptId });
408+
409+
socket.emit("REQUEST_EXIT", {
410+
version: "v1",
411+
});
412+
393413
return;
394414
}
395415

apps/coordinator/tsconfig.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"strict": true,
1010
"skipLibCheck": true,
1111
"paths": {
12-
"@trigger.dev/core/v3": ["../core/src/v3"],
13-
"@trigger.dev/core/v3/*": ["../core/src/v3/*"],
14-
"@trigger.dev/core-apps": ["../core-apps/src"],
15-
"@trigger.dev/core-apps/*": ["../core-apps/src/*"]
12+
"@trigger.dev/core/v3": ["../../packages/core/src/v3"],
13+
"@trigger.dev/core/v3/*": ["../../packages/core/src/v3/*"],
14+
"@trigger.dev/core-apps": ["../../packages/core-apps/src"],
15+
"@trigger.dev/core-apps/*": ["../../packages/core-apps/src/*"]
1616
}
1717
}
1818
}

apps/docker-provider/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"version": "0.0.1",
55
"description": "",
66
"main": "dist/index.cjs",
7-
"type": "module",
87
"scripts": {
98
"build": "npm run build:bundle",
109
"build:bundle": "esbuild src/index.ts --bundle --outfile=dist/index.mjs --platform=node --format=esm --target=esnext --banner:js=\"const require = createRequire(import.meta.url);\"",
@@ -29,4 +28,4 @@
2928
"tsx": "^4.7.0",
3029
"typescript": "^5.3.3"
3130
}
32-
}
31+
}

apps/docker-provider/tsconfig.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
"strict": true,
88
"skipLibCheck": true,
99
"paths": {
10-
"@trigger.dev/core/v3": ["../core/src/v3"],
11-
"@trigger.dev/core/v3/*": ["../core/src/v3/*"],
12-
"@trigger.dev/core-apps": ["../core-apps/src"],
13-
"@trigger.dev/core-apps/*": ["../core-apps/src/*"]
10+
"@trigger.dev/core/v3": ["../../packages/core/src/v3"],
11+
"@trigger.dev/core/v3/*": ["../../packages/core/src/v3/*"],
12+
"@trigger.dev/core-apps": ["../../packages/core-apps/src"],
13+
"@trigger.dev/core-apps/*": ["../../packages/core-apps/src/*"]
1414
}
1515
}
1616
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ const variants = {
1010
base: "text-base",
1111
};
1212

13+
export type InlineCodeVariant = keyof typeof variants;
14+
1315
type InlineCodeProps = {
1416
children: React.ReactNode;
17+
variant?: InlineCodeVariant;
18+
className?: string;
1519
};
1620

17-
type VariantProps = InlineCodeProps & {
18-
variant?: keyof typeof variants;
19-
};
20-
21-
export function InlineCode({ variant = "small", children }: VariantProps) {
22-
return <code className={cn(inlineCode, variants[variant])}>{children}</code>;
21+
export function InlineCode({ variant = "small", children, className }: InlineCodeProps) {
22+
return <code className={cn(inlineCode, variants[variant], className)}>{children}</code>;
2323
}

apps/webapp/app/components/primitives/Table.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ type TableCellProps = TableCellBasicProps & {
123123
onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
124124
hasAction?: boolean;
125125
isSticky?: boolean;
126+
actionClassName?: string;
126127
};
127128

128129
const stickyStyles =
@@ -132,6 +133,7 @@ export const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(
132133
(
133134
{
134135
className,
136+
actionClassName,
135137
alignment = "left",
136138
children,
137139
colSpan,
@@ -176,11 +178,11 @@ export const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(
176178
colSpan={colSpan}
177179
>
178180
{to ? (
179-
<Link to={to} className={flexClasses}>
181+
<Link to={to} className={cn(flexClasses, actionClassName)}>
180182
{children}
181183
</Link>
182184
) : onClick ? (
183-
<button onClick={onClick} className={flexClasses}>
185+
<button onClick={onClick} className={cn(flexClasses, actionClassName)}>
184186
{children}
185187
</button>
186188
) : (

apps/webapp/app/components/primitives/TreeView/TreeView.tsx

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,9 @@
11
import { VirtualItem, Virtualizer, useVirtualizer } from "@tanstack/react-virtual";
2-
import {
3-
Fragment,
4-
MutableRefObject,
5-
RefObject,
6-
useCallback,
7-
useEffect,
8-
useImperativeHandle,
9-
useReducer,
10-
useRef,
11-
useState,
12-
} from "react";
2+
import { MutableRefObject, RefObject, useCallback, useEffect, useReducer, useRef } from "react";
133
import { UnmountClosed } from "react-collapse";
144
import { cn } from "~/utils/cn";
15-
import { Changes, NodeState, NodesState, reducer } from "./reducer";
16-
import {
17-
applyFilterToState,
18-
concreteStateFromInput,
19-
firstVisibleNode,
20-
lastVisibleNode,
21-
selectedIdFromState,
22-
} from "./utils";
5+
import { NodeState, NodesState, reducer } from "./reducer";
6+
import { applyFilterToState, concreteStateFromInput, selectedIdFromState } from "./utils";
237

248
export type TreeViewProps<TData> = {
259
tree: FlatTree<TData>;
@@ -232,6 +216,7 @@ export function useTree<TData>({
232216
index,
233217
});
234218
},
219+
overscan: 20,
235220
});
236221

237222
const scrollToNodeFn = useCallback(

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import { InlineCode, InlineCodeVariant } from "~/components/code/InlineCode";
12
import { SpanCodePathAccessory } from "./SpanTitle";
3+
import { cn } from "~/utils/cn";
24

35
type TaskPathProps = {
46
filePath: string;
@@ -16,3 +18,17 @@ export function TaskPath({ filePath, functionName, className }: TaskPathProps) {
1618
/>
1719
);
1820
}
21+
22+
type TaskFunctionNameProps = {
23+
functionName: string;
24+
variant?: InlineCodeVariant;
25+
className?: string;
26+
};
27+
28+
export function TaskFunctionName({ variant, functionName, className }: TaskFunctionNameProps) {
29+
return (
30+
<InlineCode variant={variant} className={cn("text-sun-100", className)}>
31+
{functionName}()
32+
</InlineCode>
33+
);
34+
}

apps/webapp/app/consts.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ export const RUN_CHUNK_EXECUTION_BUFFER = 350;
1010
export const MAX_RUN_CHUNK_EXECUTION_LIMIT = 120000; // 2 minutes
1111
export const VERCEL_RESPONSE_TIMEOUT_STATUS_CODES = [408, 504];
1212
export const MAX_BATCH_TRIGGER_ITEMS = 100;
13+
export const MAX_TASK_RUN_ATTEMPTS = 250;
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { useLocation, useNavigation, useResolvedPath } from "@remix-run/react";
2+
import type { RelativeRoutingType } from "@remix-run/router";
3+
4+
//A lot of this logic is lifted from <NavLink> in react-router-dom, thanks again Remix team ❤️.
5+
//https://github.com/remix-run/react-router/blob/a04ae6b90127ae583be08432c52b951e53f6a3c7/packages/react-router-dom/index.tsx#L1010
6+
7+
type Options = {
8+
/** Defines the relative path behavior for the link.
9+
*
10+
* route - default, relative to the route hierarchy so .. will remove all URL segments of the current route pattern
11+
*
12+
* path - relative to the path so .. will remove one URL segment
13+
*/
14+
relative?: RelativeRoutingType;
15+
/** The end prop changes the matching logic for the active and pending states to only match to the "end" of the NavLinks's to path. If the URL is longer than to, it will no longer be considered active. */
16+
end?: boolean;
17+
};
18+
19+
type Result = {
20+
isActive: boolean;
21+
isPending: boolean;
22+
isTransitioning: boolean;
23+
};
24+
25+
/** Pass a relative link and you will get back whether it's the current page, about to be and whether the route is currently changing */
26+
export function useLinkStatus(to: string, options?: Options): Result {
27+
const { relative, end = false } = options || {};
28+
29+
const path = useResolvedPath(to, { relative: relative });
30+
const pathName = path.pathname.toLowerCase();
31+
32+
//current location and pending location (if there is one)
33+
const location = useLocation();
34+
const locationPathname = location.pathname.toLowerCase();
35+
const navigation = useNavigation();
36+
const nextLocationPathname = navigation.location
37+
? navigation.location.pathname.toLowerCase()
38+
: null;
39+
40+
// If the `to` has a trailing slash, look at that exact spot. Otherwise,
41+
// we're looking for a slash _after_ what's in `to`. For example:
42+
//
43+
// <NavLink to="/users"> and <NavLink to="/users/">
44+
// both want to look for a / at index 6 to match URL `/users/matt`
45+
const endSlashPosition =
46+
pathName !== "/" && pathName.endsWith("/") ? pathName.length - 1 : pathName.length;
47+
48+
const isActive =
49+
locationPathname === pathName ||
50+
(!end &&
51+
locationPathname.startsWith(pathName) &&
52+
locationPathname.charAt(endSlashPosition) === "/");
53+
54+
const isPending =
55+
nextLocationPathname != null &&
56+
(nextLocationPathname === pathName ||
57+
(!end &&
58+
nextLocationPathname.startsWith(pathName) &&
59+
nextLocationPathname.charAt(pathName.length) === "/"));
60+
61+
return {
62+
isActive,
63+
isPending,
64+
isTransitioning: navigation.state === "loading",
65+
};
66+
}

0 commit comments

Comments
 (0)