@aws-amplify/interactions 6.0.1-unstable.cfbde4c.0 → 6.0.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/{lib → dist/cjs}/errors/InteractionsError.js +3 -1
- package/dist/cjs/errors/InteractionsError.js.map +1 -0
- package/{lib → dist/cjs}/errors/assertValidationError.js +3 -1
- package/dist/cjs/errors/assertValidationError.js.map +1 -0
- package/{lib → dist/cjs}/errors/index.js +3 -1
- package/dist/cjs/errors/index.js.map +1 -0
- package/{lib → dist/cjs}/errors/validation.js +4 -2
- package/dist/cjs/errors/validation.js.map +1 -0
- package/{lib → dist/cjs}/index.js +3 -1
- package/dist/cjs/index.js.map +1 -0
- package/{lib → dist/cjs}/lex-v1/AWSLexProvider.js +3 -3
- package/dist/cjs/lex-v1/AWSLexProvider.js.map +1 -0
- package/{lib → dist/cjs}/lex-v1/apis/index.js +3 -1
- package/dist/cjs/lex-v1/apis/index.js.map +1 -0
- package/{lib → dist/cjs}/lex-v1/apis/onComplete.js +3 -1
- package/dist/cjs/lex-v1/apis/onComplete.js.map +1 -0
- package/{lib → dist/cjs}/lex-v1/apis/send.js +3 -1
- package/dist/cjs/lex-v1/apis/send.js.map +1 -0
- package/{lib → dist/cjs}/lex-v1/index.js +3 -1
- package/dist/cjs/lex-v1/index.js.map +1 -0
- package/{lib → dist/cjs}/lex-v1/types/AWSLexProviderOption.js +3 -1
- package/dist/cjs/lex-v1/types/AWSLexProviderOption.js.map +1 -0
- package/{lib/lex-v2 → dist/cjs/lex-v1}/types/index.js +3 -1
- package/dist/cjs/lex-v1/types/index.js.map +1 -0
- package/{lib/lex-v2 → dist/cjs/lex-v1}/types/inputs.js +3 -1
- package/dist/cjs/lex-v1/types/inputs.js.map +1 -0
- package/{lib/lex-v2 → dist/cjs/lex-v1}/types/outputs.js +3 -1
- package/dist/cjs/lex-v1/types/outputs.js.map +1 -0
- package/{lib/lex-v2 → dist/cjs/lex-v1}/utils/index.js +3 -1
- package/dist/cjs/lex-v1/utils/index.js.map +1 -0
- package/{lib → dist/cjs}/lex-v1/utils/resolveBotConfig.js +3 -1
- package/dist/cjs/lex-v1/utils/resolveBotConfig.js.map +1 -0
- package/{lib → dist/cjs}/lex-v2/AWSLexV2Provider.js +3 -3
- package/dist/cjs/lex-v2/AWSLexV2Provider.js.map +1 -0
- package/{lib → dist/cjs}/lex-v2/apis/index.js +3 -1
- package/dist/cjs/lex-v2/apis/index.js.map +1 -0
- package/{lib → dist/cjs}/lex-v2/apis/onComplete.js +3 -1
- package/dist/cjs/lex-v2/apis/onComplete.js.map +1 -0
- package/{lib → dist/cjs}/lex-v2/apis/send.js +3 -1
- package/dist/cjs/lex-v2/apis/send.js.map +1 -0
- package/{lib → dist/cjs}/lex-v2/index.js +3 -1
- package/dist/cjs/lex-v2/index.js.map +1 -0
- package/{lib → dist/cjs}/lex-v2/types/AWSLexV2ProviderOption.js +3 -1
- package/dist/cjs/lex-v2/types/AWSLexV2ProviderOption.js.map +1 -0
- package/{lib/lex-v1 → dist/cjs/lex-v2}/types/index.js +3 -1
- package/dist/cjs/lex-v2/types/index.js.map +1 -0
- package/{lib/lex-v1 → dist/cjs/lex-v2}/types/inputs.js +3 -1
- package/dist/cjs/lex-v2/types/inputs.js.map +1 -0
- package/{lib → dist/cjs/lex-v2}/types/outputs.js +3 -1
- package/dist/cjs/lex-v2/types/outputs.js.map +1 -0
- package/{lib/lex-v1 → dist/cjs/lex-v2}/utils/index.js +3 -1
- package/dist/cjs/lex-v2/utils/index.js.map +1 -0
- package/{lib → dist/cjs}/lex-v2/utils/resolveBotConfig.js +3 -1
- package/dist/cjs/lex-v2/utils/resolveBotConfig.js.map +1 -0
- package/{lib → dist/cjs}/types/Interactions.js +3 -1
- package/dist/cjs/types/Interactions.js.map +1 -0
- package/{lib → dist/cjs}/types/index.js +3 -1
- package/dist/cjs/types/index.js.map +1 -0
- package/{lib → dist/cjs}/types/inputs.js +3 -1
- package/dist/cjs/types/inputs.js.map +1 -0
- package/{lib/lex-v1 → dist/cjs}/types/outputs.js +3 -1
- package/dist/cjs/types/outputs.js.map +1 -0
- package/{lib → dist/cjs}/utils/commonUtils.js +3 -1
- package/dist/cjs/utils/commonUtils.js.map +1 -0
- package/{lib → dist/cjs}/utils/index.js +3 -1
- package/dist/cjs/utils/index.js.map +1 -0
- package/{lib → dist/cjs}/utils/utils.js +3 -1
- package/dist/cjs/utils/utils.js.map +1 -0
- package/{lib → dist/cjs}/utils/utils.native.js +3 -1
- package/dist/cjs/utils/utils.native.js.map +1 -0
- package/{lib-esm/errors/InteractionsError.js → dist/esm/errors/InteractionsError.mjs} +6 -2
- package/dist/esm/errors/InteractionsError.mjs.map +1 -0
- package/{lib-esm/errors/assertValidationError.js → dist/esm/errors/assertValidationError.mjs} +7 -3
- package/dist/esm/errors/assertValidationError.mjs.map +1 -0
- package/dist/esm/errors/index.mjs +3 -0
- package/dist/esm/errors/index.mjs.map +1 -0
- package/{lib-esm/errors/validation.js → dist/esm/errors/validation.mjs} +5 -2
- package/dist/esm/errors/validation.mjs.map +1 -0
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -0
- package/{lib-esm/lex-v1/AWSLexProvider.js → dist/esm/lex-v1/AWSLexProvider.mjs} +7 -5
- package/dist/esm/lex-v1/AWSLexProvider.mjs.map +1 -0
- package/dist/esm/lex-v1/apis/index.mjs +3 -0
- package/dist/esm/lex-v1/apis/index.mjs.map +1 -0
- package/dist/esm/lex-v1/apis/onComplete.mjs +16 -0
- package/dist/esm/lex-v1/apis/onComplete.mjs.map +1 -0
- package/{lib-esm/lex-v2/apis/send.js → dist/esm/lex-v1/apis/send.mjs} +9 -4
- package/dist/esm/lex-v1/apis/send.mjs.map +1 -0
- package/{lib-esm/lex-v1/index.js → dist/esm/lex-v1/index.mjs} +7 -2
- package/dist/esm/lex-v1/index.mjs.map +1 -0
- package/dist/esm/lex-v1/types/AWSLexProviderOption.mjs +2 -0
- package/dist/esm/lex-v1/types/AWSLexProviderOption.mjs.map +1 -0
- package/dist/esm/lex-v1/types/index.mjs +2 -0
- package/dist/esm/lex-v1/types/index.mjs.map +1 -0
- package/dist/esm/lex-v1/types/inputs.mjs +2 -0
- package/dist/esm/lex-v1/types/inputs.mjs.map +1 -0
- package/dist/esm/lex-v1/types/outputs.mjs +2 -0
- package/dist/esm/lex-v1/types/outputs.mjs.map +1 -0
- package/dist/esm/lex-v1/utils/index.mjs +2 -0
- package/dist/esm/lex-v1/utils/index.mjs.map +1 -0
- package/{lib-esm/lex-v1/utils/resolveBotConfig.js → dist/esm/lex-v1/utils/resolveBotConfig.mjs} +6 -2
- package/dist/esm/lex-v1/utils/resolveBotConfig.mjs.map +1 -0
- package/{lib-esm/lex-v2/AWSLexV2Provider.js → dist/esm/lex-v2/AWSLexV2Provider.mjs} +10 -7
- package/dist/esm/lex-v2/AWSLexV2Provider.mjs.map +1 -0
- package/dist/esm/lex-v2/apis/index.mjs +3 -0
- package/dist/esm/lex-v2/apis/index.mjs.map +1 -0
- package/dist/esm/lex-v2/apis/onComplete.mjs +16 -0
- package/dist/esm/lex-v2/apis/onComplete.mjs.map +1 -0
- package/{lib-esm/lex-v1/apis/send.js → dist/esm/lex-v2/apis/send.mjs} +9 -4
- package/dist/esm/lex-v2/apis/send.mjs.map +1 -0
- package/dist/esm/lex-v2/index.mjs +12 -0
- package/dist/esm/lex-v2/index.mjs.map +1 -0
- package/dist/esm/lex-v2/types/AWSLexV2ProviderOption.mjs +2 -0
- package/dist/esm/lex-v2/types/AWSLexV2ProviderOption.mjs.map +1 -0
- package/dist/esm/lex-v2/types/index.mjs +2 -0
- package/dist/esm/lex-v2/types/index.mjs.map +1 -0
- package/dist/esm/lex-v2/types/inputs.mjs +2 -0
- package/dist/esm/lex-v2/types/inputs.mjs.map +1 -0
- package/dist/esm/lex-v2/types/outputs.mjs +2 -0
- package/dist/esm/lex-v2/types/outputs.mjs.map +1 -0
- package/dist/esm/lex-v2/utils/index.mjs +2 -0
- package/dist/esm/lex-v2/utils/index.mjs.map +1 -0
- package/{lib-esm/lex-v2/utils/resolveBotConfig.js → dist/esm/lex-v2/utils/resolveBotConfig.mjs} +6 -2
- package/dist/esm/lex-v2/utils/resolveBotConfig.mjs.map +1 -0
- package/dist/esm/types/Interactions.mjs +2 -0
- package/dist/esm/types/Interactions.mjs.map +1 -0
- package/dist/esm/types/index.mjs +2 -0
- package/dist/esm/types/index.mjs.map +1 -0
- package/dist/esm/types/inputs.mjs +2 -0
- package/dist/esm/types/inputs.mjs.map +1 -0
- package/dist/esm/types/outputs.mjs +2 -0
- package/dist/esm/types/outputs.mjs.map +1 -0
- package/{lib-esm/utils/commonUtils.js → dist/esm/utils/commonUtils.mjs} +6 -2
- package/dist/esm/utils/commonUtils.mjs.map +1 -0
- package/dist/esm/utils/index.mjs +3 -0
- package/dist/esm/utils/index.mjs.map +1 -0
- package/{lib-esm/utils/utils.js → dist/esm/utils/utils.mjs} +8 -4
- package/dist/esm/utils/utils.mjs.map +1 -0
- package/{lib-esm/utils/utils.native.js → dist/esm/utils/utils.native.mjs} +9 -5
- package/dist/esm/utils/utils.native.mjs.map +1 -0
- package/lex-v1/package.json +5 -4
- package/lex-v2/package.json +5 -4
- package/package.json +38 -38
- package/lib/errors/InteractionsError.d.ts +0 -4
- package/lib/errors/assertValidationError.d.ts +0 -2
- package/lib/errors/index.d.ts +0 -2
- package/lib/errors/validation.d.ts +0 -5
- package/lib/index.d.ts +0 -2
- package/lib/lex-v1/AWSLexProvider.d.ts +0 -20
- package/lib/lex-v1/apis/index.d.ts +0 -2
- package/lib/lex-v1/apis/onComplete.d.ts +0 -2
- package/lib/lex-v1/apis/send.d.ts +0 -2
- package/lib/lex-v1/index.d.ts +0 -6
- package/lib/lex-v1/types/AWSLexProviderOption.d.ts +0 -11
- package/lib/lex-v1/types/index.d.ts +0 -3
- package/lib/lex-v1/types/inputs.d.ts +0 -9
- package/lib/lex-v1/types/outputs.d.ts +0 -5
- package/lib/lex-v1/utils/index.d.ts +0 -1
- package/lib/lex-v1/utils/resolveBotConfig.d.ts +0 -2
- package/lib/lex-v2/AWSLexV2Provider.d.ts +0 -52
- package/lib/lex-v2/apis/index.d.ts +0 -2
- package/lib/lex-v2/apis/onComplete.d.ts +0 -2
- package/lib/lex-v2/apis/send.d.ts +0 -2
- package/lib/lex-v2/index.d.ts +0 -3
- package/lib/lex-v2/types/AWSLexV2ProviderOption.d.ts +0 -13
- package/lib/lex-v2/types/index.d.ts +0 -3
- package/lib/lex-v2/types/inputs.d.ts +0 -9
- package/lib/lex-v2/types/outputs.d.ts +0 -5
- package/lib/lex-v2/utils/index.d.ts +0 -1
- package/lib/lex-v2/utils/resolveBotConfig.d.ts +0 -2
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/lib/types/Interactions.d.ts +0 -17
- package/lib/types/index.d.ts +0 -2
- package/lib/types/inputs.d.ts +0 -9
- package/lib/types/outputs.d.ts +0 -2
- package/lib/utils/commonUtils.d.ts +0 -1
- package/lib/utils/index.d.ts +0 -2
- package/lib/utils/utils.d.ts +0 -3
- package/lib/utils/utils.native.d.ts +0 -3
- package/lib-esm/errors/index.js +0 -4
- package/lib-esm/index.js +0 -3
- package/lib-esm/lex-v1/apis/index.js +0 -4
- package/lib-esm/lex-v1/apis/onComplete.js +0 -11
- package/lib-esm/lex-v1/types/AWSLexProviderOption.js +0 -3
- package/lib-esm/lex-v1/types/index.js +0 -3
- package/lib-esm/lex-v1/types/inputs.js +0 -3
- package/lib-esm/lex-v1/types/outputs.js +0 -3
- package/lib-esm/lex-v1/utils/index.js +0 -3
- package/lib-esm/lex-v2/apis/index.js +0 -4
- package/lib-esm/lex-v2/apis/onComplete.js +0 -11
- package/lib-esm/lex-v2/index.js +0 -7
- package/lib-esm/lex-v2/types/AWSLexV2ProviderOption.js +0 -3
- package/lib-esm/lex-v2/types/index.js +0 -3
- package/lib-esm/lex-v2/types/inputs.js +0 -3
- package/lib-esm/lex-v2/types/outputs.js +0 -3
- package/lib-esm/lex-v2/utils/index.js +0 -3
- package/lib-esm/tsconfig.tsbuildinfo +0 -1
- package/lib-esm/types/Interactions.js +0 -3
- package/lib-esm/types/index.js +0 -3
- package/lib-esm/types/inputs.js +0 -3
- package/lib-esm/types/outputs.js +0 -3
- package/lib-esm/utils/index.js +0 -4
- /package/{lib-esm → dist/esm}/errors/InteractionsError.d.ts +0 -0
- /package/{lib-esm → dist/esm}/errors/assertValidationError.d.ts +0 -0
- /package/{lib-esm → dist/esm}/errors/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/errors/validation.d.ts +0 -0
- /package/{lib-esm → dist/esm}/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v1/AWSLexProvider.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v1/apis/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v1/apis/onComplete.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v1/apis/send.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v1/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v1/types/AWSLexProviderOption.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v1/types/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v1/types/inputs.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v1/types/outputs.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v1/utils/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v1/utils/resolveBotConfig.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v2/AWSLexV2Provider.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v2/apis/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v2/apis/onComplete.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v2/apis/send.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v2/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v2/types/AWSLexV2ProviderOption.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v2/types/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v2/types/inputs.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v2/types/outputs.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v2/utils/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/lex-v2/utils/resolveBotConfig.d.ts +0 -0
- /package/{lib-esm → dist/esm}/types/Interactions.d.ts +0 -0
- /package/{lib-esm → dist/esm}/types/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/types/inputs.d.ts +0 -0
- /package/{lib-esm → dist/esm}/types/outputs.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/commonUtils.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/utils.d.ts +0 -0
- /package/{lib-esm → dist/esm}/utils/utils.native.d.ts +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -9,3 +10,4 @@ Object.defineProperty(exports, "base64ToArrayBuffer", { enumerable: true, get: f
|
|
|
9
10
|
Object.defineProperty(exports, "gzipDecompressToString", { enumerable: true, get: function () { return utils_1.gzipDecompressToString; } });
|
|
10
11
|
var commonUtils_1 = require("./commonUtils");
|
|
11
12
|
Object.defineProperty(exports, "unGzipBase64AsJson", { enumerable: true, get: function () { return commonUtils_1.unGzipBase64AsJson; } });
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/utils/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.unGzipBase64AsJson = exports.gzipDecompressToString = exports.base64ToArrayBuffer = exports.convert = void 0;\nvar utils_1 = require(\"./utils\");\nObject.defineProperty(exports, \"convert\", { enumerable: true, get: function () { return utils_1.convert; } });\nObject.defineProperty(exports, \"base64ToArrayBuffer\", { enumerable: true, get: function () { return utils_1.base64ToArrayBuffer; } });\nObject.defineProperty(exports, \"gzipDecompressToString\", { enumerable: true, get: function () { return utils_1.gzipDecompressToString; } });\nvar commonUtils_1 = require(\"./commonUtils\");\nObject.defineProperty(exports, \"unGzipBase64AsJson\", { enumerable: true, get: function () { return commonUtils_1.unGzipBase64AsJson; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;AACrH,IAAI,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACjC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;AAC9G,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,qBAAqB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,OAAO,CAAC,mBAAmB,CAAC,EAAE,EAAE,CAAC,CAAC;AACtI,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,wBAAwB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,OAAO,CAAC,sBAAsB,CAAC,EAAE,EAAE,CAAC,CAAC;AAC5I,IAAI,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAC7C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,oBAAoB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,aAAa,CAAC,kBAAkB,CAAC,EAAE,EAAE,CAAC;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -30,3 +31,4 @@ const gzipDecompressToString = async (data) => {
|
|
|
30
31
|
});
|
|
31
32
|
};
|
|
32
33
|
exports.gzipDecompressToString = gzipDecompressToString;
|
|
34
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/utils/utils.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.gzipDecompressToString = exports.base64ToArrayBuffer = exports.convert = void 0;\nconst fflate_1 = require(\"fflate\");\nconst convert = async (stream) => {\n if (stream instanceof Blob || stream instanceof ReadableStream) {\n return new Response(stream)\n .arrayBuffer()\n .then(buffer => new Uint8Array(buffer));\n }\n else {\n return Promise.reject('Invalid content type');\n }\n};\nexports.convert = convert;\nconst base64ToArrayBuffer = (base64) => {\n return Uint8Array.from(window.atob(base64), c => c.charCodeAt(0));\n};\nexports.base64ToArrayBuffer = base64ToArrayBuffer;\nconst gzipDecompressToString = async (data) => {\n return await new Promise((resolve, reject) => {\n (0, fflate_1.gunzip)(data, (err, resp) => {\n if (err)\n reject(err);\n else\n resolve((0, fflate_1.strFromU8)(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,gBAAgB,MAAM,CAAC,GAAG,CAAC,CAAC;AAC5B;AACA,gBAAgB,OAAO,CAAC,IAAI,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;AACvD,SAAS,CAAC,CAAC;AACX,KAAK,CAAC,CAAC;AACP,CAAC,CAAC;AACF,OAAO,CAAC,sBAAsB,GAAG,sBAAsB;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -43,3 +44,4 @@ const gzipDecompressToString = async (data) => {
|
|
|
43
44
|
});
|
|
44
45
|
};
|
|
45
46
|
exports.gzipDecompressToString = gzipDecompressToString;
|
|
47
|
+
//# sourceMappingURL=utils.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.native.js","sources":["../../../src/utils/utils.native.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.gzipDecompressToString = exports.base64ToArrayBuffer = exports.convert = void 0;\nconst base_64_1 = require(\"base-64\");\nconst pako_1 = require(\"pako\");\nconst convert = async (stream) => {\n if (!(stream instanceof Blob)) {\n return Promise.reject('Invalid content type');\n }\n return new Promise(async (resolve, reject) => {\n try {\n const fileReaderInstance = new FileReader();\n fileReaderInstance.readAsDataURL(stream);\n fileReaderInstance.onload = async () => {\n const blobURL = fileReaderInstance.result;\n const base64Blob = blobURL.split(/,(.*)/s)[1];\n const decodedArrayBuffer = (0, exports.base64ToArrayBuffer)(base64Blob);\n resolve(decodedArrayBuffer);\n };\n }\n catch (error) {\n reject('unable to convert blob to arrayBuffer: ' + error);\n }\n });\n};\nexports.convert = convert;\nconst base64ToArrayBuffer = (base64) => {\n const binaryString = (0, base_64_1.decode)(base64);\n return Uint8Array.from(binaryString, c => c.charCodeAt(0));\n};\nexports.base64ToArrayBuffer = base64ToArrayBuffer;\nconst gzipDecompressToString = async (data) => {\n return new Promise((resolve, reject) => {\n try {\n const result = (0, pako_1.ungzip)(data, { to: 'string' });\n resolve(result);\n }\n catch (error) {\n reject('unable to decompress' + error);\n }\n });\n};\nexports.gzipDecompressToString = gzipDecompressToString;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;AACxF,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACrC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC/B,MAAM,OAAO,GAAG,OAAO,MAAM,KAAK;AAClC,IAAI,IAAI,EAAE,MAAM,YAAY,IAAI,CAAC,EAAE;AACnC,QAAQ,OAAO,OAAO,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;AACtD,KAAK;AACL,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,OAAO,EAAE,MAAM,KAAK;AAClD,QAAQ,IAAI;AACZ,YAAY,MAAM,kBAAkB,GAAG,IAAI,UAAU,EAAE,CAAC;AACxD,YAAY,kBAAkB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;AACrD,YAAY,kBAAkB,CAAC,MAAM,GAAG,YAAY;AACpD,gBAAgB,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC;AAC1D,gBAAgB,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,gBAAgB,MAAM,kB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yright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
export class InteractionsError extends AmplifyError {
|
|
5
|
+
class InteractionsError extends AmplifyError {
|
|
5
6
|
constructor(params) {
|
|
6
7
|
super(params);
|
|
7
8
|
// Hack for making the custom error class work when transpiled to es5
|
|
@@ -10,3 +11,6 @@ export class InteractionsError extends AmplifyError {
|
|
|
10
11
|
Object.setPrototypeOf(this, InteractionsError.prototype);
|
|
11
12
|
}
|
|
12
13
|
}
|
|
14
|
+
|
|
15
|
+
export { InteractionsError };
|
|
16
|
+
//# sourceMappingURL=InteractionsError.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InteractionsError.mjs","sources":["../../../src/errors/InteractionsError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyError, } from '@aws-amplify/core/internals/utils';\nexport class InteractionsError extends AmplifyError {\n constructor(params) {\n super(params);\n // Hack for making the custom error class work when transpiled to es5\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = InteractionsError;\n Object.setPrototypeOf(this, InteractionsError.prototype);\n }\n}\n"],"names":[],"mappings":";;AAAA;AACA;AAEO,MAAM,iBAAiB,SAAS,YAAY,CAAC;AACpD,IAAI,WAAW,CAAC,MAAM,EAAE;AACxB,QAAQ,KAAK,CAAC,MAAM,CAAC,CAAC;AACtB;AACA;AACA,QAAQ,IAAI,CAAC,WAAW,GAAG,iBAAiB,CAAC;AAC7C,QAAQ,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;AACjE,KAAK;AACL;;;;"}
|
package/{lib-esm/errors/assertValidationError.js → dist/esm/errors/assertValidationError.mjs}
RENAMED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { validationErrorMap } from './validation.mjs';
|
|
2
|
+
import { InteractionsError } from './InteractionsError.mjs';
|
|
3
|
+
|
|
1
4
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
5
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { InteractionsError } from './InteractionsError';
|
|
5
|
-
export function assertValidationError(assertion, name, message) {
|
|
6
|
+
function assertValidationError(assertion, name, message) {
|
|
6
7
|
if (!assertion) {
|
|
7
8
|
const { message: defaultMessage, recoverySuggestion } = validationErrorMap[name];
|
|
8
9
|
throw new InteractionsError({
|
|
@@ -12,3 +13,6 @@ export function assertValidationError(assertion, name, message) {
|
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
15
|
}
|
|
16
|
+
|
|
17
|
+
export { assertValidationError };
|
|
18
|
+
//# sourceMappingURL=assertValidationError.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertValidationError.mjs","sources":["../../../src/errors/assertValidationError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { validationErrorMap, } from './validation';\nimport { InteractionsError } from './InteractionsError';\nexport function assertValidationError(assertion, name, message) {\n if (!assertion) {\n const { message: defaultMessage, recoverySuggestion } = validationErrorMap[name];\n throw new InteractionsError({\n name,\n message: message ?? defaultMessage,\n recoverySuggestion,\n });\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGO,SAAS,qBAAqB,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE;AAChE,IAAI,IAAI,CAAC,SAAS,EAAE;AACpB,QAAQ,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;AACzF,QAAQ,MAAM,IAAI,iBAAiB,CAAC;AACpC,YAAY,IAAI;AAChB,YAAY,OAAO,EAAE,OAAO,IAAI,cAAc;AAC9C,YAAY,kBAAkB;AAC9B,SAAS,CAAC,CAAC;AACX,KAAK;AACL;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
3
|
+
var InteractionsValidationErrorCode;
|
|
4
4
|
(function (InteractionsValidationErrorCode) {
|
|
5
5
|
InteractionsValidationErrorCode["NoBotConfig"] = "NoBotConfig";
|
|
6
6
|
})(InteractionsValidationErrorCode || (InteractionsValidationErrorCode = {}));
|
|
7
|
-
|
|
7
|
+
const validationErrorMap = {
|
|
8
8
|
[InteractionsValidationErrorCode.NoBotConfig]: {
|
|
9
9
|
message: 'Missing configuration for the bot',
|
|
10
10
|
},
|
|
11
11
|
};
|
|
12
|
+
|
|
13
|
+
export { InteractionsValidationErrorCode, validationErrorMap };
|
|
14
|
+
//# sourceMappingURL=validation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.mjs","sources":["../../../src/errors/validation.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport var InteractionsValidationErrorCode;\n(function (InteractionsValidationErrorCode) {\n InteractionsValidationErrorCode[\"NoBotConfig\"] = \"NoBotConfig\";\n})(InteractionsValidationErrorCode || (InteractionsValidationErrorCode = {}));\nexport const validationErrorMap = {\n [InteractionsValidationErrorCode.NoBotConfig]: {\n message: 'Missing configuration for the bot',\n },\n};\n"],"names":[],"mappings":"AAAA;AACA;AACU,IAAC,gCAAgC;AAC3C,CAAC,UAAU,+BAA+B,EAAE;AAC5C,IAAI,+BAA+B,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC;AACnE,CAAC,EAAE,+BAA+B,KAAK,+BAA+B,GAAG,EAAE,CAAC,CAAC,CAAC;AAClE,MAAC,kBAAkB,GAAG;AAClC,IAAI,CAAC,+BAA+B,CAAC,WAAW,GAAG;AACnD,QAAQ,OAAO,EAAE,mCAAmC;AACpD,KAAK;AACL;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { DialogState, LexRuntimeServiceClient,
|
|
1
|
+
import { DialogState, LexRuntimeServiceClient, PostTextCommand, PostContentCommand } from '@aws-sdk/client-lex-runtime-service';
|
|
2
2
|
import { getAmplifyUserAgentObject } from '@aws-amplify/core/internals/utils';
|
|
3
3
|
import { ConsoleLogger, fetchAuthSession } from '@aws-amplify/core';
|
|
4
|
-
import { convert } from '../utils';
|
|
4
|
+
import { convert } from '../utils/utils.mjs';
|
|
5
|
+
|
|
5
6
|
const logger = new ConsoleLogger('AWSLexProvider');
|
|
6
7
|
class AWSLexProvider {
|
|
7
8
|
constructor() {
|
|
@@ -27,8 +28,6 @@ class AWSLexProvider {
|
|
|
27
28
|
case DialogState.FAILED:
|
|
28
29
|
callback(new Error('Bot conversation failed'));
|
|
29
30
|
break;
|
|
30
|
-
default:
|
|
31
|
-
break;
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
33
|
async sendMessage(botConfig, message) {
|
|
@@ -113,4 +112,7 @@ class AWSLexProvider {
|
|
|
113
112
|
this._botsCompleteCallback[name] = callback;
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
|
-
|
|
115
|
+
const lexProvider = new AWSLexProvider();
|
|
116
|
+
|
|
117
|
+
export { lexProvider };
|
|
118
|
+
//# sourceMappingURL=AWSLexProvider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AWSLexProvider.mjs","sources":["../../../src/lex-v1/AWSLexProvider.ts"],"sourcesContent":["import { DialogState, LexRuntimeServiceClient, PostContentCommand, PostTextCommand, } from '@aws-sdk/client-lex-runtime-service';\nimport { getAmplifyUserAgentObject } from '@aws-amplify/core/internals/utils';\nimport { ConsoleLogger, fetchAuthSession } from '@aws-amplify/core';\nimport { convert } from '../utils';\nconst logger = new ConsoleLogger('AWSLexProvider');\nclass AWSLexProvider {\n constructor() {\n this._botsCompleteCallback = {};\n }\n /**\n * @deprecated\n * This is used internally by 'sendMessage' to call onComplete callback\n * for a bot if configured\n */\n reportBotStatus(data, { name }) {\n const callback = this._botsCompleteCallback[name];\n if (!callback) {\n return;\n }\n // Check if state is fulfilled to resolve onFullfilment promise\n logger.debug('postContent state', data.dialogState);\n switch (data.dialogState) {\n case DialogState.READY_FOR_FULFILLMENT:\n case DialogState.FULFILLED:\n callback(undefined, data);\n break;\n case DialogState.FAILED:\n callback(new Error('Bot conversation failed'));\n break;\n default:\n break;\n }\n }\n async sendMessage(botConfig, message) {\n // check if credentials are present\n let session;\n try {\n session = await fetchAuthSession();\n }\n catch (error) {\n return Promise.reject('No credentials');\n }\n const { name, region, alias } = botConfig;\n const client = new LexRuntimeServiceClient({\n region,\n credentials: session.credentials,\n customUserAgent: getAmplifyUserAgentObject(),\n });\n let params;\n if (typeof message === 'string') {\n params = {\n botAlias: alias,\n botName: name,\n inputText: message,\n userId: session.identityId,\n };\n logger.debug('postText to lex', message);\n try {\n const postTextCommand = new PostTextCommand(params);\n const data = await client.send(postTextCommand);\n this.reportBotStatus(data, botConfig);\n return data;\n }\n catch (err) {\n return Promise.reject(err);\n }\n }\n else {\n const { content, options: { messageType }, } = message;\n if (messageType === 'voice') {\n if (typeof content !== 'object') {\n return Promise.reject('invalid content type');\n }\n const inputStream = content instanceof Uint8Array ? content : await convert(content);\n params = {\n botAlias: alias,\n botName: name,\n contentType: 'audio/x-l16; sample-rate=16000; channel-count=1',\n userId: session.identityId,\n accept: 'audio/mpeg',\n inputStream,\n };\n }\n else {\n if (typeof content !== 'string')\n return Promise.reject('invalid content type');\n params = {\n botAlias: alias,\n botName: name,\n contentType: 'text/plain; charset=utf-8',\n inputStream: content,\n userId: session.identityId,\n accept: 'audio/mpeg',\n };\n }\n logger.debug('postContent to lex', message);\n try {\n const postContentCommand = new PostContentCommand(params);\n const data = await client.send(postContentCommand);\n const audioArray = data.audioStream\n ? await convert(data.audioStream)\n : undefined;\n const response = { ...data, ...{ audioStream: audioArray } };\n this.reportBotStatus(response, botConfig);\n return response;\n }\n catch (err) {\n return Promise.reject(err);\n }\n }\n }\n onComplete({ name }, callback) {\n this._botsCompleteCallback[name] = callback;\n }\n}\nexport const lexProvider = new AWSLexProvider();\n"],"names":[],"mappings":";;;;;AAIA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,gBAAgB,CAAC,CAAC;AACnD,MAAM,cAAc,CAAC;AACrB,IAAI,WAAW,GAAG;AAClB,QAAQ,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC;AACxC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,IAAI,eAAe,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE;AACpC,QAAQ,MAAM,QAAQ,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;AAC1D,QAAQ,IAAI,CAAC,QAAQ,EAAE;AACvB,YAAY,OAAO;AACnB,SAAS;AACT;AACA,QAAQ,MAAM,CAAC,KAAK,CAAC,mBAAmB,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;AAC5D,QAAQ,QAAQ,IAAI,CAAC,WAAW;AAChC,YAAY,KAAK,WAAW,CAAC,qBAAqB,CAAC;AACnD,YAAY,KAAK,WAAW,CAAC,SAAS;AACtC,gBAAgB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC1C,gBAAgB,MAAM;AACtB,YAAY,KAAK,WAAW,CAAC,MAAM;AACnC,gBAAgB,QAAQ,CAAC,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC,CAAC;AAC/D,gBAAgB,MAAM;AAGtB,SAAS;AACT,KAAK;AACL,IAAI,MAAM,WA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AI,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;AACnE,gBAAgB,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW;AACnD,sBAAsB,MAAM,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;AACrD,sBAAsB,SAAS,CAAC;AAChC,gBAAgB,MAAM,QAAQ,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,CAAC;AAC7E,gBAAgB,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC1D,gBAAgB,OAAO,QAAQ,CAAC;AAChC,aAAa;AACb,YAAY,OAAO,GAAG,EAAE;AACxB,gBAAgB,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC3C,aAAa;AACb,SAAS;AACT,KAAK;AACL,IAAI,UAAU,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE;AACnC,QAAQ,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;AACpD,KAAK;AACL,CAAC;AACW,MAAC,WAAW,GAAG,IAAI,cAAc;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { resolveBotConfig } from '../utils/resolveBotConfig.mjs';
|
|
2
|
+
import { lexProvider } from '../AWSLexProvider.mjs';
|
|
3
|
+
import { assertValidationError } from '../../errors/assertValidationError.mjs';
|
|
4
|
+
import { InteractionsValidationErrorCode } from '../../errors/validation.mjs';
|
|
5
|
+
|
|
6
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
7
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
const onComplete = (input) => {
|
|
9
|
+
const { botName, callback } = input;
|
|
10
|
+
const botConfig = resolveBotConfig(botName);
|
|
11
|
+
assertValidationError(!!botConfig, InteractionsValidationErrorCode.NoBotConfig, `Bot ${botName} does not exist.`);
|
|
12
|
+
lexProvider.onComplete(botConfig, callback);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { onComplete };
|
|
16
|
+
//# sourceMappingURL=onComplete.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onComplete.mjs","sources":["../../../../src/lex-v1/apis/onComplete.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { resolveBotConfig } from '../utils';\nimport { lexProvider } from '../AWSLexProvider';\nimport { assertValidationError, InteractionsValidationErrorCode, } from '../../errors';\nexport const onComplete = (input) => {\n const { botName, callback } = input;\n const botConfig = resolveBotConfig(botName);\n assertValidationError(!!botConfig, InteractionsValidationErrorCode.NoBotConfig, `Bot ${botName} does not exist.`);\n lexProvider.onComplete(botConfig, callback);\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAIY,MAAC,UAAU,GAAG,CAAC,KAAK,KAAK;AACrC,IAAI,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;AACxC,IAAI,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAChD,IAAI,qBAAqB,CAAC,CAAC,CAAC,SAAS,EAAE,+BAA+B,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACtH,IAAI,WAAW,CAAC,UAAU,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAChD;;;;"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import { resolveBotConfig } from '../utils/resolveBotConfig.mjs';
|
|
2
|
+
import { lexProvider } from '../AWSLexProvider.mjs';
|
|
3
|
+
import { assertValidationError } from '../../errors/assertValidationError.mjs';
|
|
4
|
+
import { InteractionsValidationErrorCode } from '../../errors/validation.mjs';
|
|
5
|
+
|
|
1
6
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
7
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { resolveBotConfig } from '../utils';
|
|
5
|
-
import { assertValidationError, InteractionsValidationErrorCode, } from '../../errors';
|
|
6
|
-
export const send = async (input) => {
|
|
8
|
+
const send = async (input) => {
|
|
7
9
|
const { botName, message } = input;
|
|
8
10
|
const botConfig = resolveBotConfig(botName);
|
|
9
11
|
assertValidationError(!!botConfig, InteractionsValidationErrorCode.NoBotConfig, `Bot ${botName} does not exist.`);
|
|
10
12
|
return lexProvider.sendMessage(botConfig, message);
|
|
11
13
|
};
|
|
14
|
+
|
|
15
|
+
export { send };
|
|
16
|
+
//# sourceMappingURL=send.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send.mjs","sources":["../../../../src/lex-v1/apis/send.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { resolveBotConfig } from '../utils';\nimport { lexProvider } from '../AWSLexProvider';\nimport { assertValidationError, InteractionsValidationErrorCode, } from '../../errors';\nexport const send = async (input) => {\n const { botName, message } = input;\n const botConfig = resolveBotConfig(botName);\n assertValidationError(!!botConfig, InteractionsValidationErrorCode.NoBotConfig, `Bot ${botName} does not exist.`);\n return lexProvider.sendMessage(botConfig, message);\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAIY,MAAC,IAAI,GAAG,OAAO,KAAK,KAAK;AACrC,IAAI,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;AACvC,IAAI,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAChD,IAAI,qBAAqB,CAAC,CAAC,CAAC,SAAS,EAAE,+BAA+B,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACtH,IAAI,OAAO,WAAW,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACvD;;;;"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
import { send } from './apis/send.mjs';
|
|
2
|
+
import { onComplete } from './apis/onComplete.mjs';
|
|
3
|
+
|
|
1
4
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
5
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { send, onComplete } from './apis';
|
|
4
6
|
/**
|
|
5
7
|
* @deprecated recommend to migrate to AWS Lex V2 instead
|
|
6
8
|
* */
|
|
7
|
-
|
|
9
|
+
const Interactions = {
|
|
8
10
|
send,
|
|
9
11
|
onComplete,
|
|
10
12
|
};
|
|
13
|
+
|
|
14
|
+
export { Interactions };
|
|
15
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/lex-v1/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { send, onComplete } from './apis';\n/**\n * @deprecated recommend to migrate to AWS Lex V2 instead\n * */\nexport const Interactions = {\n send,\n onComplete,\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAEA;AACA;AACA;AACY,MAAC,YAAY,GAAG;AAC5B,IAAI,IAAI;AACR,IAAI,UAAU;AACd;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AWSLexProviderOption.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputs.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outputs.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/{lib-esm/lex-v1/utils/resolveBotConfig.js → dist/esm/lex-v1/utils/resolveBotConfig.mjs}
RENAMED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { Amplify } from '@aws-amplify/core';
|
|
2
|
+
|
|
1
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
export const resolveBotConfig = (botName) => {
|
|
5
|
+
const resolveBotConfig = (botName) => {
|
|
5
6
|
const { [botName]: botConfig = undefined } = Amplify.getConfig().Interactions?.LexV1 ?? {};
|
|
6
7
|
if (botConfig !== undefined) {
|
|
7
8
|
return { ...botConfig, name: botName };
|
|
8
9
|
}
|
|
9
10
|
};
|
|
11
|
+
|
|
12
|
+
export { resolveBotConfig };
|
|
13
|
+
//# sourceMappingURL=resolveBotConfig.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveBotConfig.mjs","sources":["../../../../src/lex-v1/utils/resolveBotConfig.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify } from '@aws-amplify/core';\nexport const resolveBotConfig = (botName) => {\n const { [botName]: botConfig = undefined } = Amplify.getConfig().Interactions?.LexV1 ?? {};\n if (botConfig !== undefined) {\n return { ...botConfig, name: botName };\n }\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEY,MAAC,gBAAgB,GAAG,CAAC,OAAO,KAAK;AAC7C,IAAI,MAAM,EAAE,CAAC,OAAO,GAAG,SAAS,GAAG,SAAS,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE,CAAC;AAC/F,IAAI,IAAI,SAAS,KAAK,SAAS,EAAE;AACjC,QAAQ,OAAO,EAAE,GAAG,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC/C,KAAK;AACL;;;;"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LexRuntimeV2Client, IntentState, RecognizeTextCommand, RecognizeUtteranceCommand } from '@aws-sdk/client-lex-runtime-v2';
|
|
2
2
|
import { getAmplifyUserAgentObject } from '@aws-amplify/core/internals/utils';
|
|
3
3
|
import { ConsoleLogger, fetchAuthSession } from '@aws-amplify/core';
|
|
4
|
-
import { convert
|
|
5
|
-
import {
|
|
4
|
+
import { convert } from '../utils/utils.mjs';
|
|
5
|
+
import { unGzipBase64AsJson } from '../utils/commonUtils.mjs';
|
|
6
|
+
import { v4 } from 'uuid';
|
|
7
|
+
|
|
6
8
|
const logger = new ConsoleLogger('AWSLexV2Provider');
|
|
7
9
|
class AWSLexV2Provider {
|
|
8
10
|
constructor() {
|
|
9
11
|
this._botsCompleteCallback = {};
|
|
10
|
-
this.defaultSessionId =
|
|
12
|
+
this.defaultSessionId = v4();
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
15
|
* Send a message to a bot
|
|
@@ -75,8 +77,6 @@ class AWSLexV2Provider {
|
|
|
75
77
|
case IntentState.FAILED:
|
|
76
78
|
callback(new Error('Bot conversation failed'));
|
|
77
79
|
break;
|
|
78
|
-
default:
|
|
79
|
-
break;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
@@ -160,4 +160,7 @@ class AWSLexV2Provider {
|
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
|
|
163
|
+
const lexProvider = new AWSLexV2Provider();
|
|
164
|
+
|
|
165
|
+
export { lexProvider };
|
|
166
|
+
//# sourceMappingURL=AWSLexV2Provider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AWSLexV2Provider.mjs","sources":["../../../src/lex-v2/AWSLexV2Provider.ts"],"sourcesContent":["import { IntentState, LexRuntimeV2Client, RecognizeTextCommand, RecognizeUtteranceCommand, } from '@aws-sdk/client-lex-runtime-v2';\nimport { getAmplifyUserAgentObject } from '@aws-amplify/core/internals/utils';\nimport { ConsoleLogger, fetchAuthSession } from '@aws-amplify/core';\nimport { convert, unGzipBase64AsJson } from '../utils';\nimport { v4 as uuid } from 'uuid';\nconst logger = new ConsoleLogger('AWSLexV2Provider');\nclass AWSLexV2Provider {\n constructor() {\n this._botsCompleteCallback = {};\n this.defaultSessionId = uuid();\n }\n /**\n * Send a message to a bot\n * @async\n * @param {AWSLexV2ProviderOption} botConfig - Bot configuration for sending the message\n * @param {string | InteractionsMessage} message - message to send to the bot\n * @return {Promise<InteractionsResponse>} A promise resolves to the response from the bot\n */\n async sendMessage(botConfig, message) {\n // check if credentials are present\n let session;\n try {\n session = await fetchAuthSession();\n }\n catch (error) {\n return Promise.reject('No credentials');\n }\n const { region, aliasId, localeId, botId } = botConfig;\n const client = new LexRuntimeV2Client({\n region,\n credentials: session.credentials,\n customUserAgent: getAmplifyUserAgentObject(),\n });\n let response;\n // common base params for all requests\n const reqBaseParams = {\n botAliasId: aliasId,\n botId,\n localeId,\n sessionId: session.identityId ?? this.defaultSessionId,\n };\n if (typeof message === 'string') {\n response = await this._handleRecognizeTextCommand(botConfig, message, reqBaseParams, client);\n }\n else {\n response = await this._handleRecognizeUtteranceCommand(botConfig, message, reqBaseParams, client);\n }\n return response;\n }\n /**\n * Attach a onComplete callback function to a bot.\n * The callback is called once the bot's intent is fulfilled\n * @param {AWSLexV2ProviderOption} botConfig - Bot configuration to attach the onComplete callback\n * @param {InteractionsOnCompleteCallback} callback - called when Intent Fulfilled\n */\n onComplete({ name }, callback) {\n this._botsCompleteCallback[name] = callback;\n }\n /**\n * call onComplete callback for a bot if configured\n */\n _reportBotStatus(data, { name }) {\n const sessionState = data?.sessionState;\n // Check if state is fulfilled to resolve onFullfilment promise\n logger.debug('postContent state', sessionState?.intent?.state);\n const callback = this._botsCompleteCallback[name];\n if (!callback) {\n return;\n }\n switch (sessionState?.intent?.state) {\n case IntentState.READY_FOR_FULFILLMENT:\n case IntentState.FULFILLED:\n callback(undefined, data);\n break;\n case IntentState.FAILED:\n callback(new Error('Bot conversation failed'));\n break;\n default:\n break;\n }\n }\n /**\n * Format UtteranceCommandOutput's response\n * decompress attributes\n * update audioStream format\n */\n async _formatUtteranceCommandOutput(data) {\n return {\n ...data,\n messages: await unGzipBase64AsJson(data.messages),\n sessionState: await unGzipBase64AsJson(data.sessionState),\n interpretations: await unGzipBase64AsJson(data.interpretations),\n requestAttributes: await unGzipBase64AsJson(data.requestAttributes),\n inputTranscript: await unGzipBase64AsJson(data.inputTranscript),\n audioStream: data.audioStream\n ? await convert(data.audioStream)\n : undefined,\n };\n }\n /**\n * handle client's `RecognizeTextCommand`\n * used for sending simple text message\n */\n async _handleRecognizeTextCommand(botConfig, data, baseParams, client) {\n logger.debug('postText to lex2', data);\n const params = {\n ...baseParams,\n text: data,\n };\n try {\n const recognizeTextCommand = new RecognizeTextCommand(params);\n const data = await client.send(recognizeTextCommand);\n this._reportBotStatus(data, botConfig);\n return data;\n }\n catch (err) {\n return Promise.reject(err);\n }\n }\n /**\n * handle client's `RecognizeUtteranceCommand`\n * used for obj text or obj voice message\n */\n async _handleRecognizeUtteranceCommand(botConfig, data, baseParams, client) {\n const { content, options: { messageType }, } = data;\n logger.debug('postContent to lex2', data);\n let params;\n // prepare params\n if (messageType === 'voice') {\n if (typeof content !== 'object') {\n return Promise.reject('invalid content type');\n }\n const inputStream = content instanceof Uint8Array ? content : await convert(content);\n params = {\n ...baseParams,\n requestContentType: 'audio/x-l16; sample-rate=16000; channel-count=1',\n inputStream,\n };\n }\n else {\n // text input\n if (typeof content !== 'string')\n return Promise.reject('invalid content type');\n params = {\n ...baseParams,\n requestContentType: 'text/plain; charset=utf-8',\n inputStream: content,\n };\n }\n // make API call to lex\n try {\n const recognizeUtteranceCommand = new RecognizeUtteranceCommand(params);\n const data = await client.send(recognizeUtteranceCommand);\n const response = await this._formatUtteranceCommandOutput(data);\n this._reportBotStatus(response, botConfig);\n return response;\n }\n catch (err) {\n return Promise.reject(err);\n }\n }\n}\nexport const lexProvider = new AWSLexV2Provider();\n"],"names":["uuid"],"mappings":";;;;;;;AAKA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,kBAAkB,CAAC,CAAC;AACrD,MAAM,gBAAgB,CAAC;AACvB,IAAI,WAAW,GAAG;AAClB,QAAQ,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC;AACxC,QAAQ,IAAI,CAAC,gBAAgB,GAAGA,EAAI,EAAE,CAAC;AACvC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,WAAW,CAAC,SAAS,EAAE,OAAO,EAAE;AAC1C;AACA,QAAQ,IAAI,OAAO,CAAC;AACpB,QAAQ,IAAI;AACZ,YAAY,OAAO,GAAG,MAAM,gBAAgB,EAAE,CAAC;AAC/C,SAAS;AACT,QAAQ,OAAO,KAAK,EAAE;AACtB,YAAY,OAAO,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACpD,SAAS;AACT,QAAQ,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;AAC/D,QAAQ,MAAM,MAAM,GAAG,IAAI,kBAAkB,CAAC;AAC9C,YAAY,MAAM;AAClB,YAAY,WAAW,EAAE,OAAO,CAAC,WAAW;AAC5C,YAAY,eAAe,EAAE,yBAAyB,EAAE;AACxD,SAAS,CAAC,CAAC;AACX,QAAQ,IAAI,QAAQ,CAAC;AACrB;AACA,QAAQ,MAAM,aAAa,GAAG;AAC9B,YAAY,UAAU,EAAE,OAAO;AAC/B,YAAY,KAAK;AACjB,YAAY,QAAQ;AACpB,YAAY,SAAS,EAAE,OAAO,CAA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AM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AACtE,YAAY,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,CAAC;AAC5E,YAAY,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AACvD,YAAY,OAAO,QAAQ,CAAC;AAC5B,SAAS;AACT,QAAQ,OAAO,GAAG,EAAE;AACpB,YAAY,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACvC,SAAS;AACT,KAAK;AACL,CAAC;AACW,MAAC,WAAW,GAAG,IAAI,gBAAgB;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { resolveBotConfig } from '../utils/resolveBotConfig.mjs';
|
|
2
|
+
import { lexProvider } from '../AWSLexV2Provider.mjs';
|
|
3
|
+
import { assertValidationError } from '../../errors/assertValidationError.mjs';
|
|
4
|
+
import { InteractionsValidationErrorCode } from '../../errors/validation.mjs';
|
|
5
|
+
|
|
6
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
7
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
const onComplete = (input) => {
|
|
9
|
+
const { botName, callback } = input;
|
|
10
|
+
const botConfig = resolveBotConfig(botName);
|
|
11
|
+
assertValidationError(!!botConfig, InteractionsValidationErrorCode.NoBotConfig, `Bot ${botName} does not exist.`);
|
|
12
|
+
lexProvider.onComplete(botConfig, callback);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { onComplete };
|
|
16
|
+
//# sourceMappingURL=onComplete.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onComplete.mjs","sources":["../../../../src/lex-v2/apis/onComplete.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { resolveBotConfig } from '../utils';\nimport { lexProvider } from '../AWSLexV2Provider';\nimport { assertValidationError, InteractionsValidationErrorCode, } from '../../errors';\nexport const onComplete = (input) => {\n const { botName, callback } = input;\n const botConfig = resolveBotConfig(botName);\n assertValidationError(!!botConfig, InteractionsValidationErrorCode.NoBotConfig, `Bot ${botName} does not exist.`);\n lexProvider.onComplete(botConfig, callback);\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAIY,MAAC,UAAU,GAAG,CAAC,KAAK,KAAK;AACrC,IAAI,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;AACxC,IAAI,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAChD,IAAI,qBAAqB,CAAC,CAAC,CAAC,SAAS,EAAE,+BAA+B,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACtH,IAAI,WAAW,CAAC,UAAU,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAChD;;;;"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import { lexProvider } from '../AWSLexV2Provider.mjs';
|
|
2
|
+
import { resolveBotConfig } from '../utils/resolveBotConfig.mjs';
|
|
3
|
+
import { assertValidationError } from '../../errors/assertValidationError.mjs';
|
|
4
|
+
import { InteractionsValidationErrorCode } from '../../errors/validation.mjs';
|
|
5
|
+
|
|
1
6
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
7
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { lexProvider } from '../AWSLexProvider';
|
|
5
|
-
import { assertValidationError, InteractionsValidationErrorCode, } from '../../errors';
|
|
6
|
-
export const send = async (input) => {
|
|
8
|
+
const send = async (input) => {
|
|
7
9
|
const { botName, message } = input;
|
|
8
10
|
const botConfig = resolveBotConfig(botName);
|
|
9
11
|
assertValidationError(!!botConfig, InteractionsValidationErrorCode.NoBotConfig, `Bot ${botName} does not exist.`);
|
|
10
12
|
return lexProvider.sendMessage(botConfig, message);
|
|
11
13
|
};
|
|
14
|
+
|
|
15
|
+
export { send };
|
|
16
|
+
//# sourceMappingURL=send.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send.mjs","sources":["../../../../src/lex-v2/apis/send.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { lexProvider } from '../AWSLexV2Provider';\nimport { resolveBotConfig } from '../utils';\nimport { assertValidationError, InteractionsValidationErrorCode, } from '../../errors';\nexport const send = async (input) => {\n const { botName, message } = input;\n const botConfig = resolveBotConfig(botName);\n assertValidationError(!!botConfig, InteractionsValidationErrorCode.NoBotConfig, `Bot ${botName} does not exist.`);\n return lexProvider.sendMessage(botConfig, message);\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAIY,MAAC,IAAI,GAAG,OAAO,KAAK,KAAK;AACrC,IAAI,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;AACvC,IAAI,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAChD,IAAI,qBAAqB,CAAC,CAAC,CAAC,SAAS,EAAE,+BAA+B,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACtH,IAAI,OAAO,WAAW,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACvD;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { send } from './apis/send.mjs';
|
|
2
|
+
import { onComplete } from './apis/onComplete.mjs';
|
|
3
|
+
|
|
4
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
const Interactions = {
|
|
7
|
+
send,
|
|
8
|
+
onComplete,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { Interactions };
|
|
12
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/lex-v2/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { send, onComplete } from './apis';\nexport const Interactions = {\n send,\n onComplete,\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAEY,MAAC,YAAY,GAAG;AAC5B,IAAI,IAAI;AACR,IAAI,UAAU;AACd;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AWSLexV2ProviderOption.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputs.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outputs.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/{lib-esm/lex-v2/utils/resolveBotConfig.js → dist/esm/lex-v2/utils/resolveBotConfig.mjs}
RENAMED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { Amplify } from '@aws-amplify/core';
|
|
2
|
+
|
|
1
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
export const resolveBotConfig = (botName) => {
|
|
5
|
+
const resolveBotConfig = (botName) => {
|
|
5
6
|
const { [botName]: botConfig = undefined } = Amplify.getConfig().Interactions?.LexV2 ?? {};
|
|
6
7
|
if (botConfig !== undefined) {
|
|
7
8
|
return { ...botConfig, name: botName };
|
|
8
9
|
}
|
|
9
10
|
};
|
|
11
|
+
|
|
12
|
+
export { resolveBotConfig };
|
|
13
|
+
//# sourceMappingURL=resolveBotConfig.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveBotConfig.mjs","sources":["../../../../src/lex-v2/utils/resolveBotConfig.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify } from '@aws-amplify/core';\nexport const resolveBotConfig = (botName) => {\n const { [botName]: botConfig = undefined } = Amplify.getConfig().Interactions?.LexV2 ?? {};\n if (botConfig !== undefined) {\n return { ...botConfig, name: botName };\n }\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEY,MAAC,gBAAgB,GAAG,CAAC,OAAO,KAAK;AAC7C,IAAI,MAAM,EAAE,CAAC,OAAO,GAAG,SAAS,GAAG,SAAS,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE,CAAC;AAC/F,IAAI,IAAI,SAAS,KAAK,SAAS,EAAE;AACjC,QAAQ,OAAO,EAAE,GAAG,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC/C,KAAK;AACL;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Interactions.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputs.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outputs.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { base64ToArrayBuffer, gzipDecompressToString } from './utils.mjs';
|
|
2
|
+
|
|
1
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
export const unGzipBase64AsJson = async (gzipBase64) => {
|
|
5
|
+
const unGzipBase64AsJson = async (gzipBase64) => {
|
|
5
6
|
if (typeof gzipBase64 === 'undefined')
|
|
6
7
|
return undefined;
|
|
7
8
|
try {
|
|
@@ -13,3 +14,6 @@ export const unGzipBase64AsJson = async (gzipBase64) => {
|
|
|
13
14
|
return Promise.reject('unable to decode and decompress ' + error);
|
|
14
15
|
}
|
|
15
16
|
};
|
|
17
|
+
|
|
18
|
+
export { unGzipBase64AsJson };
|
|
19
|
+
//# sourceMappingURL=commonUtils.mjs.map
|