@aws-sdk/client-migrationhub-config 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
@@ -193,6 +193,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
193
193
  var import_types = require("@smithy/types");
194
194
 
195
195
  // src/protocols/Aws_json1_1.ts
196
+ var import_core2 = require("@aws-sdk/core");
196
197
 
197
198
 
198
199
 
@@ -353,7 +354,7 @@ var de_CreateHomeRegionControlCommand = /* @__PURE__ */ __name(async (output, co
353
354
  if (output.statusCode >= 300) {
354
355
  return de_CommandError(output, context);
355
356
  }
356
- const data = await parseBody(output.body, context);
357
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
357
358
  let contents = {};
358
359
  contents = de_CreateHomeRegionControlResult(data, context);
359
360
  const response = {
@@ -366,7 +367,7 @@ var de_DeleteHomeRegionControlCommand = /* @__PURE__ */ __name(async (output, co
366
367
  if (output.statusCode >= 300) {
367
368
  return de_CommandError(output, context);
368
369
  }
369
- const data = await parseBody(output.body, context);
370
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
370
371
  let contents = {};
371
372
  contents = (0, import_smithy_client._json)(data);
372
373
  const response = {
@@ -379,7 +380,7 @@ var de_DescribeHomeRegionControlsCommand = /* @__PURE__ */ __name(async (output,
379
380
  if (output.statusCode >= 300) {
380
381
  return de_CommandError(output, context);
381
382
  }
382
- const data = await parseBody(output.body, context);
383
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
383
384
  let contents = {};
384
385
  contents = de_DescribeHomeRegionControlsResult(data, context);
385
386
  const response = {
@@ -392,7 +393,7 @@ var de_GetHomeRegionCommand = /* @__PURE__ */ __name(async (output, context) =>
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 = {
@@ -404,9 +405,9 @@ var de_GetHomeRegionCommand = /* @__PURE__ */ __name(async (output, context) =>
404
405
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
405
406
  const parsedOutput = {
406
407
  ...output,
407
- body: await parseErrorBody(output.body, context)
408
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
408
409
  };
409
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
410
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
410
411
  switch (errorCode) {
411
412
  case "AccessDeniedException":
412
413
  case "com.amazonaws.migrationhubconfig#AccessDeniedException":
@@ -520,7 +521,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
520
521
  extendedRequestId: output.headers["x-amz-id-2"],
521
522
  cfId: output.headers["x-amz-cf-id"]
522
523
  }), "deserializeMetadata");
523
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
524
524
  var throwDefaultError = (0, import_smithy_client.withBaseException)(MigrationHubConfigServiceException);
525
525
  var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => {
526
526
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -547,46 +547,6 @@ function sharedHeaders(operation) {
547
547
  };
548
548
  }
549
549
  __name(sharedHeaders, "sharedHeaders");
550
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
551
- if (encoded.length) {
552
- return JSON.parse(encoded);
553
- }
554
- return {};
555
- }), "parseBody");
556
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
557
- const value = await parseBody(errorBody, context);
558
- value.message = value.message ?? value.Message;
559
- return value;
560
- }, "parseErrorBody");
561
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
562
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
563
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
564
- let cleanValue = rawValue;
565
- if (typeof cleanValue === "number") {
566
- cleanValue = cleanValue.toString();
567
- }
568
- if (cleanValue.indexOf(",") >= 0) {
569
- cleanValue = cleanValue.split(",")[0];
570
- }
571
- if (cleanValue.indexOf(":") >= 0) {
572
- cleanValue = cleanValue.split(":")[0];
573
- }
574
- if (cleanValue.indexOf("#") >= 0) {
575
- cleanValue = cleanValue.split("#")[1];
576
- }
577
- return cleanValue;
578
- }, "sanitizeErrorCode");
579
- const headerKey = findKey(output.headers, "x-amzn-errortype");
580
- if (headerKey !== void 0) {
581
- return sanitizeErrorCode(output.headers[headerKey]);
582
- }
583
- if (data.code !== void 0) {
584
- return sanitizeErrorCode(data.code);
585
- }
586
- if (data["__type"] !== void 0) {
587
- return sanitizeErrorCode(data["__type"]);
588
- }
589
- }, "loadRestJsonErrorCode");
590
550
 
591
551
  // src/commands/CreateHomeRegionControlCommand.ts
592
552
  var _CreateHomeRegionControlCommand = class _CreateHomeRegionControlCommand 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 { MigrationHubConfigServiceException as __BaseException } from "../models/MigrationHubConfigServiceException";
@@ -225,43 +226,3 @@ function sharedHeaders(operation) {
225
226
  "x-amz-target": `AWSMigrationHubMultiAccountService.${operation}`,
226
227
  };
227
228
  }
228
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
229
- if (encoded.length) {
230
- return JSON.parse(encoded);
231
- }
232
- return {};
233
- });
234
- const parseErrorBody = async (errorBody, context) => {
235
- const value = await parseBody(errorBody, context);
236
- value.message = value.message ?? value.Message;
237
- return value;
238
- };
239
- const loadRestJsonErrorCode = (output, data) => {
240
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
241
- const sanitizeErrorCode = (rawValue) => {
242
- let cleanValue = rawValue;
243
- if (typeof cleanValue === "number") {
244
- cleanValue = cleanValue.toString();
245
- }
246
- if (cleanValue.indexOf(",") >= 0) {
247
- cleanValue = cleanValue.split(",")[0];
248
- }
249
- if (cleanValue.indexOf(":") >= 0) {
250
- cleanValue = cleanValue.split(":")[0];
251
- }
252
- if (cleanValue.indexOf("#") >= 0) {
253
- cleanValue = cleanValue.split("#")[1];
254
- }
255
- return cleanValue;
256
- };
257
- const headerKey = findKey(output.headers, "x-amzn-errortype");
258
- if (headerKey !== undefined) {
259
- return sanitizeErrorCode(output.headers[headerKey]);
260
- }
261
- if (data.code !== undefined) {
262
- return sanitizeErrorCode(data.code);
263
- }
264
- if (data["__type"] !== undefined) {
265
- return sanitizeErrorCode(data["__type"]);
266
- }
267
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-migrationhub-config",
3
3
  "description": "AWS SDK for JavaScript Migrationhub Config 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-migrationhub-config",
@@ -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",