@aws-sdk/client-forecastquery 3.180.0 → 3.183.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.
@@ -1,285 +1,250 @@
1
- import { __assign, __awaiter, __generator, __read } from "tslib";
2
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
3
2
  import { decorateServiceException as __decorateServiceException, expectString as __expectString, limitedParseDouble as __limitedParseDouble, throwDefaultError, } from "@aws-sdk/smithy-client";
4
3
  import { ForecastqueryServiceException as __BaseException } from "../models/ForecastqueryServiceException";
5
4
  import { InvalidInputException, InvalidNextTokenException, LimitExceededException, ResourceInUseException, ResourceNotFoundException, } from "../models/models_0";
6
- export var serializeAws_json1_1QueryForecastCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
7
- var headers, body;
8
- return __generator(this, function (_a) {
9
- headers = {
10
- "content-type": "application/x-amz-json-1.1",
11
- "x-amz-target": "AmazonForecastRuntime.QueryForecast",
12
- };
13
- body = JSON.stringify(serializeAws_json1_1QueryForecastRequest(input, context));
14
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
15
- });
16
- }); };
17
- export var serializeAws_json1_1QueryWhatIfForecastCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
18
- var headers, body;
19
- return __generator(this, function (_a) {
20
- headers = {
21
- "content-type": "application/x-amz-json-1.1",
22
- "x-amz-target": "AmazonForecastRuntime.QueryWhatIfForecast",
23
- };
24
- body = JSON.stringify(serializeAws_json1_1QueryWhatIfForecastRequest(input, context));
25
- return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
26
- });
27
- }); };
28
- export var deserializeAws_json1_1QueryForecastCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
29
- var data, contents, response;
30
- return __generator(this, function (_a) {
31
- switch (_a.label) {
32
- case 0:
33
- if (output.statusCode >= 300) {
34
- return [2, deserializeAws_json1_1QueryForecastCommandError(output, context)];
35
- }
36
- return [4, parseBody(output.body, context)];
37
- case 1:
38
- data = _a.sent();
39
- contents = {};
40
- contents = deserializeAws_json1_1QueryForecastResponse(data, context);
41
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
42
- return [2, Promise.resolve(response)];
43
- }
44
- });
45
- }); };
46
- var deserializeAws_json1_1QueryForecastCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
47
- var parsedOutput, _a, errorCode, _b, parsedBody;
48
- var _c;
49
- return __generator(this, function (_d) {
50
- switch (_d.label) {
51
- case 0:
52
- _a = [__assign({}, output)];
53
- _c = {};
54
- return [4, parseBody(output.body, context)];
55
- case 1:
56
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
57
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
58
- _b = errorCode;
59
- switch (_b) {
60
- case "InvalidInputException": return [3, 2];
61
- case "com.amazonaws.forecastquery#InvalidInputException": return [3, 2];
62
- case "InvalidNextTokenException": return [3, 4];
63
- case "com.amazonaws.forecastquery#InvalidNextTokenException": return [3, 4];
64
- case "LimitExceededException": return [3, 6];
65
- case "com.amazonaws.forecastquery#LimitExceededException": return [3, 6];
66
- case "ResourceInUseException": return [3, 8];
67
- case "com.amazonaws.forecastquery#ResourceInUseException": return [3, 8];
68
- case "ResourceNotFoundException": return [3, 10];
69
- case "com.amazonaws.forecastquery#ResourceNotFoundException": return [3, 10];
70
- }
71
- return [3, 12];
72
- case 2: return [4, deserializeAws_json1_1InvalidInputExceptionResponse(parsedOutput, context)];
73
- case 3: throw _d.sent();
74
- case 4: return [4, deserializeAws_json1_1InvalidNextTokenExceptionResponse(parsedOutput, context)];
75
- case 5: throw _d.sent();
76
- case 6: return [4, deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)];
77
- case 7: throw _d.sent();
78
- case 8: return [4, deserializeAws_json1_1ResourceInUseExceptionResponse(parsedOutput, context)];
79
- case 9: throw _d.sent();
80
- case 10: return [4, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];
81
- case 11: throw _d.sent();
82
- case 12:
83
- parsedBody = parsedOutput.body;
84
- throwDefaultError({
85
- output: output,
86
- parsedBody: parsedBody,
87
- exceptionCtor: __BaseException,
88
- errorCode: errorCode,
89
- });
90
- _d.label = 13;
91
- case 13: return [2];
92
- }
93
- });
94
- }); };
95
- export var deserializeAws_json1_1QueryWhatIfForecastCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
96
- var data, contents, response;
97
- return __generator(this, function (_a) {
98
- switch (_a.label) {
99
- case 0:
100
- if (output.statusCode >= 300) {
101
- return [2, deserializeAws_json1_1QueryWhatIfForecastCommandError(output, context)];
102
- }
103
- return [4, parseBody(output.body, context)];
104
- case 1:
105
- data = _a.sent();
106
- contents = {};
107
- contents = deserializeAws_json1_1QueryWhatIfForecastResponse(data, context);
108
- response = __assign({ $metadata: deserializeMetadata(output) }, contents);
109
- return [2, Promise.resolve(response)];
110
- }
111
- });
112
- }); };
113
- var deserializeAws_json1_1QueryWhatIfForecastCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
114
- var parsedOutput, _a, errorCode, _b, parsedBody;
115
- var _c;
116
- return __generator(this, function (_d) {
117
- switch (_d.label) {
118
- case 0:
119
- _a = [__assign({}, output)];
120
- _c = {};
121
- return [4, parseBody(output.body, context)];
122
- case 1:
123
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
124
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
125
- _b = errorCode;
126
- switch (_b) {
127
- case "InvalidInputException": return [3, 2];
128
- case "com.amazonaws.forecastquery#InvalidInputException": return [3, 2];
129
- case "InvalidNextTokenException": return [3, 4];
130
- case "com.amazonaws.forecastquery#InvalidNextTokenException": return [3, 4];
131
- case "LimitExceededException": return [3, 6];
132
- case "com.amazonaws.forecastquery#LimitExceededException": return [3, 6];
133
- case "ResourceInUseException": return [3, 8];
134
- case "com.amazonaws.forecastquery#ResourceInUseException": return [3, 8];
135
- case "ResourceNotFoundException": return [3, 10];
136
- case "com.amazonaws.forecastquery#ResourceNotFoundException": return [3, 10];
137
- }
138
- return [3, 12];
139
- case 2: return [4, deserializeAws_json1_1InvalidInputExceptionResponse(parsedOutput, context)];
140
- case 3: throw _d.sent();
141
- case 4: return [4, deserializeAws_json1_1InvalidNextTokenExceptionResponse(parsedOutput, context)];
142
- case 5: throw _d.sent();
143
- case 6: return [4, deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)];
144
- case 7: throw _d.sent();
145
- case 8: return [4, deserializeAws_json1_1ResourceInUseExceptionResponse(parsedOutput, context)];
146
- case 9: throw _d.sent();
147
- case 10: return [4, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];
148
- case 11: throw _d.sent();
149
- case 12:
150
- parsedBody = parsedOutput.body;
151
- throwDefaultError({
152
- output: output,
153
- parsedBody: parsedBody,
154
- exceptionCtor: __BaseException,
155
- errorCode: errorCode,
156
- });
157
- _d.label = 13;
158
- case 13: return [2];
159
- }
160
- });
161
- }); };
162
- var deserializeAws_json1_1InvalidInputExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
163
- var body, deserialized, exception;
164
- return __generator(this, function (_a) {
165
- body = parsedOutput.body;
166
- deserialized = deserializeAws_json1_1InvalidInputException(body, context);
167
- exception = new InvalidInputException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
168
- return [2, __decorateServiceException(exception, body)];
5
+ export const serializeAws_json1_1QueryForecastCommand = async (input, context) => {
6
+ const headers = {
7
+ "content-type": "application/x-amz-json-1.1",
8
+ "x-amz-target": "AmazonForecastRuntime.QueryForecast",
9
+ };
10
+ let body;
11
+ body = JSON.stringify(serializeAws_json1_1QueryForecastRequest(input, context));
12
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
13
+ };
14
+ export const serializeAws_json1_1QueryWhatIfForecastCommand = async (input, context) => {
15
+ const headers = {
16
+ "content-type": "application/x-amz-json-1.1",
17
+ "x-amz-target": "AmazonForecastRuntime.QueryWhatIfForecast",
18
+ };
19
+ let body;
20
+ body = JSON.stringify(serializeAws_json1_1QueryWhatIfForecastRequest(input, context));
21
+ return buildHttpRpcRequest(context, headers, "/", undefined, body);
22
+ };
23
+ export const deserializeAws_json1_1QueryForecastCommand = async (output, context) => {
24
+ if (output.statusCode >= 300) {
25
+ return deserializeAws_json1_1QueryForecastCommandError(output, context);
26
+ }
27
+ const data = await parseBody(output.body, context);
28
+ let contents = {};
29
+ contents = deserializeAws_json1_1QueryForecastResponse(data, context);
30
+ const response = {
31
+ $metadata: deserializeMetadata(output),
32
+ ...contents,
33
+ };
34
+ return Promise.resolve(response);
35
+ };
36
+ const deserializeAws_json1_1QueryForecastCommandError = async (output, context) => {
37
+ const parsedOutput = {
38
+ ...output,
39
+ body: await parseErrorBody(output.body, context),
40
+ };
41
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
42
+ switch (errorCode) {
43
+ case "InvalidInputException":
44
+ case "com.amazonaws.forecastquery#InvalidInputException":
45
+ throw await deserializeAws_json1_1InvalidInputExceptionResponse(parsedOutput, context);
46
+ case "InvalidNextTokenException":
47
+ case "com.amazonaws.forecastquery#InvalidNextTokenException":
48
+ throw await deserializeAws_json1_1InvalidNextTokenExceptionResponse(parsedOutput, context);
49
+ case "LimitExceededException":
50
+ case "com.amazonaws.forecastquery#LimitExceededException":
51
+ throw await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context);
52
+ case "ResourceInUseException":
53
+ case "com.amazonaws.forecastquery#ResourceInUseException":
54
+ throw await deserializeAws_json1_1ResourceInUseExceptionResponse(parsedOutput, context);
55
+ case "ResourceNotFoundException":
56
+ case "com.amazonaws.forecastquery#ResourceNotFoundException":
57
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
58
+ default:
59
+ const parsedBody = parsedOutput.body;
60
+ throwDefaultError({
61
+ output,
62
+ parsedBody,
63
+ exceptionCtor: __BaseException,
64
+ errorCode,
65
+ });
66
+ }
67
+ };
68
+ export const deserializeAws_json1_1QueryWhatIfForecastCommand = async (output, context) => {
69
+ if (output.statusCode >= 300) {
70
+ return deserializeAws_json1_1QueryWhatIfForecastCommandError(output, context);
71
+ }
72
+ const data = await parseBody(output.body, context);
73
+ let contents = {};
74
+ contents = deserializeAws_json1_1QueryWhatIfForecastResponse(data, context);
75
+ const response = {
76
+ $metadata: deserializeMetadata(output),
77
+ ...contents,
78
+ };
79
+ return Promise.resolve(response);
80
+ };
81
+ const deserializeAws_json1_1QueryWhatIfForecastCommandError = async (output, context) => {
82
+ const parsedOutput = {
83
+ ...output,
84
+ body: await parseErrorBody(output.body, context),
85
+ };
86
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
87
+ switch (errorCode) {
88
+ case "InvalidInputException":
89
+ case "com.amazonaws.forecastquery#InvalidInputException":
90
+ throw await deserializeAws_json1_1InvalidInputExceptionResponse(parsedOutput, context);
91
+ case "InvalidNextTokenException":
92
+ case "com.amazonaws.forecastquery#InvalidNextTokenException":
93
+ throw await deserializeAws_json1_1InvalidNextTokenExceptionResponse(parsedOutput, context);
94
+ case "LimitExceededException":
95
+ case "com.amazonaws.forecastquery#LimitExceededException":
96
+ throw await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context);
97
+ case "ResourceInUseException":
98
+ case "com.amazonaws.forecastquery#ResourceInUseException":
99
+ throw await deserializeAws_json1_1ResourceInUseExceptionResponse(parsedOutput, context);
100
+ case "ResourceNotFoundException":
101
+ case "com.amazonaws.forecastquery#ResourceNotFoundException":
102
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
103
+ default:
104
+ const parsedBody = parsedOutput.body;
105
+ throwDefaultError({
106
+ output,
107
+ parsedBody,
108
+ exceptionCtor: __BaseException,
109
+ errorCode,
110
+ });
111
+ }
112
+ };
113
+ const deserializeAws_json1_1InvalidInputExceptionResponse = async (parsedOutput, context) => {
114
+ const body = parsedOutput.body;
115
+ const deserialized = deserializeAws_json1_1InvalidInputException(body, context);
116
+ const exception = new InvalidInputException({
117
+ $metadata: deserializeMetadata(parsedOutput),
118
+ ...deserialized,
169
119
  });
170
- }); };
171
- var deserializeAws_json1_1InvalidNextTokenExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
172
- var body, deserialized, exception;
173
- return __generator(this, function (_a) {
174
- body = parsedOutput.body;
175
- deserialized = deserializeAws_json1_1InvalidNextTokenException(body, context);
176
- exception = new InvalidNextTokenException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
177
- return [2, __decorateServiceException(exception, body)];
120
+ return __decorateServiceException(exception, body);
121
+ };
122
+ const deserializeAws_json1_1InvalidNextTokenExceptionResponse = async (parsedOutput, context) => {
123
+ const body = parsedOutput.body;
124
+ const deserialized = deserializeAws_json1_1InvalidNextTokenException(body, context);
125
+ const exception = new InvalidNextTokenException({
126
+ $metadata: deserializeMetadata(parsedOutput),
127
+ ...deserialized,
178
128
  });
179
- }); };
180
- var deserializeAws_json1_1LimitExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
181
- var body, deserialized, exception;
182
- return __generator(this, function (_a) {
183
- body = parsedOutput.body;
184
- deserialized = deserializeAws_json1_1LimitExceededException(body, context);
185
- exception = new LimitExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
186
- return [2, __decorateServiceException(exception, body)];
129
+ return __decorateServiceException(exception, body);
130
+ };
131
+ const deserializeAws_json1_1LimitExceededExceptionResponse = async (parsedOutput, context) => {
132
+ const body = parsedOutput.body;
133
+ const deserialized = deserializeAws_json1_1LimitExceededException(body, context);
134
+ const exception = new LimitExceededException({
135
+ $metadata: deserializeMetadata(parsedOutput),
136
+ ...deserialized,
187
137
  });
188
- }); };
189
- var deserializeAws_json1_1ResourceInUseExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
190
- var body, deserialized, exception;
191
- return __generator(this, function (_a) {
192
- body = parsedOutput.body;
193
- deserialized = deserializeAws_json1_1ResourceInUseException(body, context);
194
- exception = new ResourceInUseException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
195
- return [2, __decorateServiceException(exception, body)];
138
+ return __decorateServiceException(exception, body);
139
+ };
140
+ const deserializeAws_json1_1ResourceInUseExceptionResponse = async (parsedOutput, context) => {
141
+ const body = parsedOutput.body;
142
+ const deserialized = deserializeAws_json1_1ResourceInUseException(body, context);
143
+ const exception = new ResourceInUseException({
144
+ $metadata: deserializeMetadata(parsedOutput),
145
+ ...deserialized,
196
146
  });
197
- }); };
198
- var deserializeAws_json1_1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
199
- var body, deserialized, exception;
200
- return __generator(this, function (_a) {
201
- body = parsedOutput.body;
202
- deserialized = deserializeAws_json1_1ResourceNotFoundException(body, context);
203
- exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
204
- return [2, __decorateServiceException(exception, body)];
147
+ return __decorateServiceException(exception, body);
148
+ };
149
+ const deserializeAws_json1_1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
150
+ const body = parsedOutput.body;
151
+ const deserialized = deserializeAws_json1_1ResourceNotFoundException(body, context);
152
+ const exception = new ResourceNotFoundException({
153
+ $metadata: deserializeMetadata(parsedOutput),
154
+ ...deserialized,
205
155
  });
206
- }); };
207
- var serializeAws_json1_1Filters = function (input, context) {
208
- return Object.entries(input).reduce(function (acc, _a) {
209
- var _b;
210
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
156
+ return __decorateServiceException(exception, body);
157
+ };
158
+ const serializeAws_json1_1Filters = (input, context) => {
159
+ return Object.entries(input).reduce((acc, [key, value]) => {
211
160
  if (value === null) {
212
161
  return acc;
213
162
  }
214
- return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));
163
+ return {
164
+ ...acc,
165
+ [key]: value,
166
+ };
215
167
  }, {});
216
168
  };
