Skip to content

Commit f561843

Browse files
authored
Merge pull request #412 from chughts/iamkeys
Iam keys
2 parents 8c875d3 + 4f44889 commit f561843

28 files changed

+654
-428
lines changed

ChangeHistory.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,88 @@
1+
## 0.6.x
2+
3+
### New in version 0.6.14
4+
- Visual Recognition instances created post May 22 2018, have a new authentication mechanism
5+
6+
### New in version 0.6.13
7+
- Added opt-out option for collection parsing of strings in Natural Language Classifier Node.
8+
9+
### New in version 0.6.12
10+
- Fix to collection check in Natural Language Classification Node allowing for . in domain
11+
names.
12+
13+
### New in version 0.6.11
14+
- Fix to defaulting name for NLU Node.
15+
- Allow pre-check of audio format to be disabled in Speech to Text node.
16+
- Migrate from deprecated getModels and getCustomizations methods in Speech to Text nodes.
17+
- Implement update classifier in Visual Recognition Util node.
18+
- In Visual Recognition Util node append 'positive_' to zip name if neither 'positive' not 'negative' not already there.
19+
- Removed duplicated code in Visual Recognition Util node.
20+
21+
### New in version 0.6.10
22+
- Needed to stringify json before addDocument in Discovery node.
23+
- Using Node.js v 6 features, so will not run on Node.js v 4 anymore
24+
25+
### New in version 0.6.9
26+
- Implemented classify collection on Natural Language Classifier node. The collection can be
27+
in the form of multiple sentences, an array of strings, or an array of objects.
28+
29+
### New in version 0.6.8
30+
- Move all Discovery calls to latest API version - 2017-11-07
31+
- Updated calls to deprecated discovery methods addJsonDocument and getCollections
32+
- Correct implemetation of passages related options
33+
- Allow highlight option to be specified in Discovery overrides - msg.discoveryparams
34+
- Rename Conversation Nodes to Assistant
35+
- Use Assistant endpoint
36+
- Move all Assistant calls to latest API version - 2018-02-16
37+
- Move all Visual Recognition calls to lates API version - 2018-03-19
38+
- Add French as a Visual Recognition classification response language
39+
40+
### New in version 0.6.7
41+
- Enable Opt-out option for Conversation Node.
42+
- Implement time out option for response from Conversation Node.
43+
- Bump to v 3.2.1 of watson-developer-cloud dependency.
44+
- Fix to how API version is specified in Natural Language Understanding Node.
45+
- Add Korean to list of languages in Natural Language Classifier Node.
46+
47+
### New in version 0.6.6
48+
- Added Mute option for STT Node warning status when running in Streaming mode
49+
- Discard option for STT Node Streaming listening events.
50+
- Added Auto-Connect mode for STT Node - Will keep connection to service alive,
51+
else connection is restored on demand.
52+
- Fix to Discovery Query Builder Node to return schema options.
53+
54+
### New in version 0.6.5
55+
- Endpoint can now be specified in Natural Language Classifier Node
56+
57+
### New in version 0.6.4
58+
- Speech to Text node now reports all errors, including disconnects when running in stream mode.
59+
60+
### New in version 0.6.3
61+
- Allow input / output from Node-RED web-sockets for Speech to Text node. To
62+
enable select streaming mode. No token is needed as the Node handles this. Look
63+
out for sample flows and templates showing how to use this feature.
64+
- Three new languages for Language Translator, Polish, Russian and Turkish in Neural Translation mode.
65+
- Removed the code for the deprecated Language Translation Nodes.
66+
67+
### New in version 0.6.2
68+
- Visual Recognition fix for accept-language
69+
70+
### New in version 0.6.1
71+
- Allow STT Language to be dyamically configurable using msg.srclang
72+
73+
### New in version 0.6.0
74+
- Bump to watson-developer-cloud 3.0.4
75+
- Document link updates
76+
- IE fix
77+
- Option to set Conversation credentials though msg.params
78+
- Speech To Text fullresult now includes speaker_labels. Breaking change to any code that used fullresult due an extra level of indirection.
79+
- Allow Korean as an option for Personality Insights
80+
- Text Recognition option removed from Visual Recognition Node
81+
- Move Retrieve and Rank nodes to deprecated list
82+
- Removed Document Conversion, Alchemy, Concept Insights, Dialog, Tradeoff Analytics and Similarity Search Nodes
83+
- Nodes deprecated in 0.5.x will be removed in 0.6.x releases
84+
85+
186
## 0.5.x
287

