@aws-sdk/client-pricing 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
@@ -198,6 +198,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
198
198
  var import_types = require("@smithy/types");
199
199
 
200
200
  // src/protocols/Aws_json1_1.ts
201
+ var import_core2 = require("@aws-sdk/core");
201
202
 
202
203
 
203
204
 
@@ -385,7 +386,7 @@ var de_DescribeServicesCommand = /* @__PURE__ */ __name(async (output, context)
385
386
  if (output.statusCode >= 300) {
386
387
  return de_CommandError(output, context);
387
388
  }
388
- const data = await parseBody(output.body, context);
389
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
389
390
  let contents = {};
390
391
  contents = (0, import_smithy_client._json)(data);
391
392
  const response = {
@@ -398,7 +399,7 @@ var de_GetAttributeValuesCommand = /* @__PURE__ */ __name(async (output, context
398
399
  if (output.statusCode >= 300) {
399
400
  return de_CommandError(output, context);
400
401
  }
401
- const data = await parseBody(output.body, context);
402
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
402
403
  let contents = {};
403
404
  contents = (0, import_smithy_client._json)(data);
404
405
  const response = {
@@ -411,7 +412,7 @@ var de_GetPriceListFileUrlCommand = /* @__PURE__ */ __name(async (output, contex
411
412
  if (output.statusCode >= 300) {
412
413
  return de_CommandError(output, context);
413
414
  }
414
- const data = await parseBody(output.body, context);
415
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
415
416
  let contents = {};
416
417
  contents = (0, import_smithy_client._json)(data);
417
418
  const response = {
@@ -424,7 +425,7 @@ var de_GetProductsCommand = /* @__PURE__ */ __name(async (output, context) => {
424
425
  if (output.statusCode >= 300) {
425
426
  return de_CommandError(output, context);
426
427
  }
427
- const data = await parseBody(output.body, context);
428
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
428
429
  let contents = {};
429
430
  contents = de_GetProductsResponse(data, context);
430
431
  const response = {
@@ -437,7 +438,7 @@ var de_ListPriceListsCommand = /* @__PURE__ */ __name(async (output, context) =>
437
438
  if (output.statusCode >= 300) {
438
439
  return de_CommandError(output, context);
439
440
  }
440
- const data = await parseBody(output.body, context);
441
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
441
442
  let contents = {};
442
443
  contents = (0, import_smithy_client._json)(data);
443
444
  const response = {
@@ -449,9 +450,9 @@ var de_ListPriceListsCommand = /* @__PURE__ */ __name(async (output, context) =>
449
450
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
450
451
  const parsedOutput = {
451
452
  ...output,
452
- body: await parseErrorBody(output.body, context)
453
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
453
454
  };
454
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
455
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
455
456
  switch (errorCode) {
456
457
  case "ExpiredNextTokenException":
457
458
  case "com.amazonaws.pricing#ExpiredNextTokenException":
@@ -575,7 +576,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
575
576
  extendedRequestId: output.headers["x-amz-id-2"],
576
577
  cfId: output.headers["x-amz-cf-id"]
577
578
  }), "deserializeMetadata");
578
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
579
579
  var throwDefaultError = (0, import_smithy_client.withBaseException)(PricingServiceException);
580
580
  var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => {
581
581
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -602,46 +602,6 @@ function sharedHeaders(operation) {
602
602
  };
603
603
  }
604
604
  __name(sharedHeaders, "sharedHeaders");
605
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
606
- if (encoded.length) {
607
- return JSON.parse(encoded);
608
- }
609
- return {};
610
- }), "parseBody");
611
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
612
- const value = await parseBody(errorBody, context);
613
- value.message = value.message ?? value.Message;
614
- return value;
615
- }, "parseErrorBody");
616
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
617
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
618
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
619
- let cleanValue = rawValue;
620
- if (typeof cleanValue === "number") {
621
- cleanValue = cleanValue.toString();
622
- }
623
- if (cleanValue.indexOf(",") >= 0) {
624
- cleanValue = cleanValue.split(",")[0];
625
- }
626
- if (cleanValue.indexOf(":") >= 0) {
627
- cleanValue = cleanValue.split(":")[0];
628
- }
629
- if (cleanValue.indexOf("#") >= 0) {
630
- cleanValue = cleanValue.split("#")[1];
631
- }
632
- return cleanValue;
633
- }, "sanitizeErrorCode");
634
- const headerKey = findKey(output.headers, "x-amzn-errortype");
635
- if (headerKey !== void 0) {
636
- return sanitizeErrorCode(output.headers[headerKey]);
637
- }
638
- if (data.code !== void 0) {
639
- return sanitizeErrorCode(data.code);
640
- }
641
- if (data["__type"] !== void 0) {
642
- return sanitizeErrorCode(data["__type"]);
643
- }
644
- }, "loadRestJsonErrorCode");
645
605
 
646
606
  // src/commands/DescribeServicesCommand.ts
647
607
  var _DescribeServicesCommand = class _DescribeServicesCommand 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, expectString as __expectString, LazyJsonString as __LazyJsonString, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { AccessDeniedException, ExpiredNextTokenException, InternalErrorException, InvalidNextTokenException, InvalidParameterException, NotFoundException, ThrottlingException, } from "../models/models_0";
@@ -254,43 +255,3 @@ function sharedHeaders(operation) {
254
255
  "x-amz-target": `AWSPriceListService.${operation}`,
255
256
  };
256
257
  }
257
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
258
- if (encoded.length) {
259
- return JSON.parse(encoded);
260
- }
261
- return {};
262
- });
263
- const parseErrorBody = async (errorBody, context) => {
264
- const value = await parseBody(errorBody, context);
265
- value.message = value.message ?? value.Message;
266
- return value;
267
- };
268
- const loadRestJsonErrorCode = (output, data) => {
269
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
270
- const sanitizeErrorCode = (rawValue) => {
271
- let cleanValue = rawValue;
272
- if (typeof cleanValue === "number") {
273
- cleanValue = cleanValue.toString();
274
- }
275
- if (cleanValue.indexOf(",") >= 0) {
276
- cleanValue = cleanValue.split(",")[0];
277
- }
278
- if (cleanValue.indexOf(":") >= 0) {
279
- cleanValue = cleanValue.split(":")[0];
280
- }
281
- if (cleanValue.indexOf("#") >= 0) {
282
- cleanValue = cleanValue.split("#")[1];
283
- }
284
- return cleanValue;
285
- };
286
- const headerKey = findKey(output.headers, "x-amzn-errortype");
287
- if (headerKey !== undefined) {
288
- return sanitizeErrorCode(output.headers[headerKey]);
289
- }
290
- if (data.code !== undefined) {
291
- return sanitizeErrorCode(data.code);
292
- }
293
- if (data["__type"] !== undefined) {
294
- return sanitizeErrorCode(data["__type"]);
295
- }
296
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-pricing",
3
3
  "description": "AWS SDK for JavaScript Pricing 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-pricing",
@@ -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",