Skip to content

Commit 9bf01a9

Browse files
committed
Merge branch 'master' into snyk-fix-k82684
2 parents e61d1de + 25aec3d commit 9bf01a9

17 files changed

+141
-131
lines changed

.travis.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ node_js:
44
- 6
55
- 8
66
before_install:
7-
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && openssl aes-256-cbc -K $encrypted_ac3aacad7ba8_key -iv $encrypted_ac3aacad7ba8_iv
8-
-in secrets.tar.enc -out test/resources/secrets.tar -d || true'
9-
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && cd test/resources/ && tar xvf secrets.tar && cd ../.. || true'
7+
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && openssl aes-256-cbc -K $encrypted_ac3aacad7ba8_key
8+
-iv $encrypted_ac3aacad7ba8_iv -in secrets.tar.enc -out test/resources/secrets.tar
9+
-d || true'
10+
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && cd test/resources/ && tar xvf secrets.tar
11+
&& cd ../.. || true'
1012
- npm install -g typescript
1113
script:
1214
- tsc
13-
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ];
14-
then npm run test-travis;
15-
else
16-
npm run test-unit-travis;
17-
fi
15+
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then npm run test-travis; else npm run
16+
test-unit-travis; fi
1817
- sh scripts/typedoc/generate_typedoc.sh
1918
after_success:
2019
- npm run report-coverage

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## [3.15.1](https://github.com/watson-developer-cloud/node-sdk/compare/v3.15.0...v3.15.1) (2019-01-07)
2+
3+
4+
### Bug Fixes
5+
6+
* add `disabled` property to CreateDialogNode ([41cd8dc](https://github.com/watson-developer-cloud/node-sdk/commit/41cd8dc))
7+
* add `user_defined` property to MessageOutput model ([ea28bf3](https://github.com/watson-developer-cloud/node-sdk/commit/ea28bf3))
8+
19
# [3.15.0](https://github.com/watson-developer-cloud/node-sdk/compare/v3.14.0...v3.15.0) (2018-12-07)
210

311

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,6 @@ function (err, token) {
282282

283283
### Assistant v2
284284

285-
> Watson Assistant v2 API is released in beta. For details, see the ["Introducing Watson Assistant"](https://www.ibm.com/blogs/watson/2018/03/the-future-of-watson-conversation-watson-assistant/) blog post.
286-
287285
Use the [Assistant][conversation] service to determine the intent of a message.
288286

289287
Note: You must first create a workspace via IBM Cloud. See [the documentation](https://console.bluemix.net/docs/services/conversation/index.html#about) for details.

assistant/v1.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3805,6 +3805,8 @@ namespace AssistantV1 {
38053805
digress_out_slots?: string;
38063806
/** A label that can be displayed externally to describe the purpose of the node to users. This string must be no longer than 512 characters. */
38073807
user_label?: string;
3808+
/** For internal use only. */
3809+
disabled?: boolean;
38083810
}
38093811

38103812
/** DialogNodeAction. */

assistant/v2.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,8 @@ namespace AssistantV2 {
452452
actions?: DialogNodeAction[];
453453
/** Additional detailed information about a message response and how it was generated. */
454454
debug?: MessageOutputDebug;
455+
/** An object containing any custom properties included in the response. This object includes any arbitrary properties defined in the dialog JSON editor as part of the dialog node output. */
456+
user_defined?: Object;
455457
}
456458

457459
/** Additional detailed information about a message response and how it was generated. */

examples/personality_insights.v2.js

Lines changed: 0 additions & 81 deletions
This file was deleted.

examples/text_to_speech_websocket.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ const synthesizeStream = textToSpeech.synthesizeUsingWebSocket(params);
2222
// the output of the stream can be piped to any writable stream, like an audio file
2323
synthesizeStream.pipe(fs.createWriteStream('./speech.ogg'));
2424

25+
// !!!!! IMPORTANT !!!!!
2526
// if the stream is not being piped anywhere and is only being listened to, the stream needs
26-
// to be explicitly set to flowing mode:
27+
// to be explicitly set to flowing mode by uncommenting the following line:
2728

2829
// synthesizeStream.resume();
2930

lib/base_service.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,30 @@ function usesBasicForIam(obj: any): boolean {
8989
return obj.username === 'apikey' && !obj.password.startsWith('icp-');
9090
}
9191

92+
// returns true if the string has a curly bracket or quote as the first or last character
93+
// these are common user-issues that we should handle before they get a network error
94+
function badCharAtAnEnd(value: string): boolean {
95+
return value.startsWith('{') || value.startsWith('"') || value.endsWith('}') || value.endsWith('"');
96+
}
97+
98+
// checks credentials for common user mistakes of copying {, }, or " characters from the documentation
99+
function checkCredentials(obj: any) {
100+
let errorMessage = '';
101+
const credsToCheck = ['url', 'username', 'password', 'iam_apikey'];
102+
credsToCheck.forEach(cred => {
103+
if (obj[cred] && badCharAtAnEnd(obj[cred])) {
104+
errorMessage += `The ${cred} shouldn't start or end with curly brackets or quotes. Be sure to remove any {, }, or "`;
105+
}
106+
});
107+
108+
if (errorMessage.length) {
109+
errorMessage += 'Revise these credentials - they should not start or end with curly brackets or quotes.';
110+
return errorMessage;
111+
} else {
112+
return null;
113+
}
114+
}
115+
92116
export class BaseService {
93117
static URL: string;
94118
name: string;
@@ -309,6 +333,11 @@ export class BaseService {
309333
}
310334
}
311335
}
336+
// check credentials for common user errors
337+
const credentialProblems = checkCredentials(_options);
338+
if (credentialProblems) {
339+
throw new Error(credentialProblems);
340+
}
312341
return _options;
313342
}
314343
/**

lib/synthesize-stream.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class SynthesizeStream extends Readable {
9999
const url =
100100
(options.url || 'wss://stream.watsonplatform.net/text-to-speech/api')
101101
.replace(/^http/, 'ws') +
102-
'/v1/synthesize' +
102+
'/v1/synthesize?' +
103103
queryString;
104104

105105
const socket = (this.socket = new w3cWebSocket(

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)