@aws-sdk/client-sagemaker-edge 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
@@ -190,6 +190,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
190
190
  var import_types = require("@smithy/types");
191
191
 
192
192
  // src/protocols/Aws_restJson1.ts
193
+ var import_core2 = require("@aws-sdk/core");
193
194
 
194
195
 
195
196
 
@@ -305,7 +306,7 @@ var de_GetDeploymentsCommand = /* @__PURE__ */ __name(async (output, context) =>
305
306
  const contents = (0, import_smithy_client.map)({
306
307
  $metadata: deserializeMetadata(output)
307
308
  });
308
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
309
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
309
310
  const doc = (0, import_smithy_client.take)(data, {
310
311
  Deployments: import_smithy_client._json
311
312
  });
@@ -319,7 +320,7 @@ var de_GetDeviceRegistrationCommand = /* @__PURE__ */ __name(async (output, cont
319
320
  const contents = (0, import_smithy_client.map)({
320
321
  $metadata: deserializeMetadata(output)
321
322
  });
322
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
323
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
323
324
  const doc = (0, import_smithy_client.take)(data, {
324
325
  CacheTTL: import_smithy_client.expectString,
325
326
  DeviceRegistration: import_smithy_client.expectString
@@ -340,9 +341,9 @@ var de_SendHeartbeatCommand = /* @__PURE__ */ __name(async (output, context) =>
340
341
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
341
342
  const parsedOutput = {
342
343
  ...output,
343
- body: await parseErrorBody(output.body, context)
344
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
344
345
  };
345
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
346
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
346
347
  switch (errorCode) {
347
348
  case "InternalServiceException":
348
349
  case "com.amazonaws.sagemakeredge#InternalServiceException":
@@ -413,47 +414,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
413
414
  extendedRequestId: output.headers["x-amz-id-2"],
414
415
  cfId: output.headers["x-amz-cf-id"]
415
416
  }), "deserializeMetadata");
416
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
417
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
418
- if (encoded.length) {
419
- return JSON.parse(encoded);
420
- }
421
- return {};
422
- }), "parseBody");
423
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
424
- const value = await parseBody(errorBody, context);
425
- value.message = value.message ?? value.Message;
426
- return value;
427
- }, "parseErrorBody");
428
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
429
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
430
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
431
- let cleanValue = rawValue;
432
- if (typeof cleanValue === "number") {
433
- cleanValue = cleanValue.toString();
434
- }
435
- if (cleanValue.indexOf(",") >= 0) {
436
- cleanValue = cleanValue.split(",")[0];
437
- }
438
- if (cleanValue.indexOf(":") >= 0) {
439
- cleanValue = cleanValue.split(":")[0];
440
- }
441
- if (cleanValue.indexOf("#") >= 0) {
442
- cleanValue = cleanValue.split("#")[1];
443
- }
444
- return cleanValue;
445
- }, "sanitizeErrorCode");
446
- const headerKey = findKey(output.headers, "x-amzn-errortype");
447
- if (headerKey !== void 0) {
448
- return sanitizeErrorCode(output.headers[headerKey]);
449
- }
450
- if (data.code !== void 0) {
451
- return sanitizeErrorCode(data.code);
452
- }
453
- if (data["__type"] !== void 0) {
454
- return sanitizeErrorCode(data["__type"]);
455
- }
456
- }, "loadRestJsonErrorCode");
457
417
 
458
418
  // src/commands/GetDeploymentsCommand.ts
459
419
  var _GetDeploymentsCommand = class _GetDeploymentsCommand 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, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map, serializeFloat as __serializeFloat, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { InternalServiceException } from "../models/models_0";
@@ -173,43 +174,3 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
173
174
  value !== "" &&
174
175
  (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
175
176
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
176
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
177
- if (encoded.length) {
178
- return JSON.parse(encoded);
179
- }
180
- return {};
181
- });
182
- const parseErrorBody = async (errorBody, context) => {
183
- const value = await parseBody(errorBody, context);
184
- value.message = value.message ?? value.Message;
185
- return value;
186
- };
187
- const loadRestJsonErrorCode = (output, data) => {
188
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
189
- const sanitizeErrorCode = (rawValue) => {
190
- let cleanValue = rawValue;
191
- if (typeof cleanValue === "number") {
192
- cleanValue = cleanValue.toString();
193
- }
194
- if (cleanValue.indexOf(",") >= 0) {
195
- cleanValue = cleanValue.split(",")[0];
196
- }
197
- if (cleanValue.indexOf(":") >= 0) {
198
- cleanValue = cleanValue.split(":")[0];
199
- }
200
- if (cleanValue.indexOf("#") >= 0) {
201
- cleanValue = cleanValue.split("#")[1];
202
- }
203
- return cleanValue;
204
- };
205
- const headerKey = findKey(output.headers, "x-amzn-errortype");
206
- if (headerKey !== undefined) {
207
- return sanitizeErrorCode(output.headers[headerKey]);
208
- }
209
- if (data.code !== undefined) {
210
- return sanitizeErrorCode(data.code);
211
- }
212
- if (data["__type"] !== undefined) {
213
- return sanitizeErrorCode(data["__type"]);
214
- }
215
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-sagemaker-edge",
3
3
  "description": "AWS SDK for JavaScript Sagemaker Edge 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-edge",
@@ -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",