@konversi/konversi-client 1.4.7 → 1.4.9
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 +27 -1
- package/dist/index.js +25 -12
- package/dist/index.mjs +25 -12
- package/index.ts +11 -11
- package/package.json +1 -1
package/KonversiError.ts
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
export default class KonversiError extends Error {
|
|
2
|
-
|
|
2
|
+
originalError?: Error;
|
|
3
|
+
|
|
4
|
+
constructor(message: string, originalError?: Error) {
|
|
3
5
|
super(message);
|
|
6
|
+
|
|
7
|
+
this.originalError = originalError;
|
|
8
|
+
|
|
9
|
+
// Type assertion to access captureStackTrace which exists in Node.js
|
|
10
|
+
const errorConstructor = Error as any;
|
|
11
|
+
if (errorConstructor.captureStackTrace) {
|
|
12
|
+
errorConstructor.captureStackTrace(this, this.constructor);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (originalError?.stack) {
|
|
16
|
+
// Filter the stack trace to show only application code
|
|
17
|
+
const filteredStack = originalError.stack
|
|
18
|
+
.split('\n')
|
|
19
|
+
.filter(line =>
|
|
20
|
+
!line.includes('node_modules') &&
|
|
21
|
+
!line.includes('(node:') &&
|
|
22
|
+
!line.includes('node:internal/')
|
|
23
|
+
)
|
|
24
|
+
.join('\n');
|
|
25
|
+
|
|
26
|
+
this.stack = `${this.stack}\nCaused by: ${filteredStack}`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
this.name = this.constructor.name;
|
|
4
30
|
}
|
|
5
31
|
}
|
package/dist/index.js
CHANGED
|
@@ -246,8 +246,21 @@ var OUTGOING_SHIPMENT = "shipment/outgoing-shipment";
|
|
|
246
246
|
|
|
247
247
|
// KonversiError.ts
|
|
248
248
|
var KonversiError = class extends Error {
|
|
249
|
-
constructor(message) {
|
|
249
|
+
constructor(message, originalError) {
|
|
250
250
|
super(message);
|
|
251
|
+
this.originalError = originalError;
|
|
252
|
+
const errorConstructor = Error;
|
|
253
|
+
if (errorConstructor.captureStackTrace) {
|
|
254
|
+
errorConstructor.captureStackTrace(this, this.constructor);
|
|
255
|
+
}
|
|
256
|
+
if (originalError == null ? void 0 : originalError.stack) {
|
|
257
|
+
const filteredStack = originalError.stack.split("\n").filter(
|
|
258
|
+
(line) => !line.includes("node_modules") && !line.includes("(node:") && !line.includes("node:internal/")
|
|
259
|
+
).join("\n");
|
|
260
|
+
this.stack = `${this.stack}
|
|
261
|
+
Caused by: ${filteredStack}`;
|
|
262
|
+
}
|
|
263
|
+
this.name = this.constructor.name;
|
|
251
264
|
}
|
|
252
265
|
};
|
|
253
266
|
|
|
@@ -268,7 +281,7 @@ function getAllCustomObjects(_0) {
|
|
|
268
281
|
});
|
|
269
282
|
return response.data;
|
|
270
283
|
} catch (e) {
|
|
271
|
-
throw new KonversiError(e.message +
|
|
284
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
272
285
|
}
|
|
273
286
|
});
|
|
274
287
|
}
|
|
@@ -282,7 +295,7 @@ function getCustomObjectById(schemaName, id) {
|
|
|
282
295
|
});
|
|
283
296
|
return response.data;
|
|
284
297
|
} catch (e) {
|
|
285
|
-
throw new KonversiError(e.message +
|
|
298
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
286
299
|
}
|
|
287
300
|
});
|
|
288
301
|
}
|
|
@@ -300,7 +313,7 @@ function updateCustomObject(schemaName, id, newData) {
|
|
|
300
313
|
});
|
|
301
314
|
return response.data;
|
|
302
315
|
} catch (e) {
|
|
303
|
-
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}
|
|
316
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
304
317
|
}
|
|
305
318
|
});
|
|
306
319
|
}
|
|
@@ -315,7 +328,7 @@ function createCustomObject(schemaName, data) {
|
|
|
315
328
|
});
|
|
316
329
|
return response.data;
|
|
317
330
|
} catch (e) {
|
|
318
|
-
throw new KonversiError(e.message +
|
|
331
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
319
332
|
}
|
|
320
333
|
});
|
|
321
334
|
}
|
|
@@ -330,7 +343,7 @@ function deleteCustomObject(schemaName, id) {
|
|
|
330
343
|
});
|
|
331
344
|
return response.data;
|
|
332
345
|
} catch (e) {
|
|
333
|
-
throw new KonversiError(e.message +
|
|
346
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
334
347
|
}
|
|
335
348
|
});
|
|
336
349
|
}
|
|
@@ -343,7 +356,7 @@ function getAllObjects(_0) {
|
|
|
343
356
|
});
|
|
344
357
|
return response.data;
|
|
345
358
|
} catch (e) {
|
|
346
|
-
throw new KonversiError(e.message +
|
|
359
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
347
360
|
}
|
|
348
361
|
});
|
|
349
362
|
}
|
|
@@ -354,7 +367,7 @@ function getObjectById(entity, id) {
|
|
|
354
367
|
const response = yield axiosAPI_default.get(`${entity}/${id}`);
|
|
355
368
|
return response.data;
|
|
356
369
|
} catch (e) {
|
|
357
|
-
throw new KonversiError(e.message +
|
|
370
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
358
371
|
}
|
|
359
372
|
});
|
|
360
373
|
}
|
|
@@ -365,7 +378,7 @@ function updateObject(entity, id, newData) {
|
|
|
365
378
|
const response = yield axiosAPI_default.put(`${entity}/${id}`, newData);
|
|
366
379
|
return response.data;
|
|
367
380
|
} catch (e) {
|
|
368
|
-
throw new KonversiError(e.message +
|
|
381
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
369
382
|
}
|
|
370
383
|
});
|
|
371
384
|
}
|
|
@@ -376,7 +389,7 @@ function createObject(entity, data) {
|
|
|
376
389
|
const response = yield axiosAPI_default.post(`${entity}`, data);
|
|
377
390
|
return response.data;
|
|
378
391
|
} catch (e) {
|
|
379
|
-
throw new KonversiError(e.message +
|
|
392
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
380
393
|
}
|
|
381
394
|
});
|
|
382
395
|
}
|
|
@@ -387,7 +400,7 @@ function deleteObject(entity, id) {
|
|
|
387
400
|
const response = yield axiosAPI_default.delete(`${entity}/${id}`);
|
|
388
401
|
return response.data;
|
|
389
402
|
} catch (e) {
|
|
390
|
-
throw new KonversiError(e.message +
|
|
403
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
391
404
|
}
|
|
392
405
|
});
|
|
393
406
|
}
|
|
@@ -402,7 +415,7 @@ function runScript(scriptNameOrId, input, sync = false) {
|
|
|
402
415
|
const response = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run`, { input });
|
|
403
416
|
return response.data;
|
|
404
417
|
} catch (e) {
|
|
405
|
-
throw new KonversiError(e.message +
|
|
418
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
406
419
|
}
|
|
407
420
|
});
|
|
408
421
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -214,8 +214,21 @@ var OUTGOING_SHIPMENT = "shipment/outgoing-shipment";
|
|
|
214
214
|
|
|
215
215
|
// KonversiError.ts
|
|
216
216
|
var KonversiError = class extends Error {
|
|
217
|
-
constructor(message) {
|
|
217
|
+
constructor(message, originalError) {
|
|
218
218
|
super(message);
|
|
219
|
+
this.originalError = originalError;
|
|
220
|
+
const errorConstructor = Error;
|
|
221
|
+
if (errorConstructor.captureStackTrace) {
|
|
222
|
+
errorConstructor.captureStackTrace(this, this.constructor);
|
|
223
|
+
}
|
|
224
|
+
if (originalError == null ? void 0 : originalError.stack) {
|
|
225
|
+
const filteredStack = originalError.stack.split("\n").filter(
|
|
226
|
+
(line) => !line.includes("node_modules") && !line.includes("(node:") && !line.includes("node:internal/")
|
|
227
|
+
).join("\n");
|
|
228
|
+
this.stack = `${this.stack}
|
|
229
|
+
Caused by: ${filteredStack}`;
|
|
230
|
+
}
|
|
231
|
+
this.name = this.constructor.name;
|
|
219
232
|
}
|
|
220
233
|
};
|
|
221
234
|
|
|
@@ -236,7 +249,7 @@ function getAllCustomObjects(_0) {
|
|
|
236
249
|
});
|
|
237
250
|
return response.data;
|
|
238
251
|
} catch (e) {
|
|
239
|
-
throw new KonversiError(e.message +
|
|
252
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
240
253
|
}
|
|
241
254
|
});
|
|
242
255
|
}
|
|
@@ -250,7 +263,7 @@ function getCustomObjectById(schemaName, id) {
|
|
|
250
263
|
});
|
|
251
264
|
return response.data;
|
|
252
265
|
} catch (e) {
|
|
253
|
-
throw new KonversiError(e.message +
|
|
266
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
254
267
|
}
|
|
255
268
|
});
|
|
256
269
|
}
|
|
@@ -268,7 +281,7 @@ function updateCustomObject(schemaName, id, newData) {
|
|
|
268
281
|
});
|
|
269
282
|
return response.data;
|
|
270
283
|
} catch (e) {
|
|
271
|
-
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${(_b = e.response) == null ? void 0 : _b.data}
|
|
284
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
272
285
|
}
|
|
273
286
|
});
|
|
274
287
|
}
|
|
@@ -283,7 +296,7 @@ function createCustomObject(schemaName, data) {
|
|
|
283
296
|
});
|
|
284
297
|
return response.data;
|
|
285
298
|
} catch (e) {
|
|
286
|
-
throw new KonversiError(e.message +
|
|
299
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
287
300
|
}
|
|
288
301
|
});
|
|
289
302
|
}
|
|
@@ -298,7 +311,7 @@ function deleteCustomObject(schemaName, id) {
|
|
|
298
311
|
});
|
|
299
312
|
return response.data;
|
|
300
313
|
} catch (e) {
|
|
301
|
-
throw new KonversiError(e.message +
|
|
314
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
302
315
|
}
|
|
303
316
|
});
|
|
304
317
|
}
|
|
@@ -311,7 +324,7 @@ function getAllObjects(_0) {
|
|
|
311
324
|
});
|
|
312
325
|
return response.data;
|
|
313
326
|
} catch (e) {
|
|
314
|
-
throw new KonversiError(e.message +
|
|
327
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
315
328
|
}
|
|
316
329
|
});
|
|
317
330
|
}
|
|
@@ -322,7 +335,7 @@ function getObjectById(entity, id) {
|
|
|
322
335
|
const response = yield axiosAPI_default.get(`${entity}/${id}`);
|
|
323
336
|
return response.data;
|
|
324
337
|
} catch (e) {
|
|
325
|
-
throw new KonversiError(e.message +
|
|
338
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
326
339
|
}
|
|
327
340
|
});
|
|
328
341
|
}
|
|
@@ -333,7 +346,7 @@ function updateObject(entity, id, newData) {
|
|
|
333
346
|
const response = yield axiosAPI_default.put(`${entity}/${id}`, newData);
|
|
334
347
|
return response.data;
|
|
335
348
|
} catch (e) {
|
|
336
|
-
throw new KonversiError(e.message +
|
|
349
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
337
350
|
}
|
|
338
351
|
});
|
|
339
352
|
}
|
|
@@ -344,7 +357,7 @@ function createObject(entity, data) {
|
|
|
344
357
|
const response = yield axiosAPI_default.post(`${entity}`, data);
|
|
345
358
|
return response.data;
|
|
346
359
|
} catch (e) {
|
|
347
|
-
throw new KonversiError(e.message +
|
|
360
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
348
361
|
}
|
|
349
362
|
});
|
|
350
363
|
}
|
|
@@ -355,7 +368,7 @@ function deleteObject(entity, id) {
|
|
|
355
368
|
const response = yield axiosAPI_default.delete(`${entity}/${id}`);
|
|
356
369
|
return response.data;
|
|
357
370
|
} catch (e) {
|
|
358
|
-
throw new KonversiError(e.message +
|
|
371
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
359
372
|
}
|
|
360
373
|
});
|
|
361
374
|
}
|
|
@@ -370,7 +383,7 @@ function runScript(scriptNameOrId, input, sync = false) {
|
|
|
370
383
|
const response = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run`, { input });
|
|
371
384
|
return response.data;
|
|
372
385
|
} catch (e) {
|
|
373
|
-
throw new KonversiError(e.message +
|
|
386
|
+
throw new KonversiError(e.message + ` ${(_a2 = e.response) == null ? void 0 : _a2.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
|
|
374
387
|
}
|
|
375
388
|
});
|
|
376
389
|
}
|
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.message +
|
|
20
|
+
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
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.message +
|
|
32
|
+
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
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.message + ` ${e.response?.status} ${e.response?.data}
|
|
48
|
+
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
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.message +
|
|
62
|
+
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
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.message +
|
|
75
|
+
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
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.message +
|
|
88
|
+
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
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.message +
|
|
97
|
+
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
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.message +
|
|
106
|
+
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
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.message +
|
|
116
|
+
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
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.message +
|
|
126
|
+
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
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.message +
|
|
141
|
+
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
|