fix(core.gbapp): ms-rest-azure updated due to https://github.com/Azure/ms-rest-js/issues/347.
This commit is contained in:
parent
f29c8c2343
commit
d61d2f86e8
5 changed files with 81 additions and 27 deletions
2
gbot.cmd
2
gbot.cmd
|
@ -12,4 +12,4 @@ ECHO Compiling...
|
|||
CALL tsc
|
||||
|
||||
:ALLSET
|
||||
node app.js
|
||||
node boot.js
|
||||
|
|
78
package-lock.json
generated
78
package-lock.json
generated
|
@ -36,16 +36,60 @@
|
|||
}
|
||||
},
|
||||
"@azure/ms-rest-js": {
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-1.2.6.tgz",
|
||||
"integrity": "sha512-8cmDpxsQjVdveJwYKtNnkJorxEORLYJu9UHaUvLZA6yHExzDeISHAcSVWE0J05+VkJtqheVHF17M+2ro18Cdnw==",
|
||||
"version": "1.8.13",
|
||||
"resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-1.8.13.tgz",
|
||||
"integrity": "sha512-jAa6Y2XrvwbEqkaEXDHK+ReNo0WnCPS+LgQ1dRAJUUNxK4CghF5u+SXsVtPENritilVE7FVteqsLOtlhTk+haA==",
|
||||
"requires": {
|
||||
"axios": "^0.18.0",
|
||||
"@types/tunnel": "0.0.0",
|
||||
"axios": "^0.19.0",
|
||||
"form-data": "^2.3.2",
|
||||
"tough-cookie": "^2.4.3",
|
||||
"tslib": "^1.9.2",
|
||||
"tunnel": "0.0.6",
|
||||
"uuid": "^3.2.1",
|
||||
"xml2js": "^0.4.19"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": {
|
||||
"version": "0.19.0",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz",
|
||||
"integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==",
|
||||
"requires": {
|
||||
"follow-redirects": "1.5.10",
|
||||
"is-buffer": "^2.0.2"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
|
||||
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.5.10",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
|
||||
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
|
||||
"requires": {
|
||||
"debug": "=3.1.0"
|
||||
}
|
||||
},
|
||||
"is-buffer": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz",
|
||||
"integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw=="
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
},
|
||||
"tunnel": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
||||
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"@babel/code-frame": {
|
||||
|
@ -2995,6 +3039,19 @@
|
|||
"rsa-pem-from-mod-exp": "^0.8.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@azure/ms-rest-js": {
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-1.2.6.tgz",
|
||||
"integrity": "sha512-8cmDpxsQjVdveJwYKtNnkJorxEORLYJu9UHaUvLZA6yHExzDeISHAcSVWE0J05+VkJtqheVHF17M+2ro18Cdnw==",
|
||||
"requires": {
|
||||
"axios": "^0.18.0",
|
||||
"form-data": "^2.3.2",
|
||||
"tough-cookie": "^2.4.3",
|
||||
"tslib": "^1.9.2",
|
||||
"uuid": "^3.2.1",
|
||||
"xml2js": "^0.4.19"
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "10.14.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.7.tgz",
|
||||
|
@ -9266,19 +9323,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"ms-rest-js": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ms-rest-js/-/ms-rest-js-1.0.1.tgz",
|
||||
"integrity": "sha512-o2Gms3XE4sCKm0FZLJicq0aa2ybYyV8pwUHKHJG1QExkk/csM7PLuHiaPAj6Xn3kzqzAx4cAYtyEp4P1T3ujyA==",
|
||||
"requires": {
|
||||
"axios": "^0.18.0",
|
||||
"form-data": "^2.3.2",
|
||||
"tough-cookie": "^2.4.3",
|
||||
"tslib": "^1.9.2",
|
||||
"uuid": "^3.2.1",
|
||||
"xml2js": "^0.4.19"
|
||||
}
|
||||
},
|
||||
"mute-stream": {
|
||||
"version": "0.0.7",
|
||||
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
"mocha-typescript": "1.1.17",
|
||||
"ms": "2.1.1",
|
||||
"ms-rest-azure": "2.6.0",
|
||||
"ms-rest-js": "1.0.1",
|
||||
"@azure/ms-rest-js": "1.8.13",
|
||||
"nexmo": "2.4.1",
|
||||
"ngrok": "3.1.1",
|
||||
"npm": "6.9.0",
|
||||
|
|
|
@ -36,15 +36,15 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import { HttpHeaders, HttpMethods, ServiceClient, WebResource } from '@azure/ms-rest-js';
|
||||
import { CognitiveServicesManagementClient } from 'azure-arm-cognitiveservices';
|
||||
import { ResourceManagementClient, SubscriptionClient } from 'azure-arm-resource';
|
||||
import { SearchManagementClient } from 'azure-arm-search';
|
||||
import { SqlManagementClient } from 'azure-arm-sql';
|
||||
import { WebSiteManagementClient } from 'azure-arm-website';
|
||||
//tslint:disable-next-line:no-submodule-imports
|
||||
import { AppServicePlan, Site, SiteConfigResource, SiteSourceControl, SiteLogsConfig } from 'azure-arm-website/lib/models';
|
||||
import { AppServicePlan, Site, SiteConfigResource, SiteLogsConfig, SiteSourceControl } from 'azure-arm-website/lib/models';
|
||||
import { GBLog, IGBInstallationDeployer, IGBInstance } from 'botlib';
|
||||
import { HttpHeaders, HttpMethods, ServiceClient, WebResource } from 'ms-rest-js';
|
||||
import { GBAdminService } from '../../../packages/admin.gbapp/services/GBAdminService';
|
||||
import { GBCorePackage } from '../../../packages/core.gbapp';
|
||||
import { GBConfigService } from '../../../packages/core.gbapp/services/GBConfigService';
|
||||
|
@ -719,7 +719,7 @@ export class AzureDeployerService implements IGBInstallationDeployer {
|
|||
serverFarmId: serverFarmId,
|
||||
siteConfig: {
|
||||
appSettings: [
|
||||
{ name: 'WEBSITES_CONTAINER_START_TIME_LIMIT', value: WebSiteResponseTimeout },
|
||||
{ name: 'WEBSITES_CONTAINER_START_TIME_LIMIT', value: `${WebSiteResponseTimeout}` },
|
||||
{ name: 'WEBSITE_NODE_DEFAULT_VERSION', value: GBAdminService.getNodeVersion() },
|
||||
{ name: 'ADDITIONAL_DEPLOY_PATH', value: `` },
|
||||
{ name: 'ADMIN_PASS', value: `${instance.adminPass}` },
|
||||
|
|
|
@ -17,7 +17,6 @@ export class WhatsappDirectLine extends GBService {
|
|||
public whatsappServiceKey: string;
|
||||
public whatsappServiceNumber: string;
|
||||
public whatsappServiceUrl: string;
|
||||
public whatsappServiceWebhookUrl: string;
|
||||
public botId: string;
|
||||
public watermark: string;
|
||||
|
||||
|
@ -28,8 +27,7 @@ export class WhatsappDirectLine extends GBService {
|
|||
directLineSecret,
|
||||
whatsappServiceKey,
|
||||
whatsappServiceNumber,
|
||||
whatsappServiceUrl,
|
||||
whatsappServiceWebhookUrl
|
||||
whatsappServiceUrl
|
||||
) {
|
||||
super();
|
||||
|
||||
|
@ -37,8 +35,7 @@ export class WhatsappDirectLine extends GBService {
|
|||
this.whatsappServiceKey = whatsappServiceKey;
|
||||
this.whatsappServiceNumber = whatsappServiceNumber;
|
||||
this.whatsappServiceUrl = whatsappServiceUrl;
|
||||
this.whatsappServiceWebhookUrl = whatsappServiceWebhookUrl;
|
||||
var fs = require('fs')
|
||||
const fs = require('fs');
|
||||
|
||||
this.directLineClient =
|
||||
new Swagger({
|
||||
|
@ -94,7 +91,10 @@ export class WhatsappDirectLine extends GBService {
|
|||
client.Conversations.Conversations_StartConversation()
|
||||
.then(response => {
|
||||
return response.obj.conversationId;
|
||||
}).catch(err => {
|
||||
GBLog.error(`Error calling Conversations_StartConversation on Whatsapp channel ${err}`);
|
||||
})
|
||||
|
||||
.then(generatedConversationId => {
|
||||
this.conversationIds[from] = generatedConversationId;
|
||||
this.inputMessage(client, generatedConversationId, text, from, fromName);
|
||||
|
@ -108,7 +108,10 @@ export class WhatsappDirectLine extends GBService {
|
|||
this.inputMessage(client, conversationId, text, from, fromName);
|
||||
}
|
||||
res.end();
|
||||
}).catch(err => {
|
||||
GBLog.error(`Error initializing DirectLine for Whatsapp channel ${err}`);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public inputMessage(client, conversationId, text, from, fromName) {
|
||||
|
@ -143,9 +146,16 @@ export class WhatsappDirectLine extends GBService {
|
|||
|
||||
return response.obj.activities;
|
||||
})
|
||||
.catch(err => {
|
||||
GBLog.error(`Error calling Conversations_GetActivities on Whatsapp channel ${err}`);
|
||||
})
|
||||
.then(activities => {
|
||||
this.printMessages(activities, conversationId, from, fromName);
|
||||
})
|
||||
.catch(err => {
|
||||
GBLog.error(`Error calling printMessages on Whatsapp channel ${err}`);
|
||||
});
|
||||
|
||||
}, this.pollInterval);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue