@in.pulse-crm/sdk 2.8.10 → 2.9.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/.prettierrc +4 -4
- package/dist/api-client.d.ts +2 -2
- package/dist/api-client.js +2 -2
- package/dist/files.client.d.ts +2 -0
- package/dist/types/files.types.d.ts +2 -0
- package/dist/whatsapp.client.js +1 -1
- package/package.json +1 -1
- package/src/api-client.ts +25 -26
- package/src/whatsapp.client.ts +2 -2
- package/tsconfig.json +16 -16
package/.prettierrc
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"tabWidth": 4,
|
|
3
|
-
"useTabs": true
|
|
4
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"tabWidth": 4,
|
|
3
|
+
"useTabs": true
|
|
4
|
+
}
|
package/dist/api-client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AxiosInstance, AxiosError } from
|
|
2
|
-
import { ErrorResponse } from
|
|
1
|
+
import { AxiosInstance, AxiosError } from "axios";
|
|
2
|
+
import { ErrorResponse } from "./types/response.types";
|
|
3
3
|
export default class ApiClient {
|
|
4
4
|
readonly ax: AxiosInstance;
|
|
5
5
|
private baseUrl;
|
package/dist/api-client.js
CHANGED
|
@@ -13,7 +13,7 @@ class ApiClient {
|
|
|
13
13
|
baseURL: `${this.baseUrl}`,
|
|
14
14
|
timeout: 60000,
|
|
15
15
|
headers: {
|
|
16
|
-
|
|
16
|
+
"Content-Type": "application/json",
|
|
17
17
|
},
|
|
18
18
|
});
|
|
19
19
|
this.initializeResponseInterceptor();
|
|
@@ -23,7 +23,7 @@ class ApiClient {
|
|
|
23
23
|
}
|
|
24
24
|
handleError = (error) => {
|
|
25
25
|
const errorMessage = error.response?.data?.message || error.message;
|
|
26
|
-
return Promise.reject(new Error(errorMessage));
|
|
26
|
+
return Promise.reject(new Error(errorMessage, { cause: error }));
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
exports.default = ApiClient;
|
package/dist/files.client.d.ts
CHANGED
package/dist/whatsapp.client.js
CHANGED
|
@@ -129,7 +129,7 @@ class WhatsappClient extends api_client_1.default {
|
|
|
129
129
|
}
|
|
130
130
|
async markAllAsReadNotification() {
|
|
131
131
|
const url = `/api/whatsapp/notifications/mark-all-read`;
|
|
132
|
-
const { data: res } = await this.ax.
|
|
132
|
+
const { data: res } = await this.ax.patch(url);
|
|
133
133
|
return res.data;
|
|
134
134
|
}
|
|
135
135
|
;
|
package/package.json
CHANGED
package/src/api-client.ts
CHANGED
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
import axios, { AxiosInstance, AxiosError } from
|
|
2
|
-
import { ErrorResponse } from
|
|
1
|
+
import axios, { AxiosInstance, AxiosError } from "axios";
|
|
2
|
+
import { ErrorResponse } from "./types/response.types";
|
|
3
3
|
|
|
4
4
|
export default class ApiClient {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
public readonly ax: AxiosInstance;
|
|
6
|
+
private baseUrl: string;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
constructor(baseUrl: string) {
|
|
9
|
+
this.baseUrl = baseUrl;
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
this.ax = axios.create({
|
|
12
|
+
baseURL: `${this.baseUrl}`,
|
|
13
|
+
timeout: 60000,
|
|
14
|
+
headers: {
|
|
15
|
+
"Content-Type": "application/json",
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
this.initializeResponseInterceptor();
|
|
20
|
+
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.handleError
|
|
26
|
-
);
|
|
27
|
-
}
|
|
22
|
+
private initializeResponseInterceptor() {
|
|
23
|
+
this.ax.interceptors.response.use(null, this.handleError);
|
|
24
|
+
}
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
26
|
+
protected handleError = (
|
|
27
|
+
error: AxiosError<ErrorResponse>,
|
|
28
|
+
): Promise<never> => {
|
|
29
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
30
|
+
return Promise.reject(new Error(errorMessage, { cause: error }));
|
|
31
|
+
};
|
|
32
|
+
}
|
package/src/whatsapp.client.ts
CHANGED
|
@@ -223,9 +223,9 @@ export default class WhatsappClient extends ApiClient {
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
public async markAllAsReadNotification () {
|
|
226
|
-
const url = `/api/whatsapp/notifications/mark-all-read`;
|
|
226
|
+
const url = `/api/whatsapp/notifications/mark-all-read`;
|
|
227
227
|
const { data: res } =
|
|
228
|
-
await this.ax.
|
|
228
|
+
await this.ax.patch<DataResponse<any>>(url);
|
|
229
229
|
|
|
230
230
|
return res.data;
|
|
231
231
|
};
|
package/tsconfig.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
4
|
-
"module": "commonjs" /* Specify what module code is generated. */,
|
|
5
|
-
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
6
|
-
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
7
|
-
"strict": true /* Enable all strict type-checking options. */,
|
|
8
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
|
|
9
|
-
"noUnusedLocals": false,
|
|
10
|
-
"outDir": "./dist", /* Redirect output structure to the directory. */
|
|
11
|
-
"declaration": true
|
|
12
|
-
},
|
|
13
|
-
"include": [
|
|
14
|
-
"src/index.ts",
|
|
15
|
-
"src/**/*.{ts}"
|
|
16
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
4
|
+
"module": "commonjs" /* Specify what module code is generated. */,
|
|
5
|
+
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
6
|
+
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
7
|
+
"strict": true /* Enable all strict type-checking options. */,
|
|
8
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
|
|
9
|
+
"noUnusedLocals": false,
|
|
10
|
+
"outDir": "./dist", /* Redirect output structure to the directory. */
|
|
11
|
+
"declaration": true
|
|
12
|
+
},
|
|
13
|
+
"include": [
|
|
14
|
+
"src/index.ts",
|
|
15
|
+
"src/**/*.{ts}"
|
|
16
|
+
]
|
|
17
17
|
}
|