@aws-sdk/client-forecastquery 3.926.0 → 3.928.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
@@ -6,6 +6,7 @@ var middlewareRecursionDetection = require('@aws-sdk/middleware-recursion-detect
6
6
  var middlewareUserAgent = require('@aws-sdk/middleware-user-agent');
7
7
  var configResolver = require('@smithy/config-resolver');
8
8
  var core = require('@smithy/core');
9
+ var schema = require('@smithy/core/schema');
9
10
  var middlewareContentLength = require('@smithy/middleware-content-length');
10
11
  var middlewareEndpoint = require('@smithy/middleware-endpoint');
11
12
  var middlewareRetry = require('@smithy/middleware-retry');
@@ -14,8 +15,6 @@ var httpAuthSchemeProvider = require('./auth/httpAuthSchemeProvider');
14
15
  var runtimeConfig = require('./runtimeConfig');
15
16
  var regionConfigResolver = require('@aws-sdk/region-config-resolver');
16
17
  var protocolHttp = require('@smithy/protocol-http');
17
- var middlewareSerde = require('@smithy/middleware-serde');
18
- var core$1 = require('@aws-sdk/core');
19
18
 
20
19
  const resolveClientEndpointParameters = (options) => {
21
20
  return Object.assign(options, {
@@ -91,6 +90,7 @@ class ForecastqueryClient extends smithyClient.Client {
91
90
  const _config_7 = httpAuthSchemeProvider.resolveHttpAuthSchemeConfig(_config_6);
92
91
  const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);
93
92
  this.config = _config_8;
93
+ this.middlewareStack.use(schema.getSchemaSerdePlugin(this.config));
94
94
  this.middlewareStack.use(middlewareUserAgent.getUserAgentPlugin(this.config));
95
95
  this.middlewareStack.use(middlewareRetry.getRetryPlugin(this.config));
96
96
  this.middlewareStack.use(middlewareContentLength.getContentLengthPlugin(this.config));
@@ -110,14 +110,14 @@ class ForecastqueryClient extends smithyClient.Client {
110
110
  }
111
111
  }
112
112
 
113
- class ForecastqueryServiceException extends smithyClient.ServiceException {
113
+ let ForecastqueryServiceException$1 = class ForecastqueryServiceException extends smithyClient.ServiceException {
114
114
  constructor(options) {
115
115
  super(options);
116
116
  Object.setPrototypeOf(this, ForecastqueryServiceException.prototype);
117
117
  }
118
- }
118
+ };
119
119
 
120
- class InvalidInputException extends ForecastqueryServiceException {
120
+ let InvalidInputException$1 = class InvalidInputException extends ForecastqueryServiceException$1 {
121
121
  name = "InvalidInputException";
122
122
  $fault = "client";
123
123
  Message;
@@ -130,8 +130,8 @@ class InvalidInputException extends ForecastqueryServiceException {
130
130
  Object.setPrototypeOf(this, InvalidInputException.prototype);
131
131
  this.Message = opts.Message;
132
132
  }
133
- }
134
- class InvalidNextTokenException extends ForecastqueryServiceException {
133
+ };
134
+ let InvalidNextTokenException$1 = class InvalidNextTokenException extends ForecastqueryServiceException$1 {
135
135
  name = "InvalidNextTokenException";
136
136
  $fault = "client";
137
137
  Message;
@@ -144,8 +144,8 @@ class InvalidNextTokenException extends ForecastqueryServiceException {
144
144
  Object.setPrototypeOf(this, InvalidNextTokenException.prototype);
145
145
  this.Message = opts.Message;
146
146
  }
147
- }
148
- class LimitExceededException extends ForecastqueryServiceException {
147
+ };
148
+ let LimitExceededException$1 = class LimitExceededException extends ForecastqueryServiceException$1 {
149
149
  name = "LimitExceededException";
150
150
  $fault = "client";
151
151
  Message;
@@ -158,8 +158,8 @@ class LimitExceededException extends ForecastqueryServiceException {
158
158
  Object.setPrototypeOf(this, LimitExceededException.prototype);
159
159
  this.Message = opts.Message;
160
160
  }
161
- }
162
- class ResourceInUseException extends ForecastqueryServiceException {
161
+ };
162
+ let ResourceInUseException$1 = class ResourceInUseException extends ForecastqueryServiceException$1 {
163
163
  name = "ResourceInUseException";
164
164
  $fault = "client";
165
165
  Message;
@@ -172,8 +172,8 @@ class ResourceInUseException extends ForecastqueryServiceException {
172
172
  Object.setPrototypeOf(this, ResourceInUseException.prototype);
173
173
  this.Message = opts.Message;
174
174
  }
175
- }
176
- class ResourceNotFoundException extends ForecastqueryServiceException {
175
+ };
176
+ let ResourceNotFoundException$1 = class ResourceNotFoundException extends ForecastqueryServiceException$1 {
177
177
  name = "ResourceNotFoundException";
178
178
  $fault = "client";
179
179
  Message;
@@ -186,203 +186,147 @@ class ResourceNotFoundException extends ForecastqueryServiceException {
186
186
  Object.setPrototypeOf(this, ResourceNotFoundException.prototype);
187
187
  this.Message = opts.Message;
188
188
  }
189
- }
190
-
191
- const se_QueryForecastCommand = async (input, context) => {
192
- const headers = sharedHeaders("QueryForecast");
193
- let body;
194
- body = JSON.stringify(smithyClient._json(input));
195
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
196
- };
197
- const se_QueryWhatIfForecastCommand = async (input, context) => {
198
- const headers = sharedHeaders("QueryWhatIfForecast");
199
- let body;
200
- body = JSON.stringify(smithyClient._json(input));
201
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
202
- };
203
- const de_QueryForecastCommand = async (output, context) => {
204
- if (output.statusCode >= 300) {
205
- return de_CommandError(output, context);
206
- }
207
- const data = await core$1.parseJsonBody(output.body, context);
208
- let contents = {};
209
- contents = de_QueryForecastResponse(data);
210
- const response = {
211
- $metadata: deserializeMetadata(output),
212
- ...contents,
213
- };
214
- return response;
215
- };
216
- const de_QueryWhatIfForecastCommand = async (output, context) => {
217
- if (output.statusCode >= 300) {
218
- return de_CommandError(output, context);
219
- }
220
- const data = await core$1.parseJsonBody(output.body, context);
221
- let contents = {};
222
- contents = de_QueryWhatIfForecastResponse(data);
223
- const response = {
224
- $metadata: deserializeMetadata(output),
225
- ...contents,
226
- };
227
- return response;
228
- };
229
- const de_CommandError = async (output, context) => {
230
- const parsedOutput = {
231
- ...output,
232
- body: await core$1.parseJsonErrorBody(output.body, context),
233
- };
234
- const errorCode = core$1.loadRestJsonErrorCode(output, parsedOutput.body);
235
- switch (errorCode) {
236
- case "InvalidInputException":
237
- case "com.amazonaws.forecastquery#InvalidInputException":
238
- throw await de_InvalidInputExceptionRes(parsedOutput);
239
- case "InvalidNextTokenException":
240
- case "com.amazonaws.forecastquery#InvalidNextTokenException":
241
- throw await de_InvalidNextTokenExceptionRes(parsedOutput);
242
- case "LimitExceededException":
243
- case "com.amazonaws.forecastquery#LimitExceededException":
244
- throw await de_LimitExceededExceptionRes(parsedOutput);
245
- case "ResourceInUseException":
246
- case "com.amazonaws.forecastquery#ResourceInUseException":
247
- throw await de_ResourceInUseExceptionRes(parsedOutput);
248
- case "ResourceNotFoundException":
249
- case "com.amazonaws.forecastquery#ResourceNotFoundException":
250
- throw await de_ResourceNotFoundExceptionRes(parsedOutput);
251
- default:
252
- const parsedBody = parsedOutput.body;
253
- return throwDefaultError({
254
- output,
255
- parsedBody,
256
- errorCode,
257
- });
258
- }
259
- };
260
- const de_InvalidInputExceptionRes = async (parsedOutput, context) => {
261
- const body = parsedOutput.body;
262
- const deserialized = smithyClient._json(body);
263
- const exception = new InvalidInputException({
264
- $metadata: deserializeMetadata(parsedOutput),
265
- ...deserialized,
266
- });
267
- return smithyClient.decorateServiceException(exception, body);
268
- };
269
- const de_InvalidNextTokenExceptionRes = async (parsedOutput, context) => {
270
- const body = parsedOutput.body;
271
- const deserialized = smithyClient._json(body);
272
- const exception = new InvalidNextTokenException({
273
- $metadata: deserializeMetadata(parsedOutput),
274
- ...deserialized,
275
- });
276
- return smithyClient.decorateServiceException(exception, body);
277
189
  };
278
- const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
279
- const body = parsedOutput.body;
280
- const deserialized = smithyClient._json(body);
281
- const exception = new LimitExceededException({
282
- $metadata: deserializeMetadata(parsedOutput),
283
- ...deserialized,
284
- });
285
- return smithyClient.decorateServiceException(exception, body);
286
- };
287
- const de_ResourceInUseExceptionRes = async (parsedOutput, context) => {
288
- const body = parsedOutput.body;
289
- const deserialized = smithyClient._json(body);
290
- const exception = new ResourceInUseException({
291
- $metadata: deserializeMetadata(parsedOutput),
292
- ...deserialized,
293
- });
294
- return smithyClient.decorateServiceException(exception, body);
295
- };
296
- const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
297
- const body = parsedOutput.body;
298
- const deserialized = smithyClient._json(body);
299
- const exception = new ResourceNotFoundException({
300
- $metadata: deserializeMetadata(parsedOutput),
301
- ...deserialized,
302
- });
303
- return smithyClient.decorateServiceException(exception, body);
304
- };
305
- const de_DataPoint = (output, context) => {
306
- return smithyClient.take(output, {
307
- Timestamp: smithyClient.expectString,
308
- Value: smithyClient.limitedParseDouble,
309
- });
310
- };
311
- const de_Forecast = (output, context) => {
312
- return smithyClient.take(output, {
313
- Predictions: (_) => de_Predictions(_),
314
- });
315
- };
316
- const de_Predictions = (output, context) => {
317
- return Object.entries(output).reduce((acc, [key, value]) => {
318
- if (value === null) {
319
- return acc;
320
- }
321
- acc[key] = de_TimeSeries(value);
322
- return acc;
323
- }, {});
324
- };
325
- const de_QueryForecastResponse = (output, context) => {
326
- return smithyClient.take(output, {
327
- Forecast: (_) => de_Forecast(_),
328
- });
329
- };
330
- const de_QueryWhatIfForecastResponse = (output, context) => {
331
- return smithyClient.take(output, {
332
- Forecast: (_) => de_Forecast(_),
333
- });
334
- };
335
- const de_TimeSeries = (output, context) => {
336
- const retVal = (output || [])
337
- .filter((e) => e != null)
338
- .map((entry) => {
339
- return de_DataPoint(entry);
340
- });
341
- return retVal;
342
- };
343
- const deserializeMetadata = (output) => ({
344
- httpStatusCode: output.statusCode,
345
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
346
- extendedRequestId: output.headers["x-amz-id-2"],
347
- cfId: output.headers["x-amz-cf-id"],
348
- });
349
- const throwDefaultError = smithyClient.withBaseException(ForecastqueryServiceException);
350
- const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
351
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
352
- const contents = {
353
- protocol,
354
- hostname,
355
- port,
356
- method: "POST",
357
- path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
358
- headers,
359
- };
360
- if (body !== undefined) {
361
- contents.body = body;
362
- }
363
- return new protocolHttp.HttpRequest(contents);
364
- };
365
- function sharedHeaders(operation) {
366
- return {
367
- "content-type": "application/x-amz-json-1.1",
368
- "x-amz-target": `AmazonForecastRuntime.${operation}`,
369
- };
370
- }
190
+
191
+ const _DP = "DataPoint";
192
+ const _ED = "EndDate";
193
+ const _F = "Forecast";
194
+ const _FA = "ForecastArn";
195
+ const _Fi = "Filters";
196
+ const _IIE = "InvalidInputException";
197
+ const _INTE = "InvalidNextTokenException";
198
+ const _LEE = "LimitExceededException";
199
+ const _M = "Message";
200
+ const _NT = "NextToken";
201
+ const _P = "Predictions";
202
+ const _QF = "QueryForecast";
203
+ const _QFR = "QueryForecastRequest";
204
+ const _QFRu = "QueryForecastResponse";
205
+ const _QWIF = "QueryWhatIfForecast";
206
+ const _QWIFR = "QueryWhatIfForecastRequest";
207
+ const _QWIFRu = "QueryWhatIfForecastResponse";
208
+ const _RIUE = "ResourceInUseException";
209
+ const _RNFE = "ResourceNotFoundException";
210
+ const _SD = "StartDate";
211
+ const _T = "Timestamp";
212
+ const _TS = "TimeSeries";
213
+ const _V = "Value";
214
+ const _WIFA = "WhatIfForecastArn";
215
+ const _c = "client";
216
+ const _e = "error";
217
+ const _hE = "httpError";
218
+ const _s = "smithy.ts.sdk.synthetic.com.amazonaws.forecastquery";
219
+ const n0 = "com.amazonaws.forecastquery";
220
+ var DataPoint = [3, n0, _DP, 0, [_T, _V], [0, 1]];
221
+ var Forecast = [3, n0, _F, 0, [_P], [() => Predictions]];
222
+ var InvalidInputException = [
223
+ -3,
224
+ n0,
225
+ _IIE,
226
+ {
227
+ [_e]: _c,
228
+ [_hE]: 400,
229
+ },
230
+ [_M],
231
+ [0],
232
+ ];
233
+ schema.TypeRegistry.for(n0).registerError(InvalidInputException, InvalidInputException$1);
234
+ var InvalidNextTokenException = [
235
+ -3,
236
+ n0,
237
+ _INTE,
238
+ {
239
+ [_e]: _c,
240
+ [_hE]: 400,
241
+ },
242
+ [_M],
243
+ [0],
244
+ ];
245
+ schema.TypeRegistry.for(n0).registerError(InvalidNextTokenException, InvalidNextTokenException$1);
246
+ var LimitExceededException = [
247
+ -3,
248
+ n0,
249
+ _LEE,
250
+ {
251
+ [_e]: _c,
252
+ [_hE]: 409,
253
+ },
254
+ [_M],
255
+ [0],
256
+ ];
257
+ schema.TypeRegistry.for(n0).registerError(LimitExceededException, LimitExceededException$1);
258
+ var QueryForecastRequest = [
259
+ 3,
260
+ n0,
261
+ _QFR,
262
+ 0,
263
+ [_FA, _SD, _ED, _Fi, _NT],
264
+ [0, 0, 0, 128 | 0, 0],
265
+ ];
266
+ var QueryForecastResponse = [3, n0, _QFRu, 0, [_F], [() => Forecast]];
267
+ var QueryWhatIfForecastRequest = [
268
+ 3,
269
+ n0,
270
+ _QWIFR,
271
+ 0,
272
+ [_WIFA, _SD, _ED, _Fi, _NT],
273
+ [0, 0, 0, 128 | 0, 0],
274
+ ];
275
+ var QueryWhatIfForecastResponse = [3, n0, _QWIFRu, 0, [_F], [() => Forecast]];
276
+ var ResourceInUseException = [
277
+ -3,
278
+ n0,
279
+ _RIUE,
280
+ {
281
+ [_e]: _c,
282
+ [_hE]: 409,
283
+ },
284
+ [_M],
285
+ [0],
286
+ ];
287
+ schema.TypeRegistry.for(n0).registerError(ResourceInUseException, ResourceInUseException$1);
288
+ var ResourceNotFoundException = [
289
+ -3,
290
+ n0,
291
+ _RNFE,
292
+ {
293
+ [_e]: _c,
294
+ [_hE]: 404,
295
+ },
296
+ [_M],
297
+ [0],
298
+ ];
299
+ schema.TypeRegistry.for(n0).registerError(ResourceNotFoundException, ResourceNotFoundException$1);
300
+ var ForecastqueryServiceException = [-3, _s, "ForecastqueryServiceException", 0, [], []];
301
+ schema.TypeRegistry.for(_s).registerError(ForecastqueryServiceException, ForecastqueryServiceException$1);
302
+ var TimeSeries = [1, n0, _TS, 0, () => DataPoint];
303
+ var Predictions = [2, n0, _P, 0, 0, () => TimeSeries];
304
+ var QueryForecast = [
305
+ 9,
306
+ n0,
307
+ _QF,
308
+ 0,
309
+ () => QueryForecastRequest,
310
+ () => QueryForecastResponse,
311
+ ];
312
+ var QueryWhatIfForecast = [
313
+ 9,
314
+ n0,
315
+ _QWIF,
316
+ 0,
317
+ () => QueryWhatIfForecastRequest,
318
+ () => QueryWhatIfForecastResponse,
319
+ ];
371
320
 
372
321
  class QueryForecastCommand extends smithyClient.Command
373
322
  .classBuilder()
374
323
  .ep(commonParams)
375
324
  .m(function (Command, cs, config, o) {
376
- return [
377
- middlewareSerde.getSerdePlugin(config, this.serialize, this.deserialize),
378
- middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
379
- ];
325
+ return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
380
326
  })
381
327
  .s("AmazonForecastRuntime", "QueryForecast", {})
382
328
  .n("ForecastqueryClient", "QueryForecastCommand")
383
- .f(void 0, void 0)
384
- .ser(se_QueryForecastCommand)
385
- .de(de_QueryForecastCommand)
329
+ .sc(QueryForecast)
386
330
  .build() {
387
331
  }
388
332
 
@@ -390,16 +334,11 @@ class QueryWhatIfForecastCommand extends smithyClient.Command
390
334
  .classBuilder()
391
335
  .ep(commonParams)
392
336
  .m(function (Command, cs, config, o) {
393
- return [
394
- middlewareSerde.getSerdePlugin(config, this.serialize, this.deserialize),
395
- middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
396
- ];
337
+ return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
397
338
  })
398
339
  .s("AmazonForecastRuntime", "QueryWhatIfForecast", {})
399
340
  .n("ForecastqueryClient", "QueryWhatIfForecastCommand")
400
- .f(void 0, void 0)
401
- .ser(se_QueryWhatIfForecastCommand)
402
- .de(de_QueryWhatIfForecastCommand)
341
+ .sc(QueryWhatIfForecast)
403
342
  .build() {
404
343
  }
405
344
 
@@ -421,11 +360,11 @@ Object.defineProperty(exports, "__Client", {
421
360
  });
422
361
  exports.Forecastquery = Forecastquery;
423
362
  exports.ForecastqueryClient = ForecastqueryClient;
424
- exports.ForecastqueryServiceException = ForecastqueryServiceException;
425
- exports.InvalidInputException = InvalidInputException;
426
- exports.InvalidNextTokenException = InvalidNextTokenException;
427
- exports.LimitExceededException = LimitExceededException;
363
+ exports.ForecastqueryServiceException = ForecastqueryServiceException$1;
364
+ exports.InvalidInputException = InvalidInputException$1;
365
+ exports.InvalidNextTokenException = InvalidNextTokenException$1;
366
+ exports.LimitExceededException = LimitExceededException$1;
428
367
  exports.QueryForecastCommand = QueryForecastCommand;
429
368
  exports.QueryWhatIfForecastCommand = QueryWhatIfForecastCommand;
430
- exports.ResourceInUseException = ResourceInUseException;
431
- exports.ResourceNotFoundException = ResourceNotFoundException;
369
+ exports.ResourceInUseException = ResourceInUseException$1;
370
+ exports.ResourceNotFoundException = ResourceNotFoundException$1;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRuntimeConfig = void 0;
4
4
  const core_1 = require("@aws-sdk/core");
5
+ const protocols_1 = require("@aws-sdk/core/protocols");
5
6
  const smithy_client_1 = require("@smithy/smithy-client");
6
7
  const url_parser_1 = require("@smithy/url-parser");
7
8
  const util_base64_1 = require("@smithy/util-base64");
@@ -25,6 +26,12 @@ const getRuntimeConfig = (config) => {
25
26
  },
26
27
  ],