388
### New in version 0.5.23

README.md

Lines changed: 9 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -7,87 +7,15 @@ 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.6.14
11-
- Visual Recognition instances created post May 22 2018, have a new authentication mechanism
12-
13-
### New in version 0.6.13
14-
- Added opt-out option for collection parsing of strings in Natural Language Classifier Node.
15-
16-
### New in version 0.6.12
17-
- Fix to collection check in Natural Language Classification Node allowing for . in domain
18-
names.
19-
20-
### New in version 0.6.11
21-
- Fix to defaulting name for NLU Node.
22-
- Allow pre-check of audio format to be disabled in Speech to Text node.
23-
- Migrate from deprecated getModels and getCustomizations methods in Speech to Text nodes.
24-
- Implement update classifier in Visual Recognition Util node.
25-
- In Visual Recognition Util node append 'positive_' to zip name if neither 'positive' not 'negative' not already there.
26-
- Removed duplicated code in Visual Recognition Util node.
27-
28-
### New in version 0.6.10
29-
- Needed to stringify json before addDocument in Discovery node.
30-
- Using Node.js v 6 features, so will not run on Node.js v 4 anymore
31-
32-
### New in version 0.6.9
33-
- Implemented classify collection on Natural Language Classifier node. The collection can be
34-
in the form of multiple sentences, an array of strings, or an array of objects.
35-
36-
### New in version 0.6.8
37-
- Move all Discovery calls to latest API version - 2017-11-07
38-
- Updated calls to deprecated discovery methods addJsonDocument and getCollections
39-
- Correct implemetation of passages related options
40-
- Allow highlight option to be specified in Discovery overrides - msg.discoveryparams
41-
- Rename Conversation Nodes to Assistant
42-
- Use Assistant endpoint
43-
- Move all Assistant calls to latest API version - 2018-02-16
44-
- Move all Visual Recognition calls to lates API version - 2018-03-19
45-
- Add French as a Visual Recognition classification response language
46-
47-
### New in version 0.6.7
48-
- Enable Opt-out option for Conversation Node.
49-
- Implement time out option for response from Conversation Node.
50-
- Bump to v 3.2.1 of watson-developer-cloud dependency.
51-
- Fix to how API version is specified in Natural Language Understanding Node.
52-
- Add Korean to list of languages in Natural Language Classifier Node.
53-
54-
### New in version 0.6.6
55-
- Added Mute option for STT Node warning status when running in Streaming mode
56-
- Discard option for STT Node Streaming listening events.
57-
- Added Auto-Connect mode for STT Node - Will keep connection to service alive,
58-
else connection is restored on demand.
59-
- Fix to Discovery Query Builder Node to return schema options.
60-
61-
### New in version 0.6.5
62-
- Endpoint can now be specified in Natural Language Classifier Node
63-
64-
### New in version 0.6.4
65-
- Speech to Text node now reports all errors, including disconnects when running in stream mode.
66-
67-
### New in version 0.6.3
68-
- Allow input / output from Node-RED web-sockets for Speech to Text node. To
69-
enable select streaming mode. No token is needed as the Node handles this. Look
70-
out for sample flows and templates showing how to use this feature.
71-
- Three new languages for Language Translator, Polish, Russian and Turkish in Neural Translation mode.
72-
- Removed the code for the deprecated Language Translation Nodes.
73-
74-
### New in version 0.6.2
75-
- Visual Recognition fix for accept-language
76-
77-
### New in version 0.6.1
78-
- Allow STT Language to be dyamically configurable using msg.srclang
79-
80-
### New in version 0.6.0
81-
- Bump to watson-developer-cloud 3.0.4
82-
- Document link updates
83-
- IE fix
84-
- Option to set Conversation credentials though msg.params
85-
- Speech To Text fullresult now includes speaker_labels. Breaking change to any code that used fullresult due an extra level of indirection.
86-
- Allow Korean as an option for Personality Insights
87-
- Text Recognition option removed from Visual Recognition Node
88-
- Move Retrieve and Rank nodes to deprecated list
89-
- Removed Document Conversion, Alchemy, Concept Insights, Dialog, Tradeoff Analytics and Similarity Search Nodes
90-
- Nodes deprecated in 0.5.x will be removed in 0.6.x releases
10+
### New in version 0.7.0
11+
- Assistant, Discovery, Natural Language Understanding, Speech to Text, Text to Speech, Tone Analyzer nodes updated
12+
to allow for use of iam key for authentication.
13+
- Migrated STT node off deprecated methods.
14+
- Fix to Tone Analyzer Node to preserve credentials on config reopen.
15+
- Fix to Tone Analyzer to allow json objects and arrays as payload.
16+
- Fix to STT where auto-connect was not being preserved when reopening configuration.
17+
- Bump to 2018-03-05 version date for Discovery service.
18+
- Migrated Discovery Nodes off deprecated methods.
9119

