@aws-sdk/client-translate 3.525.0 → 3.529.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/dist-cjs/index.js +21 -61
- package/dist-es/protocols/Aws_json1_1.js +1 -40
- package/package.json +4 -4
package/dist-cjs/index.js
CHANGED
|
@@ -236,6 +236,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
|
|
|
236
236
|
var import_types = require("@smithy/types");
|
|
237
237
|
|
|
238
238
|
// src/protocols/Aws_json1_1.ts
|
|
239
|
+
var import_core2 = require("@aws-sdk/core");
|
|
239
240
|
|
|
240
241
|
|
|
241
242
|
var import_uuid = require("uuid");
|
|
@@ -734,7 +735,7 @@ var de_CreateParallelDataCommand = /* @__PURE__ */ __name(async (output, context
|
|
|
734
735
|
if (output.statusCode >= 300) {
|
|
735
736
|
return de_CommandError(output, context);
|
|
736
737
|
}
|
|
737
|
-
const data = await
|
|
738
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
738
739
|
let contents = {};
|
|
739
740
|
contents = (0, import_smithy_client._json)(data);
|
|
740
741
|
const response = {
|
|
@@ -747,7 +748,7 @@ var de_DeleteParallelDataCommand = /* @__PURE__ */ __name(async (output, context
|
|
|
747
748
|
if (output.statusCode >= 300) {
|
|
748
749
|
return de_CommandError(output, context);
|
|
749
750
|
}
|
|
750
|
-
const data = await
|
|
751
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
751
752
|
let contents = {};
|
|
752
753
|
contents = (0, import_smithy_client._json)(data);
|
|
753
754
|
const response = {
|
|
@@ -770,7 +771,7 @@ var de_DescribeTextTranslationJobCommand = /* @__PURE__ */ __name(async (output,
|
|
|
770
771
|
if (output.statusCode >= 300) {
|
|
771
772
|
return de_CommandError(output, context);
|
|
772
773
|
}
|
|
773
|
-
const data = await
|
|
774
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
774
775
|
let contents = {};
|
|
775
776
|
contents = de_DescribeTextTranslationJobResponse(data, context);
|
|
776
777
|
const response = {
|
|
@@ -783,7 +784,7 @@ var de_GetParallelDataCommand = /* @__PURE__ */ __name(async (output, context) =
|
|
|
783
784
|
if (output.statusCode >= 300) {
|
|
784
785
|
return de_CommandError(output, context);
|
|
785
786
|
}
|
|
786
|
-
const data = await
|
|
787
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
787
788
|
let contents = {};
|
|
788
789
|
contents = de_GetParallelDataResponse(data, context);
|
|
789
790
|
const response = {
|
|
@@ -796,7 +797,7 @@ var de_GetTerminologyCommand = /* @__PURE__ */ __name(async (output, context) =>
|
|
|
796
797
|
if (output.statusCode >= 300) {
|
|
797
798
|
return de_CommandError(output, context);
|
|
798
799
|
}
|
|
799
|
-
const data = await
|
|
800
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
800
801
|
let contents = {};
|
|
801
802
|
contents = de_GetTerminologyResponse(data, context);
|
|
802
803
|
const response = {
|
|
@@ -809,7 +810,7 @@ var de_ImportTerminologyCommand = /* @__PURE__ */ __name(async (output, context)
|
|
|
809
810
|
if (output.statusCode >= 300) {
|
|
810
811
|
return de_CommandError(output, context);
|
|
811
812
|
}
|
|
812
|
-
const data = await
|
|
813
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
813
814
|
let contents = {};
|
|
814
815
|
contents = de_ImportTerminologyResponse(data, context);
|
|
815
816
|
const response = {
|
|
@@ -822,7 +823,7 @@ var de_ListLanguagesCommand = /* @__PURE__ */ __name(async (output, context) =>
|
|
|
822
823
|
if (output.statusCode >= 300) {
|
|
823
824
|
return de_CommandError(output, context);
|
|
824
825
|
}
|
|
825
|
-
const data = await
|
|
826
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
826
827
|
let contents = {};
|
|
827
828
|
contents = (0, import_smithy_client._json)(data);
|
|
828
829
|
const response = {
|
|
@@ -835,7 +836,7 @@ var de_ListParallelDataCommand = /* @__PURE__ */ __name(async (output, context)
|
|
|
835
836
|
if (output.statusCode >= 300) {
|
|
836
837
|
return de_CommandError(output, context);
|
|
837
838
|
}
|
|
838
|
-
const data = await
|
|
839
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
839
840
|
let contents = {};
|
|
840
841
|
contents = de_ListParallelDataResponse(data, context);
|
|
841
842
|
const response = {
|
|
@@ -848,7 +849,7 @@ var de_ListTagsForResourceCommand = /* @__PURE__ */ __name(async (output, contex
|
|
|
848
849
|
if (output.statusCode >= 300) {
|
|
849
850
|
return de_CommandError(output, context);
|
|
850
851
|
}
|
|
851
|
-
const data = await
|
|
852
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
852
853
|
let contents = {};
|
|
853
854
|
contents = (0, import_smithy_client._json)(data);
|
|
854
855
|
const response = {
|
|
@@ -861,7 +862,7 @@ var de_ListTerminologiesCommand = /* @__PURE__ */ __name(async (output, context)
|
|
|
861
862
|
if (output.statusCode >= 300) {
|
|
862
863
|
return de_CommandError(output, context);
|
|
863
864
|
}
|
|
864
|
-
const data = await
|
|
865
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
865
866
|
let contents = {};
|
|
866
867
|
contents = de_ListTerminologiesResponse(data, context);
|
|
867
868
|
const response = {
|
|
@@ -874,7 +875,7 @@ var de_ListTextTranslationJobsCommand = /* @__PURE__ */ __name(async (output, co
|
|
|
874
875
|
if (output.statusCode >= 300) {
|
|
875
876
|
return de_CommandError(output, context);
|
|
876
877
|
}
|
|
877
|
-
const data = await
|
|
878
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
878
879
|
let contents = {};
|
|
879
880
|
contents = de_ListTextTranslationJobsResponse(data, context);
|
|
880
881
|
const response = {
|
|
@@ -887,7 +888,7 @@ var de_StartTextTranslationJobCommand = /* @__PURE__ */ __name(async (output, co
|
|
|
887
888
|
if (output.statusCode >= 300) {
|
|
888
889
|
return de_CommandError(output, context);
|
|
889
890
|
}
|
|
890
|
-
const data = await
|
|
891
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
891
892
|
let contents = {};
|
|
892
893
|
contents = (0, import_smithy_client._json)(data);
|
|
893
894
|
const response = {
|
|
@@ -900,7 +901,7 @@ var de_StopTextTranslationJobCommand = /* @__PURE__ */ __name(async (output, con
|
|
|
900
901
|
if (output.statusCode >= 300) {
|
|
901
902
|
return de_CommandError(output, context);
|
|
902
903
|
}
|
|
903
|
-
const data = await
|
|
904
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
904
905
|
let contents = {};
|
|
905
906
|
contents = (0, import_smithy_client._json)(data);
|
|
906
907
|
const response = {
|
|
@@ -913,7 +914,7 @@ var de_TagResourceCommand = /* @__PURE__ */ __name(async (output, context) => {
|
|
|
913
914
|
if (output.statusCode >= 300) {
|
|
914
915
|
return de_CommandError(output, context);
|
|
915
916
|
}
|
|
916
|
-
const data = await
|
|
917
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
917
918
|
let contents = {};
|
|
918
919
|
contents = (0, import_smithy_client._json)(data);
|
|
919
920
|
const response = {
|
|
@@ -926,7 +927,7 @@ var de_TranslateDocumentCommand = /* @__PURE__ */ __name(async (output, context)
|
|
|
926
927
|
if (output.statusCode >= 300) {
|
|
927
928
|
return de_CommandError(output, context);
|
|
928
929
|
}
|
|
929
|
-
const data = await
|
|
930
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
930
931
|
let contents = {};
|
|
931
932
|
contents = de_TranslateDocumentResponse(data, context);
|
|
932
933
|
const response = {
|
|
@@ -939,7 +940,7 @@ var de_TranslateTextCommand = /* @__PURE__ */ __name(async (output, context) =>
|
|
|
939
940
|
if (output.statusCode >= 300) {
|
|
940
941
|
return de_CommandError(output, context);
|
|
941
942
|
}
|
|
942
|
-
const data = await
|
|
943
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
943
944
|
let contents = {};
|
|
944
945
|
contents = (0, import_smithy_client._json)(data);
|
|
945
946
|
const response = {
|
|
@@ -952,7 +953,7 @@ var de_UntagResourceCommand = /* @__PURE__ */ __name(async (output, context) =>
|
|
|
952
953
|
if (output.statusCode >= 300) {
|
|
953
954
|
return de_CommandError(output, context);
|
|
954
955
|
}
|
|
955
|
-
const data = await
|
|
956
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
956
957
|
let contents = {};
|
|
957
958
|
contents = (0, import_smithy_client._json)(data);
|
|
958
959
|
const response = {
|
|
@@ -965,7 +966,7 @@ var de_UpdateParallelDataCommand = /* @__PURE__ */ __name(async (output, context
|
|
|
965
966
|
if (output.statusCode >= 300) {
|
|
966
967
|
return de_CommandError(output, context);
|
|
967
968
|
}
|
|
968
|
-
const data = await
|
|
969
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
969
970
|
let contents = {};
|
|
970
971
|
contents = de_UpdateParallelDataResponse(data, context);
|
|
971
972
|
const response = {
|
|
@@ -977,9 +978,9 @@ var de_UpdateParallelDataCommand = /* @__PURE__ */ __name(async (output, context
|
|
|
977
978
|
var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
|
|
978
979
|
const parsedOutput = {
|
|
979
980
|
...output,
|
|
980
|
-
body: await
|
|
981
|
+
body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
|
|
981
982
|
};
|
|
982
|
-
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
983
|
+
const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
|
|
983
984
|
switch (errorCode) {
|
|
984
985
|
case "ConcurrentModificationException":
|
|
985
986
|
case "com.amazonaws.translate#ConcurrentModificationException":
|
|
@@ -1397,7 +1398,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
|
|
|
1397
1398
|
extendedRequestId: output.headers["x-amz-id-2"],
|
|
1398
1399
|
cfId: output.headers["x-amz-cf-id"]
|
|
1399
1400
|
}), "deserializeMetadata");
|
|
1400
|
-
var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
|
|
1401
1401
|
var throwDefaultError = (0, import_smithy_client.withBaseException)(TranslateServiceException);
|
|
1402
1402
|
var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => {
|
|
1403
1403
|
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
@@ -1424,46 +1424,6 @@ function sharedHeaders(operation) {
|
|
|
1424
1424
|
};
|
|
1425
1425
|
}
|
|
1426
1426
|
__name(sharedHeaders, "sharedHeaders");
|
|
1427
|
-
var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
1428
|
-
if (encoded.length) {
|
|
1429
|
-
return JSON.parse(encoded);
|
|
1430
|
-
}
|
|
1431
|
-
return {};
|
|
1432
|
-
}), "parseBody");
|
|
1433
|
-
var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
|
|
1434
|
-
const value = await parseBody(errorBody, context);
|
|
1435
|
-
value.message = value.message ?? value.Message;
|
|
1436
|
-
return value;
|
|
1437
|
-
}, "parseErrorBody");
|
|
1438
|
-
var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
|
|
1439
|
-
const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
|
|
1440
|
-
const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
|
|
1441
|
-
let cleanValue = rawValue;
|
|
1442
|
-
if (typeof cleanValue === "number") {
|
|
1443
|
-
cleanValue = cleanValue.toString();
|
|
1444
|
-
}
|
|
1445
|
-
if (cleanValue.indexOf(",") >= 0) {
|
|
1446
|
-
cleanValue = cleanValue.split(",")[0];
|
|
1447
|
-
}
|
|
1448
|
-
if (cleanValue.indexOf(":") >= 0) {
|
|
1449
|
-
cleanValue = cleanValue.split(":")[0];
|
|
1450
|
-
}
|
|
1451
|
-
if (cleanValue.indexOf("#") >= 0) {
|
|
1452
|
-
cleanValue = cleanValue.split("#")[1];
|
|
1453
|
-
}
|
|
1454
|
-
return cleanValue;
|
|
1455
|
-
}, "sanitizeErrorCode");
|
|
1456
|
-
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
1457
|
-
if (headerKey !== void 0) {
|
|
1458
|
-
return sanitizeErrorCode(output.headers[headerKey]);
|
|
1459
|
-
}
|
|
1460
|
-
if (data.code !== void 0) {
|
|
1461
|
-
return sanitizeErrorCode(data.code);
|
|
1462
|
-
}
|
|
1463
|
-
if (data["__type"] !== void 0) {
|
|
1464
|
-
return sanitizeErrorCode(data["__type"]);
|
|
1465
|
-
}
|
|
1466
|
-
}, "loadRestJsonErrorCode");
|
|
1467
1427
|
|
|
1468
1428
|
// src/commands/CreateParallelDataCommand.ts
|
|
1469
1429
|
var _CreateParallelDataCommand = class _CreateParallelDataCommand extends import_smithy_client.Command.classBuilder().ep({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody } from "@aws-sdk/core";
|
|
1
2
|
import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
|
|
2
3
|
import { _json, collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectString as __expectString, parseEpochTimestamp as __parseEpochTimestamp, take, withBaseException, } from "@smithy/smithy-client";
|
|
3
4
|
import { v4 as generateIdempotencyToken } from "uuid";
|
|
@@ -816,43 +817,3 @@ function sharedHeaders(operation) {
|
|
|
816
817
|
"x-amz-target": `AWSShineFrontendService_20170701.${operation}`,
|
|
817
818
|
};
|
|
818
819
|
}
|
|
819
|
-
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
820
|
-
if (encoded.length) {
|
|
821
|
-
return JSON.parse(encoded);
|
|
822
|
-
}
|
|
823
|
-
return {};
|
|
824
|
-
});
|
|
825
|
-
const parseErrorBody = async (errorBody, context) => {
|
|
826
|
-
const value = await parseBody(errorBody, context);
|
|
827
|
-
value.message = value.message ?? value.Message;
|
|
828
|
-
return value;
|
|
829
|
-
};
|
|
830
|
-
const loadRestJsonErrorCode = (output, data) => {
|
|
831
|
-
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
832
|
-
const sanitizeErrorCode = (rawValue) => {
|
|
833
|
-
let cleanValue = rawValue;
|
|
834
|
-
if (typeof cleanValue === "number") {
|
|
835
|
-
cleanValue = cleanValue.toString();
|
|
836
|
-
}
|
|
837
|
-
if (cleanValue.indexOf(",") >= 0) {
|
|
838
|
-
cleanValue = cleanValue.split(",")[0];
|
|
839
|
-
}
|
|
840
|
-
if (cleanValue.indexOf(":") >= 0) {
|
|
841
|
-
cleanValue = cleanValue.split(":")[0];
|
|
842
|
-
}
|
|
843
|
-
if (cleanValue.indexOf("#") >= 0) {
|
|
844
|
-
cleanValue = cleanValue.split("#")[1];
|
|
845
|
-
}
|
|
846
|
-
return cleanValue;
|
|
847
|
-
};
|
|
848
|
-
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
849
|
-
if (headerKey !== undefined) {
|
|
850
|
-
return sanitizeErrorCode(output.headers[headerKey]);
|
|
851
|
-
}
|
|
852
|
-
if (data.code !== undefined) {
|
|
853
|
-
return sanitizeErrorCode(data.code);
|
|
854
|
-
}
|
|
855
|
-
if (data["__type"] !== undefined) {
|
|
856
|
-
return sanitizeErrorCode(data["__type"]);
|
|
857
|
-
}
|
|
858
|
-
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/client-translate",
|
|
3
3
|
"description": "AWS SDK for JavaScript Translate Client for Node.js, Browser and React Native",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.529.1",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
7
7
|
"build:cjs": "node ../../scripts/compilation/inline client-translate",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@aws-crypto/sha256-browser": "3.0.0",
|
|
22
22
|
"@aws-crypto/sha256-js": "3.0.0",
|
|
23
|
-
"@aws-sdk/client-sts": "3.
|
|
24
|
-
"@aws-sdk/core": "3.
|
|
25
|
-
"@aws-sdk/credential-provider-node": "3.
|
|
23
|
+
"@aws-sdk/client-sts": "3.529.1",
|
|
24
|
+
"@aws-sdk/core": "3.529.1",
|
|
25
|
+
"@aws-sdk/credential-provider-node": "3.529.1",
|
|
26
26
|
"@aws-sdk/middleware-host-header": "3.523.0",
|
|
27
27
|
"@aws-sdk/middleware-logger": "3.523.0",
|
|
28
28
|
"@aws-sdk/middleware-recursion-detection": "3.523.0",
|