@konversi/konversi-client 1.0.1 → 1.0.4

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.
Files changed (2) hide show
  1. package/index.ts +8 -11
  2. package/package.json +3 -3
package/index.ts CHANGED
@@ -1,40 +1,37 @@
1
- import axiosAPI, { setAuthToken } from "./axiosAPI";
1
+ import axiosAPI, { setAuthToken, setCompanyId } from "./axiosAPI";
2
2
 
3
- function setToken(token: string) {
4
- setAuthToken(token);
5
- }
6
-
7
- async function getAllObjects(entity, queryParams = {}) {
3
+ async function getAllObjects(entity: any, queryParams: any = {}) {
8
4
  const response = await axiosAPI.get(`${entity}`, {
9
5
  params: queryParams
10
6
  })
11
7
  return response.data;
12
8
  }
13
9
 
14
- async function getObjectById(entity, id) {
10
+ async function getObjectById(entity: any, id: string) {
15
11
  const response = await axiosAPI.get(`${entity}/${id}`)
16
12
  return response.data;
17
13
  }
18
14
 
19
- async function updateObject(entity, id, newData) {
15
+ async function updateObject(entity: any, id: string, newData: any) {
20
16
  const response = await axiosAPI.put(`${entity}/${id}`, newData)
21
17
  return response.data;
22
18
  }
23
19
 
24
- async function createObject(entity, data) {
20
+ async function createObject(entity: any, data: any) {
25
21
  const response = await axiosAPI.post(`${entity}`, data)
26
22
 
27
23
  return response.data;
28
24
  }
29
25
 
30
- async function deleteObject(entity, id) {
26
+ async function deleteObject(entity: any, id: string) {
31
27
  const response = await axiosAPI.delete(`${entity}/${id}`)
32
28
 
33
29
  return response.data;
34
30
  }
35
31
 
36
32
  const konversiAPI = {
37
- setToken,
33
+ setToken: setAuthToken,
34
+ setCompanyId,
38
35
  getAllObjects,
39
36
  getObjectById,
40
37
  updateObject,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konversi/konversi-client",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -9,8 +9,8 @@
9
9
  "author": "",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
- "axios": "^1.6.8"
12
+ "axios": "^1.6.8",
13
+ "ts-node": "^10.9.2"
13
14
  },
14
- "devDependencies": {},
15
15
  "description": ""
16
16
  }