@aws-sdk/client-personalize-runtime 3.34.0 → 3.37.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 +47 -0
- package/{dist/cjs → dist-cjs}/PersonalizeRuntime.js +1 -5
- package/{dist/cjs → dist-cjs}/PersonalizeRuntimeClient.js +8 -17
- package/{dist/cjs → dist-cjs}/commands/GetPersonalizedRankingCommand.js +2 -32
- package/dist-cjs/commands/GetRecommendationsCommand.js +36 -0
- package/{dist/cjs → dist-cjs}/endpoints.js +1 -2
- package/{dist/cjs → dist-cjs}/index.js +0 -1
- package/{dist/cjs → dist-cjs}/models/index.js +0 -1
- package/{dist/cjs → dist-cjs}/models/models_0.js +0 -22
- package/{dist/cjs → dist-cjs}/protocols/Aws_restJson1.js +2 -8
- package/{dist/cjs → dist-cjs}/runtimeConfig.browser.js +1 -5
- package/{dist/cjs → dist-cjs}/runtimeConfig.js +1 -5
- package/{dist/cjs → dist-cjs}/runtimeConfig.native.js +0 -4
- package/{dist/cjs → dist-cjs}/runtimeConfig.shared.js +1 -5
- package/{dist/es → dist-es}/PersonalizeRuntime.js +1 -2
- package/{dist/es → dist-es}/PersonalizeRuntimeClient.js +1 -2
- package/{dist/es → dist-es}/commands/GetPersonalizedRankingCommand.js +2 -3
- package/{dist/es → dist-es}/commands/GetRecommendationsCommand.js +2 -3
- package/{dist/es → dist-es}/endpoints.js +1 -2
- package/{dist/types/index.d.ts → dist-es/index.js} +0 -0
- package/{dist/types/models/index.d.ts → dist-es/models/index.js} +0 -0
- package/{dist/es → dist-es}/models/models_0.js +0 -1
- package/{dist/es → dist-es}/protocols/Aws_restJson1.js +0 -1
- package/{dist/es → dist-es}/runtimeConfig.browser.js +1 -2
- package/{dist/es → dist-es}/runtimeConfig.js +1 -2
- package/{dist/es → dist-es}/runtimeConfig.native.js +0 -1
- package/{dist/es → dist-es}/runtimeConfig.shared.js +1 -2
- package/{dist/types → dist-types}/PersonalizeRuntime.d.ts +2 -2
- package/{dist/types → dist-types}/PersonalizeRuntimeClient.d.ts +3 -3
- package/{dist/types → dist-types}/commands/GetPersonalizedRankingCommand.d.ts +3 -3
- package/{dist/types → dist-types}/commands/GetRecommendationsCommand.d.ts +3 -3
- package/{dist/types → dist-types}/endpoints.d.ts +0 -0
- package/{index.ts → dist-types/index.d.ts} +0 -0
- package/{models/index.ts → dist-types/models/index.d.ts} +0 -0
- package/{dist/types → dist-types}/models/models_0.d.ts +0 -0
- package/{dist/types → dist-types}/protocols/Aws_restJson1.d.ts +2 -2
- package/{dist/types → dist-types}/runtimeConfig.browser.d.ts +0 -0
- package/{dist/types → dist-types}/runtimeConfig.d.ts +1 -1
- package/{dist/types → dist-types}/runtimeConfig.native.d.ts +0 -0
- package/{dist/types → dist-types}/runtimeConfig.shared.d.ts +0 -0
- package/{dist/types → dist-types}/ts3.4/PersonalizeRuntime.d.ts +5 -30
- package/dist-types/ts3.4/PersonalizeRuntimeClient.d.ts +69 -0
- package/dist-types/ts3.4/commands/GetPersonalizedRankingCommand.d.ts +17 -0
- package/dist-types/ts3.4/commands/GetRecommendationsCommand.d.ts +17 -0
- package/{dist/types → dist-types}/ts3.4/endpoints.d.ts +0 -0
- package/{dist/types → dist-types}/ts3.4/index.d.ts +0 -0
- package/{dist/types → dist-types}/ts3.4/models/index.d.ts +0 -0
- package/dist-types/ts3.4/models/models_0.d.ts +98 -0
- package/{dist/types → dist-types}/ts3.4/protocols/Aws_restJson1.d.ts +2 -2
- package/{dist/types → dist-types}/ts3.4/runtimeConfig.browser.d.ts +1 -3
- package/{dist/types → dist-types}/ts3.4/runtimeConfig.d.ts +2 -4
- package/{dist/types → dist-types}/ts3.4/runtimeConfig.native.d.ts +1 -3
- package/{dist/types → dist-types}/ts3.4/runtimeConfig.shared.d.ts +1 -3
- package/package.json +45 -42
- package/PersonalizeRuntime.ts +0 -100
- package/PersonalizeRuntimeClient.ts +0 -240
- package/commands/GetPersonalizedRankingCommand.ts +0 -103
- package/commands/GetRecommendationsCommand.ts +0 -112
- package/dist/cjs/PersonalizeRuntime.js.map +0 -1
- package/dist/cjs/PersonalizeRuntimeClient.js.map +0 -1
- package/dist/cjs/commands/GetPersonalizedRankingCommand.js.map +0 -1
- package/dist/cjs/commands/GetRecommendationsCommand.js +0 -75
- package/dist/cjs/commands/GetRecommendationsCommand.js.map +0 -1
- package/dist/cjs/endpoints.js.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/models/index.js.map +0 -1
- package/dist/cjs/models/models_0.js.map +0 -1
- package/dist/cjs/package.json +0 -91
- package/dist/cjs/protocols/Aws_restJson1.js.map +0 -1
- package/dist/cjs/runtimeConfig.browser.js.map +0 -1
- package/dist/cjs/runtimeConfig.js.map +0 -1
- package/dist/cjs/runtimeConfig.native.js.map +0 -1
- package/dist/cjs/runtimeConfig.shared.js.map +0 -1
- package/dist/es/PersonalizeRuntime.js.map +0 -1
- package/dist/es/PersonalizeRuntimeClient.js.map +0 -1
- package/dist/es/commands/GetPersonalizedRankingCommand.js.map +0 -1
- package/dist/es/commands/GetRecommendationsCommand.js.map +0 -1
- package/dist/es/endpoints.js.map +0 -1
- package/dist/es/index.js +0 -6
- package/dist/es/index.js.map +0 -1
- package/dist/es/models/index.js +0 -2
- package/dist/es/models/index.js.map +0 -1
- package/dist/es/models/models_0.js.map +0 -1
- package/dist/es/package.json +0 -91
- package/dist/es/protocols/Aws_restJson1.js.map +0 -1
- package/dist/es/runtimeConfig.browser.js.map +0 -1
- package/dist/es/runtimeConfig.js.map +0 -1
- package/dist/es/runtimeConfig.native.js.map +0 -1
- package/dist/es/runtimeConfig.shared.js.map +0 -1
- package/dist/types/ts3.4/PersonalizeRuntimeClient.d.ts +0 -134
- package/dist/types/ts3.4/commands/GetPersonalizedRankingCommand.d.ts +0 -40
- package/dist/types/ts3.4/commands/GetRecommendationsCommand.d.ts +0 -49
- package/dist/types/ts3.4/models/models_0.d.ts +0 -190
- package/endpoints.ts +0 -57
- package/jest.config.js +0 -4
- package/models/models_0.ts +0 -229
- package/protocols/Aws_restJson1.ts +0 -372
- package/runtimeConfig.browser.ts +0 -40
- package/runtimeConfig.native.ts +0 -16
- package/runtimeConfig.shared.ts +0 -16
- package/runtimeConfig.ts +0 -45
- package/tsconfig.es.json +0 -10
- package/tsconfig.json +0 -31
- package/tsconfig.types.json +0 -8
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GetPersonalizedRankingCommandInput,
|
|
3
|
-
GetPersonalizedRankingCommandOutput,
|
|
4
|
-
} from "../commands/GetPersonalizedRankingCommand";
|
|
5
|
-
import { GetRecommendationsCommandInput, GetRecommendationsCommandOutput } from "../commands/GetRecommendationsCommand";
|
|
6
|
-
import { InvalidInputException, PredictedItem, ResourceNotFoundException } from "../models/models_0";
|
|
7
|
-
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
|
|
8
|
-
import {
|
|
9
|
-
expectNonNull as __expectNonNull,
|
|
10
|
-
expectObject as __expectObject,
|
|
11
|
-
expectString as __expectString,
|
|
12
|
-
limitedParseDouble as __limitedParseDouble,
|
|
13
|
-
} from "@aws-sdk/smithy-client";
|
|
14
|
-
import {
|
|
15
|
-
Endpoint as __Endpoint,
|
|
16
|
-
MetadataBearer as __MetadataBearer,
|
|
17
|
-
ResponseMetadata as __ResponseMetadata,
|
|
18
|
-
SerdeContext as __SerdeContext,
|
|
19
|
-
SmithyException as __SmithyException,
|
|
20
|
-
} from "@aws-sdk/types";
|
|
21
|
-
|
|
22
|
-
export const serializeAws_restJson1GetPersonalizedRankingCommand = async (
|
|
23
|
-
input: GetPersonalizedRankingCommandInput,
|
|
24
|
-
context: __SerdeContext
|
|
25
|
-
): Promise<__HttpRequest> => {
|
|
26
|
-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
27
|
-
const headers: any = {
|
|
28
|
-
"content-type": "application/json",
|
|
29
|
-
};
|
|
30
|
-
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/personalize-ranking";
|
|
31
|
-
let body: any;
|
|
32
|
-
body = JSON.stringify({
|
|
33
|
-
...(input.campaignArn !== undefined && input.campaignArn !== null && { campaignArn: input.campaignArn }),
|
|
34
|
-
...(input.context !== undefined &&
|
|
35
|
-
input.context !== null && { context: serializeAws_restJson1Context(input.context, context) }),
|
|
36
|
-
...(input.filterArn !== undefined && input.filterArn !== null && { filterArn: input.filterArn }),
|
|
37
|
-
...(input.filterValues !== undefined &&
|
|
38
|
-
input.filterValues !== null && { filterValues: serializeAws_restJson1FilterValues(input.filterValues, context) }),
|
|
39
|
-
...(input.inputList !== undefined &&
|
|
40
|
-
input.inputList !== null && { inputList: serializeAws_restJson1InputList(input.inputList, context) }),
|
|
41
|
-
...(input.userId !== undefined && input.userId !== null && { userId: input.userId }),
|
|
42
|
-
});
|
|
43
|
-
return new __HttpRequest({
|
|
44
|
-
protocol,
|
|
45
|
-
hostname,
|
|
46
|
-
port,
|
|
47
|
-
method: "POST",
|
|
48
|
-
headers,
|
|
49
|
-
path: resolvedPath,
|
|
50
|
-
body,
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const serializeAws_restJson1GetRecommendationsCommand = async (
|
|
55
|
-
input: GetRecommendationsCommandInput,
|
|
56
|
-
context: __SerdeContext
|
|
57
|
-
): Promise<__HttpRequest> => {
|
|
58
|
-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
59
|
-
const headers: any = {
|
|
60
|
-
"content-type": "application/json",
|
|
61
|
-
};
|
|
62
|
-
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/recommendations";
|
|
63
|
-
let body: any;
|
|
64
|
-
body = JSON.stringify({
|
|
65
|
-
...(input.campaignArn !== undefined && input.campaignArn !== null && { campaignArn: input.campaignArn }),
|
|
66
|
-
...(input.context !== undefined &&
|
|
67
|
-
input.context !== null && { context: serializeAws_restJson1Context(input.context, context) }),
|
|
68
|
-
...(input.filterArn !== undefined && input.filterArn !== null && { filterArn: input.filterArn }),
|
|
69
|
-
...(input.filterValues !== undefined &&
|
|
70
|
-
input.filterValues !== null && { filterValues: serializeAws_restJson1FilterValues(input.filterValues, context) }),
|
|
71
|
-
...(input.itemId !== undefined && input.itemId !== null && { itemId: input.itemId }),
|
|
72
|
-
...(input.numResults !== undefined && input.numResults !== null && { numResults: input.numResults }),
|
|
73
|
-
...(input.userId !== undefined && input.userId !== null && { userId: input.userId }),
|
|
74
|
-
});
|
|
75
|
-
return new __HttpRequest({
|
|
76
|
-
protocol,
|
|
77
|
-
hostname,
|
|
78
|
-
port,
|
|
79
|
-
method: "POST",
|
|
80
|
-
headers,
|
|
81
|
-
path: resolvedPath,
|
|
82
|
-
body,
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export const deserializeAws_restJson1GetPersonalizedRankingCommand = async (
|
|
87
|
-
output: __HttpResponse,
|
|
88
|
-
context: __SerdeContext
|
|
89
|
-
): Promise<GetPersonalizedRankingCommandOutput> => {
|
|
90
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
91
|
-
return deserializeAws_restJson1GetPersonalizedRankingCommandError(output, context);
|
|
92
|
-
}
|
|
93
|
-
const contents: GetPersonalizedRankingCommandOutput = {
|
|
94
|
-
$metadata: deserializeMetadata(output),
|
|
95
|
-
personalizedRanking: undefined,
|
|
96
|
-
recommendationId: undefined,
|
|
97
|
-
};
|
|
98
|
-
const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
99
|
-
if (data.personalizedRanking !== undefined && data.personalizedRanking !== null) {
|
|
100
|
-
contents.personalizedRanking = deserializeAws_restJson1ItemList(data.personalizedRanking, context);
|
|
101
|
-
}
|
|
102
|
-
if (data.recommendationId !== undefined && data.recommendationId !== null) {
|
|
103
|
-
contents.recommendationId = __expectString(data.recommendationId);
|
|
104
|
-
}
|
|
105
|
-
return Promise.resolve(contents);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const deserializeAws_restJson1GetPersonalizedRankingCommandError = async (
|
|
109
|
-
output: __HttpResponse,
|
|
110
|
-
context: __SerdeContext
|
|
111
|
-
): Promise<GetPersonalizedRankingCommandOutput> => {
|
|
112
|
-
const parsedOutput: any = {
|
|
113
|
-
...output,
|
|
114
|
-
body: await parseBody(output.body, context),
|
|
115
|
-
};
|
|
116
|
-
let response: __SmithyException & __MetadataBearer & { [key: string]: any };
|
|
117
|
-
let errorCode: string = "UnknownError";
|
|
118
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
119
|
-
switch (errorCode) {
|
|
120
|
-
case "InvalidInputException":
|
|
121
|
-
case "com.amazonaws.personalizeruntime#InvalidInputException":
|
|
122
|
-
response = {
|
|
123
|
-
...(await deserializeAws_restJson1InvalidInputExceptionResponse(parsedOutput, context)),
|
|
124
|
-
name: errorCode,
|
|
125
|
-
$metadata: deserializeMetadata(output),
|
|
126
|
-
};
|
|
127
|
-
break;
|
|
128
|
-
case "ResourceNotFoundException":
|
|
129
|
-
case "com.amazonaws.personalizeruntime#ResourceNotFoundException":
|
|
130
|
-
response = {
|
|
131
|
-
...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
|
|
132
|
-
name: errorCode,
|
|
133
|
-
$metadata: deserializeMetadata(output),
|
|
134
|
-
};
|
|
135
|
-
break;
|
|
136
|
-
default:
|
|
137
|
-
const parsedBody = parsedOutput.body;
|
|
138
|
-
errorCode = parsedBody.code || parsedBody.Code || errorCode;
|
|
139
|
-
response = {
|
|
140
|
-
...parsedBody,
|
|
141
|
-
name: `${errorCode}`,
|
|
142
|
-
message: parsedBody.message || parsedBody.Message || errorCode,
|
|
143
|
-
$fault: "client",
|
|
144
|
-
$metadata: deserializeMetadata(output),
|
|
145
|
-
} as any;
|
|
146
|
-
}
|
|
147
|
-
const message = response.message || response.Message || errorCode;
|
|
148
|
-
response.message = message;
|
|
149
|
-
delete response.Message;
|
|
150
|
-
return Promise.reject(Object.assign(new Error(message), response));
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
export const deserializeAws_restJson1GetRecommendationsCommand = async (
|
|
154
|
-
output: __HttpResponse,
|
|
155
|
-
context: __SerdeContext
|
|
156
|
-
): Promise<GetRecommendationsCommandOutput> => {
|
|
157
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
158
|
-
return deserializeAws_restJson1GetRecommendationsCommandError(output, context);
|
|
159
|
-
}
|
|
160
|
-
const contents: GetRecommendationsCommandOutput = {
|
|
161
|
-
$metadata: deserializeMetadata(output),
|
|
162
|
-
itemList: undefined,
|
|
163
|
-
recommendationId: undefined,
|
|
164
|
-
};
|
|
165
|
-
const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
166
|
-
if (data.itemList !== undefined && data.itemList !== null) {
|
|
167
|
-
contents.itemList = deserializeAws_restJson1ItemList(data.itemList, context);
|
|
168
|
-
}
|
|
169
|
-
if (data.recommendationId !== undefined && data.recommendationId !== null) {
|
|
170
|
-
contents.recommendationId = __expectString(data.recommendationId);
|
|
171
|
-
}
|
|
172
|
-
return Promise.resolve(contents);
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
const deserializeAws_restJson1GetRecommendationsCommandError = async (
|
|
176
|
-
output: __HttpResponse,
|
|
177
|
-
context: __SerdeContext
|
|
178
|
-
): Promise<GetRecommendationsCommandOutput> => {
|
|
179
|
-
const parsedOutput: any = {
|
|
180
|
-
...output,
|
|
181
|
-
body: await parseBody(output.body, context),
|
|
182
|
-
};
|
|
183
|
-
let response: __SmithyException & __MetadataBearer & { [key: string]: any };
|
|
184
|
-
let errorCode: string = "UnknownError";
|
|
185
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
186
|
-
switch (errorCode) {
|
|
187
|
-
case "InvalidInputException":
|
|
188
|
-
case "com.amazonaws.personalizeruntime#InvalidInputException":
|
|
189
|
-
response = {
|
|
190
|
-
...(await deserializeAws_restJson1InvalidInputExceptionResponse(parsedOutput, context)),
|
|
191
|
-
name: errorCode,
|
|
192
|
-
$metadata: deserializeMetadata(output),
|
|
193
|
-
};
|
|
194
|
-
break;
|
|
195
|
-
case "ResourceNotFoundException":
|
|
196
|
-
case "com.amazonaws.personalizeruntime#ResourceNotFoundException":
|
|
197
|
-
response = {
|
|
198
|
-
...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
|
|
199
|
-
name: errorCode,
|
|
200
|
-
$metadata: deserializeMetadata(output),
|
|
201
|
-
};
|
|
202
|
-
break;
|
|
203
|
-
default:
|
|
204
|
-
const parsedBody = parsedOutput.body;
|
|
205
|
-
errorCode = parsedBody.code || parsedBody.Code || errorCode;
|
|
206
|
-
response = {
|
|
207
|
-
...parsedBody,
|
|
208
|
-
name: `${errorCode}`,
|
|
209
|
-
message: parsedBody.message || parsedBody.Message || errorCode,
|
|
210
|
-
$fault: "client",
|
|
211
|
-
$metadata: deserializeMetadata(output),
|
|
212
|
-
} as any;
|
|
213
|
-
}
|
|
214
|
-
const message = response.message || response.Message || errorCode;
|
|
215
|
-
response.message = message;
|
|
216
|
-
delete response.Message;
|
|
217
|
-
return Promise.reject(Object.assign(new Error(message), response));
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
const deserializeAws_restJson1InvalidInputExceptionResponse = async (
|
|
221
|
-
parsedOutput: any,
|
|
222
|
-
context: __SerdeContext
|
|
223
|
-
): Promise<InvalidInputException> => {
|
|
224
|
-
const contents: InvalidInputException = {
|
|
225
|
-
name: "InvalidInputException",
|
|
226
|
-
$fault: "client",
|
|
227
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
228
|
-
message: undefined,
|
|
229
|
-
};
|
|
230
|
-
const data: any = parsedOutput.body;
|
|
231
|
-
if (data.message !== undefined && data.message !== null) {
|
|
232
|
-
contents.message = __expectString(data.message);
|
|
233
|
-
}
|
|
234
|
-
return contents;
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (
|
|
238
|
-
parsedOutput: any,
|
|
239
|
-
context: __SerdeContext
|
|
240
|
-
): Promise<ResourceNotFoundException> => {
|
|
241
|
-
const contents: ResourceNotFoundException = {
|
|
242
|
-
name: "ResourceNotFoundException",
|
|
243
|
-
$fault: "client",
|
|
244
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
245
|
-
message: undefined,
|
|
246
|
-
};
|
|
247
|
-
const data: any = parsedOutput.body;
|
|
248
|
-
if (data.message !== undefined && data.message !== null) {
|
|
249
|
-
contents.message = __expectString(data.message);
|
|
250
|
-
}
|
|
251
|
-
return contents;
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
const serializeAws_restJson1Context = (input: { [key: string]: string }, context: __SerdeContext): any => {
|
|
255
|
-
return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => {
|
|
256
|
-
if (value === null) {
|
|
257
|
-
return acc;
|
|
258
|
-
}
|
|
259
|
-
return {
|
|
260
|
-
...acc,
|
|
261
|
-
[key]: value,
|
|
262
|
-
};
|
|
263
|
-
}, {});
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
const serializeAws_restJson1FilterValues = (input: { [key: string]: string }, context: __SerdeContext): any => {
|
|
267
|
-
return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => {
|
|
268
|
-
if (value === null) {
|
|
269
|
-
return acc;
|
|
270
|
-
}
|
|
271
|
-
return {
|
|
272
|
-
...acc,
|
|
273
|
-
[key]: value,
|
|
274
|
-
};
|
|
275
|
-
}, {});
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
const serializeAws_restJson1InputList = (input: string[], context: __SerdeContext): any => {
|
|
279
|
-
return input
|
|
280
|
-
.filter((e: any) => e != null)
|
|
281
|
-
.map((entry) => {
|
|
282
|
-
if (entry === null) {
|
|
283
|
-
return null as any;
|
|
284
|
-
}
|
|
285
|
-
return entry;
|
|
286
|
-
});
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
const deserializeAws_restJson1ItemList = (output: any, context: __SerdeContext): PredictedItem[] => {
|
|
290
|
-
return (output || [])
|
|
291
|
-
.filter((e: any) => e != null)
|
|
292
|
-
.map((entry: any) => {
|
|
293
|
-
if (entry === null) {
|
|
294
|
-
return null as any;
|
|
295
|
-
}
|
|
296
|
-
return deserializeAws_restJson1PredictedItem(entry, context);
|
|
297
|
-
});
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
const deserializeAws_restJson1PredictedItem = (output: any, context: __SerdeContext): PredictedItem => {
|
|
301
|
-
return {
|
|
302
|
-
itemId: __expectString(output.itemId),
|
|
303
|
-
score: __limitedParseDouble(output.score),
|
|
304
|
-
} as any;
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
|
|
308
|
-
httpStatusCode: output.statusCode,
|
|
309
|
-
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
|
|
310
|
-
extendedRequestId: output.headers["x-amz-id-2"],
|
|
311
|
-
cfId: output.headers["x-amz-cf-id"],
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
// Collect low-level response body stream to Uint8Array.
|
|
315
|
-
const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
|
|
316
|
-
if (streamBody instanceof Uint8Array) {
|
|
317
|
-
return Promise.resolve(streamBody);
|
|
318
|
-
}
|
|
319
|
-
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
// Encode Uint8Array data into string with utf-8.
|
|
323
|
-
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
|
|
324
|
-
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
325
|
-
|
|
326
|
-
const isSerializableHeaderValue = (value: any): boolean =>
|
|
327
|
-
value !== undefined &&
|
|
328
|
-
value !== null &&
|
|
329
|
-
value !== "" &&
|
|
330
|
-
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
|
|
331
|
-
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
332
|
-
|
|
333
|
-
const parseBody = (streamBody: any, context: __SerdeContext): any =>
|
|
334
|
-
collectBodyString(streamBody, context).then((encoded) => {
|
|
335
|
-
if (encoded.length) {
|
|
336
|
-
return JSON.parse(encoded);
|
|
337
|
-
}
|
|
338
|
-
return {};
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* Load an error code for the aws.rest-json-1.1 protocol.
|
|
343
|
-
*/
|
|
344
|
-
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
|
|
345
|
-
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
346
|
-
|
|
347
|
-
const sanitizeErrorCode = (rawValue: string): string => {
|
|
348
|
-
let cleanValue = rawValue;
|
|
349
|
-
if (cleanValue.indexOf(":") >= 0) {
|
|
350
|
-
cleanValue = cleanValue.split(":")[0];
|
|
351
|
-
}
|
|
352
|
-
if (cleanValue.indexOf("#") >= 0) {
|
|
353
|
-
cleanValue = cleanValue.split("#")[1];
|
|
354
|
-
}
|
|
355
|
-
return cleanValue;
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
359
|
-
if (headerKey !== undefined) {
|
|
360
|
-
return sanitizeErrorCode(output.headers[headerKey]);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
if (data.code !== undefined) {
|
|
364
|
-
return sanitizeErrorCode(data.code);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
if (data["__type"] !== undefined) {
|
|
368
|
-
return sanitizeErrorCode(data["__type"]);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
return "";
|
|
372
|
-
};
|
package/runtimeConfig.browser.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import packageInfo from "./package.json";
|
|
2
|
-
|
|
3
|
-
import { Sha256 } from "@aws-crypto/sha256-browser";
|
|
4
|
-
import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler";
|
|
5
|
-
import { invalidProvider } from "@aws-sdk/invalid-dependency";
|
|
6
|
-
import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry";
|
|
7
|
-
import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser";
|
|
8
|
-
import { calculateBodyLength } from "@aws-sdk/util-body-length-browser";
|
|
9
|
-
import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser";
|
|
10
|
-
import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser";
|
|
11
|
-
import { PersonalizeRuntimeClientConfig } from "./PersonalizeRuntimeClient";
|
|
12
|
-
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
export const getRuntimeConfig = (config: PersonalizeRuntimeClientConfig) => {
|
|
18
|
-
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
19
|
-
return {
|
|
20
|
-
...clientSharedValues,
|
|
21
|
-
...config,
|
|
22
|
-
runtime: "browser",
|
|
23
|
-
base64Decoder: config?.base64Decoder ?? fromBase64,
|
|
24
|
-
base64Encoder: config?.base64Encoder ?? toBase64,
|
|
25
|
-
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
26
|
-
credentialDefaultProvider:
|
|
27
|
-
config?.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))),
|
|
28
|
-
defaultUserAgentProvider:
|
|
29
|
-
config?.defaultUserAgentProvider ??
|
|
30
|
-
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
31
|
-
maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
|
|
32
|
-
region: config?.region ?? invalidProvider("Region is missing"),
|
|
33
|
-
requestHandler: config?.requestHandler ?? new FetchHttpHandler(),
|
|
34
|
-
retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)),
|
|
35
|
-
sha256: config?.sha256 ?? Sha256,
|
|
36
|
-
streamCollector: config?.streamCollector ?? streamCollector,
|
|
37
|
-
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
38
|
-
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
39
|
-
};
|
|
40
|
-
};
|
package/runtimeConfig.native.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Sha256 } from "@aws-crypto/sha256-js";
|
|
2
|
-
import { PersonalizeRuntimeClientConfig } from "./PersonalizeRuntimeClient";
|
|
3
|
-
import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export const getRuntimeConfig = (config: PersonalizeRuntimeClientConfig) => {
|
|
9
|
-
const browserDefaults = getBrowserRuntimeConfig(config);
|
|
10
|
-
return {
|
|
11
|
-
...browserDefaults,
|
|
12
|
-
...config,
|
|
13
|
-
runtime: "react-native",
|
|
14
|
-
sha256: config?.sha256 ?? Sha256,
|
|
15
|
-
};
|
|
16
|
-
};
|
package/runtimeConfig.shared.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { defaultRegionInfoProvider } from "./endpoints";
|
|
2
|
-
import { Logger as __Logger } from "@aws-sdk/types";
|
|
3
|
-
import { parseUrl } from "@aws-sdk/url-parser";
|
|
4
|
-
import { PersonalizeRuntimeClientConfig } from "./PersonalizeRuntimeClient";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export const getRuntimeConfig = (config: PersonalizeRuntimeClientConfig) => ({
|
|
10
|
-
apiVersion: "2018-05-22",
|
|
11
|
-
disableHostPrefix: config?.disableHostPrefix ?? false,
|
|
12
|
-
logger: config?.logger ?? ({} as __Logger),
|
|
13
|
-
regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider,
|
|
14
|
-
serviceId: config?.serviceId ?? "Personalize Runtime",
|
|
15
|
-
urlParser: config?.urlParser ?? parseUrl,
|
|
16
|
-
});
|
package/runtimeConfig.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import packageInfo from "./package.json";
|
|
2
|
-
|
|
3
|
-
import { decorateDefaultCredentialProvider } from "@aws-sdk/client-sts";
|
|
4
|
-
import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS } from "@aws-sdk/config-resolver";
|
|
5
|
-
import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
|
|
6
|
-
import { Hash } from "@aws-sdk/hash-node";
|
|
7
|
-
import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry";
|
|
8
|
-
import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider";
|
|
9
|
-
import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler";
|
|
10
|
-
import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node";
|
|
11
|
-
import { calculateBodyLength } from "@aws-sdk/util-body-length-node";
|
|
12
|
-
import { defaultUserAgent } from "@aws-sdk/util-user-agent-node";
|
|
13
|
-
import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node";
|
|
14
|
-
import { PersonalizeRuntimeClientConfig } from "./PersonalizeRuntimeClient";
|
|
15
|
-
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
|
16
|
-
import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client";
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
export const getRuntimeConfig = (config: PersonalizeRuntimeClientConfig) => {
|
|
22
|
-
emitWarningIfUnsupportedVersion(process.version);
|
|
23
|
-
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
24
|
-
return {
|
|
25
|
-
...clientSharedValues,
|
|
26
|
-
...config,
|
|
27
|
-
runtime: "node",
|
|
28
|
-
base64Decoder: config?.base64Decoder ?? fromBase64,
|
|
29
|
-
base64Encoder: config?.base64Encoder ?? toBase64,
|
|
30
|
-
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
31
|
-
credentialDefaultProvider:
|
|
32
|
-
config?.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider),
|
|
33
|
-
defaultUserAgentProvider:
|
|
34
|
-
config?.defaultUserAgentProvider ??
|
|
35
|
-
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
36
|
-
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
|
|
37
|
-
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
|
|
38
|
-
requestHandler: config?.requestHandler ?? new NodeHttpHandler(),
|
|
39
|
-
retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS),
|
|
40
|
-
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
|
|
41
|
-
streamCollector: config?.streamCollector ?? streamCollector,
|
|
42
|
-
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
43
|
-
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
44
|
-
};
|
|
45
|
-
};
|
package/tsconfig.es.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"module": "esnext",
|
|
6
|
-
"moduleResolution": "node",
|
|
7
|
-
"lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"],
|
|
8
|
-
"outDir": "dist/es"
|
|
9
|
-
}
|
|
10
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"alwaysStrict": true,
|
|
4
|
-
"target": "ES2018",
|
|
5
|
-
"module": "commonjs",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"sourceMap": true,
|
|
8
|
-
"downlevelIteration": true,
|
|
9
|
-
"importHelpers": true,
|
|
10
|
-
"noEmitHelpers": true,
|
|
11
|
-
"incremental": true,
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"esModuleInterop": true,
|
|
14
|
-
"outDir": "dist/cjs",
|
|
15
|
-
"removeComments": true
|
|
16
|
-
},
|
|
17
|
-
"typedocOptions": {
|
|
18
|
-
"exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"],
|
|
19
|
-
"excludeNotExported": true,
|
|
20
|
-
"excludePrivate": true,
|
|
21
|
-
"hideGenerator": true,
|
|
22
|
-
"ignoreCompilerErrors": true,
|
|
23
|
-
"includeDeclarations": true,
|
|
24
|
-
"stripInternal": true,
|
|
25
|
-
"readme": "README.md",
|
|
26
|
-
"mode": "file",
|
|
27
|
-
"out": "docs",
|
|
28
|
-
"theme": "minimal",
|
|
29
|
-
"plugin": ["@aws-sdk/client-documentation-generator"]
|
|
30
|
-
}
|
|
31
|
-
}
|