@aws-sdk/client-supplychain 3.525.0 → 3.529.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/dist-cjs/index.js CHANGED
@@ -191,6 +191,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
191
191
  var import_types = require("@smithy/types");
192
192
 
193
193
  // src/protocols/Aws_restJson1.ts
194
+ var import_core2 = require("@aws-sdk/core");
194
195
 
195
196
 
196
197
  var import_uuid = require("uuid");
@@ -376,7 +377,7 @@ var de_CreateBillOfMaterialsImportJobCommand = /* @__PURE__ */ __name(async (out
376
377
  const contents = (0, import_smithy_client.map)({
377
378
  $metadata: deserializeMetadata(output)
378
379
  });
379
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
380
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
380
381
  const doc = (0, import_smithy_client.take)(data, {
381
382
  jobId: import_smithy_client.expectString
382
383
  });
@@ -390,7 +391,7 @@ var de_GetBillOfMaterialsImportJobCommand = /* @__PURE__ */ __name(async (output
390
391
  const contents = (0, import_smithy_client.map)({
391
392
  $metadata: deserializeMetadata(output)
392
393
  });
393
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
394
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
394
395
  const doc = (0, import_smithy_client.take)(data, {
395
396
  job: import_smithy_client._json
396
397
  });
@@ -400,9 +401,9 @@ var de_GetBillOfMaterialsImportJobCommand = /* @__PURE__ */ __name(async (output
400
401
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
401
402
  const parsedOutput = {
402
403
  ...output,
403
- body: await parseErrorBody(output.body, context)
404
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
404
405
  };
405
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
406
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
406
407
  switch (errorCode) {
407
408
  case "AccessDeniedException":
408
409
  case "com.amazonaws.supplychain#AccessDeniedException":
@@ -532,47 +533,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
532
533
  extendedRequestId: output.headers["x-amz-id-2"],
533
534
  cfId: output.headers["x-amz-cf-id"]
534
535
  }), "deserializeMetadata");
535
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
536
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
537
- if (encoded.length) {
538
- return JSON.parse(encoded);
539
- }
540
- return {};
541
- }), "parseBody");
542
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
543
- const value = await parseBody(errorBody, context);
544
- value.message = value.message ?? value.Message;
545
- return value;
546
- }, "parseErrorBody");
547
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
548
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
549
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
550
- let cleanValue = rawValue;
551
- if (typeof cleanValue === "number") {
552
- cleanValue = cleanValue.toString();
553
- }
554
- if (cleanValue.indexOf(",") >= 0) {
555
- cleanValue = cleanValue.split(",")[0];
556
- }
557
- if (cleanValue.indexOf(":") >= 0) {
558
- cleanValue = cleanValue.split(":")[0];
559
- }
560
- if (cleanValue.indexOf("#") >= 0) {
561
- cleanValue = cleanValue.split("#")[1];
562
- }
563
- return cleanValue;
564
- }, "sanitizeErrorCode");
565
- const headerKey = findKey(output.headers, "x-amzn-errortype");
566
- if (headerKey !== void 0) {
567
- return sanitizeErrorCode(output.headers[headerKey]);
568
- }
569
- if (data.code !== void 0) {
570
- return sanitizeErrorCode(data.code);
571
- }
572
- if (data["__type"] !== void 0) {
573
- return sanitizeErrorCode(data["__type"]);
574
- }
575
- }, "loadRestJsonErrorCode");
576
536
 
577
537
  // src/commands/CreateBillOfMaterialsImportJobCommand.ts
578
538
  var _CreateBillOfMaterialsImportJobCommand = class _CreateBillOfMaterialsImportJobCommand 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, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { v4 as generateIdempotencyToken } from "uuid";
@@ -197,43 +198,3 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
197
198
  value !== "" &&
198
199
  (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
199
200
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
200
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
201
- if (encoded.length) {
202
- return JSON.parse(encoded);
203
- }
204
- return {};
205
- });
206
- const parseErrorBody = async (errorBody, context) => {
207
- const value = await parseBody(errorBody, context);
208
- value.message = value.message ?? value.Message;
209
- return value;
210
- };
211
- const loadRestJsonErrorCode = (output, data) => {
212
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
213
- const sanitizeErrorCode = (rawValue) => {
214
- let cleanValue = rawValue;
215
- if (typeof cleanValue === "number") {
216
- cleanValue = cleanValue.toString();
217
- }
218
- if (cleanValue.indexOf(",") >= 0) {
219
- cleanValue = cleanValue.split(",")[0];
220
- }
221
- if (cleanValue.indexOf(":") >= 0) {
222
- cleanValue = cleanValue.split(":")[0];
223
- }
224
- if (cleanValue.indexOf("#") >= 0) {
225
- cleanValue = cleanValue.split("#")[1];
226
- }
227
- return cleanValue;
228
- };
229
- const headerKey = findKey(output.headers, "x-amzn-errortype");
230
- if (headerKey !== undefined) {
231
- return sanitizeErrorCode(output.headers[headerKey]);
232
- }
233
- if (data.code !== undefined) {
234
- return sanitizeErrorCode(data.code);
235
- }
236
- if (data["__type"] !== undefined) {
237
- return sanitizeErrorCode(data["__type"]);
238
- }
239
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-supplychain",
3
3
  "description": "AWS SDK for JavaScript Supplychain Client for Node.js, Browser and React Native",
4
- "version": "3.525.0",
4
+ "version": "3.529.0",
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-supplychain",
@@ -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.0",
24
+ "@aws-sdk/core": "3.529.0",
25
+ "@aws-sdk/credential-provider-node": "3.529.0",
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",