27
28
  logger: config?.logger ?? new smithy_client_1.NoOpLogger(),
29
+ protocol: config?.protocol ??
30
+ new protocols_1.AwsJson1_1Protocol({
31
+ defaultNamespace: "com.amazonaws.forecastquery",
32
+ serviceTarget: "AmazonForecastRuntime",
33
+ awsQueryCompatible: false,
34
+ }),
28
35
  serviceId: config?.serviceId ?? "forecastquery",
29
36
  urlParser: config?.urlParser ?? url_parser_1.parseUrl,
30
37
  utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8,
@@ -4,6 +4,7 @@ import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detec
4
4
  import { getUserAgentPlugin, resolveUserAgentConfig, } from "@aws-sdk/middleware-user-agent";
5
5
  import { resolveRegionConfig } from "@smithy/config-resolver";
6
6
  import { DefaultIdentityProviderConfig, getHttpAuthSchemeEndpointRuleSetPlugin, getHttpSigningPlugin, } from "@smithy/core";
7
+ import { getSchemaSerdePlugin } from "@smithy/core/schema";
7
8
  import { getContentLengthPlugin } from "@smithy/middleware-content-length";
8
9
  import { resolveEndpointConfig } from "@smithy/middleware-endpoint";
9
10
  import { getRetryPlugin, resolveRetryConfig } from "@smithy/middleware-retry";
