@aws-sdk/client-personalize-runtime 3.186.0 → 3.190.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 +16 -0
- package/dist-es/PersonalizeRuntime.js +10 -17
- package/dist-es/PersonalizeRuntimeClient.js +22 -28
- package/dist-es/commands/GetPersonalizedRankingCommand.js +21 -28
- package/dist-es/commands/GetRecommendationsCommand.js +21 -28
- package/dist-es/endpoints.js +8 -8
- package/dist-es/models/PersonalizeRuntimeServiceException.js +5 -10
- package/dist-es/models/models_0.js +46 -29
- package/dist-es/protocols/Aws_restJson1.js +212 -267
- 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
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.190.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.189.0...v3.190.0) (2022-10-17)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @aws-sdk/client-personalize-runtime
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [3.188.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.187.0...v3.188.0) (2022-10-13)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @aws-sdk/client-personalize-runtime
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [3.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @aws-sdk/client-personalize-runtime
|
|
@@ -1,40 +1,33 @@
|
|
|
1
|
-
import { __extends } from "tslib";
|
|
2
1
|
import { GetPersonalizedRankingCommand, } from "./commands/GetPersonalizedRankingCommand";
|
|
3
2
|
import { GetRecommendationsCommand, } from "./commands/GetRecommendationsCommand";
|
|
4
3
|
import { PersonalizeRuntimeClient } from "./PersonalizeRuntimeClient";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
9
|
-
}
|
|
10
|
-
PersonalizeRuntime.prototype.getPersonalizedRanking = function (args, optionsOrCb, cb) {
|
|
11
|
-
var command = new GetPersonalizedRankingCommand(args);
|
|
4
|
+
export class PersonalizeRuntime extends PersonalizeRuntimeClient {
|
|
5
|
+
getPersonalizedRanking(args, optionsOrCb, cb) {
|
|
6
|
+
const command = new GetPersonalizedRankingCommand(args);
|
|
12
7
|
if (typeof optionsOrCb === "function") {
|
|
13
8
|
this.send(command, optionsOrCb);
|
|
14
9
|
}
|
|
15
10
|
else if (typeof cb === "function") {
|
|
16
11
|
if (typeof optionsOrCb !== "object")
|
|
17
|
-
throw new Error(
|
|
12
|
+
throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
|
|
18
13
|
this.send(command, optionsOrCb || {}, cb);
|
|
19
14
|
}
|
|
20
15
|
else {
|
|
21
16
|
return this.send(command, optionsOrCb);
|
|
22
17
|
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
}
|
|
19
|
+
getRecommendations(args, optionsOrCb, cb) {
|
|
20
|
+
const command = new GetRecommendationsCommand(args);
|
|
26
21
|
if (typeof optionsOrCb === "function") {
|
|
27
22
|
this.send(command, optionsOrCb);
|
|
28
23
|
}
|
|
29
24
|
else if (typeof cb === "function") {
|
|
30
25
|
if (typeof optionsOrCb !== "object")
|
|
31
|
-
throw new Error(
|
|
26
|
+
throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
|
|
32
27
|
this.send(command, optionsOrCb || {}, cb);
|
|
33
28
|
}
|
|
34
29
|
else {
|
|
35
30
|
return this.send(command, optionsOrCb);
|
|
36
31
|
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
}(PersonalizeRuntimeClient));
|
|
40
|
-
export { PersonalizeRuntime };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __extends } from "tslib";
|
|
2
1
|
import { resolveEndpointsConfig, resolveRegionConfig, } from "@aws-sdk/config-resolver";
|
|
3
2
|
import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length";
|
|
4
3
|
import { getHostHeaderPlugin, resolveHostHeaderConfig, } from "@aws-sdk/middleware-host-header";
|
|
@@ -9,31 +8,26 @@ import { getAwsAuthPlugin, resolveAwsAuthConfig, } from "@aws-sdk/middleware-sig
|
|
|
9
8
|
import { getUserAgentPlugin, resolveUserAgentConfig, } from "@aws-sdk/middleware-user-agent";
|
|
10
9
|
import { Client as __Client, } from "@aws-sdk/smithy-client";
|
|
11
10
|
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
_this.middlewareStack.use(getAwsAuthPlugin(_this.config));
|
|
31
|
-
_this.middlewareStack.use(getUserAgentPlugin(_this.config));
|
|
32
|
-
return _this;
|
|
11
|
+
export class PersonalizeRuntimeClient extends __Client {
|
|
12
|
+
constructor(configuration) {
|
|
13
|
+
const _config_0 = __getRuntimeConfig(configuration);
|
|
14
|
+
const _config_1 = resolveRegionConfig(_config_0);
|
|
15
|
+
const _config_2 = resolveEndpointsConfig(_config_1);
|
|
16
|
+
const _config_3 = resolveRetryConfig(_config_2);
|
|
17
|
+
const _config_4 = resolveHostHeaderConfig(_config_3);
|
|
18
|
+
const _config_5 = resolveAwsAuthConfig(_config_4);
|
|
19
|
+
const _config_6 = resolveUserAgentConfig(_config_5);
|
|
20
|
+
super(_config_6);
|
|
21
|
+
this.config = _config_6;
|
|
22
|
+
this.middlewareStack.use(getRetryPlugin(this.config));
|
|
23
|
+
this.middlewareStack.use(getContentLengthPlugin(this.config));
|
|
24
|
+
this.middlewareStack.use(getHostHeaderPlugin(this.config));
|
|
25
|
+
this.middlewareStack.use(getLoggerPlugin(this.config));
|
|
26
|
+
this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
|
|
27
|
+
this.middlewareStack.use(getAwsAuthPlugin(this.config));
|
|
28
|
+
this.middlewareStack.use(getUserAgentPlugin(this.config));
|
|
33
29
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
}(__Client));
|
|
39
|
-
export { PersonalizeRuntimeClient };
|
|
30
|
+
destroy() {
|
|
31
|
+
super.destroy();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,39 +1,32 @@
|
|
|
1
|
-
import { __extends } from "tslib";
|
|
2
1
|
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
|
|
3
2
|
import { Command as $Command } from "@aws-sdk/smithy-client";
|
|
4
3
|
import { GetPersonalizedRankingRequestFilterSensitiveLog, GetPersonalizedRankingResponseFilterSensitiveLog, } from "../models/models_0";
|
|
5
4
|
import { deserializeAws_restJson1GetPersonalizedRankingCommand, serializeAws_restJson1GetPersonalizedRankingCommand, } from "../protocols/Aws_restJson1";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
_this.input = input;
|
|
11
|
-
return _this;
|
|
5
|
+
export class GetPersonalizedRankingCommand extends $Command {
|
|
6
|
+
constructor(input) {
|
|
7
|
+
super();
|
|
8
|
+
this.input = input;
|
|
12
9
|
}
|
|
13
|
-
|
|
10
|
+
resolveMiddleware(clientStack, configuration, options) {
|
|
14
11
|
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
logger
|
|
21
|
-
clientName
|
|
22
|
-
commandName
|
|
12
|
+
const stack = clientStack.concat(this.middlewareStack);
|
|
13
|
+
const { logger } = configuration;
|
|
14
|
+
const clientName = "PersonalizeRuntimeClient";
|
|
15
|
+
const commandName = "GetPersonalizedRankingCommand";
|
|
16
|
+
const handlerExecutionContext = {
|
|
17
|
+
logger,
|
|
18
|
+
clientName,
|
|
19
|
+
commandName,
|
|
23
20
|
inputFilterSensitiveLog: GetPersonalizedRankingRequestFilterSensitiveLog,
|
|
24
21
|
outputFilterSensitiveLog: GetPersonalizedRankingResponseFilterSensitiveLog,
|
|
25
22
|
};
|
|
26
|
-
|
|
27
|
-
return stack.resolve(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
GetPersonalizedRankingCommand.prototype.serialize = function (input, context) {
|
|
23
|
+
const { requestHandler } = configuration;
|
|
24
|
+
return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
|
|
25
|
+
}
|
|
26
|
+
serialize(input, context) {
|
|
32
27
|
return serializeAws_restJson1GetPersonalizedRankingCommand(input, context);
|
|
33
|
-
}
|
|
34
|
-
|
|
28
|
+
}
|
|
29
|
+
deserialize(output, context) {
|
|
35
30
|
return deserializeAws_restJson1GetPersonalizedRankingCommand(output, context);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
}($Command));
|
|
39
|
-
export { GetPersonalizedRankingCommand };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,39 +1,32 @@
|
|
|
1
|
-
import { __extends } from "tslib";
|
|
2
1
|
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
|
|
3
2
|
import { Command as $Command } from "@aws-sdk/smithy-client";
|
|
4
3
|
import { GetRecommendationsRequestFilterSensitiveLog, GetRecommendationsResponseFilterSensitiveLog, } from "../models/models_0";
|
|
5
4
|
import { deserializeAws_restJson1GetRecommendationsCommand, serializeAws_restJson1GetRecommendationsCommand, } from "../protocols/Aws_restJson1";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
_this.input = input;
|
|
11
|
-
return _this;
|
|
5
|
+
export class GetRecommendationsCommand extends $Command {
|
|
6
|
+
constructor(input) {
|
|
7
|
+
super();
|
|
8
|
+
this.input = input;
|
|
12
9
|
}
|
|
13
|
-
|
|
10
|
+
resolveMiddleware(clientStack, configuration, options) {
|
|
14
11
|
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
logger
|
|
21
|
-
clientName
|
|
22
|
-
commandName
|
|
12
|
+
const stack = clientStack.concat(this.middlewareStack);
|
|
13
|
+
const { logger } = configuration;
|
|
14
|
+
const clientName = "PersonalizeRuntimeClient";
|
|
15
|
+
const commandName = "GetRecommendationsCommand";
|
|
16
|
+
const handlerExecutionContext = {
|
|
17
|
+
logger,
|
|
18
|
+
clientName,
|
|
19
|
+
commandName,
|
|
23
20
|
inputFilterSensitiveLog: GetRecommendationsRequestFilterSensitiveLog,
|
|
24
21
|
outputFilterSensitiveLog: GetRecommendationsResponseFilterSensitiveLog,
|
|
25
22
|
};
|
|
26
|
-
|
|
27
|
-
return stack.resolve(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
GetRecommendationsCommand.prototype.serialize = function (input, context) {
|
|
23
|
+
const { requestHandler } = configuration;
|
|
24
|
+
return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
|
|
25
|
+
}
|
|
26
|
+
serialize(input, context) {
|
|
32
27
|
return serializeAws_restJson1GetRecommendationsCommand(input, context);
|
|
33
|
-
}
|
|
34
|
-
|
|
28
|
+
}
|
|
29
|
+
deserialize(output, context) {
|
|
35
30
|
return deserializeAws_restJson1GetRecommendationsCommand(output, context);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
}($Command));
|
|
39
|
-
export { GetRecommendationsCommand };
|
|
31
|
+
}
|
|
32
|
+
}
|
package/dist-es/endpoints.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
1
|
import { getRegionInfo } from "@aws-sdk/config-resolver";
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const regionHash = {};
|
|
3
|
+
const partitionHash = {
|
|
5
4
|
aws: {
|
|
6
5
|
regions: [
|
|
7
6
|
"af-south-1",
|
|
@@ -121,8 +120,9 @@ var partitionHash = {
|
|
|
121
120
|
],
|
|
122
121
|
},
|
|
123
122
|
};
|
|
124
|
-
export
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
export const defaultRegionInfoProvider = async (region, options) => getRegionInfo(region, {
|
|
124
|
+
...options,
|
|
125
|
+
signingService: "personalize",
|
|
126
|
+
regionHash,
|
|
127
|
+
partitionHash,
|
|
128
|
+
});
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import { __extends } from "tslib";
|
|
2
1
|
import { ServiceException as __ServiceException, } from "@aws-sdk/smithy-client";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.setPrototypeOf(_this, PersonalizeRuntimeServiceException.prototype);
|
|
8
|
-
return _this;
|
|
2
|
+
export class PersonalizeRuntimeServiceException extends __ServiceException {
|
|
3
|
+
constructor(options) {
|
|
4
|
+
super(options);
|
|
5
|
+
Object.setPrototypeOf(this, PersonalizeRuntimeServiceException.prototype);
|
|
9
6
|
}
|
|
10
|
-
|
|
11
|
-
}(__ServiceException));
|
|
12
|
-
export { PersonalizeRuntimeServiceException };
|
|
7
|
+
}
|
|
@@ -1,33 +1,50 @@
|
|
|
1
|
-
import { __assign, __extends } from "tslib";
|
|
2
1
|
import { SENSITIVE_STRING } from "@aws-sdk/smithy-client";
|
|
3
2
|
import { PersonalizeRuntimeServiceException as __BaseException } from "./PersonalizeRuntimeServiceException";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
export class InvalidInputException extends __BaseException {
|
|
4
|
+
constructor(opts) {
|
|
5
|
+
super({
|
|
6
|
+
name: "InvalidInputException",
|
|
7
|
+
$fault: "client",
|
|
8
|
+
...opts,
|
|
9
|
+
});
|
|
10
|
+
this.name = "InvalidInputException";
|
|
11
|
+
this.$fault = "client";
|
|
12
|
+
Object.setPrototypeOf(this, InvalidInputException.prototype);
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
}
|
|
15
|
+
export class ResourceNotFoundException extends __BaseException {
|
|
16
|
+
constructor(opts) {
|
|
17
|
+
super({
|
|
18
|
+
name: "ResourceNotFoundException",
|
|
19
|
+
$fault: "client",
|
|
20
|
+
...opts,
|
|
21
|
+
});
|
|
22
|
+
this.name = "ResourceNotFoundException";
|
|
23
|
+
this.$fault = "client";
|
|
24
|
+
Object.setPrototypeOf(this, ResourceNotFoundException.prototype);
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
}
|
|
27
|
+
export const GetPersonalizedRankingRequestFilterSensitiveLog = (obj) => ({
|
|
28
|
+
...obj,
|
|
29
|
+
...(obj.context && { context: SENSITIVE_STRING }),
|
|
30
|
+
...(obj.filterValues && { filterValues: SENSITIVE_STRING }),
|
|
31
|
+
});
|
|
32
|
+
export const PredictedItemFilterSensitiveLog = (obj) => ({
|
|
33
|
+
...obj,
|
|
34
|
+
});
|
|
35
|
+
export const GetPersonalizedRankingResponseFilterSensitiveLog = (obj) => ({
|
|
36
|
+
...obj,
|
|
37
|
+
});
|
|
38
|
+
export const PromotionFilterSensitiveLog = (obj) => ({
|
|
39
|
+
...obj,
|
|
40
|
+
...(obj.filterValues && { filterValues: SENSITIVE_STRING }),
|
|
41
|
+
});
|
|
42
|
+
export const GetRecommendationsRequestFilterSensitiveLog = (obj) => ({
|
|
43
|
+
...obj,
|
|
44
|
+
...(obj.context && { context: SENSITIVE_STRING }),
|
|
45
|
+
...(obj.filterValues && { filterValues: SENSITIVE_STRING }),
|
|
46
|
+
...(obj.promotions && { promotions: obj.promotions.map((item) => PromotionFilterSensitiveLog(item)) }),
|
|
47
|
+
});
|
|
48
|
+
export const GetRecommendationsResponseFilterSensitiveLog = (obj) => ({
|
|
49
|
+
...obj,
|
|
50
|
+
});
|
|
@@ -1,254 +1,217 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator, __read } from "tslib";
|
|
2
1
|
import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
|
|
3
2
|
import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, map as __map, throwDefaultError, } from "@aws-sdk/smithy-client";
|
|
4
3
|
import { InvalidInputException, ResourceNotFoundException } from "../models/models_0";
|
|
5
4
|
import { PersonalizeRuntimeServiceException as __BaseException } from "../models/PersonalizeRuntimeServiceException";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
hostname: hostname,
|
|
23
|
-
port: port,
|
|
24
|
-
method: "POST",
|
|
25
|
-
headers: headers,
|
|
26
|
-
path: resolvedPath,
|
|
27
|
-
body: body,
|
|
28
|
-
})];
|
|
29
|
-
}
|
|
5
|
+
export const serializeAws_restJson1GetPersonalizedRankingCommand = 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 || ""}` + "/personalize-ranking";
|
|
11
|
+
let body;
|
|
12
|
+
body = JSON.stringify({
|
|
13
|
+
...(input.campaignArn != null && { campaignArn: input.campaignArn }),
|
|
14
|
+
...(input.context != null && { context: serializeAws_restJson1Context(input.context, context) }),
|
|
15
|
+
...(input.filterArn != null && { filterArn: input.filterArn }),
|
|
16
|
+
...(input.filterValues != null && {
|
|
17
|
+
filterValues: serializeAws_restJson1FilterValues(input.filterValues, context),
|
|
18
|
+
}),
|
|
19
|
+
...(input.inputList != null && { inputList: serializeAws_restJson1InputList(input.inputList, context) }),
|
|
20
|
+
...(input.userId != null && { userId: input.userId }),
|
|
30
21
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
headers = {
|
|
40
|
-
"content-type": "application/json",
|
|
41
|
-
};
|
|
42
|
-
resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/recommendations";
|
|
43
|
-
body = JSON.stringify(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.campaignArn != null && { campaignArn: input.campaignArn })), (input.context != null && { context: serializeAws_restJson1Context(input.context, context) })), (input.filterArn != null && { filterArn: input.filterArn })), (input.filterValues != null && {
|
|
44
|
-
filterValues: serializeAws_restJson1FilterValues(input.filterValues, context),
|
|
45
|
-
})), (input.itemId != null && { itemId: input.itemId })), (input.numResults != null && { numResults: input.numResults })), (input.promotions != null && { promotions: serializeAws_restJson1PromotionList(input.promotions, context) })), (input.recommenderArn != null && { recommenderArn: input.recommenderArn })), (input.userId != null && { userId: input.userId })));
|
|
46
|
-
return [2, new __HttpRequest({
|
|
47
|
-
protocol: protocol,
|
|
48
|
-
hostname: hostname,
|
|
49
|
-
port: port,
|
|
50
|
-
method: "POST",
|
|
51
|
-
headers: headers,
|
|
52
|
-
path: resolvedPath,
|
|
53
|
-
body: body,
|
|
54
|
-
})];
|
|
55
|
-
}
|
|
22
|
+
return new __HttpRequest({
|
|
23
|
+
protocol,
|
|
24
|
+
hostname,
|
|
25
|
+
port,
|
|
26
|
+
method: "POST",
|
|
27
|
+
headers,
|
|
28
|
+
path: resolvedPath,
|
|
29
|
+
body,
|
|
56
30
|
});
|
|
57
|
-
}
|
|
58
|
-
export
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (data.recommendationId != null) {
|
|
78
|
-
contents.recommendationId = __expectString(data.recommendationId);
|
|
79
|
-
}
|
|
80
|
-
return [2, contents];
|
|
81
|
-
}
|
|
31
|
+
};
|
|
32
|
+
export const serializeAws_restJson1GetRecommendationsCommand = async (input, context) => {
|
|
33
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
34
|
+
const headers = {
|
|
35
|
+
"content-type": "application/json",
|
|
36
|
+
};
|
|
37
|
+
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/recommendations";
|
|
38
|
+
let body;
|
|
39
|
+
body = JSON.stringify({
|
|
40
|
+
...(input.campaignArn != null && { campaignArn: input.campaignArn }),
|
|
41
|
+
...(input.context != null && { context: serializeAws_restJson1Context(input.context, context) }),
|
|
42
|
+
...(input.filterArn != null && { filterArn: input.filterArn }),
|
|
43
|
+
...(input.filterValues != null && {
|
|
44
|
+
filterValues: serializeAws_restJson1FilterValues(input.filterValues, context),
|
|
45
|
+
}),
|
|
46
|
+
...(input.itemId != null && { itemId: input.itemId }),
|
|
47
|
+
...(input.numResults != null && { numResults: input.numResults }),
|
|
48
|
+
...(input.promotions != null && { promotions: serializeAws_restJson1PromotionList(input.promotions, context) }),
|
|
49
|
+
...(input.recommenderArn != null && { recommenderArn: input.recommenderArn }),
|
|
50
|
+
...(input.userId != null && { userId: input.userId }),
|
|
82
51
|
});
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
_c = {};
|
|
92
|
-
return [4, parseErrorBody(output.body, context)];
|
|
93
|
-
case 1:
|
|
94
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
|
|
95
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
96
|
-
_b = errorCode;
|
|
97
|
-
switch (_b) {
|
|
98
|
-
case "InvalidInputException": return [3, 2];
|
|
99
|
-
case "com.amazonaws.personalizeruntime#InvalidInputException": return [3, 2];
|
|
100
|
-
case "ResourceNotFoundException": return [3, 4];
|
|
101
|
-
case "com.amazonaws.personalizeruntime#ResourceNotFoundException": return [3, 4];
|
|
102
|
-
}
|
|
103
|
-
return [3, 6];
|
|
104
|
-
case 2: return [4, deserializeAws_restJson1InvalidInputExceptionResponse(parsedOutput, context)];
|
|
105
|
-
case 3: throw _d.sent();
|
|
106
|
-
case 4: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
|
|
107
|
-
case 5: throw _d.sent();
|
|
108
|
-
case 6:
|
|
109
|
-
parsedBody = parsedOutput.body;
|
|
110
|
-
throwDefaultError({
|
|
111
|
-
output: output,
|
|
112
|
-
parsedBody: parsedBody,
|
|
113
|
-
exceptionCtor: __BaseException,
|
|
114
|
-
errorCode: errorCode,
|
|
115
|
-
});
|
|
116
|
-
_d.label = 7;
|
|
117
|
-
case 7: return [2];
|
|
118
|
-
}
|
|
52
|
+
return new __HttpRequest({
|
|
53
|
+
protocol,
|
|
54
|
+
hostname,
|
|
55
|
+
port,
|
|
56
|
+
method: "POST",
|
|
57
|
+
headers,
|
|
58
|
+
path: resolvedPath,
|
|
59
|
+
body,
|
|
119
60
|
});
|
|
120
|
-
}
|
|
121
|
-
export
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return [2, deserializeAws_restJson1GetRecommendationsCommandError(output, context)];
|
|
128
|
-
}
|
|
129
|
-
contents = map({
|
|
130
|
-
$metadata: deserializeMetadata(output),
|
|
131
|
-
});
|
|
132
|
-
_a = __expectNonNull;
|
|
133
|
-
_b = __expectObject;
|
|
134
|
-
return [4, parseBody(output.body, context)];
|
|
135
|
-
case 1:
|
|
136
|
-
data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
|
|
137
|
-
if (data.itemList != null) {
|
|
138
|
-
contents.itemList = deserializeAws_restJson1ItemList(data.itemList, context);
|
|
139
|
-
}
|
|
140
|
-
if (data.recommendationId != null) {
|
|
141
|
-
contents.recommendationId = __expectString(data.recommendationId);
|
|
142
|
-
}
|
|
143
|
-
return [2, contents];
|
|
144
|
-
}
|
|
61
|
+
};
|
|
62
|
+
export const deserializeAws_restJson1GetPersonalizedRankingCommand = async (output, context) => {
|
|
63
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
64
|
+
return deserializeAws_restJson1GetPersonalizedRankingCommandError(output, context);
|
|
65
|
+
}
|
|
66
|
+
const contents = map({
|
|
67
|
+
$metadata: deserializeMetadata(output),
|
|
145
68
|
});
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
parsedBody
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
69
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
70
|
+
if (data.personalizedRanking != null) {
|
|
71
|
+
contents.personalizedRanking = deserializeAws_restJson1ItemList(data.personalizedRanking, context);
|
|
72
|
+
}
|
|
73
|
+
if (data.recommendationId != null) {
|
|
74
|
+
contents.recommendationId = __expectString(data.recommendationId);
|
|
75
|
+
}
|
|
76
|
+
return contents;
|
|
77
|
+
};
|
|
78
|
+
const deserializeAws_restJson1GetPersonalizedRankingCommandError = async (output, context) => {
|
|
79
|
+
const parsedOutput = {
|
|
80
|
+
...output,
|
|
81
|
+
body: await parseErrorBody(output.body, context),
|
|
82
|
+
};
|
|
83
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
84
|
+
switch (errorCode) {
|
|
85
|
+
case "InvalidInputException":
|
|
86
|
+
case "com.amazonaws.personalizeruntime#InvalidInputException":
|
|
87
|
+
throw await deserializeAws_restJson1InvalidInputExceptionResponse(parsedOutput, context);
|
|
88
|
+
case "ResourceNotFoundException":
|
|
89
|
+
case "com.amazonaws.personalizeruntime#ResourceNotFoundException":
|
|
90
|
+
throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
|
|
91
|
+
default:
|
|
92
|
+
const parsedBody = parsedOutput.body;
|
|
93
|
+
throwDefaultError({
|
|
94
|
+
output,
|
|
95
|
+
parsedBody,
|
|
96
|
+
exceptionCtor: __BaseException,
|
|
97
|
+
errorCode,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
export const deserializeAws_restJson1GetRecommendationsCommand = async (output, context) => {
|
|
102
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
103
|
+
return deserializeAws_restJson1GetRecommendationsCommandError(output, context);
|
|
104
|
+
}
|
|
105
|
+
const contents = map({
|
|
106
|
+
$metadata: deserializeMetadata(output),
|
|
182
107
|
});
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
contents =
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
108
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
109
|
+
if (data.itemList != null) {
|
|
110
|
+
contents.itemList = deserializeAws_restJson1ItemList(data.itemList, context);
|
|
111
|
+
}
|
|
112
|
+
if (data.recommendationId != null) {
|
|
113
|
+
contents.recommendationId = __expectString(data.recommendationId);
|
|
114
|
+
}
|
|
115
|
+
return contents;
|
|
116
|
+
};
|
|
117
|
+
const deserializeAws_restJson1GetRecommendationsCommandError = async (output, context) => {
|
|
118
|
+
const parsedOutput = {
|
|
119
|
+
...output,
|
|
120
|
+
body: await parseErrorBody(output.body, context),
|
|
121
|
+
};
|
|
122
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
123
|
+
switch (errorCode) {
|
|
124
|
+
case "InvalidInputException":
|
|
125
|
+
case "com.amazonaws.personalizeruntime#InvalidInputException":
|
|
126
|
+
throw await deserializeAws_restJson1InvalidInputExceptionResponse(parsedOutput, context);
|
|
127
|
+
case "ResourceNotFoundException":
|
|
128
|
+
case "com.amazonaws.personalizeruntime#ResourceNotFoundException":
|
|
129
|
+
throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
|
|
130
|
+
default:
|
|
131
|
+
const parsedBody = parsedOutput.body;
|
|
132
|
+
throwDefaultError({
|
|
133
|
+
output,
|
|
134
|
+
parsedBody,
|
|
135
|
+
exceptionCtor: __BaseException,
|
|
136
|
+
errorCode,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
const map = __map;
|
|
141
|
+
const deserializeAws_restJson1InvalidInputExceptionResponse = async (parsedOutput, context) => {
|
|
142
|
+
const contents = map({});
|
|
143
|
+
const data = parsedOutput.body;
|
|
144
|
+
if (data.message != null) {
|
|
145
|
+
contents.message = __expectString(data.message);
|
|
146
|
+
}
|
|
147
|
+
const exception = new InvalidInputException({
|
|
148
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
149
|
+
...contents,
|
|
195
150
|
});
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
151
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
152
|
+
};
|
|
153
|
+
const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
|
|
154
|
+
const contents = map({});
|
|
155
|
+
const data = parsedOutput.body;
|
|
156
|
+
if (data.message != null) {
|
|
157
|
+
contents.message = __expectString(data.message);
|
|
158
|
+
}
|
|
159
|
+
const exception = new ResourceNotFoundException({
|
|
160
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
161
|
+
...contents,
|
|
207
162
|
});
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
163
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
164
|
+
};
|
|
165
|
+
const serializeAws_restJson1Context = (input, context) => {
|
|
166
|
+
return Object.entries(input).reduce((acc, [key, value]) => {
|
|
213
167
|
if (value === null) {
|
|
214
168
|
return acc;
|
|
215
169
|
}
|
|
216
|
-
return
|
|
170
|
+
return {
|
|
171
|
+
...acc,
|
|
172
|
+
[key]: value,
|
|
173
|
+
};
|
|
217
174
|
}, {});
|
|
218
175
|
};
|
|
219
|
-
|
|
220
|
-
return Object.entries(input).reduce(
|
|
221
|
-
var _b;
|
|
222
|
-
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
176
|
+
const serializeAws_restJson1FilterValues = (input, context) => {
|
|
177
|
+
return Object.entries(input).reduce((acc, [key, value]) => {
|
|
223
178
|
if (value === null) {
|
|
224
179
|
return acc;
|
|
225
180
|
}
|
|
226
|
-
return
|
|
181
|
+
return {
|
|
182
|
+
...acc,
|
|
183
|
+
[key]: value,
|
|
184
|
+
};
|
|
227
185
|
}, {});
|
|
228
186
|
};
|
|
229
|
-
|
|
187
|
+
const serializeAws_restJson1InputList = (input, context) => {
|
|
230
188
|
return input
|
|
231
|
-
.filter(
|
|
232
|
-
.map(
|
|
189
|
+
.filter((e) => e != null)
|
|
190
|
+
.map((entry) => {
|
|
233
191
|
return entry;
|
|
234
192
|
});
|
|
235
193
|
};
|
|
236
|
-
|
|
237
|
-
return
|
|
238
|
-
|
|
239
|
-
|
|
194
|
+
const serializeAws_restJson1Promotion = (input, context) => {
|
|
195
|
+
return {
|
|
196
|
+
...(input.filterArn != null && { filterArn: input.filterArn }),
|
|
197
|
+
...(input.filterValues != null && {
|
|
198
|
+
filterValues: serializeAws_restJson1FilterValues(input.filterValues, context),
|
|
199
|
+
}),
|
|
200
|
+
...(input.name != null && { name: input.name }),
|
|
201
|
+
...(input.percentPromotedItems != null && { percentPromotedItems: input.percentPromotedItems }),
|
|
202
|
+
};
|
|
240
203
|
};
|
|
241
|
-
|
|
204
|
+
const serializeAws_restJson1PromotionList = (input, context) => {
|
|
242
205
|
return input
|
|
243
|
-
.filter(
|
|
244
|
-
.map(
|
|
206
|
+
.filter((e) => e != null)
|
|
207
|
+
.map((entry) => {
|
|
245
208
|
return serializeAws_restJson1Promotion(entry, context);
|
|
246
209
|
});
|
|
247
210
|
};
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
.filter(
|
|
251
|
-
.map(
|
|
211
|
+
const deserializeAws_restJson1ItemList = (output, context) => {
|
|
212
|
+
const retVal = (output || [])
|
|
213
|
+
.filter((e) => e != null)
|
|
214
|
+
.map((entry) => {
|
|
252
215
|
if (entry === null) {
|
|
253
216
|
return null;
|
|
254
217
|
}
|
|
@@ -256,64 +219,46 @@ var deserializeAws_restJson1ItemList = function (output, context) {
|
|
|
256
219
|
});
|
|
257
220
|
return retVal;
|
|
258
221
|
};
|
|
259
|
-
|
|
222
|
+
const deserializeAws_restJson1PredictedItem = (output, context) => {
|
|
260
223
|
return {
|
|
261
224
|
itemId: __expectString(output.itemId),
|
|
262
225
|
promotionName: __expectString(output.promotionName),
|
|
263
226
|
score: __limitedParseDouble(output.score),
|
|
264
227
|
};
|
|
265
228
|
};
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
});
|
|
274
|
-
};
|
|
275
|
-
var collectBody = function (streamBody, context) {
|
|
276
|
-
if (streamBody === void 0) { streamBody = new Uint8Array(); }
|
|
229
|
+
const deserializeMetadata = (output) => ({
|
|
230
|
+
httpStatusCode: output.statusCode,
|
|
231
|
+
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
|
232
|
+
extendedRequestId: output.headers["x-amz-id-2"],
|
|
233
|
+
cfId: output.headers["x-amz-cf-id"],
|
|
234
|
+
});
|
|
235
|
+
const collectBody = (streamBody = new Uint8Array(), context) => {
|
|
277
236
|
if (streamBody instanceof Uint8Array) {
|
|
278
237
|
return Promise.resolve(streamBody);
|
|
279
238
|
}
|
|
280
239
|
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
|
281
240
|
};
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
});
|
|
241
|
+
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
242
|
+
const isSerializableHeaderValue = (value) => value !== undefined &&
|
|
243
|
+
value !== null &&
|
|
244
|
+
value !== "" &&
|
|
245
|
+
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
|
|
246
|
+
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
247
|
+
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
248
|
+
if (encoded.length) {
|
|
249
|
+
return JSON.parse(encoded);
|
|
250
|
+
}
|
|
251
|
+
return {};
|
|
252
|
+
});
|
|
253
|
+
const parseErrorBody = async (errorBody, context) => {
|
|
254
|
+
const value = await parseBody(errorBody, context);
|
|
255
|
+
value.message = value.message ?? value.Message;
|
|
256
|
+
return value;
|
|
299
257
|
};
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
switch (_b.label) {
|
|
305
|
-
case 0: return [4, parseBody(errorBody, context)];
|
|
306
|
-
case 1:
|
|
307
|
-
value = _b.sent();
|
|
308
|
-
value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
|
|
309
|
-
return [2, value];
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
}); };
|
|
313
|
-
var loadRestJsonErrorCode = function (output, data) {
|
|
314
|
-
var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
|
|
315
|
-
var sanitizeErrorCode = function (rawValue) {
|
|
316
|
-
var cleanValue = rawValue;
|
|
258
|
+
const loadRestJsonErrorCode = (output, data) => {
|
|
259
|
+
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
260
|
+
const sanitizeErrorCode = (rawValue) => {
|
|
261
|
+
let cleanValue = rawValue;
|
|
317
262
|
if (typeof cleanValue === "number") {
|
|
318
263
|
cleanValue = cleanValue.toString();
|
|
319
264
|
}
|
|
@@ -328,7 +273,7 @@ var loadRestJsonErrorCode = function (output, data) {
|
|
|
328
273
|
}
|
|
329
274
|
return cleanValue;
|
|
330
275
|
};
|
|
331
|
-
|
|
276
|
+
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
332
277
|
if (headerKey !== undefined) {
|
|
333
278
|
return sanitizeErrorCode(output.headers[headerKey]);
|
|
334
279
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
1
|
import packageInfo from "../package.json";
|
|
3
2
|
import { Sha256 } from "@aws-crypto/sha256-browser";
|
|
4
3
|
import { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT } from "@aws-sdk/config-resolver";
|
|
@@ -12,15 +11,30 @@ import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser";
|
|
|
12
11
|
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
|
13
12
|
import { loadConfigsForDefaultMode } from "@aws-sdk/smithy-client";
|
|
14
13
|
import { resolveDefaultsModeConfig } from "@aws-sdk/util-defaults-mode-browser";
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
export const getRuntimeConfig = (config) => {
|
|
15
|
+
const defaultsMode = resolveDefaultsModeConfig(config);
|
|
16
|
+
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
|
17
|
+
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
18
|
+
return {
|
|
19
|
+
...clientSharedValues,
|
|
20
|
+
...config,
|
|
21
|
+
runtime: "browser",
|
|
22
|
+
defaultsMode,
|
|
23
|
+
base64Decoder: config?.base64Decoder ?? fromBase64,
|
|
24
|
+
base64Encoder: config?.base64Encoder ?? toBase64,
|
|
25
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
26
|
+
credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
|
|
27
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
28
|
+
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
29
|
+
maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
|
|
30
|
+
region: config?.region ?? invalidProvider("Region is missing"),
|
|
31
|
+
requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
|
|
32
|
+
retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
|
|
33
|
+
sha256: config?.sha256 ?? Sha256,
|
|
34
|
+
streamCollector: config?.streamCollector ?? streamCollector,
|
|
35
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),
|
|
36
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT)),
|
|
37
|
+
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
38
|
+
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
39
|
+
};
|
|
26
40
|
};
|
package/dist-es/runtimeConfig.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
1
|
import packageInfo from "../package.json";
|
|
3
2
|
import { decorateDefaultCredentialProvider } from "@aws-sdk/client-sts";
|
|
4
3
|
import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, } from "@aws-sdk/config-resolver";
|
|
@@ -15,16 +14,35 @@ import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shar
|
|
|
15
14
|
import { loadConfigsForDefaultMode } from "@aws-sdk/smithy-client";
|
|
16
15
|
import { resolveDefaultsModeConfig } from "@aws-sdk/util-defaults-mode-node";
|
|
17
16
|
import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client";
|
|
18
|
-
export
|
|
19
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
17
|
+
export const getRuntimeConfig = (config) => {
|
|
20
18
|
emitWarningIfUnsupportedVersion(process.version);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
const defaultsMode = resolveDefaultsModeConfig(config);
|
|
20
|
+
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
|
21
|
+
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
22
|
+
return {
|
|
23
|
+
...clientSharedValues,
|
|
24
|
+
...config,
|
|
25
|
+
runtime: "node",
|
|
26
|
+
defaultsMode,
|
|
27
|
+
base64Decoder: config?.base64Decoder ?? fromBase64,
|
|
28
|
+
base64Encoder: config?.base64Encoder ?? toBase64,
|
|
29
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
30
|
+
credentialDefaultProvider: config?.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider),
|
|
31
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
32
|
+
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
33
|
+
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
|
|
34
|
+
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
|
|
35
|
+
requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
|
|
36
|
+
retryMode: config?.retryMode ??
|
|
37
|
+
loadNodeConfig({
|
|
38
|
+
...NODE_RETRY_MODE_CONFIG_OPTIONS,
|
|
39
|
+
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
|
|
40
|
+
}),
|
|
41
|
+
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
|
|
42
|
+
streamCollector: config?.streamCollector ?? streamCollector,
|
|
43
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
|
|
44
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS),
|
|
45
|
+
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
46
|
+
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
47
|
+
};
|
|
30
48
|
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import { Sha256 } from "@aws-crypto/sha256-js";
|
|
3
2
|
import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export const getRuntimeConfig = (config) => {
|
|
4
|
+
const browserDefaults = getBrowserRuntimeConfig(config);
|
|
5
|
+
return {
|
|
6
|
+
...browserDefaults,
|
|
7
|
+
...config,
|
|
8
|
+
runtime: "react-native",
|
|
9
|
+
sha256: config?.sha256 ?? Sha256,
|
|
10
|
+
};
|
|
8
11
|
};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { parseUrl } from "@aws-sdk/url-parser";
|
|
2
2
|
import { defaultRegionInfoProvider } from "./endpoints";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
urlParser: (_e = config === null || config === void 0 ? void 0 : config.urlParser) !== null && _e !== void 0 ? _e : parseUrl,
|
|
12
|
-
});
|
|
13
|
-
};
|
|
3
|
+
export const getRuntimeConfig = (config) => ({
|
|
4
|
+
apiVersion: "2018-05-22",
|
|
5
|
+
disableHostPrefix: config?.disableHostPrefix ?? false,
|
|
6
|
+
logger: config?.logger ?? {},
|
|
7
|
+
regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider,
|
|
8
|
+
serviceId: config?.serviceId ?? "Personalize Runtime",
|
|
9
|
+
urlParser: config?.urlParser ?? parseUrl,
|
|
10
|
+
});
|
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.190.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",
|
|
@@ -19,41 +19,41 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@aws-crypto/sha256-browser": "2.0.0",
|
|
21
21
|
"@aws-crypto/sha256-js": "2.0.0",
|
|
22
|
-
"@aws-sdk/client-sts": "3.
|
|
23
|
-
"@aws-sdk/config-resolver": "3.
|
|
24
|
-
"@aws-sdk/credential-provider-node": "3.
|
|
25
|
-
"@aws-sdk/fetch-http-handler": "3.
|
|
26
|
-
"@aws-sdk/hash-node": "3.
|
|
27
|
-
"@aws-sdk/invalid-dependency": "3.
|
|
28
|
-
"@aws-sdk/middleware-content-length": "3.
|
|
29
|
-
"@aws-sdk/middleware-host-header": "3.
|
|
30
|
-
"@aws-sdk/middleware-logger": "3.
|
|
31
|
-
"@aws-sdk/middleware-recursion-detection": "3.
|
|
32
|
-
"@aws-sdk/middleware-retry": "3.
|
|
33
|
-
"@aws-sdk/middleware-serde": "3.
|
|
34
|
-
"@aws-sdk/middleware-signing": "3.
|
|
35
|
-
"@aws-sdk/middleware-stack": "3.
|
|
36
|
-
"@aws-sdk/middleware-user-agent": "3.
|
|
37
|
-
"@aws-sdk/node-config-provider": "3.
|
|
38
|
-
"@aws-sdk/node-http-handler": "3.
|
|
39
|
-
"@aws-sdk/protocol-http": "3.
|
|
40
|
-
"@aws-sdk/smithy-client": "3.
|
|
41
|
-
"@aws-sdk/types": "3.
|
|
42
|
-
"@aws-sdk/url-parser": "3.
|
|
43
|
-
"@aws-sdk/util-base64-browser": "3.
|
|
44
|
-
"@aws-sdk/util-base64-node": "3.
|
|
45
|
-
"@aws-sdk/util-body-length-browser": "3.
|
|
46
|
-
"@aws-sdk/util-body-length-node": "3.
|
|
47
|
-
"@aws-sdk/util-defaults-mode-browser": "3.
|
|
48
|
-
"@aws-sdk/util-defaults-mode-node": "3.
|
|
49
|
-
"@aws-sdk/util-user-agent-browser": "3.
|
|
50
|
-
"@aws-sdk/util-user-agent-node": "3.
|
|
51
|
-
"@aws-sdk/util-utf8-browser": "3.
|
|
52
|
-
"@aws-sdk/util-utf8-node": "3.
|
|
22
|
+
"@aws-sdk/client-sts": "3.190.0",
|
|
23
|
+
"@aws-sdk/config-resolver": "3.190.0",
|
|
24
|
+
"@aws-sdk/credential-provider-node": "3.190.0",
|
|
25
|
+
"@aws-sdk/fetch-http-handler": "3.190.0",
|
|
26
|
+
"@aws-sdk/hash-node": "3.190.0",
|
|
27
|
+
"@aws-sdk/invalid-dependency": "3.190.0",
|
|
28
|
+
"@aws-sdk/middleware-content-length": "3.190.0",
|
|
29
|
+
"@aws-sdk/middleware-host-header": "3.190.0",
|
|
30
|
+
"@aws-sdk/middleware-logger": "3.190.0",
|
|
31
|
+
"@aws-sdk/middleware-recursion-detection": "3.190.0",
|
|
32
|
+
"@aws-sdk/middleware-retry": "3.190.0",
|
|
33
|
+
"@aws-sdk/middleware-serde": "3.190.0",
|
|
34
|
+
"@aws-sdk/middleware-signing": "3.190.0",
|
|
35
|
+
"@aws-sdk/middleware-stack": "3.190.0",
|
|
36
|
+
"@aws-sdk/middleware-user-agent": "3.190.0",
|
|
37
|
+
"@aws-sdk/node-config-provider": "3.190.0",
|
|
38
|
+
"@aws-sdk/node-http-handler": "3.190.0",
|
|
39
|
+
"@aws-sdk/protocol-http": "3.190.0",
|
|
40
|
+
"@aws-sdk/smithy-client": "3.190.0",
|
|
41
|
+
"@aws-sdk/types": "3.190.0",
|
|
42
|
+
"@aws-sdk/url-parser": "3.190.0",
|
|
43
|
+
"@aws-sdk/util-base64-browser": "3.188.0",
|
|
44
|
+
"@aws-sdk/util-base64-node": "3.188.0",
|
|
45
|
+
"@aws-sdk/util-body-length-browser": "3.188.0",
|
|
46
|
+
"@aws-sdk/util-body-length-node": "3.188.0",
|
|
47
|
+
"@aws-sdk/util-defaults-mode-browser": "3.190.0",
|
|
48
|
+
"@aws-sdk/util-defaults-mode-node": "3.190.0",
|
|
49
|
+
"@aws-sdk/util-user-agent-browser": "3.190.0",
|
|
50
|
+
"@aws-sdk/util-user-agent-node": "3.190.0",
|
|
51
|
+
"@aws-sdk/util-utf8-browser": "3.188.0",
|
|
52
|
+
"@aws-sdk/util-utf8-node": "3.188.0",
|
|
53
53
|
"tslib": "^2.3.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@aws-sdk/service-client-documentation-generator": "3.
|
|
56
|
+
"@aws-sdk/service-client-documentation-generator": "3.188.0",
|
|
57
57
|
"@tsconfig/recommended": "1.0.1",
|
|
58
58
|
"@types/node": "^12.7.5",
|
|
59
59
|
"concurrently": "7.0.0",
|