@aws-sdk/client-sagemaker-metrics 3.525.0 → 3.529.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist-cjs/index.js CHANGED
@@ -185,6 +185,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
185
185
  var import_types = require("@smithy/types");
186
186
 
187
187
  // src/protocols/Aws_restJson1.ts
188
+ var import_core2 = require("@aws-sdk/core");
188
189
 
189
190
 
190
191
 
@@ -226,7 +227,7 @@ var de_BatchPutMetricsCommand = /* @__PURE__ */ __name(async (output, context) =
226
227
  const contents = (0, import_smithy_client.map)({
227
228
  $metadata: deserializeMetadata(output)
228
229
  });
229
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
230
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
230
231
  const doc = (0, import_smithy_client.take)(data, {
231
232
  Errors: import_smithy_client._json
232
233
  });
@@ -236,9 +237,9 @@ var de_BatchPutMetricsCommand = /* @__PURE__ */ __name(async (output, context) =
236
237
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
237
238
  const parsedOutput = {
238
239
  ...output,
239
- body: await parseErrorBody(output.body, context)
240
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
240
241
  };
241
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
242
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
242
243
  const parsedBody = parsedOutput.body;
243
244
  return throwDefaultError({
244
245
  output,
@@ -266,47 +267,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
266
267
  extendedRequestId: output.headers["x-amz-id-2"],
267
268
  cfId: output.headers["x-amz-cf-id"]
268
269
  }), "deserializeMetadata");
269
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
270
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
271
- if (encoded.length) {
272
- return JSON.parse(encoded);
273
- }
274
- return {};
275
- }), "parseBody");
276
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
277
- const value = await parseBody(errorBody, context);
278
- value.message = value.message ?? value.Message;
279
- return value;
280
- }, "parseErrorBody");
281
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
282
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
283
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
284
- let cleanValue = rawValue;
285
- if (typeof cleanValue === "number") {
286
- cleanValue = cleanValue.toString();
287
- }
288
- if (cleanValue.indexOf(",") >= 0) {
289
- cleanValue = cleanValue.split(",")[0];
290
- }
291
- if (cleanValue.indexOf(":") >= 0) {
292
- cleanValue = cleanValue.split(":")[0];
293
- }
294
- if (cleanValue.indexOf("#") >= 0) {
295
- cleanValue = cleanValue.split("#")[1];
296
- }
297
- return cleanValue;
298
- }, "sanitizeErrorCode");
299
- const headerKey = findKey(output.headers, "x-amzn-errortype");
300
- if (headerKey !== void 0) {
301
- return sanitizeErrorCode(output.headers[headerKey]);
302
- }
303
- if (data.code !== void 0) {
304
- return sanitizeErrorCode(data.code);
305
- }
306
- if (data["__type"] !== void 0) {
307
- return sanitizeErrorCode(data["__type"]);
308
- }
309
- }, "loadRestJsonErrorCode");
310
270
 
311
271
  // src/commands/BatchPutMetricsCommand.ts
312
272
  var _BatchPutMetricsCommand = class _BatchPutMetricsCommand extends import_smithy_client.Command.classBuilder().ep({
@@ -1,3 +1,4 @@
1
+ import { loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody } from "@aws-sdk/core";
1
2
  import { requestBuilder as rb } from "@smithy/core";
2
3
  import { _json, collectBody, expectNonNull as __expectNonNull, expectObject as __expectObject, map, serializeFloat as __serializeFloat, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { SageMakerMetricsServiceException as __BaseException } from "../models/SageMakerMetricsServiceException";
@@ -70,43 +71,3 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
70
71
  value !== "" &&
71
72
  (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
72
73
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
73
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
74
- if (encoded.length) {
75
- return JSON.parse(encoded);
76
- }
77
- return {};
78
- });
79
- const parseErrorBody = async (errorBody, context) => {
80
- const value = await parseBody(errorBody, context);
81
- value.message = value.message ?? value.Message;
82
- return value;
83
- };
84
- const loadRestJsonErrorCode = (output, data) => {
85
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
86
- const sanitizeErrorCode = (rawValue) => {
87
- let cleanValue = rawValue;
88
- if (typeof cleanValue === "number") {
89
- cleanValue = cleanValue.toString();
90
- }
91
- if (cleanValue.indexOf(",") >= 0) {
92
- cleanValue = cleanValue.split(",")[0];
93
- }
94
- if (cleanValue.indexOf(":") >= 0) {
95
- cleanValue = cleanValue.split(":")[0];
96
- }
97
- if (cleanValue.indexOf("#") >= 0) {
98
- cleanValue = cleanValue.split("#")[1];
99
- }
100
- return cleanValue;
101
- };
102
- const headerKey = findKey(output.headers, "x-amzn-errortype");
103
- if (headerKey !== undefined) {
104
- return sanitizeErrorCode(output.headers[headerKey]);
105
- }
106
- if (data.code !== undefined) {
107
- return sanitizeErrorCode(data.code);
108
- }
109
- if (data["__type"] !== undefined) {
110
- return sanitizeErrorCode(data["__type"]);
111
- }
112
- };
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.525.0",
4
+ "version": "3.529.1",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "node ../../scripts/compilation/inline client-sagemaker-metrics",
@@ -20,9 +20,9 @@
20
20
  "dependencies": {
21
21
  "@aws-crypto/sha256-browser": "3.0.0",
22
22
  "@aws-crypto/sha256-js": "3.0.0",
23
- "@aws-sdk/client-sts": "3.525.0",
24
- "@aws-sdk/core": "3.525.0",
25
- "@aws-sdk/credential-provider-node": "3.525.0",
23
+ "@aws-sdk/client-sts": "3.529.1",
24
+ "@aws-sdk/core": "3.529.1",
25
+ "@aws-sdk/credential-provider-node": "3.529.1",
26
26
  "@aws-sdk/middleware-host-header": "3.523.0",
27
27
  "@aws-sdk/middleware-logger": "3.523.0",
28
28
  "@aws-sdk/middleware-recursion-detection": "3.523.0",