@aws-sdk/client-personalize-events 3.186.0 → 3.188.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 +8 -0
- package/dist-es/PersonalizeEvents.js +14 -21
- package/dist-es/PersonalizeEventsClient.js +22 -28
- package/dist-es/commands/PutEventsCommand.js +22 -29
- package/dist-es/commands/PutItemsCommand.js +22 -29
- package/dist-es/commands/PutUsersCommand.js +22 -29
- package/dist-es/endpoints.js +8 -8
- package/dist-es/models/PersonalizeEventsServiceException.js +5 -10
- package/dist-es/models/models_0.js +51 -40
- package/dist-es/protocols/Aws_restJson1.js +253 -331
- package/dist-es/runtimeConfig.browser.js +26 -12
- package/dist-es/runtimeConfig.js +30 -12
- package/dist-es/runtimeConfig.native.js +8 -5
- package/dist-es/runtimeConfig.shared.js +8 -11
- package/package.json +33 -33
|
@@ -1,374 +1,296 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
1
|
import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
|
|
3
2
|
import { decorateServiceException as __decorateServiceException, expectString as __expectString, LazyJsonString as __LazyJsonString, map as __map, serializeFloat as __serializeFloat, throwDefaultError, } from "@aws-sdk/smithy-client";
|
|
4
3
|
import { InvalidInputException, ResourceInUseException, ResourceNotFoundException, } from "../models/models_0";
|
|
5
4
|
import { PersonalizeEventsServiceException as __BaseException } from "../models/PersonalizeEventsServiceException";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return [2, new __HttpRequest({
|
|
19
|
-
protocol: protocol,
|
|
20
|
-
hostname: hostname,
|
|
21
|
-
port: port,
|
|
22
|
-
method: "POST",
|
|
23
|
-
headers: headers,
|
|
24
|
-
path: resolvedPath,
|
|
25
|
-
body: body,
|
|
26
|
-
})];
|
|
27
|
-
}
|
|
5
|
+
export const serializeAws_restJson1PutEventsCommand = async (input, context) => {
|
|
6
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
7
|
+
const headers = {
|
|
8
|
+
"content-type": "application/json",
|
|
9
|
+
};
|
|
10
|
+
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/events";
|
|
11
|
+
let body;
|
|
12
|
+
body = JSON.stringify({
|
|
13
|
+
...(input.eventList != null && { eventList: serializeAws_restJson1EventList(input.eventList, context) }),
|
|
14
|
+
...(input.sessionId != null && { sessionId: input.sessionId }),
|
|
15
|
+
...(input.trackingId != null && { trackingId: input.trackingId }),
|
|
16
|
+
...(input.userId != null && { userId: input.userId }),
|
|
28
17
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
headers = {
|
|
38
|
-
"content-type": "application/json",
|
|
39
|
-
};
|
|
40
|
-
resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/items";
|
|
41
|
-
body = JSON.stringify(__assign(__assign({}, (input.datasetArn != null && { datasetArn: input.datasetArn })), (input.items != null && { items: serializeAws_restJson1ItemList(input.items, context) })));
|
|
42
|
-
return [2, new __HttpRequest({
|
|
43
|
-
protocol: protocol,
|
|
44
|
-
hostname: hostname,
|
|
45
|
-
port: port,
|
|
46
|
-
method: "POST",
|
|
47
|
-
headers: headers,
|
|
48
|
-
path: resolvedPath,
|
|
49
|
-
body: body,
|
|
50
|
-
})];
|
|
51
|
-
}
|
|
18
|
+
return new __HttpRequest({
|
|
19
|
+
protocol,
|
|
20
|
+
hostname,
|
|
21
|
+
port,
|
|
22
|
+
method: "POST",
|
|
23
|
+
headers,
|
|
24
|
+
path: resolvedPath,
|
|
25
|
+
body,
|
|
52
26
|
});
|
|
53
|
-
}
|
|
54
|
-
export
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/users";
|
|
65
|
-
body = JSON.stringify(__assign(__assign({}, (input.datasetArn != null && { datasetArn: input.datasetArn })), (input.users != null && { users: serializeAws_restJson1UserList(input.users, context) })));
|
|
66
|
-
return [2, new __HttpRequest({
|
|
67
|
-
protocol: protocol,
|
|
68
|
-
hostname: hostname,
|
|
69
|
-
port: port,
|
|
70
|
-
method: "POST",
|
|
71
|
-
headers: headers,
|
|
72
|
-
path: resolvedPath,
|
|
73
|
-
body: body,
|
|
74
|
-
})];
|
|
75
|
-
}
|
|
27
|
+
};
|
|
28
|
+
export const serializeAws_restJson1PutItemsCommand = async (input, context) => {
|
|
29
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
30
|
+
const headers = {
|
|
31
|
+
"content-type": "application/json",
|
|
32
|
+
};
|
|
33
|
+
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/items";
|
|
34
|
+
let body;
|
|
35
|
+
body = JSON.stringify({
|
|
36
|
+
...(input.datasetArn != null && { datasetArn: input.datasetArn }),
|
|
37
|
+
...(input.items != null && { items: serializeAws_restJson1ItemList(input.items, context) }),
|
|
76
38
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
contents = map({
|
|
87
|
-
$metadata: deserializeMetadata(output),
|
|
88
|
-
});
|
|
89
|
-
return [4, collectBody(output.body, context)];
|
|
90
|
-
case 1:
|
|
91
|
-
_a.sent();
|
|
92
|
-
return [2, contents];
|
|
93
|
-
}
|
|
39
|
+
return new __HttpRequest({
|
|
40
|
+
protocol,
|
|
41
|
+
hostname,
|
|
42
|
+
port,
|
|
43
|
+
method: "POST",
|
|
44
|
+
headers,
|
|
45
|
+
path: resolvedPath,
|
|
46
|
+
body,
|
|
94
47
|
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
|
|
107
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
108
|
-
_b = errorCode;
|
|
109
|
-
switch (_b) {
|
|
110
|
-
case "InvalidInputException": return [3, 2];
|
|
111
|
-
case "com.amazonaws.personalizeevents#InvalidInputException": return [3, 2];
|
|
112
|
-
}
|
|
113
|
-
return [3, 4];
|
|
114
|
-
case 2: return [4, deserializeAws_restJson1InvalidInputExceptionResponse(parsedOutput, context)];
|
|
115
|
-
case 3: throw _d.sent();
|
|
116
|
-
case 4:
|
|
117
|
-
parsedBody = parsedOutput.body;
|
|
118
|
-
throwDefaultError({
|
|
119
|
-
output: output,
|
|
120
|
-
parsedBody: parsedBody,
|
|
121
|
-
exceptionCtor: __BaseException,
|
|
122
|
-
errorCode: errorCode,
|
|
123
|
-
});
|
|
124
|
-
_d.label = 5;
|
|
125
|
-
case 5: return [2];
|
|
126
|
-
}
|
|
48
|
+
};
|
|
49
|
+
export const serializeAws_restJson1PutUsersCommand = async (input, context) => {
|
|
50
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
51
|
+
const headers = {
|
|
52
|
+
"content-type": "application/json",
|
|
53
|
+
};
|
|
54
|
+
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/users";
|
|
55
|
+
let body;
|
|
56
|
+
body = JSON.stringify({
|
|
57
|
+
...(input.datasetArn != null && { datasetArn: input.datasetArn }),
|
|
58
|
+
...(input.users != null && { users: serializeAws_restJson1UserList(input.users, context) }),
|
|
127
59
|
});
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
contents = map({
|
|
138
|
-
$metadata: deserializeMetadata(output),
|
|
139
|
-
});
|
|
140
|
-
return [4, collectBody(output.body, context)];
|
|
141
|
-
case 1:
|
|
142
|
-
_a.sent();
|
|
143
|
-
return [2, contents];
|
|
144
|
-
}
|
|
60
|
+
return new __HttpRequest({
|
|
61
|
+
protocol,
|
|
62
|
+
hostname,
|
|
63
|
+
port,
|
|
64
|
+
method: "POST",
|
|
65
|
+
headers,
|
|
66
|
+
path: resolvedPath,
|
|
67
|
+
body,
|
|
145
68
|
});
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
_a = [__assign({}, output)];
|
|
154
|
-
_c = {};
|
|
155
|
-
return [4, parseErrorBody(output.body, context)];
|
|
156
|
-
case 1:
|
|
157
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
|
|
158
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
159
|
-
_b = errorCode;
|
|
160
|
-
switch (_b) {
|
|
161
|
-
case "InvalidInputException": return [3, 2];
|
|
162
|
-
case "com.amazonaws.personalizeevents#InvalidInputException": return [3, 2];
|
|
163
|
-
case "ResourceInUseException": return [3, 4];
|
|
164
|
-
case "com.amazonaws.personalizeevents#ResourceInUseException": return [3, 4];
|
|
165
|
-
case "ResourceNotFoundException": return [3, 6];
|
|
166
|
-
case "com.amazonaws.personalizeevents#ResourceNotFoundException": return [3, 6];
|
|
167
|
-
}
|
|
168
|
-
return [3, 8];
|
|
169
|
-
case 2: return [4, deserializeAws_restJson1InvalidInputExceptionResponse(parsedOutput, context)];
|
|
170
|
-
case 3: throw _d.sent();
|
|
171
|
-
case 4: return [4, deserializeAws_restJson1ResourceInUseExceptionResponse(parsedOutput, context)];
|
|
172
|
-
case 5: throw _d.sent();
|
|
173
|
-
case 6: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
|
|
174
|
-
case 7: throw _d.sent();
|
|
175
|
-
case 8:
|
|
176
|
-
parsedBody = parsedOutput.body;
|
|
177
|
-
throwDefaultError({
|
|
178
|
-
output: output,
|
|
179
|
-
parsedBody: parsedBody,
|
|
180
|
-
exceptionCtor: __BaseException,
|
|
181
|
-
errorCode: errorCode,
|
|
182
|
-
});
|
|
183
|
-
_d.label = 9;
|
|
184
|
-
case 9: return [2];
|
|
185
|
-
}
|
|
69
|
+
};
|
|
70
|
+
export const deserializeAws_restJson1PutEventsCommand = async (output, context) => {
|
|
71
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
72
|
+
return deserializeAws_restJson1PutEventsCommandError(output, context);
|
|
73
|
+
}
|
|
74
|
+
const contents = map({
|
|
75
|
+
$metadata: deserializeMetadata(output),
|
|
186
76
|
});
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
77
|
+
await collectBody(output.body, context);
|
|
78
|
+
return contents;
|
|
79
|
+
};
|
|
80
|
+
const deserializeAws_restJson1PutEventsCommandError = async (output, context) => {
|
|
81
|
+
const parsedOutput = {
|
|
82
|
+
...output,
|
|
83
|
+
body: await parseErrorBody(output.body, context),
|
|
84
|
+
};
|
|
85
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
86
|
+
switch (errorCode) {
|
|
87
|
+
case "InvalidInputException":
|
|
88
|
+
case "com.amazonaws.personalizeevents#InvalidInputException":
|
|
89
|
+
throw await deserializeAws_restJson1InvalidInputExceptionResponse(parsedOutput, context);
|
|
90
|
+
default:
|
|
91
|
+
const parsedBody = parsedOutput.body;
|
|
92
|
+
throwDefaultError({
|
|
93
|
+
output,
|
|
94
|
+
parsedBody,
|
|
95
|
+
exceptionCtor: __BaseException,
|
|
96
|
+
errorCode,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
export const deserializeAws_restJson1PutItemsCommand = async (output, context) => {
|
|
101
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
102
|
+
return deserializeAws_restJson1PutItemsCommandError(output, context);
|
|
103
|
+
}
|
|
104
|
+
const contents = map({
|
|
105
|
+
$metadata: deserializeMetadata(output),
|
|
204
106
|
});
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
errorCode: errorCode,
|
|
241
|
-
});
|
|
242
|
-
_d.label = 9;
|
|
243
|
-
case 9: return [2];
|
|
244
|
-
}
|
|
107
|
+
await collectBody(output.body, context);
|
|
108
|
+
return contents;
|
|
109
|
+
};
|
|
110
|
+
const deserializeAws_restJson1PutItemsCommandError = async (output, context) => {
|
|
111
|
+
const parsedOutput = {
|
|
112
|
+
...output,
|
|
113
|
+
body: await parseErrorBody(output.body, context),
|
|
114
|
+
};
|
|
115
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
116
|
+
switch (errorCode) {
|
|
117
|
+
case "InvalidInputException":
|
|
118
|
+
case "com.amazonaws.personalizeevents#InvalidInputException":
|
|
119
|
+
throw await deserializeAws_restJson1InvalidInputExceptionResponse(parsedOutput, context);
|
|
120
|
+
case "ResourceInUseException":
|
|
121
|
+
case "com.amazonaws.personalizeevents#ResourceInUseException":
|
|
122
|
+
throw await deserializeAws_restJson1ResourceInUseExceptionResponse(parsedOutput, context);
|
|
123
|
+
case "ResourceNotFoundException":
|
|
124
|
+
case "com.amazonaws.personalizeevents#ResourceNotFoundException":
|
|
125
|
+
throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
|
|
126
|
+
default:
|
|
127
|
+
const parsedBody = parsedOutput.body;
|
|
128
|
+
throwDefaultError({
|
|
129
|
+
output,
|
|
130
|
+
parsedBody,
|
|
131
|
+
exceptionCtor: __BaseException,
|
|
132
|
+
errorCode,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
export const deserializeAws_restJson1PutUsersCommand = async (output, context) => {
|
|
137
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
138
|
+
return deserializeAws_restJson1PutUsersCommandError(output, context);
|
|
139
|
+
}
|
|
140
|
+
const contents = map({
|
|
141
|
+
$metadata: deserializeMetadata(output),
|
|
245
142
|
});
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
143
|
+
await collectBody(output.body, context);
|
|
144
|
+
return contents;
|
|
145
|
+
};
|
|
146
|
+
const deserializeAws_restJson1PutUsersCommandError = async (output, context) => {
|
|
147
|
+
const parsedOutput = {
|
|
148
|
+
...output,
|
|
149
|
+
body: await parseErrorBody(output.body, context),
|
|
150
|
+
};
|
|
151
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
152
|
+
switch (errorCode) {
|
|
153
|
+
case "InvalidInputException":
|
|
154
|
+
case "com.amazonaws.personalizeevents#InvalidInputException":
|
|
155
|
+
throw await deserializeAws_restJson1InvalidInputExceptionResponse(parsedOutput, context);
|
|
156
|
+
case "ResourceInUseException":
|
|
157
|
+
case "com.amazonaws.personalizeevents#ResourceInUseException":
|
|
158
|
+
throw await deserializeAws_restJson1ResourceInUseExceptionResponse(parsedOutput, context);
|
|
159
|
+
case "ResourceNotFoundException":
|
|
160
|
+
case "com.amazonaws.personalizeevents#ResourceNotFoundException":
|
|
161
|
+
throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
|
|
162
|
+
default:
|
|
163
|
+
const parsedBody = parsedOutput.body;
|
|
164
|
+
throwDefaultError({
|
|
165
|
+
output,
|
|
166
|
+
parsedBody,
|
|
167
|
+
exceptionCtor: __BaseException,
|
|
168
|
+
errorCode,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
const map = __map;
|
|
173
|
+
const deserializeAws_restJson1InvalidInputExceptionResponse = async (parsedOutput, context) => {
|
|
174
|
+
const contents = map({});
|
|
175
|
+
const data = parsedOutput.body;
|
|
176
|
+
if (data.message != null) {
|
|
177
|
+
contents.message = __expectString(data.message);
|
|
178
|
+
}
|
|
179
|
+
const exception = new InvalidInputException({
|
|
180
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
181
|
+
...contents,
|
|
258
182
|
});
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
183
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
184
|
+
};
|
|
185
|
+
const deserializeAws_restJson1ResourceInUseExceptionResponse = async (parsedOutput, context) => {
|
|
186
|
+
const contents = map({});
|
|
187
|
+
const data = parsedOutput.body;
|
|
188
|
+
if (data.message != null) {
|
|
189
|
+
contents.message = __expectString(data.message);
|
|
190
|
+
}
|
|
191
|
+
const exception = new ResourceInUseException({
|
|
192
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
193
|
+
...contents,
|
|
270
194
|
});
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
195
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
196
|
+
};
|
|
197
|
+
const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
|
|
198
|
+
const contents = map({});
|
|
199
|
+
const data = parsedOutput.body;
|
|
200
|
+
if (data.message != null) {
|
|
201
|
+
contents.message = __expectString(data.message);
|
|
202
|
+
}
|
|
203
|
+
const exception = new ResourceNotFoundException({
|
|
204
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
205
|
+
...contents,
|
|
282
206
|
});
|
|
283
|
-
|
|
284
|
-
var serializeAws_restJson1Event = function (input, context) {
|
|
285
|
-
return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.eventId != null && { eventId: input.eventId })), (input.eventType != null && { eventType: input.eventType })), (input.eventValue != null && { eventValue: __serializeFloat(input.eventValue) })), (input.impression != null && { impression: serializeAws_restJson1Impression(input.impression, context) })), (input.itemId != null && { itemId: input.itemId })), (input.properties != null && { properties: __LazyJsonString.fromObject(input.properties) })), (input.recommendationId != null && { recommendationId: input.recommendationId })), (input.sentAt != null && { sentAt: Math.round(input.sentAt.getTime() / 1000) }));
|
|
207
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
286
208
|
};
|
|
287
|
-
|
|
209
|
+
const serializeAws_restJson1Event = (input, context) => {
|
|
210
|
+
return {
|
|
211
|
+
...(input.eventId != null && { eventId: input.eventId }),
|
|
212
|
+
...(input.eventType != null && { eventType: input.eventType }),
|
|
213
|
+
...(input.eventValue != null && { eventValue: __serializeFloat(input.eventValue) }),
|
|
214
|
+
...(input.impression != null && { impression: serializeAws_restJson1Impression(input.impression, context) }),
|
|
215
|
+
...(input.itemId != null && { itemId: input.itemId }),
|
|
216
|
+
...(input.properties != null && { properties: __LazyJsonString.fromObject(input.properties) }),
|
|
217
|
+
...(input.recommendationId != null && { recommendationId: input.recommendationId }),
|
|
218
|
+
...(input.sentAt != null && { sentAt: Math.round(input.sentAt.getTime() / 1000) }),
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
const serializeAws_restJson1EventList = (input, context) => {
|
|
288
222
|
return input
|
|
289
|
-
.filter(
|
|
290
|
-
.map(
|
|
223
|
+
.filter((e) => e != null)
|
|
224
|
+
.map((entry) => {
|
|
291
225
|
return serializeAws_restJson1Event(entry, context);
|
|
292
226
|
});
|
|
293
227
|
};
|
|
294
|
-
|
|
228
|
+
const serializeAws_restJson1Impression = (input, context) => {
|
|
295
229
|
return input
|
|
296
|
-
.filter(
|
|
297
|
-
.map(
|
|
230
|
+
.filter((e) => e != null)
|
|
231
|
+
.map((entry) => {
|
|
298
232
|
return entry;
|
|
299
233
|
});
|
|
300
234
|
};
|
|
301
|
-
|
|
302
|
-
return
|
|
235
|
+
const serializeAws_restJson1Item = (input, context) => {
|
|
236
|
+
return {
|
|
237
|
+
...(input.itemId != null && { itemId: input.itemId }),
|
|
238
|
+
...(input.properties != null && { properties: __LazyJsonString.fromObject(input.properties) }),
|
|
239
|
+
};
|
|
303
240
|
};
|
|
304
|
-
|
|
241
|
+
const serializeAws_restJson1ItemList = (input, context) => {
|
|
305
242
|
return input
|
|
306
|
-
.filter(
|
|
307
|
-
.map(
|
|
243
|
+
.filter((e) => e != null)
|
|
244
|
+
.map((entry) => {
|
|
308
245
|
return serializeAws_restJson1Item(entry, context);
|
|
309
246
|
});
|
|
310
247
|
};
|
|
311
|
-
|
|
312
|
-
return
|
|
248
|
+
const serializeAws_restJson1User = (input, context) => {
|
|
249
|
+
return {
|
|
250
|
+
...(input.properties != null && { properties: __LazyJsonString.fromObject(input.properties) }),
|
|
251
|
+
...(input.userId != null && { userId: input.userId }),
|
|
252
|
+
};
|
|
313
253
|
};
|
|
314
|
-
|
|
254
|
+
const serializeAws_restJson1UserList = (input, context) => {
|
|
315
255
|
return input
|
|
316
|
-
.filter(
|
|
317
|
-
.map(
|
|
256
|
+
.filter((e) => e != null)
|
|
257
|
+
.map((entry) => {
|
|
318
258
|
return serializeAws_restJson1User(entry, context);
|
|
319
259
|
});
|
|
320
260
|
};
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
});
|
|
329
|
-
};
|
|
330
|
-
var collectBody = function (streamBody, context) {
|
|
331
|
-
if (streamBody === void 0) { streamBody = new Uint8Array(); }
|
|
261
|
+
const deserializeMetadata = (output) => ({
|
|
262
|
+
httpStatusCode: output.statusCode,
|
|
263
|
+
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
|
264
|
+
extendedRequestId: output.headers["x-amz-id-2"],
|
|
265
|
+
cfId: output.headers["x-amz-cf-id"],
|
|
266
|
+
});
|
|
267
|
+
const collectBody = (streamBody = new Uint8Array(), context) => {
|
|
332
268
|
if (streamBody instanceof Uint8Array) {
|
|
333
269
|
return Promise.resolve(streamBody);
|
|
334
270
|
}
|
|
335
271
|
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
|
336
272
|
};
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
});
|
|
273
|
+
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
274
|
+
const isSerializableHeaderValue = (value) => value !== undefined &&
|
|
275
|
+
value !== null &&
|
|
276
|
+
value !== "" &&
|
|
277
|
+
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
|
|
278
|
+
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
279
|
+
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
280
|
+
if (encoded.length) {
|
|
281
|
+
return JSON.parse(encoded);
|
|
282
|
+
}
|
|
283
|
+
return {};
|
|
284
|
+
});
|
|
285
|
+
const parseErrorBody = async (errorBody, context) => {
|
|
286
|
+
const value = await parseBody(errorBody, context);
|
|
287
|
+
value.message = value.message ?? value.Message;
|
|
288
|
+
return value;
|
|
354
289
|
};
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
switch (_b.label) {
|
|
360
|
-
case 0: return [4, parseBody(errorBody, context)];
|
|
361
|
-
case 1:
|
|
362
|
-
value = _b.sent();
|
|
363
|
-
value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
|
|
364
|
-
return [2, value];
|
|
365
|
-
}
|
|
366
|
-
});
|
|
367
|
-
}); };
|
|
368
|
-
var loadRestJsonErrorCode = function (output, data) {
|
|
369
|
-
var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
|
|
370
|
-
var sanitizeErrorCode = function (rawValue) {
|
|
371
|
-
var cleanValue = rawValue;
|
|
290
|
+
const loadRestJsonErrorCode = (output, data) => {
|
|
291
|
+
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
292
|
+
const sanitizeErrorCode = (rawValue) => {
|
|
293
|
+
let cleanValue = rawValue;
|
|
372
294
|
if (typeof cleanValue === "number") {
|
|
373
295
|
cleanValue = cleanValue.toString();
|
|
374
296
|
}
|
|
@@ -383,7 +305,7 @@ var loadRestJsonErrorCode = function (output, data) {
|
|
|
383
305
|
}
|
|
384
306
|
return cleanValue;
|
|
385
307
|
};
|
|
386
|
-
|
|
308
|
+
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
387
309
|
if (headerKey !== undefined) {
|
|
388
310
|
return sanitizeErrorCode(output.headers[headerKey]);
|
|
389
311
|
}
|