Skip to content

Commit 86dc70f

Browse files
giovaborgognoclaude
andcommitted
fix(events): fix typecheck errors in event routes, DLQ service, and TaskResource schema
- Fix resource callback signature in history/stats loader routes (first arg is resource, not params) - Add missing onEventFilter and onEventPattern to TaskResource schema in resources.ts - Fix JSON.parse return type narrowing in DeadLetterService.extractPayload Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d625a22 commit 86dc70f

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

apps/webapp/app/routes/api.v1.events.$eventId.history.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const loader = createLoaderApiRoute(
1313
corsStrategy: "all",
1414
authorization: {
1515
action: "read",
16-
resource: (params) => ({ tasks: params.eventId }),
16+
resource: (_resource, params) => ({ tasks: params.eventId }),
1717
superScopes: ["read:runs", "read:all", "admin"],
1818
},
1919
findResource: async () => 1 as const,

apps/webapp/app/routes/api.v1.events.$eventId.stats.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const loader = createLoaderApiRoute(
1313
corsStrategy: "all",
1414
authorization: {
1515
action: "read",
16-
resource: (params) => ({ tasks: params.eventId }),
16+
resource: (_resource, params) => ({ tasks: params.eventId }),
1717
superScopes: ["read:runs", "read:all", "admin"],
1818
},
1919
findResource: async () => 1 as const,

apps/webapp/app/v3/services/events/deadLetterService.server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ export class DeadLetterService extends BaseService {
7575
private extractPayload(run: TaskRun): object {
7676
try {
7777
if (typeof run.payload === "string") {
78-
return JSON.parse(run.payload);
78+
const parsed: unknown = JSON.parse(run.payload);
79+
return typeof parsed === "object" && parsed !== null ? (parsed as object) : { raw: parsed };
7980
}
8081
return { raw: run.payload };
8182
} catch {

packages/core/src/v3/schemas/resources.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export const TaskResource = z.object({
1616
// JSONSchema type - using z.unknown() for runtime validation to accept JSONSchema7
1717
payloadSchema: z.unknown().optional(),
1818
onEvent: z.string().optional(),
19+
onEventFilter: z.unknown().optional(),
20+
onEventPattern: z.string().optional(),
1921
onEventConsumerGroup: z.string().optional(),
2022
});
2123

0 commit comments

Comments
 (0)