@@ -28,6 +29,7 @@ export class ForecastqueryClient extends __Client {
28
29
  const _config_7 = resolveHttpAuthSchemeConfig(_config_6);
29
30
  const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);
30
31
  this.config = _config_8;
32
+ this.middlewareStack.use(getSchemaSerdePlugin(this.config));
31
33
  this.middlewareStack.use(getUserAgentPlugin(this.config));
32
34
  this.middlewareStack.use(getRetryPlugin(this.config));
33
35
  this.middlewareStack.use(getContentLengthPlugin(this.config));
@@ -1,22 +1,16 @@
1
1
  import { getEndpointPlugin } from "@smithy/middleware-endpoint";
2
- import { getSerdePlugin } from "@smithy/middleware-serde";
3
2
  import { Command as $Command } from "@smithy/smithy-client";
4
3
  import { commonParams } from "../endpoint/EndpointParameters";
5
- import { de_QueryForecastCommand, se_QueryForecastCommand } from "../protocols/Aws_json1_1";
4
+ import { QueryForecast } from "../schemas/schemas_0";
6
5
  export { $Command };
7
6
  export class QueryForecastCommand extends $Command
8
7
  .classBuilder()
9
8
  .ep(commonParams)
10
9
  .m(function (Command, cs, config, o) {
11
- return [
12
- getSerdePlugin(config, this.serialize, this.deserialize),
13
- getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
14
- ];
10
+ return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
15
11
  })
