@aws-sdk/client-cloudsearch-domain 3.186.0 → 3.190.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,339 +1,251 @@
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, expectLong as __expectLong, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, map as __map, throwDefaultError, } from "@aws-sdk/smithy-client";
4
3
  import { CloudSearchDomainServiceException as __BaseException } from "../models/CloudSearchDomainServiceException";
5
4
  import { DocumentServiceException, SearchException, } from "../models/models_0";
6
- export var serializeAws_restJson1SearchCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
7
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
8
- return __generator(this, function (_c) {
9
- switch (_c.label) {
10
- case 0: return [4, context.endpoint()];
11
- case 1:
12
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
13
- headers = {};
14
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/2013-01-01/search";
15
- query = map({
16
- format: [, "sdk"],
17
- pretty: [, "true"],
18
- cursor: [, input.cursor],
19
- expr: [, input.expr],
20
- facet: [, input.facet],
21
- fq: [, input.filterQuery],
22
- highlight: [, input.highlight],
23
- partial: [function () { return input.partial !== void 0; }, function () { return input.partial.toString(); }],
24
- q: [, input.query],
25
- "q.options": [, input.queryOptions],
26
- "q.parser": [, input.queryParser],
27
- return: [, input.return],
28
- size: [function () { return input.size !== void 0; }, function () { return input.size.toString(); }],
29
- sort: [, input.sort],
30
- start: [function () { return input.start !== void 0; }, function () { return input.start.toString(); }],
31
- stats: [, input.stats],
32
- });
33
- return [2, new __HttpRequest({
34
- protocol: protocol,
35
- hostname: hostname,
36
- port: port,
37
- method: "GET",
38
- headers: headers,
39
- path: resolvedPath,
40
- query: query,
41
- body: body,
42
- })];
43
- }
5
+ export const serializeAws_restJson1SearchCommand = async (input, context) => {
6
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
7
+ const headers = {};
8
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-01-01/search";
9
+ const query = map({
10
+ format: [, "sdk"],
11
+ pretty: [, "true"],
12
+ cursor: [, input.cursor],
13
+ expr: [, input.expr],
14
+ facet: [, input.facet],
15
+ fq: [, input.filterQuery],
16
+ highlight: [, input.highlight],
17
+ partial: [() => input.partial !== void 0, () => input.partial.toString()],
18
+ q: [, input.query],
19
+ "q.options": [, input.queryOptions],
20
+ "q.parser": [, input.queryParser],
21
+ return: [, input.return],
22
+ size: [() => input.size !== void 0, () => input.size.toString()],
23
+ sort: [, input.sort],
24
+ start: [() => input.start !== void 0, () => input.start.toString()],
25
+ stats: [, input.stats],
44
26
  });
45
- }); };
46
- export var serializeAws_restJson1SuggestCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
47
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
48
- return __generator(this, function (_c) {
49
- switch (_c.label) {
50
- case 0: return [4, context.endpoint()];
51
- case 1:
52
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
53
- headers = {};
54
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/2013-01-01/suggest";
55
- query = map({
56
- format: [, "sdk"],
57
- pretty: [, "true"],
58
- q: [, input.query],
59
- suggester: [, input.suggester],
60
- size: [function () { return input.size !== void 0; }, function () { return input.size.toString(); }],
61
- });
62
- return [2, new __HttpRequest({
63
- protocol: protocol,
64
- hostname: hostname,
65
- port: port,
66
- method: "GET",
67
- headers: headers,
68
- path: resolvedPath,
69
- query: query,
70
- body: body,
71
- })];
72
- }
27
+ let body;
28
+ return new __HttpRequest({
29
+ protocol,
30
+ hostname,
31
+ port,
32
+ method: "GET",
33
+ headers,
34
+ path: resolvedPath,
35
+ query,
36
+ body,
73
37
  });
74
- }); };
75
- export var serializeAws_restJson1UploadDocumentsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
76
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
77
- return __generator(this, function (_c) {
78
- switch (_c.label) {
79
- case 0: return [4, context.endpoint()];
80
- case 1:
81
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
82
- headers = map({}, isSerializableHeaderValue, {
83
- "content-type": input.contentType || "application/octet-stream",
84
- });
85
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/2013-01-01/documents/batch";
86
- query = map({
87
- format: [, "sdk"],
88
- });
89
- if (input.documents !== undefined) {
90
- body = input.documents;
91
- }
92
- return [2, new __HttpRequest({
93
- protocol: protocol,
94
- hostname: hostname,
95
- port: port,
96
- method: "POST",
97
- headers: headers,
98
- path: resolvedPath,
99
- query: query,
100
- body: body,
101
- })];
102
- }
38
+ };
39
+ export const serializeAws_restJson1SuggestCommand = async (input, context) => {
40
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
41
+ const headers = {};
42
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-01-01/suggest";
43
+ const query = map({
44
+ format: [, "sdk"],
45
+ pretty: [, "true"],
46
+ q: [, input.query],
47
+ suggester: [, input.suggester],
48
+ size: [() => input.size !== void 0, () => input.size.toString()],
103
49
  });
104
- }); };
105
- export var deserializeAws_restJson1SearchCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
106
- var contents, data, _a, _b;
107
- return __generator(this, function (_c) {
108
- switch (_c.label) {
109
- case 0:
110
- if (output.statusCode !== 200 && output.statusCode >= 300) {
111
- return [2, deserializeAws_restJson1SearchCommandError(output, context)];
112
- }
113
- contents = map({
114
- $metadata: deserializeMetadata(output),
115
- });
116
- _a = __expectNonNull;
117
- _b = __expectObject;
118
- return [4, parseBody(output.body, context)];
119
- case 1:
120
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
121
- if (data.facets != null) {
122
- contents.facets = deserializeAws_restJson1Facets(data.facets, context);
123
- }
124
- if (data.hits != null) {
125
- contents.hits = deserializeAws_restJson1Hits(data.hits, context);
126
- }
127
- if (data.stats != null) {
128
- contents.stats = deserializeAws_restJson1Stats(data.stats, context);
129
- }
130
- if (data.status != null) {
131
- contents.status = deserializeAws_restJson1SearchStatus(data.status, context);
132
- }
133
- return [2, contents];
134
- }
50
+ let body;
51
+ return new __HttpRequest({
52
+ protocol,
53
+ hostname,
54
+ port,
55
+ method: "GET",
56
+ headers,
57
+ path: resolvedPath,
58
+ query,
59
+ body,
135
60
  });
136
- }); };
137
- var deserializeAws_restJson1SearchCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
138
- var parsedOutput, _a, errorCode, _b, parsedBody;
139
- var _c;
140
- return __generator(this, function (_d) {
141
- switch (_d.label) {
142
- case 0:
143
- _a = [__assign({}, output)];
144
- _c = {};
145
- return [4, parseErrorBody(output.body, context)];
146
- case 1:
147
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
148
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
149
- _b = errorCode;
150
- switch (_b) {
151
- case "SearchException": return [3, 2];
152
- case "com.amazonaws.cloudsearchdomain#SearchException": return [3, 2];
153
- }
154
- return [3, 4];
155
- case 2: return [4, deserializeAws_restJson1SearchExceptionResponse(parsedOutput, context)];
156
- case 3: throw _d.sent();
157
- case 4:
158
- parsedBody = parsedOutput.body;
159
- throwDefaultError({
160
- output: output,
161
- parsedBody: parsedBody,
162
- exceptionCtor: __BaseException,
163
- errorCode: errorCode,
164
- });
165
- _d.label = 5;
166
- case 5: return [2];
167
- }
61
+ };
62
+ export const serializeAws_restJson1UploadDocumentsCommand = async (input, context) => {
63
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
64
+ const headers = map({}, isSerializableHeaderValue, {
65
+ "content-type": input.contentType || "application/octet-stream",
168
66
  });
169
- }); };
170
- export var deserializeAws_restJson1SuggestCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
171
- var contents, data, _a, _b;
172
- return __generator(this, function (_c) {
173
- switch (_c.label) {
174
- case 0:
175
- if (output.statusCode !== 200 && output.statusCode >= 300) {
176
- return [2, deserializeAws_restJson1SuggestCommandError(output, context)];
177
- }
178
- contents = map({
179
- $metadata: deserializeMetadata(output),
180
- });
181
- _a = __expectNonNull;
182
- _b = __expectObject;
183
- return [4, parseBody(output.body, context)];
184
- case 1:
185
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
186
- if (data.status != null) {
187
- contents.status = deserializeAws_restJson1SuggestStatus(data.status, context);
188
- }
189
- if (data.suggest != null) {
190
- contents.suggest = deserializeAws_restJson1SuggestModel(data.suggest, context);
191
- }
192
- return [2, contents];
193
- }
67
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-01-01/documents/batch";
68
+ const query = map({
69
+ format: [, "sdk"],
194
70
  });
195
- }); };
196
- var deserializeAws_restJson1SuggestCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
197
- var parsedOutput, _a, errorCode, _b, parsedBody;
198
- var _c;
199
- return __generator(this, function (_d) {
200
- switch (_d.label) {
201
- case 0:
202
- _a = [__assign({}, output)];
203
- _c = {};
204
- return [4, parseErrorBody(output.body, context)];
205
- case 1:
206
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
207
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
208
- _b = errorCode;
209
- switch (_b) {
210
- case "SearchException": return [3, 2];
211
- case "com.amazonaws.cloudsearchdomain#SearchException": return [3, 2];
212
- }
213
- return [3, 4];
214
- case 2: return [4, deserializeAws_restJson1SearchExceptionResponse(parsedOutput, context)];
215
- case 3: throw _d.sent();
216
- case 4:
217
- parsedBody = parsedOutput.body;
218
- throwDefaultError({
219
- output: output,
220
- parsedBody: parsedBody,
221
- exceptionCtor: __BaseException,
222
- errorCode: errorCode,
223
- });
224
- _d.label = 5;
225
- case 5: return [2];
226
- }
71
+ let body;
72
+ if (input.documents !== undefined) {
73
+ body = input.documents;
74
+ }
75
+ return new __HttpRequest({
76
+ protocol,
77
+ hostname,
78
+ port,
79
+ method: "POST",
80
+ headers,
81
+ path: resolvedPath,
82
+ query,
83
+ body,
227
84
  });
228
- }); };
229
- export var deserializeAws_restJson1UploadDocumentsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
230
- var contents, data, _a, _b;
231
- return __generator(this, function (_c) {
232
- switch (_c.label) {
233
- case 0:
234
- if (output.statusCode !== 200 && output.statusCode >= 300) {
235
- return [2, deserializeAws_restJson1UploadDocumentsCommandError(output, context)];
236
- }
237
- contents = map({
238
- $metadata: deserializeMetadata(output),
239
- });
240
- _a = __expectNonNull;
241
- _b = __expectObject;
242
- return [4, parseBody(output.body, context)];
243
- case 1:
244
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
245
- if (data.adds != null) {
246
- contents.adds = __expectLong(data.adds);
247
- }
248
- if (data.deletes != null) {
249
- contents.deletes = __expectLong(data.deletes);
250
- }
251
- if (data.status != null) {
252
- contents.status = __expectString(data.status);
253
- }
254
- if (data.warnings != null) {
255
- contents.warnings = deserializeAws_restJson1DocumentServiceWarnings(data.warnings, context);
256
- }
257
- return [2, contents];
258
- }
85
+ };
86
+ export const deserializeAws_restJson1SearchCommand = async (output, context) => {
87
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
88
+ return deserializeAws_restJson1SearchCommandError(output, context);
89
+ }
90
+ const contents = map({
91
+ $metadata: deserializeMetadata(output),
259
92
  });
260
- }); };
261
- var deserializeAws_restJson1UploadDocumentsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
262
- var parsedOutput, _a, errorCode, _b, parsedBody;
263
- var _c;
264
- return __generator(this, function (_d) {
265
- switch (_d.label) {
266
- case 0:
267
- _a = [__assign({}, output)];
268
- _c = {};
269
- return [4, parseErrorBody(output.body, context)];
270
- case 1:
271
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
272
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
273
- _b = errorCode;
274
- switch (_b) {
275
- case "DocumentServiceException": return [3, 2];
276
- case "com.amazonaws.cloudsearchdomain#DocumentServiceException": return [3, 2];
277
- }
278
- return [3, 4];
279
- case 2: return [4, deserializeAws_restJson1DocumentServiceExceptionResponse(parsedOutput, context)];
280
- case 3: throw _d.sent();
281
- case 4:
282
- parsedBody = parsedOutput.body;
283
- throwDefaultError({
284
- output: output,
285
- parsedBody: parsedBody,
286
- exceptionCtor: __BaseException,
287
- errorCode: errorCode,
288
- });
289
- _d.label = 5;
290
- case 5: return [2];
291
- }
93
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
94
+ if (data.facets != null) {
95
+ contents.facets = deserializeAws_restJson1Facets(data.facets, context);
96
+ }
97
+ if (data.hits != null) {
98
+ contents.hits = deserializeAws_restJson1Hits(data.hits, context);
99
+ }
100
+ if (data.stats != null) {
101
+ contents.stats = deserializeAws_restJson1Stats(data.stats, context);
102
+ }
103
+ if (data.status != null) {
104
+ contents.status = deserializeAws_restJson1SearchStatus(data.status, context);
105
+ }
106
+ return contents;
107
+ };
108
+ const deserializeAws_restJson1SearchCommandError = async (output, context) => {
109
+ const parsedOutput = {
110
+ ...output,
111
+ body: await parseErrorBody(output.body, context),
112
+ };
113
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
114
+ switch (errorCode) {
115
+ case "SearchException":
116
+ case "com.amazonaws.cloudsearchdomain#SearchException":
117
+ throw await deserializeAws_restJson1SearchExceptionResponse(parsedOutput, context);
118
+ default:
119
+ const parsedBody = parsedOutput.body;
120
+ throwDefaultError({
121
+ output,
122
+ parsedBody,
123
+ exceptionCtor: __BaseException,
124
+ errorCode,
125
+ });
126
+ }
127
+ };
128
+ export const deserializeAws_restJson1SuggestCommand = async (output, context) => {
129
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
130
+ return deserializeAws_restJson1SuggestCommandError(output, context);
131
+ }
132
+ const contents = map({
133
+ $metadata: deserializeMetadata(output),
292
134
  });
293
- }); };
294
- var map = __map;
295
- var deserializeAws_restJson1DocumentServiceExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
296
- var contents, data, exception;
297
- return __generator(this, function (_a) {
298
- contents = map({});
299
- data = parsedOutput.body;
300
- if (data.message != null) {
301
- contents.message = __expectString(data.message);
302
- }
303
- if (data.status != null) {
304
- contents.status = __expectString(data.status);
305
- }
306
- exception = new DocumentServiceException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
307
- return [2, __decorateServiceException(exception, parsedOutput.body)];
135
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
136
+ if (data.status != null) {
137
+ contents.status = deserializeAws_restJson1SuggestStatus(data.status, context);
138
+ }
139
+ if (data.suggest != null) {
140
+ contents.suggest = deserializeAws_restJson1SuggestModel(data.suggest, context);
141
+ }
142
+ return contents;
143
+ };
144
+ const deserializeAws_restJson1SuggestCommandError = async (output, context) => {
145
+ const parsedOutput = {
146
+ ...output,
147
+ body: await parseErrorBody(output.body, context),
148
+ };
149
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
150
+ switch (errorCode) {
151
+ case "SearchException":
152
+ case "com.amazonaws.cloudsearchdomain#SearchException":
153
+ throw await deserializeAws_restJson1SearchExceptionResponse(parsedOutput, context);
154
+ default:
155
+ const parsedBody = parsedOutput.body;
156
+ throwDefaultError({
157
+ output,
158
+ parsedBody,
159
+ exceptionCtor: __BaseException,
160
+ errorCode,
161
+ });
162
+ }
163
+ };
164
+ export const deserializeAws_restJson1UploadDocumentsCommand = async (output, context) => {
165
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
166
+ return deserializeAws_restJson1UploadDocumentsCommandError(output, context);
167
+ }
168
+ const contents = map({
169
+ $metadata: deserializeMetadata(output),
308
170
  });
309
- }); };
310
- var deserializeAws_restJson1SearchExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
311
- var contents, data, exception;
312
- return __generator(this, function (_a) {
313
- contents = map({});
314
- data = parsedOutput.body;
315
- if (data.message != null) {
316
- contents.message = __expectString(data.message);
317
- }
318
- exception = new SearchException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
319
- return [2, __decorateServiceException(exception, parsedOutput.body)];
171
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
172
+ if (data.adds != null) {
173
+ contents.adds = __expectLong(data.adds);
174
+ }
175
+ if (data.deletes != null) {
176
+ contents.deletes = __expectLong(data.deletes);
177
+ }
178
+ if (data.status != null) {
179
+ contents.status = __expectString(data.status);
180
+ }
181
+ if (data.warnings != null) {
182
+ contents.warnings = deserializeAws_restJson1DocumentServiceWarnings(data.warnings, context);
183
+ }
184
+ return contents;
185
+ };
186
+ const deserializeAws_restJson1UploadDocumentsCommandError = async (output, context) => {
187
+ const parsedOutput = {
188
+ ...output,
189
+ body: await parseErrorBody(output.body, context),
190
+ };
191
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
192
+ switch (errorCode) {
193
+ case "DocumentServiceException":
194
+ case "com.amazonaws.cloudsearchdomain#DocumentServiceException":
195
+ throw await deserializeAws_restJson1DocumentServiceExceptionResponse(parsedOutput, context);
196
+ default:
197
+ const parsedBody = parsedOutput.body;
198
+ throwDefaultError({
199
+ output,
200
+ parsedBody,
201
+ exceptionCtor: __BaseException,
202
+ errorCode,
203
+ });
204
+ }
205
+ };
206
+ const map = __map;
207
+ const deserializeAws_restJson1DocumentServiceExceptionResponse = async (parsedOutput, context) => {
208
+ const contents = map({});
209
+ const data = parsedOutput.body;
210
+ if (data.message != null) {
211
+ contents.message = __expectString(data.message);
212
+ }
213
+ if (data.status != null) {
214
+ contents.status = __expectString(data.status);
215
+ }
216
+ const exception = new DocumentServiceException({
217
+ $metadata: deserializeMetadata(parsedOutput),
218
+ ...contents,
219
+ });
220
+ return __decorateServiceException(exception, parsedOutput.body);
221
+ };
222
+ const deserializeAws_restJson1SearchExceptionResponse = async (parsedOutput, context) => {
223
+ const contents = map({});
224
+ const data = parsedOutput.body;
225
+ if (data.message != null) {
226
+ contents.message = __expectString(data.message);
227
+ }
228
+ const exception = new SearchException({
229
+ $metadata: deserializeMetadata(parsedOutput),
230
+ ...contents,
320
231
  });
321
- }); };
322
- var deserializeAws_restJson1Bucket = function (output, context) {
232
+ return __decorateServiceException(exception, parsedOutput.body);
233
+ };
234
+ const deserializeAws_restJson1Bucket = (output, context) => {
323
235
  return {
324
236
  count: __expectLong(output.count),
325
237
  value: __expectString(output.value),
326
238
  };
327
239
  };
