Skip to content

Commit

Permalink
Merge pull request #174 from watson-developer-cloud/master
Browse files Browse the repository at this point in the history
Rebasing
  • Loading branch information
chughts authored Mar 27, 2022
2 parents 69882d7 + cf5bd16 commit 502f788
Show file tree
Hide file tree
Showing 58 changed files with 1,232 additions and 2,949 deletions.
33 changes: 33 additions & 0 deletions ChangeHistory.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@

## 0.9.x

### New in version 0.9.5
- Assistant V1 & V2 - Allow customerId to be passed inside msg.params
- Assistant V2 - Skip the persist_session_id check if there is no msg.params
- Update list of supported languages in Speech to Text and Text to Speech nodes.

### New in version 0.9.4
- Assistant V1 Workspace manager - Allow endpoint to be overridden through msg.params
- Language Translator, Speech to Text, Text to Speech - Sort Languages in drop down select list.

### New in version 0.9.3
- Assistant V1 - Fix alternateIntents setting.
- Assistant V2 - Allow return of request session id.
- Update list of supported languages in Speech to Text, Text to Speech and Translation nodes.

### New in version 0.9.2
- Assistant V2 - Fix bug session expiry bug.


### New in version 0.9.1
- Assistant V2 - Allow flow to assign a string session id. The node maps this user specified session id to the real session id. Additional param option allow session id to be reset.

### New in version 0.9.0
- Node-RED & IBM-Watson & Use of promises on API invocation & IAM URL construct migration & Removal of default endpoint of
- Assistant V1
- Assistant V2
- All Nodes now require Node-RED 1.0.x or above
- Remove watson-developer-cloud dependancy
- Remove code for redundant nodes


## 0.8.x

### New in version 0.8.2
Expand Down
40 changes: 11 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,16 @@ Node-RED Watson Nodes for IBM Cloud
<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>


### New in version 0.9.5
- Assistant V1 & V2 - Allow customerId to be passed inside msg.params
- Assistant V2 - Skip the persist_session_id check if there is no msg.params
- Update list of supported languages in Speech to Text and Text to Speech nodes.

### New in version 0.9.4
- Assistant V1 Workspace manager - Allow endpoint to be overridden through msg.params
- Language Translator, Speech to Text, Text to Speech - Sort Languages in drop down select list.

### New in version 0.9.3
- Assistant V1 - Fix alternateIntents setting.
- Assistant V2 - Allow return of request session id.
- Update list of supported languages in Speech to Text, Text to Speech and Translation nodes.

### New in version 0.9.2
- Assistant V2 - Fix bug session expiry bug.


### New in version 0.9.1
- Assistant V2 - Allow flow to assign a string session id. The node maps this user specified session id to the real session id. Additional param option allow session id to be reset.

### New in version 0.9.0
- Node-RED & IBM-Watson & Use of promises on API invocation & IAM URL construct migration & Removal of default endpoint of
- Assistant V1
- Assistant V2
- All Nodes now require Node-RED 1.0.x or above
- Remove watson-developer-cloud dependancy
- Remove code for redundant nodes
### New in version 0.10.0
- Bump of dependencies
- ibm-watson to 6.2.2
- Min version of Node is 12.20.0
- Drop Personality Insights node
- Drop Visual Recognition nodes
- Remove Username / Password fields from all nodes
- Bump to latest version of services
- New Discovery V2 node
- Add Classifications to Natural Language Understanding node


### Watson Nodes for Node-RED
Expand Down Expand Up @@ -79,4 +61,4 @@ before doing so.

### Copyright and license

