@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 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
- var PersonalizeRuntime = (function (_super) {
6
- __extends(PersonalizeRuntime, _super);
7
- function PersonalizeRuntime() {
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("Expect http options but get ".concat(typeof optionsOrCb));
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
- PersonalizeRuntime.prototype.getRecommendations = function (args, optionsOrCb, cb) {
25
- var command = new GetRecommendationsCommand(args);
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("Expect http options but get ".concat(typeof optionsOrCb));
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
- return PersonalizeRuntime;
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
- var PersonalizeRuntimeClient = (function (_super) {
13
- __extends(PersonalizeRuntimeClient, _super);
14
- function PersonalizeRuntimeClient(configuration) {
15
- var _this = this;
16
- var _config_0 = __getRuntimeConfig(configuration);
17
- var _config_1 = resolveRegionConfig(_config_0);
18
- var _config_2 = resolveEndpointsConfig(_config_1);
19
- var _config_3 = resolveRetryConfig(_config_2);
20
- var _config_4 = resolveHostHeaderConfig(_config_3);
21
- var _config_5 = resolveAwsAuthConfig(_config_4);
22
- var _config_6 = resolveUserAgentConfig(_config_5);
23
- _this = _super.call(this, _config_6) || this;
24
- _this.config = _config_6;
25
- _this.middlewareStack.use(getRetryPlugin(_this.config));
26
- _this.middlewareStack.use(getContentLengthPlugin(_this.config));
27
- _this.middlewareStack.use(getHostHeaderPlugin(_this.config));
28
- _this.middlewareStack.use(getLoggerPlugin(_this.config));
29
- _this.middlewareStack.use(getRecursionDetectionPlugin(_this.config));
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
- PersonalizeRuntimeClient.prototype.destroy = function () {
35
- _super.prototype.destroy.call(this);
36
- };
37
- return PersonalizeRuntimeClient;
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
- var GetPersonalizedRankingCommand = (function (_super) {
7
- __extends(GetPersonalizedRankingCommand, _super);
8
- function GetPersonalizedRankingCommand(input) {
9
- var _this = _super.call(this) || this;
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
- GetPersonalizedRankingCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
10
+ resolveMiddleware(clientStack, configuration, options) {
14
11
  this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
15
- var stack = clientStack.concat(this.middlewareStack);
16
- var logger = configuration.logger;
17
- var clientName = "PersonalizeRuntimeClient";
18
- var commandName = "GetPersonalizedRankingCommand";
19
- var handlerExecutionContext = {
20
- logger: logger,
21
- clientName: clientName,
22
- commandName: 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
- var requestHandler = configuration.requestHandler;
27
- return stack.resolve(function (request) {
28
- return requestHandler.handle(request.request, options || {});
29
- }, handlerExecutionContext);
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
- GetPersonalizedRankingCommand.prototype.deserialize = function (output, context) {
28
+ }
29
+ deserialize(output, context) {
35
30
  return deserializeAws_restJson1GetPersonalizedRankingCommand(output, context);
36
- };
37
- return GetPersonalizedRankingCommand;
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
- var GetRecommendationsCommand = (function (_super) {
7
- __extends(GetRecommendationsCommand, _super);
8
- function GetRecommendationsCommand(input) {
9
- var _this = _super.call(this) || this;
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
- GetRecommendationsCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
10
+ resolveMiddleware(clientStack, configuration, options) {
14
11
  this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
15
- var stack = clientStack.concat(this.middlewareStack);
16
- var logger = configuration.logger;
17
- var clientName = "PersonalizeRuntimeClient";
18
- var commandName = "GetRecommendationsCommand";
19
- var handlerExecutionContext = {
20
- logger: logger,
21
- clientName: clientName,
22
- commandName: 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
- var requestHandler = configuration.requestHandler;
27
- return stack.resolve(function (request) {
28
- return requestHandler.handle(request.request, options || {});
29
- }, handlerExecutionContext);
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
- GetRecommendationsCommand.prototype.deserialize = function (output, context) {
28
+ }
29
+ deserialize(output, context) {
35
30
  return deserializeAws_restJson1GetRecommendationsCommand(output, context);
36
- };
37
- return GetRecommendationsCommand;
38
- }($Command));
39
- export { GetRecommendationsCommand };
31
+ }
32
+ }
@@ -1,7 +1,6 @@
1
- import { __assign, __awaiter, __generator } from "tslib";
2
1
  import { getRegionInfo } from "@aws-sdk/config-resolver";
3
- var regionHash = {};
4
- var partitionHash = {
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 var defaultRegionInfoProvider = function (region, options) { return __awaiter(void 0, void 0, void 0, function () {
125
- return __generator(this, function (_a) {
126
- return [2, getRegionInfo(region, __assign(__assign({}, options), { signingService: "personalize", regionHash: regionHash, partitionHash: partitionHash }))];
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
- var PersonalizeRuntimeServiceException = (function (_super) {
4
- __extends(PersonalizeRuntimeServiceException, _super);
5
- function PersonalizeRuntimeServiceException(options) {
6
- var _this = _super.call(this, options) || this;
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
- return PersonalizeRuntimeServiceException;
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
- var InvalidInputException = (function (_super) {
5
- __extends(InvalidInputException, _super);
6
- function InvalidInputException(opts) {
7
- var _this = _super.call(this, __assign({ name: "InvalidInputException", $fault: "client" }, opts)) || this;
8
- _this.name = "InvalidInputException";
9
- _this.$fault = "client";
10
- Object.setPrototypeOf(_this, InvalidInputException.prototype);
11
- return _this;
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
- return InvalidInputException;
14
- }(__BaseException));
15
- export { InvalidInputException };
16
- var ResourceNotFoundException = (function (_super) {
17
- __extends(ResourceNotFoundException, _super);
18
- function ResourceNotFoundException(opts) {
19
- var _this = _super.call(this, __assign({ name: "ResourceNotFoundException", $fault: "client" }, opts)) || this;
20
- _this.name = "ResourceNotFoundException";
21
- _this.$fault = "client";
22
- Object.setPrototypeOf(_this, ResourceNotFoundException.prototype);
23
- return _this;
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
- return ResourceNotFoundException;
26
- }(__BaseException));
27
- export { ResourceNotFoundException };
28
- export var GetPersonalizedRankingRequestFilterSensitiveLog = function (obj) { return (__assign(__assign(__assign({}, obj), (obj.context && { context: SENSITIVE_STRING })), (obj.filterValues && { filterValues: SENSITIVE_STRING }))); };
29
- export var PredictedItemFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
30
- export var GetPersonalizedRankingResponseFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
31
- export var PromotionFilterSensitiveLog = function (obj) { return (__assign(__assign({}, obj), (obj.filterValues && { filterValues: SENSITIVE_STRING }))); };
32
- export var GetRecommendationsRequestFilterSensitiveLog = function (obj) { return (__assign(__assign(__assign(__assign({}, obj), (obj.context && { context: SENSITIVE_STRING })), (obj.filterValues && { filterValues: SENSITIVE_STRING })), (obj.promotions && { promotions: obj.promotions.map(function (item) { return PromotionFilterSensitiveLog(item); }) }))); };
33
- export var GetRecommendationsResponseFilterSensitiveLog = function (obj) { return (__assign({}, obj)); };
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 var serializeAws_restJson1GetPersonalizedRankingCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
7
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
8
- return __generator(this, function (_c) {
9
- switch (_c.label) {
10
- case 0: return [4, context.endpoint()];
11
- case 1:
12
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
13
- headers = {
14
- "content-type": "application/json",
15
- };
16
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/personalize-ranking";
17
- body = JSON.stringify(__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 && {
18
- filterValues: serializeAws_restJson1FilterValues(input.filterValues, context),
19
- })), (input.inputList != null && { inputList: serializeAws_restJson1InputList(input.inputList, context) })), (input.userId != null && { userId: input.userId })));
20
- return [2, new __HttpRequest({
21
- protocol: protocol,
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
- export var serializeAws_restJson1GetRecommendationsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
33
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
34
- return __generator(this, function (_c) {
35
- switch (_c.label) {
36
- case 0: return [4, context.endpoint()];
37
- case 1:
38
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
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 var deserializeAws_restJson1GetPersonalizedRankingCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
59
- var contents, data, _a, _b;
60
- return __generator(this, function (_c) {
61
- switch (_c.label) {
62
- case 0:
63
- if (output.statusCode !== 200 && output.statusCode >= 300) {
64
- return [2, deserializeAws_restJson1GetPersonalizedRankingCommandError(output, context)];
65
- }
66
- contents = map({
67
- $metadata: deserializeMetadata(output),
68
- });
69
- _a = __expectNonNull;
70
- _b = __expectObject;
71
- return [4, parseBody(output.body, context)];
72
- case 1:
73
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
74
- if (data.personalizedRanking != null) {
75
- contents.personalizedRanking = deserializeAws_restJson1ItemList(data.personalizedRanking, context);
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
- var deserializeAws_restJson1GetPersonalizedRankingCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
85
- var parsedOutput, _a, errorCode, _b, parsedBody;
86
- var _c;
87
- return __generator(this, function (_d) {
88
- switch (_d.label) {
89
- case 0:
90
- _a = [__assign({}, output)];
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 var deserializeAws_restJson1GetRecommendationsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
122
- var contents, data, _a, _b;
123
- return __generator(this, function (_c) {
124
- switch (_c.label) {
125
- case 0:
126
- if (output.statusCode !== 200 && output.statusCode >= 300) {
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
- var deserializeAws_restJson1GetRecommendationsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
148
- var parsedOutput, _a, errorCode, _b, parsedBody;
149
- var _c;
150
- return __generator(this, function (_d) {
151
- switch (_d.label) {
152
- case 0:
153
- _a = [__assign({}, output)];
154
- _c = {};
155
- return [4, parseErrorBody(output.body, context)];
156
- case 1:
157
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
158
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
159
- _b = errorCode;
160
- switch (_b) {
161
- case "InvalidInputException": return [3, 2];
162
- case "com.amazonaws.personalizeruntime#InvalidInputException": return [3, 2];
163
- case "ResourceNotFoundException": return [3, 4];
164
- case "com.amazonaws.personalizeruntime#ResourceNotFoundException": return [3, 4];
165
- }
166
- return [3, 6];
167
- case 2: return [4, deserializeAws_restJson1InvalidInputExceptionResponse(parsedOutput, context)];
168
- case 3: throw _d.sent();
169
- case 4: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
170
- case 5: throw _d.sent();
171
- case 6:
172
- parsedBody = parsedOutput.body;
173
- throwDefaultError({
174
- output: output,
175
- parsedBody: parsedBody,
176
- exceptionCtor: __BaseException,
177
- errorCode: errorCode,
178
- });
179
- _d.label = 7;
180
- case 7: return [2];
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
- var map = __map;
185
- var deserializeAws_restJson1InvalidInputExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
186
- var contents, data, exception;
187
- return __generator(this, function (_a) {
188
- contents = map({});
189
- data = parsedOutput.body;
190
- if (data.message != null) {
191
- contents.message = __expectString(data.message);
192
- }
193
- exception = new InvalidInputException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
194
- return [2, __decorateServiceException(exception, parsedOutput.body)];
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
- var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
198
- var contents, data, exception;
199
- return __generator(this, function (_a) {
200
- contents = map({});
201
- data = parsedOutput.body;
202
- if (data.message != null) {
203
- contents.message = __expectString(data.message);
204
- }
205
- exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
206
- return [2, __decorateServiceException(exception, parsedOutput.body)];
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
- var serializeAws_restJson1Context = function (input, context) {
210
- return Object.entries(input).reduce(function (acc, _a) {
211
- var _b;
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 __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));
170
+ return {
171
+ ...acc,
172
+ [key]: value,
173
+ };
217
174
  }, {});
218
175
  };
219
- var serializeAws_restJson1FilterValues = function (input, context) {
220
- return Object.entries(input).reduce(function (acc, _a) {
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 __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));
181
+ return {
182
+ ...acc,
183
+ [key]: value,
184
+ };
227
185
  }, {});
228
186
  };
229
- var serializeAws_restJson1InputList = function (input, context) {
187
+ const serializeAws_restJson1InputList = (input, context) => {
230
188
  return input
231
- .filter(function (e) { return e != null; })
232
- .map(function (entry) {
189
+ .filter((e) => e != null)
190
+ .map((entry) => {
233
191
  return entry;
234
192
  });
235
193
  };
236
- var serializeAws_restJson1Promotion = function (input, context) {
237
- return __assign(__assign(__assign(__assign({}, (input.filterArn != null && { filterArn: input.filterArn })), (input.filterValues != null && {
238
- filterValues: serializeAws_restJson1FilterValues(input.filterValues, context),
239
- })), (input.name != null && { name: input.name })), (input.percentPromotedItems != null && { percentPromotedItems: input.percentPromotedItems }));
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
- var serializeAws_restJson1PromotionList = function (input, context) {
204
+ const serializeAws_restJson1PromotionList = (input, context) => {
242
205
  return input
243
- .filter(function (e) { return e != null; })
244
- .map(function (entry) {
206
+ .filter((e) => e != null)
207
+ .map((entry) => {
245
208
  return serializeAws_restJson1Promotion(entry, context);
246
209
  });
247
210
  };
248
- var deserializeAws_restJson1ItemList = function (output, context) {
249
- var retVal = (output || [])
250
- .filter(function (e) { return e != null; })
251
- .map(function (entry) {
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
- var deserializeAws_restJson1PredictedItem = function (output, context) {
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
- var deserializeMetadata = function (output) {
267
- var _a, _b;
268
- return ({
269
- httpStatusCode: output.statusCode,
270
- requestId: (_b = (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"]) !== null && _b !== void 0 ? _b : output.headers["x-amz-request-id"],
271
- extendedRequestId: output.headers["x-amz-id-2"],
272
- cfId: output.headers["x-amz-cf-id"],
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
- var collectBodyString = function (streamBody, context) {
283
- return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
284
- };
285
- var isSerializableHeaderValue = function (value) {
286
- return value !== undefined &&
287
- value !== null &&
288
- value !== "" &&
289
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
290
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
291
- };
292
- var parseBody = function (streamBody, context) {
293
- return collectBodyString(streamBody, context).then(function (encoded) {
294
- if (encoded.length) {
295
- return JSON.parse(encoded);
296
- }
297
- return {};
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
- var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
301
- var value;
302
- var _a;
303
- return __generator(this, function (_b) {
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
- var headerKey = findKey(output.headers, "x-amzn-errortype");
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 var getRuntimeConfig = function (config) {
16
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
17
- var defaultsMode = resolveDefaultsModeConfig(config);
18
- var defaultConfigProvider = function () { return defaultsMode().then(loadConfigsForDefaultMode); };
19
- var clientSharedValues = getSharedRuntimeConfig(config);
20
- return __assign(__assign(__assign({}, clientSharedValues), config), { runtime: "browser", defaultsMode: defaultsMode, base64Decoder: (_a = config === null || config === void 0 ? void 0 : config.base64Decoder) !== null && _a !== void 0 ? _a : fromBase64, base64Encoder: (_b = config === null || config === void 0 ? void 0 : config.base64Encoder) !== null && _b !== void 0 ? _b : toBase64, bodyLengthChecker: (_c = config === null || config === void 0 ? void 0 : config.bodyLengthChecker) !== null && _c !== void 0 ? _c : calculateBodyLength, credentialDefaultProvider: (_d = config === null || config === void 0 ? void 0 : config.credentialDefaultProvider) !== null && _d !== void 0 ? _d : (function (_) { return function () { return Promise.reject(new Error("Credential is missing")); }; }), defaultUserAgentProvider: (_e = config === null || config === void 0 ? void 0 : config.defaultUserAgentProvider) !== null && _e !== void 0 ? _e : defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), maxAttempts: (_f = config === null || config === void 0 ? void 0 : config.maxAttempts) !== null && _f !== void 0 ? _f : DEFAULT_MAX_ATTEMPTS, region: (_g = config === null || config === void 0 ? void 0 : config.region) !== null && _g !== void 0 ? _g : invalidProvider("Region is missing"), requestHandler: (_h = config === null || config === void 0 ? void 0 : config.requestHandler) !== null && _h !== void 0 ? _h : new RequestHandler(defaultConfigProvider), retryMode: (_j = config === null || config === void 0 ? void 0 : config.retryMode) !== null && _j !== void 0 ? _j : (function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
21
- switch (_a.label) {
22
- case 0: return [4, defaultConfigProvider()];
23
- case 1: return [2, (_a.sent()).retryMode || DEFAULT_RETRY_MODE];
24
- }
25
- }); }); }), sha256: (_k = config === null || config === void 0 ? void 0 : config.sha256) !== null && _k !== void 0 ? _k : Sha256, streamCollector: (_l = config === null || config === void 0 ? void 0 : config.streamCollector) !== null && _l !== void 0 ? _l : streamCollector, useDualstackEndpoint: (_m = config === null || config === void 0 ? void 0 : config.useDualstackEndpoint) !== null && _m !== void 0 ? _m : (function () { return Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT); }), useFipsEndpoint: (_o = config === null || config === void 0 ? void 0 : config.useFipsEndpoint) !== null && _o !== void 0 ? _o : (function () { return Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT); }), utf8Decoder: (_p = config === null || config === void 0 ? void 0 : config.utf8Decoder) !== null && _p !== void 0 ? _p : fromUtf8, utf8Encoder: (_q = config === null || config === void 0 ? void 0 : config.utf8Encoder) !== null && _q !== void 0 ? _q : toUtf8 });
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
  };
@@ -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 var getRuntimeConfig = function (config) {
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
- var defaultsMode = resolveDefaultsModeConfig(config);
22
- var defaultConfigProvider = function () { return defaultsMode().then(loadConfigsForDefaultMode); };
23
- var clientSharedValues = getSharedRuntimeConfig(config);
24
- return __assign(__assign(__assign({}, clientSharedValues), config), { runtime: "node", defaultsMode: defaultsMode, base64Decoder: (_a = config === null || config === void 0 ? void 0 : config.base64Decoder) !== null && _a !== void 0 ? _a : fromBase64, base64Encoder: (_b = config === null || config === void 0 ? void 0 : config.base64Encoder) !== null && _b !== void 0 ? _b : toBase64, bodyLengthChecker: (_c = config === null || config === void 0 ? void 0 : config.bodyLengthChecker) !== null && _c !== void 0 ? _c : calculateBodyLength, credentialDefaultProvider: (_d = config === null || config === void 0 ? void 0 : config.credentialDefaultProvider) !== null && _d !== void 0 ? _d : decorateDefaultCredentialProvider(credentialDefaultProvider), defaultUserAgentProvider: (_e = config === null || config === void 0 ? void 0 : config.defaultUserAgentProvider) !== null && _e !== void 0 ? _e : defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }), maxAttempts: (_f = config === null || config === void 0 ? void 0 : config.maxAttempts) !== null && _f !== void 0 ? _f : loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), region: (_g = config === null || config === void 0 ? void 0 : config.region) !== null && _g !== void 0 ? _g : loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), requestHandler: (_h = config === null || config === void 0 ? void 0 : config.requestHandler) !== null && _h !== void 0 ? _h : new RequestHandler(defaultConfigProvider), retryMode: (_j = config === null || config === void 0 ? void 0 : config.retryMode) !== null && _j !== void 0 ? _j : loadNodeConfig(__assign(__assign({}, NODE_RETRY_MODE_CONFIG_OPTIONS), { default: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
25
- switch (_a.label) {
26
- case 0: return [4, defaultConfigProvider()];
27
- case 1: return [2, (_a.sent()).retryMode || DEFAULT_RETRY_MODE];
28
- }
29
- }); }); } })), sha256: (_k = config === null || config === void 0 ? void 0 : config.sha256) !== null && _k !== void 0 ? _k : Hash.bind(null, "sha256"), streamCollector: (_l = config === null || config === void 0 ? void 0 : config.streamCollector) !== null && _l !== void 0 ? _l : streamCollector, useDualstackEndpoint: (_m = config === null || config === void 0 ? void 0 : config.useDualstackEndpoint) !== null && _m !== void 0 ? _m : loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), useFipsEndpoint: (_o = config === null || config === void 0 ? void 0 : config.useFipsEndpoint) !== null && _o !== void 0 ? _o : loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS), utf8Decoder: (_p = config === null || config === void 0 ? void 0 : config.utf8Decoder) !== null && _p !== void 0 ? _p : fromUtf8, utf8Encoder: (_q = config === null || config === void 0 ? void 0 : config.utf8Encoder) !== null && _q !== void 0 ? _q : toUtf8 });
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 var getRuntimeConfig = function (config) {
5
- var _a;
6
- var browserDefaults = getBrowserRuntimeConfig(config);
7
- return __assign(__assign(__assign({}, browserDefaults), config), { runtime: "react-native", sha256: (_a = config === null || config === void 0 ? void 0 : config.sha256) !== null && _a !== void 0 ? _a : Sha256 });
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 var getRuntimeConfig = function (config) {
4
- var _a, _b, _c, _d, _e;
5
- return ({
6
- apiVersion: "2018-05-22",
7
- disableHostPrefix: (_a = config === null || config === void 0 ? void 0 : config.disableHostPrefix) !== null && _a !== void 0 ? _a : false,
8
- logger: (_b = config === null || config === void 0 ? void 0 : config.logger) !== null && _b !== void 0 ? _b : {},
9
- regionInfoProvider: (_c = config === null || config === void 0 ? void 0 : config.regionInfoProvider) !== null && _c !== void 0 ? _c : defaultRegionInfoProvider,
10
- serviceId: (_d = config === null || config === void 0 ? void 0 : config.serviceId) !== null && _d !== void 0 ? _d : "Personalize Runtime",
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.186.0",
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.186.0",
23
- "@aws-sdk/config-resolver": "3.186.0",
24
- "@aws-sdk/credential-provider-node": "3.186.0",
25
- "@aws-sdk/fetch-http-handler": "3.186.0",
26
- "@aws-sdk/hash-node": "3.186.0",
27
- "@aws-sdk/invalid-dependency": "3.186.0",
28
- "@aws-sdk/middleware-content-length": "3.186.0",
29
- "@aws-sdk/middleware-host-header": "3.186.0",
30
- "@aws-sdk/middleware-logger": "3.186.0",
31
- "@aws-sdk/middleware-recursion-detection": "3.186.0",
32
- "@aws-sdk/middleware-retry": "3.186.0",
33
- "@aws-sdk/middleware-serde": "3.186.0",
34
- "@aws-sdk/middleware-signing": "3.186.0",
35
- "@aws-sdk/middleware-stack": "3.186.0",
36
- "@aws-sdk/middleware-user-agent": "3.186.0",
37
- "@aws-sdk/node-config-provider": "3.186.0",
38
- "@aws-sdk/node-http-handler": "3.186.0",
39
- "@aws-sdk/protocol-http": "3.186.0",
40
- "@aws-sdk/smithy-client": "3.186.0",
41
- "@aws-sdk/types": "3.186.0",
42
- "@aws-sdk/url-parser": "3.186.0",
43
- "@aws-sdk/util-base64-browser": "3.186.0",
44
- "@aws-sdk/util-base64-node": "3.186.0",
45
- "@aws-sdk/util-body-length-browser": "3.186.0",
46
- "@aws-sdk/util-body-length-node": "3.186.0",
47
- "@aws-sdk/util-defaults-mode-browser": "3.186.0",
48
- "@aws-sdk/util-defaults-mode-node": "3.186.0",
49
- "@aws-sdk/util-user-agent-browser": "3.186.0",
50
- "@aws-sdk/util-user-agent-node": "3.186.0",
51
- "@aws-sdk/util-utf8-browser": "3.186.0",
52
- "@aws-sdk/util-utf8-node": "3.186.0",
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.186.0",
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",