@aws-sdk/client-cloudsearch-domain 3.35.0 → 3.38.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.
Files changed (92) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist-cjs/CloudSearchDomain.js +0 -7
  3. package/dist-cjs/CloudSearchDomainClient.js +0 -12
  4. package/dist-cjs/commands/SearchCommand.js +0 -33
  5. package/dist-cjs/commands/SuggestCommand.js +0 -28
  6. package/dist-cjs/commands/UploadDocumentsCommand.js +0 -28
  7. package/dist-cjs/commands/index.js +6 -0
  8. package/dist-cjs/endpoints.js +1 -2
  9. package/dist-cjs/index.js +3 -6
  10. package/dist-cjs/models/index.js +0 -1
  11. package/dist-cjs/models/models_0.js +0 -55
  12. package/dist-cjs/protocols/Aws_restJson1.js +0 -6
  13. package/dist-cjs/runtimeConfig.browser.js +1 -6
  14. package/dist-cjs/runtimeConfig.js +2 -7
  15. package/dist-cjs/runtimeConfig.native.js +0 -4
  16. package/dist-cjs/runtimeConfig.shared.js +0 -4
  17. package/dist-es/CloudSearchDomain.js +0 -1
  18. package/dist-es/CloudSearchDomainClient.js +0 -1
  19. package/dist-es/commands/SearchCommand.js +0 -1
  20. package/dist-es/commands/SuggestCommand.js +0 -1
  21. package/dist-es/commands/UploadDocumentsCommand.js +0 -1
  22. package/dist-es/commands/index.js +3 -0
  23. package/dist-es/endpoints.js +1 -2
  24. package/dist-es/index.js +3 -6
  25. package/dist-es/models/index.js +0 -1
  26. package/dist-es/models/models_0.js +0 -1
  27. package/dist-es/protocols/Aws_restJson1.js +0 -1
  28. package/dist-es/runtimeConfig.browser.js +1 -2
  29. package/dist-es/runtimeConfig.js +2 -3
  30. package/dist-es/runtimeConfig.native.js +0 -1
  31. package/dist-es/runtimeConfig.shared.js +0 -1
  32. package/dist-types/commands/index.d.ts +3 -0
  33. package/dist-types/index.d.ts +3 -5
  34. package/dist-types/ts3.4/CloudSearchDomain.d.ts +4 -29
  35. package/dist-types/ts3.4/CloudSearchDomainClient.d.ts +24 -92
  36. package/dist-types/ts3.4/commands/SearchCommand.d.ts +2 -28
  37. package/dist-types/ts3.4/commands/SuggestCommand.d.ts +2 -23
  38. package/dist-types/ts3.4/commands/UploadDocumentsCommand.d.ts +5 -30
  39. package/dist-types/ts3.4/commands/index.d.ts +3 -0
  40. package/dist-types/ts3.4/index.d.ts +3 -5
  41. package/dist-types/ts3.4/models/models_0.d.ts +99 -513
  42. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -3
  43. package/dist-types/ts3.4/runtimeConfig.d.ts +1 -3
  44. package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -3
  45. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +1 -3
  46. package/package.json +33 -30
  47. package/dist-cjs/CloudSearchDomain.js.map +0 -1
  48. package/dist-cjs/CloudSearchDomainClient.js.map +0 -1
  49. package/dist-cjs/commands/SearchCommand.js.map +0 -1
  50. package/dist-cjs/commands/SuggestCommand.js.map +0 -1
  51. package/dist-cjs/commands/UploadDocumentsCommand.js.map +0 -1
  52. package/dist-cjs/endpoints.js.map +0 -1
  53. package/dist-cjs/index.js.map +0 -1
  54. package/dist-cjs/models/index.js.map +0 -1
  55. package/dist-cjs/models/models_0.js.map +0 -1
  56. package/dist-cjs/protocols/Aws_restJson1.js.map +0 -1
  57. package/dist-cjs/runtimeConfig.browser.js.map +0 -1
  58. package/dist-cjs/runtimeConfig.js.map +0 -1
  59. package/dist-cjs/runtimeConfig.native.js.map +0 -1
  60. package/dist-cjs/runtimeConfig.shared.js.map +0 -1
  61. package/dist-es/CloudSearchDomain.js.map +0 -1
  62. package/dist-es/CloudSearchDomainClient.js.map +0 -1
  63. package/dist-es/commands/SearchCommand.js.map +0 -1
  64. package/dist-es/commands/SuggestCommand.js.map +0 -1
  65. package/dist-es/commands/UploadDocumentsCommand.js.map +0 -1
  66. package/dist-es/endpoints.js.map +0 -1
  67. package/dist-es/index.js.map +0 -1
  68. package/dist-es/models/index.js.map +0 -1
  69. package/dist-es/models/models_0.js.map +0 -1
  70. package/dist-es/protocols/Aws_restJson1.js.map +0 -1
  71. package/dist-es/runtimeConfig.browser.js.map +0 -1
  72. package/dist-es/runtimeConfig.js.map +0 -1
  73. package/dist-es/runtimeConfig.native.js.map +0 -1
  74. package/dist-es/runtimeConfig.shared.js.map +0 -1
  75. package/jest.config.js +0 -4
  76. package/src/CloudSearchDomain.ts +0 -116
  77. package/src/CloudSearchDomainClient.ts +0 -242
  78. package/src/commands/SearchCommand.ts +0 -104
  79. package/src/commands/SuggestCommand.ts +0 -102
  80. package/src/commands/UploadDocumentsCommand.ts +0 -111
  81. package/src/endpoints.ts +0 -57
  82. package/src/index.ts +0 -6
  83. package/src/models/index.ts +0 -1
  84. package/src/models/models_0.ts +0 -790
  85. package/src/protocols/Aws_restJson1.ts +0 -646
  86. package/src/runtimeConfig.browser.ts +0 -41
  87. package/src/runtimeConfig.native.ts +0 -17
  88. package/src/runtimeConfig.shared.ts +0 -17
  89. package/src/runtimeConfig.ts +0 -46
  90. package/tsconfig.es.json +0 -10
  91. package/tsconfig.json +0 -33
  92. package/tsconfig.types.json +0 -9
