@aws-sdk/client-connectparticipant 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
@@ -209,6 +209,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
209
209
  var import_types = require("@smithy/types");
210
210
 
211
211
  // src/protocols/Aws_restJson1.ts
212
+ var import_core2 = require("@aws-sdk/core");
212
213
 
213
214
 
214
215
  var import_uuid = require("uuid");
@@ -592,7 +593,7 @@ var de_CreateParticipantConnectionCommand = /* @__PURE__ */ __name(async (output
592
593
  const contents = (0, import_smithy_client.map)({
593
594
  $metadata: deserializeMetadata(output)
594
595
  });
595
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
596
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
596
597
  const doc = (0, import_smithy_client.take)(data, {
597
598
  ConnectionCredentials: import_smithy_client._json,
598
599
  Websocket: import_smithy_client._json
@@ -607,7 +608,7 @@ var de_DescribeViewCommand = /* @__PURE__ */ __name(async (output, context) => {
607
608
  const contents = (0, import_smithy_client.map)({
608
609
  $metadata: deserializeMetadata(output)
609
610
  });
610
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
611
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
611
612
  const doc = (0, import_smithy_client.take)(data, {
612
613
  View: import_smithy_client._json
613
614
  });
@@ -631,7 +632,7 @@ var de_GetAttachmentCommand = /* @__PURE__ */ __name(async (output, context) =>
631
632
  const contents = (0, import_smithy_client.map)({
632
633
  $metadata: deserializeMetadata(output)
633
634
  });
634
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
635
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
635
636
  const doc = (0, import_smithy_client.take)(data, {
636
637
  Url: import_smithy_client.expectString,
637
638
  UrlExpiry: import_smithy_client.expectString
@@ -646,7 +647,7 @@ var de_GetTranscriptCommand = /* @__PURE__ */ __name(async (output, context) =>
646
647
  const contents = (0, import_smithy_client.map)({
647
648
  $metadata: deserializeMetadata(output)
648
649
  });
649
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
650
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
650
651
  const doc = (0, import_smithy_client.take)(data, {
651
652
  InitialContactId: import_smithy_client.expectString,
652
653
  NextToken: import_smithy_client.expectString,
@@ -662,7 +663,7 @@ var de_SendEventCommand = /* @__PURE__ */ __name(async (output, context) => {
662
663
  const contents = (0, import_smithy_client.map)({
663
664
  $metadata: deserializeMetadata(output)
664
665
  });
665
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
666
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
666
667
  const doc = (0, import_smithy_client.take)(data, {
667
668
  AbsoluteTime: import_smithy_client.expectString,
668
669
  Id: import_smithy_client.expectString
@@ -677,7 +678,7 @@ var de_SendMessageCommand = /* @__PURE__ */ __name(async (output, context) => {
677
678
  const contents = (0, import_smithy_client.map)({
678
679
  $metadata: deserializeMetadata(output)
679
680
  });
680
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
681
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
681
682
  const doc = (0, import_smithy_client.take)(data, {
682
683
  AbsoluteTime: import_smithy_client.expectString,
683
684
  Id: import_smithy_client.expectString
@@ -692,7 +693,7 @@ var de_StartAttachmentUploadCommand = /* @__PURE__ */ __name(async (output, cont
692
693
  const contents = (0, import_smithy_client.map)({
693
694
  $metadata: deserializeMetadata(output)
694
695
  });
695
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
696
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
696
697
  const doc = (0, import_smithy_client.take)(data, {
697
698
  AttachmentId: import_smithy_client.expectString,
698
699
  UploadMetadata: import_smithy_client._json
@@ -703,9 +704,9 @@ var de_StartAttachmentUploadCommand = /* @__PURE__ */ __name(async (output, cont
703
704
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
704
705
  const parsedOutput = {
705
706
  ...output,
706
- body: await parseErrorBody(output.body, context)
707
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
707
708
  };
708
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
709
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
709
710
  switch (errorCode) {
710
711
  case "AccessDeniedException":
711
712
  case "com.amazonaws.connectparticipant#AccessDeniedException":
@@ -837,51 +838,10 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
837
838
  extendedRequestId: output.headers["x-amz-id-2"],
838
839
  cfId: output.headers["x-amz-cf-id"]
839
840
  }), "deserializeMetadata");
840
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
841
841
  var isSerializableHeaderValue = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "" && (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) && (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0), "isSerializableHeaderValue");
842
842
  var _CT = "ConnectionToken";
843
843
  var _PT = "ParticipantToken";
844
844
  var _xab = "x-amz-bearer";
845
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
846
- if (encoded.length) {
847
- return JSON.parse(encoded);
848
- }
849
- return {};
850
- }), "parseBody");
851
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
852
- const value = await parseBody(errorBody, context);
853
- value.message = value.message ?? value.Message;
854
- return value;
855
- }, "parseErrorBody");
856
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
857
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
858
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
859
- let cleanValue = rawValue;
860
- if (typeof cleanValue === "number") {
861
- cleanValue = cleanValue.toString();
862
- }
863
- if (cleanValue.indexOf(",") >= 0) {
864
- cleanValue = cleanValue.split(",")[0];
865
- }
866
- if (cleanValue.indexOf(":") >= 0) {
867
- cleanValue = cleanValue.split(":")[0];
868
- }
869
- if (cleanValue.indexOf("#") >= 0) {
870
- cleanValue = cleanValue.split("#")[1];
871
- }
872
- return cleanValue;
873
- }, "sanitizeErrorCode");
874
- const headerKey = findKey(output.headers, "x-amzn-errortype");
875
- if (headerKey !== void 0) {
876
- return sanitizeErrorCode(output.headers[headerKey]);
877
- }
878
- if (data.code !== void 0) {
879
- return sanitizeErrorCode(data.code);
880
- }
881
- if (data["__type"] !== void 0) {
882
- return sanitizeErrorCode(data["__type"]);
883
- }
884
- }, "loadRestJsonErrorCode");
885
845
 
886
846
  // src/commands/CompleteAttachmentUploadCommand.ts
887
847
  var _CompleteAttachmentUploadCommand = class _CompleteAttachmentUploadCommand 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";
@@ -411,43 +412,3 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
411
412
  const _CT = "ConnectionToken";
412
413
  const _PT = "ParticipantToken";
413
414
  const _xab = "x-amz-bearer";
414
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
415
- if (encoded.length) {
416
- return JSON.parse(encoded);
417
- }
418
- return {};
419
- });
420
- const parseErrorBody = async (errorBody, context) => {
421
- const value = await parseBody(errorBody, context);
422
- value.message = value.message ?? value.Message;
423
- return value;
424
- };
425
- const loadRestJsonErrorCode = (output, data) => {
426
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
427
- const sanitizeErrorCode = (rawValue) => {
428
- let cleanValue = rawValue;
429
- if (typeof cleanValue === "number") {
430
- cleanValue = cleanValue.toString();
431
- }
432
- if (cleanValue.indexOf(",") >= 0) {
433
- cleanValue = cleanValue.split(",")[0];
434
- }
435
- if (cleanValue.indexOf(":") >= 0) {
436
- cleanValue = cleanValue.split(":")[0];
437
- }
438
- if (cleanValue.indexOf("#") >= 0) {
439
- cleanValue = cleanValue.split("#")[1];
440
- }
441
- return cleanValue;
442
- };
443
- const headerKey = findKey(output.headers, "x-amzn-errortype");
444
- if (headerKey !== undefined) {
445
- return sanitizeErrorCode(output.headers[headerKey]);
446
- }
447
- if (data.code !== undefined) {
448
- return sanitizeErrorCode(data.code);
449
- }
450
- if (data["__type"] !== undefined) {
451
- return sanitizeErrorCode(data["__type"]);
452
- }
453
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-connectparticipant",
3
3
  "description": "AWS SDK for JavaScript Connectparticipant 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-connectparticipant",
@@ -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",