@aws-sdk/client-personalize-runtime 3.141.0 → 3.142.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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.142.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.141.0...v3.142.0) (2022-08-02)
7
+
8
+
9
+ ### Features
10
+
11
+ * **codegen:** general data mapping function ([#3830](https://github.com/aws/aws-sdk-js-v3/issues/3830)) ([9417eae](https://github.com/aws/aws-sdk-js-v3/commit/9417eae722806799fb4c15c07921574268c1165c))
12
+
13
+
14
+
15
+
16
+
6
17
  # [3.141.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.140.0...v3.141.0) (2022-08-01)
7
18
 
8
19
 
@@ -67,19 +67,17 @@ const deserializeAws_restJson1GetPersonalizedRankingCommand = async (output, con
67
67
  if (output.statusCode !== 200 && output.statusCode >= 300) {
68
68
  return deserializeAws_restJson1GetPersonalizedRankingCommandError(output, context);
69
69
  }
70
- const contents = {
70
+ const contents = map({
71
71
  $metadata: deserializeMetadata(output),
72
- personalizedRanking: undefined,
73
- recommendationId: undefined,
74
- };
72
+ });
75
73
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
76
- if (data.personalizedRanking !== undefined && data.personalizedRanking !== null) {
74
+ if (data.personalizedRanking != null) {
77
75
  contents.personalizedRanking = deserializeAws_restJson1ItemList(data.personalizedRanking, context);
78
76
  }
79
- if (data.recommendationId !== undefined && data.recommendationId !== null) {
77
+ if (data.recommendationId != null) {
80
78
  contents.recommendationId = (0, smithy_client_1.expectString)(data.recommendationId);
81
79
  }
82
- return Promise.resolve(contents);
80
+ return contents;
83
81
  };
84
82
  exports.deserializeAws_restJson1GetPersonalizedRankingCommand = deserializeAws_restJson1GetPersonalizedRankingCommand;
85
83
  const deserializeAws_restJson1GetPersonalizedRankingCommandError = async (output, context) => {
@@ -87,7 +85,6 @@ const deserializeAws_restJson1GetPersonalizedRankingCommandError = async (output
87
85
  ...output,
88
86
  body: await parseBody(output.body, context),
89
87
  };
90
- let response;
91
88
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
92
89
  switch (errorCode) {
93
90
  case "InvalidInputException":
@@ -98,33 +95,29 @@ const deserializeAws_restJson1GetPersonalizedRankingCommandError = async (output
98
95
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
99
96
  default:
100
97
  const parsedBody = parsedOutput.body;
101
- const $metadata = deserializeMetadata(output);
102
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
103
- response = new PersonalizeRuntimeServiceException_1.PersonalizeRuntimeServiceException({
104
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
105
- $fault: "client",
106
- $metadata,
98
+ (0, smithy_client_1.throwDefaultError)({
99
+ output,
100
+ parsedBody,
101
+ exceptionCtor: PersonalizeRuntimeServiceException_1.PersonalizeRuntimeServiceException,
102
+ errorCode,
107
103
  });
108
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
109
104
  }
110
105
  };
111
106
  const deserializeAws_restJson1GetRecommendationsCommand = async (output, context) => {
112
107
  if (output.statusCode !== 200 && output.statusCode >= 300) {
113
108
  return deserializeAws_restJson1GetRecommendationsCommandError(output, context);
114
109
  }
115
- const contents = {
110
+ const contents = map({
116
111
  $metadata: deserializeMetadata(output),
117
- itemList: undefined,
118
- recommendationId: undefined,
119
- };
112
+ });
120
113
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
121
- if (data.itemList !== undefined && data.itemList !== null) {
114
+ if (data.itemList != null) {
122
115
  contents.itemList = deserializeAws_restJson1ItemList(data.itemList, context);
123
116
  }
124
- if (data.recommendationId !== undefined && data.recommendationId !== null) {
117
+ if (data.recommendationId != null) {
125
118
  contents.recommendationId = (0, smithy_client_1.expectString)(data.recommendationId);
126
119
  }
127
- return Promise.resolve(contents);
120
+ return contents;
128
121
  };
129
122
  exports.deserializeAws_restJson1GetRecommendationsCommand = deserializeAws_restJson1GetRecommendationsCommand;
130
123
  const deserializeAws_restJson1GetRecommendationsCommandError = async (output, context) => {
@@ -132,7 +125,6 @@ const deserializeAws_restJson1GetRecommendationsCommandError = async (output, co
132
125
  ...output,
133
126
  body: await parseBody(output.body, context),
134
127
  };
135
- let response;
136
128
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
137
129
  switch (errorCode) {
138
130
  case "InvalidInputException":
@@ -143,20 +135,19 @@ const deserializeAws_restJson1GetRecommendationsCommandError = async (output, co
143
135
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
144
136
  default:
145
137
  const parsedBody = parsedOutput.body;
146
- const $metadata = deserializeMetadata(output);
147
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
148
- response = new PersonalizeRuntimeServiceException_1.PersonalizeRuntimeServiceException({
149
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
150
- $fault: "client",
151
- $metadata,
138
+ (0, smithy_client_1.throwDefaultError)({
139
+ output,
140
+ parsedBody,
141
+ exceptionCtor: PersonalizeRuntimeServiceException_1.PersonalizeRuntimeServiceException,
142
+ errorCode,
152
143
  });
153
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
154
144
  }
155
145
  };
146
+ const map = smithy_client_1.map;
156
147
  const deserializeAws_restJson1InvalidInputExceptionResponse = async (parsedOutput, context) => {
157
- const contents = {};
148
+ const contents = map({});
158
149
  const data = parsedOutput.body;
159
- if (data.message !== undefined && data.message !== null) {
150
+ if (data.message != null) {
160
151
  contents.message = (0, smithy_client_1.expectString)(data.message);
161
152
  }
162
153
  const exception = new models_0_1.InvalidInputException({
@@ -166,9 +157,9 @@ const deserializeAws_restJson1InvalidInputExceptionResponse = async (parsedOutpu
166
157
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
167
158
  };
168
159
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
169
- const contents = {};
160
+ const contents = map({});
170
161
  const data = parsedOutput.body;
171
- if (data.message !== undefined && data.message !== null) {
162
+ if (data.message != null) {
172
163
  contents.message = (0, smithy_client_1.expectString)(data.message);
173
164
  }
174
165
  const exception = new models_0_1.ResourceNotFoundException({
@@ -203,9 +194,6 @@ const serializeAws_restJson1InputList = (input, context) => {
203
194
  return input
204
195
  .filter((e) => e != null)
205
196
  .map((entry) => {
206
- if (entry === null) {
207
- return null;
208
- }
209
197
  return entry;
210
198
  });
211
199
  };
@@ -1,6 +1,6 @@
1
1
  import { __assign, __awaiter, __generator, __read } from "tslib";
2
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
3
- import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, } from "@aws-sdk/smithy-client";
3
+ import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, map as __map, throwDefaultError, } from "@aws-sdk/smithy-client";
4
4
  import { InvalidInputException, ResourceNotFoundException } from "../models/models_0";
5
5
  import { PersonalizeRuntimeServiceException as __BaseException } from "../models/PersonalizeRuntimeServiceException";
6
6
  export var serializeAws_restJson1GetPersonalizedRankingCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
@@ -63,28 +63,26 @@ export var deserializeAws_restJson1GetPersonalizedRankingCommand = function (out
63
63
  if (output.statusCode !== 200 && output.statusCode >= 300) {
64
64
  return [2, deserializeAws_restJson1GetPersonalizedRankingCommandError(output, context)];
65
65
  }
66
- contents = {
66
+ contents = map({
67
67
  $metadata: deserializeMetadata(output),
68
- personalizedRanking: undefined,
69
- recommendationId: undefined,
70
- };
68
+ });
71
69
  _a = __expectNonNull;
72
70
  _b = __expectObject;
73
71
  return [4, parseBody(output.body, context)];
74
72
  case 1:
75
73
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
76
- if (data.personalizedRanking !== undefined && data.personalizedRanking !== null) {
74
+ if (data.personalizedRanking != null) {
77
75
  contents.personalizedRanking = deserializeAws_restJson1ItemList(data.personalizedRanking, context);
78
76
  }
79
- if (data.recommendationId !== undefined && data.recommendationId !== null) {
77
+ if (data.recommendationId != null) {
80
78
  contents.recommendationId = __expectString(data.recommendationId);
81
79
  }
82
- return [2, Promise.resolve(contents)];
80
+ return [2, contents];
83
81
  }
84
82
  });
85
83
  }); };
86
84
  var deserializeAws_restJson1GetPersonalizedRankingCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
87
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
85
+ var parsedOutput, _a, errorCode, _b, parsedBody;
88
86
  var _c;
89
87
  return __generator(this, function (_d) {
90
88
  switch (_d.label) {
@@ -109,14 +107,14 @@ var deserializeAws_restJson1GetPersonalizedRankingCommandError = function (outpu
109
107
  case 5: throw _d.sent();
110
108
  case 6:
111
109
  parsedBody = parsedOutput.body;
112
- $metadata = deserializeMetadata(output);
113
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
114
- response = new __BaseException({
115
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
116
- $fault: "client",
117
- $metadata: $metadata,
110
+ throwDefaultError({
111
+ output: output,
112
+ parsedBody: parsedBody,
113
+ exceptionCtor: __BaseException,
114
+ errorCode: errorCode,
118
115
  });
119
- throw __decorateServiceException(response, parsedBody);
116
+ _d.label = 7;
117
+ case 7: return [2];
120
118
  }
121
119
  });
122
120
  }); };
@@ -128,28 +126,26 @@ export var deserializeAws_restJson1GetRecommendationsCommand = function (output,
128
126
  if (output.statusCode !== 200 && output.statusCode >= 300) {
129
127
  return [2, deserializeAws_restJson1GetRecommendationsCommandError(output, context)];
130
128
  }
131
- contents = {
129
+ contents = map({
132
130
  $metadata: deserializeMetadata(output),
133
- itemList: undefined,
134
- recommendationId: undefined,
135
- };
131
+ });
136
132
  _a = __expectNonNull;
137
133
  _b = __expectObject;
138
134
  return [4, parseBody(output.body, context)];
139
135
  case 1:
140
136
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
141
- if (data.itemList !== undefined && data.itemList !== null) {
137
+ if (data.itemList != null) {
142
138
  contents.itemList = deserializeAws_restJson1ItemList(data.itemList, context);
143
139
  }
144
- if (data.recommendationId !== undefined && data.recommendationId !== null) {
140
+ if (data.recommendationId != null) {
145
141
  contents.recommendationId = __expectString(data.recommendationId);
146
142
  }
147
- return [2, Promise.resolve(contents)];
143
+ return [2, contents];
148
144
  }
149
145
  });
150
146
  }); };
151
147
  var deserializeAws_restJson1GetRecommendationsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
152
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
148
+ var parsedOutput, _a, errorCode, _b, parsedBody;
153
149
  var _c;
154
150
  return __generator(this, function (_d) {
155
151
  switch (_d.label) {
@@ -174,23 +170,24 @@ var deserializeAws_restJson1GetRecommendationsCommandError = function (output, c
174
170
  case 5: throw _d.sent();
175
171
  case 6:
176
172
  parsedBody = parsedOutput.body;
177
- $metadata = deserializeMetadata(output);
178
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
179
- response = new __BaseException({
180
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
181
- $fault: "client",
182
- $metadata: $metadata,
173
+ throwDefaultError({
174
+ output: output,
175
+ parsedBody: parsedBody,
176
+ exceptionCtor: __BaseException,
177
+ errorCode: errorCode,
183
178
  });
184
- throw __decorateServiceException(response, parsedBody);
179
+ _d.label = 7;
180
+ case 7: return [2];
185
181
  }
186
182
  });
187
183
  }); };
184
+ var map = __map;
188
185
  var deserializeAws_restJson1InvalidInputExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
189
186
  var contents, data, exception;
190
187
  return __generator(this, function (_a) {
191
- contents = {};
188
+ contents = map({});
192
189
  data = parsedOutput.body;
193
- if (data.message !== undefined && data.message !== null) {
190
+ if (data.message != null) {
194
191
  contents.message = __expectString(data.message);
195
192
  }
196
193
  exception = new InvalidInputException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -200,9 +197,9 @@ var deserializeAws_restJson1InvalidInputExceptionResponse = function (parsedOutp
200
197
  var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
201
198
  var contents, data, exception;
202
199
  return __generator(this, function (_a) {
203
- contents = {};
200
+ contents = map({});
204
201
  data = parsedOutput.body;
205
- if (data.message !== undefined && data.message !== null) {
202
+ if (data.message != null) {
206
203
  contents.message = __expectString(data.message);
207
204
  }
208
205
  exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -233,9 +230,6 @@ var serializeAws_restJson1InputList = function (input, context) {
233
230
  return input
234
231
  .filter(function (e) { return e != null; })
235
232
  .map(function (entry) {
236
- if (entry === null) {
237
- return null;
238
- }
239
233
  return entry;
240
234
  });
241
235
  };
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.141.0",
4
+ "version": "3.142.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",
@@ -18,9 +18,9 @@
18
18
  "dependencies": {
19
19
  "@aws-crypto/sha256-browser": "2.0.0",
20
20
  "@aws-crypto/sha256-js": "2.0.0",
21
- "@aws-sdk/client-sts": "3.141.0",
21
+ "@aws-sdk/client-sts": "3.142.0",
22
22
  "@aws-sdk/config-resolver": "3.130.0",
23
- "@aws-sdk/credential-provider-node": "3.141.0",
23
+ "@aws-sdk/credential-provider-node": "3.142.0",
24
24
  "@aws-sdk/fetch-http-handler": "3.131.0",
25
25
  "@aws-sdk/hash-node": "3.127.0",
26
26
  "@aws-sdk/invalid-dependency": "3.127.0",
@@ -36,15 +36,15 @@
36
36
  "@aws-sdk/node-config-provider": "3.127.0",
37
37
  "@aws-sdk/node-http-handler": "3.127.0",
38
38
  "@aws-sdk/protocol-http": "3.127.0",
39
- "@aws-sdk/smithy-client": "3.137.0",
39
+ "@aws-sdk/smithy-client": "3.142.0",
40
40
  "@aws-sdk/types": "3.127.0",
41
41
  "@aws-sdk/url-parser": "3.127.0",
42
42
  "@aws-sdk/util-base64-browser": "3.109.0",
43
43
  "@aws-sdk/util-base64-node": "3.55.0",
44
44
  "@aws-sdk/util-body-length-browser": "3.55.0",
45
45
  "@aws-sdk/util-body-length-node": "3.55.0",
46
- "@aws-sdk/util-defaults-mode-browser": "3.137.0",
47
- "@aws-sdk/util-defaults-mode-node": "3.137.0",
46
+ "@aws-sdk/util-defaults-mode-browser": "3.142.0",
47
+ "@aws-sdk/util-defaults-mode-node": "3.142.0",
48
48
  "@aws-sdk/util-user-agent-browser": "3.127.0",
49
49
  "@aws-sdk/util-user-agent-node": "3.127.0",
50
50
  "@aws-sdk/util-utf8-browser": "3.109.0",