@nuancelabs/js-sdk 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +4 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@ function isRecord(value) {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
// src/core/sdk-version.ts
|
|
7
|
-
var SDK_HEADER = `js/${"0.1.
|
|
7
|
+
var SDK_HEADER = `js/${"0.1.1"}`;
|
|
8
8
|
|
|
9
9
|
// src/utils.ts
|
|
10
10
|
function normalizeHost(host) {
|
|
@@ -35,6 +35,9 @@ class NuanceApiClient {
|
|
|
35
35
|
}
|
|
36
36
|
async createConversation(request) {
|
|
37
37
|
const token = this.tokenProvider ? await this.tokenProvider() : undefined;
|
|
38
|
+
if (token !== undefined && (typeof token !== "string" || token === "")) {
|
|
39
|
+
throw new TypeError(`The token option must resolve to the session token string, but it resolved to ${token === "" ? "an empty string" : typeof token}. Return the "token" field of your endpoint's response.`);
|
|
40
|
+
}
|
|
38
41
|
const conversation = await this.request("/conversation", { method: "POST", body: request, token });
|
|
39
42
|
if (token !== undefined)
|
|
40
43
|
this.tokens.set(conversation.id, token);
|