Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#4009] Update samples to support latest Node version - TypeScript #431

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
4 changes: 2 additions & 2 deletions samples/typescript_nodejs/00.empty-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
"dependencies": {
"botbuilder": "~4.22.1",
"replace": "~1.2.0",
"restify": "~8.6.0"
"restify": "~10.0.0"
},
"devDependencies": {
"@types/restify": "8.4.2",
"@types/restify": "8.5.12",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "^8.57.0",
Expand Down
4 changes: 2 additions & 2 deletions samples/typescript_nodejs/00.empty-bot/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ adapter.onTurnError = async (context, error) => {
const myBot = new EmptyBot();

// Listen for incoming requests.
server.post('/api/messages', async (req, res) => {
server.post('/api/messages', (req, res, next) => {
// Route received a request to adapter for processing
await adapter.process(req, res, (context) => myBot.run(context));
adapter.process(req, res, async (context) => await myBot.run(context));
});
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
},
"linuxFxVersion": {
"type": "string",
"defaultValue": "NODE|16"
"defaultValue": "NODE|20-LTS"
},
"appId": {
"type": "string",
Expand Down Expand Up @@ -137,7 +137,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"linuxFxVersion": {
"type": "string",
"defaultValue": "NODE|16"
"defaultValue": "NODE|20-LTS"
},
"appId": {
"type": "string",
Expand Down Expand Up @@ -156,7 +156,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
4 changes: 2 additions & 2 deletions samples/typescript_nodejs/02.echo-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
"botbuilder": "~4.22.1",
"dotenv": "^8.2.0",
"replace": "^1.2.0",
"restify": "~8.6.0"
"restify": "~10.0.0"
},
"devDependencies": {
"@types/dotenv": "6.1.1",
"@types/node": "^16.11.6",
"@types/restify": "8.4.2",
"@types/restify": "8.5.12",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "^8.57.0",
Expand Down
4 changes: 2 additions & 2 deletions samples/typescript_nodejs/02.echo-bot/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ adapter.onTurnError = onTurnErrorHandler;
const myBot = new EchoBot();

// Listen for incoming requests.
server.post('/api/messages', async (req, res) => {
server.post('/api/messages', (req, res, next) => {
// Route received a request to adapter for processing
await adapter.process(req, res, (context) => myBot.run(context));
adapter.process(req, res, async (context) => await myBot.run(context));
});

// Listen for Upgrade requests for Streaming.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
4 changes: 2 additions & 2 deletions samples/typescript_nodejs/03.welcome-users/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
"dependencies": {
"botbuilder": "~4.22.1",
"replace": "~1.2.0",
"restify": "~8.6.0"
"restify": "~10.0.0"
},
"devDependencies": {
"@types/restify": "8.4.2",
"@types/restify": "8.5.12",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "^8.57.0",
Expand Down
4 changes: 2 additions & 2 deletions samples/typescript_nodejs/03.welcome-users/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const userState = new UserState(memoryStorage);
const myBot = new WelcomeBot(userState);

// Listen for incoming requests.
server.post('/api/messages', async (req, res) => {
server.post('/api/messages', (req, res, next) => {
// Route received a request to adapter for processing
await adapter.process(req, res, (context) => myBot.run(context));
adapter.process(req, res, async (context) => await myBot.run(context));
});
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
4 changes: 2 additions & 2 deletions samples/typescript_nodejs/05.multi-turn-prompt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"botbuilder-dialogs": "~4.22.1",
"dotenv": "^8.2.0",
"replace": "~1.2.0",
"restify": "~8.6.0"
"restify": "~10.0.0"
},
"devDependencies": {
"@types/restify": "8.4.2",
"@types/restify": "8.5.12",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "^8.57.0",
Expand Down
4 changes: 2 additions & 2 deletions samples/typescript_nodejs/05.multi-turn-prompt/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ server.listen(process.env.port || process.env.PORT || 3978, () => {
});

// Listen for incoming requests.
server.post('/api/messages', async (req, res) => {
server.post('/api/messages', (req, res, next) => {
// Route received a request to adapter for processing
await adapter.process(req, res, (context) => bot.run(context));
adapter.process(req, res, async (context) => await bot.run(context));
});
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
4 changes: 2 additions & 2 deletions samples/typescript_nodejs/06.using-cards/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"botbuilder-dialogs": "~4.22.1",
"dotenv": "^8.2.0",
"replace": "~1.2.0",
"restify": "~8.6.0"
"restify": "~10.0.0"
},
"devDependencies": {
"@types/restify": "8.4.2",
"@types/restify": "8.5.12",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "^8.57.0",
Expand Down
4 changes: 2 additions & 2 deletions samples/typescript_nodejs/06.using-cards/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ server.listen(process.env.port || process.env.PORT || 3978, () => {
});

// Listen for incoming activities and route them to your bot main dialog.
server.post('/api/messages', async (req, res) => {
server.post('/api/messages', (req, res, next) => {
// Route received a request to adapter for processing
await adapter.process(req, res, (context) => bot.run(context));
adapter.process(req, res, async (context) => await bot.run(context));
});
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
},
"linuxFxVersion": {
"type": "string",
"defaultValue": "NODE|16"
"defaultValue": "NODE|20-LTS"
},
"appId": {
"type": "string",
Expand Down Expand Up @@ -137,7 +137,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"linuxFxVersion": {
"type": "string",
"defaultValue": "NODE|16"
"defaultValue": "NODE|20-LTS"
},
"appId": {
"type": "string",
Expand Down Expand Up @@ -156,7 +156,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
5 changes: 3 additions & 2 deletions samples/typescript_nodejs/13.core-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@
"botbuilder-dialogs": "~4.22.1",
"botbuilder-testing": "~4.22.1",
"dotenv": "^8.2.0",
"moment": "^2.30.1",
"replace": "~1.2.0",
"restify": "~8.6.0"
"restify": "~10.0.0"
},
"devDependencies": {
"@types/dotenv": "6.1.1",
"@types/mocha": "^7.0.2",
"@types/node": "^16.11.6",
"@types/restify": "8.4.2",
"@types/restify": "8.5.12",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "^8.57.0",
Expand Down
4 changes: 2 additions & 2 deletions samples/typescript_nodejs/13.core-bot/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ server.listen(process.env.port || process.env.PORT || 3978, () => {
});

// Listen for incoming activities and route them to your bot main dialog.
server.post('/api/messages', async (req, res) => {
server.post('/api/messages', (req, res, next) => {
// Route received a request to adapter for processing
await adapter.process(req, res, (context) => bot.run(context));
adapter.process(req, res, async (context) => await bot.run(context));
});

// Listen for Upgrade requests for Streaming.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16"
"value": "~20"
},
{
"name": "MicrosoftAppType",
Expand Down
4 changes: 2 additions & 2 deletions samples/typescript_nodejs/16.proactive-messages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
"botbuilder": "~4.22.1",
"dotenv": "^8.2.0",
"replace": "~1.2.0",
"restify": "~8.6.0"
"restify": "~10.0.0"
},
"devDependencies": {
"@types/dotenv": "6.1.1",
"@types/restify": "8.4.2",
"@types/restify": "8.5.12",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "^8.57.0",
Expand Down
12 changes: 6 additions & 6 deletions samples/typescript_nodejs/16.proactive-messages/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ const conversationReferences = {};
const myBot = new EchoBot(conversationReferences);

// Listen for incoming requests.
server.post('/api/messages', async (req, res) => {
server.post('/api/messages', (req, res, next) => {
// Route received a request to adapter for processing
await adapter.process(req, res, (context) => myBot.run(context));
adapter.process(req, res, async (context) => await myBot.run(context));
});

// Listen for Upgrade requests for Streaming.
Expand All @@ -84,9 +84,9 @@ server.on('upgrade', async (req, socket, head) => {
});

// Listen for incoming notifications and send proactive messages to users.
server.get('/api/notify', async (req, res) => {
server.get('/api/notify', (req, res, next) => {
for (const conversationReference of Object.values(conversationReferences)) {
await adapter.continueConversationAsync(process.env.MicrosoftAppId, conversationReference, async (context) => {
adapter.continueConversationAsync(process.env.MicrosoftAppId, conversationReference, async (context) => {
await context.sendActivity('proactive hello');
});
}
Expand All @@ -97,10 +97,10 @@ server.get('/api/notify', async (req, res) => {
});

// Listen for incoming custom notifications and send proactive messages to users.
server.post('/api/notify', async (req, res) => {
server.post('/api/notify', (req, res, next) => {
for (const msg of req.body) {
for (const conversationReference of Object.values(conversationReferences)) {
await adapter.continueConversationAsync(process.env.MicrosoftAppId, conversationReference, async (turnContext) => {
adapter.continueConversationAsync(process.env.MicrosoftAppId, conversationReference, async (turnContext) => {
await turnContext.sendActivity(msg);
});
}
Expand Down
Loading