MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / groupTaskMetadataIssuesByTask

Function groupTaskMetadataIssuesByTask

packages/core/src/v3/errors.ts:134–188  ·  view source on GitHub ↗
(tasks: any, issues: z.ZodIssue[])

Source from the content-addressed store, hash-verified

132}
133
134export function groupTaskMetadataIssuesByTask(tasks: any, issues: z.ZodIssue[]) {
135 return issues.reduce(
136 (acc, issue) => {
137 if (issue.path.length === 0) {
138 return acc;
139 }
140
141 const taskIndex = issue.path[1];
142
143 if (typeof taskIndex !== "number") {
144 return acc;
145 }
146
147 const task = tasks[taskIndex];
148
149 if (!task) {
150 return acc;
151 }
152
153 const restOfPath = issue.path.slice(2);
154
155 const taskId = task.id;
156 const taskName = task.exportName;
157 const filePath = task.filePath;
158
159 const key = taskIndex;
160
161 const existing = acc[key] ?? {
162 id: taskId,
163 exportName: taskName,
164 filePath,
165 issues: [] as Array<{ message: string; path?: string }>,
166 };
167
168 existing.issues.push({
169 message: issue.message,
170 path: restOfPath.length === 0 ? undefined : restOfPath.join("."),
171 });
172
173 return {
174 ...acc,
175 [key]: existing,
176 };
177 },
178 {} as Record<
179 number,
180 {
181 id: any;
182 exportName: string;
183 filePath: string;
184 issues: Array<{ message: string; path?: string }>;
185 }
186 >
187 );
188}

Callers 2

Calls 1

sliceMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…