Skip to content

Commit 163f254

Browse files
committed
remove dependancy on sdk-core
1 parent e104c52 commit 163f254

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Node-RED Watson Nodes for IBM Cloud
77

88
<a href="https://cla-assistant.io/watson-developer-cloud/node-red-node-watson"><img src="https://cla-assistant.io/readme/badge/watson-developer-cloud/node-red-node-watson" alt="CLA assistant" /></a>
99

10+
### New in version 0.8.1
11+
-
1012

1113
### New in version 0.8.0
1214
- In the 0.8.x releases the nodes are migrated to a node-red 1.0.x input

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-node-watson",
3-
"version": "0.8.0",
3+
"version": "0.8.1",
44
"description": "A collection of Node-RED nodes for IBM Watson services",
55
"dependencies": {
66
"async": "^1.5.2",
@@ -11,7 +11,6 @@
1111
"qs": "6.x",
1212
"image-type": "^2.0.2",
1313
"watson-developer-cloud": "^3.18.3",
14-
"ibm-cloud-sdk-core": "^0.3.7",
1514
"ibm-watson": "^5.2.1",
1615
"word-count": "^0.2.2",
1716
"is-docx": "^0.0.3",

services/speech_to_text/v1.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ module.exports = function (RED) {
2929
sttutils = require('./stt-utils'),
3030
AuthV1 = require('watson-developer-cloud/authorization/v1'),
3131
//AuthIAMV1 = require('ibm-cloud-sdk-core/iam-token-manager/v1'),
32-
AuthIAMV1 = require('ibm-cloud-sdk-core/auth/iam-token-manager-v1'),
32+
//AuthIAMV1 = require('ibm-cloud-sdk-core/auth/iam-token-manager-v1'),
3333
//AuthIAMV1 = require('ibm-cloud-sdk-core/auth/token-managers/iam-token-manager'),
34-
//{ IamTokenManager } = require('ibm-watson/auth');
34+
{ IamTokenManager } = require('ibm-watson/auth');
3535
muteMode = true, discardMode = false, autoConnect = true,
3636
username = '', password = '', sUsername = '', sPassword = '',
3737
apikey = '', sApikey = '',
@@ -329,8 +329,9 @@ module.exports = function (RED) {
329329
// tokenService = new AuthIAMV1.IamTokenManagerV1({iamApikey : apikey, iamUrl: endpoint});
330330

331331
//tokenService = new AuthIAMV1({apikey : apikey});
332-
tokenService = new AuthIAMV1.IamTokenManagerV1({iamApikey : apikey});
332+
//tokenService = new AuthIAMV1.IamTokenManagerV1({iamApikey : apikey});
333333
//tokenService = new AuthIAMV1.IamTokenManager({apikey : apikey});
334+
tokenService = new IamTokenManager({apikey : apikey});
334335
//tokenService = new iamutils(apikey);
335336

336337
} else {
@@ -445,16 +446,17 @@ module.exports = function (RED) {
445446
} else {
446447
// Everything is now in place to invoke the service
447448
tokenPending = true;
448-
tokenService.getToken(function (err, res) {
449-
if (err) {
450-
reject(err);
451-
} else {
449+
450+
tokenService.getToken()
451+
.then((t) => {
452+
token = t;
452453
tokenPending = false;
453454
tokenTime = now;
454-
token = res;
455455
resolve();
456-
}
457-
});
456+
})
457+
.catch((err) => {
458+
reject(err);
459+
})
458460
}
459461
});
460462
return p;

0 commit comments

Comments
 (0)