9220

9321
### Watson Nodes for Node-RED

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-node-watson",
3-
"version": "0.6.14",
3+
"version": "0.7.0",
44
"description": "A collection of Node-RED nodes for IBM Watson services",
55
"dependencies": {
66
"async": "^1.5.2",
@@ -10,7 +10,7 @@
1010
"temp": "^0.8.3",
1111
"qs": "6.x",
1212
"image-type": "^2.0.2",
13-
"watson-developer-cloud": "^3.4.2",
13+
"watson-developer-cloud": "^3.4.5",
1414
"kuromoji": "^0.1.1",
1515
"word-count": "^0.2.2",
1616
"is-docx": "^0.0.3",

services/conversation/v1-workspace-manager.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@
3838
<label for="node-input-password"><i class="fa fa-key"></i> Password</label>
3939
<input type="password" id="node-input-password" placeholder="Password"></input>
4040
</div>
41+
<div class="form-row credentials" style="display: none;">
42+
<label for="node-input-apikey"><i class="fa fa-key"></i> API Key</label>
43+
<input type="password" id="node-input-apikey" placeholder="API Key"></input>
44+
</div>
45+
4146
<div class="form-row credentials">
4247
<label>&nbsp;</label>
4348
<input type="checkbox" id="node-input-cwm-default-endpoint" style="display: inline-block; width: auto; vertical-align: top;">
@@ -352,6 +357,9 @@
352357
<li>
353358
<code>msg.params.password</code>
354359
</li>
360+
<li>
361+
<code>msg.params.apikey</code>
362+
</li>
355363
<li>
356364
<code>msg.params.workspace_id</code>
357365
</li>
@@ -596,7 +604,8 @@
596604
},
597605
credentials: {
598606
username: {type:'text'},
599-
password: {type: 'password'}
607+
password: {type: 'password'},
608+
apikey: {type: 'password'}
600609
},
601610
color: 'rgb(84,149,180)',
602611
inputs: 1,

