@aws-sdk/client-kinesis-video-media 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
@@ -327,6 +327,7 @@ var GetMediaOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
327
327
  }), "GetMediaOutputFilterSensitiveLog");
328
328
 
329
329
  // src/protocols/Aws_restJson1.ts
330
+ var import_core2 = require("@aws-sdk/core");
330
331
 
331
332
 
332
333
  var se_GetMediaCommand = /* @__PURE__ */ __name(async (input, context) => {
@@ -362,9 +363,9 @@ var de_GetMediaCommand = /* @__PURE__ */ __name(async (output, context) => {
362
363
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
363
364
  const parsedOutput = {
364
365
  ...output,
365
- body: await parseErrorBody(output.body, context)
366
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
366
367
  };
367
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
368
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
368
369
  switch (errorCode) {
369
370
  case "ClientLimitExceededException":
370
371
  case "com.amazonaws.kinesisvideomedia#ClientLimitExceededException":
@@ -486,49 +487,8 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
486
487
  extendedRequestId: output.headers["x-amz-id-2"],
487
488
  cfId: output.headers["x-amz-cf-id"]
488
489
  }), "deserializeMetadata");
489
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
490
490
  var _CT = "ContentType";
491
491
  var _ct = "content-type";
492
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
493
- if (encoded.length) {
494
- return JSON.parse(encoded);
495
- }
496
- return {};
497
- }), "parseBody");
498
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
499
- const value = await parseBody(errorBody, context);
500
- value.message = value.message ?? value.Message;
501
- return value;
502
- }, "parseErrorBody");
503
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
504
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
505
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
506
- let cleanValue = rawValue;
507
- if (typeof cleanValue === "number") {
508
- cleanValue = cleanValue.toString();
509
- }
510
- if (cleanValue.indexOf(",") >= 0) {
511
- cleanValue = cleanValue.split(",")[0];
512
- }
513
- if (cleanValue.indexOf(":") >= 0) {
514
- cleanValue = cleanValue.split(":")[0];
515
- }
516
- if (cleanValue.indexOf("#") >= 0) {
517
- cleanValue = cleanValue.split("#")[1];
518
- }
519
- return cleanValue;
520
- }, "sanitizeErrorCode");
521
- const headerKey = findKey(output.headers, "x-amzn-errortype");
522
- if (headerKey !== void 0) {
523
- return sanitizeErrorCode(output.headers[headerKey]);
524
- }
525
- if (data.code !== void 0) {
526
- return sanitizeErrorCode(data.code);
527
- }
528
- if (data["__type"] !== void 0) {
529
- return sanitizeErrorCode(data["__type"]);
530
- }
531
- }, "loadRestJsonErrorCode");
532
492
 
533
493
  // src/commands/GetMediaCommand.ts
534
494
  var _GetMediaCommand = class _GetMediaCommand extends import_smithy_client.Command.classBuilder().ep({
@@ -1,3 +1,4 @@
1
+ import { loadRestJsonErrorCode, parseJsonErrorBody as parseErrorBody } from "@aws-sdk/core";
1
2
  import { requestBuilder as rb } from "@smithy/core";
2
3
  import { collectBody, decorateServiceException as __decorateServiceException, expectString as __expectString, map, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { KinesisVideoMediaServiceException as __BaseException } from "../models/KinesisVideoMediaServiceException";
@@ -165,43 +166,3 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
165
166
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
166
167
  const _CT = "ContentType";
167
168
  const _ct = "content-type";
168
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
169
- if (encoded.length) {
170
- return JSON.parse(encoded);
171
- }
172
- return {};
173
- });
174
- const parseErrorBody = async (errorBody, context) => {
175
- const value = await parseBody(errorBody, context);
176
- value.message = value.message ?? value.Message;
177
- return value;
178
- };
179
- const loadRestJsonErrorCode = (output, data) => {
180
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
181
- const sanitizeErrorCode = (rawValue) => {
182
- let cleanValue = rawValue;
183
- if (typeof cleanValue === "number") {
184
- cleanValue = cleanValue.toString();
185
- }
186
- if (cleanValue.indexOf(",") >= 0) {
187
- cleanValue = cleanValue.split(",")[0];
188
- }
189
- if (cleanValue.indexOf(":") >= 0) {
190
- cleanValue = cleanValue.split(":")[0];
191
- }
192
- if (cleanValue.indexOf("#") >= 0) {
193
- cleanValue = cleanValue.split("#")[1];
194
- }
195
- return cleanValue;
196
- };
197
- const headerKey = findKey(output.headers, "x-amzn-errortype");
198
- if (headerKey !== undefined) {
199
- return sanitizeErrorCode(output.headers[headerKey]);
200
- }
201
- if (data.code !== undefined) {
202
- return sanitizeErrorCode(data.code);
203
- }
204
- if (data["__type"] !== undefined) {
205
- return sanitizeErrorCode(data["__type"]);
206
- }
207
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-kinesis-video-media",
3
3
  "description": "AWS SDK for JavaScript Kinesis Video Media 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-kinesis-video-media",
@@ -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",