@@ -1,646 +0,0 @@
1
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
2
- import {
3
- expectLong as __expectLong,
4
- expectNonNull as __expectNonNull,
5
- expectObject as __expectObject,
6
- expectString as __expectString,
7
- extendedEncodeURIComponent as __extendedEncodeURIComponent,
8
- limitedParseDouble as __limitedParseDouble,
9
- } from "@aws-sdk/smithy-client";
10
- import {
11
- Endpoint as __Endpoint,
12
- MetadataBearer as __MetadataBearer,
13
- ResponseMetadata as __ResponseMetadata,
14
- SerdeContext as __SerdeContext,
15
- SmithyException as __SmithyException,
16
- } from "@aws-sdk/types";
17
-
18
- import { SearchCommandInput, SearchCommandOutput } from "../commands/SearchCommand";
19
- import { SuggestCommandInput, SuggestCommandOutput } from "../commands/SuggestCommand";
20
- import { UploadDocumentsCommandInput, UploadDocumentsCommandOutput } from "../commands/UploadDocumentsCommand";
21
- import {
22
- Bucket,
23
- BucketInfo,
24
- DocumentServiceException,
25
- DocumentServiceWarning,
26
- FieldStats,
27
- Hit,
28
- Hits,
29
- SearchException,
30
- SearchStatus,
31
- SuggestionMatch,
32
- SuggestModel,
33
- SuggestStatus,
34
- } from "../models/models_0";
35
-
36
- export const serializeAws_restJson1SearchCommand = async (
37
- input: SearchCommandInput,
38
- context: __SerdeContext
39
- ): Promise<__HttpRequest> => {
40
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
41
- const headers: any = {};
42
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-01-01/search";
43
- const query: any = {
44
- format: "sdk",
45
- pretty: "true",
46
- ...(input.cursor !== undefined && { cursor: input.cursor }),
47
- ...(input.expr !== undefined && { expr: input.expr }),
48
- ...(input.facet !== undefined && { facet: input.facet }),
49
- ...(input.filterQuery !== undefined && { fq: input.filterQuery }),
50
- ...(input.highlight !== undefined && { highlight: input.highlight }),
51
- ...(input.partial !== undefined && { partial: input.partial.toString() }),
52
- ...(input.query !== undefined && { q: input.query }),
53
- ...(input.queryOptions !== undefined && { "q.options": input.queryOptions }),
54
- ...(input.queryParser !== undefined && { "q.parser": input.queryParser }),
55
- ...(input.return !== undefined && { return: input.return }),
56
- ...(input.size !== undefined && { size: input.size.toString() }),
57
- ...(input.sort !== undefined && { sort: input.sort }),
58
- ...(input.start !== undefined && { start: input.start.toString() }),
59
- ...(input.stats !== undefined && { stats: input.stats }),
60
- };
61
- let body: any;
62
- return new __HttpRequest({
63
- protocol,
64
- hostname,
65
- port,
66
- method: "GET",
67
- headers,
68
- path: resolvedPath,
69
- query,
70
- body,
71
- });
72
- };
73
-
74
- export const serializeAws_restJson1SuggestCommand = async (
75
- input: SuggestCommandInput,
76
- context: __SerdeContext
77
- ): Promise<__HttpRequest> => {
78
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
79
- const headers: any = {};
80
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-01-01/suggest";
81
- const query: any = {
82
- format: "sdk",
83
- pretty: "true",
84
- ...(input.query !== undefined && { q: input.query }),
85
- ...(input.suggester !== undefined && { suggester: input.suggester }),
86
- ...(input.size !== undefined && { size: input.size.toString() }),
87
- };
88
- let body: any;
89
- return new __HttpRequest({
90
- protocol,
91
- hostname,
92
- port,
93
- method: "GET",
94
- headers,
95
- path: resolvedPath,
96
- query,
97
- body,
98
- });
99
- };
100
-
101
- export const serializeAws_restJson1UploadDocumentsCommand = async (
102
- input: UploadDocumentsCommandInput,
103
- context: __SerdeContext
104
- ): Promise<__HttpRequest> => {
105
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
106
- const headers: any = {
107
- "content-type": "application/octet-stream",
108
- ...(isSerializableHeaderValue(input.contentType) && { "content-type": input.contentType! }),
109
- };
110
- const resolvedPath =
111
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-01-01/documents/batch";
112
- const query: any = {
113
- format: "sdk",
114
- };
115
- let body: any;
116
- if (input.documents !== undefined) {
117
- body = input.documents;
118
- }
119
- return new __HttpRequest({
120
- protocol,
121
- hostname,
122
- port,
123
- method: "POST",
124
- headers,
125
- path: resolvedPath,
126
- query,
127
- body,
128
- });
129
- };
130
-
131
- export const deserializeAws_restJson1SearchCommand = async (
132
- output: __HttpResponse,
133
- context: __SerdeContext
134
- ): Promise<SearchCommandOutput> => {
135
- if (output.statusCode !== 200 && output.statusCode >= 300) {
136
- return deserializeAws_restJson1SearchCommandError(output, context);
137
- }
138
- const contents: SearchCommandOutput = {
139
- $metadata: deserializeMetadata(output),
140
- facets: undefined,
141
- hits: undefined,
142
- stats: undefined,
143
- status: undefined,
144
- };
145
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
146
- if (data.facets !== undefined && data.facets !== null) {
147
- contents.facets = deserializeAws_restJson1Facets(data.facets, context);
148
- }
149
- if (data.hits !== undefined && data.hits !== null) {
150
- contents.hits = deserializeAws_restJson1Hits(data.hits, context);
151
- }
152
- if (data.stats !== undefined && data.stats !== null) {
153
- contents.stats = deserializeAws_restJson1Stats(data.stats, context);
154
- }
155
- if (data.status !== undefined && data.status !== null) {
156
- contents.status = deserializeAws_restJson1SearchStatus(data.status, context);
157
- }
158
- return Promise.resolve(contents);
159
- };
160
-
161
- const deserializeAws_restJson1SearchCommandError = async (
162
- output: __HttpResponse,
163
- context: __SerdeContext
164
- ): Promise<SearchCommandOutput> => {
165
- const parsedOutput: any = {
166
- ...output,
167
- body: await parseBody(output.body, context),
168
- };
169
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
170
- let errorCode = "UnknownError";
171
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
172
- switch (errorCode) {
173
- case "SearchException":
174
- case "com.amazonaws.cloudsearchdomain#SearchException":
175
- response = {
176
- ...(await deserializeAws_restJson1SearchExceptionResponse(parsedOutput, context)),
177
- name: errorCode,
178
- $metadata: deserializeMetadata(output),
179
- };
180
- break;
181
- default:
182
- const parsedBody = parsedOutput.body;
183
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
184
- response = {
185
- ...parsedBody,
186
- name: `${errorCode}`,
187
- message: parsedBody.message || parsedBody.Message || errorCode,
188
- $fault: "client",
189
- $metadata: deserializeMetadata(output),
190
- } as any;
191
- }
192
- const message = response.message || response.Message || errorCode;
193
- response.message = message;
194
- delete response.Message;
195
- return Promise.reject(Object.assign(new Error(message), response));
196
- };
197
-
198
- export const deserializeAws_restJson1SuggestCommand = async (
199
- output: __HttpResponse,
200
- context: __SerdeContext
201
- ): Promise<SuggestCommandOutput> => {
202
- if (output.statusCode !== 200 && output.statusCode >= 300) {
203
- return deserializeAws_restJson1SuggestCommandError(output, context);
204
- }
205
- const contents: SuggestCommandOutput = {
206
- $metadata: deserializeMetadata(output),
207
- status: undefined,
208
- suggest: undefined,
209
- };
210
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
211
- if (data.status !== undefined && data.status !== null) {
212
- contents.status = deserializeAws_restJson1SuggestStatus(data.status, context);
213
- }
214
- if (data.suggest !== undefined && data.suggest !== null) {
215
- contents.suggest = deserializeAws_restJson1SuggestModel(data.suggest, context);
216
- }
217
- return Promise.resolve(contents);
218
- };
219
-
220
- const deserializeAws_restJson1SuggestCommandError = async (
221
- output: __HttpResponse,
222
- context: __SerdeContext
223
- ): Promise<SuggestCommandOutput> => {
224
- const parsedOutput: any = {
225
- ...output,
226
- body: await parseBody(output.body, context),
227
- };
228
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
229
- let errorCode = "UnknownError";
230
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
231
- switch (errorCode) {
232
- case "SearchException":
233
- case "com.amazonaws.cloudsearchdomain#SearchException":
234
- response = {
235
- ...(await deserializeAws_restJson1SearchExceptionResponse(parsedOutput, context)),
236
- name: errorCode,
237
- $metadata: deserializeMetadata(output),
238
- };
239
- break;
240
- default:
241
- const parsedBody = parsedOutput.body;
242
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
243
- response = {
244
- ...parsedBody,
245
- name: `${errorCode}`,
246
- message: parsedBody.message || parsedBody.Message || errorCode,
247
- $fault: "client",
248
- $metadata: deserializeMetadata(output),
249
- } as any;
250
- }
251
- const message = response.message || response.Message || errorCode;
252
- response.message = message;
253
- delete response.Message;
254
- return Promise.reject(Object.assign(new Error(message), response));
255
- };
256
-
257
- export const deserializeAws_restJson1UploadDocumentsCommand = async (
258
- output: __HttpResponse,
259
- context: __SerdeContext
260
- ): Promise<UploadDocumentsCommandOutput> => {
261
- if (output.statusCode !== 200 && output.statusCode >= 300) {
262
- return deserializeAws_restJson1UploadDocumentsCommandError(output, context);
263
- }
264
- const contents: UploadDocumentsCommandOutput = {
265
- $metadata: deserializeMetadata(output),
266
- adds: undefined,
267
- deletes: undefined,
268
- status: undefined,
269
- warnings: undefined,
270
- };
271
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
272
- if (data.adds !== undefined && data.adds !== null) {
273
- contents.adds = __expectLong(data.adds);
274
- }
275
- if (data.deletes !== undefined && data.deletes !== null) {
276
- contents.deletes = __expectLong(data.deletes);
277
- }
278
- if (data.status !== undefined && data.status !== null) {
279
- contents.status = __expectString(data.status);
280
- }
281
- if (data.warnings !== undefined && data.warnings !== null) {
282
- contents.warnings = deserializeAws_restJson1DocumentServiceWarnings(data.warnings, context);
283
- }
284
- return Promise.resolve(contents);
285
- };
286
-
287
- const deserializeAws_restJson1UploadDocumentsCommandError = async (
288
- output: __HttpResponse,
289
- context: __SerdeContext
290
- ): Promise<UploadDocumentsCommandOutput> => {
291
- const parsedOutput: any = {
292
- ...output,
293
- body: await parseBody(output.body, context),
294
- };
295
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
296
- let errorCode = "UnknownError";
297
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
298
- switch (errorCode) {
299
- case "DocumentServiceException":
300
- case "com.amazonaws.cloudsearchdomain#DocumentServiceException":
301
- response = {
302
- ...(await deserializeAws_restJson1DocumentServiceExceptionResponse(parsedOutput, context)),
303
- name: errorCode,
304
- $metadata: deserializeMetadata(output),
305
- };
306
- break;
307
- default:
308
- const parsedBody = parsedOutput.body;
309
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
310
- response = {
311
- ...parsedBody,
312
- name: `${errorCode}`,
313
- message: parsedBody.message || parsedBody.Message || errorCode,
314
- $fault: "client",
315
- $metadata: deserializeMetadata(output),
316
- } as any;
317
- }
318
- const message = response.message || response.Message || errorCode;
319
- response.message = message;
320
- delete response.Message;
321
- return Promise.reject(Object.assign(new Error(message), response));
322
- };
323
-
324
- const deserializeAws_restJson1DocumentServiceExceptionResponse = async (
325
- parsedOutput: any,
326
- context: __SerdeContext
327
- ): Promise<DocumentServiceException> => {
328
- const contents: DocumentServiceException = {
329
- name: "DocumentServiceException",
330
- $fault: "client",
331
- $metadata: deserializeMetadata(parsedOutput),
332
- message: undefined,
333
- status: undefined,
334
- };
335
- const data: any = parsedOutput.body;
336
- if (data.message !== undefined && data.message !== null) {
337
- contents.message = __expectString(data.message);
338
- }
339
- if (data.status !== undefined && data.status !== null) {
340
- contents.status = __expectString(data.status);
341
- }
342
- return contents;
343
- };
344
-
345
- const deserializeAws_restJson1SearchExceptionResponse = async (
346
- parsedOutput: any,
347
- context: __SerdeContext
348
- ): Promise<SearchException> => {
349
- const contents: SearchException = {
350
- name: "SearchException",
351
- $fault: "client",
352
- $metadata: deserializeMetadata(parsedOutput),
353
- message: undefined,
354
- };
355
- const data: any = parsedOutput.body;
356
- if (data.message !== undefined && data.message !== null) {
357
- contents.message = __expectString(data.message);
358
- }
359
- return contents;
360
- };
361
-
362
- const deserializeAws_restJson1Bucket = (output: any, context: __SerdeContext): Bucket => {
363
- return {
364
- count: __expectLong(output.count),
365
- value: __expectString(output.value),
366
- } as any;
367
- };
368
-
369
- const deserializeAws_restJson1BucketInfo = (output: any, context: __SerdeContext): BucketInfo => {
370
- return {
371
- buckets:
372
- output.buckets !== undefined && output.buckets !== null
373
- ? deserializeAws_restJson1BucketList(output.buckets, context)
374
- : undefined,
375
- } as any;
376
- };
377
-
378
- const deserializeAws_restJson1BucketList = (output: any, context: __SerdeContext): Bucket[] => {
379
- return (output || [])
380
- .filter((e: any) => e != null)
381
- .map((entry: any) => {
382
- if (entry === null) {
383
- return null as any;
384
- }
385
- return deserializeAws_restJson1Bucket(entry, context);
386
- });
387
- };
388
-
389
- const deserializeAws_restJson1DocumentServiceWarning = (
390
- output: any,
391
- context: __SerdeContext
392
- ): DocumentServiceWarning => {
393
- return {
394
- message: __expectString(output.message),
395
- } as any;
396
- };
397
-
398
- const deserializeAws_restJson1DocumentServiceWarnings = (
399
- output: any,
400
- context: __SerdeContext
401
- ): DocumentServiceWarning[] => {
402
- return (output || [])
403
- .filter((e: any) => e != null)
404
- .map((entry: any) => {
405
- if (entry === null) {
406
- return null as any;
407
- }
408
- return deserializeAws_restJson1DocumentServiceWarning(entry, context);
409
- });
410
- };
411
-
412
- const deserializeAws_restJson1Exprs = (output: any, context: __SerdeContext): { [key: string]: string } => {
413
- return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => {
414
- if (value === null) {
415
- return acc;
416
- }
417
- return {
418
- ...acc,
419
- [key]: __expectString(value) as any,
420
- };
421
- }, {});
422
- };
423
-
424
- const deserializeAws_restJson1Facets = (output: any, context: __SerdeContext): { [key: string]: BucketInfo } => {
425
- return Object.entries(output).reduce((acc: { [key: string]: BucketInfo }, [key, value]: [string, any]) => {
426
- if (value === null) {
427
- return acc;
428
- }
429
- return {
430
- ...acc,
431
- [key]: deserializeAws_restJson1BucketInfo(value, context),
432
- };
433
- }, {});
434
- };
435
-
436
- const deserializeAws_restJson1Fields = (output: any, context: __SerdeContext): { [key: string]: string[] } => {
437
- return Object.entries(output).reduce((acc: { [key: string]: string[] }, [key, value]: [string, any]) => {
438
- if (value === null) {
439
- return acc;
440
- }
441
- return {
442
- ...acc,
443
- [key]: deserializeAws_restJson1FieldValue(value, context),
444
- };
445
- }, {});
446
- };
447
-
448
- const deserializeAws_restJson1FieldStats = (output: any, context: __SerdeContext): FieldStats => {
449
- return {
450
- count: __expectLong(output.count),
451
- max: __expectString(output.max),
452
- mean: __expectString(output.mean),
453
- min: __expectString(output.min),
454
- missing: __expectLong(output.missing),
455
- stddev: __limitedParseDouble(output.stddev),
456
- sum: __limitedParseDouble(output.sum),
457
- sumOfSquares: __limitedParseDouble(output.sumOfSquares),
458
- } as any;
459
- };
460
-
461
- const deserializeAws_restJson1FieldValue = (output: any, context: __SerdeContext): string[] => {
462
- return (output || [])
463
- .filter((e: any) => e != null)
464
- .map((entry: any) => {
465
- if (entry === null) {
466
- return null as any;
467
- }
468
- return __expectString(entry) as any;
469
- });
470
- };
471
-
472
- const deserializeAws_restJson1Highlights = (output: any, context: __SerdeContext): { [key: string]: string } => {
473
- return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => {
474
- if (value === null) {
475
- return acc;
476
- }
477
- return {
478
- ...acc,
479
- [key]: __expectString(value) as any,
480
- };
481
- }, {});
482
- };
483
-
484
- const deserializeAws_restJson1Hit = (output: any, context: __SerdeContext): Hit => {
485
- return {
486
- exprs:
487
- output.exprs !== undefined && output.exprs !== null
488
- ? deserializeAws_restJson1Exprs(output.exprs, context)
489
- : undefined,
490
- fields:
491
- output.fields !== undefined && output.fields !== null
492
- ? deserializeAws_restJson1Fields(output.fields, context)
493
- : undefined,
494
- highlights:
495
- output.highlights !== undefined && output.highlights !== null
496
- ? deserializeAws_restJson1Highlights(output.highlights, context)
497
- : undefined,
498
- id: __expectString(output.id),
499
- } as any;
500
- };
501
-
502
- const deserializeAws_restJson1HitList = (output: any, context: __SerdeContext): Hit[] => {
503
- return (output || [])
504
- .filter((e: any) => e != null)
505
- .map((entry: any) => {
506
- if (entry === null) {
507
- return null as any;
508
- }
509
- return deserializeAws_restJson1Hit(entry, context);
510
- });
511
- };
512
-
513
- const deserializeAws_restJson1Hits = (output: any, context: __SerdeContext): Hits => {
514
- return {
515
- cursor: __expectString(output.cursor),
516
- found: __expectLong(output.found),
517
- hit:
518
- output.hit !== undefined && output.hit !== null
519
- ? deserializeAws_restJson1HitList(output.hit, context)
520
- : undefined,
521
- start: __expectLong(output.start),
522
- } as any;
523
- };
524
-
525
- const deserializeAws_restJson1SearchStatus = (output: any, context: __SerdeContext): SearchStatus => {
526
- return {
527
- rid: __expectString(output.rid),
528
- timems: __expectLong(output.timems),
529
- } as any;
530
- };
531
-
532
- const deserializeAws_restJson1Stats = (output: any, context: __SerdeContext): { [key: string]: FieldStats } => {
533
- return Object.entries(output).reduce((acc: { [key: string]: FieldStats }, [key, value]: [string, any]) => {
534
- if (value === null) {
535
- return acc;
536
- }
537
- return {
538
- ...acc,
539
- [key]: deserializeAws_restJson1FieldStats(value, context),
540
- };
541
- }, {});
542
- };
543
-
544
- const deserializeAws_restJson1SuggestionMatch = (output: any, context: __SerdeContext): SuggestionMatch => {
545
- return {
546
- id: __expectString(output.id),
547
- score: __expectLong(output.score),
548
- suggestion: __expectString(output.suggestion),
549
- } as any;
550
- };
551
-
552
- const deserializeAws_restJson1Suggestions = (output: any, context: __SerdeContext): SuggestionMatch[] => {
553
- return (output || [])
554
- .filter((e: any) => e != null)
555
- .map((entry: any) => {
556
- if (entry === null) {
557
- return null as any;
558
- }
559
- return deserializeAws_restJson1SuggestionMatch(entry, context);
560
- });
561
- };
562
-
563
- const deserializeAws_restJson1SuggestModel = (output: any, context: __SerdeContext): SuggestModel => {
564
- return {
565
- found: __expectLong(output.found),
566
- query: __expectString(output.query),
567
- suggestions:
568
- output.suggestions !== undefined && output.suggestions !== null
569
- ? deserializeAws_restJson1Suggestions(output.suggestions, context)
570
- : undefined,
571
- } as any;
572
- };
573
-
574
- const deserializeAws_restJson1SuggestStatus = (output: any, context: __SerdeContext): SuggestStatus => {
575
- return {
576
- rid: __expectString(output.rid),
577
- timems: __expectLong(output.timems),
578
- } as any;
579
- };
580
-
581
- const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
582
- httpStatusCode: output.statusCode,
583
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
584
- extendedRequestId: output.headers["x-amz-id-2"],
585
- cfId: output.headers["x-amz-cf-id"],
586
- });
587
-
588
- // Collect low-level response body stream to Uint8Array.
589
- const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
590
- if (streamBody instanceof Uint8Array) {
591
- return Promise.resolve(streamBody);
592
- }
593
- return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
594
- };
595
-
596
- // Encode Uint8Array data into string with utf-8.
597
- const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
598
- collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
599
-
600
- const isSerializableHeaderValue = (value: any): boolean =>
601
- value !== undefined &&
602
- value !== null &&
603
- value !== "" &&
604
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
605
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
606
-
607
- const parseBody = (streamBody: any, context: __SerdeContext): any =>
608
- collectBodyString(streamBody, context).then((encoded) => {
609
- if (encoded.length) {
610
- return JSON.parse(encoded);
611
- }
612
- return {};
613
- });
614
-
615
- /**
616
- * Load an error code for the aws.rest-json-1.1 protocol.
617
- */
618
- const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
619
- const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
620
-
621
- const sanitizeErrorCode = (rawValue: string): string => {
622
- let cleanValue = rawValue;
623
- if (cleanValue.indexOf(":") >= 0) {
624
- cleanValue = cleanValue.split(":")[0];
625
- }
626
- if (cleanValue.indexOf("#") >= 0) {
627
- cleanValue = cleanValue.split("#")[1];
628
- }
629
- return cleanValue;
630
- };
631
-
632
- const headerKey = findKey(output.headers, "x-amzn-errortype");
633
- if (headerKey !== undefined) {
634
- return sanitizeErrorCode(output.headers[headerKey]);
635
- }
636
-
637
- if (data.code !== undefined) {
638
- return sanitizeErrorCode(data.code);
639
- }
640
-
641
- if (data["__type"] !== undefined) {
642
- return sanitizeErrorCode(data["__type"]);
643
- }
644
-
645
- return "";
646
- };
@@ -1,41 +0,0 @@
1
- import { Sha256 } from "@aws-crypto/sha256-browser";
2
- import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler";
3
- import { invalidProvider } from "@aws-sdk/invalid-dependency";
4
- import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry";
5
- import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser";
6
- import { calculateBodyLength } from "@aws-sdk/util-body-length-browser";
7
- import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser";
8
- import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser";
9
-
10
- // @ts-ignore: package.json will be imported from dist folders
11
- import packageInfo from "../package.json";
12
- import { CloudSearchDomainClientConfig } from "./CloudSearchDomainClient";
13
- import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
14
-
15
- /**
16
- * @internal
17
- */
18
- export const getRuntimeConfig = (config: CloudSearchDomainClientConfig) => {
19
- const clientSharedValues = getSharedRuntimeConfig(config);
20
- return {
21
- ...clientSharedValues,
22
- ...config,
23
- runtime: "browser",
24
- base64Decoder: config?.base64Decoder ?? fromBase64,
25
- base64Encoder: config?.base64Encoder ?? toBase64,
26
- bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
27
- credentialDefaultProvider:
28
- config?.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))),
29
- defaultUserAgentProvider:
30
- config?.defaultUserAgentProvider ??
31
- defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
32
- maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
33
- region: config?.region ?? invalidProvider("Region is missing"),
34
- requestHandler: config?.requestHandler ?? new FetchHttpHandler(),
35
- retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)),
36
- sha256: config?.sha256 ?? Sha256,
37
- streamCollector: config?.streamCollector ?? streamCollector,
38
- utf8Decoder: config?.utf8Decoder ?? fromUtf8,
39
- utf8Encoder: config?.utf8Encoder ?? toUtf8,
40
- };
41
- };
@@ -1,17 +0,0 @@
1
- import { Sha256 } from "@aws-crypto/sha256-js";
2
-
3
- import { CloudSearchDomainClientConfig } from "./CloudSearchDomainClient";
4
- import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
5
-
6
- /**
7
- * @internal
8
- */
9
- export const getRuntimeConfig = (config: CloudSearchDomainClientConfig) => {
10
- const browserDefaults = getBrowserRuntimeConfig(config);
11
- return {
12
- ...browserDefaults,
13
- ...config,
14
- runtime: "react-native",
15
- sha256: config?.sha256 ?? Sha256,
16
- };
17
- };