@aws-amplify/interactions 4.0.51 → 4.1.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/CHANGELOG.md +18 -0
- package/dist/aws-amplify-interactions.js +23054 -6091
- package/dist/aws-amplify-interactions.js.map +1 -1
- package/dist/aws-amplify-interactions.min.js +4 -4
- package/dist/aws-amplify-interactions.min.js.map +1 -1
- package/lib/Providers/AWSLexProvider.d.ts +12 -1
- package/lib/Providers/AWSLexProvider.js +48 -36
- package/lib/Providers/AWSLexProvider.js.map +1 -1
- package/lib/Providers/AWSLexProviderHelper/commonUtils.d.ts +1 -0
- package/lib/Providers/AWSLexProviderHelper/{convert.native.js → commonUtils.js} +36 -18
- package/lib/Providers/AWSLexProviderHelper/commonUtils.js.map +1 -0
- package/lib/Providers/AWSLexProviderHelper/utils.d.ts +3 -0
- package/lib/Providers/AWSLexProviderHelper/utils.js +83 -0
- package/lib/Providers/AWSLexProviderHelper/utils.js.map +1 -0
- package/lib/Providers/AWSLexProviderHelper/utils.native.d.ts +3 -0
- package/lib/Providers/AWSLexProviderHelper/utils.native.js +100 -0
- package/lib/Providers/AWSLexProviderHelper/utils.native.js.map +1 -0
- package/lib/Providers/AWSLexV2Provider.d.ts +58 -0
- package/lib/Providers/AWSLexV2Provider.js +351 -0
- package/lib/Providers/AWSLexV2Provider.js.map +1 -0
- package/lib/Providers/index.d.ts +1 -0
- package/lib/Providers/index.js +1 -0
- package/lib/Providers/index.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/Providers/AWSLexV2Provider.d.ts +12 -0
- package/lib/types/Providers/AWSLexV2Provider.js +3 -0
- package/lib/types/Providers/AWSLexV2Provider.js.map +1 -0
- package/lib/types/index.d.ts +1 -0
- package/lib-esm/Providers/AWSLexProvider.d.ts +12 -1
- package/lib-esm/Providers/AWSLexProvider.js +47 -35
- package/lib-esm/Providers/AWSLexProvider.js.map +1 -1
- package/lib-esm/Providers/AWSLexProviderHelper/commonUtils.d.ts +1 -0
- package/lib-esm/Providers/AWSLexProviderHelper/{convert.native.js → commonUtils.js} +36 -18
- package/lib-esm/Providers/AWSLexProviderHelper/commonUtils.js.map +1 -0
- package/lib-esm/Providers/AWSLexProviderHelper/utils.d.ts +3 -0
- package/lib-esm/Providers/AWSLexProviderHelper/utils.js +81 -0
- package/lib-esm/Providers/AWSLexProviderHelper/utils.js.map +1 -0
- package/lib-esm/Providers/AWSLexProviderHelper/utils.native.d.ts +3 -0
- package/lib-esm/Providers/AWSLexProviderHelper/utils.native.js +98 -0
- package/lib-esm/Providers/AWSLexProviderHelper/utils.native.js.map +1 -0
- package/lib-esm/Providers/AWSLexV2Provider.d.ts +58 -0
- package/lib-esm/Providers/AWSLexV2Provider.js +349 -0
- package/lib-esm/Providers/AWSLexV2Provider.js.map +1 -0
- package/lib-esm/Providers/index.d.ts +1 -0
- package/lib-esm/Providers/index.js +1 -0
- package/lib-esm/Providers/index.js.map +1 -1
- package/lib-esm/index.d.ts +1 -0
- package/lib-esm/index.js +1 -0
- package/lib-esm/index.js.map +1 -1
- package/lib-esm/types/Providers/AWSLexV2Provider.d.ts +12 -0
- package/lib-esm/types/Providers/AWSLexV2Provider.js +1 -0
- package/lib-esm/types/Providers/AWSLexV2Provider.js.map +1 -0
- package/lib-esm/types/index.d.ts +1 -0
- package/package.json +8 -4
- package/src/Providers/AWSLexProvider.ts +28 -18
- package/src/Providers/AWSLexProviderHelper/commonUtils.ts +27 -0
- package/src/Providers/AWSLexProviderHelper/utils.native.ts +56 -0
- package/src/Providers/AWSLexProviderHelper/utils.ts +39 -0
- package/src/Providers/AWSLexV2Provider.ts +343 -0
- package/src/Providers/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/types/Providers/AWSLexProvider.ts +12 -0
- package/src/types/Providers/AWSLexV2Provider.ts +25 -0
- package/src/types/index.ts +1 -0
- package/lib/Providers/AWSLexProviderHelper/convert.d.ts +0 -3
- package/lib/Providers/AWSLexProviderHelper/convert.js +0 -13
- package/lib/Providers/AWSLexProviderHelper/convert.js.map +0 -1
- package/lib/Providers/AWSLexProviderHelper/convert.native.d.ts +0 -1
- package/lib/Providers/AWSLexProviderHelper/convert.native.js.map +0 -1
- package/lib-esm/Providers/AWSLexProviderHelper/convert.d.ts +0 -3
- package/lib-esm/Providers/AWSLexProviderHelper/convert.js +0 -11
- package/lib-esm/Providers/AWSLexProviderHelper/convert.js.map +0 -1
- package/lib-esm/Providers/AWSLexProviderHelper/convert.native.d.ts +0 -1
- package/lib-esm/Providers/AWSLexProviderHelper/convert.native.js.map +0 -1
- package/src/Providers/AWSLexProviderHelper/convert.native.ts +0 -13
- package/src/Providers/AWSLexProviderHelper/convert.ts +0 -12
|
@@ -34,21 +34,39 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
34
34
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
37
|
+
/*
|
|
38
|
+
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
39
|
+
*
|
|
40
|
+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
41
|
+
* the License. A copy of the License is located at
|
|
42
|
+
*
|
|
43
|
+
* http://aws.amazon.com/apache2.0/
|
|
44
|
+
*
|
|
45
|
+
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
46
|
+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
47
|
+
* and limitations under the License.
|
|
48
|
+
*/
|
|
49
|
+
import { base64ToArrayBuffer, gzipDecompressToString } from './utils';
|
|
50
|
+
export var unGzipBase64AsJson = function (gzipBase64) { return __awaiter(void 0, void 0, void 0, function () {
|
|
51
|
+
var decodedArrayBuffer, objString, error_1;
|
|
52
|
+
return __generator(this, function (_a) {
|
|
53
|
+
switch (_a.label) {
|
|
54
|
+
case 0:
|
|
55
|
+
if (typeof gzipBase64 === 'undefined')
|
|
56
|
+
return [2 /*return*/, undefined];
|
|
57
|
+
_a.label = 1;
|
|
58
|
+
case 1:
|
|
59
|
+
_a.trys.push([1, 3, , 4]);
|
|
60
|
+
decodedArrayBuffer = base64ToArrayBuffer(gzipBase64);
|
|
61
|
+
return [4 /*yield*/, gzipDecompressToString(decodedArrayBuffer)];
|
|
62
|
+
case 2:
|
|
63
|
+
objString = _a.sent();
|
|
64
|
+
return [2 /*return*/, JSON.parse(objString)];
|
|
65
|
+
case 3:
|
|
66
|
+
error_1 = _a.sent();
|
|
67
|
+
return [2 /*return*/, Promise.reject('unable to decode and decompress ' + error_1)];
|
|
68
|
+
case 4: return [2 /*return*/];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}); };
|
|
72
|
+
//# sourceMappingURL=commonUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonUtils.js","sourceRoot":"","sources":["../../../src/Providers/AWSLexProviderHelper/commonUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtE,MAAM,CAAC,IAAM,kBAAkB,GAAG,UAAO,UAA8B;;;;;gBACtE,IAAI,OAAO,UAAU,KAAK,WAAW;oBAAE,sBAAO,SAAS,EAAC;;;;gBAGjD,kBAAkB,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;gBAEjC,qBAAM,sBAAsB,CAAC,kBAAkB,CAAC,EAAA;;gBAApE,SAAS,GAAW,SAAgD;gBAE1E,sBAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAC;;;gBAE7B,sBAAO,OAAO,CAAC,MAAM,CAAC,kCAAkC,GAAG,OAAK,CAAC,EAAC;;;;KAEnE,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
5
|
+
* the License. A copy of the License is located at
|
|
6
|
+
*
|
|
7
|
+
* http://aws.amazon.com/apache2.0/
|
|
8
|
+
*
|
|
9
|
+
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
10
|
+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
11
|
+
* and limitations under the License.
|
|
12
|
+
*/
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
import { gunzip, strFromU8 } from 'fflate';
|
|
50
|
+
export var convert = function (stream) { return __awaiter(void 0, void 0, void 0, function () {
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
if (stream instanceof Blob || stream instanceof ReadableStream) {
|
|
53
|
+
return [2 /*return*/, new Response(stream)
|
|
54
|
+
.arrayBuffer()
|
|
55
|
+
.then(function (buffer) { return new Uint8Array(buffer); })];
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return [2 /*return*/, Promise.reject('Invalid content type')];
|
|
59
|
+
}
|
|
60
|
+
return [2 /*return*/];
|
|
61
|
+
});
|
|
62
|
+
}); };
|
|
63
|
+
export var base64ToArrayBuffer = function (base64) {
|
|
64
|
+
return Uint8Array.from(window.atob(base64), function (c) { return c.charCodeAt(0); });
|
|
65
|
+
};
|
|
66
|
+
export var gzipDecompressToString = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
67
|
+
return __generator(this, function (_a) {
|
|
68
|
+
switch (_a.label) {
|
|
69
|
+
case 0: return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
70
|
+
gunzip(data, function (err, resp) {
|
|
71
|
+
if (err)
|
|
72
|
+
reject(err);
|
|
73
|
+
else
|
|
74
|
+
resolve(strFromU8(resp));
|
|
75
|
+
});
|
|
76
|
+
})];
|
|
77
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}); };
|
|
81
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/Providers/AWSLexProviderHelper/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,CAAC,IAAM,OAAO,GAAG,UAAO,MAAc;;QAC3C,IAAI,MAAM,YAAY,IAAI,IAAI,MAAM,YAAY,cAAc,EAAE;YAC/D,sBAAO,IAAI,QAAQ,CAAC,MAAM,CAAC;qBACzB,WAAW,EAAE;qBACb,IAAI,CAAC,UAAA,MAAM,IAAI,OAAA,IAAI,UAAU,CAAC,MAAM,CAAC,EAAtB,CAAsB,CAAC,EAAC;SACzC;aAAM;YACN,sBAAO,OAAO,CAAC,MAAM,CAAC,sBAAsB,CAAC,EAAC;SAC9C;;;KACD,CAAC;AAEF,MAAM,CAAC,IAAM,mBAAmB,GAAG,UAAC,MAAc;IACjD,OAAO,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAf,CAAe,CAAC,CAAC;AACnE,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,sBAAsB,GAAG,UACrC,IAAgB;;;oBAET,qBAAM,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;oBACxC,MAAM,CAAC,IAAI,EAAE,UAAC,GAAG,EAAE,IAAI;wBACtB,IAAI,GAAG;4BAAE,MAAM,CAAC,GAAG,CAAC,CAAC;;4BAChB,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;oBAC/B,CAAC,CAAC,CAAC;gBACJ,CAAC,CAAC,EAAA;oBALF,sBAAO,SAKL,EAAC;;;KACH,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
5
|
+
* the License. A copy of the License is located at
|
|
6
|
+
*
|
|
7
|
+
* http://aws.amazon.com/apache2.0/
|
|
8
|
+
*
|
|
9
|
+
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
10
|
+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
11
|
+
* and limitations under the License.
|
|
12
|
+
*/
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
import { decode } from 'base-64';
|
|
50
|
+
import { ungzip } from 'pako';
|
|
51
|
+
export var convert = function (stream) { return __awaiter(void 0, void 0, void 0, function () {
|
|
52
|
+
return __generator(this, function (_a) {
|
|
53
|
+
if (!(stream instanceof Blob)) {
|
|
54
|
+
return [2 /*return*/, Promise.reject('Invalid content type')];
|
|
55
|
+
}
|
|
56
|
+
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
|
|
57
|
+
var fileReaderInstance_1;
|
|
58
|
+
return __generator(this, function (_a) {
|
|
59
|
+
try {
|
|
60
|
+
fileReaderInstance_1 = new FileReader();
|
|
61
|
+
fileReaderInstance_1.readAsDataURL(stream);
|
|
62
|
+
fileReaderInstance_1.onload = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
63
|
+
var blobURL, base64Blob, decodedArrayBuffer;
|
|
64
|
+
return __generator(this, function (_a) {
|
|
65
|
+
blobURL = fileReaderInstance_1.result;
|
|
66
|
+
base64Blob = blobURL.split(/,(.*)/s)[1];
|
|
67
|
+
decodedArrayBuffer = base64ToArrayBuffer(base64Blob);
|
|
68
|
+
resolve(decodedArrayBuffer);
|
|
69
|
+
return [2 /*return*/];
|
|
70
|
+
});
|
|
71
|
+
}); };
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
reject('unable to convert blob to arrayBuffer: ' + error);
|
|
75
|
+
}
|
|
76
|
+
return [2 /*return*/];
|
|
77
|
+
});
|
|
78
|
+
}); })];
|
|
79
|
+
});
|
|
80
|
+
}); };
|
|
81
|
+
export var base64ToArrayBuffer = function (base64) {
|
|
82
|
+
var binaryString = decode(base64);
|
|
83
|
+
return Uint8Array.from(binaryString, function (c) { return c.charCodeAt(0); });
|
|
84
|
+
};
|
|
85
|
+
export var gzipDecompressToString = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
86
|
+
return __generator(this, function (_a) {
|
|
87
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
88
|
+
try {
|
|
89
|
+
var result = ungzip(data, { to: 'string' });
|
|
90
|
+
resolve(result);
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
reject('unable to decompress' + error);
|
|
94
|
+
}
|
|
95
|
+
})];
|
|
96
|
+
});
|
|
97
|
+
}); };
|
|
98
|
+
//# sourceMappingURL=utils.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.native.js","sourceRoot":"","sources":["../../../src/Providers/AWSLexProviderHelper/utils.native.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,MAAM,CAAC,IAAM,OAAO,GAAG,UAAO,MAAc;;QAC3C,IAAI,CAAC,CAAC,MAAM,YAAY,IAAI,CAAC,EAAE;YAC9B,sBAAO,OAAO,CAAC,MAAM,CAAC,sBAAsB,CAAC,EAAC;SAC9C;QAED,sBAAO,IAAI,OAAO,CAAC,UAAO,OAAO,EAAE,MAAM;;;oBACxC,IAAI;wBACG,uBAAqB,IAAI,UAAU,EAAE,CAAC;wBAC5C,oBAAkB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;wBACzC,oBAAkB,CAAC,MAAM,GAAG;;;gCACrB,OAAO,GAAG,oBAAkB,CAAC,MAAgB,CAAC;gCAE9C,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;gCAExC,kBAAkB,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;gCAC3D,OAAO,CAAC,kBAAkB,CAAC,CAAC;;;6BAC5B,CAAC;qBACF;oBAAC,OAAO,KAAK,EAAE;wBACf,MAAM,CAAC,yCAAyC,GAAG,KAAK,CAAC,CAAC;qBAC1D;;;iBACD,CAAC,EAAC;;KACH,CAAC;AAEF,MAAM,CAAC,IAAM,mBAAmB,GAAG,UAAC,MAAc;IACjD,IAAM,YAAY,GAAW,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5C,OAAO,UAAU,CAAC,IAAI,CAAC,YAAY,EAAE,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAf,CAAe,CAAC,CAAC;AAC5D,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,sBAAsB,GAAG,UACrC,IAAgB;;QAEhB,sBAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;gBAClC,IAAI;oBACH,IAAM,MAAM,GAAW,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;oBACtD,OAAO,CAAC,MAAM,CAAC,CAAC;iBAChB;gBAAC,OAAO,KAAK,EAAE;oBACf,MAAM,CAAC,sBAAsB,GAAG,KAAK,CAAC,CAAC;iBACvC;YACF,CAAC,CAAC,EAAC;;KACH,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { AbstractInteractionsProvider } from './InteractionsProvider';
|
|
2
|
+
import { InteractionsOptions, AWSLexV2ProviderOptions, InteractionsResponse, InteractionsMessage } from '../types';
|
|
3
|
+
export declare class AWSLexV2Provider extends AbstractInteractionsProvider {
|
|
4
|
+
private _lexRuntimeServiceV2Client;
|
|
5
|
+
private _botsCompleteCallback;
|
|
6
|
+
/**
|
|
7
|
+
* Initialize Interactions with AWS configurations
|
|
8
|
+
* @param {InteractionsOptions} options - Configuration object for Interactions
|
|
9
|
+
*/
|
|
10
|
+
constructor(options?: InteractionsOptions);
|
|
11
|
+
/**
|
|
12
|
+
* get provider name of the plugin
|
|
13
|
+
* @returns {string} name of the provider
|
|
14
|
+
*/
|
|
15
|
+
getProviderName(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Configure Interactions part with aws configuration
|
|
18
|
+
* @param {AWSLexV2ProviderOptions} config - Configuration of the Interactions
|
|
19
|
+
* @return {AWSLexV2ProviderOptions} - Current configuration
|
|
20
|
+
*/
|
|
21
|
+
configure(config?: AWSLexV2ProviderOptions): AWSLexV2ProviderOptions;
|
|
22
|
+
/**
|
|
23
|
+
* Send a message to a bot
|
|
24
|
+
* @async
|
|
25
|
+
* @param {string} botname - Bot name to send the message
|
|
26
|
+
* @param {string | InteractionsMessage} message - message to send to the bot
|
|
27
|
+
* @return {Promise<InteractionsResponse>} A promise resolves to the response from the bot
|
|
28
|
+
*/
|
|
29
|
+
sendMessage(botname: string, message: string | InteractionsMessage): Promise<InteractionsResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* Attach a onComplete callback function to a bot.
|
|
32
|
+
* The callback is called once the bot's intent is fulfilled
|
|
33
|
+
* @param {string} botname - Bot name to attach the onComplete callback
|
|
34
|
+
* @param {(err: Error | null, confirmation: InteractionsResponse) => void} callback - called when Intent Fulfilled
|
|
35
|
+
*/
|
|
36
|
+
onComplete(botname: string, callback: (err: Error | null, confirmation: InteractionsResponse) => void): void;
|
|
37
|
+
/**
|
|
38
|
+
* @private
|
|
39
|
+
* call onComplete callback for a bot if configured
|
|
40
|
+
*/
|
|
41
|
+
private _reportBotStatus;
|
|
42
|
+
/**
|
|
43
|
+
* Format UtteranceCommandOutput's response
|
|
44
|
+
* decompress attributes
|
|
45
|
+
* update audioStream format
|
|
46
|
+
*/
|
|
47
|
+
private _formatUtteranceCommandOutput;
|
|
48
|
+
/**
|
|
49
|
+
* handle client's `RecognizeTextCommand`
|
|
50
|
+
* used for sending simple text message
|
|
51
|
+
*/
|
|
52
|
+
private _handleRecognizeTextCommand;
|
|
53
|
+
/**
|
|
54
|
+
* handle client's `RecognizeUtteranceCommand`
|
|
55
|
+
* used for obj text or obj voice message
|
|
56
|
+
*/
|
|
57
|
+
private _handleRecognizeUtteranceCommand;
|
|
58
|
+
}
|