@in.pulse-crm/sdk 1.0.0 → 1.0.1

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.
@@ -21,7 +21,7 @@ class InstanceSDK {
21
21
  }
22
22
  throw new Error(error.message);
23
23
  });
24
- return response.data.data;
24
+ return response.data.result;
25
25
  }
26
26
  }
27
27
  exports.default = InstanceSDK;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in.pulse-crm/sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "SDKs for abstraction of api consumption of in.pulse-crm application",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  import axios, { AxiosInstance } from "axios";
2
2
  import { InstanceSDKOptions } from "../types/instance.types";
3
- import { SuccessDataResponse } from "../types/response.types";
3
+ import { QueryResultResponse, SuccessDataResponse } from "../types/response.types";
4
4
 
5
5
  class InstanceSDK {
6
6
  private readonly _api: AxiosInstance;
@@ -11,7 +11,7 @@ class InstanceSDK {
11
11
 
12
12
  public async executeQuery<T>(instance: string, query: string, parameters: Array<any>) {
13
13
  const response = await this._api
14
- .post<SuccessDataResponse<T>>(`/${instance}/query`, { query, parameters })
14
+ .post<QueryResultResponse<T>>(`/${instance}/query`, { query, parameters })
15
15
  .catch((error) => {
16
16
  if (error.response?.data?.message) {
17
17
  throw new Error(error.response.data.message);
@@ -24,7 +24,7 @@ class InstanceSDK {
24
24
  throw new Error(error.message);
25
25
  });
26
26
 
27
- return response.data.data;
27
+ return response.data.result;
28
28
  }
29
29
 
30
30
  }
@@ -2,3 +2,7 @@ export interface SuccessDataResponse<T> {
2
2
  message: string;
3
3
  data: T;
4
4
  }
5
+
6
+ export type QueryResultResponse<T> = {
7
+ result: T;
8
+ }