16
12
  .s("AmazonForecastRuntime", "QueryForecast", {})
17
13
  .n("ForecastqueryClient", "QueryForecastCommand")
18
- .f(void 0, void 0)
19
- .ser(se_QueryForecastCommand)
20
- .de(de_QueryForecastCommand)
14
+ .sc(QueryForecast)
21
15
  .build() {
22
16
  }
@@ -1,22 +1,16 @@
1
1
  import { getEndpointPlugin } from "@smithy/middleware-endpoint";
2
- import { getSerdePlugin } from "@smithy/middleware-serde";
3
2
  import { Command as $Command } from "@smithy/smithy-client";
4
3
  import { commonParams } from "../endpoint/EndpointParameters";
5
- import { de_QueryWhatIfForecastCommand, se_QueryWhatIfForecastCommand } from "../protocols/Aws_json1_1";
4
+ import { QueryWhatIfForecast } from "../schemas/schemas_0";
6
5
  export { $Command };
7
6
  export class QueryWhatIfForecastCommand extends $Command
8
7
  .classBuilder()
9
8
  .ep(commonParams)
10
9
  .m(function (Command, cs, config, o) {
11
- return [
12
- getSerdePlugin(config, this.serialize, this.deserialize),
13
- getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
14
- ];
10
+ return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
15
11
  })
16
12
  .s("AmazonForecastRuntime", "QueryWhatIfForecast", {})
17
13
  .n("ForecastqueryClient", "QueryWhatIfForecastCommand")
18
- .f(void 0, void 0)
19
- .ser(se_QueryWhatIfForecastCommand)
20
- .de(de_QueryWhatIfForecastCommand)
14
+ .sc(QueryWhatIfForecast)
21
15
  .build() {
22
16
  }
@@ -1,4 +1,5 @@
1
1
  import { AwsSdkSigV4Signer } from "@aws-sdk/core";
2
+ import { AwsJson1_1Protocol } from "@aws-sdk/core/protocols";
2
3
  import { NoOpLogger } from "@smithy/smithy-client";
3
4
  import { parseUrl } from "@smithy/url-parser";
4
5
  import { fromBase64, toBase64 } from "@smithy/util-base64";
@@ -22,6 +23,12 @@ export const getRuntimeConfig = (config) => {
22
23
  },
23
24
  ],
24
25
  logger: config?.logger ?? new NoOpLogger(),
26
+ protocol: config?.protocol ??
27
+ new AwsJson1_1Protocol({
28
+ defaultNamespace: "com.amazonaws.forecastquery",
29
+ serviceTarget: "AmazonForecastRuntime",
30
+ awsQueryCompatible: false,
31
+ }),
25
32
  serviceId: config?.serviceId ?? "forecastquery",
26
33
  urlParser: config?.urlParser ?? parseUrl,
27
34
  utf8Decoder: config?.utf8Decoder ?? fromUtf8,
