@konversi/konversi-client 1.4.3 → 1.4.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/.github/workflows/publish_npm.yaml +20 -0
- package/KonversiError.ts +1 -1
- package/crudEndpoints.ts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/dist/index.mjs +8 -8
- package/index.ts +5 -5
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v2
|
|
13
|
+
- name: Install dependencies
|
|
14
|
+
run: npm install
|
|
15
|
+
- name: Build and publish
|
|
16
|
+
env:
|
|
17
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
18
|
+
run: |
|
|
19
|
+
npm run build
|
|
20
|
+
npm publish
|
package/KonversiError.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { isAxiosError } from "axios";
|
|
|
3
3
|
export default class KonversiError extends Error {
|
|
4
4
|
constructor(error: Error) {
|
|
5
5
|
if (isAxiosError(error)) {
|
|
6
|
-
super(`Konversi API Error ${error.response?.status || 'unknown'}: ${error.response?.data
|
|
6
|
+
super(`Konversi API Error ${error.response?.status || 'unknown'}: ${error.response?.data ?JSON.stringify(error.response?.data) : error.message}`);
|
|
7
7
|
} else {
|
|
8
8
|
super(`Konversi Error: ${error.message}`);
|
|
9
9
|
}
|
package/crudEndpoints.ts
CHANGED
|
@@ -79,7 +79,7 @@ export const DELIVERY_JOB = 'fleet/delivery-job'
|
|
|
79
79
|
|
|
80
80
|
// Custom Objects
|
|
81
81
|
export const CUSTOM_ENTITY_SCHEMA = 'custom-entity/schema'
|
|
82
|
-
export const CUSTOM_ENTITY_OBJECT = 'custom-entity'; // Need to add schemaName after this
|
|
82
|
+
export const CUSTOM_ENTITY_OBJECT = 'custom-entity/object'; // Need to add schemaName after this
|
|
83
83
|
export const CUSTOM_ENTITY_FIELD = 'custom-entity/field'; // Need to add schemaName after this
|
|
84
84
|
export const FORM = 'form';
|
|
85
85
|
export const CUSTOM_REPORT = 'report/custom-report';
|
package/dist/index.d.mts
CHANGED
|
@@ -60,7 +60,7 @@ declare const ATTENDANCE = "human-resources/attendance";
|
|
|
60
60
|
declare const VEHICLE = "fleet/vehicle";
|
|
61
61
|
declare const DELIVERY_JOB = "fleet/delivery-job";
|
|
62
62
|
declare const CUSTOM_ENTITY_SCHEMA = "custom-entity/schema";
|
|
63
|
-
declare const CUSTOM_ENTITY_OBJECT = "custom-entity";
|
|
63
|
+
declare const CUSTOM_ENTITY_OBJECT = "custom-entity/object";
|
|
64
64
|
declare const CUSTOM_ENTITY_FIELD = "custom-entity/field";
|
|
65
65
|
declare const FORM = "form";
|
|
66
66
|
declare const CUSTOM_REPORT = "report/custom-report";
|
package/dist/index.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ declare const ATTENDANCE = "human-resources/attendance";
|
|
|
60
60
|
declare const VEHICLE = "fleet/vehicle";
|
|
61
61
|
declare const DELIVERY_JOB = "fleet/delivery-job";
|
|
62
62
|
declare const CUSTOM_ENTITY_SCHEMA = "custom-entity/schema";
|
|
63
|
-
declare const CUSTOM_ENTITY_OBJECT = "custom-entity";
|
|
63
|
+
declare const CUSTOM_ENTITY_OBJECT = "custom-entity/object";
|
|
64
64
|
declare const CUSTOM_ENTITY_FIELD = "custom-entity/field";
|
|
65
65
|
declare const FORM = "form";
|
|
66
66
|
declare const CUSTOM_REPORT = "report/custom-report";
|
package/dist/index.js
CHANGED
|
@@ -220,7 +220,7 @@ var ATTENDANCE = "human-resources/attendance";
|
|
|
220
220
|
var VEHICLE = "fleet/vehicle";
|
|
221
221
|
var DELIVERY_JOB = "fleet/delivery-job";
|
|
222
222
|
var CUSTOM_ENTITY_SCHEMA = "custom-entity/schema";
|
|
223
|
-
var CUSTOM_ENTITY_OBJECT = "custom-entity";
|
|
223
|
+
var CUSTOM_ENTITY_OBJECT = "custom-entity/object";
|
|
224
224
|
var CUSTOM_ENTITY_FIELD = "custom-entity/field";
|
|
225
225
|
var FORM = "form";
|
|
226
226
|
var CUSTOM_REPORT = "report/custom-report";
|
|
@@ -248,9 +248,9 @@ var OUTGOING_SHIPMENT = "shipment/outgoing-shipment";
|
|
|
248
248
|
var import_axios2 = require("axios");
|
|
249
249
|
var KonversiError = class _KonversiError extends Error {
|
|
250
250
|
constructor(error) {
|
|
251
|
-
var _a2, _b;
|
|
251
|
+
var _a2, _b, _c;
|
|
252
252
|
if ((0, import_axios2.isAxiosError)(error)) {
|
|
253
|
-
super(`Konversi API Error ${((_a2 = error.response) == null ? void 0 : _a2.status) || "unknown"}: ${((_b = error.response) == null ? void 0 : _b.data)
|
|
253
|
+
super(`Konversi API Error ${((_a2 = error.response) == null ? void 0 : _a2.status) || "unknown"}: ${((_b = error.response) == null ? void 0 : _b.data) ? JSON.stringify((_c = error.response) == null ? void 0 : _c.data) : error.message}`);
|
|
254
254
|
} else {
|
|
255
255
|
super(`Konversi Error: ${error.message}`);
|
|
256
256
|
}
|
|
@@ -269,7 +269,7 @@ function getAllCustomObjects(_0) {
|
|
|
269
269
|
try {
|
|
270
270
|
const response = yield axiosAPI_default.request({
|
|
271
271
|
method: "get",
|
|
272
|
-
url: `custom-entity/${schemaName}`,
|
|
272
|
+
url: `custom-entity/object/${schemaName}`,
|
|
273
273
|
params: queryParams
|
|
274
274
|
});
|
|
275
275
|
return response.data;
|
|
@@ -283,7 +283,7 @@ function getCustomObjectById(schemaName, id) {
|
|
|
283
283
|
try {
|
|
284
284
|
const response = yield axiosAPI_default.request({
|
|
285
285
|
method: "get",
|
|
286
|
-
url: `custom-entity/${schemaName}/${id}`
|
|
286
|
+
url: `custom-entity/object/${schemaName}/${id}`
|
|
287
287
|
});
|
|
288
288
|
return response.data;
|
|
289
289
|
} catch (e) {
|
|
@@ -296,7 +296,7 @@ function updateCustomObject(schemaName, id, newData) {
|
|
|
296
296
|
try {
|
|
297
297
|
const response = yield axiosAPI_default.request({
|
|
298
298
|
method: "put",
|
|
299
|
-
url: `custom-entity/${schemaName}/${id}`,
|
|
299
|
+
url: `custom-entity/object/${schemaName}/${id}`,
|
|
300
300
|
headers: {
|
|
301
301
|
"Content-Type": "application/json"
|
|
302
302
|
},
|
|
@@ -313,7 +313,7 @@ function createCustomObject(schemaName, data) {
|
|
|
313
313
|
try {
|
|
314
314
|
const response = yield axiosAPI_default.request({
|
|
315
315
|
method: "post",
|
|
316
|
-
url: `custom-entity/${schemaName}`,
|
|
316
|
+
url: `custom-entity/object/${schemaName}`,
|
|
317
317
|
data
|
|
318
318
|
});
|
|
319
319
|
return response.data;
|
|
@@ -328,7 +328,7 @@ function deleteCustomObject(schemaName, id) {
|
|
|
328
328
|
const response = yield axiosAPI_default.request({
|
|
329
329
|
method: "delete",
|
|
330
330
|
maxBodyLength: Infinity,
|
|
331
|
-
url: `custom-entity/${schemaName}/${id}`
|
|
331
|
+
url: `custom-entity/object/${schemaName}/${id}`
|
|
332
332
|
});
|
|
333
333
|
return response.data;
|
|
334
334
|
} catch (e) {
|
package/dist/index.mjs
CHANGED
|
@@ -188,7 +188,7 @@ var ATTENDANCE = "human-resources/attendance";
|
|
|
188
188
|
var VEHICLE = "fleet/vehicle";
|
|
189
189
|
var DELIVERY_JOB = "fleet/delivery-job";
|
|
190
190
|
var CUSTOM_ENTITY_SCHEMA = "custom-entity/schema";
|
|
191
|
-
var CUSTOM_ENTITY_OBJECT = "custom-entity";
|
|
191
|
+
var CUSTOM_ENTITY_OBJECT = "custom-entity/object";
|
|
192
192
|
var CUSTOM_ENTITY_FIELD = "custom-entity/field";
|
|
193
193
|
var FORM = "form";
|
|
194
194
|
var CUSTOM_REPORT = "report/custom-report";
|
|
@@ -216,9 +216,9 @@ var OUTGOING_SHIPMENT = "shipment/outgoing-shipment";
|
|
|
216
216
|
import { isAxiosError } from "axios";
|
|
217
217
|
var KonversiError = class _KonversiError extends Error {
|
|
218
218
|
constructor(error) {
|
|
219
|
-
var _a2, _b;
|
|
219
|
+
var _a2, _b, _c;
|
|
220
220
|
if (isAxiosError(error)) {
|
|
221
|
-
super(`Konversi API Error ${((_a2 = error.response) == null ? void 0 : _a2.status) || "unknown"}: ${((_b = error.response) == null ? void 0 : _b.data)
|
|
221
|
+
super(`Konversi API Error ${((_a2 = error.response) == null ? void 0 : _a2.status) || "unknown"}: ${((_b = error.response) == null ? void 0 : _b.data) ? JSON.stringify((_c = error.response) == null ? void 0 : _c.data) : error.message}`);
|
|
222
222
|
} else {
|
|
223
223
|
super(`Konversi Error: ${error.message}`);
|
|
224
224
|
}
|
|
@@ -237,7 +237,7 @@ function getAllCustomObjects(_0) {
|
|
|
237
237
|
try {
|
|
238
238
|
const response = yield axiosAPI_default.request({
|
|
239
239
|
method: "get",
|
|
240
|
-
url: `custom-entity/${schemaName}`,
|
|
240
|
+
url: `custom-entity/object/${schemaName}`,
|
|
241
241
|
params: queryParams
|
|
242
242
|
});
|
|
243
243
|
return response.data;
|
|
@@ -251,7 +251,7 @@ function getCustomObjectById(schemaName, id) {
|
|
|
251
251
|
try {
|
|
252
252
|
const response = yield axiosAPI_default.request({
|
|
253
253
|
method: "get",
|
|
254
|
-
url: `custom-entity/${schemaName}/${id}`
|
|
254
|
+
url: `custom-entity/object/${schemaName}/${id}`
|
|
255
255
|
});
|
|
256
256
|
return response.data;
|
|
257
257
|
} catch (e) {
|
|
@@ -264,7 +264,7 @@ function updateCustomObject(schemaName, id, newData) {
|
|
|
264
264
|
try {
|
|
265
265
|
const response = yield axiosAPI_default.request({
|
|
266
266
|
method: "put",
|
|
267
|
-
url: `custom-entity/${schemaName}/${id}`,
|
|
267
|
+
url: `custom-entity/object/${schemaName}/${id}`,
|
|
268
268
|
headers: {
|
|
269
269
|
"Content-Type": "application/json"
|
|
270
270
|
},
|
|
@@ -281,7 +281,7 @@ function createCustomObject(schemaName, data) {
|
|
|
281
281
|
try {
|
|
282
282
|
const response = yield axiosAPI_default.request({
|
|
283
283
|
method: "post",
|
|
284
|
-
url: `custom-entity/${schemaName}`,
|
|
284
|
+
url: `custom-entity/object/${schemaName}`,
|
|
285
285
|
data
|
|
286
286
|
});
|
|
287
287
|
return response.data;
|
|
@@ -296,7 +296,7 @@ function deleteCustomObject(schemaName, id) {
|
|
|
296
296
|
const response = yield axiosAPI_default.request({
|
|
297
297
|
method: "delete",
|
|
298
298
|
maxBodyLength: Infinity,
|
|
299
|
-
url: `custom-entity/${schemaName}/${id}`
|
|
299
|
+
url: `custom-entity/object/${schemaName}/${id}`
|
|
300
300
|
});
|
|
301
301
|
return response.data;
|
|
302
302
|
} catch (e) {
|
package/index.ts
CHANGED
|
@@ -12,7 +12,7 @@ async function getAllCustomObjects(schemaName: string, queryParams: any = {}) {
|
|
|
12
12
|
try {
|
|
13
13
|
const response = await axiosAPI.request({
|
|
14
14
|
method: 'get',
|
|
15
|
-
url: `custom-entity/${schemaName}`,
|
|
15
|
+
url: `custom-entity/object/${schemaName}`,
|
|
16
16
|
params: queryParams
|
|
17
17
|
})
|
|
18
18
|
return response.data;
|
|
@@ -25,7 +25,7 @@ async function getCustomObjectById(schemaName: string, id: string) {
|
|
|
25
25
|
try {
|
|
26
26
|
const response = await axiosAPI.request({
|
|
27
27
|
method: 'get',
|
|
28
|
-
url: `custom-entity/${schemaName}/${id}`,
|
|
28
|
+
url: `custom-entity/object/${schemaName}/${id}`,
|
|
29
29
|
})
|
|
30
30
|
return response.data;
|
|
31
31
|
} catch (e: any) {
|
|
@@ -37,7 +37,7 @@ async function updateCustomObject(schemaName: string, id: string, newData: any)
|
|
|
37
37
|
try {
|
|
38
38
|
const response = await axiosAPI.request({
|
|
39
39
|
method: 'put',
|
|
40
|
-
url: `custom-entity/${schemaName}/${id}`,
|
|
40
|
+
url: `custom-entity/object/${schemaName}/${id}`,
|
|
41
41
|
headers: {
|
|
42
42
|
'Content-Type': 'application/json'
|
|
43
43
|
},
|
|
@@ -53,7 +53,7 @@ async function createCustomObject(schemaName: string, data: any) {
|
|
|
53
53
|
try {
|
|
54
54
|
const response = await axiosAPI.request({
|
|
55
55
|
method: 'post',
|
|
56
|
-
url: `custom-entity/${schemaName}`,
|
|
56
|
+
url: `custom-entity/object/${schemaName}`,
|
|
57
57
|
data: data
|
|
58
58
|
});
|
|
59
59
|
|
|
@@ -68,7 +68,7 @@ async function deleteCustomObject(schemaName: string, id: string) {
|
|
|
68
68
|
const response = await axiosAPI.request({
|
|
69
69
|
method: 'delete',
|
|
70
70
|
maxBodyLength: Infinity,
|
|
71
|
-
url: `custom-entity/${schemaName}/${id}`,
|
|
71
|
+
url: `custom-entity/object/${schemaName}/${id}`,
|
|
72
72
|
})
|
|
73
73
|
return response.data;
|
|
74
74
|
} catch (e: any) {
|