@aws-sdk/client-dlm 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
@@ -208,6 +208,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
208
208
  var import_types = require("@smithy/types");
209
209
 
210
210
  // src/protocols/Aws_restJson1.ts
211
+ var import_core2 = require("@aws-sdk/core");
211
212
 
212
213
 
213
214
 
@@ -502,7 +503,7 @@ var de_CreateLifecyclePolicyCommand = /* @__PURE__ */ __name(async (output, cont
502
503
  const contents = (0, import_smithy_client.map)({
503
504
  $metadata: deserializeMetadata(output)
504
505
  });
505
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
506
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
506
507
  const doc = (0, import_smithy_client.take)(data, {
507
508
  PolicyId: import_smithy_client.expectString
508
509
  });
@@ -526,7 +527,7 @@ var de_GetLifecyclePoliciesCommand = /* @__PURE__ */ __name(async (output, conte
526
527
  const contents = (0, import_smithy_client.map)({
527
528
  $metadata: deserializeMetadata(output)
528
529
  });
529
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
530
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
530
531
  const doc = (0, import_smithy_client.take)(data, {
531
532
  Policies: import_smithy_client._json
532
533
  });
@@ -540,7 +541,7 @@ var de_GetLifecyclePolicyCommand = /* @__PURE__ */ __name(async (output, context
540
541
  const contents = (0, import_smithy_client.map)({
541
542
  $metadata: deserializeMetadata(output)
542
543
  });
543
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
544
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
544
545
  const doc = (0, import_smithy_client.take)(data, {
545
546
  Policy: (_) => de_LifecyclePolicy(_, context)
546
547
  });
@@ -554,7 +555,7 @@ var de_ListTagsForResourceCommand = /* @__PURE__ */ __name(async (output, contex
554
555
  const contents = (0, import_smithy_client.map)({
555
556
  $metadata: deserializeMetadata(output)
556
557
  });
557
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
558
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
558
559
  const doc = (0, import_smithy_client.take)(data, {
559
560
  Tags: import_smithy_client._json
560
561
  });
@@ -594,9 +595,9 @@ var de_UpdateLifecyclePolicyCommand = /* @__PURE__ */ __name(async (output, cont
594
595
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
595
596
  const parsedOutput = {
596
597
  ...output,
597
- body: await parseErrorBody(output.body, context)
598
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
598
599
  };
599
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
600
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
600
601
  switch (errorCode) {
601
602
  case "InternalServerException":
602
603
  case "com.amazonaws.dlm#InternalServerException":
@@ -702,7 +703,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
702
703
  extendedRequestId: output.headers["x-amz-id-2"],
703
704
  cfId: output.headers["x-amz-cf-id"]
704
705
  }), "deserializeMetadata");
705
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
706
706
  var _DPT = "DefaultPolicyType";
707
707
  var _PI = "PolicyIds";
708
708
  var _RT = "ResourceTypes";
@@ -717,46 +717,6 @@ var _s = "state";
717
717
  var _tK = "tagKeys";
718
718
  var _tT = "targetTags";
719
719
  var _tTA = "tagsToAdd";
720
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
721
- if (encoded.length) {
722
- return JSON.parse(encoded);
723
- }
724
- return {};
725
- }), "parseBody");
726
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
727
- const value = await parseBody(errorBody, context);
728
- value.message = value.message ?? value.Message;
729
- return value;
730
- }, "parseErrorBody");
731
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
732
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
733
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
734
- let cleanValue = rawValue;
735
- if (typeof cleanValue === "number") {
736
- cleanValue = cleanValue.toString();
737
- }
738
- if (cleanValue.indexOf(",") >= 0) {
739
- cleanValue = cleanValue.split(",")[0];
740
- }
741
- if (cleanValue.indexOf(":") >= 0) {
742
- cleanValue = cleanValue.split(":")[0];
743
- }
744
- if (cleanValue.indexOf("#") >= 0) {
745
- cleanValue = cleanValue.split("#")[1];
746
- }
747
- return cleanValue;
748
- }, "sanitizeErrorCode");
749
- const headerKey = findKey(output.headers, "x-amzn-errortype");
750
- if (headerKey !== void 0) {
751
- return sanitizeErrorCode(output.headers[headerKey]);
752
- }
753
- if (data.code !== void 0) {
754
- return sanitizeErrorCode(data.code);
755
- }
756
- if (data["__type"] !== void 0) {
757
- return sanitizeErrorCode(data["__type"]);
758
- }
759
- }, "loadRestJsonErrorCode");
760
720
 
761
721
  // src/commands/CreateLifecyclePolicyCommand.ts
762
722
  var _CreateLifecyclePolicyCommand = class _CreateLifecyclePolicyCommand 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, expectBoolean as __expectBoolean, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { DLMServiceException as __BaseException } from "../models/DLMServiceException";
@@ -348,43 +349,3 @@ const _s = "state";
348
349
  const _tK = "tagKeys";
349
350
  const _tT = "targetTags";
350
351
  const _tTA = "tagsToAdd";
351
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
352
- if (encoded.length) {
353
- return JSON.parse(encoded);
354
- }
355
- return {};
356
- });
357
- const parseErrorBody = async (errorBody, context) => {
358
- const value = await parseBody(errorBody, context);
359
- value.message = value.message ?? value.Message;
360
- return value;
361
- };
362
- const loadRestJsonErrorCode = (output, data) => {
363
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
364
- const sanitizeErrorCode = (rawValue) => {
365
- let cleanValue = rawValue;
366
- if (typeof cleanValue === "number") {
367
- cleanValue = cleanValue.toString();
368
- }
369
- if (cleanValue.indexOf(",") >= 0) {
370
- cleanValue = cleanValue.split(",")[0];
371
- }
372
- if (cleanValue.indexOf(":") >= 0) {
373
- cleanValue = cleanValue.split(":")[0];
374
- }
375
- if (cleanValue.indexOf("#") >= 0) {
376
- cleanValue = cleanValue.split("#")[1];
377
- }
378
- return cleanValue;
379
- };
380
- const headerKey = findKey(output.headers, "x-amzn-errortype");
381
- if (headerKey !== undefined) {
382
- return sanitizeErrorCode(output.headers[headerKey]);
383
- }
384
- if (data.code !== undefined) {
385
- return sanitizeErrorCode(data.code);
386
- }
387
- if (data["__type"] !== undefined) {
388
- return sanitizeErrorCode(data["__type"]);
389
- }
390
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-dlm",
3
3
  "description": "AWS SDK for JavaScript Dlm 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-dlm",
@@ -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",