@aws-sdk/client-marketplace-metering 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
@@ -203,6 +203,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
203
203
  var import_types = require("@smithy/types");
204
204
 
205
205
  // src/protocols/Aws_json1_1.ts
206
+ var import_core2 = require("@aws-sdk/core");
206
207
 
207
208
 
208
209
 
@@ -545,7 +546,7 @@ var de_BatchMeterUsageCommand = /* @__PURE__ */ __name(async (output, context) =
545
546
  if (output.statusCode >= 300) {
546
547
  return de_CommandError(output, context);
547
548
  }
548
- const data = await parseBody(output.body, context);
549
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
549
550
  let contents = {};
550
551
  contents = de_BatchMeterUsageResult(data, context);
551
552
  const response = {
@@ -558,7 +559,7 @@ var de_MeterUsageCommand = /* @__PURE__ */ __name(async (output, context) => {
558
559
  if (output.statusCode >= 300) {
559
560
  return de_CommandError(output, context);
560
561
  }
561
- const data = await parseBody(output.body, context);
562
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
562
563
  let contents = {};
563
564
  contents = (0, import_smithy_client._json)(data);
564
565
  const response = {
@@ -571,7 +572,7 @@ var de_RegisterUsageCommand = /* @__PURE__ */ __name(async (output, context) =>
571
572
  if (output.statusCode >= 300) {
572
573
  return de_CommandError(output, context);
573
574
  }
574
- const data = await parseBody(output.body, context);
575
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
575
576
  let contents = {};
576
577
  contents = de_RegisterUsageResult(data, context);
577
578
  const response = {
@@ -584,7 +585,7 @@ var de_ResolveCustomerCommand = /* @__PURE__ */ __name(async (output, context) =
584
585
  if (output.statusCode >= 300) {
585
586
  return de_CommandError(output, context);
586
587
  }
587
- const data = await parseBody(output.body, context);
588
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
588
589
  let contents = {};
589
590
  contents = (0, import_smithy_client._json)(data);
590
591
  const response = {
@@ -596,9 +597,9 @@ var de_ResolveCustomerCommand = /* @__PURE__ */ __name(async (output, context) =
596
597
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
597
598
  const parsedOutput = {
598
599
  ...output,
599
- body: await parseErrorBody(output.body, context)
600
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
600
601
  };
601
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
602
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
602
603
  switch (errorCode) {
603
604
  case "DisabledApiException":
604
605
  case "com.amazonaws.marketplacemetering#DisabledApiException":
@@ -889,7 +890,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
889
890
  extendedRequestId: output.headers["x-amz-id-2"],
890
891
  cfId: output.headers["x-amz-cf-id"]
891
892
  }), "deserializeMetadata");
892
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
893
893
  var throwDefaultError = (0, import_smithy_client.withBaseException)(MarketplaceMeteringServiceException);
894
894
  var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => {
895
895
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -916,46 +916,6 @@ function sharedHeaders(operation) {
916
916
  };
917
917
  }
918
918
  __name(sharedHeaders, "sharedHeaders");
919
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
920
- if (encoded.length) {
921
- return JSON.parse(encoded);
922
- }
923
- return {};
924
- }), "parseBody");
925
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
926
- const value = await parseBody(errorBody, context);
927
- value.message = value.message ?? value.Message;
928
- return value;
929
- }, "parseErrorBody");
930
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
931
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
932
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
933
- let cleanValue = rawValue;
934
- if (typeof cleanValue === "number") {
935
- cleanValue = cleanValue.toString();
936
- }
937
- if (cleanValue.indexOf(",") >= 0) {
938
- cleanValue = cleanValue.split(",")[0];
939
- }
940
- if (cleanValue.indexOf(":") >= 0) {
941
- cleanValue = cleanValue.split(":")[0];
942
- }
943
- if (cleanValue.indexOf("#") >= 0) {
944
- cleanValue = cleanValue.split("#")[1];
945
- }
946
- return cleanValue;
947
- }, "sanitizeErrorCode");
948
- const headerKey = findKey(output.headers, "x-amzn-errortype");
949
- if (headerKey !== void 0) {
950
- return sanitizeErrorCode(output.headers[headerKey]);
951
- }
952
- if (data.code !== void 0) {
953
- return sanitizeErrorCode(data.code);
954
- }
955
- if (data["__type"] !== void 0) {
956
- return sanitizeErrorCode(data["__type"]);
957
- }
958
- }, "loadRestJsonErrorCode");
959
919
 
960
920
  // src/commands/BatchMeterUsageCommand.ts
961
921
  var _BatchMeterUsageCommand = class _BatchMeterUsageCommand 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, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectString as __expectString, parseEpochTimestamp as __parseEpochTimestamp, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { MarketplaceMeteringServiceException as __BaseException } from "../models/MarketplaceMeteringServiceException";
@@ -406,43 +407,3 @@ function sharedHeaders(operation) {
406
407
  "x-amz-target": `AWSMPMeteringService.${operation}`,
407
408
  };
408
409
  }
409
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
410
- if (encoded.length) {
411
- return JSON.parse(encoded);
412
- }
413
- return {};
414
- });
415
- const parseErrorBody = async (errorBody, context) => {
416
- const value = await parseBody(errorBody, context);
417
- value.message = value.message ?? value.Message;
418
- return value;
419
- };
420
- const loadRestJsonErrorCode = (output, data) => {
421
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
422
- const sanitizeErrorCode = (rawValue) => {
423
- let cleanValue = rawValue;
424
- if (typeof cleanValue === "number") {
425
- cleanValue = cleanValue.toString();
426
- }
427
- if (cleanValue.indexOf(",") >= 0) {
428
- cleanValue = cleanValue.split(",")[0];
429
- }
430
- if (cleanValue.indexOf(":") >= 0) {
431
- cleanValue = cleanValue.split(":")[0];
432
- }
433
- if (cleanValue.indexOf("#") >= 0) {
434
- cleanValue = cleanValue.split("#")[1];
435
- }
436
- return cleanValue;
437
- };
438
- const headerKey = findKey(output.headers, "x-amzn-errortype");
439
- if (headerKey !== undefined) {
440
- return sanitizeErrorCode(output.headers[headerKey]);
441
- }
442
- if (data.code !== undefined) {
443
- return sanitizeErrorCode(data.code);
444
- }
445
- if (data["__type"] !== undefined) {
446
- return sanitizeErrorCode(data["__type"]);
447
- }
448
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-marketplace-metering",
3
3
  "description": "AWS SDK for JavaScript Marketplace Metering 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-marketplace-metering",
@@ -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",