@instabrain-sdks/api-client 2.4.0 → 2.6.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/LICENSE.md +31 -0
- package/README.md +820 -81
- package/dist/client/instabrain-client.d.ts +170 -9
- package/dist/client/instabrain-client.js +189 -8
- package/dist/services/application.service.d.ts +29 -2
- package/dist/services/application.service.js +29 -2
- package/dist/services/finalexpense.service.d.ts +23 -5
- package/dist/services/finalexpense.service.js +23 -5
- package/dist/services/gigdb.service.d.ts +25 -3
- package/dist/services/gigdb.service.js +25 -3
- package/dist/services/payment.service.d.ts +94 -0
- package/dist/services/payment.service.js +161 -0
- package/dist/services/pivot.service.d.ts +104 -0
- package/dist/services/pivot.service.js +116 -0
- package/dist/services/pureterm.service.d.ts +96 -10
- package/dist/services/pureterm.service.js +100 -8
- package/dist/services/secure-sign.service.d.ts +19 -3
- package/dist/services/secure-sign.service.js +19 -3
- package/dist/types/enums.d.ts +112 -3
- package/dist/types/enums.js +134 -4
- package/dist/types/errors.js +31 -2
- package/dist/types/gigdb.types.d.ts +32 -0
- package/dist/types/ibterm.types.d.ts +5 -2
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/payment.types.d.ts +52 -0
- package/dist/types/payment.types.js +3 -0
- package/dist/types/pivot.types.d.ts +122 -0
- package/dist/types/pivot.types.js +2 -0
- package/dist/types/pureterm.types.d.ts +186 -31
- package/dist/utils/error-utils.d.ts +9 -1
- package/dist/utils/error-utils.js +18 -3
- package/dist/utils/http-client.js +11 -2
- package/package.json +9 -4
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.HttpClient = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
const types_1 = require("../types");
|
|
9
|
+
const error_utils_1 = require("./error-utils");
|
|
9
10
|
/**
|
|
10
11
|
* HTTP client for making requests to the InstaBrain API
|
|
11
12
|
*/
|
|
@@ -44,6 +45,7 @@ class HttpClient {
|
|
|
44
45
|
});
|
|
45
46
|
// Response interceptor for error handling
|
|
46
47
|
this.axiosInstance.interceptors.response.use((response) => response, (error) => {
|
|
48
|
+
var _a;
|
|
47
49
|
if (error.response) {
|
|
48
50
|
const { status, data } = error.response;
|
|
49
51
|
// Handle specific error status codes
|
|
@@ -52,8 +54,15 @@ class HttpClient {
|
|
|
52
54
|
// Clear invalid token
|
|
53
55
|
this.jwtToken = null;
|
|
54
56
|
throw new types_1.AuthenticationError((data === null || data === void 0 ? void 0 : data.error) || 'Authentication failed');
|
|
55
|
-
case 400:
|
|
56
|
-
|
|
57
|
+
case 400: {
|
|
58
|
+
// Mirror BaseService's flagStatus-false handling so a 400 and a
|
|
59
|
+
// 200-with-flagStatus-false produce the same error type. Callers
|
|
60
|
+
// documented to use isErrorType() / getUserFriendlyMessage() need
|
|
61
|
+
// APIValidationError, and the body carries value.fields.
|
|
62
|
+
const errorMessage = (data === null || data === void 0 ? void 0 : data.error) || (data === null || data === void 0 ? void 0 : data.errorCode) || 'Validation failed';
|
|
63
|
+
const errorCode = (_a = (0, error_utils_1.extractErrorCode)(data !== null && data !== void 0 ? data : {})) !== null && _a !== void 0 ? _a : errorMessage;
|
|
64
|
+
throw new types_1.APIValidationError(errorMessage, errorCode, data);
|
|
65
|
+
}
|
|
57
66
|
case 404:
|
|
58
67
|
throw new types_1.InstaBrainError('Resource not found', 404, data);
|
|
59
68
|
case 500:
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instabrain-sdks/api-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "Official Node.js SDK for InstaBrain APIs - Insurance quotes and application processing",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
9
9
|
"README.md",
|
|
10
|
-
"LICENSE"
|
|
10
|
+
"LICENSE.md"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "tsc",
|
|
@@ -30,9 +30,14 @@
|
|
|
30
30
|
"typescript"
|
|
31
31
|
],
|
|
32
32
|
"author": "InstaBrain",
|
|
33
|
-
"license": "
|
|
33
|
+
"license": "LicenseRef-InstaBrain-Proprietary",
|
|
34
|
+
"homepage": "https://www.instabrain.io",
|
|
35
|
+
"bugs": {
|
|
36
|
+
"email": "helpdesk@instabrain.io",
|
|
37
|
+
"url": "https://www.instabrain.io"
|
|
38
|
+
},
|
|
34
39
|
"publishConfig": {
|
|
35
|
-
"access": "
|
|
40
|
+
"access": "public"
|
|
36
41
|
},
|
|
37
42
|
"engines": {
|
|
38
43
|
"node": ">=14.0.0"
|