node-consul-service 1.0.55 → 1.0.57

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.
@@ -11,6 +11,7 @@ interface ServiceResponse<T = any> {
11
11
  data?: T;
12
12
  message?: string;
13
13
  status?: number;
14
+ code?: string;
14
15
  }
15
16
  export declare function callService(serviceName: string, options?: CallServiceOptions): Promise<ServiceResponse>;
16
17
  export {};
package/dist/index.cjs.js CHANGED
@@ -19032,7 +19032,7 @@ const {
19032
19032
  } = axios;
19033
19033
 
19034
19034
  async function callService(serviceName, options = {}) {
19035
- var _a, _b;
19035
+ var _a, _b, _c, _d;
19036
19036
  const { method = 'GET', path = '/', data, headers, params, } = options;
19037
19037
  try {
19038
19038
  const instance = await getRandomServiceInstance(serviceName);
@@ -19051,7 +19051,8 @@ async function callService(serviceName, options = {}) {
19051
19051
  success: false,
19052
19052
  message: error.message,
19053
19053
  status: (_a = error.response) === null || _a === void 0 ? void 0 : _a.status,
19054
- data: (_b = error.response) === null || _b === void 0 ? void 0 : _b.data,
19054
+ code: (_c = (_b = error.response) === null || _b === void 0 ? void 0 : _b.data.code) !== null && _c !== void 0 ? _c : "",
19055
+ data: (_d = error.response) === null || _d === void 0 ? void 0 : _d.data,
19055
19056
  };
19056
19057
  }
19057
19058
  }
package/dist/index.esm.js CHANGED
@@ -19030,7 +19030,7 @@ const {
19030
19030
  } = axios;
19031
19031
 
19032
19032
  async function callService(serviceName, options = {}) {
19033
- var _a, _b;
19033
+ var _a, _b, _c, _d;
19034
19034
  const { method = 'GET', path = '/', data, headers, params, } = options;
19035
19035
  try {
19036
19036
  const instance = await getRandomServiceInstance(serviceName);
@@ -19049,7 +19049,8 @@ async function callService(serviceName, options = {}) {
19049
19049
  success: false,
19050
19050
  message: error.message,
19051
19051
  status: (_a = error.response) === null || _a === void 0 ? void 0 : _a.status,
19052
- data: (_b = error.response) === null || _b === void 0 ? void 0 : _b.data,
19052
+ code: (_c = (_b = error.response) === null || _b === void 0 ? void 0 : _b.data.code) !== null && _c !== void 0 ? _c : "",
19053
+ data: (_d = error.response) === null || _d === void 0 ? void 0 : _d.data,
19053
19054
  };
19054
19055
  }
19055
19056
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-consul-service",
3
- "version": "1.0.55",
3
+ "version": "1.0.57",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",