@aws-sdk/client-cloudsearch-domain 3.312.0 → 3.316.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,52 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CloudSearchDomain = void 0;
4
+ const smithy_client_1 = require("@aws-sdk/smithy-client");
4
5
  const CloudSearchDomainClient_1 = require("./CloudSearchDomainClient");
5
6
  const SearchCommand_1 = require("./commands/SearchCommand");
6
7
  const SuggestCommand_1 = require("./commands/SuggestCommand");
7
8
  const UploadDocumentsCommand_1 = require("./commands/UploadDocumentsCommand");
9
+ const commands = {
10
+ SearchCommand: SearchCommand_1.SearchCommand,
11
+ SuggestCommand: SuggestCommand_1.SuggestCommand,
12
+ UploadDocumentsCommand: UploadDocumentsCommand_1.UploadDocumentsCommand,
13
+ };
8
14
  class CloudSearchDomain extends CloudSearchDomainClient_1.CloudSearchDomainClient {
9
- search(args, optionsOrCb, cb) {
10
- const command = new SearchCommand_1.SearchCommand(args);
11
- if (typeof optionsOrCb === "function") {
12
- this.send(command, optionsOrCb);
13
- }
14
- else if (typeof cb === "function") {
15
- if (typeof optionsOrCb !== "object")
16
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
17
- this.send(command, optionsOrCb || {}, cb);
18
- }
19
- else {
20
- return this.send(command, optionsOrCb);
21
- }
22
- }
23
- suggest(args, optionsOrCb, cb) {
24
- const command = new SuggestCommand_1.SuggestCommand(args);
25
- if (typeof optionsOrCb === "function") {
26
- this.send(command, optionsOrCb);
27
- }
28
- else if (typeof cb === "function") {
29
- if (typeof optionsOrCb !== "object")
30
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
31
- this.send(command, optionsOrCb || {}, cb);
32
- }
33
- else {
34
- return this.send(command, optionsOrCb);
35
- }
36
- }
37
- uploadDocuments(args, optionsOrCb, cb) {
38
- const command = new UploadDocumentsCommand_1.UploadDocumentsCommand(args);
39
- if (typeof optionsOrCb === "function") {
40
- this.send(command, optionsOrCb);
41
- }
42
- else if (typeof cb === "function") {
43
- if (typeof optionsOrCb !== "object")
44
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
45
- this.send(command, optionsOrCb || {}, cb);
46
- }
47
- else {
48
- return this.send(command, optionsOrCb);
49
- }
50
- }
51
15
  }
52
16
  exports.CloudSearchDomain = CloudSearchDomain;
