Skip to content

Commit

Permalink
Fix issues in runtime-integration-express
Browse files Browse the repository at this point in the history
  • Loading branch information
ceciliaavila committed Nov 13, 2024
1 parent 12aba52 commit 69e15dc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"build": "tsc -b",
"clean": "rimraf _ts3.4 lib tsconfig.tsbuildinfo",
"depcheck": "depcheck --config ../../.depcheckrc",
"lint": "eslint .",
"lint": "eslint . --config ../../eslint.config.cjs",
"postbuild": "downlevel-dts lib _ts3.4/lib --checksum"
},
"files": [
Expand All @@ -44,7 +44,6 @@
"botbuilder-dialogs-adaptive-runtime-core": "4.1.6",
"botframework-connector": "4.1.6",
"express": "^4.21.0",
"eslint-plugin-only-warn": "^1.1.0",
"zod": "^3.23.8"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const TypedOptions = z.object({
/**
* Used when creating ConnectorClients.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any

connectorClientOptions: z.object({}) as z.ZodObject<any, any, any, ConnectorClientOptions>,
});

Expand Down Expand Up @@ -71,7 +71,7 @@ const defaultOptions: Options = {
export async function start(
applicationRoot: string,
settingsDirectory: string,
options: Partial<Options> = {}
options: Partial<Options> = {},
): Promise<void> {
const [services, configuration] = await getRuntimeServices(applicationRoot, settingsDirectory, {
connectorClientOptions: options.connectorClientOptions,
Expand Down Expand Up @@ -102,7 +102,7 @@ export async function makeApp(
configuration: Configuration,
applicationRoot: string,
options: Partial<Options> = {},
app: Application = express()
app: Application = express(),
): Promise<[Application, (callback?: () => void) => Server]> {
const configOverrides: Partial<Options> = {};

Expand All @@ -119,11 +119,10 @@ export async function makeApp(
}

if (res && !res.headersSent) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const statusCode = typeof (err as any)?.statusCode === 'number' ? (err as any).statusCode : 500;

res.status(statusCode).json({
message: err instanceof Error ? err.message : err ?? 'Internal server error',
message: err instanceof Error ? err.message : (err ?? 'Internal server error'),
});
}
};
Expand All @@ -146,7 +145,7 @@ export async function makeApp(
res.setHeader('Content-Type', contentType);
}
},
})
}),
);

app.post(resolvedOptions.messagingEndpointPath, async (req, res) => {
Expand All @@ -169,8 +168,8 @@ export async function makeApp(
name: z.string(),
enabled: z.boolean().optional(),
route: z.string(),
})
)
}),
),
) ?? [];

adapters
Expand Down Expand Up @@ -200,7 +199,7 @@ export async function makeApp(
// after the app starts listening for requests.
const server = app.listen(
resolvedOptions.port,
callback ?? (() => console.log(`server listening on port ${resolvedOptions.port}`))
callback ?? (() => console.log(`server listening on port ${resolvedOptions.port}`)),
);

server.on('upgrade', async (req, socket, head) => {
Expand Down

0 comments on commit 69e15dc

Please sign in to comment.