@@ -0,0 +1,133 @@
1
+ const _DP = "DataPoint";
2
+ const _ED = "EndDate";
3
+ const _F = "Forecast";
4
+ const _FA = "ForecastArn";
5
+ const _Fi = "Filters";
6
+ const _IIE = "InvalidInputException";
7
+ const _INTE = "InvalidNextTokenException";
8
+ const _LEE = "LimitExceededException";
9
+ const _M = "Message";
10
+ const _NT = "NextToken";
11
+ const _P = "Predictions";
12
+ const _QF = "QueryForecast";
13
+ const _QFR = "QueryForecastRequest";
14
+ const _QFRu = "QueryForecastResponse";
15
+ const _QWIF = "QueryWhatIfForecast";
16
+ const _QWIFR = "QueryWhatIfForecastRequest";
17
+ const _QWIFRu = "QueryWhatIfForecastResponse";
18
+ const _RIUE = "ResourceInUseException";
19
+ const _RNFE = "ResourceNotFoundException";
20
+ const _SD = "StartDate";
21
+ const _T = "Timestamp";
22
+ const _TS = "TimeSeries";
23
+ const _V = "Value";
24
+ const _WIFA = "WhatIfForecastArn";
25
+ const _c = "client";
26
+ const _e = "error";
27
+ const _hE = "httpError";
28
+ const _s = "smithy.ts.sdk.synthetic.com.amazonaws.forecastquery";
29
+ const n0 = "com.amazonaws.forecastquery";
30
+ import { TypeRegistry } from "@smithy/core/schema";
31
+ import { ForecastqueryServiceException as __ForecastqueryServiceException } from "../models/ForecastqueryServiceException";
32
+ import { InvalidInputException as __InvalidInputException, InvalidNextTokenException as __InvalidNextTokenException, LimitExceededException as __LimitExceededException, ResourceInUseException as __ResourceInUseException, ResourceNotFoundException as __ResourceNotFoundException, } from "../models/index";
33
+ export var DataPoint = [3, n0, _DP, 0, [_T, _V], [0, 1]];
34
+ export var Forecast = [3, n0, _F, 0, [_P], [() => Predictions]];
35
+ export var InvalidInputException = [
36
+ -3,
37
+ n0,
38
+ _IIE,
39
+ {
40
+ [_e]: _c,
41
+ [_hE]: 400,
42
+ },
43
+ [_M],
44
+ [0],
45
+ ];
46
+ TypeRegistry.for(n0).registerError(InvalidInputException, __InvalidInputException);
47
+ export var InvalidNextTokenException = [
48
+ -3,
49
+ n0,
50
+ _INTE,
51
+ {
52
+ [_e]: _c,
53
+ [_hE]: 400,
54
+ },
55
+ [_M],
56
+ [0],
57
+ ];
58
+ TypeRegistry.for(n0).registerError(InvalidNextTokenException, __InvalidNextTokenException);
59
+ export var LimitExceededException = [
60
+ -3,
61
+ n0,
62
+ _LEE,
63
+ {
64
+ [_e]: _c,
65
+ [_hE]: 409,
66
+ },
67
+ [_M],
68
+ [0],
69
+ ];
70
+ TypeRegistry.for(n0).registerError(LimitExceededException, __LimitExceededException);
71
+ export var QueryForecastRequest = [
72
+ 3,
73
+ n0,
74
+ _QFR,
75
+ 0,
76
+ [_FA, _SD, _ED, _Fi, _NT],
77
+ [0, 0, 0, 128 | 0, 0],
78
+ ];
79
+ export var QueryForecastResponse = [3, n0, _QFRu, 0, [_F], [() => Forecast]];
80
+ export var QueryWhatIfForecastRequest = [
81
+ 3,
82
+ n0,
83
+ _QWIFR,
84
+ 0,
85
+ [_WIFA, _SD, _ED, _Fi, _NT],
86
+ [0, 0, 0, 128 | 0, 0],
87
+ ];
88
+ export var QueryWhatIfForecastResponse = [3, n0, _QWIFRu, 0, [_F], [() => Forecast]];
89
+ export var ResourceInUseException = [
90
+ -3,
91
+ n0,
92
+ _RIUE,
93
+ {
94
+ [_e]: _c,
95
+ [_hE]: 409,
96
+ },
97
+ [_M],
98
+ [0],
99
+ ];
100
+ TypeRegistry.for(n0).registerError(ResourceInUseException, __ResourceInUseException);
101
+ export var ResourceNotFoundException = [
102
+ -3,
103
+ n0,
104
+ _RNFE,
105
+ {
106
+ [_e]: _c,
107
+ [_hE]: 404,
108
+ },
109
+ [_M],
110
+ [0],
111
+ ];
112
+ TypeRegistry.for(n0).registerError(ResourceNotFoundException, __ResourceNotFoundException);
113
+ export var ForecastqueryServiceException = [-3, _s, "ForecastqueryServiceException", 0, [], []];
114
+ TypeRegistry.for(_s).registerError(ForecastqueryServiceException, __ForecastqueryServiceException);
115
+ export var TimeSeries = [1, n0, _TS, 0, () => DataPoint];
116
+ export var Filters = 128 | 0;
117
+ export var Predictions = [2, n0, _P, 0, 0, () => TimeSeries];
118
+ export var QueryForecast = [
119
+ 9,
120
+ n0,
121
+ _QF,
122
+ 0,
123
+ () => QueryForecastRequest,
124
+ () => QueryForecastResponse,
125
+ ];
126
+ export var QueryWhatIfForecast = [
127
+ 9,
128
+ n0,
129
+ _QWIF,
130
+ 0,
131
+ () => QueryWhatIfForecastRequest,
132
+ () => QueryWhatIfForecastResponse,
133
+ ];
@@ -5,7 +5,7 @@ import { EndpointInputConfig, EndpointResolvedConfig } from "@smithy/middleware-
5
5
  import { RetryInputConfig, RetryResolvedConfig } from "@smithy/middleware-retry";
6
6
  import { HttpHandlerUserInput as __HttpHandlerUserInput } from "@smithy/protocol-http";
7
7
  import { Client as __Client, DefaultsMode as __DefaultsMode, SmithyConfiguration as __SmithyConfiguration, SmithyResolvedConfiguration as __SmithyResolvedConfiguration } from "@smithy/smithy-client";
8
- import { AwsCredentialIdentityProvider, BodyLengthCalculator as __BodyLengthCalculator, CheckOptionalClientConfig as __CheckOptionalClientConfig, ChecksumConstructor as __ChecksumConstructor, Decoder as __Decoder, Encoder as __Encoder, HashConstructor as __HashConstructor, HttpHandlerOptions as __HttpHandlerOptions, Logger as __Logger, Provider as __Provider, Provider, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent } from "@smithy/types";
8
+ import { AwsCredentialIdentityProvider, BodyLengthCalculator as __BodyLengthCalculator, CheckOptionalClientConfig as __CheckOptionalClientConfig, ChecksumConstructor as __ChecksumConstructor, ClientProtocol, Decoder as __Decoder, Encoder as __Encoder, HashConstructor as __HashConstructor, HttpHandlerOptions as __HttpHandlerOptions, HttpRequest, HttpResponse, Logger as __Logger, Provider as __Provider, Provider, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent } from "@smithy/types";
9
9
  import { HttpAuthSchemeInputConfig, HttpAuthSchemeResolvedConfig } from "./auth/httpAuthSchemeProvider";
10
10
  import { QueryForecastCommandInput, QueryForecastCommandOutput } from "./commands/QueryForecastCommand";
11
11
  import { QueryWhatIfForecastCommandInput, QueryWhatIfForecastCommandOutput } from "./commands/QueryWhatIfForecastCommand";
@@ -143,6 +143,15 @@ export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHand
143
143
  * Optional extensions
144
144
  */
145
145
  extensions?: RuntimeExtension[];
146
+ /**
147
+ * The protocol controlling the message type (e.g. HTTP) and format (e.g. JSON)
148
+ * may be overridden. A default will always be set by the client.
149
+ * Available options depend on the service's supported protocols and will not be validated by
150
+ * the client.
151
+ * @alpha
152
+ *
153
+ */
154
+ protocol?: ClientProtocol<HttpRequest, HttpResponse>;
146
155
  /**
147
156
  * The {@link @smithy/smithy-client#DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK.
148
157
  */
