@aws-sdk/client-personalize-events 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
@@ -317,6 +317,7 @@ var PutUsersRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
317
317
  }), "PutUsersRequestFilterSensitiveLog");
318
318
 
319
319
  // src/protocols/Aws_restJson1.ts
320
+ var import_core2 = require("@aws-sdk/core");
320
321
 
321
322
 
322
323
  var se_PutActionInteractionsCommand = /* @__PURE__ */ __name(async (input, context) => {
@@ -454,9 +455,9 @@ var de_PutUsersCommand = /* @__PURE__ */ __name(async (output, context) => {
454
455
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
455
456
  const parsedOutput = {
456
457
  ...output,
457
- body: await parseErrorBody(output.body, context)
458
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
458
459
  };
459
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
460
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
460
461
  switch (errorCode) {
461
462
  case "InvalidInputException":
462
463
  case "com.amazonaws.personalizeevents#InvalidInputException":
@@ -591,47 +592,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
591
592
  extendedRequestId: output.headers["x-amz-id-2"],
592
593
  cfId: output.headers["x-amz-cf-id"]
593
594
  }), "deserializeMetadata");
594
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
595
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
596
- if (encoded.length) {
597
- return JSON.parse(encoded);
598
- }
599
- return {};
600
- }), "parseBody");
601
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
602
- const value = await parseBody(errorBody, context);
603
- value.message = value.message ?? value.Message;
604
- return value;
605
- }, "parseErrorBody");
606
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
607
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
608
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
609
- let cleanValue = rawValue;
610
- if (typeof cleanValue === "number") {
611
- cleanValue = cleanValue.toString();
612
- }
613
- if (cleanValue.indexOf(",") >= 0) {
614
- cleanValue = cleanValue.split(",")[0];
615
- }
616
- if (cleanValue.indexOf(":") >= 0) {
617
- cleanValue = cleanValue.split(":")[0];
618
- }
619
- if (cleanValue.indexOf("#") >= 0) {
620
- cleanValue = cleanValue.split("#")[1];
621
- }
622
- return cleanValue;
623
- }, "sanitizeErrorCode");
624
- const headerKey = findKey(output.headers, "x-amzn-errortype");
625
- if (headerKey !== void 0) {
626
- return sanitizeErrorCode(output.headers[headerKey]);
627
- }
628
- if (data.code !== void 0) {
629
- return sanitizeErrorCode(data.code);
630
- }
631
- if (data["__type"] !== void 0) {
632
- return sanitizeErrorCode(data["__type"]);
633
- }
634
- }, "loadRestJsonErrorCode");
635
595
 
636
596
  // src/commands/PutActionInteractionsCommand.ts
637
597
  var _PutActionInteractionsCommand = class _PutActionInteractionsCommand extends import_smithy_client.Command.classBuilder().ep({
@@ -1,3 +1,4 @@
1
+ import { loadRestJsonErrorCode, parseJsonErrorBody as parseErrorBody } from "@aws-sdk/core";
1
2
  import { requestBuilder as rb } from "@smithy/core";
2
3
  import { _json, collectBody, decorateServiceException as __decorateServiceException, expectString as __expectString, LazyJsonString as __LazyJsonString, map, serializeFloat as __serializeFloat, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { InvalidInputException, ResourceInUseException, ResourceNotFoundException, } from "../models/models_0";
@@ -280,43 +281,3 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
280
281
  value !== "" &&
281
282
  (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
282
283
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
283
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
284
- if (encoded.length) {
285
- return JSON.parse(encoded);
286
- }
287
- return {};
288
- });
289
- const parseErrorBody = async (errorBody, context) => {
290
- const value = await parseBody(errorBody, context);
291
- value.message = value.message ?? value.Message;
292
- return value;
293
- };
294
- const loadRestJsonErrorCode = (output, data) => {
295
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
296
- const sanitizeErrorCode = (rawValue) => {
297
- let cleanValue = rawValue;
298
- if (typeof cleanValue === "number") {
299
- cleanValue = cleanValue.toString();
300
- }
301
- if (cleanValue.indexOf(",") >= 0) {
302
- cleanValue = cleanValue.split(",")[0];
303
- }
304
- if (cleanValue.indexOf(":") >= 0) {
305
- cleanValue = cleanValue.split(":")[0];
306
- }
307
- if (cleanValue.indexOf("#") >= 0) {
308
- cleanValue = cleanValue.split("#")[1];
309
- }
310
- return cleanValue;
311
- };
312
- const headerKey = findKey(output.headers, "x-amzn-errortype");
313
- if (headerKey !== undefined) {
314
- return sanitizeErrorCode(output.headers[headerKey]);
315
- }
316
- if (data.code !== undefined) {
317
- return sanitizeErrorCode(data.code);
318
- }
319
- if (data["__type"] !== undefined) {
320
- return sanitizeErrorCode(data["__type"]);
321
- }
322
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-personalize-events",
3
3
  "description": "AWS SDK for JavaScript Personalize Events 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-events",
@@ -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",