@equos/node-sdk 0.0.8 → 0.0.9

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.
@@ -1,10 +1,40 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
5
35
  Object.defineProperty(exports, "__esModule", { value: true });
6
36
  exports.HttpUtils = void 0;
7
- const axios_1 = __importDefault(require("axios"));
37
+ const axios_1 = __importStar(require("axios"));
8
38
  class HttpUtils {
9
39
  baseUrl;
10
40
  version;
@@ -24,7 +54,13 @@ class HttpUtils {
24
54
  'x-api-key': this.apiKey,
25
55
  },
26
56
  })
27
- .then((response) => response.data);
57
+ .then((response) => response.data)
58
+ .catch((e) => {
59
+ if (e instanceof axios_1.AxiosError) {
60
+ throw new Error(e.response?.data || { message: e?.message, code: e?.code });
61
+ }
62
+ throw e;
63
+ });
28
64
  }
29
65
  async post(path, data) {
30
66
  return axios_1.default
@@ -33,7 +69,13 @@ class HttpUtils {
33
69
  'x-api-key': this.apiKey,
34
70
  },
35
71
  })
36
- .then((response) => response.data);
72
+ .then((response) => response.data)
73
+ .catch((e) => {
74
+ if (e instanceof axios_1.AxiosError) {
75
+ throw new Error(e.response?.data || { message: e?.message, code: e?.code });
76
+ }
77
+ throw e;
78
+ });
37
79
  }
38
80
  async patch(path, data) {
39
81
  return axios_1.default
@@ -42,7 +84,13 @@ class HttpUtils {
42
84
  'x-api-key': this.apiKey,
43
85
  },
44
86
  })
45
- .then((response) => response.data);
87
+ .then((response) => response.data)
88
+ .catch((e) => {
89
+ if (e instanceof axios_1.AxiosError) {
90
+ throw new Error(e.response?.data || { message: e?.message, code: e?.code });
91
+ }
92
+ throw e;
93
+ });
46
94
  }
47
95
  }
48
96
  exports.HttpUtils = HttpUtils;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equos/node-sdk",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "Equos.ai node.js official SDK.",
5
5
  "keywords": [
6
6
  "ai",