@aws-sdk/client-marketplace-agreement 3.525.0 → 3.529.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/dist-cjs/index.js CHANGED
@@ -392,7 +392,7 @@ var de_DescribeAgreementCommand = /* @__PURE__ */ __name(async (output, context)
392
392
  if (output.statusCode >= 300) {
393
393
  return de_CommandError(output, context);
394
394
  }
395
- const data = await parseBody(output.body, context);
395
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
396
396
  let contents = {};
397
397
  contents = de_DescribeAgreementOutput(data, context);
398
398
  const response = {
@@ -405,7 +405,7 @@ var de_GetAgreementTermsCommand = /* @__PURE__ */ __name(async (output, context)
405
405
  if (output.statusCode >= 300) {
406
406
  return de_CommandError(output, context);
407
407
  }
408
- const data = await parseBody(output.body, context);
408
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
409
409
  let contents = {};
410
410
  contents = de_GetAgreementTermsOutput(data, context);
411
411
  const response = {
@@ -418,7 +418,7 @@ var de_SearchAgreementsCommand = /* @__PURE__ */ __name(async (output, context)
418
418
  if (output.statusCode >= 300) {
419
419
  return de_CommandError(output, context);
420
420
  }
421
- const data = await parseBody(output.body, context);
421
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
422
422
  let contents = {};
423
423
  contents = de_SearchAgreementsOutput(data, context);
424
424
  const response = {
@@ -430,9 +430,9 @@ var de_SearchAgreementsCommand = /* @__PURE__ */ __name(async (output, context)
430
430
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
431
431
  const parsedOutput = {
432
432
  ...output,
433
- body: await parseErrorBody(output.body, context)
433
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
434
434
  };
435
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
435
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
436
436
  switch (errorCode) {
437
437
  case "AccessDeniedException":
438
438
  case "com.amazonaws.marketplaceagreement#AccessDeniedException":
@@ -645,7 +645,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
645
645
  extendedRequestId: output.headers["x-amz-id-2"],
646
646
  cfId: output.headers["x-amz-cf-id"]
647
647
  }), "deserializeMetadata");
648
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
649
648
  var throwDefaultError = (0, import_smithy_client.withBaseException)(MarketplaceAgreementServiceException);
650
649
  var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => {
651
650
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -672,46 +671,6 @@ function sharedHeaders(operation) {
672
671
  };
673
672
  }
674
673
  __name(sharedHeaders, "sharedHeaders");
675
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
676
- if (encoded.length) {
677
- return JSON.parse(encoded);
678
- }
679
- return {};
680
- }), "parseBody");
681
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
682
- const value = await parseBody(errorBody, context);
683
- value.message = value.message ?? value.Message;
684
- return value;
685
- }, "parseErrorBody");
686
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
687
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
688
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
689
- let cleanValue = rawValue;
690
- if (typeof cleanValue === "number") {
691
- cleanValue = cleanValue.toString();
692
- }
693
- if (cleanValue.indexOf(",") >= 0) {
694
- cleanValue = cleanValue.split(",")[0];
695
- }
696
- if (cleanValue.indexOf(":") >= 0) {
697
- cleanValue = cleanValue.split(":")[0];
698
- }
699
- if (cleanValue.indexOf("#") >= 0) {
700
- cleanValue = cleanValue.split("#")[1];
701
- }
702
- return cleanValue;
703
- }, "sanitizeErrorCode");
704
- const headerKey = findKey(output.headers, "x-amzn-errortype");
705
- if (headerKey !== void 0) {
706
- return sanitizeErrorCode(output.headers[headerKey]);
707
- }
708
- if (data.code !== void 0) {
709
- return sanitizeErrorCode(data.code);
710
- }
711
- if (data["__type"] !== void 0) {
712
- return sanitizeErrorCode(data["__type"]);
713
- }
714
- }, "loadRestJsonErrorCode");
715
674
 
716
675
  // src/commands/DescribeAgreementCommand.ts
717
676
  var _DescribeAgreementCommand = class _DescribeAgreementCommand extends import_smithy_client.Command.classBuilder().ep({
@@ -1,4 +1,4 @@
1
- import { awsExpectUnion as __expectUnion } from "@aws-sdk/core";
1
+ import { awsExpectUnion as __expectUnion, loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody, } from "@aws-sdk/core";
2
2
  import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
3
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";
4
4
  import { MarketplaceAgreementServiceException as __BaseException } from "../models/MarketplaceAgreementServiceException";
@@ -310,43 +310,3 @@ function sharedHeaders(operation) {
310
310
  "x-amz-target": `AWSMPCommerceService_v20200301.${operation}`,
311
311
  };
312
312
  }
313
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
314
- if (encoded.length) {
315
- return JSON.parse(encoded);
316
- }
317
- return {};
318
- });
319
- const parseErrorBody = async (errorBody, context) => {
320
- const value = await parseBody(errorBody, context);
321
- value.message = value.message ?? value.Message;
322
- return value;
323
- };
324
- const loadRestJsonErrorCode = (output, data) => {
325
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
326
- const sanitizeErrorCode = (rawValue) => {
327
- let cleanValue = rawValue;
328
- if (typeof cleanValue === "number") {
329
- cleanValue = cleanValue.toString();
330
- }
331
- if (cleanValue.indexOf(",") >= 0) {
332
- cleanValue = cleanValue.split(",")[0];
333
- }
334
- if (cleanValue.indexOf(":") >= 0) {
335
- cleanValue = cleanValue.split(":")[0];
336
- }
337
- if (cleanValue.indexOf("#") >= 0) {
338
- cleanValue = cleanValue.split("#")[1];
339
- }
340
- return cleanValue;
341
- };
342
- const headerKey = findKey(output.headers, "x-amzn-errortype");
343
- if (headerKey !== undefined) {
344
- return sanitizeErrorCode(output.headers[headerKey]);
345
- }
346
- if (data.code !== undefined) {
347
- return sanitizeErrorCode(data.code);
348
- }
349
- if (data["__type"] !== undefined) {
350
- return sanitizeErrorCode(data["__type"]);
351
- }
352
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-marketplace-agreement",
3
3
  "description": "AWS SDK for JavaScript Marketplace Agreement Client for Node.js, Browser and React Native",
4
- "version": "3.525.0",
4
+ "version": "3.529.0",
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-marketplace-agreement",
@@ -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.0",
24
+ "@aws-sdk/core": "3.529.0",
25
+ "@aws-sdk/credential-provider-node": "3.529.0",
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",