@aws-sdk/client-sagemaker-metrics 3.310.0 → 3.315.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.
@@ -11,10 +11,10 @@ const se_BatchPutMetricsCommand = async (input, context) => {
11
11
  };
12
12
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/BatchPutMetrics";
13
13
  let body;
14
- body = JSON.stringify({
15
- ...(input.MetricData != null && { MetricData: se_RawMetricDataList(input.MetricData, context) }),
16
- ...(input.TrialComponentName != null && { TrialComponentName: input.TrialComponentName }),
17
- });
14
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
15
+ MetricData: (_) => se_RawMetricDataList(_, context),
16
+ TrialComponentName: [],
17
+ }));
18
18
  return new protocol_http_1.HttpRequest({
19
19
  protocol,
20
20
  hostname,
@@ -30,13 +30,14 @@ const de_BatchPutMetricsCommand = async (output, context) => {
30
30
  if (output.statusCode !== 200 && output.statusCode >= 300) {
31
31
  return de_BatchPutMetricsCommandError(output, context);
32
32
  }
33
- const contents = map({
33
+ const contents = (0, smithy_client_1.map)({
34
34
  $metadata: deserializeMetadata(output),
35
35
  });
36
36
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
37
- if (data.Errors != null) {
38
- contents.Errors = de_BatchPutMetricsErrorList(data.Errors, context);
39
- }
37
+ const doc = (0, smithy_client_1.take)(data, {
38
+ Errors: smithy_client_1._json,
39
+ });
40
+ Object.assign(contents, doc);
40
41
  return contents;
41
42
  };
42
43
  exports.de_BatchPutMetricsCommand = de_BatchPutMetricsCommand;
@@ -47,21 +48,20 @@ const de_BatchPutMetricsCommandError = async (output, context) => {
47
48
  };
48
49
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
49
50
  const parsedBody = parsedOutput.body;
50
- (0, smithy_client_1.throwDefaultError)({
51
+ return throwDefaultError({
51
52
  output,
52
53
  parsedBody,
53
- exceptionCtor: SageMakerMetricsServiceException_1.SageMakerMetricsServiceException,
54
54
  errorCode,
55
55
  });
56
56
  };
57
- const map = smithy_client_1.map;
57
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(SageMakerMetricsServiceException_1.SageMakerMetricsServiceException);
58
58
  const se_RawMetricData = (input, context) => {
59
- return {
60
- ...(input.MetricName != null && { MetricName: input.MetricName }),
61
- ...(input.Step != null && { Step: input.Step }),
62
- ...(input.Timestamp != null && { Timestamp: Math.round(input.Timestamp.getTime() / 1000) }),
63
- ...(input.Value != null && { Value: (0, smithy_client_1.serializeFloat)(input.Value) }),
64
- };
59
+ return (0, smithy_client_1.take)(input, {
60
+ MetricName: [],
61
+ Step: [],
62
+ Timestamp: (_) => Math.round(_.getTime() / 1000),
63
+ Value: smithy_client_1.serializeFloat,
64
+ });
65
65
  };
66
66
  const se_RawMetricDataList = (input, context) => {
67
67
  return input
@@ -70,23 +70,6 @@ const se_RawMetricDataList = (input, context) => {
70
70
  return se_RawMetricData(entry, context);
71
71
  });
72
72
  };
73
- const de_BatchPutMetricsError = (output, context) => {
74
- return {
75
- Code: (0, smithy_client_1.expectString)(output.Code),
76
- MetricIndex: (0, smithy_client_1.expectInt32)(output.MetricIndex),
77
- };
78
- };
79
- const de_BatchPutMetricsErrorList = (output, context) => {
80
- const retVal = (output || [])
81
- .filter((e) => e != null)
82
- .map((entry) => {
83
- if (entry === null) {
84
- return null;
85
- }
86
- return de_BatchPutMetricsError(entry, context);
87
- });
88
- return retVal;
89
- };
90
73
  const deserializeMetadata = (output) => ({
91
74
  httpStatusCode: output.statusCode,
92
75
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -1,5 +1,5 @@
1
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
- import { expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map as __map, serializeFloat as __serializeFloat, throwDefaultError, } from "@aws-sdk/smithy-client";
2
+ import { _json, expectNonNull as __expectNonNull, expectObject as __expectObject, map, serializeFloat as __serializeFloat, take, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { SageMakerMetricsServiceException as __BaseException } from "../models/SageMakerMetricsServiceException";
4
4
  export const se_BatchPutMetricsCommand = async (input, context) => {
5
5
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -8,10 +8,10 @@ export const se_BatchPutMetricsCommand = async (input, context) => {
8
8
  };
9
9
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/BatchPutMetrics";
10
10
  let body;
11
- body = JSON.stringify({
12
- ...(input.MetricData != null && { MetricData: se_RawMetricDataList(input.MetricData, context) }),
13
- ...(input.TrialComponentName != null && { TrialComponentName: input.TrialComponentName }),
14
- });
11
+ body = JSON.stringify(take(input, {
12
+ MetricData: (_) => se_RawMetricDataList(_, context),
13
+ TrialComponentName: [],
14
+ }));
15
15
  return new __HttpRequest({
16
16
  protocol,
17
17
  hostname,
@@ -30,9 +30,10 @@ export const de_BatchPutMetricsCommand = async (output, context) => {
30
30
  $metadata: deserializeMetadata(output),
31
31
  });
32
32
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
33
- if (data.Errors != null) {
34
- contents.Errors = de_BatchPutMetricsErrorList(data.Errors, context);
35
- }
33
+ const doc = take(data, {
34
+ Errors: _json,
35
+ });
36
+ Object.assign(contents, doc);
36
37
  return contents;
37
38
  };
38
39
  const de_BatchPutMetricsCommandError = async (output, context) => {
@@ -42,21 +43,20 @@ const de_BatchPutMetricsCommandError = async (output, context) => {
42
43
  };
43
44
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
44
45
  const parsedBody = parsedOutput.body;
45
- throwDefaultError({
46
+ return throwDefaultError({
46
47
  output,
47
48
  parsedBody,
48
- exceptionCtor: __BaseException,
49
49
  errorCode,
50
50
  });
51
51
  };
52
- const map = __map;
52
+ const throwDefaultError = withBaseException(__BaseException);
53
53
  const se_RawMetricData = (input, context) => {
54
- return {
55
- ...(input.MetricName != null && { MetricName: input.MetricName }),
56
- ...(input.Step != null && { Step: input.Step }),
57
- ...(input.Timestamp != null && { Timestamp: Math.round(input.Timestamp.getTime() / 1000) }),
58
- ...(input.Value != null && { Value: __serializeFloat(input.Value) }),
59
- };
54
+ return take(input, {
55
+ MetricName: [],
56
+ Step: [],
57
+ Timestamp: (_) => Math.round(_.getTime() / 1000),
58
+ Value: __serializeFloat,
59
+ });
60
60
  };
61
61
  const se_RawMetricDataList = (input, context) => {
62
62
  return input
@@ -65,23 +65,6 @@ const se_RawMetricDataList = (input, context) => {
65
65
  return se_RawMetricData(entry, context);
66
66
  });
67
67
  };
68
- const de_BatchPutMetricsError = (output, context) => {
69
- return {
70
- Code: __expectString(output.Code),
71
- MetricIndex: __expectInt32(output.MetricIndex),
72
- };
73
- };
74
- const de_BatchPutMetricsErrorList = (output, context) => {
75
- const retVal = (output || [])
76
- .filter((e) => e != null)
77
- .map((entry) => {
78
- if (entry === null) {
79
- return null;
80
- }
81
- return de_BatchPutMetricsError(entry, context);
82
- });
83
- return retVal;
84
- };
85
68
  const deserializeMetadata = (output) => ({
86
69
  httpStatusCode: output.statusCode,
87
70
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-sagemaker-metrics",
3
3
  "description": "AWS SDK for JavaScript Sagemaker Metrics Client for Node.js, Browser and React Native",
4
- "version": "3.310.0",
4
+ "version": "3.315.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -21,9 +21,9 @@
21
21
  "dependencies": {
22
22
  "@aws-crypto/sha256-browser": "3.0.0",
23
23
  "@aws-crypto/sha256-js": "3.0.0",
24
- "@aws-sdk/client-sts": "3.310.0",
24
+ "@aws-sdk/client-sts": "3.315.0",
25
25
  "@aws-sdk/config-resolver": "3.310.0",
26
- "@aws-sdk/credential-provider-node": "3.310.0",
26
+ "@aws-sdk/credential-provider-node": "3.315.0",
27
27
  "@aws-sdk/fetch-http-handler": "3.310.0",
28
28
  "@aws-sdk/hash-node": "3.310.0",
29
29
  "@aws-sdk/invalid-dependency": "3.310.0",
@@ -40,14 +40,14 @@
40
40
  "@aws-sdk/node-config-provider": "3.310.0",
41
41
  "@aws-sdk/node-http-handler": "3.310.0",
42
42
  "@aws-sdk/protocol-http": "3.310.0",
43
- "@aws-sdk/smithy-client": "3.310.0",
43
+ "@aws-sdk/smithy-client": "3.315.0",
44
44
  "@aws-sdk/types": "3.310.0",
45
45
  "@aws-sdk/url-parser": "3.310.0",
46
46
  "@aws-sdk/util-base64": "3.310.0",
47
47
  "@aws-sdk/util-body-length-browser": "3.310.0",
48
48
  "@aws-sdk/util-body-length-node": "3.310.0",
49
- "@aws-sdk/util-defaults-mode-browser": "3.310.0",
50
- "@aws-sdk/util-defaults-mode-node": "3.310.0",
49
+ "@aws-sdk/util-defaults-mode-browser": "3.315.0",
50
+ "@aws-sdk/util-defaults-mode-node": "3.315.0",
51
51
  "@aws-sdk/util-endpoints": "3.310.0",
52
52
  "@aws-sdk/util-retry": "3.310.0",
53
53
  "@aws-sdk/util-user-agent-browser": "3.310.0",