@@ -29,6 +29,7 @@ export declare const getRuntimeConfig: (config: ForecastqueryClientConfig) => {
29
29
  profile?: string;
30
30
  logger: import("@smithy/types").Logger;
31
31
  extensions: import("./runtimeExtensions").RuntimeExtension[];
32
+ protocol: import("@smithy/types").ClientProtocol<import("@smithy/types").HttpRequest, import("@smithy/types").HttpResponse>;
32
33
  customUserAgent?: string | import("@smithy/types").UserAgent;
33
34
  userAgentAppId?: string | undefined | import("@smithy/types").Provider<string | undefined>;
34
35
  retryStrategy?: import("@smithy/types").RetryStrategy | import("@smithy/types").RetryStrategyV2;
@@ -31,6 +31,7 @@ export declare const getRuntimeConfig: (config: ForecastqueryClientConfig) => {
31
31
  profile?: string;
32
32
  logger: import("@smithy/types").Logger;
33
33
  extensions: import("./runtimeExtensions").RuntimeExtension[];
34
+ protocol: import("@smithy/types").ClientProtocol<import("@smithy/types").HttpRequest, import("@smithy/types").HttpResponse>;
34
35
  customUserAgent?: string | import("@smithy/types").UserAgent;
35
36
  retryStrategy?: import("@smithy/types").RetryStrategy | import("@smithy/types").RetryStrategyV2;
36
37
  endpoint?: ((string | import("@smithy/types").Endpoint | import("@smithy/types").Provider<import("@smithy/types").Endpoint> | import("@smithy/types").EndpointV2 | import("@smithy/types").Provider<import("@smithy/types").EndpointV2>) & (string | import("@smithy/types").Provider<string> | import("@smithy/types").Endpoint | import("@smithy/types").Provider<import("@smithy/types").Endpoint> | import("@smithy/types").EndpointV2 | import("@smithy/types").Provider<import("@smithy/types").EndpointV2>)) | undefined;
@@ -27,6 +27,7 @@ export declare const getRuntimeConfig: (config: ForecastqueryClientConfig) => {
27
27
  retryMode: string | import("@smithy/types").Provider<string>;
28
28
  logger: import("@smithy/types").Logger;
29
29
  extensions: import("./runtimeExtensions").RuntimeExtension[];
30
+ protocol: import("@smithy/types").ClientProtocol<import("@smithy/types").HttpRequest, import("@smithy/types").HttpResponse>;
30
31
  defaultsMode: import("@smithy/smithy-client").DefaultsMode | import("@smithy/types").Provider<import("@smithy/smithy-client").DefaultsMode>;
31
32
  customUserAgent?: string | import("@smithy/types").UserAgent;
32
33
  userAgentAppId?: string | undefined | import("@smithy/types").Provider<string | undefined>;
@@ -14,6 +14,7 @@ export declare const getRuntimeConfig: (config: ForecastqueryClientConfig) => {
14
14
  httpAuthSchemeProvider: import("./auth/httpAuthSchemeProvider").ForecastqueryHttpAuthSchemeProvider;
15
15
  httpAuthSchemes: import("@smithy/types").HttpAuthScheme[];
16
16
  logger: import("@smithy/types").Logger;
17
+ protocol: import("@smithy/types").ClientProtocol<import("@smithy/types").HttpRequest, import("@smithy/types").HttpResponse>;
17
18
  serviceId: string;
18
19
  urlParser: import("@smithy/types").UrlParser;
19
20
  utf8Decoder: import("@smithy/types").Decoder;
@@ -0,0 +1,18 @@
1
+ import { StaticErrorSchema, StaticListSchema, StaticMapSchema, StaticOperationSchema, StaticStructureSchema } from "@smithy/types";
2
+ export declare var DataPoint: StaticStructureSchema;
3
+ export declare var Forecast: StaticStructureSchema;
4
+ export declare var InvalidInputException: StaticErrorSchema;
5
+ export declare var InvalidNextTokenException: StaticErrorSchema;
6
+ export declare var LimitExceededException: StaticErrorSchema;
7
+ export declare var QueryForecastRequest: StaticStructureSchema;
8
+ export declare var QueryForecastResponse: StaticStructureSchema;
9
+ export declare var QueryWhatIfForecastRequest: StaticStructureSchema;
10
+ export declare var QueryWhatIfForecastResponse: StaticStructureSchema;
11
+ export declare var ResourceInUseException: StaticErrorSchema;
12
+ export declare var ResourceNotFoundException: StaticErrorSchema;
13
+ export declare var ForecastqueryServiceException: StaticErrorSchema;
14
+ export declare var TimeSeries: StaticListSchema;
15
+ export declare var Filters: number;
16
+ export declare var Predictions: StaticMapSchema;
17
+ export declare var QueryForecast: StaticOperationSchema;
18
+ export declare var QueryWhatIfForecast: StaticOperationSchema;
@@ -30,10 +30,13 @@ import {
30
30
  BodyLengthCalculator as __BodyLengthCalculator,
31
31
  CheckOptionalClientConfig as __CheckOptionalClientConfig,
32
32
  ChecksumConstructor as __ChecksumConstructor,
33
+ ClientProtocol,
33
34
  Decoder as __Decoder,
34
35
  Encoder as __Encoder,
35
36
  HashConstructor as __HashConstructor,
36
37
  HttpHandlerOptions as __HttpHandlerOptions,
38
+ HttpRequest,
39
+ HttpResponse,
37
40
  Logger as __Logger,
38
41
  Provider as __Provider,
39
42
  Provider,
@@ -90,6 +93,7 @@ export interface ClientDefaults
90
93
  retryMode?: string | __Provider<string>;
91
94
  logger?: __Logger;
92
95
  extensions?: RuntimeExtension[];
96
+ protocol?: ClientProtocol<HttpRequest, HttpResponse>;
93
97
  defaultsMode?: __DefaultsMode | __Provider<__DefaultsMode>;
94
98
  }
95
99
  export type ForecastqueryClientConfigType = Partial<
@@ -38,6 +38,10 @@ export declare const getRuntimeConfig: (config: ForecastqueryClientConfig) => {
38
38
  profile?: string;
39
39
  logger: import("@smithy/types").Logger;
40
40
  extensions: import("./runtimeExtensions").RuntimeExtension[];
41
+ protocol: import("@smithy/types").ClientProtocol<
42
+ import("@smithy/types").HttpRequest,
43
+ import("@smithy/types").HttpResponse
44
+ >;
41
45
  customUserAgent?: string | import("@smithy/types").UserAgent;
42
46
  userAgentAppId?:
43
47
  | string
@@ -38,6 +38,10 @@ export declare const getRuntimeConfig: (config: ForecastqueryClientConfig) => {
38
38
  profile?: string;
39
39
  logger: import("@smithy/types").Logger;
40
40
  extensions: import("./runtimeExtensions").RuntimeExtension[];
41
+ protocol: import("@smithy/types").ClientProtocol<
42
+ import("@smithy/types").HttpRequest,
43
+ import("@smithy/types").HttpResponse
44
+ >;
41
45
  customUserAgent?: string | import("@smithy/types").UserAgent;
42
46
  retryStrategy?:
43
47
  | import("@smithy/types").RetryStrategy
@@ -37,6 +37,10 @@ export declare const getRuntimeConfig: (config: ForecastqueryClientConfig) => {
37
37
  retryMode: string | import("@smithy/types").Provider<string>;
38
38
  logger: import("@smithy/types").Logger;
39
39
  extensions: import("./runtimeExtensions").RuntimeExtension[];
40
+ protocol: import("@smithy/types").ClientProtocol<
41
+ import("@smithy/types").HttpRequest,
42
+ import("@smithy/types").HttpResponse
43
+ >;
40
44
  defaultsMode:
41
45
  | import("@smithy/smithy-client").DefaultsMode
42
46
  | import("@smithy/types").Provider<
@@ -14,6 +14,10 @@ export declare const getRuntimeConfig: (config: ForecastqueryClientConfig) => {
14
14
  httpAuthSchemeProvider: import("./auth/httpAuthSchemeProvider").ForecastqueryHttpAuthSchemeProvider;
15
15
  httpAuthSchemes: import("@smithy/types").HttpAuthScheme[];
16
16
  logger: import("@smithy/types").Logger;
17
+ protocol: import("@smithy/types").ClientProtocol<
18
+ import("@smithy/types").HttpRequest,
19
+ import("@smithy/types").HttpResponse
20
+ >;
17
21
  serviceId: string;
18
22
  urlParser: import("@smithy/types").UrlParser;
19
23
  utf8Decoder: import("@smithy/types").Decoder;
@@ -0,0 +1,24 @@
1
+ import {
2
+ StaticErrorSchema,
3
+ StaticListSchema,
4
+ StaticMapSchema,
5
+ StaticOperationSchema,
6
+ StaticStructureSchema,
7
+ } from "@smithy/types";
8
+ export declare var DataPoint: StaticStructureSchema;
9
+ export declare var Forecast: StaticStructureSchema;
10
+ export declare var InvalidInputException: StaticErrorSchema;
11
+ export declare var InvalidNextTokenException: StaticErrorSchema;
12
+ export declare var LimitExceededException: StaticErrorSchema;
13
+ export declare var QueryForecastRequest: StaticStructureSchema;
14
+ export declare var QueryForecastResponse: StaticStructureSchema;
15
+ export declare var QueryWhatIfForecastRequest: StaticStructureSchema;
16
+ export declare var QueryWhatIfForecastResponse: StaticStructureSchema;
17
+ export declare var ResourceInUseException: StaticErrorSchema;
18
+ export declare var ResourceNotFoundException: StaticErrorSchema;
19
+ export declare var ForecastqueryServiceException: StaticErrorSchema;
20
+ export declare var TimeSeries: StaticListSchema;
21
+ export declare var Filters: number;
22
+ export declare var Predictions: StaticMapSchema;
23
+ export declare var QueryForecast: StaticOperationSchema;
24
+ export declare var QueryWhatIfForecast: StaticOperationSchema;
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.926.0",
4
+ "version": "3.928.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,17 +20,17 @@
20
20
  "dependencies": {
21
21
  "@aws-crypto/sha256-browser": "5.2.0",
22
22
  "@aws-crypto/sha256-js": "5.2.0",
23
- "@aws-sdk/core": "3.926.0",
24
- "@aws-sdk/credential-provider-node": "3.926.0",
23
+ "@aws-sdk/core": "3.928.0",
24
+ "@aws-sdk/credential-provider-node": "3.928.0",
25
25
  "@aws-sdk/middleware-host-header": "3.922.0",
26
26
  "@aws-sdk/middleware-logger": "3.922.0",
27
27
  "@aws-sdk/middleware-recursion-detection": "3.922.0",
28
- "@aws-sdk/middleware-user-agent": "3.926.0",
28
+ "@aws-sdk/middleware-user-agent": "3.928.0",
29
29
  "@aws-sdk/region-config-resolver": "3.925.0",
30
30
  "@aws-sdk/types": "3.922.0",
31
31
  "@aws-sdk/util-endpoints": "3.922.0",
32
32
  "@aws-sdk/util-user-agent-browser": "3.922.0",
33
- "@aws-sdk/util-user-agent-node": "3.926.0",
33
+ "@aws-sdk/util-user-agent-node": "3.928.0",
34
34
  "@smithy/config-resolver": "^4.4.2",
35
35
  "@smithy/core": "^3.17.2",
36
36
  "@smithy/fetch-http-handler": "^5.3.5",
@@ -1,189 +0,0 @@
1
- import { loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody } from "@aws-sdk/core";
2
- import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
3
- import { _json, collectBody, decorateServiceException as __decorateServiceException, expectString as __expectString, limitedParseDouble as __limitedParseDouble, take, withBaseException, } from "@smithy/smithy-client";
4
- import { ForecastqueryServiceException as __BaseException } from "../models/ForecastqueryServiceException";
5
- import { InvalidInputException, InvalidNextTokenException, LimitExceededException, ResourceInUseException, ResourceNotFoundException, } from "../models/models_0";
6
- export const se_QueryForecastCommand = async (input, context) => {
7
- const headers = sharedHeaders("QueryForecast");
8
- let body;
9
- body = JSON.stringify(_json(input));
10
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
11
- };
12
- export const se_QueryWhatIfForecastCommand = async (input, context) => {
13
- const headers = sharedHeaders("QueryWhatIfForecast");
14
- let body;
15
- body = JSON.stringify(_json(input));
16
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
17
- };
18
- export const de_QueryForecastCommand = async (output, context) => {
19
- if (output.statusCode >= 300) {
20
- return de_CommandError(output, context);
21
- }
22
- const data = await parseBody(output.body, context);
23
- let contents = {};
24
- contents = de_QueryForecastResponse(data, context);
25
- const response = {
26
- $metadata: deserializeMetadata(output),
27
- ...contents,
28
- };
29
- return response;
30
- };
31
- export const de_QueryWhatIfForecastCommand = async (output, context) => {
32
- if (output.statusCode >= 300) {
33
- return de_CommandError(output, context);
34
- }
35
- const data = await parseBody(output.body, context);
36
- let contents = {};
37
- contents = de_QueryWhatIfForecastResponse(data, context);
38
- const response = {
39
- $metadata: deserializeMetadata(output),
40
- ...contents,
41
- };
42
- return response;
43
- };
44
- const de_CommandError = async (output, context) => {
45
- const parsedOutput = {
46
- ...output,
47
- body: await parseErrorBody(output.body, context),
48
- };
49
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
50
- switch (errorCode) {
51
- case "InvalidInputException":
52
- case "com.amazonaws.forecastquery#InvalidInputException":
53
- throw await de_InvalidInputExceptionRes(parsedOutput, context);
54
- case "InvalidNextTokenException":
55
- case "com.amazonaws.forecastquery#InvalidNextTokenException":
56
- throw await de_InvalidNextTokenExceptionRes(parsedOutput, context);
57
- case "LimitExceededException":
58
- case "com.amazonaws.forecastquery#LimitExceededException":
59
- throw await de_LimitExceededExceptionRes(parsedOutput, context);
60
- case "ResourceInUseException":
61
- case "com.amazonaws.forecastquery#ResourceInUseException":
62
- throw await de_ResourceInUseExceptionRes(parsedOutput, context);
63
- case "ResourceNotFoundException":
64
- case "com.amazonaws.forecastquery#ResourceNotFoundException":
65
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
66
- default:
67
- const parsedBody = parsedOutput.body;
68
- return throwDefaultError({
69
- output,
70
- parsedBody,
71
- errorCode,
72
- });
73
- }
74
- };
75
- const de_InvalidInputExceptionRes = async (parsedOutput, context) => {
76
- const body = parsedOutput.body;
77
- const deserialized = _json(body);
78
- const exception = new InvalidInputException({
79
- $metadata: deserializeMetadata(parsedOutput),
80
- ...deserialized,
81
- });
82
- return __decorateServiceException(exception, body);
83
- };
84
- const de_InvalidNextTokenExceptionRes = async (parsedOutput, context) => {
85
- const body = parsedOutput.body;
86
- const deserialized = _json(body);
87
- const exception = new InvalidNextTokenException({
88
- $metadata: deserializeMetadata(parsedOutput),
89
- ...deserialized,
90
- });
91
- return __decorateServiceException(exception, body);
92
- };
93
- const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
94
- const body = parsedOutput.body;
95
- const deserialized = _json(body);
96
- const exception = new LimitExceededException({
97
- $metadata: deserializeMetadata(parsedOutput),
98
- ...deserialized,
99
- });
100
- return __decorateServiceException(exception, body);
101
- };
102
- const de_ResourceInUseExceptionRes = async (parsedOutput, context) => {
103
- const body = parsedOutput.body;
104
- const deserialized = _json(body);
105
- const exception = new ResourceInUseException({
106
- $metadata: deserializeMetadata(parsedOutput),
107
- ...deserialized,
108
- });
109
- return __decorateServiceException(exception, body);
110
- };
111
- const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
112
- const body = parsedOutput.body;
113
- const deserialized = _json(body);
114
- const exception = new ResourceNotFoundException({
115
- $metadata: deserializeMetadata(parsedOutput),
116
- ...deserialized,
117
- });
118
- return __decorateServiceException(exception, body);
119
- };
120
- const de_DataPoint = (output, context) => {
121
- return take(output, {
122
- Timestamp: __expectString,
123
- Value: __limitedParseDouble,
124
- });
125
- };
126
- const de_Forecast = (output, context) => {
127
- return take(output, {
128
- Predictions: (_) => de_Predictions(_, context),
129
- });
130
- };
131
- const de_Predictions = (output, context) => {
132
- return Object.entries(output).reduce((acc, [key, value]) => {
133
- if (value === null) {
134
- return acc;
135
- }
136
- acc[key] = de_TimeSeries(value, context);
137
- return acc;
138
- }, {});
139
- };
140
- const de_QueryForecastResponse = (output, context) => {
141
- return take(output, {
142
- Forecast: (_) => de_Forecast(_, context),
143
- });
144
- };
145
- const de_QueryWhatIfForecastResponse = (output, context) => {
146
- return take(output, {
147
- Forecast: (_) => de_Forecast(_, context),
148
- });
149
- };
150
- const de_TimeSeries = (output, context) => {
151
- const retVal = (output || [])
152
- .filter((e) => e != null)
153
- .map((entry) => {
154
- return de_DataPoint(entry, context);
155
- });
156
- return retVal;
157
- };
158
- const deserializeMetadata = (output) => ({
159
- httpStatusCode: output.statusCode,
160
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
161
- extendedRequestId: output.headers["x-amz-id-2"],
162
- cfId: output.headers["x-amz-cf-id"],
163
- });
164
- const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
165
- const throwDefaultError = withBaseException(__BaseException);
166
- const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
167
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
168
- const contents = {
169
- protocol,
170
- hostname,
171
- port,
172
- method: "POST",
173
- path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
174
- headers,
175
- };
176
- if (resolvedHostname !== undefined) {
177
- contents.hostname = resolvedHostname;
178
- }
179
- if (body !== undefined) {
180
- contents.body = body;
181
- }
182
- return new __HttpRequest(contents);
183
- };
184
- function sharedHeaders(operation) {
185
- return {
186
- "content-type": "application/x-amz-json-1.1",
187
- "x-amz-target": `AmazonForecastRuntime.${operation}`,
188
- };
189
- }
@@ -1,20 +0,0 @@
1
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
2
- import { SerdeContext as __SerdeContext } from "@smithy/types";
3
- import { QueryForecastCommandInput, QueryForecastCommandOutput } from "../commands/QueryForecastCommand";
4
- import { QueryWhatIfForecastCommandInput, QueryWhatIfForecastCommandOutput } from "../commands/QueryWhatIfForecastCommand";
5
- /**
6
- * serializeAws_json1_1QueryForecastCommand
7
- */
8
- export declare const se_QueryForecastCommand: (input: QueryForecastCommandInput, context: __SerdeContext) => Promise<__HttpRequest>;
9
- /**
10
- * serializeAws_json1_1QueryWhatIfForecastCommand
11
- */
12
- export declare const se_QueryWhatIfForecastCommand: (input: QueryWhatIfForecastCommandInput, context: __SerdeContext) => Promise<__HttpRequest>;
13
- /**
14
- * deserializeAws_json1_1QueryForecastCommand
15
- */
16
- export declare const de_QueryForecastCommand: (output: __HttpResponse, context: __SerdeContext) => Promise<QueryForecastCommandOutput>;
17
- /**
18
- * deserializeAws_json1_1QueryWhatIfForecastCommand
19
- */
20
- export declare const de_QueryWhatIfForecastCommand: (output: __HttpResponse, context: __SerdeContext) => Promise<QueryWhatIfForecastCommandOutput>;
@@ -1,29 +0,0 @@
1
- import {
2
- HttpRequest as __HttpRequest,
3
- HttpResponse as __HttpResponse,
4
- } from "@smithy/protocol-http";
5
- import { SerdeContext as __SerdeContext } from "@smithy/types";
6
- import {
7
- QueryForecastCommandInput,
8
- QueryForecastCommandOutput,
9
- } from "../commands/QueryForecastCommand";
10
- import {
11
- QueryWhatIfForecastCommandInput,
12
- QueryWhatIfForecastCommandOutput,
13
- } from "../commands/QueryWhatIfForecastCommand";
14
- export declare const se_QueryForecastCommand: (
15
- input: QueryForecastCommandInput,
16
- context: __SerdeContext
17
- ) => Promise<__HttpRequest>;
18
- export declare const se_QueryWhatIfForecastCommand: (
19
- input: QueryWhatIfForecastCommandInput,
20
- context: __SerdeContext
21
- ) => Promise<__HttpRequest>;
22
- export declare const de_QueryForecastCommand: (
23
- output: __HttpResponse,
24
- context: __SerdeContext
25
- ) => Promise<QueryForecastCommandOutput>;
26
- export declare const de_QueryWhatIfForecastCommand: (
27
- output: __HttpResponse,
28
- context: __SerdeContext
29
- ) => Promise<QueryWhatIfForecastCommandOutput>;