@aws-sdk/client-apigatewaymanagementapi 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
@@ -188,6 +188,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
188
188
  var import_types = require("@smithy/types");
189
189
 
190
190
  // src/protocols/Aws_restJson1.ts
191
+ var import_core2 = require("@aws-sdk/core");
191
192
 
192
193
 
193
194
 
@@ -326,7 +327,7 @@ var de_GetConnectionCommand = /* @__PURE__ */ __name(async (output, context) =>
326
327
  const contents = (0, import_smithy_client.map)({
327
328
  $metadata: deserializeMetadata(output)
328
329
  });
329
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
330
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
330
331
  const doc = (0, import_smithy_client.take)(data, {
331
332
  ConnectedAt: [, (_) => (0, import_smithy_client.expectNonNull)((0, import_smithy_client.parseRfc3339DateTimeWithOffset)(_)), `connectedAt`],
332
333
  Identity: [, (_) => de_Identity(_, context), `identity`],
@@ -348,9 +349,9 @@ var de_PostToConnectionCommand = /* @__PURE__ */ __name(async (output, context)
348
349
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
349
350
  const parsedOutput = {
350
351
  ...output,
351
- body: await parseErrorBody(output.body, context)
352
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
352
353
  };
353
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
354
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
354
355
  switch (errorCode) {
355
356
  case "ForbiddenException":
356
357
  case "com.amazonaws.apigatewaymanagementapi#ForbiddenException":
@@ -432,47 +433,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
432
433
  extendedRequestId: output.headers["x-amz-id-2"],
433
434
  cfId: output.headers["x-amz-cf-id"]
434
435
  }), "deserializeMetadata");
435
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
436
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
437
- if (encoded.length) {
438
- return JSON.parse(encoded);
439
- }
440
- return {};
441
- }), "parseBody");
442
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
443
- const value = await parseBody(errorBody, context);
444
- value.message = value.message ?? value.Message;
445
- return value;
446
- }, "parseErrorBody");
447
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
448
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
449
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
450
- let cleanValue = rawValue;
451
- if (typeof cleanValue === "number") {
452
- cleanValue = cleanValue.toString();
453
- }
454
- if (cleanValue.indexOf(",") >= 0) {
455
- cleanValue = cleanValue.split(",")[0];
456
- }
457
- if (cleanValue.indexOf(":") >= 0) {
458
- cleanValue = cleanValue.split(":")[0];
459
- }
460
- if (cleanValue.indexOf("#") >= 0) {
461
- cleanValue = cleanValue.split("#")[1];
462
- }
463
- return cleanValue;
464
- }, "sanitizeErrorCode");
465
- const headerKey = findKey(output.headers, "x-amzn-errortype");
466
- if (headerKey !== void 0) {
467
- return sanitizeErrorCode(output.headers[headerKey]);
468
- }
469
- if (data.code !== void 0) {
470
- return sanitizeErrorCode(data.code);
471
- }
472
- if (data["__type"] !== void 0) {
473
- return sanitizeErrorCode(data["__type"]);
474
- }
475
- }, "loadRestJsonErrorCode");
476
436
 
477
437
  // src/commands/DeleteConnectionCommand.ts
478
438
  var _DeleteConnectionCommand = class _DeleteConnectionCommand 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 { collectBody, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { ApiGatewayManagementApiServiceException as __BaseException } from "../models/ApiGatewayManagementApiServiceException";
@@ -163,43 +164,3 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
163
164
  value !== "" &&
164
165
  (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
165
166
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
166
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
167
- if (encoded.length) {
168
- return JSON.parse(encoded);
169
- }
170
- return {};
171
- });
172
- const parseErrorBody = async (errorBody, context) => {
173
- const value = await parseBody(errorBody, context);
174
- value.message = value.message ?? value.Message;
175
- return value;
176
- };
177
- const loadRestJsonErrorCode = (output, data) => {
178
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
179
- const sanitizeErrorCode = (rawValue) => {
180
- let cleanValue = rawValue;
181
- if (typeof cleanValue === "number") {
182
- cleanValue = cleanValue.toString();
183
- }
184
- if (cleanValue.indexOf(",") >= 0) {
185
- cleanValue = cleanValue.split(",")[0];
186
- }
187
- if (cleanValue.indexOf(":") >= 0) {
188
- cleanValue = cleanValue.split(":")[0];
189
- }
190
- if (cleanValue.indexOf("#") >= 0) {
191
- cleanValue = cleanValue.split("#")[1];
192
- }
193
- return cleanValue;
194
- };
195
- const headerKey = findKey(output.headers, "x-amzn-errortype");
196
- if (headerKey !== undefined) {
197
- return sanitizeErrorCode(output.headers[headerKey]);
198
- }
199
- if (data.code !== undefined) {
200
- return sanitizeErrorCode(data.code);
201
- }
202
- if (data["__type"] !== undefined) {
203
- return sanitizeErrorCode(data["__type"]);
204
- }
205
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-apigatewaymanagementapi",
3
3
  "description": "AWS SDK for JavaScript Apigatewaymanagementapi 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-apigatewaymanagementapi",
@@ -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",