@aws-amplify/interactions 6.0.16 → 6.0.17-unstable.0d2aa5d.0
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/package.json +3 -3
- package/src/errors/assertValidationError.ts +1 -1
- package/src/lex-v1/AWSLexProvider.ts +3 -3
- package/src/lex-v1/apis/onComplete.ts +1 -1
- package/src/lex-v1/apis/send.ts +1 -1
- package/src/lex-v1/utils/resolveBotConfig.ts +1 -1
- package/src/lex-v2/AWSLexV2Provider.ts +8 -8
- package/src/lex-v2/apis/onComplete.ts +1 -1
- package/src/lex-v2/apis/send.ts +1 -1
- package/src/lex-v2/utils/resolveBotConfig.ts +1 -1
- package/src/types/Interactions.ts +1 -1
- package/src/utils/utils.native.ts +1 -1
- package/src/utils/utils.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/interactions",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.17-unstable.0d2aa5d.0+0d2aa5d",
|
|
4
4
|
"description": "Interactions category of aws-amplify",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"uuid": "^9.0.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@aws-amplify/core": "6.0.
|
|
83
|
+
"@aws-amplify/core": "6.0.17-unstable.0d2aa5d.0+0d2aa5d",
|
|
84
84
|
"typescript": "^5.0.2"
|
|
85
85
|
},
|
|
86
86
|
"size-limit": [
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"limit": "47.00 kB"
|
|
104
104
|
}
|
|
105
105
|
],
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "0d2aa5d71a6b995e302c7404becd8345763eae43"
|
|
107
107
|
}
|
|
@@ -10,7 +10,7 @@ import { InteractionsError } from './InteractionsError';
|
|
|
10
10
|
export function assertValidationError(
|
|
11
11
|
assertion: boolean,
|
|
12
12
|
name: InteractionsValidationErrorCode,
|
|
13
|
-
message?: string
|
|
13
|
+
message?: string,
|
|
14
14
|
): asserts assertion {
|
|
15
15
|
if (!assertion) {
|
|
16
16
|
const { message: defaultMessage, recoverySuggestion } =
|
|
@@ -44,7 +44,7 @@ class AWSLexProvider {
|
|
|
44
44
|
*/
|
|
45
45
|
reportBotStatus(
|
|
46
46
|
data: AWSLexProviderSendResponse,
|
|
47
|
-
{ name }: AWSLexProviderOption
|
|
47
|
+
{ name }: AWSLexProviderOption,
|
|
48
48
|
) {
|
|
49
49
|
const callback = this._botsCompleteCallback[name];
|
|
50
50
|
if (!callback) {
|
|
@@ -68,7 +68,7 @@ class AWSLexProvider {
|
|
|
68
68
|
|
|
69
69
|
async sendMessage(
|
|
70
70
|
botConfig: AWSLexProviderOption,
|
|
71
|
-
message: string | InteractionsMessage
|
|
71
|
+
message: string | InteractionsMessage,
|
|
72
72
|
): Promise<InteractionsResponse> {
|
|
73
73
|
// check if credentials are present
|
|
74
74
|
let session;
|
|
@@ -158,7 +158,7 @@ class AWSLexProvider {
|
|
|
158
158
|
|
|
159
159
|
onComplete(
|
|
160
160
|
{ name }: AWSLexProviderOption,
|
|
161
|
-
callback: InteractionsOnCompleteCallback
|
|
161
|
+
callback: InteractionsOnCompleteCallback,
|
|
162
162
|
) {
|
|
163
163
|
this._botsCompleteCallback[name] = callback;
|
|
164
164
|
}
|
|
@@ -15,7 +15,7 @@ export const onComplete = (input: OnCompleteInput): void => {
|
|
|
15
15
|
assertValidationError(
|
|
16
16
|
!!botConfig,
|
|
17
17
|
InteractionsValidationErrorCode.NoBotConfig,
|
|
18
|
-
`Bot ${botName} does not exist
|
|
18
|
+
`Bot ${botName} does not exist.`,
|
|
19
19
|
);
|
|
20
20
|
lexProvider.onComplete(botConfig, callback);
|
|
21
21
|
};
|
package/src/lex-v1/apis/send.ts
CHANGED
|
@@ -15,7 +15,7 @@ export const send = async (input: SendInput): Promise<SendOutput> => {
|
|
|
15
15
|
assertValidationError(
|
|
16
16
|
!!botConfig,
|
|
17
17
|
InteractionsValidationErrorCode.NoBotConfig,
|
|
18
|
-
`Bot ${botName} does not exist
|
|
18
|
+
`Bot ${botName} does not exist.`,
|
|
19
19
|
);
|
|
20
20
|
return lexProvider.sendMessage(botConfig, message);
|
|
21
21
|
};
|
|
@@ -5,7 +5,7 @@ import { AWSLexProviderOption } from '../types';
|
|
|
5
5
|
import { Amplify } from '@aws-amplify/core';
|
|
6
6
|
|
|
7
7
|
export const resolveBotConfig = (
|
|
8
|
-
botName: string
|
|
8
|
+
botName: string,
|
|
9
9
|
): AWSLexProviderOption | undefined => {
|
|
10
10
|
const { [botName]: botConfig = undefined } =
|
|
11
11
|
Amplify.getConfig().Interactions?.LexV1 ?? {};
|
|
@@ -66,7 +66,7 @@ class AWSLexV2Provider {
|
|
|
66
66
|
*/
|
|
67
67
|
public async sendMessage(
|
|
68
68
|
botConfig: AWSLexV2ProviderOption,
|
|
69
|
-
message: string | InteractionsMessage
|
|
69
|
+
message: string | InteractionsMessage,
|
|
70
70
|
): Promise<InteractionsResponse> {
|
|
71
71
|
// check if credentials are present
|
|
72
72
|
let session;
|
|
@@ -98,14 +98,14 @@ class AWSLexV2Provider {
|
|
|
98
98
|
botConfig,
|
|
99
99
|
message,
|
|
100
100
|
reqBaseParams,
|
|
101
|
-
client
|
|
101
|
+
client,
|
|
102
102
|
);
|
|
103
103
|
} else {
|
|
104
104
|
response = await this._handleRecognizeUtteranceCommand(
|
|
105
105
|
botConfig,
|
|
106
106
|
message,
|
|
107
107
|
reqBaseParams,
|
|
108
|
-
client
|
|
108
|
+
client,
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
111
|
return response;
|
|
@@ -119,7 +119,7 @@ class AWSLexV2Provider {
|
|
|
119
119
|
*/
|
|
120
120
|
public onComplete(
|
|
121
121
|
{ name }: AWSLexV2ProviderOption,
|
|
122
|
-
callback: InteractionsOnCompleteCallback
|
|
122
|
+
callback: InteractionsOnCompleteCallback,
|
|
123
123
|
) {
|
|
124
124
|
this._botsCompleteCallback[name] = callback;
|
|
125
125
|
}
|
|
@@ -129,7 +129,7 @@ class AWSLexV2Provider {
|
|
|
129
129
|
*/
|
|
130
130
|
_reportBotStatus(
|
|
131
131
|
data: AWSLexV2ProviderSendResponse,
|
|
132
|
-
{ name }: AWSLexV2ProviderOption
|
|
132
|
+
{ name }: AWSLexV2ProviderOption,
|
|
133
133
|
) {
|
|
134
134
|
const sessionState = data?.sessionState;
|
|
135
135
|
|
|
@@ -159,7 +159,7 @@ class AWSLexV2Provider {
|
|
|
159
159
|
* update audioStream format
|
|
160
160
|
*/
|
|
161
161
|
private async _formatUtteranceCommandOutput(
|
|
162
|
-
data: RecognizeUtteranceCommandOutput
|
|
162
|
+
data: RecognizeUtteranceCommandOutput,
|
|
163
163
|
): Promise<RecognizeUtteranceCommandOutputFormatted> {
|
|
164
164
|
return {
|
|
165
165
|
...data,
|
|
@@ -182,7 +182,7 @@ class AWSLexV2Provider {
|
|
|
182
182
|
botConfig: AWSLexV2ProviderOption,
|
|
183
183
|
data: string,
|
|
184
184
|
baseParams: lexV2BaseReqParams,
|
|
185
|
-
client: LexRuntimeV2Client
|
|
185
|
+
client: LexRuntimeV2Client,
|
|
186
186
|
) {
|
|
187
187
|
logger.debug('postText to lex2', data);
|
|
188
188
|
|
|
@@ -210,7 +210,7 @@ class AWSLexV2Provider {
|
|
|
210
210
|
botConfig: AWSLexV2ProviderOption,
|
|
211
211
|
data: InteractionsMessage,
|
|
212
212
|
baseParams: lexV2BaseReqParams,
|
|
213
|
-
client: LexRuntimeV2Client
|
|
213
|
+
client: LexRuntimeV2Client,
|
|
214
214
|
) {
|
|
215
215
|
const {
|
|
216
216
|
content,
|
|
@@ -15,7 +15,7 @@ export const onComplete = (input: OnCompleteInput): void => {
|
|
|
15
15
|
assertValidationError(
|
|
16
16
|
!!botConfig,
|
|
17
17
|
InteractionsValidationErrorCode.NoBotConfig,
|
|
18
|
-
`Bot ${botName} does not exist
|
|
18
|
+
`Bot ${botName} does not exist.`,
|
|
19
19
|
);
|
|
20
20
|
lexProvider.onComplete(botConfig, callback);
|
|
21
21
|
};
|
package/src/lex-v2/apis/send.ts
CHANGED
|
@@ -15,7 +15,7 @@ export const send = async (input: SendInput): Promise<SendOutput> => {
|
|
|
15
15
|
assertValidationError(
|
|
16
16
|
!!botConfig,
|
|
17
17
|
InteractionsValidationErrorCode.NoBotConfig,
|
|
18
|
-
`Bot ${botName} does not exist
|
|
18
|
+
`Bot ${botName} does not exist.`,
|
|
19
19
|
);
|
|
20
20
|
return lexProvider.sendMessage(botConfig, message);
|
|
21
21
|
};
|
|
@@ -5,7 +5,7 @@ import { AWSLexV2ProviderOption } from '../types';
|
|
|
5
5
|
import { Amplify } from '@aws-amplify/core';
|
|
6
6
|
|
|
7
7
|
export const resolveBotConfig = (
|
|
8
|
-
botName: string
|
|
8
|
+
botName: string,
|
|
9
9
|
): AWSLexV2ProviderOption | undefined => {
|
|
10
10
|
const { [botName]: botConfig = undefined } =
|
|
11
11
|
Amplify.getConfig().Interactions?.LexV2 ?? {};
|
package/src/utils/utils.ts
CHANGED
|
@@ -18,7 +18,7 @@ export const base64ToArrayBuffer = (base64: string): Uint8Array => {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export const gzipDecompressToString = async (
|
|
21
|
-
data: Uint8Array
|
|
21
|
+
data: Uint8Array,
|
|
22
22
|
): Promise<string> => {
|
|
23
23
|
return await new Promise((resolve, reject) => {
|
|
24
24
|
gunzip(data, (err, resp) => {
|