@aws-sdk/client-cloudsearch-domain 3.525.0 → 3.529.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist-cjs/index.js CHANGED
@@ -189,6 +189,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
189
189
  var import_types = require("@smithy/types");
190
190
 
191
191
  // src/protocols/Aws_restJson1.ts
192
+ var import_core2 = require("@aws-sdk/core");
192
193
 
193
194
 
194
195
 
@@ -321,7 +322,7 @@ var de_SearchCommand = /* @__PURE__ */ __name(async (output, context) => {
321
322
  const contents = (0, import_smithy_client.map)({
322
323
  $metadata: deserializeMetadata(output)
323
324
  });
324
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
325
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
325
326
  const doc = (0, import_smithy_client.take)(data, {
326
327
  facets: import_smithy_client._json,
327
328
  hits: import_smithy_client._json,
@@ -338,7 +339,7 @@ var de_SuggestCommand = /* @__PURE__ */ __name(async (output, context) => {
338
339
  const contents = (0, import_smithy_client.map)({
339
340
  $metadata: deserializeMetadata(output)
340
341
  });
341
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
342
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
342
343
  const doc = (0, import_smithy_client.take)(data, {
343
344
  status: import_smithy_client._json,
344
345
  suggest: import_smithy_client._json
@@ -353,7 +354,7 @@ var de_UploadDocumentsCommand = /* @__PURE__ */ __name(async (output, context) =
353
354
  const contents = (0, import_smithy_client.map)({
354
355
  $metadata: deserializeMetadata(output)
355
356
  });
356
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
357
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
357
358
  const doc = (0, import_smithy_client.take)(data, {
358
359
  adds: import_smithy_client.expectLong,
359
360
  deletes: import_smithy_client.expectLong,
@@ -366,9 +367,9 @@ var de_UploadDocumentsCommand = /* @__PURE__ */ __name(async (output, context) =
366
367
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
367
368
  const parsedOutput = {
368
369
  ...output,
369
- body: await parseErrorBody(output.body, context)
370
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
370
371
  };
371
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
372
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
372
373
  switch (errorCode) {
373
374
  case "SearchException":
374
375
  case "com.amazonaws.cloudsearchdomain#SearchException":
@@ -440,7 +441,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
440
441
  extendedRequestId: output.headers["x-amz-id-2"],
441
442
  cfId: output.headers["x-amz-cf-id"]
442
443
  }), "deserializeMetadata");
443
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
444
444
  var isSerializableHeaderValue = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "" && (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) && (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0), "isSerializableHeaderValue");
445
445
  var _c = "cursor";
446
446
  var _cT = "contentType";
@@ -465,46 +465,6 @@ var _so = "sort";
465
465
  var _st = "start";
466
466
  var _sta = "stats";
467
467
  var _su = "suggester";
468
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
469
- if (encoded.length) {
470
- return JSON.parse(encoded);
471
- }
472
- return {};
473
- }), "parseBody");
474
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
475
- const value = await parseBody(errorBody, context);
476
- value.message = value.message ?? value.Message;
477
- return value;
478
- }, "parseErrorBody");
479
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
480
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
481
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
482
- let cleanValue = rawValue;
483
- if (typeof cleanValue === "number") {
484
- cleanValue = cleanValue.toString();
485
- }
486
- if (cleanValue.indexOf(",") >= 0) {
487
- cleanValue = cleanValue.split(",")[0];
488
- }
489
- if (cleanValue.indexOf(":") >= 0) {
490
- cleanValue = cleanValue.split(":")[0];
491
- }
492
- if (cleanValue.indexOf("#") >= 0) {
493
- cleanValue = cleanValue.split("#")[1];
494
- }
495
- return cleanValue;
496
- }, "sanitizeErrorCode");
497
- const headerKey = findKey(output.headers, "x-amzn-errortype");
498
- if (headerKey !== void 0) {
499
- return sanitizeErrorCode(output.headers[headerKey]);
500
- }
501
- if (data.code !== void 0) {
502
- return sanitizeErrorCode(data.code);
503
- }
504
- if (data["__type"] !== void 0) {
505
- return sanitizeErrorCode(data["__type"]);
506
- }
507
- }, "loadRestJsonErrorCode");
508
468
 
509
469
  // src/commands/SearchCommand.ts
510
470
  var _SearchCommand = class _SearchCommand extends import_smithy_client.Command.classBuilder().ep({
@@ -1,3 +1,4 @@
1
+ import { loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody } from "@aws-sdk/core";
1
2
  import { requestBuilder as rb } from "@smithy/core";
2
3
  import { _json, collectBody, decorateServiceException as __decorateServiceException, expectLong as __expectLong, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, map, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { CloudSearchDomainServiceException as __BaseException } from "../models/CloudSearchDomainServiceException";
@@ -214,43 +215,3 @@ const _so = "sort";
214
215
  const _st = "start";
215
216
  const _sta = "stats";
216
217
  const _su = "suggester";
217
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
218
- if (encoded.length) {
219
- return JSON.parse(encoded);
220
- }
221
- return {};
222
- });
223
- const parseErrorBody = async (errorBody, context) => {
224
- const value = await parseBody(errorBody, context);
225
- value.message = value.message ?? value.Message;
226
- return value;
227
- };
228
- const loadRestJsonErrorCode = (output, data) => {
229
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
230
- const sanitizeErrorCode = (rawValue) => {
231
- let cleanValue = rawValue;
232
- if (typeof cleanValue === "number") {
233
- cleanValue = cleanValue.toString();
234
- }
235
- if (cleanValue.indexOf(",") >= 0) {
236
- cleanValue = cleanValue.split(",")[0];
237
- }
238
- if (cleanValue.indexOf(":") >= 0) {
239
- cleanValue = cleanValue.split(":")[0];
240
- }
241
- if (cleanValue.indexOf("#") >= 0) {
242
- cleanValue = cleanValue.split("#")[1];
243
- }
244
- return cleanValue;
245
- };
246
- const headerKey = findKey(output.headers, "x-amzn-errortype");
247
- if (headerKey !== undefined) {
248
- return sanitizeErrorCode(output.headers[headerKey]);
249
- }
250
- if (data.code !== undefined) {
251
- return sanitizeErrorCode(data.code);
252
- }
253
- if (data["__type"] !== undefined) {
254
- return sanitizeErrorCode(data["__type"]);
255
- }
256
- };
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.525.0",
4
+ "version": "3.529.1",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "node ../../scripts/compilation/inline client-cloudsearch-domain",
@@ -20,9 +20,9 @@
20
20
  "dependencies": {
21
21
  "@aws-crypto/sha256-browser": "3.0.0",
22
22
  "@aws-crypto/sha256-js": "3.0.0",
23
- "@aws-sdk/client-sts": "3.525.0",
24
- "@aws-sdk/core": "3.525.0",
25
- "@aws-sdk/credential-provider-node": "3.525.0",
23
+ "@aws-sdk/client-sts": "3.529.1",
24
+ "@aws-sdk/core": "3.529.1",
25
+ "@aws-sdk/credential-provider-node": "3.529.1",
26
26
  "@aws-sdk/middleware-host-header": "3.523.0",
27
27
  "@aws-sdk/middleware-logger": "3.523.0",
28
28
  "@aws-sdk/middleware-recursion-detection": "3.523.0",