@konversi/konversi-client 1.4.5 → 1.4.7
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/KonversiError.ts +2 -11
- package/dist/index.js +30 -26
- package/dist/index.mjs +27 -23
- package/index.ts +11 -11
- package/package.json +8 -7
package/KonversiError.ts
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import { isAxiosError } from "axios";
|
|
2
|
-
|
|
3
1
|
export default class KonversiError extends Error {
|
|
4
|
-
constructor(
|
|
5
|
-
|
|
6
|
-
super(`Konversi API Error ${error.response?.status || 'unknown'}: ${error.response?.data ?JSON.stringify(error.response?.data) : error.message}`);
|
|
7
|
-
} else {
|
|
8
|
-
super(`Konversi Error: ${error.message}`);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// Set the prototype explicitly.
|
|
12
|
-
Object.setPrototypeOf(this, KonversiError.prototype);
|
|
2
|
+
constructor(message: string) {
|
|
3
|
+
super(message);
|
|
13
4
|
}
|
|
14
5
|
}
|
package/dist/index.js
CHANGED
|
@@ -48,13 +48,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
// index.ts
|
|
51
|
-
var
|
|
52
|
-
__export(
|
|
51
|
+
var index_exports = {};
|
|
52
|
+
__export(index_exports, {
|
|
53
53
|
Entity: () => Entity,
|
|
54
|
-
default: () =>
|
|
54
|
+
default: () => index_default,
|
|
55
55
|
runScript: () => runScript
|
|
56
56
|
});
|
|
57
|
-
module.exports = __toCommonJS(
|
|
57
|
+
module.exports = __toCommonJS(index_exports);
|
|
58
58
|
|
|
59
59
|
// axiosAPI.ts
|
|
60
60
|
var import_axios = __toESM(require("axios"));
|
|
@@ -245,16 +245,9 @@ var INCOMING_SHIPMENT = "shipment/incoming-shipment";
|
|
|
245
245
|
var OUTGOING_SHIPMENT = "shipment/outgoing-shipment";
|
|
246
246
|
|
|
247
247
|
// KonversiError.ts
|
|
248
|
-
var
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
var _a2, _b, _c;
|
|
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) ? JSON.stringify((_c = error.response) == null ? void 0 : _c.data) : error.message}`);
|
|
254
|
-
} else {
|
|
255
|
-
super(`Konversi Error: ${error.message}`);
|
|
256
|
-
}
|
|
257
|
-
Object.setPrototypeOf(this, _KonversiError.prototype);
|
|
248
|
+
var KonversiError = class extends Error {
|
|
249
|
+
constructor(message) {
|
|
250
|
+
super(message);
|
|
258
251
|
}
|
|
259
252
|
};
|
|
260
253
|
|
|
@@ -266,6 +259,7 @@ function call(axiosRequest) {
|
|
|
266
259
|
}
|
|
267
260
|
function getAllCustomObjects(_0) {
|
|
268
261
|
return __async(this, arguments, function* (schemaName, queryParams = {}) {
|
|
262
|
+
var _a2, _b;
|
|
269
263
|
try {
|
|
270
264
|
const response = yield axiosAPI_default.request({
|
|
271
265
|
method: "get",
|
|
@@ -274,12 +268,13 @@ function getAllCustomObjects(_0) {
|
|
|
274
268
|
});
|
|
275
269
|
return response.data;
|
|
276
270
|
} catch (e) {
|
|
277
|
-
throw new KonversiError(e);
|
|
271
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
278
272
|
}
|
|
279
273
|
});
|
|
280
274
|
}
|
|
281
275
|
function getCustomObjectById(schemaName, id) {
|
|
282
276
|
return __async(this, null, function* () {
|
|
277
|
+
var _a2, _b;
|
|
283
278
|
try {
|
|
284
279
|
const response = yield axiosAPI_default.request({
|
|
285
280
|
method: "get",
|
|
@@ -287,12 +282,13 @@ function getCustomObjectById(schemaName, id) {
|
|
|
287
282
|
});
|
|
288
283
|
return response.data;
|
|
289
284
|
} catch (e) {
|
|
290
|
-
throw new KonversiError(e);
|
|
285
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
291
286
|
}
|
|
292
287
|
});
|
|
293
288
|
}
|
|
294
289
|
function updateCustomObject(schemaName, id, newData) {
|
|
295
290
|
return __async(this, null, function* () {
|
|
291
|
+
var _a2, _b;
|
|
296
292
|
try {
|
|
297
293
|
const response = yield axiosAPI_default.request({
|
|
298
294
|
method: "put",
|
|
@@ -304,12 +300,13 @@ function updateCustomObject(schemaName, id, newData) {
|
|
|
304
300
|
});
|
|
305
301
|
return response.data;
|
|
306
302
|
} catch (e) {
|
|
307
|
-
throw new KonversiError(e);
|
|
303
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
308
304
|
}
|
|
309
305
|
});
|
|
310
306
|
}
|
|
311
307
|
function createCustomObject(schemaName, data) {
|
|
312
308
|
return __async(this, null, function* () {
|
|
309
|
+
var _a2, _b;
|
|
313
310
|
try {
|
|
314
311
|
const response = yield axiosAPI_default.request({
|
|
315
312
|
method: "post",
|
|
@@ -318,12 +315,13 @@ function createCustomObject(schemaName, data) {
|
|
|
318
315
|
});
|
|
319
316
|
return response.data;
|
|
320
317
|
} catch (e) {
|
|
321
|
-
throw new KonversiError(e);
|
|
318
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
322
319
|
}
|
|
323
320
|
});
|
|
324
321
|
}
|
|
325
322
|
function deleteCustomObject(schemaName, id) {
|
|
326
323
|
return __async(this, null, function* () {
|
|
324
|
+
var _a2, _b;
|
|
327
325
|
try {
|
|
328
326
|
const response = yield axiosAPI_default.request({
|
|
329
327
|
method: "delete",
|
|
@@ -332,64 +330,70 @@ function deleteCustomObject(schemaName, id) {
|
|
|
332
330
|
});
|
|
333
331
|
return response.data;
|
|
334
332
|
} catch (e) {
|
|
335
|
-
throw new KonversiError(e);
|
|
333
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
336
334
|
}
|
|
337
335
|
});
|
|
338
336
|
}
|
|
339
337
|
function getAllObjects(_0) {
|
|
340
338
|
return __async(this, arguments, function* (entity, queryParams = {}) {
|
|
339
|
+
var _a2, _b;
|
|
341
340
|
try {
|
|
342
341
|
const response = yield axiosAPI_default.get(`${entity}`, {
|
|
343
342
|
params: queryParams
|
|
344
343
|
});
|
|
345
344
|
return response.data;
|
|
346
345
|
} catch (e) {
|
|
347
|
-
throw new KonversiError(e);
|
|
346
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
348
347
|
}
|
|
349
348
|
});
|
|
350
349
|
}
|
|
351
350
|
function getObjectById(entity, id) {
|
|
352
351
|
return __async(this, null, function* () {
|
|
352
|
+
var _a2, _b;
|
|
353
353
|
try {
|
|
354
354
|
const response = yield axiosAPI_default.get(`${entity}/${id}`);
|
|
355
355
|
return response.data;
|
|
356
356
|
} catch (e) {
|
|
357
|
-
throw new KonversiError(e);
|
|
357
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
358
358
|
}
|
|
359
359
|
});
|
|
360
360
|
}
|
|
361
361
|
function updateObject(entity, id, newData) {
|
|
362
362
|
return __async(this, null, function* () {
|
|
363
|
+
var _a2, _b;
|
|
363
364
|
try {
|
|
364
365
|
const response = yield axiosAPI_default.put(`${entity}/${id}`, newData);
|
|
365
366
|
return response.data;
|
|
366
367
|
} catch (e) {
|
|
367
|
-
throw new KonversiError(e);
|
|
368
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
368
369
|
}
|
|
369
370
|
});
|
|
370
371
|
}
|
|
371
372
|
function createObject(entity, data) {
|
|
372
373
|
return __async(this, null, function* () {
|
|
374
|
+
var _a2, _b;
|
|
373
375
|
try {
|
|
374
376
|
const response = yield axiosAPI_default.post(`${entity}`, data);
|
|
375
377
|
return response.data;
|
|
376
378
|
} catch (e) {
|
|
377
|
-
throw new KonversiError(e);
|
|
379
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
378
380
|
}
|
|
379
381
|
});
|
|
380
382
|
}
|
|
381
383
|
function deleteObject(entity, id) {
|
|
382
384
|
return __async(this, null, function* () {
|
|
385
|
+
var _a2, _b;
|
|
383
386
|
try {
|
|
384
387
|
const response = yield axiosAPI_default.delete(`${entity}/${id}`);
|
|
385
388
|
return response.data;
|
|
386
389
|
} catch (e) {
|
|
387
|
-
throw new KonversiError(e);
|
|
390
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
388
391
|
}
|
|
389
392
|
});
|
|
390
393
|
}
|
|
391
394
|
function runScript(scriptNameOrId, input, sync = false) {
|
|
392
395
|
return __async(this, null, function* () {
|
|
396
|
+
var _a2, _b;
|
|
393
397
|
try {
|
|
394
398
|
if (sync) {
|
|
395
399
|
const response2 = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run?mode=sync`, { input });
|
|
@@ -398,7 +402,7 @@ function runScript(scriptNameOrId, input, sync = false) {
|
|
|
398
402
|
const response = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run`, { input });
|
|
399
403
|
return response.data;
|
|
400
404
|
} catch (e) {
|
|
401
|
-
throw new KonversiError(e);
|
|
405
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
402
406
|
}
|
|
403
407
|
});
|
|
404
408
|
}
|
|
@@ -423,7 +427,7 @@ var konversiAPI = {
|
|
|
423
427
|
token: ((_a = axiosAPI_default.defaults.headers.common["Authorization"]) == null ? void 0 : _a.toString().split(" ")[1]) || "",
|
|
424
428
|
companyId: axiosAPI_default.defaults.headers.common["Company"]
|
|
425
429
|
};
|
|
426
|
-
var
|
|
430
|
+
var index_default = konversiAPI;
|
|
427
431
|
var Entity = crudEndpoints_exports;
|
|
428
432
|
// Annotate the CommonJS export names for ESM import in node:
|
|
429
433
|
0 && (module.exports = {
|
package/dist/index.mjs
CHANGED
|
@@ -213,16 +213,9 @@ var INCOMING_SHIPMENT = "shipment/incoming-shipment";
|
|
|
213
213
|
var OUTGOING_SHIPMENT = "shipment/outgoing-shipment";
|
|
214
214
|
|
|
215
215
|
// KonversiError.ts
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
var _a2, _b, _c;
|
|
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) ? JSON.stringify((_c = error.response) == null ? void 0 : _c.data) : error.message}`);
|
|
222
|
-
} else {
|
|
223
|
-
super(`Konversi Error: ${error.message}`);
|
|
224
|
-
}
|
|
225
|
-
Object.setPrototypeOf(this, _KonversiError.prototype);
|
|
216
|
+
var KonversiError = class extends Error {
|
|
217
|
+
constructor(message) {
|
|
218
|
+
super(message);
|
|
226
219
|
}
|
|
227
220
|
};
|
|
228
221
|
|
|
@@ -234,6 +227,7 @@ function call(axiosRequest) {
|
|
|
234
227
|
}
|
|
235
228
|
function getAllCustomObjects(_0) {
|
|
236
229
|
return __async(this, arguments, function* (schemaName, queryParams = {}) {
|
|
230
|
+
var _a2, _b;
|
|
237
231
|
try {
|
|
238
232
|
const response = yield axiosAPI_default.request({
|
|
239
233
|
method: "get",
|
|
@@ -242,12 +236,13 @@ function getAllCustomObjects(_0) {
|
|
|
242
236
|
});
|
|
243
237
|
return response.data;
|
|
244
238
|
} catch (e) {
|
|
245
|
-
throw new KonversiError(e);
|
|
239
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
246
240
|
}
|
|
247
241
|
});
|
|
248
242
|
}
|
|
249
243
|
function getCustomObjectById(schemaName, id) {
|
|
250
244
|
return __async(this, null, function* () {
|
|
245
|
+
var _a2, _b;
|
|
251
246
|
try {
|
|
252
247
|
const response = yield axiosAPI_default.request({
|
|
253
248
|
method: "get",
|
|
@@ -255,12 +250,13 @@ function getCustomObjectById(schemaName, id) {
|
|
|
255
250
|
});
|
|
256
251
|
return response.data;
|
|
257
252
|
} catch (e) {
|
|
258
|
-
throw new KonversiError(e);
|
|
253
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
259
254
|
}
|
|
260
255
|
});
|
|
261
256
|
}
|
|
262
257
|
function updateCustomObject(schemaName, id, newData) {
|
|
263
258
|
return __async(this, null, function* () {
|
|
259
|
+
var _a2, _b;
|
|
264
260
|
try {
|
|
265
261
|
const response = yield axiosAPI_default.request({
|
|
266
262
|
method: "put",
|
|
@@ -272,12 +268,13 @@ function updateCustomObject(schemaName, id, newData) {
|
|
|
272
268
|
});
|
|
273
269
|
return response.data;
|
|
274
270
|
} catch (e) {
|
|
275
|
-
throw new KonversiError(e);
|
|
271
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
276
272
|
}
|
|
277
273
|
});
|
|
278
274
|
}
|
|
279
275
|
function createCustomObject(schemaName, data) {
|
|
280
276
|
return __async(this, null, function* () {
|
|
277
|
+
var _a2, _b;
|
|
281
278
|
try {
|
|
282
279
|
const response = yield axiosAPI_default.request({
|
|
283
280
|
method: "post",
|
|
@@ -286,12 +283,13 @@ function createCustomObject(schemaName, data) {
|
|
|
286
283
|
});
|
|
287
284
|
return response.data;
|
|
288
285
|
} catch (e) {
|
|
289
|
-
throw new KonversiError(e);
|
|
286
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
290
287
|
}
|
|
291
288
|
});
|
|
292
289
|
}
|
|
293
290
|
function deleteCustomObject(schemaName, id) {
|
|
294
291
|
return __async(this, null, function* () {
|
|
292
|
+
var _a2, _b;
|
|
295
293
|
try {
|
|
296
294
|
const response = yield axiosAPI_default.request({
|
|
297
295
|
method: "delete",
|
|
@@ -300,64 +298,70 @@ function deleteCustomObject(schemaName, id) {
|
|
|
300
298
|
});
|
|
301
299
|
return response.data;
|
|
302
300
|
} catch (e) {
|
|
303
|
-
throw new KonversiError(e);
|
|
301
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
304
302
|
}
|
|
305
303
|
});
|
|
306
304
|
}
|
|
307
305
|
function getAllObjects(_0) {
|
|
308
306
|
return __async(this, arguments, function* (entity, queryParams = {}) {
|
|
307
|
+
var _a2, _b;
|
|
309
308
|
try {
|
|
310
309
|
const response = yield axiosAPI_default.get(`${entity}`, {
|
|
311
310
|
params: queryParams
|
|
312
311
|
});
|
|
313
312
|
return response.data;
|
|
314
313
|
} catch (e) {
|
|
315
|
-
throw new KonversiError(e);
|
|
314
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
316
315
|
}
|
|
317
316
|
});
|
|
318
317
|
}
|
|
319
318
|
function getObjectById(entity, id) {
|
|
320
319
|
return __async(this, null, function* () {
|
|
320
|
+
var _a2, _b;
|
|
321
321
|
try {
|
|
322
322
|
const response = yield axiosAPI_default.get(`${entity}/${id}`);
|
|
323
323
|
return response.data;
|
|
324
324
|
} catch (e) {
|
|
325
|
-
throw new KonversiError(e);
|
|
325
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
326
326
|
}
|
|
327
327
|
});
|
|
328
328
|
}
|
|
329
329
|
function updateObject(entity, id, newData) {
|
|
330
330
|
return __async(this, null, function* () {
|
|
331
|
+
var _a2, _b;
|
|
331
332
|
try {
|
|
332
333
|
const response = yield axiosAPI_default.put(`${entity}/${id}`, newData);
|
|
333
334
|
return response.data;
|
|
334
335
|
} catch (e) {
|
|
335
|
-
throw new KonversiError(e);
|
|
336
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
336
337
|
}
|
|
337
338
|
});
|
|
338
339
|
}
|
|
339
340
|
function createObject(entity, data) {
|
|
340
341
|
return __async(this, null, function* () {
|
|
342
|
+
var _a2, _b;
|
|
341
343
|
try {
|
|
342
344
|
const response = yield axiosAPI_default.post(`${entity}`, data);
|
|
343
345
|
return response.data;
|
|
344
346
|
} catch (e) {
|
|
345
|
-
throw new KonversiError(e);
|
|
347
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
346
348
|
}
|
|
347
349
|
});
|
|
348
350
|
}
|
|
349
351
|
function deleteObject(entity, id) {
|
|
350
352
|
return __async(this, null, function* () {
|
|
353
|
+
var _a2, _b;
|
|
351
354
|
try {
|
|
352
355
|
const response = yield axiosAPI_default.delete(`${entity}/${id}`);
|
|
353
356
|
return response.data;
|
|
354
357
|
} catch (e) {
|
|
355
|
-
throw new KonversiError(e);
|
|
358
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
356
359
|
}
|
|
357
360
|
});
|
|
358
361
|
}
|
|
359
362
|
function runScript(scriptNameOrId, input, sync = false) {
|
|
360
363
|
return __async(this, null, function* () {
|
|
364
|
+
var _a2, _b;
|
|
361
365
|
try {
|
|
362
366
|
if (sync) {
|
|
363
367
|
const response2 = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run?mode=sync`, { input });
|
|
@@ -366,7 +370,7 @@ function runScript(scriptNameOrId, input, sync = false) {
|
|
|
366
370
|
const response = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run`, { input });
|
|
367
371
|
return response.data;
|
|
368
372
|
} catch (e) {
|
|
369
|
-
throw new KonversiError(e);
|
|
373
|
+
throw new KonversiError(e.message + `${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}`);
|
|
370
374
|
}
|
|
371
375
|
});
|
|
372
376
|
}
|
|
@@ -391,10 +395,10 @@ var konversiAPI = {
|
|
|
391
395
|
token: ((_a = axiosAPI_default.defaults.headers.common["Authorization"]) == null ? void 0 : _a.toString().split(" ")[1]) || "",
|
|
392
396
|
companyId: axiosAPI_default.defaults.headers.common["Company"]
|
|
393
397
|
};
|
|
394
|
-
var
|
|
398
|
+
var index_default = konversiAPI;
|
|
395
399
|
var Entity = crudEndpoints_exports;
|
|
396
400
|
export {
|
|
397
401
|
Entity,
|
|
398
|
-
|
|
402
|
+
index_default as default,
|
|
399
403
|
runScript
|
|
400
404
|
};
|
package/index.ts
CHANGED
|
@@ -17,7 +17,7 @@ async function getAllCustomObjects(schemaName: string, queryParams: any = {}) {
|
|
|
17
17
|
})
|
|
18
18
|
return response.data;
|
|
19
19
|
} catch (e: any) {
|
|
20
|
-
throw new KonversiError(e);
|
|
20
|
+
throw new KonversiError(e.message + `${e.response?.status} ${e.response?.data}`);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -29,7 +29,7 @@ async function getCustomObjectById(schemaName: string, id: string) {
|
|
|
29
29
|
})
|
|
30
30
|
return response.data;
|
|
31
31
|
} catch (e: any) {
|
|
32
|
-
throw new KonversiError(e);
|
|
32
|
+
throw new KonversiError(e.message + `${e.response?.status} ${e.response?.data}`);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -45,7 +45,7 @@ async function updateCustomObject(schemaName: string, id: string, newData: any)
|
|
|
45
45
|
})
|
|
46
46
|
return response.data;
|
|
47
47
|
} catch (e: any) {
|
|
48
|
-
throw new KonversiError(e);
|
|
48
|
+
throw new KonversiError(e.message + ` ${e.response?.status} ${e.response?.data}`);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -59,7 +59,7 @@ async function createCustomObject(schemaName: string, data: any) {
|
|
|
59
59
|
|
|
60
60
|
return response.data;
|
|
61
61
|
} catch (e: any) {
|
|
62
|
-
throw new KonversiError(e);
|
|
62
|
+
throw new KonversiError(e.message + `${e.response?.status} ${e.response?.data}`);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -72,7 +72,7 @@ async function deleteCustomObject(schemaName: string, id: string) {
|
|
|
72
72
|
})
|
|
73
73
|
return response.data;
|
|
74
74
|
} catch (e: any) {
|
|
75
|
-
throw new KonversiError(e);
|
|
75
|
+
throw new KonversiError(e.message + `${e.response?.status} ${e.response?.data}`);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -85,7 +85,7 @@ async function getAllObjects(entity: any, queryParams: any = {}) {
|
|
|
85
85
|
})
|
|
86
86
|
return response.data;
|
|
87
87
|
} catch (e: any) {
|
|
88
|
-
throw new KonversiError(e);
|
|
88
|
+
throw new KonversiError(e.message + `${e.response?.status} ${e.response?.data}`);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -94,7 +94,7 @@ async function getObjectById(entity: any, id: string) {
|
|
|
94
94
|
const response = await axiosAPI.get(`${entity}/${id}`)
|
|
95
95
|
return response.data;
|
|
96
96
|
} catch (e: any) {
|
|
97
|
-
throw new KonversiError(e);
|
|
97
|
+
throw new KonversiError(e.message + `${e.response?.status} ${e.response?.data}`);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -103,7 +103,7 @@ async function updateObject(entity: any, id: string, newData: any) {
|
|
|
103
103
|
const response = await axiosAPI.put(`${entity}/${id}`, newData)
|
|
104
104
|
return response.data;
|
|
105
105
|
} catch (e: any) {
|
|
106
|
-
throw new KonversiError(e);
|
|
106
|
+
throw new KonversiError(e.message + `${e.response?.status} ${e.response?.data}`);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
@@ -113,7 +113,7 @@ async function createObject(entity: any, data: any) {
|
|
|
113
113
|
|
|
114
114
|
return response.data;
|
|
115
115
|
} catch (e: any) {
|
|
116
|
-
throw new KonversiError(e);
|
|
116
|
+
throw new KonversiError(e.message + `${e.response?.status} ${e.response?.data}`);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -123,7 +123,7 @@ async function deleteObject(entity: any, id: string) {
|
|
|
123
123
|
|
|
124
124
|
return response.data;
|
|
125
125
|
} catch (e: any) {
|
|
126
|
-
throw new KonversiError(e);
|
|
126
|
+
throw new KonversiError(e.message + `${e.response?.status} ${e.response?.data}`);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
|
|
@@ -138,7 +138,7 @@ export async function runScript(scriptNameOrId: string, input: any, sync= false)
|
|
|
138
138
|
|
|
139
139
|
return response.data;
|
|
140
140
|
} catch (e: any) {
|
|
141
|
-
throw new KonversiError(e);
|
|
141
|
+
throw new KonversiError(e.message + `${e.response?.status} ${e.response?.data}`);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@konversi/konversi-client",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.7",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
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
|
+
},
|
|
7
12
|
"keywords": [],
|
|
8
13
|
"author": "",
|
|
9
14
|
"license": "ISC",
|
|
@@ -16,9 +21,5 @@
|
|
|
16
21
|
"tsup": "^8.2.4",
|
|
17
22
|
"typescript": "^5.4.5"
|
|
18
23
|
},
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
"build": "tsup index.ts --format cjs,esm --dts",
|
|
22
|
-
"lint": "tsc"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
24
|
+
"packageManager": "pnpm@10.6.5+sha512.cdf928fca20832cd59ec53826492b7dc25dc524d4370b6b4adbf65803d32efaa6c1c88147c0ae4e8d579a6c9eec715757b50d4fa35eea179d868eada4ed043af"
|
|
25
|
+
}
|