@aws-sdk/client-iot-jobs-data-plane 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
@@ -193,6 +193,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
193
193
  var import_types = require("@smithy/types");
194
194
 
195
195
  // src/protocols/Aws_restJson1.ts
196
+ var import_core2 = require("@aws-sdk/core");
196
197
 
197
198
 
198
199
 
@@ -413,7 +414,7 @@ var de_DescribeJobExecutionCommand = /* @__PURE__ */ __name(async (output, conte
413
414
  const contents = (0, import_smithy_client.map)({
414
415
  $metadata: deserializeMetadata(output)
415
416
  });
416
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
417
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
417
418
  const doc = (0, import_smithy_client.take)(data, {
418
419
  execution: import_smithy_client._json
419
420
  });
@@ -427,7 +428,7 @@ var de_GetPendingJobExecutionsCommand = /* @__PURE__ */ __name(async (output, co
427
428
  const contents = (0, import_smithy_client.map)({
428
429
  $metadata: deserializeMetadata(output)
429
430
  });
430
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
431
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
431
432
  const doc = (0, import_smithy_client.take)(data, {
432
433
  inProgressJobs: import_smithy_client._json,
433
434
  queuedJobs: import_smithy_client._json
@@ -442,7 +443,7 @@ var de_StartNextPendingJobExecutionCommand = /* @__PURE__ */ __name(async (outpu
442
443
  const contents = (0, import_smithy_client.map)({
443
444
  $metadata: deserializeMetadata(output)
444
445
  });
445
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
446
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
446
447
  const doc = (0, import_smithy_client.take)(data, {
447
448
  execution: import_smithy_client._json
448
449
  });
@@ -456,7 +457,7 @@ var de_UpdateJobExecutionCommand = /* @__PURE__ */ __name(async (output, context
456
457
  const contents = (0, import_smithy_client.map)({
457
458
  $metadata: deserializeMetadata(output)
458
459
  });
459
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
460
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
460
461
  const doc = (0, import_smithy_client.take)(data, {
461
462
  executionState: import_smithy_client._json,
462
463
  jobDocument: import_smithy_client.expectString
@@ -467,9 +468,9 @@ var de_UpdateJobExecutionCommand = /* @__PURE__ */ __name(async (output, context
467
468
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
468
469
  const parsedOutput = {
469
470
  ...output,
470
- body: await parseErrorBody(output.body, context)
471
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
471
472
  };
472
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
473
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
473
474
  switch (errorCode) {
474
475
  case "CertificateValidationException":
475
476
  case "com.amazonaws.iotjobsdataplane#CertificateValidationException":
@@ -600,49 +601,8 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
600
601
  extendedRequestId: output.headers["x-amz-id-2"],
601
602
  cfId: output.headers["x-amz-cf-id"]
602
603
  }), "deserializeMetadata");
603
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
604
604
  var _eN = "executionNumber";
605
605
  var _iJD = "includeJobDocument";
606
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
607
- if (encoded.length) {
608
- return JSON.parse(encoded);
609
- }
610
- return {};
611
- }), "parseBody");
612
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
613
- const value = await parseBody(errorBody, context);
614
- value.message = value.message ?? value.Message;
615
- return value;
616
- }, "parseErrorBody");
617
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
618
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
619
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
620
- let cleanValue = rawValue;
621
- if (typeof cleanValue === "number") {
622
- cleanValue = cleanValue.toString();
623
- }
624
- if (cleanValue.indexOf(",") >= 0) {
625
- cleanValue = cleanValue.split(",")[0];
626
- }
627
- if (cleanValue.indexOf(":") >= 0) {
628
- cleanValue = cleanValue.split(":")[0];
629
- }
630
- if (cleanValue.indexOf("#") >= 0) {
631
- cleanValue = cleanValue.split("#")[1];
632
- }
633
- return cleanValue;
634
- }, "sanitizeErrorCode");
635
- const headerKey = findKey(output.headers, "x-amzn-errortype");
636
- if (headerKey !== void 0) {
637
- return sanitizeErrorCode(output.headers[headerKey]);
638
- }
639
- if (data.code !== void 0) {
640
- return sanitizeErrorCode(data.code);
641
- }
642
- if (data["__type"] !== void 0) {
643
- return sanitizeErrorCode(data["__type"]);
644
- }
645
- }, "loadRestJsonErrorCode");
646
606
 
647
607
  // src/commands/DescribeJobExecutionCommand.ts
648
608
  var _DescribeJobExecutionCommand = class _DescribeJobExecutionCommand 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 { IoTJobsDataPlaneServiceException as __BaseException } from "../models/IoTJobsDataPlaneServiceException";
@@ -263,43 +264,3 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
263
264
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
264
265
  const _eN = "executionNumber";
265
266
  const _iJD = "includeJobDocument";
266
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
267
- if (encoded.length) {
268
- return JSON.parse(encoded);
269
- }
270
- return {};
271
- });
272
- const parseErrorBody = async (errorBody, context) => {
273
- const value = await parseBody(errorBody, context);
274
- value.message = value.message ?? value.Message;
275
- return value;
276
- };
277
- const loadRestJsonErrorCode = (output, data) => {
278
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
279
- const sanitizeErrorCode = (rawValue) => {
280
- let cleanValue = rawValue;
281
- if (typeof cleanValue === "number") {
282
- cleanValue = cleanValue.toString();
283
- }
284
- if (cleanValue.indexOf(",") >= 0) {
285
- cleanValue = cleanValue.split(",")[0];
286
- }
287
- if (cleanValue.indexOf(":") >= 0) {
288
- cleanValue = cleanValue.split(":")[0];
289
- }
290
- if (cleanValue.indexOf("#") >= 0) {
291
- cleanValue = cleanValue.split("#")[1];
292
- }
293
- return cleanValue;
294
- };
295
- const headerKey = findKey(output.headers, "x-amzn-errortype");
296
- if (headerKey !== undefined) {
297
- return sanitizeErrorCode(output.headers[headerKey]);
298
- }
299
- if (data.code !== undefined) {
300
- return sanitizeErrorCode(data.code);
301
- }
302
- if (data["__type"] !== undefined) {
303
- return sanitizeErrorCode(data["__type"]);
304
- }
305
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-iot-jobs-data-plane",
3
3
  "description": "AWS SDK for JavaScript Iot Jobs Data Plane 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-iot-jobs-data-plane",
@@ -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",