@aws-sdk/client-health 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
@@ -210,6 +210,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
210
210
  var import_types = require("@smithy/types");
211
211
 
212
212
  // src/protocols/Aws_json1_1.ts
213
+ var import_core2 = require("@aws-sdk/core");
213
214
 
214
215
 
215
216
 
@@ -392,7 +393,7 @@ var de_DescribeAffectedAccountsForOrganizationCommand = /* @__PURE__ */ __name(a
392
393
  if (output.statusCode >= 300) {
393
394
  return de_CommandError(output, context);
394
395
  }
395
- const data = await parseBody(output.body, context);
396
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
396
397
  let contents = {};
397
398
  contents = (0, import_smithy_client._json)(data);
398
399
  const response = {
@@ -405,7 +406,7 @@ var de_DescribeAffectedEntitiesCommand = /* @__PURE__ */ __name(async (output, c
405
406
  if (output.statusCode >= 300) {
406
407
  return de_CommandError(output, context);
407
408
  }
408
- const data = await parseBody(output.body, context);
409
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
409
410
  let contents = {};
410
411
  contents = de_DescribeAffectedEntitiesResponse(data, context);
411
412
  const response = {
@@ -418,7 +419,7 @@ var de_DescribeAffectedEntitiesForOrganizationCommand = /* @__PURE__ */ __name(a
418
419
  if (output.statusCode >= 300) {
419
420
  return de_CommandError(output, context);
420
421
  }
421
- const data = await parseBody(output.body, context);
422
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
422
423
  let contents = {};
423
424
  contents = de_DescribeAffectedEntitiesForOrganizationResponse(data, context);
424
425
  const response = {
@@ -431,7 +432,7 @@ var de_DescribeEntityAggregatesCommand = /* @__PURE__ */ __name(async (output, c
431
432
  if (output.statusCode >= 300) {
432
433
  return de_CommandError(output, context);
433
434
  }
434
- const data = await parseBody(output.body, context);
435
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
435
436
  let contents = {};
436
437
  contents = (0, import_smithy_client._json)(data);
437
438
  const response = {
@@ -444,7 +445,7 @@ var de_DescribeEntityAggregatesForOrganizationCommand = /* @__PURE__ */ __name(a
444
445
  if (output.statusCode >= 300) {
445
446
  return de_CommandError(output, context);
446
447
  }
447
- const data = await parseBody(output.body, context);
448
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
448
449
  let contents = {};
449
450
  contents = (0, import_smithy_client._json)(data);
450
451
  const response = {
@@ -457,7 +458,7 @@ var de_DescribeEventAggregatesCommand = /* @__PURE__ */ __name(async (output, co
457
458
  if (output.statusCode >= 300) {
458
459
  return de_CommandError(output, context);
459
460
  }
460
- const data = await parseBody(output.body, context);
461
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
461
462
  let contents = {};
462
463
  contents = (0, import_smithy_client._json)(data);
463
464
  const response = {
@@ -470,7 +471,7 @@ var de_DescribeEventDetailsCommand = /* @__PURE__ */ __name(async (output, conte
470
471
  if (output.statusCode >= 300) {
471
472
  return de_CommandError(output, context);
472
473
  }
473
- const data = await parseBody(output.body, context);
474
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
474
475
  let contents = {};
475
476
  contents = de_DescribeEventDetailsResponse(data, context);
476
477
  const response = {
@@ -483,7 +484,7 @@ var de_DescribeEventDetailsForOrganizationCommand = /* @__PURE__ */ __name(async
483
484
  if (output.statusCode >= 300) {
484
485
  return de_CommandError(output, context);
485
486
  }
486
- const data = await parseBody(output.body, context);
487
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
487
488
  let contents = {};
488
489
  contents = de_DescribeEventDetailsForOrganizationResponse(data, context);
489
490
  const response = {
@@ -496,7 +497,7 @@ var de_DescribeEventsCommand = /* @__PURE__ */ __name(async (output, context) =>
496
497
  if (output.statusCode >= 300) {
497
498
  return de_CommandError(output, context);
498
499
  }
499
- const data = await parseBody(output.body, context);
500
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
500
501
  let contents = {};
501
502
  contents = de_DescribeEventsResponse(data, context);
502
503
  const response = {
@@ -509,7 +510,7 @@ var de_DescribeEventsForOrganizationCommand = /* @__PURE__ */ __name(async (outp
509
510
  if (output.statusCode >= 300) {
510
511
  return de_CommandError(output, context);
511
512
  }
512
- const data = await parseBody(output.body, context);
513
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
513
514
  let contents = {};
514
515
  contents = de_DescribeEventsForOrganizationResponse(data, context);
515
516
  const response = {
@@ -522,7 +523,7 @@ var de_DescribeEventTypesCommand = /* @__PURE__ */ __name(async (output, context
522
523
  if (output.statusCode >= 300) {
523
524
  return de_CommandError(output, context);
524
525
  }
525
- const data = await parseBody(output.body, context);
526
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
526
527
  let contents = {};
527
528
  contents = (0, import_smithy_client._json)(data);
528
529
  const response = {
@@ -535,7 +536,7 @@ var de_DescribeHealthServiceStatusForOrganizationCommand = /* @__PURE__ */ __nam
535
536
  if (output.statusCode >= 300) {
536
537
  return de_CommandError(output, context);
537
538
  }
538
- const data = await parseBody(output.body, context);
539
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
539
540
  let contents = {};
540
541
  contents = (0, import_smithy_client._json)(data);
541
542
  const response = {
@@ -567,9 +568,9 @@ var de_EnableHealthServiceAccessForOrganizationCommand = /* @__PURE__ */ __name(
567
568
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
568
569
  const parsedOutput = {
569
570
  ...output,
570
- body: await parseErrorBody(output.body, context)
571
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
571
572
  };
572
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
573
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
573
574
  switch (errorCode) {
574
575
  case "InvalidPaginationToken":
575
576
  case "com.amazonaws.health#InvalidPaginationToken":
@@ -830,7 +831,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
830
831
  extendedRequestId: output.headers["x-amz-id-2"],
831
832
  cfId: output.headers["x-amz-cf-id"]
832
833
  }), "deserializeMetadata");
833
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
834
834
  var throwDefaultError = (0, import_smithy_client.withBaseException)(HealthServiceException);
835
835
  var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => {
836
836
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -857,46 +857,6 @@ function sharedHeaders(operation) {
857
857
  };
858
858
  }
859
859
  __name(sharedHeaders, "sharedHeaders");
860
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
861
- if (encoded.length) {
862
- return JSON.parse(encoded);
863
- }
864
- return {};
865
- }), "parseBody");
866
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
867
- const value = await parseBody(errorBody, context);
868
- value.message = value.message ?? value.Message;
869
- return value;
870
- }, "parseErrorBody");
871
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
872
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
873
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
874
- let cleanValue = rawValue;
875
- if (typeof cleanValue === "number") {
876
- cleanValue = cleanValue.toString();
877
- }
878
- if (cleanValue.indexOf(",") >= 0) {
879
- cleanValue = cleanValue.split(",")[0];
880
- }
881
- if (cleanValue.indexOf(":") >= 0) {
882
- cleanValue = cleanValue.split(":")[0];
883
- }
884
- if (cleanValue.indexOf("#") >= 0) {
885
- cleanValue = cleanValue.split("#")[1];
886
- }
887
- return cleanValue;
888
- }, "sanitizeErrorCode");
889
- const headerKey = findKey(output.headers, "x-amzn-errortype");
890
- if (headerKey !== void 0) {
891
- return sanitizeErrorCode(output.headers[headerKey]);
892
- }
893
- if (data.code !== void 0) {
894
- return sanitizeErrorCode(data.code);
895
- }
896
- if (data["__type"] !== void 0) {
897
- return sanitizeErrorCode(data["__type"]);
898
- }
899
- }, "loadRestJsonErrorCode");
900
860
 
901
861
  // src/commands/DescribeAffectedAccountsForOrganizationCommand.ts
902
862
  var _DescribeAffectedAccountsForOrganizationCommand = class _DescribeAffectedAccountsForOrganizationCommand 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, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectString as __expectString, parseEpochTimestamp as __parseEpochTimestamp, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { HealthServiceException as __BaseException } from "../models/HealthServiceException";
@@ -563,43 +564,3 @@ function sharedHeaders(operation) {
563
564
  "x-amz-target": `AWSHealth_20160804.${operation}`,
564
565
  };
565
566
  }
566
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
567
- if (encoded.length) {
568
- return JSON.parse(encoded);
569
- }
570
- return {};
571
- });
572
- const parseErrorBody = async (errorBody, context) => {
573
- const value = await parseBody(errorBody, context);
574
- value.message = value.message ?? value.Message;
575
- return value;
576
- };
577
- const loadRestJsonErrorCode = (output, data) => {
578
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
579
- const sanitizeErrorCode = (rawValue) => {
580
- let cleanValue = rawValue;
581
- if (typeof cleanValue === "number") {
582
- cleanValue = cleanValue.toString();
583
- }
584
- if (cleanValue.indexOf(",") >= 0) {
585
- cleanValue = cleanValue.split(",")[0];
586
- }
587
- if (cleanValue.indexOf(":") >= 0) {
588
- cleanValue = cleanValue.split(":")[0];
589
- }
590
- if (cleanValue.indexOf("#") >= 0) {
591
- cleanValue = cleanValue.split("#")[1];
592
- }
593
- return cleanValue;
594
- };
595
- const headerKey = findKey(output.headers, "x-amzn-errortype");
596
- if (headerKey !== undefined) {
597
- return sanitizeErrorCode(output.headers[headerKey]);
598
- }
599
- if (data.code !== undefined) {
600
- return sanitizeErrorCode(data.code);
601
- }
602
- if (data["__type"] !== undefined) {
603
- return sanitizeErrorCode(data["__type"]);
604
- }
605
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-health",
3
3
  "description": "AWS SDK for JavaScript Health 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-health",
@@ -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",