ismx-nexo-node-app 0.3.66 → 0.3.67

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.
@@ -37,18 +37,16 @@ class RepositoryRest extends Repository_1.default {
37
37
  // Realiza la llamada a la API con las cabeceras y la URL base de la llamada.
38
38
  let call = fetch(this.baseUrl + endpoint + QueryUtils_1.default.map(request.query), Object.assign(Object.assign({}, request), { body: method === "GET" ? JSON.stringify(request.body) : undefined, headers }));
39
39
  // Añade información adicional a la respuesta y devuelve el resultado (o el error en su caso).
40
- return call.then((res) => {
40
+ return call.then((res) => __awaiter(this, void 0, void 0, function* () {
41
41
  var _a, _b;
42
42
  let headers = {};
43
43
  res.headers.forEach((value, key) => headers[key] = value);
44
44
  let response = {
45
- httpCode: res.status,
46
- content: res.json(),
47
- headers
45
+ httpCode: res.status, content: (yield res.json()), headers
48
46
  };
49
47
  (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.onResponse) === null || _b === void 0 ? void 0 : _b.call(_a, response);
50
48
  return response;
51
- }).catch((error) => {
49
+ })).catch((error) => {
52
50
  var _a, _b;
53
51
  (_b = (_a = this.options).onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);
54
52
  throw error;
@@ -4,7 +4,7 @@ export interface Wrapper<T> {
4
4
  code: string;
5
5
  description: string;
6
6
  data?: T;
7
- degug?: string;
7
+ debug?: string;
8
8
  }
9
9
  export default class ServiceRestFormal<Req = any, Res = any> extends ServiceRest<Req, Wrapper<Res>> {
10
10
  constructor(method: string, endpoint?: string);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ismx-nexo-node-app",
3
- "version": "0.3.66",
3
+ "version": "0.3.67",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "rm -rf ./dist && npx tsc",
@@ -6,7 +6,7 @@ export interface Wrapper<T> {
6
6
  code: string,
7
7
  description: string,
8
8
  data?: T
9
- degug?: string
9
+ debug?: string
10
10
  }
11
11
 
12
12
  export default class ServiceRestFormal<Req=any, Res=any> extends ServiceRest<Req, Wrapper<Res>>
@@ -49,12 +49,10 @@ export default class RepositoryRest<Body=any,Res=any> extends Repository
49
49
  });
50
50
 
51
51
  // Añade información adicional a la respuesta y devuelve el resultado (o el error en su caso).
52
- return call.then((res: Response) => {
52
+ return call.then(async (res: Response) => {
53
53
  let headers: any = {}; res.headers.forEach((value, key) => headers[key] = value);
54
54
  let response: HttpResponse<E> = {
55
- httpCode: res.status,
56
- content: res.json() as E,
57
- headers
55
+ httpCode: res.status, content: (await res.json()) as E, headers
58
56
  };
59
57
  this.options?.onResponse?.(response);
60
58
  return response;