Copyright 2018, 2019, 2020 IBM Corp. under [the Apache 2.0 license](LICENSE).
Copyright 2018, 2022 IBM Corp. under [the Apache 2.0 license](LICENSE).
25 changes: 10 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
{
"name": "node-red-node-watson",
"version": "0.9.5",
"version": "0.10.0",
"description": "A collection of Node-RED nodes for IBM Watson services",
"dependencies": {
"async": "^1.5.2",
"cfenv": "~1.2.2",
"cfenv": "~1.2.4",
"file-type": "^12.4.2",
"request": "~2.88.0",
"temp": "^0.9.0",
"qs": "6.x",
"image-type": "^2.0.2",
"ibm-watson": "^5.2.1",
"word-count": "^0.2.2",
"request": "~2.88.2",
"temp": "^0.9.4",
"qs": "^6.10.3",
"ibm-watson": "^6.2.2",
"is-docx": "^0.0.3",
"stream-to-array": "^2.3.0",
"ws": "^4.1.0"
"ws": "^8.5.0"
},
"repository": {
"type": "git",
Expand All @@ -40,24 +37,22 @@
"watson-discovery-v1": "services/discovery/v1.js",
"watson-discovery-v1-document-loader": "services/discovery/v1-document-loader.js",
"watson-discovery-v1-query-builder": "services/discovery/v1-query-builder.js",
"watson-discovery-v2-project-manager": "services/discovery/v2-project-manager.js",
"watson-language-translator-v3": "services/language_translator/v3.js",
"watson-doc-translator-v3": "services/language_translator/v3-doc.js",
"watson-language-translator-identify-v3": "services/language_translator_identify/v3.js",
"watson-language-translator-util-v3": "services/language_translator_util/v3.js",
"watson-natural-language-classifier-v1": "services/natural_language_classifier/v1.js",
"watson-natural-language-understanding-v1": "services/natural_language_understanding/v1.js",
"watson-natural-language-understanding-model-manager-v1": "services/natural_language_understanding/v1-model-manager.js",
"watson-personality-insights-v3": "services/personality_insights/v3.js",
"watson-speech-to-text-v1": "services/speech_to_text/v1.js",
"watson-speech-to-text-corpus-builder-v1": "services/speech_to_text/v1-corpus-builder.js",
"watson-text-to-speech-v1": "services/text_to_speech/v1.js",
"watson-text-to-speech-corpus-builder-v1": "services/text_to_speech/v1-corpus-builder.js",
"watson-tone-analyzer-v3": "services/tone_analyzer/v3.js",
"watson-visual-recognition-v3": "services/visual_recognition/v3.js",
"watson-visual-recognition-collection-utils-v4": "services/visual_recognition/v4-collection-utils.js"
"watson-tone-analyzer-v3": "services/tone_analyzer/v3.js"
}
},
"engines": {
"node": ">=10.0.0"
"node": ">=12.20.0"
}
}
18 changes: 1 addition & 17 deletions services/assistant/v1-workspace-manager.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
Copyright 2017 IBM Corp.
Copyright 2017, 2022 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,14 +30,6 @@
<input type="text" id="node-input-name" placeholder="Name"></input>
</div>

<div class="form-row credentials" style="display: none;">
<label for="node-input-username"><i class="fa fa-user"></i> Username</label>
<input type="text" id="node-input-username" placeholder="Username"></input>
</div>
<div class="form-row credentials" style="display: none;">
<label for="node-input-password"><i class="fa fa-key"></i> Password</label>
<input type="password" id="node-input-password" placeholder="Password"></input>
</div>
<div class="form-row credentials" style="display: none;">
<label for="node-input-apikey"><i class="fa fa-key"></i> API Key</label>
<input type="password" id="node-input-apikey" placeholder="API Key"></input>
Expand Down Expand Up @@ -347,12 +339,6 @@