services/conversation/v1-workspace-manager.js

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = function (RED) {
2626
AssistantV1 = require('watson-developer-cloud/assistant/v1'),
2727
service = serviceutils.getServiceCreds(SERVICE_IDENTIFIER),
2828
username = '', password = '', sUsername = '', sPassword = '',
29+
apikey = '', sApikey = '',
2930
endpoint = '', sEndpoint = '';
3031

3132
if (!service) {
@@ -45,8 +46,10 @@ module.exports = function (RED) {
4546
// the edited ones are not being taken.
4647

4748
if (service) {
48-
sUsername = service.username;
49-
sPassword = service.password;
49+
sUsername = service.username ? service.username : '';
50+
sPassword = service.password ? service.password : '';
51+
sApikey = service.apikey ? service.apikey : '';
52+
5053
sEndpoint = service.url;
5154
}
5255

@@ -503,15 +506,20 @@ module.exports = function (RED) {
503506
function executeMethod(node, method, params, msg) {
504507
var conv = null,
505508
serviceSettings = {
506-
username: username,
507-
password: password,
508509
version_date: '2018-02-16',
509510
version: '2018-02-16',
510511
headers: {
511512
'User-Agent': pkg.name + '-' + pkg.version
512513
}
513514
};
514515

516+
if (apikey) {
517+
serviceSettings.iam_apikey = apikey;
518+
} else {
519+
serviceSettings.username = username;
520+
serviceSettings.password = password;
521+
}
522+
515523
if (endpoint) {
516524
serviceSettings.url = endpoint;
517525
}
@@ -1040,9 +1048,9 @@ module.exports = function (RED) {
10401048
return Promise.resolve(false);
10411049
}
10421050

1043-
function initialCheck(u, p, m) {
1051+
function initialCheck(a, u, p, m) {
10441052
var message = '';
1045-
if (!u || !p) {
1053+
if (!a && (!u || !p)) {
10461054
message = 'Missing Conversation service credentials';
10471055
} else if (!m || '' === m) {
10481056
message = 'Required mode has not been specified';
@@ -1076,6 +1084,7 @@ module.exports = function (RED) {
10761084

10771085
username = sUsername || this.credentials.username;
10781086
password = sPassword || this.credentials.password || config.password;
1087+
apikey = sApikey || this.credentials.apikey || config.apikey;
10791088

10801089
// All method to be overridden
10811090
if (msg.params) {
@@ -1088,14 +1097,17 @@ module.exports = function (RED) {
10881097
if (msg.params.password) {
10891098
password = msg.params.password;
10901099
}
1100+
if (msg.params.apikey) {
1101+
apikey = msg.params.apikey;
1102+
}
10911103
}
10921104
endpoint = sEndpoint;
10931105
if ((!config['cwm-default-endpoint']) && config['cwm-service-endpoint']) {
10941106
endpoint = config['cwm-service-endpoint'];
10951107
}
10961108

10971109
node.status({});
1098-
initialCheck(username, password, method)
1110+
initialCheck(apikey, username, password, method)
10991111
.then(function(){
11001112
return buildParams(msg, method, config, params);
11011113
})
@@ -1134,7 +1146,8 @@ module.exports = function (RED) {
11341146
RED.nodes.registerType('watson-conversation-v1-workspace-manager', Node, {
11351147
credentials: {
11361148
username: {type:'text'},
1137-
password: {type:'password'}
1149+
password: {type:'password'},
1150+
apikey: {type: 'password'}
11381151
}
11391152
});
11401153

services/conversation/v1.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
<label for="node-input-password"><i class="fa fa-key"></i> Password</label>
3535
<input type="password" id="node-input-password" placeholder="Password">
3636
</div>
37+
<div class="form-row credentials" style="display: none;">
38+
<label for="node-input-apikey"><i class="fa fa-key"></i> API Key</label>
39+
<input type="password" id="node-input-apikey" placeholder="API Key"></input>
40+
</div>
3741

3842
<div class="form-row credentials">
3943
<label>&nbsp;</label>
@@ -100,6 +104,7 @@
100104
<br/>
101105
<li><code>msg.params.username</code> : If provided will be used as the username credential for the Conversation service.</li>
102106
<li><code>msg.params.password</code> : If provided will be used as the password credential for the Conversation service.</li>
107+
<li><code>msg.params.apikey</code> : If provided will be used as the api key credential for the Conversation service.</li>
103108
<li><code>msg.params.endpoint</code> : If provided will be used as the url for the Conversation service.</li>
104109
<li><code>msg.params.optout_learning</code> : Set to true to opt out of request logging. Check the <a href="https://console.bluemix.net/docs/services/watson/getting-started-logging.html#controlling-request-logging-for-watson-services" target="_blank">documentation</a> for details.</li>
105110
</ul>
@@ -165,7 +170,8 @@
165170
},
166171
credentials: {
167172
username: {type:'text'},
168-
password: {type:'password'}
173+
password: {type:'password'},
174+
apikey: {type:'password'}
169175
},
170176
color: 'rgb(84,149,230)',
171177
inputs: 1,

0 commit comments

Comments
 (0)