@aws-sdk/client-pinpoint-sms-voice 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
@@ -196,6 +196,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
196
196
  var import_types = require("@smithy/types");
197
197
 
198
198
  // src/protocols/Aws_restJson1.ts
199
+ var import_core2 = require("@aws-sdk/core");
199
200
 
200
201
 
201
202
 
@@ -488,7 +489,7 @@ var de_GetConfigurationSetEventDestinationsCommand = /* @__PURE__ */ __name(asyn
488
489
  const contents = (0, import_smithy_client.map)({
489
490
  $metadata: deserializeMetadata(output)
490
491
  });
491
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
492
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
492
493
  const doc = (0, import_smithy_client.take)(data, {
493
494
  EventDestinations: import_smithy_client._json
494
495
  });
@@ -502,7 +503,7 @@ var de_ListConfigurationSetsCommand = /* @__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
  ConfigurationSets: import_smithy_client._json,
508
509
  NextToken: import_smithy_client.expectString
@@ -517,7 +518,7 @@ var de_SendVoiceMessageCommand = /* @__PURE__ */ __name(async (output, context)
517
518
  const contents = (0, import_smithy_client.map)({
518
519
  $metadata: deserializeMetadata(output)
519
520
  });
520
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
521
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
521
522
  const doc = (0, import_smithy_client.take)(data, {
522
523
  MessageId: import_smithy_client.expectString
523
524
  });
@@ -537,9 +538,9 @@ var de_UpdateConfigurationSetEventDestinationCommand = /* @__PURE__ */ __name(as
537
538
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
538
539
  const parsedOutput = {
539
540
  ...output,
540
- body: await parseErrorBody(output.body, context)
541
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
541
542
  };
542
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
543
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
543
544
  switch (errorCode) {
544
545
  case "AlreadyExistsException":
545
546
  case "com.amazonaws.pinpointsmsvoice#AlreadyExistsException":
@@ -653,49 +654,8 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
653
654
  extendedRequestId: output.headers["x-amz-id-2"],
654
655
  cfId: output.headers["x-amz-cf-id"]
655
656
  }), "deserializeMetadata");
656
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
657
657
  var _NT = "NextToken";
658
658
  var _PS = "PageSize";
659
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
660
- if (encoded.length) {
661
- return JSON.parse(encoded);
662
- }
663
- return {};
664
- }), "parseBody");
665
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
666
- const value = await parseBody(errorBody, context);
667
- value.message = value.message ?? value.Message;
668
- return value;
669
- }, "parseErrorBody");
670
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
671
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
672
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
673
- let cleanValue = rawValue;
674
- if (typeof cleanValue === "number") {
675
- cleanValue = cleanValue.toString();
676
- }
677
- if (cleanValue.indexOf(",") >= 0) {
678
- cleanValue = cleanValue.split(",")[0];
679
- }
680
- if (cleanValue.indexOf(":") >= 0) {
681
- cleanValue = cleanValue.split(":")[0];
682
- }
683
- if (cleanValue.indexOf("#") >= 0) {
684
- cleanValue = cleanValue.split("#")[1];
685
- }
686
- return cleanValue;
687
- }, "sanitizeErrorCode");
688
- const headerKey = findKey(output.headers, "x-amzn-errortype");
689
- if (headerKey !== void 0) {
690
- return sanitizeErrorCode(output.headers[headerKey]);
691
- }
692
- if (data.code !== void 0) {
693
- return sanitizeErrorCode(data.code);
694
- }
695
- if (data["__type"] !== void 0) {
696
- return sanitizeErrorCode(data["__type"]);
697
- }
698
- }, "loadRestJsonErrorCode");
699
659
 
700
660
  // src/commands/CreateConfigurationSetCommand.ts
701
661
  var _CreateConfigurationSetCommand = class _CreateConfigurationSetCommand 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 { AlreadyExistsException, BadRequestException, InternalServiceErrorException, LimitExceededException, NotFoundException, TooManyRequestsException, } from "../models/models_0";
@@ -322,43 +323,3 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
322
323
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
323
324
  const _NT = "NextToken";
324
325
  const _PS = "PageSize";
325
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
326
- if (encoded.length) {
327
- return JSON.parse(encoded);
328
- }
329
- return {};
330
- });
331
- const parseErrorBody = async (errorBody, context) => {
332
- const value = await parseBody(errorBody, context);
333
- value.message = value.message ?? value.Message;
334
- return value;
335
- };
336
- const loadRestJsonErrorCode = (output, data) => {
337
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
338
- const sanitizeErrorCode = (rawValue) => {
339
- let cleanValue = rawValue;
340
- if (typeof cleanValue === "number") {
341
- cleanValue = cleanValue.toString();
342
- }
343
- if (cleanValue.indexOf(",") >= 0) {
344
- cleanValue = cleanValue.split(",")[0];
345
- }
346
- if (cleanValue.indexOf(":") >= 0) {
347
- cleanValue = cleanValue.split(":")[0];
348
- }
349
- if (cleanValue.indexOf("#") >= 0) {
350
- cleanValue = cleanValue.split("#")[1];
351
- }
352
- return cleanValue;
353
- };
354
- const headerKey = findKey(output.headers, "x-amzn-errortype");
355
- if (headerKey !== undefined) {
356
- return sanitizeErrorCode(output.headers[headerKey]);
357
- }
358
- if (data.code !== undefined) {
359
- return sanitizeErrorCode(data.code);
360
- }
361
- if (data["__type"] !== undefined) {
362
- return sanitizeErrorCode(data["__type"]);
363
- }
364
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-pinpoint-sms-voice",
3
3
  "description": "AWS SDK for JavaScript Pinpoint Sms Voice 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-pinpoint-sms-voice",
@@ -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",