<p>The node configurations can be overridden by setting
<ul>
<li>
<code>msg.params.username</code>
</li>
<li>
<code>msg.params.password</code>
</li>
<li>
<code>msg.params.apikey</code>
</li>
Expand Down Expand Up @@ -593,8 +579,6 @@
'cwm-service-endpoint' :{value: ''}
},
credentials: {
username: {type:'text'},
password: {type: 'password'},
apikey: {type: 'password'}
},
color: 'rgb(84,149,180)',
Expand Down
37 changes: 11 additions & 26 deletions services/assistant/v1-workspace-manager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2017 IBM Corp.
* Copyright 2017, 2022 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,7 +27,6 @@ module.exports = function (RED) {
payloadutils = require('../../utilities/payload-utils'),
responseutils = require('../../utilities/response-utils'),
service = serviceutils.getServiceCreds(SERVICE_IDENTIFIER),
username = '', password = '', sUsername = '', sPassword = '',
apikey = '', sApikey = '',
endpoint = '', sEndpoint = '',
version = '2018-09-20';
Expand Down Expand Up @@ -73,18 +72,16 @@ module.exports = function (RED) {
temp.track();

// Require the Cloud Foundry Module to pull credentials from bound service
// If they are found then the username and password will be stored in
// the variables sUsername and sPassword.
// If they are found then the key will be stored in
// the variables sApikey.
//
// This separation between sUsername and username is to allow
// This separation is to allow
// the end user to modify the credentials when the service is not bound.
// Otherwise, once set credentials are never reset, resulting in a frustrated
// user who, when he errenously enters bad credentials, can't figure out why
// the edited ones are not being taken.

if (service) {
sUsername = service.username ? service.username : '';
sPassword = service.password ? service.password : '';
sApikey = service.apikey ? service.apikey : '';

sEndpoint = service.url;
Expand Down Expand Up @@ -501,7 +498,7 @@ module.exports = function (RED) {

function executeMethod(node, method, params, msg) {
let conv = null,
version = '2018-09-20',
version = '2021-11-27',
authSettings = {},
serviceSettings = {
version_date: version,
Expand All @@ -513,10 +510,8 @@ module.exports = function (RED) {

if (apikey) {
authSettings.apikey = apikey;
} else {
authSettings.username = username;
authSettings.password = password;
}

serviceSettings.authenticator = new IamAuthenticator(authSettings);

if (endpoint) {
Expand Down Expand Up @@ -1013,9 +1008,9 @@ module.exports = function (RED) {
});
}

function initialCheck(a, u, p, m) {
function initialCheck(a, m) {
var message = '';
if (!a && (!u || !p)) {
if (!a) {
message = 'Missing Conversation service credentials';
} else if (!m || '' === m) {
message = 'Required mode has not been specified';
Expand Down Expand Up @@ -1047,26 +1042,18 @@ module.exports = function (RED) {
message = '',
params = {};

username = sUsername || this.credentials.username;
password = sPassword || this.credentials.password || config.password;
apikey = sApikey || this.credentials.apikey || config.apikey;
endpoint = sEndpoint;

if (config['cwm-service-endpoint']) {
endpoint = config['cwm-service-endpoint'];
}

// All method to be overridden
if (msg.params) {
if (msg.params.method) {
method = msg.params.method;
}
if (msg.params.username) {
username = msg.params.username;
}
if (msg.params.password) {
password = msg.params.password;
}
if (msg.params.apikey) {
apikey = msg.params.apikey;
}
Expand All @@ -1079,7 +1066,7 @@ module.exports = function (RED) {
}

node.status({});
initialCheck(apikey, username, password, method)
initialCheck(apikey, method)
.then(function(){
return buildParams(msg, method, config, params);
})
Expand Down Expand Up @@ -1123,8 +1110,6 @@ module.exports = function (RED) {

RED.nodes.registerType('watson-conversation-v1-workspace-manager', Node, {
credentials: {
username: {type:'text'},
password: {type:'password'},
apikey: {type: 'password'}
}
});
Expand Down
14 changes: 1 addition & 13 deletions services/assistant/v1.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
Copyright 2016 IBM Corp.
Copyright 2016, 2022 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -26,14 +26,6 @@
<input type="text" id="node-input-name" placeholder="Name">
</div>

<div class="form-row credentials" style="display: none;">
<label for="node-input-username"><i class="fa fa-user"></i> Username</label>
<input type="text" id="node-input-username" placeholder="Username">
</div>
<div class="form-row credentials" style="display: none;">
<label for="node-input-password"><i class="fa fa-key"></i> Password</label>
<input type="password" id="node-input-password" placeholder="Password">
</div>
<div class="form-row credentials" style="display: none;">
<label for="node-input-apikey"><i class="fa fa-key"></i> API Key</label>
<input type="password" id="node-input-apikey" placeholder="API Key"></input>
Expand Down Expand Up @@ -97,8 +89,6 @@
<li><code>msg.params.output</code> (optional) : see API documentation </li>
<li><code>msg.additional_context</code> (optional) : additional properties that will be added to the context object. Format: Object </li>
<br/>
<li><code>msg.params.username</code> : If provided will be used as the username credential for the Assistant service.</li>
<li><code>msg.params.password</code> : If provided will be used as the password credential for the Assistant service.</li>
<li><code>msg.params.apikey</code> : If provided will be used as the api key credential for the Assistant service.</li>
<li><code>msg.params.endpoint</code> : If provided will be used as the url for the Assistant service.</li>
<li><code>msg.params.version</code> : If provided will be used as the API version date for the Assistant service.</li>
Expand Down Expand Up @@ -160,8 +150,6 @@
'optout-learning': {value: false}
},
credentials: {
username: {type:'text'},
password: {type:'password'},
apikey: {type:'password'}
},
color: 'rgb(84,149,230)',
Expand Down
Loading

0 comments on commit 502f788

Please sign in to comment.