328
- var deserializeAws_restJson1BucketInfo = function (output, context) {
240
+ const deserializeAws_restJson1BucketInfo = (output, context) => {
329
241
  return {
330
242
  buckets: output.buckets != null ? deserializeAws_restJson1BucketList(output.buckets, context) : undefined,
331
243
  };
332
244
  };
333
- var deserializeAws_restJson1BucketList = function (output, context) {
334
- var retVal = (output || [])
335
- .filter(function (e) { return e != null; })
336
- .map(function (entry) {
245
+ const deserializeAws_restJson1BucketList = (output, context) => {
246
+ const retVal = (output || [])
247
+ .filter((e) => e != null)
248
+ .map((entry) => {
337
249
  if (entry === null) {
338
250
  return null;
339
251
  }
@@ -341,15 +253,15 @@ var deserializeAws_restJson1BucketList = function (output, context) {
341
253
  });
342
254
  return retVal;
343
255
  };
344
- var deserializeAws_restJson1DocumentServiceWarning = function (output, context) {
256
+ const deserializeAws_restJson1DocumentServiceWarning = (output, context) => {
345
257
  return {
346
258
  message: __expectString(output.message),
347
259
  };
348
260
  };
349
- var deserializeAws_restJson1DocumentServiceWarnings = function (output, context) {
350
- var retVal = (output || [])
351
- .filter(function (e) { return e != null; })
352
- .map(function (entry) {
261
+ const deserializeAws_restJson1DocumentServiceWarnings = (output, context) => {
262
+ const retVal = (output || [])
263
+ .filter((e) => e != null)
264
+ .map((entry) => {
353
265
  if (entry === null) {
354
266
  return null;
355
267
  }
@@ -357,37 +269,40 @@ var deserializeAws_restJson1DocumentServiceWarnings = function (output, context)
357
269
  });
358
270
  return retVal;
359
271
  };
360
- var deserializeAws_restJson1Exprs = function (output, context) {
361
- return Object.entries(output).reduce(function (acc, _a) {
362
- var _b;
363
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
272
+ const deserializeAws_restJson1Exprs = (output, context) => {
273
+ return Object.entries(output).reduce((acc, [key, value]) => {
364
274
  if (value === null) {
365
275
  return acc;
366
276
  }
367
- return __assign(__assign({}, acc), (_b = {}, _b[key] = __expectString(value), _b));
277
+ return {
278
+ ...acc,
279
+ [key]: __expectString(value),
280
+ };
368
281
  }, {});
369
282
  };
370
- var deserializeAws_restJson1Facets = function (output, context) {
371
- return Object.entries(output).reduce(function (acc, _a) {
372
- var _b;
373
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
283
+ const deserializeAws_restJson1Facets = (output, context) => {
284
+ return Object.entries(output).reduce((acc, [key, value]) => {
374
285
  if (value === null) {
375
286
  return acc;
376
287
  }
377
- return __assign(__assign({}, acc), (_b = {}, _b[key] = deserializeAws_restJson1BucketInfo(value, context), _b));
288
+ return {
289
+ ...acc,
290
+ [key]: deserializeAws_restJson1BucketInfo(value, context),
291
+ };
378
292
  }, {});
379
293
  };
380
- var deserializeAws_restJson1Fields = function (output, context) {
381
- return Object.entries(output).reduce(function (acc, _a) {
382
- var _b;
383
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
294
+ const deserializeAws_restJson1Fields = (output, context) => {
295
+ return Object.entries(output).reduce((acc, [key, value]) => {
384
296
  if (value === null) {
385
297
  return acc;
386
298
  }
387
- return __assign(__assign({}, acc), (_b = {}, _b[key] = deserializeAws_restJson1FieldValue(value, context), _b));
299
+ return {
300
+ ...acc,
301
+ [key]: deserializeAws_restJson1FieldValue(value, context),
302
+ };
388
303
  }, {});
389
304
  };
390
- var deserializeAws_restJson1FieldStats = function (output, context) {
305
+ const deserializeAws_restJson1FieldStats = (output, context) => {
391
306
  return {
392
307
  count: __expectLong(output.count),
393
308
  max: __expectString(output.max),
@@ -399,10 +314,10 @@ var deserializeAws_restJson1FieldStats = function (output, context) {
399
314
  sumOfSquares: __limitedParseDouble(output.sumOfSquares),
400
315
  };
401
316
  };
402
- var deserializeAws_restJson1FieldValue = function (output, context) {
403
- var retVal = (output || [])
404
- .filter(function (e) { return e != null; })
405
- .map(function (entry) {
317
+ const deserializeAws_restJson1FieldValue = (output, context) => {
318
+ const retVal = (output || [])
319
+ .filter((e) => e != null)
320
+ .map((entry) => {
406
321
  if (entry === null) {
407
322
  return null;
408
323
  }
@@ -410,17 +325,18 @@ var deserializeAws_restJson1FieldValue = function (output, context) {
410
325
  });
411
326
  return retVal;
412
327
  };
413
- var deserializeAws_restJson1Highlights = function (output, context) {
414
- return Object.entries(output).reduce(function (acc, _a) {
415
- var _b;
416
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
328
+ const deserializeAws_restJson1Highlights = (output, context) => {
329
+ return Object.entries(output).reduce((acc, [key, value]) => {
417
330
  if (value === null) {
418
331
  return acc;
419
332
  }
420
- return __assign(__assign({}, acc), (_b = {}, _b[key] = __expectString(value), _b));
333
+ return {
334
+ ...acc,
335
+ [key]: __expectString(value),
336
+ };
421
337
  }, {});
422
338
  };
423
- var deserializeAws_restJson1Hit = function (output, context) {
339
+ const deserializeAws_restJson1Hit = (output, context) => {
424
340
  return {
425
341
  exprs: output.exprs != null ? deserializeAws_restJson1Exprs(output.exprs, context) : undefined,
426
342
  fields: output.fields != null ? deserializeAws_restJson1Fields(output.fields, context) : undefined,
@@ -428,10 +344,10 @@ var deserializeAws_restJson1Hit = function (output, context) {
428
344
  id: __expectString(output.id),
429
345
  };
430
346
  };
431
- var deserializeAws_restJson1HitList = function (output, context) {
432
- var retVal = (output || [])
433
- .filter(function (e) { return e != null; })
434
- .map(function (entry) {
347
+ const deserializeAws_restJson1HitList = (output, context) => {
348
+ const retVal = (output || [])
349
+ .filter((e) => e != null)
350
+ .map((entry) => {
435
351
  if (entry === null) {
436
352
  return null;
437
353
  }
@@ -439,7 +355,7 @@ var deserializeAws_restJson1HitList = function (output, context) {
439
355
  });
440
356
  return retVal;
441
357
  };
442
- var deserializeAws_restJson1Hits = function (output, context) {
358
+ const deserializeAws_restJson1Hits = (output, context) => {
443
359
  return {
444
360
  cursor: __expectString(output.cursor),
445
361
  found: __expectLong(output.found),
@@ -447,33 +363,34 @@ var deserializeAws_restJson1Hits = function (output, context) {
447
363
  start: __expectLong(output.start),
448
364
  };
449
365
  };
450
- var deserializeAws_restJson1SearchStatus = function (output, context) {
366
+ const deserializeAws_restJson1SearchStatus = (output, context) => {
451
367
  return {
452
368
  rid: __expectString(output.rid),
453
369
  timems: __expectLong(output.timems),
454
370
  };
455
371
  };
456
- var deserializeAws_restJson1Stats = function (output, context) {
457
- return Object.entries(output).reduce(function (acc, _a) {
458
- var _b;
459
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
372
+ const deserializeAws_restJson1Stats = (output, context) => {
373
+ return Object.entries(output).reduce((acc, [key, value]) => {
460
374
  if (value === null) {
461
375
  return acc;
462
376
  }
463
- return __assign(__assign({}, acc), (_b = {}, _b[key] = deserializeAws_restJson1FieldStats(value, context), _b));
377
+ return {
378
+ ...acc,
379
+ [key]: deserializeAws_restJson1FieldStats(value, context),
380
+ };
464
381
  }, {});
465
382
  };
466
- var deserializeAws_restJson1SuggestionMatch = function (output, context) {
383
+ const deserializeAws_restJson1SuggestionMatch = (output, context) => {
467
384
  return {
468
385
  id: __expectString(output.id),
469
386
  score: __expectLong(output.score),
470
387
  suggestion: __expectString(output.suggestion),
471
388
  };
472
389
  };
473
- var deserializeAws_restJson1Suggestions = function (output, context) {
474
- var retVal = (output || [])
475
- .filter(function (e) { return e != null; })
476
- .map(function (entry) {
390
+ const deserializeAws_restJson1Suggestions = (output, context) => {
391
+ const retVal = (output || [])
392
+ .filter((e) => e != null)
393
+ .map((entry) => {
477
394
  if (entry === null) {
478
395
  return null;
479
396
  }
@@ -481,70 +398,52 @@ var deserializeAws_restJson1Suggestions = function (output, context) {
481
398
  });
482
399
  return retVal;
483
400
  };
484
- var deserializeAws_restJson1SuggestModel = function (output, context) {
401
+ const deserializeAws_restJson1SuggestModel = (output, context) => {
485
402
  return {
486
403
  found: __expectLong(output.found),
487
404
  query: __expectString(output.query),
488
405
  suggestions: output.suggestions != null ? deserializeAws_restJson1Suggestions(output.suggestions, context) : undefined,
489
406
  };
490
407
  };
491
- var deserializeAws_restJson1SuggestStatus = function (output, context) {
408
+ const deserializeAws_restJson1SuggestStatus = (output, context) => {
492
409
  return {
493
410
  rid: __expectString(output.rid),
494
411
  timems: __expectLong(output.timems),
495
412
  };
496
413
  };
497
- var deserializeMetadata = function (output) {
498
- var _a, _b;
499
- return ({
500
- httpStatusCode: output.statusCode,
501
- requestId: (_b = (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"]) !== null && _b !== void 0 ? _b : output.headers["x-amz-request-id"],
502
- extendedRequestId: output.headers["x-amz-id-2"],
503
- cfId: output.headers["x-amz-cf-id"],
504
- });
505
- };
506
- var collectBody = function (streamBody, context) {
507
- if (streamBody === void 0) { streamBody = new Uint8Array(); }
414
+ const deserializeMetadata = (output) => ({
415
+ httpStatusCode: output.statusCode,
416
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
417
+ extendedRequestId: output.headers["x-amz-id-2"],
418
+ cfId: output.headers["x-amz-cf-id"],
419
+ });
420
+ const collectBody = (streamBody = new Uint8Array(), context) => {
508
421
  if (streamBody instanceof Uint8Array) {
509
422
  return Promise.resolve(streamBody);
510
423
  }
511
424
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
512
425
  };
513
- var collectBodyString = function (streamBody, context) {
514
- return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
515
- };
516
- var isSerializableHeaderValue = function (value) {
517
- return value !== undefined &&
518
- value !== null &&
519
- value !== "" &&
520
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
521
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
522
- };
523
- var parseBody = function (streamBody, context) {
524
- return collectBodyString(streamBody, context).then(function (encoded) {
525
- if (encoded.length) {
526
- return JSON.parse(encoded);
527
- }
528
- return {};
529
- });
426
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
427
+ const isSerializableHeaderValue = (value) => value !== undefined &&
428
+ value !== null &&
429
+ value !== "" &&
430
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
431
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
432
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
433
+ if (encoded.length) {
434
+ return JSON.parse(encoded);
435
+ }
436
+ return {};
437
+ });
438
+ const parseErrorBody = async (errorBody, context) => {
439
+ const value = await parseBody(errorBody, context);
440
+ value.message = value.message ?? value.Message;
441
+ return value;
530
442
  };
531
- var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
532
- var value;
533
- var _a;
534
- return __generator(this, function (_b) {
535
- switch (_b.label) {
536
- case 0: return [4, parseBody(errorBody, context)];
537
- case 1:
538
- value = _b.sent();
539
- value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
540
- return [2, value];
541
- }
542
- });
543
- }); };
544
- var loadRestJsonErrorCode = function (output, data) {
545
- var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
546
- var sanitizeErrorCode = function (rawValue) {
547
- var cleanValue = rawValue;
443
+ const loadRestJsonErrorCode = (output, data) => {
444
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
445
+ const sanitizeErrorCode = (rawValue) => {
446
+ let cleanValue = rawValue;
548
447
  if (typeof cleanValue === "number") {
549
448
  cleanValue = cleanValue.toString();
550
449
  }
@@ -559,7 +458,7 @@ var loadRestJsonErrorCode = function (output, data) {
559
458
  }
560
459
  return cleanValue;
561
460
  };
562
- var headerKey = findKey(output.headers, "x-amzn-errortype");
461
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
563
462
  if (headerKey !== undefined) {
564
463
  return sanitizeErrorCode(output.headers[headerKey]);
565
464
  }