@docbrasil/api-systemmanager 1.1.86 → 1.1.88

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/api/ai/index.js CHANGED
@@ -29,9 +29,13 @@ class MyndAI {
29
29
  _returnData(retData, def = {}) {
30
30
  if (retData.status !== 200) {
31
31
  throw Boom.badRequest(_.get(retData, 'message', 'No error message reported!'))
32
- } else {
33
- return _.get(retData, 'data', def);
34
32
  }
33
+ const body = _.get(retData, 'data', def);
34
+ // Unwrap Akamai response envelope { statusCode, message, data }
35
+ if (body && typeof body === 'object' && body.statusCode !== undefined && body.data !== undefined) {
36
+ return body.data;
37
+ }
38
+ return body;
35
39
  }
36
40
 
37
41
  /**
@@ -26,9 +26,13 @@ class AISession {
26
26
  _returnData(retData, def = {}) {
27
27
  if (retData.status !== 200) {
28
28
  throw Boom.badRequest(_.get(retData, 'message', 'No error message reported!'))
29
- } else {
30
- return _.get(retData, 'data', def);
31
29
  }
30
+ const body = _.get(retData, 'data', def);
31
+ // Unwrap Akamai response envelope { statusCode, message, data }
32
+ if (body && typeof body === 'object' && body.statusCode !== undefined && body.data !== undefined) {
33
+ return body.data;
34
+ }
35
+ return body;
32
36
  }
33
37
 
34
38
  /**
package/dist/bundle.cjs CHANGED
@@ -16190,9 +16190,13 @@ class AISession {
16190
16190
  _returnData(retData, def = {}) {
16191
16191
  if (retData.status !== 200) {
16192
16192
  throw Boom__default["default"].badRequest(___default["default"].get(retData, 'message', 'No error message reported!'))
16193
- } else {
16194
- return ___default["default"].get(retData, 'data', def);
16195
16193
  }
16194
+ const body = ___default["default"].get(retData, 'data', def);
16195
+ // Unwrap Akamai response envelope { statusCode, message, data }
16196
+ if (body && typeof body === 'object' && body.statusCode !== undefined && body.data !== undefined) {
16197
+ return body.data;
16198
+ }
16199
+ return body;
16196
16200
  }
16197
16201
 
16198
16202
  /**
@@ -16433,9 +16437,13 @@ class MyndAI {
16433
16437
  _returnData(retData, def = {}) {
16434
16438
  if (retData.status !== 200) {
16435
16439
  throw Boom__default["default"].badRequest(___default["default"].get(retData, 'message', 'No error message reported!'))
16436
- } else {
16437
- return ___default["default"].get(retData, 'data', def);
16438
16440
  }
16441
+ const body = ___default["default"].get(retData, 'data', def);
16442
+ // Unwrap Akamai response envelope { statusCode, message, data }
16443
+ if (body && typeof body === 'object' && body.statusCode !== undefined && body.data !== undefined) {
16444
+ return body.data;
16445
+ }
16446
+ return body;
16439
16447
  }
16440
16448
 
16441
16449
  /**