@aws-sdk/client-marketplace-commerce-analytics 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
@@ -186,6 +186,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
186
186
  var import_types = require("@smithy/types");
187
187
 
188
188
  // src/protocols/Aws_json1_1.ts
189
+ var import_core2 = require("@aws-sdk/core");
189
190
 
190
191
 
191
192
 
@@ -270,7 +271,7 @@ var de_GenerateDataSetCommand = /* @__PURE__ */ __name(async (output, context) =
270
271
  if (output.statusCode >= 300) {
271
272
  return de_CommandError(output, context);
272
273
  }
273
- const data = await parseBody(output.body, context);
274
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
274
275
  let contents = {};
275
276
  contents = (0, import_smithy_client._json)(data);
276
277
  const response = {
@@ -283,7 +284,7 @@ var de_StartSupportDataExportCommand = /* @__PURE__ */ __name(async (output, con
283
284
  if (output.statusCode >= 300) {
284
285
  return de_CommandError(output, context);
285
286
  }
286
- const data = await parseBody(output.body, context);
287
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
287
288
  let contents = {};
288
289
  contents = (0, import_smithy_client._json)(data);
289
290
  const response = {
@@ -295,9 +296,9 @@ var de_StartSupportDataExportCommand = /* @__PURE__ */ __name(async (output, con
295
296
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
296
297
  const parsedOutput = {
297
298
  ...output,
298
- body: await parseErrorBody(output.body, context)
299
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
299
300
  };
300
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
301
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
301
302
  switch (errorCode) {
302
303
  case "MarketplaceCommerceAnalyticsException":
303
304
  case "com.amazonaws.marketplacecommerceanalytics#MarketplaceCommerceAnalyticsException":
@@ -348,7 +349,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
348
349
  extendedRequestId: output.headers["x-amz-id-2"],
349
350
  cfId: output.headers["x-amz-cf-id"]
350
351
  }), "deserializeMetadata");
351
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
352
352
  var throwDefaultError = (0, import_smithy_client.withBaseException)(MarketplaceCommerceAnalyticsServiceException);
353
353
  var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => {
354
354
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -375,46 +375,6 @@ function sharedHeaders(operation) {
375
375
  };
376
376
  }
377
377
  __name(sharedHeaders, "sharedHeaders");
378
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
379
- if (encoded.length) {
380
- return JSON.parse(encoded);
381
- }
382
- return {};
383
- }), "parseBody");
384
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
385
- const value = await parseBody(errorBody, context);
386
- value.message = value.message ?? value.Message;
387
- return value;
388
- }, "parseErrorBody");
389
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
390
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
391
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
392
- let cleanValue = rawValue;
393
- if (typeof cleanValue === "number") {
394
- cleanValue = cleanValue.toString();
395
- }
396
- if (cleanValue.indexOf(",") >= 0) {
397
- cleanValue = cleanValue.split(",")[0];
398
- }
399
- if (cleanValue.indexOf(":") >= 0) {
400
- cleanValue = cleanValue.split(":")[0];
401
- }
402
- if (cleanValue.indexOf("#") >= 0) {
403
- cleanValue = cleanValue.split("#")[1];
404
- }
405
- return cleanValue;
406
- }, "sanitizeErrorCode");
407
- const headerKey = findKey(output.headers, "x-amzn-errortype");
408
- if (headerKey !== void 0) {
409
- return sanitizeErrorCode(output.headers[headerKey]);
410
- }
411
- if (data.code !== void 0) {
412
- return sanitizeErrorCode(data.code);
413
- }
414
- if (data["__type"] !== void 0) {
415
- return sanitizeErrorCode(data["__type"]);
416
- }
417
- }, "loadRestJsonErrorCode");
418
378
 
419
379
  // src/commands/GenerateDataSetCommand.ts
420
380
  var _GenerateDataSetCommand = class _GenerateDataSetCommand 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 { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
2
3
  import { _json, collectBody, decorateServiceException as __decorateServiceException, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { MarketplaceCommerceAnalyticsServiceException as __BaseException } from "../models/MarketplaceCommerceAnalyticsServiceException";
@@ -122,43 +123,3 @@ function sharedHeaders(operation) {
122
123
  "x-amz-target": `MarketplaceCommerceAnalytics20150701.${operation}`,
123
124
  };
124
125
  }
125
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
126
- if (encoded.length) {
127
- return JSON.parse(encoded);
128
- }
129
- return {};
130
- });
131
- const parseErrorBody = async (errorBody, context) => {
132
- const value = await parseBody(errorBody, context);
133
- value.message = value.message ?? value.Message;
134
- return value;
135
- };
136
- const loadRestJsonErrorCode = (output, data) => {
137
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
138
- const sanitizeErrorCode = (rawValue) => {
139
- let cleanValue = rawValue;
140
- if (typeof cleanValue === "number") {
141
- cleanValue = cleanValue.toString();
142
- }
143
- if (cleanValue.indexOf(",") >= 0) {
144
- cleanValue = cleanValue.split(",")[0];
145
- }
146
- if (cleanValue.indexOf(":") >= 0) {
147
- cleanValue = cleanValue.split(":")[0];
148
- }
149
- if (cleanValue.indexOf("#") >= 0) {
150
- cleanValue = cleanValue.split("#")[1];
151
- }
152
- return cleanValue;
153
- };
154
- const headerKey = findKey(output.headers, "x-amzn-errortype");
155
- if (headerKey !== undefined) {
156
- return sanitizeErrorCode(output.headers[headerKey]);
157
- }
158
- if (data.code !== undefined) {
159
- return sanitizeErrorCode(data.code);
160
- }
161
- if (data["__type"] !== undefined) {
162
- return sanitizeErrorCode(data["__type"]);
163
- }
164
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-marketplace-commerce-analytics",
3
3
  "description": "AWS SDK for JavaScript Marketplace Commerce Analytics 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-marketplace-commerce-analytics",
@@ -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",