cloreai 0.1.4 → 0.1.5

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/build/WebAPI.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import axios from 'axios';
2
- import { webStatusCodes } from './constants.js';
3
2
  import { UnknownError } from './errors.js';
4
3
  import { getErrorMessage } from './getErrorMessage.js';
5
4
  export class WebAPI {
@@ -18,7 +17,8 @@ export class WebAPI {
18
17
  return request;
19
18
  });
20
19
  this.api.interceptors.response.use((response) => {
21
- if (response.data.status === webStatusCodes['NORMAL']) {
20
+ const hasError = Boolean(response.data.error);
21
+ if (!hasError) {
22
22
  return response;
23
23
  }
24
24
  const errorMessage = getErrorMessage(response.data.status, response.data.error);
@@ -1,4 +1,3 @@
1
1
  export declare const GLOBAL_RATE_LIMIT = 1000;
2
2
  export declare const CREATE_ORDER_RATE_LIMIT = 5000;
3
3
  export declare const statusCodes: Record<string, number>;
4
- export declare const webStatusCodes: Record<string, string>;
@@ -9,6 +9,3 @@ export const statusCodes = {
9
9
  EXCEEDED: 5,
10
10
  ERROR: 6,
11
11
  };
12
- export const webStatusCodes = {
13
- NORMAL: 'ok',
14
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloreai",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "CLORE.AI API client",
5
5
  "keywords": [
6
6
  "cloreai",