@konversi/konversi-client 1.2.3 → 1.2.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/dist/index.d.mts CHANGED
@@ -156,6 +156,7 @@ declare function deleteObject(entity: any, id: string): Promise<any>;
156
156
  declare const konversiAPI: {
157
157
  setToken: (token: string) => void;
158
158
  setCompanyId: (companyId: string) => void;
159
+ setBaseUrl: (baseUrl: string) => void;
159
160
  getAllCustomObjects: typeof getAllCustomObjects;
160
161
  getCustomObjectById: typeof getCustomObjectById;
161
162
  updateCustomObject: typeof updateCustomObject;
package/dist/index.d.ts CHANGED
@@ -156,6 +156,7 @@ declare function deleteObject(entity: any, id: string): Promise<any>;
156
156
  declare const konversiAPI: {
157
157
  setToken: (token: string) => void;
158
158
  setCompanyId: (companyId: string) => void;
159
+ setBaseUrl: (baseUrl: string) => void;
159
160
  getAllCustomObjects: typeof getAllCustomObjects;
160
161
  getCustomObjectById: typeof getCustomObjectById;
161
162
  updateCustomObject: typeof updateCustomObject;
package/dist/index.js CHANGED
@@ -63,6 +63,9 @@ var instance = import_axios.default.create({
63
63
  baseURL,
64
64
  timeout
65
65
  });
66
+ var setBaseUrl = (baseUrl) => {
67
+ instance.defaults.baseURL = baseUrl;
68
+ };
66
69
  var setAuthToken = (token) => {
67
70
  instance.defaults.headers.common.authorization = `Bearer ${token}`;
68
71
  };
@@ -239,7 +242,10 @@ function updateCustomObject(schemaName, id, newData) {
239
242
  const response = yield axiosAPI_default.request({
240
243
  method: "put",
241
244
  url: `custom-entity/${schemaName}/${id}`,
242
- data: newData
245
+ headers: {
246
+ "Content-Type": "application/json"
247
+ },
248
+ data: JSON.stringify(newData)
243
249
  });
244
250
  return response.data;
245
251
  });
@@ -300,6 +306,7 @@ var _a;
300
306
  var konversiAPI = {
301
307
  setToken: setAuthToken,
302
308
  setCompanyId,
309
+ setBaseUrl,
303
310
  getAllCustomObjects,
304
311
  getCustomObjectById,
305
312
  updateCustomObject,
package/dist/index.mjs CHANGED
@@ -32,6 +32,9 @@ var instance = axios.create({
32
32
  baseURL,
33
33
  timeout
34
34
  });
35
+ var setBaseUrl = (baseUrl) => {
36
+ instance.defaults.baseURL = baseUrl;
37
+ };
35
38
  var setAuthToken = (token) => {
36
39
  instance.defaults.headers.common.authorization = `Bearer ${token}`;
37
40
  };
@@ -208,7 +211,10 @@ function updateCustomObject(schemaName, id, newData) {
208
211
  const response = yield axiosAPI_default.request({
209
212
  method: "put",
210
213
  url: `custom-entity/${schemaName}/${id}`,
211
- data: newData
214
+ headers: {
215
+ "Content-Type": "application/json"
216
+ },
217
+ data: JSON.stringify(newData)
212
218
  });
213
219
  return response.data;
214
220
  });
@@ -269,6 +275,7 @@ var _a;
269
275
  var konversiAPI = {
270
276
  setToken: setAuthToken,
271
277
  setCompanyId,
278
+ setBaseUrl,
272
279
  getAllCustomObjects,
273
280
  getCustomObjectById,
274
281
  updateCustomObject,
package/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import axiosAPI, { setAuthToken, setCompanyId } from "./axiosAPI";
1
+ import axiosAPI, { setAuthToken, setBaseUrl, setCompanyId } from "./axiosAPI";
2
2
 
3
3
  import * as crudEndpoints from "./crudEndpoints";
4
4
 
@@ -23,7 +23,10 @@ async function updateCustomObject(schemaName: string, id: string, newData: any)
23
23
  const response = await axiosAPI.request({
24
24
  method: 'put',
25
25
  url: `custom-entity/${schemaName}/${id}`,
26
- data: newData
26
+ headers: {
27
+ 'Content-Type': 'application/json'
28
+ },
29
+ data: JSON.stringify(newData)
27
30
  })
28
31
  return response.data;
29
32
  }
@@ -81,6 +84,7 @@ async function deleteObject(entity: any, id: string) {
81
84
  const konversiAPI = {
82
85
  setToken: setAuthToken,
83
86
  setCompanyId,
87
+ setBaseUrl,
84
88
 
85
89
  getAllCustomObjects,
86
90
  getCustomObjectById,
package/package.json CHANGED
@@ -1,24 +1,24 @@
1
- {
2
- "name": "@konversi/konversi-client",
3
- "version": "1.2.3",
4
- "main": "dist/index.js",
5
- "module": "dist/index.mjs",
6
- "types": "dist/index.d.ts",
7
- "keywords": [],
8
- "author": "",
9
- "license": "ISC",
10
- "dependencies": {
11
- "axios": "^1.6.8",
12
- "ts-node": "^10.9.2"
13
- },
14
- "description": "",
15
- "devDependencies": {
16
- "tsup": "^8.2.4",
17
- "typescript": "^5.4.5"
18
- },
19
- "scripts": {
20
- "test": "echo \"Error: no test specified\" && exit 1",
21
- "build": "tsup index.ts --format cjs,esm --dts",
22
- "lint": "tsc"
23
- }
24
- }
1
+ {
2
+ "name": "@konversi/konversi-client",
3
+ "version": "1.2.5",
4
+ "main": "dist/index.js",
5
+ "module": "dist/index.mjs",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "build": "tsup index.ts --format cjs,esm --dts",
10
+ "lint": "tsc"
11
+ },
12
+ "keywords": [],
13
+ "author": "",
14
+ "license": "ISC",
15
+ "dependencies": {
16
+ "axios": "^1.6.8",
17
+ "ts-node": "^10.9.2"
18
+ },
19
+ "description": "",
20
+ "devDependencies": {
21
+ "tsup": "^8.2.4",
22
+ "typescript": "^5.4.5"
23
+ }
24
+ }