@aws-sdk/client-personalize-runtime 3.525.0 → 3.529.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.
package/dist-cjs/index.js CHANGED
@@ -262,6 +262,7 @@ var GetRecommendationsRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) =
262
262
  }), "GetRecommendationsRequestFilterSensitiveLog");
263
263
 
264
264
  // src/protocols/Aws_restJson1.ts
265
+ var import_core2 = require("@aws-sdk/core");
265
266
 
266
267
 
267
268
  var se_GetActionRecommendationsCommand = /* @__PURE__ */ __name(async (input, context) => {
@@ -335,7 +336,7 @@ var de_GetActionRecommendationsCommand = /* @__PURE__ */ __name(async (output, c
335
336
  const contents = (0, import_smithy_client.map)({
336
337
  $metadata: deserializeMetadata(output)
337
338
  });
338
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
339
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
339
340
  const doc = (0, import_smithy_client.take)(data, {
340
341
  actionList: (_) => de_ActionList(_, context),
341
342
  recommendationId: import_smithy_client.expectString
@@ -350,7 +351,7 @@ var de_GetPersonalizedRankingCommand = /* @__PURE__ */ __name(async (output, con
350
351
  const contents = (0, import_smithy_client.map)({
351
352
  $metadata: deserializeMetadata(output)
352
353
  });
353
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
354
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
354
355
  const doc = (0, import_smithy_client.take)(data, {
355
356
  personalizedRanking: (_) => de_ItemList(_, context),
356
357
  recommendationId: import_smithy_client.expectString
@@ -365,7 +366,7 @@ var de_GetRecommendationsCommand = /* @__PURE__ */ __name(async (output, context
365
366
  const contents = (0, import_smithy_client.map)({
366
367
  $metadata: deserializeMetadata(output)
367
368
  });
368
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
369
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
369
370
  const doc = (0, import_smithy_client.take)(data, {
370
371
  itemList: (_) => de_ItemList(_, context),
371
372
  recommendationId: import_smithy_client.expectString
@@ -376,9 +377,9 @@ var de_GetRecommendationsCommand = /* @__PURE__ */ __name(async (output, context
376
377
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
377
378
  const parsedOutput = {
378
379
  ...output,
379
- body: await parseErrorBody(output.body, context)
380
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
380
381
  };
381
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
382
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
382
383
  switch (errorCode) {
383
384
  case "InvalidInputException":
384
385
  case "com.amazonaws.personalizeruntime#InvalidInputException":
@@ -454,47 +455,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
454
455
  extendedRequestId: output.headers["x-amz-id-2"],
455
456
  cfId: output.headers["x-amz-cf-id"]
456
457
  }), "deserializeMetadata");
457
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
458
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
459
- if (encoded.length) {
460
- return JSON.parse(encoded);
461
- }
462
- return {};
463
- }), "parseBody");
464
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
465
- const value = await parseBody(errorBody, context);
466
- value.message = value.message ?? value.Message;
467
- return value;
468
- }, "parseErrorBody");
469
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
470
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
471
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
472
- let cleanValue = rawValue;
473
- if (typeof cleanValue === "number") {
474
- cleanValue = cleanValue.toString();
475
- }
476
- if (cleanValue.indexOf(",") >= 0) {
477
- cleanValue = cleanValue.split(",")[0];
478
- }
479
- if (cleanValue.indexOf(":") >= 0) {
480
- cleanValue = cleanValue.split(":")[0];
481
- }
482
- if (cleanValue.indexOf("#") >= 0) {
483
- cleanValue = cleanValue.split("#")[1];
484
- }
485
- return cleanValue;
486
- }, "sanitizeErrorCode");
487
- const headerKey = findKey(output.headers, "x-amzn-errortype");
488
- if (headerKey !== void 0) {
489
- return sanitizeErrorCode(output.headers[headerKey]);
490
- }
491
- if (data.code !== void 0) {
492
- return sanitizeErrorCode(data.code);
493
- }
494
- if (data["__type"] !== void 0) {
495
- return sanitizeErrorCode(data["__type"]);
496
- }
497
- }, "loadRestJsonErrorCode");
498
458
 
499
459
  // src/commands/GetActionRecommendationsCommand.ts
500
460
  var _GetActionRecommendationsCommand = class _GetActionRecommendationsCommand 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, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, map, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { InvalidInputException, ResourceNotFoundException, } from "../models/models_0";
@@ -196,43 +197,3 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
196
197
  value !== "" &&
197
198
  (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
198
199
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
199
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
200
- if (encoded.length) {
201
- return JSON.parse(encoded);
202
- }
203
- return {};
204
- });
205
- const parseErrorBody = async (errorBody, context) => {
206
- const value = await parseBody(errorBody, context);
207
- value.message = value.message ?? value.Message;
208
- return value;
209
- };
210
- const loadRestJsonErrorCode = (output, data) => {
211
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
212
- const sanitizeErrorCode = (rawValue) => {
213
- let cleanValue = rawValue;
214
- if (typeof cleanValue === "number") {
215
- cleanValue = cleanValue.toString();
216
- }
217
- if (cleanValue.indexOf(",") >= 0) {
218
- cleanValue = cleanValue.split(",")[0];
219
- }
220
- if (cleanValue.indexOf(":") >= 0) {
221
- cleanValue = cleanValue.split(":")[0];
222
- }
223
- if (cleanValue.indexOf("#") >= 0) {
224
- cleanValue = cleanValue.split("#")[1];
225
- }
226
- return cleanValue;
227
- };
228
- const headerKey = findKey(output.headers, "x-amzn-errortype");
229
- if (headerKey !== undefined) {
230
- return sanitizeErrorCode(output.headers[headerKey]);
231
- }
232
- if (data.code !== undefined) {
233
- return sanitizeErrorCode(data.code);
234
- }
235
- if (data["__type"] !== undefined) {
236
- return sanitizeErrorCode(data["__type"]);
237
- }
238
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-personalize-runtime",
3
3
  "description": "AWS SDK for JavaScript Personalize Runtime Client for Node.js, Browser and React Native",
4
- "version": "3.525.0",
4
+ "version": "3.529.0",
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-personalize-runtime",
@@ -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.0",
24
+ "@aws-sdk/core": "3.529.0",
25
+ "@aws-sdk/credential-provider-node": "3.529.0",
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",