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