Skip to content

Commit

Permalink
Merge pull request #196 from OfficeDev/yilia/upgrade-ms-rest
Browse files Browse the repository at this point in the history
Upgrade ms-rest & fix vulnerabilities
  • Loading branch information
robin-liao authored Jun 20, 2019
2 parents fb2f4c8 + 3ef9bdc commit fe1b44b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"adaptivecards": "^1.0.0",
"botbuilder": "^3.16.0",
"crypto": "^1.0.1",
"ms-rest": "^1.15.7",
"ms-rest": "^2.5.0",
"sprintf-js": "^1.1.1"
},
"devDependencies": {
Expand Down
30 changes: 13 additions & 17 deletions Node/src/RemoteQuery/RestClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

var util = require('util');
var msRest = require('ms-rest');
var ServiceClient = msRest.ServiceClient;

var models = require('../models');

Expand All @@ -61,24 +60,21 @@ var models = require('../models');
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
*
*/
function RestClient(baseUri, options) {
class RestClient extends msRest.ServiceClient {
constructor (baseUri, options) {
if (!options) options = {};

if (!options) options = {};

RestClient['super_'].call(this, null, options);
this.baseUri = baseUri;
if (!this.baseUri) {
this.baseUri = 'https://api.botframework.com';
super(null, options);
this.baseUri = baseUri;
if (!this.baseUri) {
this.baseUri = 'https://api.botframework.com';
}

var packageInfo = this.getPackageJsonInfo(__dirname);
this.addUserAgentInfo(util.format('%s/%s', packageInfo.name, packageInfo.version));
this.models = models;
msRest.addSerializationMixin(this);
}

var packageInfo = this.getPackageJsonInfo(__dirname);
this.addUserAgentInfo(util.format('%s/%s', packageInfo.name, packageInfo.version));
this.models = models;
msRest.addSerializationMixin(this);

return this;
}

util.inherits(RestClient, ServiceClient);

module.exports = RestClient;
9 changes: 3 additions & 6 deletions Node/src/models/teamInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,12 @@
* @member {string} [aadGroupId] AAD group ID
*/
class TeamInfo {
constructor(name, id) {
this.id = id;
this.name = name;
}

constructor(name, id, aadGroupId) {
this.id = id;
this.name = name;
this.aadGroupId = aadGroupId
if (!!aadGroupId) {
this.aadGroupId = aadGroupId;
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Node/src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "es6",
"allowJs": true,
"module": "commonjs",
"sourceMap": false,
Expand Down
6 changes: 3 additions & 3 deletions Node/test/TeamsMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ describe('TeamsMessage', function () {
name: 'test'
};

let mention = tm.UserMention(user);
let mention = new tm.UserMention(user);
var message = new TeamsMessage(null);
var msg = message.addEntity(mention);
assert([
Expand All @@ -156,7 +156,7 @@ describe('TeamsMessage', function () {
name: 'test'
};

let mention = tm.ChannelMention(channel);
let mention = new tm.ChannelMention(channel);
var message = new TeamsMessage(null);
var msg = message.addEntity(mention);
assert([
Expand All @@ -178,7 +178,7 @@ describe('TeamsMessage', function () {
name: 'test'
};

let mention = tm.ChannelMention(team);
let mention = new tm.ChannelMention(team);
var message = new TeamsMessage(null);
var msg = message.addEntity(mention);
assert([
Expand Down

0 comments on commit fe1b44b

Please sign in to comment.