Skip to content

Commit 04efee8

Browse files
committed
♻️ Fix handler cast specificity
1 parent 47c4931 commit 04efee8

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

apps/builder/src/features/forge/api/fetchSelectItems.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ export const fetchSelectItems = authenticatedProcedure
9494
)
9595
: undefined;
9696

97-
const handler = forgedBlockHandlers[input.integrationId].find(
97+
const handler = forgedBlockHandlers[input.integrationId]?.find(
9898
(handler) => handler.type === "fetcher" && handler.id === input.fetcherId,
99-
) as FetcherHandler;
99+
) as FetcherHandler | undefined;
100100

101101
if (!handler) return { items: [] };
102102

apps/viewer/src/app/api/integrations/openai/streamer/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ export async function POST(req: Request) {
126126
{ status: 400, headers: responseHeaders },
127127
);
128128

129-
const handler = forgedBlockHandlers[block.type].find(
129+
const handler = forgedBlockHandlers[block.type]?.find(
130130
(h) => h.type === "action" && h.actionName === block.options?.action,
131-
) as ActionHandler;
131+
) as ActionHandler | undefined;
132132

133133
if (!handler || !handler.stream)
134134
return NextResponse.json(

packages/bot-engine/src/apiHandlers/getMessageStream.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ export const getMessageStream = async ({
103103
message: "This block does not have a stream function",
104104
};
105105

106-
const handler = forgedBlockHandlers[block.type].find(
106+
const handler = forgedBlockHandlers[block.type]?.find(
107107
(h) => h.type === "action" && h.actionName === block.options?.action,
108-
) as ActionHandler;
108+
) as ActionHandler | undefined;
109109

110110
if (!handler || !handler.stream)
111111
return {

packages/bot-engine/src/forge/executeForgedBlock.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ export const executeForgedBlock = async (
3434
const blockDef = forgedBlocks[block.type];
3535
if (!blockDef) return { outgoingEdgeId: block.outgoingEdgeId };
3636
const action = blockDef.actions.find((a) => a.name === block.options?.action);
37-
const handler = forgedBlockHandlers[block.type].find(
37+
const handler = forgedBlockHandlers[block.type]?.find(
3838
(h) => h.type === "action" && h.actionName === action?.name,
39-
) as ActionHandler;
39+
) as ActionHandler | undefined;
4040
if (!block.options || !handler || !action)
4141
return {
4242
outgoingEdgeId: block.outgoingEdgeId,

0 commit comments

Comments
 (0)