17
+ (0, smithy_client_1.createAggregatedClient)(commands, CloudSearchDomain);
@@ -9,7 +9,7 @@ const se_SearchCommand = async (input, context) => {
9
9
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
10
10
  const headers = {};
11
11
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-01-01/search";
12
- const query = map({
12
+ const query = (0, smithy_client_1.map)({
13
13
  format: [, "sdk"],
14
14
  pretty: [, "true"],
15
15
  cursor: [, input.cursor],
@@ -44,7 +44,7 @@ const se_SuggestCommand = async (input, context) => {
44
44
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
45
45
  const headers = {};
46
46
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-01-01/suggest";
47
- const query = map({
47
+ const query = (0, smithy_client_1.map)({
48
48
  format: [, "sdk"],
49
49
  pretty: [, "true"],
50
50
  q: [, (0, smithy_client_1.expectNonNull)(input.query, `query`)],
@@ -66,11 +66,11 @@ const se_SuggestCommand = async (input, context) => {
66
66
  exports.se_SuggestCommand = se_SuggestCommand;
67
67
  const se_UploadDocumentsCommand = async (input, context) => {
68
68
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
69
- const headers = map({}, isSerializableHeaderValue, {
69
+ const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
70
70
  "content-type": input.contentType || "application/octet-stream",
71
71
  });
72
72
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-01-01/documents/batch";
73
- const query = map({
73
+ const query = (0, smithy_client_1.map)({
74
74
  format: [, "sdk"],
75
75
  });
76
76
  let body;
@@ -93,22 +93,17 @@ const de_SearchCommand = async (output, context) => {
93
93
  if (output.statusCode !== 200 && output.statusCode >= 300) {
94
94
  return de_SearchCommandError(output, context);
95
95
  }
96
- const contents = map({
96
+ const contents = (0, smithy_client_1.map)({
97
97
  $metadata: deserializeMetadata(output),
98
98
  });
99
99
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
100
- if (data.facets != null) {
101
- contents.facets = de_Facets(data.facets, context);
102
- }
103
- if (data.hits != null) {
104
- contents.hits = de_Hits(data.hits, context);
105
- }
106
- if (data.stats != null) {
107
- contents.stats = de_Stats(data.stats, context);
108
- }
109
- if (data.status != null) {
110
- contents.status = de_SearchStatus(data.status, context);
111
- }
100
+ const doc = (0, smithy_client_1.take)(data, {
101
+ facets: smithy_client_1._json,
102
+ hits: smithy_client_1._json,
103
+ stats: (_) => de_Stats(_, context),
104
+ status: smithy_client_1._json,
105
+ });
106
+ Object.assign(contents, doc);
112
107
  return contents;
113
108
  };
114
109
  exports.de_SearchCommand = de_SearchCommand;
@@ -124,10 +119,9 @@ const de_SearchCommandError = async (output, context) => {
124
119
  throw await de_SearchExceptionRes(parsedOutput, context);
125
120
  default:
126
121
  const parsedBody = parsedOutput.body;
127
- (0, smithy_client_1.throwDefaultError)({
122
+ return throwDefaultError({
128
123
  output,
129
124
  parsedBody,
130
- exceptionCtor: CloudSearchDomainServiceException_1.CloudSearchDomainServiceException,
131
125
  errorCode,
132
126
  });
133
127
  }
@@ -136,16 +130,15 @@ const de_SuggestCommand = async (output, context) => {
136
130
  if (output.statusCode !== 200 && output.statusCode >= 300) {
137
131
  return de_SuggestCommandError(output, context);
138
132
  }
139
- const contents = map({
133
+ const contents = (0, smithy_client_1.map)({
140
134
  $metadata: deserializeMetadata(output),
141
135
  });
142
136
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
143
- if (data.status != null) {
144
- contents.status = de_SuggestStatus(data.status, context);
145
- }
146
- if (data.suggest != null) {
147
- contents.suggest = de_SuggestModel(data.suggest, context);
148
- }
137
+ const doc = (0, smithy_client_1.take)(data, {
138
+ status: smithy_client_1._json,
139
+ suggest: smithy_client_1._json,
140
+ });
141
+ Object.assign(contents, doc);
149
142
  return contents;
150
143
  };
151
144
  exports.de_SuggestCommand = de_SuggestCommand;
@@ -161,10 +154,9 @@ const de_SuggestCommandError = async (output, context) => {
161
154
  throw await de_SearchExceptionRes(parsedOutput, context);
162
155
  default:
163
156
  const parsedBody = parsedOutput.body;
164
- (0, smithy_client_1.throwDefaultError)({
157
+ return throwDefaultError({
165
158
  output,
166
159
  parsedBody,
167
- exceptionCtor: CloudSearchDomainServiceException_1.CloudSearchDomainServiceException,
168
160
  errorCode,
169
161
  });
170
162
  }
@@ -173,22 +165,17 @@ const de_UploadDocumentsCommand = async (output, context) => {
173
165
  if (output.statusCode !== 200 && output.statusCode >= 300) {
174
166
  return de_UploadDocumentsCommandError(output, context);
175
167
  }
176
- const contents = map({
168
+ const contents = (0, smithy_client_1.map)({
177
169
  $metadata: deserializeMetadata(output),
178
170
  });
179
171
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
180
- if (data.adds != null) {
181
- contents.adds = (0, smithy_client_1.expectLong)(data.adds);
182
- }
183
- if (data.deletes != null) {
184
- contents.deletes = (0, smithy_client_1.expectLong)(data.deletes);
185
- }
186
- if (data.status != null) {
187
- contents.status = (0, smithy_client_1.expectString)(data.status);
188
- }
189
- if (data.warnings != null) {
190
- contents.warnings = de_DocumentServiceWarnings(data.warnings, context);
191
- }
172
+ const doc = (0, smithy_client_1.take)(data, {
173
+ adds: smithy_client_1.expectLong,
174
+ deletes: smithy_client_1.expectLong,
175
+ status: smithy_client_1.expectString,
176
+ warnings: smithy_client_1._json,
177
+ });
178
+ Object.assign(contents, doc);
192
179
  return contents;
193
180
  };
194
181
  exports.de_UploadDocumentsCommand = de_UploadDocumentsCommand;
@@ -204,24 +191,22 @@ const de_UploadDocumentsCommandError = async (output, context) => {
204
191
  throw await de_DocumentServiceExceptionRes(parsedOutput, context);
205
192
  default:
206
193
  const parsedBody = parsedOutput.body;
207
- (0, smithy_client_1.throwDefaultError)({
194
+ return throwDefaultError({
208
195
  output,
209
196
  parsedBody,
210
- exceptionCtor: CloudSearchDomainServiceException_1.CloudSearchDomainServiceException,
211
197
  errorCode,
212
198
  });
213
199
  }
214
200
  };
215
- const map = smithy_client_1.map;
201
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(CloudSearchDomainServiceException_1.CloudSearchDomainServiceException);
216
202
  const de_DocumentServiceExceptionRes = async (parsedOutput, context) => {
217
- const contents = map({});
203
+ const contents = (0, smithy_client_1.map)({});
218
204
  const data = parsedOutput.body;
219
- if (data.message != null) {
220
- contents.message = (0, smithy_client_1.expectString)(data.message);
221
- }
222
- if (data.status != null) {
223
- contents.status = (0, smithy_client_1.expectString)(data.status);
224
- }
205
+ const doc = (0, smithy_client_1.take)(data, {
206
+ message: smithy_client_1.expectString,
207
+ status: smithy_client_1.expectString,
208
+ });
209
+ Object.assign(contents, doc);
225
210
  const exception = new models_0_1.DocumentServiceException({
226
211
  $metadata: deserializeMetadata(parsedOutput),
227
212
  ...contents,
@@ -229,146 +214,29 @@ const de_DocumentServiceExceptionRes = async (parsedOutput, context) => {
229
214
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
230
215
  };
231
216
  const de_SearchExceptionRes = async (parsedOutput, context) => {
232
- const contents = map({});
217
+ const contents = (0, smithy_client_1.map)({});
233
218
  const data = parsedOutput.body;
234
- if (data.message != null) {
235
- contents.message = (0, smithy_client_1.expectString)(data.message);
236
- }
219
+ const doc = (0, smithy_client_1.take)(data, {
220
+ message: smithy_client_1.expectString,
221
+ });
222
+ Object.assign(contents, doc);
237
223
  const exception = new models_0_1.SearchException({
238
224
  $metadata: deserializeMetadata(parsedOutput),
239
225
  ...contents,
240
226
  });
241
227
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
242
228
  };
243
- const de_Bucket = (output, context) => {
244
- return {
245
- count: (0, smithy_client_1.expectLong)(output.count),
246
- value: (0, smithy_client_1.expectString)(output.value),
247
- };
248
- };
249
- const de_BucketInfo = (output, context) => {
250
- return {
251
- buckets: output.buckets != null ? de_BucketList(output.buckets, context) : undefined,
252
- };
253
- };
254
- const de_BucketList = (output, context) => {
255
- const retVal = (output || [])
256
- .filter((e) => e != null)
257
- .map((entry) => {
258
- if (entry === null) {
259
- return null;
260
- }
261
- return de_Bucket(entry, context);
262
- });
263
- return retVal;
264
- };
265
- const de_DocumentServiceWarning = (output, context) => {
266
- return {
267
- message: (0, smithy_client_1.expectString)(output.message),
268
- };
269
- };
270
- const de_DocumentServiceWarnings = (output, context) => {
271
- const retVal = (output || [])
272
- .filter((e) => e != null)
273
- .map((entry) => {
274
- if (entry === null) {
275
- return null;
276
- }
277
- return de_DocumentServiceWarning(entry, context);
278
- });
279
- return retVal;
280
- };
281
- const de_Exprs = (output, context) => {
282
- return Object.entries(output).reduce((acc, [key, value]) => {
283
- if (value === null) {
284
- return acc;
285
- }
286
- acc[key] = (0, smithy_client_1.expectString)(value);
287
- return acc;
288
- }, {});
289
- };
290
- const de_Facets = (output, context) => {
291
- return Object.entries(output).reduce((acc, [key, value]) => {
292
- if (value === null) {
293
- return acc;
294
- }
295
- acc[key] = de_BucketInfo(value, context);
296
- return acc;
297
- }, {});
298
- };
299
- const de_Fields = (output, context) => {
300
- return Object.entries(output).reduce((acc, [key, value]) => {
301
- if (value === null) {
302
- return acc;
303
- }
304
- acc[key] = de_FieldValue(value, context);
305
- return acc;
306
- }, {});
307
- };
308
229
  const de_FieldStats = (output, context) => {
309
- return {
310
- count: (0, smithy_client_1.expectLong)(output.count),
311
- max: (0, smithy_client_1.expectString)(output.max),
312
- mean: (0, smithy_client_1.expectString)(output.mean),
313
- min: (0, smithy_client_1.expectString)(output.min),
314
- missing: (0, smithy_client_1.expectLong)(output.missing),
315
- stddev: (0, smithy_client_1.limitedParseDouble)(output.stddev),
316
- sum: (0, smithy_client_1.limitedParseDouble)(output.sum),
317
- sumOfSquares: (0, smithy_client_1.limitedParseDouble)(output.sumOfSquares),
318
- };
319
- };
320
- const de_FieldValue = (output, context) => {
321
- const retVal = (output || [])
322
- .filter((e) => e != null)
323
- .map((entry) => {
324
- if (entry === null) {
325
- return null;
326
- }
327
- return (0, smithy_client_1.expectString)(entry);
230
+ return (0, smithy_client_1.take)(output, {
231
+ count: smithy_client_1.expectLong,
232
+ max: smithy_client_1.expectString,
233
+ mean: smithy_client_1.expectString,
234
+ min: smithy_client_1.expectString,
235
+ missing: smithy_client_1.expectLong,
236
+ stddev: smithy_client_1.limitedParseDouble,
237
+ sum: smithy_client_1.limitedParseDouble,
238
+ sumOfSquares: smithy_client_1.limitedParseDouble,
328
239
  });
329
- return retVal;
330
- };
331
- const de_Highlights = (output, context) => {
332
- return Object.entries(output).reduce((acc, [key, value]) => {
333
- if (value === null) {
334
- return acc;
335
- }
336
- acc[key] = (0, smithy_client_1.expectString)(value);
337
- return acc;
338
- }, {});
339
- };
340
- const de_Hit = (output, context) => {
341
- return {
342
- exprs: output.exprs != null ? de_Exprs(output.exprs, context) : undefined,
343
- fields: output.fields != null ? de_Fields(output.fields, context) : undefined,
344
- highlights: output.highlights != null ? de_Highlights(output.highlights, context) : undefined,
345
- id: (0, smithy_client_1.expectString)(output.id),
346
- };
347
- };
348
- const de_HitList = (output, context) => {
349
- const retVal = (output || [])
350
- .filter((e) => e != null)
351
- .map((entry) => {
352
- if (entry === null) {
353
- return null;
354
- }
355
- return de_Hit(entry, context);
356
- });
357
- return retVal;
358
- };
359
- const de_Hits = (output, context) => {
360
- return {
361
- cursor: (0, smithy_client_1.expectString)(output.cursor),
362
- found: (0, smithy_client_1.expectLong)(output.found),
363
- hit: output.hit != null ? de_HitList(output.hit, context) : undefined,
364
- start: (0, smithy_client_1.expectLong)(output.start),
365
- };
366
- };
367
- const de_SearchStatus = (output, context) => {
368
- return {
369
- rid: (0, smithy_client_1.expectString)(output.rid),
370
- timems: (0, smithy_client_1.expectLong)(output.timems),
371
- };
372
240
  };
373
241
  const de_Stats = (output, context) => {
374
242
  return Object.entries(output).reduce((acc, [key, value]) => {
@@ -379,37 +247,6 @@ const de_Stats = (output, context) => {
379
247
  return acc;
380
248
  }, {});
381
249
  };
382
- const de_SuggestionMatch = (output, context) => {
383
- return {
384
- id: (0, smithy_client_1.expectString)(output.id),
385
- score: (0, smithy_client_1.expectLong)(output.score),
386
- suggestion: (0, smithy_client_1.expectString)(output.suggestion),
387
- };
388
- };
389
- const de_Suggestions = (output, context) => {
390
- const retVal = (output || [])
391
- .filter((e) => e != null)
392
- .map((entry) => {
393
- if (entry === null) {
394
- return null;
395
- }
396
- return de_SuggestionMatch(entry, context);
397
- });
398
- return retVal;
399
- };
400
- const de_SuggestModel = (output, context) => {
401
- return {
402
- found: (0, smithy_client_1.expectLong)(output.found),
403
- query: (0, smithy_client_1.expectString)(output.query),
404
- suggestions: output.suggestions != null ? de_Suggestions(output.suggestions, context) : undefined,
405
- };
406
- };
407
- const de_SuggestStatus = (output, context) => {
408
- return {
409
- rid: (0, smithy_client_1.expectString)(output.rid),
410
- timems: (0, smithy_client_1.expectLong)(output.timems),
411
- };
412
- };
413
250
  const deserializeMetadata = (output) => ({
414
251
  httpStatusCode: output.statusCode,
415
252
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -1,48 +1,13 @@
1
+ import { createAggregatedClient } from "@aws-sdk/smithy-client";
1
2
  import { CloudSearchDomainClient } from "./CloudSearchDomainClient";
2
3
  import { SearchCommand } from "./commands/SearchCommand";
3
4
  import { SuggestCommand } from "./commands/SuggestCommand";
4
5
  import { UploadDocumentsCommand, } from "./commands/UploadDocumentsCommand";
6
+ const commands = {
7
+ SearchCommand,
8
+ SuggestCommand,
9
+ UploadDocumentsCommand,
10
+ };
5
11
  export class CloudSearchDomain extends CloudSearchDomainClient {
6
- search(args, optionsOrCb, cb) {
7
- const command = new SearchCommand(args);
8
- if (typeof optionsOrCb === "function") {
9
- this.send(command, optionsOrCb);
10
- }
11
- else if (typeof cb === "function") {
12
- if (typeof optionsOrCb !== "object")
13
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
14
- this.send(command, optionsOrCb || {}, cb);
15
- }
16
- else {
17
- return this.send(command, optionsOrCb);
18
- }
19
- }
20
- suggest(args, optionsOrCb, cb) {
21
- const command = new SuggestCommand(args);
22
- if (typeof optionsOrCb === "function") {
23
- this.send(command, optionsOrCb);
24
- }
25
- else if (typeof cb === "function") {
26
- if (typeof optionsOrCb !== "object")
27
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
28
- this.send(command, optionsOrCb || {}, cb);
29
- }
30
- else {
31
- return this.send(command, optionsOrCb);
32
- }
33
- }
34
- uploadDocuments(args, optionsOrCb, cb) {
35
- const command = new UploadDocumentsCommand(args);
36
- if (typeof optionsOrCb === "function") {
37
- this.send(command, optionsOrCb);
38
- }
39
- else if (typeof cb === "function") {
40
- if (typeof optionsOrCb !== "object")
41
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
42
- this.send(command, optionsOrCb || {}, cb);
43
- }
44
- else {
45
- return this.send(command, optionsOrCb);
46
- }
47
- }
48
12
  }
13
+ createAggregatedClient(commands, CloudSearchDomain);
@@ -1,7 +1,7 @@
1
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
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";
2
+ import { _json, decorateServiceException as __decorateServiceException, expectLong as __expectLong, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, map, take, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { CloudSearchDomainServiceException as __BaseException } from "../models/CloudSearchDomainServiceException";
4
- import { DocumentServiceException, SearchException, } from "../models/models_0";
4
+ import { DocumentServiceException, SearchException } from "../models/models_0";
5
5
  export const se_SearchCommand = async (input, context) => {
6
6
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
7
7
  const headers = {};
@@ -91,18 +91,13 @@ export const de_SearchCommand = async (output, context) => {
91
91
  $metadata: deserializeMetadata(output),
92
92
  });
93
93
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
94
- if (data.facets != null) {
95
- contents.facets = de_Facets(data.facets, context);
96
- }
97
- if (data.hits != null) {
98
- contents.hits = de_Hits(data.hits, context);
99
- }
100
- if (data.stats != null) {
101
- contents.stats = de_Stats(data.stats, context);
102
- }
103
- if (data.status != null) {
104
- contents.status = de_SearchStatus(data.status, context);
105
- }
94
+ const doc = take(data, {
95
+ facets: _json,
96
+ hits: _json,
97
+ stats: (_) => de_Stats(_, context),
98
+ status: _json,
99
+ });
100
+ Object.assign(contents, doc);
106
101
  return contents;
107
102
  };
108
103
  const de_SearchCommandError = async (output, context) => {
@@ -117,10 +112,9 @@ const de_SearchCommandError = async (output, context) => {
117
112
  throw await de_SearchExceptionRes(parsedOutput, context);
118
113
  default:
119
114
  const parsedBody = parsedOutput.body;
120
- throwDefaultError({
115
+ return throwDefaultError({
121
116
  output,
122
117
  parsedBody,
123
- exceptionCtor: __BaseException,
124
118
  errorCode,
125
119
  });
126
120
  }
@@ -133,12 +127,11 @@ export const de_SuggestCommand = async (output, context) => {
133
127
  $metadata: deserializeMetadata(output),
134
128
  });
135
129
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
136
- if (data.status != null) {
137
- contents.status = de_SuggestStatus(data.status, context);
138
- }
139
- if (data.suggest != null) {
140
- contents.suggest = de_SuggestModel(data.suggest, context);
141
- }
130
+ const doc = take(data, {
131
+ status: _json,
132
+ suggest: _json,
133
+ });
134
+ Object.assign(contents, doc);
142
135
  return contents;
143
136
  };
144
137
  const de_SuggestCommandError = async (output, context) => {
@@ -153,10 +146,9 @@ const de_SuggestCommandError = async (output, context) => {
153
146
  throw await de_SearchExceptionRes(parsedOutput, context);
154
147
  default:
155
148
  const parsedBody = parsedOutput.body;
156
- throwDefaultError({
149
+ return throwDefaultError({
157
150
  output,
158
151
  parsedBody,
159
- exceptionCtor: __BaseException,
160
152
  errorCode,
161
153
  });
162
154
  }
@@ -169,18 +161,13 @@ export const de_UploadDocumentsCommand = async (output, context) => {
169
161
  $metadata: deserializeMetadata(output),
170
162
  });
171
163
  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 = de_DocumentServiceWarnings(data.warnings, context);
183
- }
164
+ const doc = take(data, {
165
+ adds: __expectLong,
166
+ deletes: __expectLong,
167
+ status: __expectString,
168
+ warnings: _json,
169
+ });
170
+ Object.assign(contents, doc);
184
171
  return contents;
185
172
  };
186
173
  const de_UploadDocumentsCommandError = async (output, context) => {
@@ -195,24 +182,22 @@ const de_UploadDocumentsCommandError = async (output, context) => {
195
182
  throw await de_DocumentServiceExceptionRes(parsedOutput, context);
196
183
  default:
197
184
  const parsedBody = parsedOutput.body;
198
- throwDefaultError({
185
+ return throwDefaultError({
199
186
  output,
200
187
  parsedBody,
201
- exceptionCtor: __BaseException,
202
188
  errorCode,
203
189
  });
204
190
  }
205
191
  };
206
- const map = __map;
192
+ const throwDefaultError = withBaseException(__BaseException);
207
193
  const de_DocumentServiceExceptionRes = async (parsedOutput, context) => {
208
194
  const contents = map({});
209
195
  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
- }
196
+ const doc = take(data, {
197
+ message: __expectString,
198
+ status: __expectString,
199
+ });
200
+ Object.assign(contents, doc);
216
201
  const exception = new DocumentServiceException({
217
202
  $metadata: deserializeMetadata(parsedOutput),
218
203
  ...contents,
@@ -222,144 +207,27 @@ const de_DocumentServiceExceptionRes = async (parsedOutput, context) => {
222
207
  const de_SearchExceptionRes = async (parsedOutput, context) => {
223
208
  const contents = map({});
224
209
  const data = parsedOutput.body;
225
- if (data.message != null) {
226
- contents.message = __expectString(data.message);
227
- }
210
+ const doc = take(data, {
211
+ message: __expectString,
212
+ });
213
+ Object.assign(contents, doc);
228
214
  const exception = new SearchException({
229
215
  $metadata: deserializeMetadata(parsedOutput),
230
216
  ...contents,
231
217
  });
232
218
  return __decorateServiceException(exception, parsedOutput.body);
233
219
  };
234
- const de_Bucket = (output, context) => {
235
- return {
236
- count: __expectLong(output.count),
237
- value: __expectString(output.value),
238
- };
239
- };
240
- const de_BucketInfo = (output, context) => {
241
- return {
242
- buckets: output.buckets != null ? de_BucketList(output.buckets, context) : undefined,
243
- };
244
- };
245
- const de_BucketList = (output, context) => {
246
- const retVal = (output || [])
247
- .filter((e) => e != null)
248
- .map((entry) => {
249
- if (entry === null) {
250
- return null;
251
- }
252
- return de_Bucket(entry, context);
253
- });
254
- return retVal;
255
- };
256
- const de_DocumentServiceWarning = (output, context) => {
257
- return {
258
- message: __expectString(output.message),
259
- };
260
- };
261
- const de_DocumentServiceWarnings = (output, context) => {
262
- const retVal = (output || [])
263
- .filter((e) => e != null)
264
- .map((entry) => {
265
- if (entry === null) {
266
- return null;
267
- }
268
- return de_DocumentServiceWarning(entry, context);
269
- });
270
- return retVal;
271
- };
272
- const de_Exprs = (output, context) => {
273
- return Object.entries(output).reduce((acc, [key, value]) => {
274
- if (value === null) {
275
- return acc;
276
- }
277
- acc[key] = __expectString(value);
278
- return acc;
279
- }, {});
280
- };
281
- const de_Facets = (output, context) => {
282
- return Object.entries(output).reduce((acc, [key, value]) => {
283
- if (value === null) {
284
- return acc;
285
- }
286
- acc[key] = de_BucketInfo(value, context);
287
- return acc;
288
- }, {});
289
- };
290
- const de_Fields = (output, context) => {
291
- return Object.entries(output).reduce((acc, [key, value]) => {
292
- if (value === null) {
293
- return acc;
294
- }
295
- acc[key] = de_FieldValue(value, context);
296
- return acc;
297
- }, {});
298
- };
299
220
  const de_FieldStats = (output, context) => {
300
- return {
301
- count: __expectLong(output.count),
302
- max: __expectString(output.max),
303
- mean: __expectString(output.mean),
304
- min: __expectString(output.min),
305
- missing: __expectLong(output.missing),
306
- stddev: __limitedParseDouble(output.stddev),
307
- sum: __limitedParseDouble(output.sum),
308
- sumOfSquares: __limitedParseDouble(output.sumOfSquares),
309
- };
310
- };
311
- const de_FieldValue = (output, context) => {
312
- const retVal = (output || [])
313
- .filter((e) => e != null)
314
- .map((entry) => {
315
- if (entry === null) {
316
- return null;
317
- }
318
- return __expectString(entry);
221
+ return take(output, {
222
+ count: __expectLong,
223
+ max: __expectString,
224
+ mean: __expectString,
225
+ min: __expectString,
226
+ missing: __expectLong,
227
+ stddev: __limitedParseDouble,
228
+ sum: __limitedParseDouble,
229
+ sumOfSquares: __limitedParseDouble,
319
230
  });
320
- return retVal;
321
- };
322
- const de_Highlights = (output, context) => {
323
- return Object.entries(output).reduce((acc, [key, value]) => {
324
- if (value === null) {
325
- return acc;
326
- }
327
- acc[key] = __expectString(value);
328
- return acc;
329
- }, {});
330
- };
331
- const de_Hit = (output, context) => {
332
- return {
333
- exprs: output.exprs != null ? de_Exprs(output.exprs, context) : undefined,
334
- fields: output.fields != null ? de_Fields(output.fields, context) : undefined,
335
- highlights: output.highlights != null ? de_Highlights(output.highlights, context) : undefined,
336
- id: __expectString(output.id),
337
- };
338
- };
339
- const de_HitList = (output, context) => {
340
- const retVal = (output || [])
341
- .filter((e) => e != null)
342
- .map((entry) => {
343
- if (entry === null) {
344
- return null;
345
- }
346
- return de_Hit(entry, context);
347
- });
348
- return retVal;
349
- };
350
- const de_Hits = (output, context) => {
351
- return {
352
- cursor: __expectString(output.cursor),
353
- found: __expectLong(output.found),
354
- hit: output.hit != null ? de_HitList(output.hit, context) : undefined,
355
- start: __expectLong(output.start),
356
- };
357
- };
358
- const de_SearchStatus = (output, context) => {
359
- return {
360
- rid: __expectString(output.rid),
361
- timems: __expectLong(output.timems),
362
- };
363
231
  };
364
232
  const de_Stats = (output, context) => {
365
233
  return Object.entries(output).reduce((acc, [key, value]) => {
@@ -370,37 +238,6 @@ const de_Stats = (output, context) => {
370
238
  return acc;
371
239
  }, {});
372
240
  };
373
- const de_SuggestionMatch = (output, context) => {
374
- return {
375
- id: __expectString(output.id),
376
- score: __expectLong(output.score),
377
- suggestion: __expectString(output.suggestion),
378
- };
379
- };
380
- const de_Suggestions = (output, context) => {
381
- const retVal = (output || [])
382
- .filter((e) => e != null)
383
- .map((entry) => {
384
- if (entry === null) {
385
- return null;
386
- }
387
- return de_SuggestionMatch(entry, context);
388
- });
389
- return retVal;
390
- };
391
- const de_SuggestModel = (output, context) => {
392
- return {
393
- found: __expectLong(output.found),
394
- query: __expectString(output.query),
395
- suggestions: output.suggestions != null ? de_Suggestions(output.suggestions, context) : undefined,
396
- };
397
- };
398
- const de_SuggestStatus = (output, context) => {
399
- return {
400
- rid: __expectString(output.rid),
401
- timems: __expectLong(output.timems),
402
- };
403
- };
404
241
  const deserializeMetadata = (output) => ({
405
242
  httpStatusCode: output.statusCode,
406
243
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -3,47 +3,32 @@ import { CloudSearchDomainClient } from "./CloudSearchDomainClient";
3
3
  import { SearchCommandInput, SearchCommandOutput } from "./commands/SearchCommand";
4
4
  import { SuggestCommandInput, SuggestCommandOutput } from "./commands/SuggestCommand";
5
5
  import { UploadDocumentsCommandInput, UploadDocumentsCommandOutput } from "./commands/UploadDocumentsCommand";
6
- /**
7
- * @public
8
- * <p>You use the AmazonCloudSearch2013 API to upload documents to a search domain and search those documents. </p>
9
- *
10
- * <p>The endpoints for submitting <code>UploadDocuments</code>, <code>Search</code>, and <code>Suggest</code> requests are domain-specific. To get the endpoints for your domain, use the Amazon CloudSearch configuration service <code>DescribeDomains</code> action. The domain endpoints are also displayed on the domain dashboard in the Amazon CloudSearch console. You submit suggest requests to the search endpoint. </p>
11
- * <p>For more information, see the <a href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide">Amazon CloudSearch Developer Guide</a>.</p>
12
- */
13
- export declare class CloudSearchDomain extends CloudSearchDomainClient {
6
+ export interface CloudSearchDomain {
14
7
  /**
15
- * @public
16
- * <p>Retrieves a list of documents that match the specified search criteria. How you specify the search criteria depends on which query parser you use. Amazon CloudSearch supports four query parsers:</p>
17
- * <ul>
18
- * <li><code>simple</code>: search all <code>text</code> and <code>text-array</code> fields for the specified string. Search for phrases, individual terms, and prefixes. </li>
19
- * <li><code>structured</code>: search specific fields, construct compound queries using Boolean operators, and use advanced features such as term boosting and proximity searching.</li>
20
- * <li><code>lucene</code>: specify search criteria using the Apache Lucene query parser syntax.</li>
21
- * <li><code>dismax</code>: specify search criteria using the simplified subset of the Apache Lucene query parser syntax defined by the DisMax query parser.</li>
22
- * </ul>
23
- * <p>For more information, see <a href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching.html">Searching Your Data</a> in the <i>Amazon CloudSearch Developer Guide</i>.</p>
24
- * <p>The endpoint for submitting <code>Search</code> requests is domain-specific. You submit search requests to a domain's search endpoint. To get the search endpoint for your domain, use the Amazon CloudSearch configuration service <code>DescribeDomains</code> action. A domain's endpoints are also displayed on the domain dashboard in the Amazon CloudSearch console. </p>
8
+ * @see {@link SearchCommand}
25
9
  */
26
10
  search(args: SearchCommandInput, options?: __HttpHandlerOptions): Promise<SearchCommandOutput>;
27
11
  search(args: SearchCommandInput, cb: (err: any, data?: SearchCommandOutput) => void): void;
28
12
  search(args: SearchCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: SearchCommandOutput) => void): void;
29
13
  /**
30
- * @public
31
- * <p>Retrieves autocomplete suggestions for a partial query string. You can use suggestions enable you to display likely matches before users finish typing. In Amazon CloudSearch, suggestions are based on the contents of a particular text field. When you request suggestions, Amazon CloudSearch finds all of the documents whose values in the suggester field start with the specified query string. The beginning of the field must match the query string to be considered a match. </p>
32
- * <p>For more information about configuring suggesters and retrieving suggestions, see <a href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide/getting-suggestions.html">Getting Suggestions</a> in the <i>Amazon CloudSearch Developer Guide</i>. </p>
33
- *
34
- * <p>The endpoint for submitting <code>Suggest</code> requests is domain-specific. You submit suggest requests to a domain's search endpoint. To get the search endpoint for your domain, use the Amazon CloudSearch configuration service <code>DescribeDomains</code> action. A domain's endpoints are also displayed on the domain dashboard in the Amazon CloudSearch console. </p>
14
+ * @see {@link SuggestCommand}
35
15
  */
36
16
  suggest(args: SuggestCommandInput, options?: __HttpHandlerOptions): Promise<SuggestCommandOutput>;
37
17
  suggest(args: SuggestCommandInput, cb: (err: any, data?: SuggestCommandOutput) => void): void;
38
18
  suggest(args: SuggestCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: SuggestCommandOutput) => void): void;
39
19
  /**
40
- * @public
41
- * <p>Posts a batch of documents to a search domain for indexing. A document batch is a collection of add and delete operations that represent the documents you want to add, update, or delete from your domain. Batches can be described in either JSON or XML. Each item that you want Amazon CloudSearch to return as a search result (such as a product) is represented as a document. Every document has a unique ID and one or more fields that contain the data that you want to search and return in results. Individual documents cannot contain more than 1 MB of data. The entire batch cannot exceed 5 MB. To get the best possible upload performance, group add and delete operations in batches that are close the 5 MB limit. Submitting a large volume of single-document batches can overload a domain's document service. </p>
42
- * <p>The endpoint for submitting <code>UploadDocuments</code> requests is domain-specific. To get the document endpoint for your domain, use the Amazon CloudSearch configuration service <code>DescribeDomains</code> action. A domain's endpoints are also displayed on the domain dashboard in the Amazon CloudSearch console. </p>
43
- * <p>For more information about formatting your data for Amazon CloudSearch, see <a href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide/preparing-data.html">Preparing Your Data</a> in the <i>Amazon CloudSearch Developer Guide</i>.
44
- * For more information about uploading data for indexing, see <a href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide/uploading-data.html">Uploading Data</a> in the <i>Amazon CloudSearch Developer Guide</i>. </p>
20
+ * @see {@link UploadDocumentsCommand}
45
21
  */
46
22
  uploadDocuments(args: UploadDocumentsCommandInput, options?: __HttpHandlerOptions): Promise<UploadDocumentsCommandOutput>;
47
23
  uploadDocuments(args: UploadDocumentsCommandInput, cb: (err: any, data?: UploadDocumentsCommandOutput) => void): void;
48
24
  uploadDocuments(args: UploadDocumentsCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: UploadDocumentsCommandOutput) => void): void;
49
25
  }
26
+ /**
27
+ * @public
28
+ * <p>You use the AmazonCloudSearch2013 API to upload documents to a search domain and search those documents. </p>
29
+ *
30
+ * <p>The endpoints for submitting <code>UploadDocuments</code>, <code>Search</code>, and <code>Suggest</code> requests are domain-specific. To get the endpoints for your domain, use the Amazon CloudSearch configuration service <code>DescribeDomains</code> action. The domain endpoints are also displayed on the domain dashboard in the Amazon CloudSearch console. You submit suggest requests to the search endpoint. </p>
31
+ * <p>For more information, see the <a href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide">Amazon CloudSearch Developer Guide</a>.</p>
32
+ */
33
+ export declare class CloudSearchDomain extends CloudSearchDomainClient implements CloudSearchDomain {
34
+ }
@@ -12,7 +12,7 @@ import {
12
12
  UploadDocumentsCommandInput,
13
13
  UploadDocumentsCommandOutput,
14
14
  } from "./commands/UploadDocumentsCommand";
15
- export declare class CloudSearchDomain extends CloudSearchDomainClient {
15
+ export interface CloudSearchDomain {
16
16
  search(
17
17
  args: SearchCommandInput,
18
18
  options?: __HttpHandlerOptions
@@ -53,3 +53,6 @@ export declare class CloudSearchDomain extends CloudSearchDomainClient {
53
53
  cb: (err: any, data?: UploadDocumentsCommandOutput) => void
54
54
  ): void;
55
55
  }
56
+ export declare class CloudSearchDomain
57
+ extends CloudSearchDomainClient
58
+ implements CloudSearchDomain {}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-cloudsearch-domain",
3
3
  "description": "AWS SDK for JavaScript Cloudsearch Domain Client for Node.js, Browser and React Native",
4
- "version": "3.312.0",
4
+ "version": "3.316.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -21,9 +21,9 @@
21
21
  "dependencies": {
22
22
  "@aws-crypto/sha256-browser": "3.0.0",
23
23
  "@aws-crypto/sha256-js": "3.0.0",
24
- "@aws-sdk/client-sts": "3.312.0",
24
+ "@aws-sdk/client-sts": "3.316.0",
25
25
  "@aws-sdk/config-resolver": "3.310.0",
26
- "@aws-sdk/credential-provider-node": "3.310.0",
26
+ "@aws-sdk/credential-provider-node": "3.316.0",
27
27
  "@aws-sdk/fetch-http-handler": "3.310.0",
28
28
  "@aws-sdk/hash-node": "3.310.0",
29
29
  "@aws-sdk/invalid-dependency": "3.310.0",
@@ -40,14 +40,14 @@
40
40
  "@aws-sdk/node-config-provider": "3.310.0",
41
41
  "@aws-sdk/node-http-handler": "3.310.0",
42
42
  "@aws-sdk/protocol-http": "3.310.0",
43
- "@aws-sdk/smithy-client": "3.310.0",
43
+ "@aws-sdk/smithy-client": "3.316.0",
44
44
  "@aws-sdk/types": "3.310.0",
45
45
  "@aws-sdk/url-parser": "3.310.0",
46
46
  "@aws-sdk/util-base64": "3.310.0",
47
47
  "@aws-sdk/util-body-length-browser": "3.310.0",
48
48
  "@aws-sdk/util-body-length-node": "3.310.0",
49
- "@aws-sdk/util-defaults-mode-browser": "3.310.0",
50
- "@aws-sdk/util-defaults-mode-node": "3.310.0",
49
+ "@aws-sdk/util-defaults-mode-browser": "3.316.0",
50
+ "@aws-sdk/util-defaults-mode-node": "3.316.0",
51
51
  "@aws-sdk/util-endpoints": "3.310.0",
52
52
  "@aws-sdk/util-retry": "3.310.0",
53
53
  "@aws-sdk/util-user-agent-browser": "3.310.0",