@aws-sdk/client-account 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 CHANGED
@@ -207,6 +207,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
207
207
  var import_types = require("@smithy/types");
208
208
 
209
209
  // src/protocols/Aws_restJson1.ts
210
+ var import_core2 = require("@aws-sdk/core");
210
211
 
211
212
 
212
213
 
@@ -583,7 +584,7 @@ var de_GetAlternateContactCommand = /* @__PURE__ */ __name(async (output, contex
583
584
  const contents = (0, import_smithy_client.map)({
584
585
  $metadata: deserializeMetadata(output)
585
586
  });
586
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
587
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
587
588
  const doc = (0, import_smithy_client.take)(data, {
588
589
  AlternateContact: import_smithy_client._json
589
590
  });
@@ -597,7 +598,7 @@ var de_GetContactInformationCommand = /* @__PURE__ */ __name(async (output, cont
597
598
  const contents = (0, import_smithy_client.map)({
598
599
  $metadata: deserializeMetadata(output)
599
600
  });
600
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
601
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
601
602
  const doc = (0, import_smithy_client.take)(data, {
602
603
  ContactInformation: import_smithy_client._json
603
604
  });
@@ -611,7 +612,7 @@ var de_GetRegionOptStatusCommand = /* @__PURE__ */ __name(async (output, context
611
612
  const contents = (0, import_smithy_client.map)({
612
613
  $metadata: deserializeMetadata(output)
613
614
  });
614
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
615
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
615
616
  const doc = (0, import_smithy_client.take)(data, {
616
617
  RegionName: import_smithy_client.expectString,
617
618
  RegionOptStatus: import_smithy_client.expectString
@@ -626,7 +627,7 @@ var de_ListRegionsCommand = /* @__PURE__ */ __name(async (output, context) => {
626
627
  const contents = (0, import_smithy_client.map)({
627
628
  $metadata: deserializeMetadata(output)
628
629
  });
629
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
630
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
630
631
  const doc = (0, import_smithy_client.take)(data, {
631
632
  NextToken: import_smithy_client.expectString,
632
633
  Regions: import_smithy_client._json
@@ -657,9 +658,9 @@ var de_PutContactInformationCommand = /* @__PURE__ */ __name(async (output, cont
657
658
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
658
659
  const parsedOutput = {
659
660
  ...output,
660
- body: await parseErrorBody(output.body, context)
661
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
661
662
  };
662
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
663
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
663
664
  switch (errorCode) {
664
665
  case "AccessDeniedException":
665
666
  case "com.amazonaws.account#AccessDeniedException":
@@ -775,47 +776,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
775
776
  extendedRequestId: output.headers["x-amz-id-2"],
776
777
  cfId: output.headers["x-amz-cf-id"]
777
778
  }), "deserializeMetadata");
778
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
779
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
780
- if (encoded.length) {
781
- return JSON.parse(encoded);
782
- }
783
- return {};
784
- }), "parseBody");
785
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
786
- const value = await parseBody(errorBody, context);
787
- value.message = value.message ?? value.Message;
788
- return value;
789
- }, "parseErrorBody");
790
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
791
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
792
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
793
- let cleanValue = rawValue;
794
- if (typeof cleanValue === "number") {
795
- cleanValue = cleanValue.toString();
796
- }
797
- if (cleanValue.indexOf(",") >= 0) {
798
- cleanValue = cleanValue.split(",")[0];
799
- }
800
- if (cleanValue.indexOf(":") >= 0) {
801
- cleanValue = cleanValue.split(":")[0];
802
- }
803
- if (cleanValue.indexOf("#") >= 0) {
804
- cleanValue = cleanValue.split("#")[1];
805
- }
806
- return cleanValue;
807
- }, "sanitizeErrorCode");
808
- const headerKey = findKey(output.headers, "x-amzn-errortype");
809
- if (headerKey !== void 0) {
810
- return sanitizeErrorCode(output.headers[headerKey]);
811
- }
812
- if (data.code !== void 0) {
813
- return sanitizeErrorCode(data.code);
814
- }
815
- if (data["__type"] !== void 0) {
816
- return sanitizeErrorCode(data["__type"]);
817
- }
818
- }, "loadRestJsonErrorCode");
819
779
 
820
780
  // src/commands/DeleteAlternateContactCommand.ts
821
781
  var _DeleteAlternateContactCommand = class _DeleteAlternateContactCommand 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 { requestBuilder as rb } from "@smithy/core";
2
3
  import { _json, collectBody, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { AccountServiceException as __BaseException } from "../models/AccountServiceException";
@@ -368,43 +369,3 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
368
369
  value !== "" &&
369
370
  (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
370
371
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
371
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
372
- if (encoded.length) {
373
- return JSON.parse(encoded);
374
- }
375
- return {};
376
- });
377
- const parseErrorBody = async (errorBody, context) => {
378
- const value = await parseBody(errorBody, context);
379
- value.message = value.message ?? value.Message;
380
- return value;
381
- };
382
- const loadRestJsonErrorCode = (output, data) => {
383
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
384
- const sanitizeErrorCode = (rawValue) => {
385
- let cleanValue = rawValue;
386
- if (typeof cleanValue === "number") {
387
- cleanValue = cleanValue.toString();
388
- }
389
- if (cleanValue.indexOf(",") >= 0) {
390
- cleanValue = cleanValue.split(",")[0];
391
- }
392
- if (cleanValue.indexOf(":") >= 0) {
393
- cleanValue = cleanValue.split(":")[0];
394
- }
395
- if (cleanValue.indexOf("#") >= 0) {
396
- cleanValue = cleanValue.split("#")[1];
397
- }
398
- return cleanValue;
399
- };
400
- const headerKey = findKey(output.headers, "x-amzn-errortype");
401
- if (headerKey !== undefined) {
402
- return sanitizeErrorCode(output.headers[headerKey]);
403
- }
404
- if (data.code !== undefined) {
405
- return sanitizeErrorCode(data.code);
406
- }
407
- if (data["__type"] !== undefined) {
408
- return sanitizeErrorCode(data["__type"]);
409
- }
410
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-account",
3
3
  "description": "AWS SDK for JavaScript Account Client for Node.js, Browser and React Native",
4
- "version": "3.525.0",
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-account",
@@ -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.525.0",
24
- "@aws-sdk/core": "3.525.0",
25
- "@aws-sdk/credential-provider-node": "3.525.0",
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",