@aws-sdk/client-cost-and-usage-report-service 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
@@ -202,6 +202,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
202
202
  var import_types = require("@smithy/types");
203
203
 
204
204
  // src/protocols/Aws_json1_1.ts
205
+ var import_core2 = require("@aws-sdk/core");
205
206
 
206
207
 
207
208
 
@@ -421,7 +422,7 @@ var de_DeleteReportDefinitionCommand = /* @__PURE__ */ __name(async (output, con
421
422
  if (output.statusCode >= 300) {
422
423
  return de_CommandError(output, context);
423
424
  }
424
- const data = await parseBody(output.body, context);
425
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
425
426
  let contents = {};
426
427
  contents = (0, import_smithy_client._json)(data);
427
428
  const response = {
@@ -434,7 +435,7 @@ var de_DescribeReportDefinitionsCommand = /* @__PURE__ */ __name(async (output,
434
435
  if (output.statusCode >= 300) {
435
436
  return de_CommandError(output, context);
436
437
  }
437
- const data = await parseBody(output.body, context);
438
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
438
439
  let contents = {};
439
440
  contents = (0, import_smithy_client._json)(data);
440
441
  const response = {
@@ -447,7 +448,7 @@ var de_ListTagsForResourceCommand = /* @__PURE__ */ __name(async (output, contex
447
448
  if (output.statusCode >= 300) {
448
449
  return de_CommandError(output, context);
449
450
  }
450
- const data = await parseBody(output.body, context);
451
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
451
452
  let contents = {};
452
453
  contents = (0, import_smithy_client._json)(data);
453
454
  const response = {
@@ -460,7 +461,7 @@ var de_ModifyReportDefinitionCommand = /* @__PURE__ */ __name(async (output, con
460
461
  if (output.statusCode >= 300) {
461
462
  return de_CommandError(output, context);
462
463
  }
463
- const data = await parseBody(output.body, context);
464
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
464
465
  let contents = {};
465
466
  contents = (0, import_smithy_client._json)(data);
466
467
  const response = {
@@ -473,7 +474,7 @@ var de_PutReportDefinitionCommand = /* @__PURE__ */ __name(async (output, contex
473
474
  if (output.statusCode >= 300) {
474
475
  return de_CommandError(output, context);
475
476
  }
476
- const data = await parseBody(output.body, context);
477
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
477
478
  let contents = {};
478
479
  contents = (0, import_smithy_client._json)(data);
479
480
  const response = {
@@ -486,7 +487,7 @@ var de_TagResourceCommand = /* @__PURE__ */ __name(async (output, context) => {
486
487
  if (output.statusCode >= 300) {
487
488
  return de_CommandError(output, context);
488
489
  }
489
- const data = await parseBody(output.body, context);
490
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
490
491
  let contents = {};
491
492
  contents = (0, import_smithy_client._json)(data);
492
493
  const response = {
@@ -499,7 +500,7 @@ var de_UntagResourceCommand = /* @__PURE__ */ __name(async (output, context) =>
499
500
  if (output.statusCode >= 300) {
500
501
  return de_CommandError(output, context);
501
502
  }
502
- const data = await parseBody(output.body, context);
503
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
503
504
  let contents = {};
504
505
  contents = (0, import_smithy_client._json)(data);
505
506
  const response = {
@@ -511,9 +512,9 @@ var de_UntagResourceCommand = /* @__PURE__ */ __name(async (output, context) =>
511
512
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
512
513
  const parsedOutput = {
513
514
  ...output,
514
- body: await parseErrorBody(output.body, context)
515
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
515
516
  };
516
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
517
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
517
518
  switch (errorCode) {
518
519
  case "InternalErrorException":
519
520
  case "com.amazonaws.costandusagereportservice#InternalErrorException":
@@ -590,7 +591,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
590
591
  extendedRequestId: output.headers["x-amz-id-2"],
591
592
  cfId: output.headers["x-amz-cf-id"]
592
593
  }), "deserializeMetadata");
593
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
594
594
  var throwDefaultError = (0, import_smithy_client.withBaseException)(CostAndUsageReportServiceServiceException);
595
595
  var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => {
596
596
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -617,46 +617,6 @@ function sharedHeaders(operation) {
617
617
  };
618
618
  }
619
619
  __name(sharedHeaders, "sharedHeaders");
620
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
621
- if (encoded.length) {
622
- return JSON.parse(encoded);
623
- }
624
- return {};
625
- }), "parseBody");
626
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
627
- const value = await parseBody(errorBody, context);
628
- value.message = value.message ?? value.Message;
629
- return value;
630
- }, "parseErrorBody");
631
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
632
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
633
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
634
- let cleanValue = rawValue;
635
- if (typeof cleanValue === "number") {
636
- cleanValue = cleanValue.toString();
637
- }
638
- if (cleanValue.indexOf(",") >= 0) {
639
- cleanValue = cleanValue.split(",")[0];
640
- }
641
- if (cleanValue.indexOf(":") >= 0) {
642
- cleanValue = cleanValue.split(":")[0];
643
- }
644
- if (cleanValue.indexOf("#") >= 0) {
645
- cleanValue = cleanValue.split("#")[1];
646
- }
647
- return cleanValue;
648
- }, "sanitizeErrorCode");
649
- const headerKey = findKey(output.headers, "x-amzn-errortype");
650
- if (headerKey !== void 0) {
651
- return sanitizeErrorCode(output.headers[headerKey]);
652
- }
653
- if (data.code !== void 0) {
654
- return sanitizeErrorCode(data.code);
655
- }
656
- if (data["__type"] !== void 0) {
657
- return sanitizeErrorCode(data["__type"]);
658
- }
659
- }, "loadRestJsonErrorCode");
660
620
 
661
621
  // src/commands/DeleteReportDefinitionCommand.ts
662
622
  var _DeleteReportDefinitionCommand = class _DeleteReportDefinitionCommand 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, withBaseException, } from "@smithy/smithy-client";
3
4
  import { CostAndUsageReportServiceServiceException as __BaseException } from "../models/CostAndUsageReportServiceServiceException";
@@ -243,43 +244,3 @@ function sharedHeaders(operation) {
243
244
  "x-amz-target": `AWSOrigamiServiceGatewayService.${operation}`,
244
245
  };
245
246
  }
246
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
247
- if (encoded.length) {
248
- return JSON.parse(encoded);
249
- }
250
- return {};
251
- });
252
- const parseErrorBody = async (errorBody, context) => {
253
- const value = await parseBody(errorBody, context);
254
- value.message = value.message ?? value.Message;
255
- return value;
256
- };
257
- const loadRestJsonErrorCode = (output, data) => {
258
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
259
- const sanitizeErrorCode = (rawValue) => {
260
- let cleanValue = rawValue;
261
- if (typeof cleanValue === "number") {
262
- cleanValue = cleanValue.toString();
263
- }
264
- if (cleanValue.indexOf(",") >= 0) {
265
- cleanValue = cleanValue.split(",")[0];
266
- }
267
- if (cleanValue.indexOf(":") >= 0) {
268
- cleanValue = cleanValue.split(":")[0];
269
- }
270
- if (cleanValue.indexOf("#") >= 0) {
271
- cleanValue = cleanValue.split("#")[1];
272
- }
273
- return cleanValue;
274
- };
275
- const headerKey = findKey(output.headers, "x-amzn-errortype");
276
- if (headerKey !== undefined) {
277
- return sanitizeErrorCode(output.headers[headerKey]);
278
- }
279
- if (data.code !== undefined) {
280
- return sanitizeErrorCode(data.code);
281
- }
282
- if (data["__type"] !== undefined) {
283
- return sanitizeErrorCode(data["__type"]);
284
- }
285
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-cost-and-usage-report-service",
3
3
  "description": "AWS SDK for JavaScript Cost And Usage Report Service 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-cost-and-usage-report-service",
@@ -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",