@aws-sdk/client-forecastquery 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
@@ -188,6 +188,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
188
188
  var import_types = require("@smithy/types");
189
189
 
190
190
  // src/protocols/Aws_json1_1.ts
191
+ var import_core2 = require("@aws-sdk/core");
191
192
 
192
193
 
193
194
 
@@ -314,7 +315,7 @@ var de_QueryForecastCommand = /* @__PURE__ */ __name(async (output, context) =>
314
315
  if (output.statusCode >= 300) {
315
316
  return de_CommandError(output, context);
316
317
  }
317
- const data = await parseBody(output.body, context);
318
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
318
319
  let contents = {};
319
320
  contents = de_QueryForecastResponse(data, context);
320
321
  const response = {
@@ -327,7 +328,7 @@ var de_QueryWhatIfForecastCommand = /* @__PURE__ */ __name(async (output, contex
327
328
  if (output.statusCode >= 300) {
328
329
  return de_CommandError(output, context);
329
330
  }
330
- const data = await parseBody(output.body, context);
331
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
331
332
  let contents = {};
332
333
  contents = de_QueryWhatIfForecastResponse(data, context);
333
334
  const response = {
@@ -339,9 +340,9 @@ var de_QueryWhatIfForecastCommand = /* @__PURE__ */ __name(async (output, contex
339
340
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
340
341
  const parsedOutput = {
341
342
  ...output,
342
- body: await parseErrorBody(output.body, context)
343
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
343
344
  };
344
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
345
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
345
346
  switch (errorCode) {
346
347
  case "InvalidInputException":
347
348
  case "com.amazonaws.forecastquery#InvalidInputException":
@@ -454,7 +455,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
454
455
  extendedRequestId: output.headers["x-amz-id-2"],
455
456
  cfId: output.headers["x-amz-cf-id"]
456
457
  }), "deserializeMetadata");
457
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
458
458
  var throwDefaultError = (0, import_smithy_client.withBaseException)(ForecastqueryServiceException);
459
459
  var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => {
460
460
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -481,46 +481,6 @@ function sharedHeaders(operation) {
481
481
  };
482
482
  }
483
483
  __name(sharedHeaders, "sharedHeaders");
484
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
485
- if (encoded.length) {
486
- return JSON.parse(encoded);
487
- }
488
- return {};
489
- }), "parseBody");
490
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
491
- const value = await parseBody(errorBody, context);
492
- value.message = value.message ?? value.Message;
493
- return value;
494
- }, "parseErrorBody");
495
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
496
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
497
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
498
- let cleanValue = rawValue;
499
- if (typeof cleanValue === "number") {
500
- cleanValue = cleanValue.toString();
501
- }
502
- if (cleanValue.indexOf(",") >= 0) {
503
- cleanValue = cleanValue.split(",")[0];
504
- }
505
- if (cleanValue.indexOf(":") >= 0) {
506
- cleanValue = cleanValue.split(":")[0];
507
- }
508
- if (cleanValue.indexOf("#") >= 0) {
509
- cleanValue = cleanValue.split("#")[1];
510
- }
511
- return cleanValue;
512
- }, "sanitizeErrorCode");
513
- const headerKey = findKey(output.headers, "x-amzn-errortype");
514
- if (headerKey !== void 0) {
515
- return sanitizeErrorCode(output.headers[headerKey]);
516
- }
517
- if (data.code !== void 0) {
518
- return sanitizeErrorCode(data.code);
519
- }
520
- if (data["__type"] !== void 0) {
521
- return sanitizeErrorCode(data["__type"]);
522
- }
523
- }, "loadRestJsonErrorCode");
524
484
 
525
485
  // src/commands/QueryForecastCommand.ts
526
486
  var _QueryForecastCommand = class _QueryForecastCommand 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, limitedParseDouble as __limitedParseDouble, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { ForecastqueryServiceException as __BaseException } from "../models/ForecastqueryServiceException";
@@ -186,43 +187,3 @@ function sharedHeaders(operation) {
186
187
  "x-amz-target": `AmazonForecastRuntime.${operation}`,
187
188
  };
188
189
  }
189
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
190
- if (encoded.length) {
191
- return JSON.parse(encoded);
192
- }
193
- return {};
194
- });
195
- const parseErrorBody = async (errorBody, context) => {
196
- const value = await parseBody(errorBody, context);
197
- value.message = value.message ?? value.Message;
198
- return value;
199
- };
200
- const loadRestJsonErrorCode = (output, data) => {
201
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
202
- const sanitizeErrorCode = (rawValue) => {
203
- let cleanValue = rawValue;
204
- if (typeof cleanValue === "number") {
205
- cleanValue = cleanValue.toString();
206
- }
207
- if (cleanValue.indexOf(",") >= 0) {
208
- cleanValue = cleanValue.split(",")[0];
209
- }
210
- if (cleanValue.indexOf(":") >= 0) {
211
- cleanValue = cleanValue.split(":")[0];
212
- }
213
- if (cleanValue.indexOf("#") >= 0) {
214
- cleanValue = cleanValue.split("#")[1];
215
- }
216
- return cleanValue;
217
- };
218
- const headerKey = findKey(output.headers, "x-amzn-errortype");
219
- if (headerKey !== undefined) {
220
- return sanitizeErrorCode(output.headers[headerKey]);
221
- }
222
- if (data.code !== undefined) {
223
- return sanitizeErrorCode(data.code);
224
- }
225
- if (data["__type"] !== undefined) {
226
- return sanitizeErrorCode(data["__type"]);
227
- }
228
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-forecastquery",
3
3
  "description": "AWS SDK for JavaScript Forecastquery 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-forecastquery",
@@ -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",