217
- var serializeAws_json1_1QueryForecastRequest = function (input, context) {
218
- return __assign(__assign(__assign(__assign(__assign({}, (input.EndDate != null && { EndDate: input.EndDate })), (input.Filters != null && { Filters: serializeAws_json1_1Filters(input.Filters, context) })), (input.ForecastArn != null && { ForecastArn: input.ForecastArn })), (input.NextToken != null && { NextToken: input.NextToken })), (input.StartDate != null && { StartDate: input.StartDate }));
169
+ const serializeAws_json1_1QueryForecastRequest = (input, context) => {
170
+ return {
171
+ ...(input.EndDate != null && { EndDate: input.EndDate }),
172
+ ...(input.Filters != null && { Filters: serializeAws_json1_1Filters(input.Filters, context) }),
173
+ ...(input.ForecastArn != null && { ForecastArn: input.ForecastArn }),
174
+ ...(input.NextToken != null && { NextToken: input.NextToken }),
175
+ ...(input.StartDate != null && { StartDate: input.StartDate }),
176
+ };
219
177
  };
220
- var serializeAws_json1_1QueryWhatIfForecastRequest = function (input, context) {
221
- return __assign(__assign(__assign(__assign(__assign({}, (input.EndDate != null && { EndDate: input.EndDate })), (input.Filters != null && { Filters: serializeAws_json1_1Filters(input.Filters, context) })), (input.NextToken != null && { NextToken: input.NextToken })), (input.StartDate != null && { StartDate: input.StartDate })), (input.WhatIfForecastArn != null && { WhatIfForecastArn: input.WhatIfForecastArn }));
178
+ const serializeAws_json1_1QueryWhatIfForecastRequest = (input, context) => {
179
+ return {
180
+ ...(input.EndDate != null && { EndDate: input.EndDate }),
181
+ ...(input.Filters != null && { Filters: serializeAws_json1_1Filters(input.Filters, context) }),
182
+ ...(input.NextToken != null && { NextToken: input.NextToken }),
183
+ ...(input.StartDate != null && { StartDate: input.StartDate }),
184
+ ...(input.WhatIfForecastArn != null && { WhatIfForecastArn: input.WhatIfForecastArn }),
185
+ };
222
186
  };
223
- var deserializeAws_json1_1DataPoint = function (output, context) {
187
+ const deserializeAws_json1_1DataPoint = (output, context) => {
224
188
  return {
225
189
  Timestamp: __expectString(output.Timestamp),
226
190
  Value: __limitedParseDouble(output.Value),
227
191
  };
228
192
  };
229
- var deserializeAws_json1_1Forecast = function (output, context) {
193
+ const deserializeAws_json1_1Forecast = (output, context) => {
230
194
  return {
231
195
  Predictions: output.Predictions != null ? deserializeAws_json1_1Predictions(output.Predictions, context) : undefined,
232
196
  };
233
197
  };
234
- var deserializeAws_json1_1InvalidInputException = function (output, context) {
198
+ const deserializeAws_json1_1InvalidInputException = (output, context) => {
235
199
  return {
236
200
  Message: __expectString(output.Message),
237
201
  };
238
202
  };
239
- var deserializeAws_json1_1InvalidNextTokenException = function (output, context) {
203
+ const deserializeAws_json1_1InvalidNextTokenException = (output, context) => {
240
204
  return {
241
205
  Message: __expectString(output.Message),
242
206
  };
243
207
  };
244
- var deserializeAws_json1_1LimitExceededException = function (output, context) {
208
+ const deserializeAws_json1_1LimitExceededException = (output, context) => {
245
209
  return {
246
210
  Message: __expectString(output.Message),
247
211
  };
248
212
  };
249
- var deserializeAws_json1_1Predictions = function (output, context) {
250
- return Object.entries(output).reduce(function (acc, _a) {
251
- var _b;
252
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
213
+ const deserializeAws_json1_1Predictions = (output, context) => {
214
+ return Object.entries(output).reduce((acc, [key, value]) => {
253
215
  if (value === null) {
254
216
  return acc;
255
217
  }
256
- return __assign(__assign({}, acc), (_b = {}, _b[key] = deserializeAws_json1_1TimeSeries(value, context), _b));
218
+ return {
219
+ ...acc,
220
+ [key]: deserializeAws_json1_1TimeSeries(value, context),
221
+ };
257
222
  }, {});
258
223
  };
259
- var deserializeAws_json1_1QueryForecastResponse = function (output, context) {
224
+ const deserializeAws_json1_1QueryForecastResponse = (output, context) => {
260
225
  return {
261
226
  Forecast: output.Forecast != null ? deserializeAws_json1_1Forecast(output.Forecast, context) : undefined,
262
227
  };
263
228
  };
264
- var deserializeAws_json1_1QueryWhatIfForecastResponse = function (output, context) {
229
+ const deserializeAws_json1_1QueryWhatIfForecastResponse = (output, context) => {
265
230
  return {
266
231
  Forecast: output.Forecast != null ? deserializeAws_json1_1Forecast(output.Forecast, context) : undefined,
267
232
  };
268
233
  };
269
- var deserializeAws_json1_1ResourceInUseException = function (output, context) {
234
+ const deserializeAws_json1_1ResourceInUseException = (output, context) => {
270
235
  return {
271
236
  Message: __expectString(output.Message),
272
237
  };
273
238
  };
274
- var deserializeAws_json1_1ResourceNotFoundException = function (output, context) {
239
+ const deserializeAws_json1_1ResourceNotFoundException = (output, context) => {
275
240
  return {
276
241
  Message: __expectString(output.Message),
277
242
  };
278
243
  };
279
- var deserializeAws_json1_1TimeSeries = function (output, context) {
280
- var retVal = (output || [])
281
- .filter(function (e) { return e != null; })
282
- .map(function (entry) {
244
+ const deserializeAws_json1_1TimeSeries = (output, context) => {
245
+ const retVal = (output || [])
246
+ .filter((e) => e != null)
247
+ .map((entry) => {
283
248
  if (entry === null) {
284
249
  return null;
285
250
  }
@@ -287,62 +252,52 @@ var deserializeAws_json1_1TimeSeries = function (output, context) {
287
252
  });
288
253
  return retVal;
289
254
  };
290
- var deserializeMetadata = function (output) {
291
- var _a;
292
- return ({
293
- httpStatusCode: output.statusCode,
294
- requestId: (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"],
295
- extendedRequestId: output.headers["x-amz-id-2"],
296
- cfId: output.headers["x-amz-cf-id"],
297
- });
298
- };
299
- var collectBody = function (streamBody, context) {
300
- if (streamBody === void 0) { streamBody = new Uint8Array(); }
255
+ const deserializeMetadata = (output) => ({
256
+ httpStatusCode: output.statusCode,
257
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
258
+ extendedRequestId: output.headers["x-amz-id-2"],
259
+ cfId: output.headers["x-amz-cf-id"],
260
+ });
261
+ const collectBody = (streamBody = new Uint8Array(), context) => {
301
262
  if (streamBody instanceof Uint8Array) {
302
263
  return Promise.resolve(streamBody);
303
264
  }
304
265
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
305
266
  };
306
- var collectBodyString = function (streamBody, context) {
307
- return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
267
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
268
+ const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
269
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
270
+ const contents = {
271
+ protocol,
272
+ hostname,
273
+ port,
274
+ method: "POST",
275
+ path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
276
+ headers,
277
+ };
278
+ if (resolvedHostname !== undefined) {
279
+ contents.hostname = resolvedHostname;
280
+ }
281
+ if (body !== undefined) {
282
+ contents.body = body;
283
+ }
284
+ return new __HttpRequest(contents);
308
285
  };
309
- var buildHttpRpcRequest = function (context, headers, path, resolvedHostname, body) { return __awaiter(void 0, void 0, void 0, function () {
310
- var _a, hostname, _b, protocol, port, basePath, contents;
311
- return __generator(this, function (_c) {
312
- switch (_c.label) {
313
- case 0: return [4, context.endpoint()];
314
- case 1:
315
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
316
- contents = {
317
- protocol: protocol,
318
- hostname: hostname,
319
- port: port,
320
- method: "POST",
321
- path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
322
- headers: headers,
323
- };
324
- if (resolvedHostname !== undefined) {
325
- contents.hostname = resolvedHostname;
326
- }
327
- if (body !== undefined) {
328
- contents.body = body;
329
- }
330
- return [2, new __HttpRequest(contents)];
331
- }
332
- });
333
- }); };
334
- var parseBody = function (streamBody, context) {
335
- return collectBodyString(streamBody, context).then(function (encoded) {
336
- if (encoded.length) {
337
- return JSON.parse(encoded);
338
- }
339
- return {};
340
- });
286
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
287
+ if (encoded.length) {
288
+ return JSON.parse(encoded);
289
+ }
290
+ return {};
291
+ });
292
+ const parseErrorBody = async (errorBody, context) => {
293
+ const value = await parseBody(errorBody, context);
294
+ value.message = value.message ?? value.Message;
295
+ return value;
341
296
  };
342
- var loadRestJsonErrorCode = function (output, data) {
343
- var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
344
- var sanitizeErrorCode = function (rawValue) {
345
- var cleanValue = rawValue;
297
+ const loadRestJsonErrorCode = (output, data) => {
298
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
299
+ const sanitizeErrorCode = (rawValue) => {
300
+ let cleanValue = rawValue;
346
301
  if (typeof cleanValue === "number") {
347
302
  cleanValue = cleanValue.toString();
348
303
  }
@@ -357,7 +312,7 @@ var loadRestJsonErrorCode = function (output, data) {
357
312
  }
358
313
  return cleanValue;
359
314
  };
360
- var headerKey = findKey(output.headers, "x-amzn-errortype");
315
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
361
316
  if (headerKey !== undefined) {
362
317
  return sanitizeErrorCode(output.headers[headerKey]);
363
318
  }