@aws-sdk/client-personalize-runtime 3.312.0 → 3.316.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/PersonalizeRuntime.js +6 -28
- package/dist-cjs/protocols/Aws_restJson1.js +49 -94
- package/dist-es/PersonalizeRuntime.js +6 -28
- package/dist-es/protocols/Aws_restJson1.js +46 -91
- package/dist-types/PersonalizeRuntime.d.ts +9 -31
- package/dist-types/ts3.4/PersonalizeRuntime.d.ts +4 -1
- package/package.json +6 -6
|
@@ -1,37 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PersonalizeRuntime = void 0;
|
|
4
|
+
const smithy_client_1 = require("@aws-sdk/smithy-client");
|
|
4
5
|
const GetPersonalizedRankingCommand_1 = require("./commands/GetPersonalizedRankingCommand");
|
|
5
6
|
const GetRecommendationsCommand_1 = require("./commands/GetRecommendationsCommand");
|
|
6
7
|
const PersonalizeRuntimeClient_1 = require("./PersonalizeRuntimeClient");
|
|
8
|
+
const commands = {
|
|
9
|
+
GetPersonalizedRankingCommand: GetPersonalizedRankingCommand_1.GetPersonalizedRankingCommand,
|
|
10
|
+
GetRecommendationsCommand: GetRecommendationsCommand_1.GetRecommendationsCommand,
|
|
11
|
+
};
|
|
7
12
|
class PersonalizeRuntime extends PersonalizeRuntimeClient_1.PersonalizeRuntimeClient {
|
|
8
|
-
getPersonalizedRanking(args, optionsOrCb, cb) {
|
|
9
|
-
const command = new GetPersonalizedRankingCommand_1.GetPersonalizedRankingCommand(args);
|
|
10
|
-
if (typeof optionsOrCb === "function") {
|
|
11
|
-
this.send(command, optionsOrCb);
|
|
12
|
-
}
|
|
13
|
-
else if (typeof cb === "function") {
|
|
14
|
-
if (typeof optionsOrCb !== "object")
|
|
15
|
-
throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
|
|
16
|
-
this.send(command, optionsOrCb || {}, cb);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
return this.send(command, optionsOrCb);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
getRecommendations(args, optionsOrCb, cb) {
|
|
23
|
-
const command = new GetRecommendationsCommand_1.GetRecommendationsCommand(args);
|
|
24
|
-
if (typeof optionsOrCb === "function") {
|
|
25
|
-
this.send(command, optionsOrCb);
|
|
26
|
-
}
|
|
27
|
-
else if (typeof cb === "function") {
|
|
28
|
-
if (typeof optionsOrCb !== "object")
|
|
29
|
-
throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
|
|
30
|
-
this.send(command, optionsOrCb || {}, cb);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
return this.send(command, optionsOrCb);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
13
|
}
|
|
37
14
|
exports.PersonalizeRuntime = PersonalizeRuntime;
|
|
15
|
+
(0, smithy_client_1.createAggregatedClient)(commands, PersonalizeRuntime);
|
|
@@ -12,14 +12,14 @@ const se_GetPersonalizedRankingCommand = async (input, context) => {
|
|
|
12
12
|
};
|
|
13
13
|
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/personalize-ranking";
|
|
14
14
|
let body;
|
|
15
|
-
body = JSON.stringify({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
15
|
+
body = JSON.stringify((0, smithy_client_1.take)(input, {
|
|
16
|
+
campaignArn: [],
|
|
17
|
+
context: (_) => (0, smithy_client_1._json)(_),
|
|
18
|
+
filterArn: [],
|
|
19
|
+
filterValues: (_) => (0, smithy_client_1._json)(_),
|
|
20
|
+
inputList: (_) => (0, smithy_client_1._json)(_),
|
|
21
|
+
userId: [],
|
|
22
|
+
}));
|
|
23
23
|
return new protocol_http_1.HttpRequest({
|
|
24
24
|
protocol,
|
|
25
25
|
hostname,
|
|
@@ -38,17 +38,17 @@ const se_GetRecommendationsCommand = async (input, context) => {
|
|
|
38
38
|
};
|
|
39
39
|
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/recommendations";
|
|
40
40
|
let body;
|
|
41
|
-
body = JSON.stringify({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
});
|
|
41
|
+
body = JSON.stringify((0, smithy_client_1.take)(input, {
|
|
42
|
+
campaignArn: [],
|
|
43
|
+
context: (_) => (0, smithy_client_1._json)(_),
|
|
44
|
+
filterArn: [],
|
|
45
|
+
filterValues: (_) => (0, smithy_client_1._json)(_),
|
|
46
|
+
itemId: [],
|
|
47
|
+
numResults: [],
|
|
48
|
+
promotions: (_) => (0, smithy_client_1._json)(_),
|
|
49
|
+
recommenderArn: [],
|
|
50
|
+
userId: [],
|
|
51
|
+
}));
|
|
52
52
|
return new protocol_http_1.HttpRequest({
|
|
53
53
|
protocol,
|
|
54
54
|
hostname,
|
|
@@ -64,16 +64,15 @@ const de_GetPersonalizedRankingCommand = async (output, context) => {
|
|
|
64
64
|
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
65
65
|
return de_GetPersonalizedRankingCommandError(output, context);
|
|
66
66
|
}
|
|
67
|
-
const contents = map({
|
|
67
|
+
const contents = (0, smithy_client_1.map)({
|
|
68
68
|
$metadata: deserializeMetadata(output),
|
|
69
69
|
});
|
|
70
70
|
const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
71
|
+
const doc = (0, smithy_client_1.take)(data, {
|
|
72
|
+
personalizedRanking: (_) => de_ItemList(_, context),
|
|
73
|
+
recommendationId: smithy_client_1.expectString,
|
|
74
|
+
});
|
|
75
|
+
Object.assign(contents, doc);
|
|
77
76
|
return contents;
|
|
78
77
|
};
|
|
79
78
|
exports.de_GetPersonalizedRankingCommand = de_GetPersonalizedRankingCommand;
|
|
@@ -92,10 +91,9 @@ const de_GetPersonalizedRankingCommandError = async (output, context) => {
|
|
|
92
91
|
throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
|
|
93
92
|
default:
|
|
94
93
|
const parsedBody = parsedOutput.body;
|
|
95
|
-
|
|
94
|
+
return throwDefaultError({
|
|
96
95
|
output,
|
|
97
96
|
parsedBody,
|
|
98
|
-
exceptionCtor: PersonalizeRuntimeServiceException_1.PersonalizeRuntimeServiceException,
|
|
99
97
|
errorCode,
|
|
100
98
|
});
|
|
101
99
|
}
|
|
@@ -104,16 +102,15 @@ const de_GetRecommendationsCommand = async (output, context) => {
|
|
|
104
102
|
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
105
103
|
return de_GetRecommendationsCommandError(output, context);
|
|
106
104
|
}
|
|
107
|
-
const contents = map({
|
|
105
|
+
const contents = (0, smithy_client_1.map)({
|
|
108
106
|
$metadata: deserializeMetadata(output),
|
|
109
107
|
});
|
|
110
108
|
const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
109
|
+
const doc = (0, smithy_client_1.take)(data, {
|
|
110
|
+
itemList: (_) => de_ItemList(_, context),
|
|
111
|
+
recommendationId: smithy_client_1.expectString,
|
|
112
|
+
});
|
|
113
|
+
Object.assign(contents, doc);
|
|
117
114
|
return contents;
|
|
118
115
|
};
|
|
119
116
|
exports.de_GetRecommendationsCommand = de_GetRecommendationsCommand;
|
|
@@ -132,21 +129,21 @@ const de_GetRecommendationsCommandError = async (output, context) => {
|
|
|
132
129
|
throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
|
|
133
130
|
default:
|
|
134
131
|
const parsedBody = parsedOutput.body;
|
|
135
|
-
|
|
132
|
+
return throwDefaultError({
|
|
136
133
|
output,
|
|
137
134
|
parsedBody,
|
|
138
|
-
exceptionCtor: PersonalizeRuntimeServiceException_1.PersonalizeRuntimeServiceException,
|
|
139
135
|
errorCode,
|
|
140
136
|
});
|
|
141
137
|
}
|
|
142
138
|
};
|
|
143
|
-
const
|
|
139
|
+
const throwDefaultError = (0, smithy_client_1.withBaseException)(PersonalizeRuntimeServiceException_1.PersonalizeRuntimeServiceException);
|
|
144
140
|
const de_InvalidInputExceptionRes = async (parsedOutput, context) => {
|
|
145
|
-
const contents = map({});
|
|
141
|
+
const contents = (0, smithy_client_1.map)({});
|
|
146
142
|
const data = parsedOutput.body;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
143
|
+
const doc = (0, smithy_client_1.take)(data, {
|
|
144
|
+
message: smithy_client_1.expectString,
|
|
145
|
+
});
|
|
146
|
+
Object.assign(contents, doc);
|
|
150
147
|
const exception = new models_0_1.InvalidInputException({
|
|
151
148
|
$metadata: deserializeMetadata(parsedOutput),
|
|
152
149
|
...contents,
|
|
@@ -154,74 +151,32 @@ const de_InvalidInputExceptionRes = async (parsedOutput, context) => {
|
|
|
154
151
|
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
155
152
|
};
|
|
156
153
|
const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
|
|
157
|
-
const contents = map({});
|
|
154
|
+
const contents = (0, smithy_client_1.map)({});
|
|
158
155
|
const data = parsedOutput.body;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
156
|
+
const doc = (0, smithy_client_1.take)(data, {
|
|
157
|
+
message: smithy_client_1.expectString,
|
|
158
|
+
});
|
|
159
|
+
Object.assign(contents, doc);
|
|
162
160
|
const exception = new models_0_1.ResourceNotFoundException({
|
|
163
161
|
$metadata: deserializeMetadata(parsedOutput),
|
|
164
162
|
...contents,
|
|
165
163
|
});
|
|
166
164
|
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
167
165
|
};
|
|
168
|
-
const se_Context = (input, context) => {
|
|
169
|
-
return Object.entries(input).reduce((acc, [key, value]) => {
|
|
170
|
-
if (value === null) {
|
|
171
|
-
return acc;
|
|
172
|
-
}
|
|
173
|
-
acc[key] = value;
|
|
174
|
-
return acc;
|
|
175
|
-
}, {});
|
|
176
|
-
};
|
|
177
|
-
const se_FilterValues = (input, context) => {
|
|
178
|
-
return Object.entries(input).reduce((acc, [key, value]) => {
|
|
179
|
-
if (value === null) {
|
|
180
|
-
return acc;
|
|
181
|
-
}
|
|
182
|
-
acc[key] = value;
|
|
183
|
-
return acc;
|
|
184
|
-
}, {});
|
|
185
|
-
};
|
|
186
|
-
const se_InputList = (input, context) => {
|
|
187
|
-
return input
|
|
188
|
-
.filter((e) => e != null)
|
|
189
|
-
.map((entry) => {
|
|
190
|
-
return entry;
|
|
191
|
-
});
|
|
192
|
-
};
|
|
193
|
-
const se_Promotion = (input, context) => {
|
|
194
|
-
return {
|
|
195
|
-
...(input.filterArn != null && { filterArn: input.filterArn }),
|
|
196
|
-
...(input.filterValues != null && { filterValues: se_FilterValues(input.filterValues, context) }),
|
|
197
|
-
...(input.name != null && { name: input.name }),
|
|
198
|
-
...(input.percentPromotedItems != null && { percentPromotedItems: input.percentPromotedItems }),
|
|
199
|
-
};
|
|
200
|
-
};
|
|
201
|
-
const se_PromotionList = (input, context) => {
|
|
202
|
-
return input
|
|
203
|
-
.filter((e) => e != null)
|
|
204
|
-
.map((entry) => {
|
|
205
|
-
return se_Promotion(entry, context);
|
|
206
|
-
});
|
|
207
|
-
};
|
|
208
166
|
const de_ItemList = (output, context) => {
|
|
209
167
|
const retVal = (output || [])
|
|
210
168
|
.filter((e) => e != null)
|
|
211
169
|
.map((entry) => {
|
|
212
|
-
if (entry === null) {
|
|
213
|
-
return null;
|
|
214
|
-
}
|
|
215
170
|
return de_PredictedItem(entry, context);
|
|
216
171
|
});
|
|
217
172
|
return retVal;
|
|
218
173
|
};
|
|
219
174
|
const de_PredictedItem = (output, context) => {
|
|
220
|
-
return {
|
|
221
|
-
itemId:
|
|
222
|
-
promotionName:
|
|
223
|
-
score:
|
|
224
|
-
};
|
|
175
|
+
return (0, smithy_client_1.take)(output, {
|
|
176
|
+
itemId: smithy_client_1.expectString,
|
|
177
|
+
promotionName: smithy_client_1.expectString,
|
|
178
|
+
score: smithy_client_1.limitedParseDouble,
|
|
179
|
+
});
|
|
225
180
|
};
|
|
226
181
|
const deserializeMetadata = (output) => ({
|
|
227
182
|
httpStatusCode: output.statusCode,
|
|
@@ -1,33 +1,11 @@
|
|
|
1
|
+
import { createAggregatedClient } from "@aws-sdk/smithy-client";
|
|
1
2
|
import { GetPersonalizedRankingCommand, } from "./commands/GetPersonalizedRankingCommand";
|
|
2
3
|
import { GetRecommendationsCommand, } from "./commands/GetRecommendationsCommand";
|
|
3
4
|
import { PersonalizeRuntimeClient } from "./PersonalizeRuntimeClient";
|
|
5
|
+
const commands = {
|
|
6
|
+
GetPersonalizedRankingCommand,
|
|
7
|
+
GetRecommendationsCommand,
|
|
8
|
+
};
|
|
4
9
|
export class PersonalizeRuntime extends PersonalizeRuntimeClient {
|
|
5
|
-
getPersonalizedRanking(args, optionsOrCb, cb) {
|
|
6
|
-
const command = new GetPersonalizedRankingCommand(args);
|
|
7
|
-
if (typeof optionsOrCb === "function") {
|
|
8
|
-
this.send(command, optionsOrCb);
|
|
9
|
-
}
|
|
10
|
-
else if (typeof cb === "function") {
|
|
11
|
-
if (typeof optionsOrCb !== "object")
|
|
12
|
-
throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
|
|
13
|
-
this.send(command, optionsOrCb || {}, cb);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
return this.send(command, optionsOrCb);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
getRecommendations(args, optionsOrCb, cb) {
|
|
20
|
-
const command = new GetRecommendationsCommand(args);
|
|
21
|
-
if (typeof optionsOrCb === "function") {
|
|
22
|
-
this.send(command, optionsOrCb);
|
|
23
|
-
}
|
|
24
|
-
else if (typeof cb === "function") {
|
|
25
|
-
if (typeof optionsOrCb !== "object")
|
|
26
|
-
throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
|
|
27
|
-
this.send(command, optionsOrCb || {}, cb);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
return this.send(command, optionsOrCb);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
10
|
}
|
|
11
|
+
createAggregatedClient(commands, PersonalizeRuntime);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
|
|
2
|
-
import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, map
|
|
2
|
+
import { _json, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, map, take, withBaseException, } from "@aws-sdk/smithy-client";
|
|
3
3
|
import { InvalidInputException, ResourceNotFoundException } from "../models/models_0";
|
|
4
4
|
import { PersonalizeRuntimeServiceException as __BaseException } from "../models/PersonalizeRuntimeServiceException";
|
|
5
5
|
export const se_GetPersonalizedRankingCommand = async (input, context) => {
|
|
@@ -9,14 +9,14 @@ export const se_GetPersonalizedRankingCommand = async (input, context) => {
|
|
|
9
9
|
};
|
|
10
10
|
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/personalize-ranking";
|
|
11
11
|
let body;
|
|
12
|
-
body = JSON.stringify({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
12
|
+
body = JSON.stringify(take(input, {
|
|
13
|
+
campaignArn: [],
|
|
14
|
+
context: (_) => _json(_),
|
|
15
|
+
filterArn: [],
|
|
16
|
+
filterValues: (_) => _json(_),
|
|
17
|
+
inputList: (_) => _json(_),
|
|
18
|
+
userId: [],
|
|
19
|
+
}));
|
|
20
20
|
return new __HttpRequest({
|
|
21
21
|
protocol,
|
|
22
22
|
hostname,
|
|
@@ -34,17 +34,17 @@ export const se_GetRecommendationsCommand = async (input, context) => {
|
|
|
34
34
|
};
|
|
35
35
|
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/recommendations";
|
|
36
36
|
let body;
|
|
37
|
-
body = JSON.stringify({
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
37
|
+
body = JSON.stringify(take(input, {
|
|
38
|
+
campaignArn: [],
|
|
39
|
+
context: (_) => _json(_),
|
|
40
|
+
filterArn: [],
|
|
41
|
+
filterValues: (_) => _json(_),
|
|
42
|
+
itemId: [],
|
|
43
|
+
numResults: [],
|
|
44
|
+
promotions: (_) => _json(_),
|
|
45
|
+
recommenderArn: [],
|
|
46
|
+
userId: [],
|
|
47
|
+
}));
|
|
48
48
|
return new __HttpRequest({
|
|
49
49
|
protocol,
|
|
50
50
|
hostname,
|
|
@@ -63,12 +63,11 @@ export const de_GetPersonalizedRankingCommand = async (output, context) => {
|
|
|
63
63
|
$metadata: deserializeMetadata(output),
|
|
64
64
|
});
|
|
65
65
|
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
66
|
+
const doc = take(data, {
|
|
67
|
+
personalizedRanking: (_) => de_ItemList(_, context),
|
|
68
|
+
recommendationId: __expectString,
|
|
69
|
+
});
|
|
70
|
+
Object.assign(contents, doc);
|
|
72
71
|
return contents;
|
|
73
72
|
};
|
|
74
73
|
const de_GetPersonalizedRankingCommandError = async (output, context) => {
|
|
@@ -86,10 +85,9 @@ const de_GetPersonalizedRankingCommandError = async (output, context) => {
|
|
|
86
85
|
throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
|
|
87
86
|
default:
|
|
88
87
|
const parsedBody = parsedOutput.body;
|
|
89
|
-
throwDefaultError({
|
|
88
|
+
return throwDefaultError({
|
|
90
89
|
output,
|
|
91
90
|
parsedBody,
|
|
92
|
-
exceptionCtor: __BaseException,
|
|
93
91
|
errorCode,
|
|
94
92
|
});
|
|
95
93
|
}
|
|
@@ -102,12 +100,11 @@ export const de_GetRecommendationsCommand = async (output, context) => {
|
|
|
102
100
|
$metadata: deserializeMetadata(output),
|
|
103
101
|
});
|
|
104
102
|
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
103
|
+
const doc = take(data, {
|
|
104
|
+
itemList: (_) => de_ItemList(_, context),
|
|
105
|
+
recommendationId: __expectString,
|
|
106
|
+
});
|
|
107
|
+
Object.assign(contents, doc);
|
|
111
108
|
return contents;
|
|
112
109
|
};
|
|
113
110
|
const de_GetRecommendationsCommandError = async (output, context) => {
|
|
@@ -125,21 +122,21 @@ const de_GetRecommendationsCommandError = async (output, context) => {
|
|
|
125
122
|
throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
|
|
126
123
|
default:
|
|
127
124
|
const parsedBody = parsedOutput.body;
|
|
128
|
-
throwDefaultError({
|
|
125
|
+
return throwDefaultError({
|
|
129
126
|
output,
|
|
130
127
|
parsedBody,
|
|
131
|
-
exceptionCtor: __BaseException,
|
|
132
128
|
errorCode,
|
|
133
129
|
});
|
|
134
130
|
}
|
|
135
131
|
};
|
|
136
|
-
const
|
|
132
|
+
const throwDefaultError = withBaseException(__BaseException);
|
|
137
133
|
const de_InvalidInputExceptionRes = async (parsedOutput, context) => {
|
|
138
134
|
const contents = map({});
|
|
139
135
|
const data = parsedOutput.body;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
136
|
+
const doc = take(data, {
|
|
137
|
+
message: __expectString,
|
|
138
|
+
});
|
|
139
|
+
Object.assign(contents, doc);
|
|
143
140
|
const exception = new InvalidInputException({
|
|
144
141
|
$metadata: deserializeMetadata(parsedOutput),
|
|
145
142
|
...contents,
|
|
@@ -149,72 +146,30 @@ const de_InvalidInputExceptionRes = async (parsedOutput, context) => {
|
|
|
149
146
|
const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
|
|
150
147
|
const contents = map({});
|
|
151
148
|
const data = parsedOutput.body;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
149
|
+
const doc = take(data, {
|
|
150
|
+
message: __expectString,
|
|
151
|
+
});
|
|
152
|
+
Object.assign(contents, doc);
|
|
155
153
|
const exception = new ResourceNotFoundException({
|
|
156
154
|
$metadata: deserializeMetadata(parsedOutput),
|
|
157
155
|
...contents,
|
|
158
156
|
});
|
|
159
157
|
return __decorateServiceException(exception, parsedOutput.body);
|
|
160
158
|
};
|
|
161
|
-
const se_Context = (input, context) => {
|
|
162
|
-
return Object.entries(input).reduce((acc, [key, value]) => {
|
|
163
|
-
if (value === null) {
|
|
164
|
-
return acc;
|
|
165
|
-
}
|
|
166
|
-
acc[key] = value;
|
|
167
|
-
return acc;
|
|
168
|
-
}, {});
|
|
169
|
-
};
|
|
170
|
-
const se_FilterValues = (input, context) => {
|
|
171
|
-
return Object.entries(input).reduce((acc, [key, value]) => {
|
|
172
|
-
if (value === null) {
|
|
173
|
-
return acc;
|
|
174
|
-
}
|
|
175
|
-
acc[key] = value;
|
|
176
|
-
return acc;
|
|
177
|
-
}, {});
|
|
178
|
-
};
|
|
179
|
-
const se_InputList = (input, context) => {
|
|
180
|
-
return input
|
|
181
|
-
.filter((e) => e != null)
|
|
182
|
-
.map((entry) => {
|
|
183
|
-
return entry;
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
|
-
const se_Promotion = (input, context) => {
|
|
187
|
-
return {
|
|
188
|
-
...(input.filterArn != null && { filterArn: input.filterArn }),
|
|
189
|
-
...(input.filterValues != null && { filterValues: se_FilterValues(input.filterValues, context) }),
|
|
190
|
-
...(input.name != null && { name: input.name }),
|
|
191
|
-
...(input.percentPromotedItems != null && { percentPromotedItems: input.percentPromotedItems }),
|
|
192
|
-
};
|
|
193
|
-
};
|
|
194
|
-
const se_PromotionList = (input, context) => {
|
|
195
|
-
return input
|
|
196
|
-
.filter((e) => e != null)
|
|
197
|
-
.map((entry) => {
|
|
198
|
-
return se_Promotion(entry, context);
|
|
199
|
-
});
|
|
200
|
-
};
|
|
201
159
|
const de_ItemList = (output, context) => {
|
|
202
160
|
const retVal = (output || [])
|
|
203
161
|
.filter((e) => e != null)
|
|
204
162
|
.map((entry) => {
|
|
205
|
-
if (entry === null) {
|
|
206
|
-
return null;
|
|
207
|
-
}
|
|
208
163
|
return de_PredictedItem(entry, context);
|
|
209
164
|
});
|
|
210
165
|
return retVal;
|
|
211
166
|
};
|
|
212
167
|
const de_PredictedItem = (output, context) => {
|
|
213
|
-
return {
|
|
214
|
-
itemId: __expectString
|
|
215
|
-
promotionName: __expectString
|
|
216
|
-
score: __limitedParseDouble
|
|
217
|
-
};
|
|
168
|
+
return take(output, {
|
|
169
|
+
itemId: __expectString,
|
|
170
|
+
promotionName: __expectString,
|
|
171
|
+
score: __limitedParseDouble,
|
|
172
|
+
});
|
|
218
173
|
};
|
|
219
174
|
const deserializeMetadata = (output) => ({
|
|
220
175
|
httpStatusCode: output.statusCode,
|
|
@@ -2,45 +2,23 @@ import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types";
|
|
|
2
2
|
import { GetPersonalizedRankingCommandInput, GetPersonalizedRankingCommandOutput } from "./commands/GetPersonalizedRankingCommand";
|
|
3
3
|
import { GetRecommendationsCommandInput, GetRecommendationsCommandOutput } from "./commands/GetRecommendationsCommand";
|
|
4
4
|
import { PersonalizeRuntimeClient } from "./PersonalizeRuntimeClient";
|
|
5
|
-
|
|
6
|
-
* @public
|
|
7
|
-
* <p></p>
|
|
8
|
-
*/
|
|
9
|
-
export declare class PersonalizeRuntime extends PersonalizeRuntimeClient {
|
|
5
|
+
export interface PersonalizeRuntime {
|
|
10
6
|
/**
|
|
11
|
-
* @
|
|
12
|
-
* <p>Re-ranks a list of recommended items for the given user. The first item in the list is
|
|
13
|
-
* deemed the most likely item to be of interest to the user.</p>
|
|
14
|
-
* <note>
|
|
15
|
-
* <p>The solution backing the campaign must have been created using a recipe of type
|
|
16
|
-
* PERSONALIZED_RANKING.</p>
|
|
17
|
-
* </note>
|
|
7
|
+
* @see {@link GetPersonalizedRankingCommand}
|
|
18
8
|
*/
|
|
19
9
|
getPersonalizedRanking(args: GetPersonalizedRankingCommandInput, options?: __HttpHandlerOptions): Promise<GetPersonalizedRankingCommandOutput>;
|
|
20
10
|
getPersonalizedRanking(args: GetPersonalizedRankingCommandInput, cb: (err: any, data?: GetPersonalizedRankingCommandOutput) => void): void;
|
|
21
11
|
getPersonalizedRanking(args: GetPersonalizedRankingCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: GetPersonalizedRankingCommandOutput) => void): void;
|
|
22
12
|
/**
|
|
23
|
-
* @
|
|
24
|
-
* <p>Returns a list of recommended items. For campaigns, the campaign's Amazon Resource Name (ARN) is required and the required user and item input depends on the recipe type used to
|
|
25
|
-
* create the solution backing the campaign as follows:</p>
|
|
26
|
-
* <ul>
|
|
27
|
-
* <li>
|
|
28
|
-
* <p>USER_PERSONALIZATION - <code>userId</code> required, <code>itemId</code> not used</p>
|
|
29
|
-
* </li>
|
|
30
|
-
* <li>
|
|
31
|
-
* <p>RELATED_ITEMS - <code>itemId</code> required, <code>userId</code> not used</p>
|
|
32
|
-
* </li>
|
|
33
|
-
* </ul>
|
|
34
|
-
* <note>
|
|
35
|
-
* <p>Campaigns that are backed by a solution created using a recipe of type
|
|
36
|
-
* PERSONALIZED_RANKING use the API.</p>
|
|
37
|
-
* </note>
|
|
38
|
-
* <p>
|
|
39
|
-
* For recommenders, the recommender's ARN is required and the required item and user input depends on the use case (domain-based recipe) backing the recommender.
|
|
40
|
-
* For information on use case requirements see <a href="https://docs.aws.amazon.com/personalize/latest/dg/domain-use-cases.html">Choosing recommender use cases</a>.
|
|
41
|
-
* </p>
|
|
13
|
+
* @see {@link GetRecommendationsCommand}
|
|
42
14
|
*/
|
|
43
15
|
getRecommendations(args: GetRecommendationsCommandInput, options?: __HttpHandlerOptions): Promise<GetRecommendationsCommandOutput>;
|
|
44
16
|
getRecommendations(args: GetRecommendationsCommandInput, cb: (err: any, data?: GetRecommendationsCommandOutput) => void): void;
|
|
45
17
|
getRecommendations(args: GetRecommendationsCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: GetRecommendationsCommandOutput) => void): void;
|
|
46
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* @public
|
|
21
|
+
* <p></p>
|
|
22
|
+
*/
|
|
23
|
+
export declare class PersonalizeRuntime extends PersonalizeRuntimeClient implements PersonalizeRuntime {
|
|
24
|
+
}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
GetRecommendationsCommandOutput,
|
|
9
9
|
} from "./commands/GetRecommendationsCommand";
|
|
10
10
|
import { PersonalizeRuntimeClient } from "./PersonalizeRuntimeClient";
|
|
11
|
-
export
|
|
11
|
+
export interface PersonalizeRuntime {
|
|
12
12
|
getPersonalizedRanking(
|
|
13
13
|
args: GetPersonalizedRankingCommandInput,
|
|
14
14
|
options?: __HttpHandlerOptions
|
|
@@ -36,3 +36,6 @@ export declare class PersonalizeRuntime extends PersonalizeRuntimeClient {
|
|
|
36
36
|
cb: (err: any, data?: GetRecommendationsCommandOutput) => void
|
|
37
37
|
): void;
|
|
38
38
|
}
|
|
39
|
+
export declare class PersonalizeRuntime
|
|
40
|
+
extends PersonalizeRuntimeClient
|
|
41
|
+
implements PersonalizeRuntime {}
|
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.
|
|
4
|
+
"version": "3.316.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",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@aws-crypto/sha256-browser": "3.0.0",
|
|
23
23
|
"@aws-crypto/sha256-js": "3.0.0",
|
|
24
|
-
"@aws-sdk/client-sts": "3.
|
|
24
|
+
"@aws-sdk/client-sts": "3.316.0",
|
|
25
25
|
"@aws-sdk/config-resolver": "3.310.0",
|
|
26
|
-
"@aws-sdk/credential-provider-node": "3.
|
|
26
|
+
"@aws-sdk/credential-provider-node": "3.316.0",
|
|
27
27
|
"@aws-sdk/fetch-http-handler": "3.310.0",
|
|
28
28
|
"@aws-sdk/hash-node": "3.310.0",
|
|
29
29
|
"@aws-sdk/invalid-dependency": "3.310.0",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"@aws-sdk/node-config-provider": "3.310.0",
|
|
41
41
|
"@aws-sdk/node-http-handler": "3.310.0",
|
|
42
42
|
"@aws-sdk/protocol-http": "3.310.0",
|
|
43
|
-
"@aws-sdk/smithy-client": "3.
|
|
43
|
+
"@aws-sdk/smithy-client": "3.316.0",
|
|
44
44
|
"@aws-sdk/types": "3.310.0",
|
|
45
45
|
"@aws-sdk/url-parser": "3.310.0",
|
|
46
46
|
"@aws-sdk/util-base64": "3.310.0",
|
|
47
47
|
"@aws-sdk/util-body-length-browser": "3.310.0",
|
|
48
48
|
"@aws-sdk/util-body-length-node": "3.310.0",
|
|
49
|
-
"@aws-sdk/util-defaults-mode-browser": "3.
|
|
50
|
-
"@aws-sdk/util-defaults-mode-node": "3.
|
|
49
|
+
"@aws-sdk/util-defaults-mode-browser": "3.316.0",
|
|
50
|
+
"@aws-sdk/util-defaults-mode-node": "3.316.0",
|
|
51
51
|
"@aws-sdk/util-endpoints": "3.310.0",
|
|
52
52
|
"@aws-sdk/util-retry": "3.310.0",
|
|
53
53
|
"@aws-sdk/util-user-agent-browser": "3.310.0",
|