@konversi/konversi-client 1.5.11 → 1.5.13

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 (3) hide show
  1. package/dist/index.js +72 -139
  2. package/dist/index.mjs +72 -139
  3. package/package.json +27 -28
package/dist/index.js CHANGED
@@ -85,16 +85,29 @@ var instance = import_axios.default.create({
85
85
  baseURL,
86
86
  timeout
87
87
  });
88
+ var MAX_RETRIES = 36;
89
+ var RETRY_DELAY_MS = 5e3;
88
90
  instance.interceptors.response.use(
89
91
  (response) => response,
90
- (error) => {
91
- var _a, _b, _c, _d, _e;
92
+ (error) => __async(null, null, function* () {
93
+ var _a, _b, _c, _d, _e, _f;
94
+ const config = error.config;
95
+ if (config) {
96
+ config.retryCount = (_a = config.retryCount) != null ? _a : 0;
97
+ const isNetworkError = !error.response && (error.code === "ECONNREFUSED" || error.code === "ENOTFOUND" || error.code === "ECONNRESET" || error.code === "ETIMEDOUT");
98
+ if (isNetworkError && config.retryCount < MAX_RETRIES) {
99
+ config.retryCount++;
100
+ console.log(`API unreachable (${error.code}). Retrying...`);
101
+ yield new Promise((resolve) => setTimeout(resolve, RETRY_DELAY_MS));
102
+ return instance(config);
103
+ }
104
+ }
92
105
  if (error.isAxiosError) {
93
- const method = (_b = (_a = error.config) == null ? void 0 : _a.method) == null ? void 0 : _b.toUpperCase();
94
- const url = (_c = error.config) == null ? void 0 : _c.url;
95
- const status = (_d = error.response) == null ? void 0 : _d.status;
106
+ const method = (_c = (_b = error.config) == null ? void 0 : _b.method) == null ? void 0 : _c.toUpperCase();
107
+ const url = (_d = error.config) == null ? void 0 : _d.url;
108
+ const status = (_e = error.response) == null ? void 0 : _e.status;
96
109
  const message = error.message;
97
- const responseBody = (_e = error.response) == null ? void 0 : _e.data;
110
+ const responseBody = (_f = error.response) == null ? void 0 : _f.data;
98
111
  const cleanError = new Error(
99
112
  [
100
113
  `Konversi call failed`,
@@ -109,7 +122,7 @@ instance.interceptors.response.use(
109
122
  return Promise.reject(cleanError);
110
123
  }
111
124
  return Promise.reject(error);
112
- }
125
+ })
113
126
  );
114
127
  var setBaseUrl = (baseUrl) => {
115
128
  instance.defaults.baseURL = baseUrl;
@@ -361,26 +374,6 @@ var RULE = "rules-engine/rule";
361
374
  var INCOMING_SHIPMENT = "shipment/incoming-shipment";
362
375
  var OUTGOING_SHIPMENT = "shipment/outgoing-shipment";
363
376
 
364
- // KonversiError.ts
365
- var KonversiError = class extends Error {
366
- constructor(message, originalError) {
367
- super(message);
368
- this.originalError = originalError;
369
- const errorConstructor = Error;
370
- if (errorConstructor.captureStackTrace) {
371
- errorConstructor.captureStackTrace(this, this.constructor);
372
- }
373
- if (originalError == null ? void 0 : originalError.stack) {
374
- const filteredStack = originalError.stack.split("\n").filter(
375
- (line) => !line.includes("node_modules") && !line.includes("(node:") && !line.includes("node:internal/")
376
- ).join("\n");
377
- this.stack = `${this.stack}
378
- Caused by: ${filteredStack}`;
379
- }
380
- this.name = this.constructor.name;
381
- }
382
- };
383
-
384
377
  // generated/modules/index.ts
385
378
  var modules_exports = {};
386
379
  __export(modules_exports, {
@@ -4279,160 +4272,100 @@ function call(axiosRequest) {
4279
4272
  }
4280
4273
  function getAllCustomObjects(_0) {
4281
4274
  return __async(this, arguments, function* (schemaName, queryParams = {}) {
4282
- var _a, _b;
4283
- try {
4284
- const response = yield axiosAPI_default.request({
4285
- method: "get",
4286
- url: `custom-entity/object/${schemaName}`,
4287
- params: queryParams
4288
- });
4289
- if (Array.isArray(response.data)) {
4290
- return response.data;
4291
- } else {
4292
- return response.data.data;
4293
- }
4294
- } catch (e) {
4295
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4275
+ const response = yield axiosAPI_default.request({
4276
+ method: "get",
4277
+ url: `custom-entity/object/${schemaName}`,
4278
+ params: queryParams
4279
+ });
4280
+ if (Array.isArray(response.data)) {
4281
+ return response.data;
4282
+ } else {
4283
+ return response.data.data;
4296
4284
  }
4297
4285
  });
4298
4286
  }
4299
4287
  function getCustomObjectById(schemaName, id) {
4300
4288
  return __async(this, null, function* () {
4301
- var _a, _b;
4302
- try {
4303
- const response = yield axiosAPI_default.request({
4304
- method: "get",
4305
- url: `custom-entity/object/${schemaName}/${id}`
4306
- });
4307
- return response.data;
4308
- } catch (e) {
4309
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4310
- }
4289
+ const response = yield axiosAPI_default.request({
4290
+ method: "get",
4291
+ url: `custom-entity/object/${schemaName}/${id}`
4292
+ });
4293
+ return response.data;
4311
4294
  });
4312
4295
  }
4313
4296
  function updateCustomObject(schemaName, id, newData) {
4314
4297
  return __async(this, null, function* () {
4315
- var _a, _b;
4316
- try {
4317
- const response = yield axiosAPI_default.request({
4318
- method: "put",
4319
- url: `custom-entity/object/${schemaName}/${id}`,
4320
- headers: {
4321
- "Content-Type": "application/json"
4322
- },
4323
- data: JSON.stringify(newData)
4324
- });
4325
- return response.data;
4326
- } catch (e) {
4327
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4328
- }
4298
+ const response = yield axiosAPI_default.request({
4299
+ method: "put",
4300
+ url: `custom-entity/object/${schemaName}/${id}`,
4301
+ headers: {
4302
+ "Content-Type": "application/json"
4303
+ },
4304
+ data: JSON.stringify(newData)
4305
+ });
4306
+ return response.data;
4329
4307
  });
4330
4308
  }
4331
4309
  function createCustomObject(schemaName, data) {
4332
4310
  return __async(this, null, function* () {
4333
- var _a, _b;
4334
- try {
4335
- const response = yield axiosAPI_default.request({
4336
- method: "post",
4337
- url: `custom-entity/object/${schemaName}`,
4338
- data
4339
- });
4340
- return response.data;
4341
- } catch (e) {
4342
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4343
- }
4311
+ const response = yield axiosAPI_default.request({
4312
+ method: "post",
4313
+ url: `custom-entity/object/${schemaName}`,
4314
+ data
4315
+ });
4316
+ return response.data;
4344
4317
  });
4345
4318
  }
4346
4319
  function deleteCustomObject(schemaName, id) {
4347
4320
  return __async(this, null, function* () {
4348
- var _a, _b;
4349
- try {
4350
- const response = yield axiosAPI_default.request({
4351
- method: "delete",
4352
- maxBodyLength: Infinity,
4353
- url: `custom-entity/object/${schemaName}/${id}`
4354
- });
4355
- return response.data;
4356
- } catch (e) {
4357
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4358
- }
4321
+ const response = yield axiosAPI_default.request({
4322
+ method: "delete",
4323
+ maxBodyLength: Infinity,
4324
+ url: `custom-entity/object/${schemaName}/${id}`
4325
+ });
4326
+ return response.data;
4359
4327
  });
4360
4328
  }
4361
4329
  function getAllObjects(_0) {
4362
4330
  return __async(this, arguments, function* (entity, queryParams = {}) {
4363
- var _a, _b;
4364
- try {
4365
- const response = yield axiosAPI_default.get(`${entity}`, {
4366
- params: queryParams
4367
- });
4368
- return response.data;
4369
- } catch (e) {
4370
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4371
- }
4331
+ const response = yield axiosAPI_default.get(`${entity}`, {
4332
+ params: queryParams
4333
+ });
4334
+ return response.data;
4372
4335
  });
4373
4336
  }
4374
4337
  function getObjectById(entity, id) {
4375
4338
  return __async(this, null, function* () {
4376
- var _a, _b;
4377
- try {
4378
- const response = yield axiosAPI_default.get(`${entity}/${id}`);
4379
- return response.data;
4380
- } catch (e) {
4381
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4382
- }
4339
+ const response = yield axiosAPI_default.get(`${entity}/${id}`);
4340
+ return response.data;
4383
4341
  });
4384
4342
  }
4385
4343
  function updateObject(entity, id, newData) {
4386
4344
  return __async(this, null, function* () {
4387
- var _a, _b;
4388
- try {
4389
- const response = yield axiosAPI_default.put(`${entity}/${id}`, newData);
4390
- return response.data;
4391
- } catch (e) {
4392
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4393
- }
4345
+ const response = yield axiosAPI_default.put(`${entity}/${id}`, newData);
4346
+ return response.data;
4394
4347
  });
4395
4348
  }
4396
4349
  function createObject(entity, data) {
4397
4350
  return __async(this, null, function* () {
4398
- var _a, _b;
4399
- try {
4400
- const response = yield axiosAPI_default.post(`${entity}`, data);
4401
- return response.data;
4402
- } catch (e) {
4403
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4404
- }
4351
+ const response = yield axiosAPI_default.post(`${entity}`, data);
4352
+ return response.data;
4405
4353
  });
4406
4354
  }
4407
4355
  function deleteObject(entity, id) {
4408
4356
  return __async(this, null, function* () {
4409
- var _a, _b;
4410
- try {
4411
- const response = yield axiosAPI_default.delete(`${entity}/${id}`);
4412
- return response.data;
4413
- } catch (e) {
4414
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4415
- }
4357
+ const response = yield axiosAPI_default.delete(`${entity}/${id}`);
4358
+ return response.data;
4416
4359
  });
4417
4360
  }
4418
4361
  function runScript(scriptNameOrId, input, sync = false) {
4419
4362
  return __async(this, null, function* () {
4420
- var _a, _b, _c, _d, _e;
4421
- try {
4422
- if (sync) {
4423
- const response2 = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run?mode=sync`, { input });
4424
- return response2.data;
4425
- }
4426
- const response = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run`, { input });
4427
- return response.data;
4428
- } catch (e) {
4429
- let errorMessage = e.message;
4430
- errorMessage = ((_b = (_a = e == null ? void 0 : e.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || errorMessage;
4431
- if (((_c = e.response) == null ? void 0 : _c.status) === 422) {
4432
- errorMessage = (_e = (_d = e.response) == null ? void 0 : _d.data) == null ? void 0 : _e.errorMessage;
4433
- }
4434
- throw new KonversiError(errorMessage, e);
4363
+ if (sync) {
4364
+ const response2 = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run?mode=sync`, { input });
4365
+ return response2.data;
4435
4366
  }
4367
+ const response = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run`, { input });
4368
+ return response.data;
4436
4369
  });
4437
4370
  }
4438
4371
  var konversiAPI = __spreadValues({
package/dist/index.mjs CHANGED
@@ -47,16 +47,29 @@ var instance = axios.create({
47
47
  baseURL,
48
48
  timeout
49
49
  });
50
+ var MAX_RETRIES = 36;
51
+ var RETRY_DELAY_MS = 5e3;
50
52
  instance.interceptors.response.use(
51
53
  (response) => response,
52
- (error) => {
53
- var _a, _b, _c, _d, _e;
54
+ (error) => __async(null, null, function* () {
55
+ var _a, _b, _c, _d, _e, _f;
56
+ const config = error.config;
57
+ if (config) {
58
+ config.retryCount = (_a = config.retryCount) != null ? _a : 0;
59
+ const isNetworkError = !error.response && (error.code === "ECONNREFUSED" || error.code === "ENOTFOUND" || error.code === "ECONNRESET" || error.code === "ETIMEDOUT");
60
+ if (isNetworkError && config.retryCount < MAX_RETRIES) {
61
+ config.retryCount++;
62
+ console.log(`API unreachable (${error.code}). Retrying...`);
63
+ yield new Promise((resolve) => setTimeout(resolve, RETRY_DELAY_MS));
64
+ return instance(config);
65
+ }
66
+ }
54
67
  if (error.isAxiosError) {
55
- const method = (_b = (_a = error.config) == null ? void 0 : _a.method) == null ? void 0 : _b.toUpperCase();
56
- const url = (_c = error.config) == null ? void 0 : _c.url;
57
- const status = (_d = error.response) == null ? void 0 : _d.status;
68
+ const method = (_c = (_b = error.config) == null ? void 0 : _b.method) == null ? void 0 : _c.toUpperCase();
69
+ const url = (_d = error.config) == null ? void 0 : _d.url;
70
+ const status = (_e = error.response) == null ? void 0 : _e.status;
58
71
  const message = error.message;
59
- const responseBody = (_e = error.response) == null ? void 0 : _e.data;
72
+ const responseBody = (_f = error.response) == null ? void 0 : _f.data;
60
73
  const cleanError = new Error(
61
74
  [
62
75
  `Konversi call failed`,
@@ -71,7 +84,7 @@ instance.interceptors.response.use(
71
84
  return Promise.reject(cleanError);
72
85
  }
73
86
  return Promise.reject(error);
74
- }
87
+ })
75
88
  );
76
89
  var setBaseUrl = (baseUrl) => {
77
90
  instance.defaults.baseURL = baseUrl;
@@ -323,26 +336,6 @@ var RULE = "rules-engine/rule";
323
336
  var INCOMING_SHIPMENT = "shipment/incoming-shipment";
324
337
  var OUTGOING_SHIPMENT = "shipment/outgoing-shipment";
325
338
 
326
- // KonversiError.ts
327
- var KonversiError = class extends Error {
328
- constructor(message, originalError) {
329
- super(message);
330
- this.originalError = originalError;
331
- const errorConstructor = Error;
332
- if (errorConstructor.captureStackTrace) {
333
- errorConstructor.captureStackTrace(this, this.constructor);
334
- }
335
- if (originalError == null ? void 0 : originalError.stack) {
336
- const filteredStack = originalError.stack.split("\n").filter(
337
- (line) => !line.includes("node_modules") && !line.includes("(node:") && !line.includes("node:internal/")
338
- ).join("\n");
339
- this.stack = `${this.stack}
340
- Caused by: ${filteredStack}`;
341
- }
342
- this.name = this.constructor.name;
343
- }
344
- };
345
-
346
339
  // generated/modules/index.ts
347
340
  var modules_exports = {};
348
341
  __export(modules_exports, {
@@ -4241,160 +4234,100 @@ function call(axiosRequest) {
4241
4234
  }
4242
4235
  function getAllCustomObjects(_0) {
4243
4236
  return __async(this, arguments, function* (schemaName, queryParams = {}) {
4244
- var _a, _b;
4245
- try {
4246
- const response = yield axiosAPI_default.request({
4247
- method: "get",
4248
- url: `custom-entity/object/${schemaName}`,
4249
- params: queryParams
4250
- });
4251
- if (Array.isArray(response.data)) {
4252
- return response.data;
4253
- } else {
4254
- return response.data.data;
4255
- }
4256
- } catch (e) {
4257
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4237
+ const response = yield axiosAPI_default.request({
4238
+ method: "get",
4239
+ url: `custom-entity/object/${schemaName}`,
4240
+ params: queryParams
4241
+ });
4242
+ if (Array.isArray(response.data)) {
4243
+ return response.data;
4244
+ } else {
4245
+ return response.data.data;
4258
4246
  }
4259
4247
  });
4260
4248
  }
4261
4249
  function getCustomObjectById(schemaName, id) {
4262
4250
  return __async(this, null, function* () {
4263
- var _a, _b;
4264
- try {
4265
- const response = yield axiosAPI_default.request({
4266
- method: "get",
4267
- url: `custom-entity/object/${schemaName}/${id}`
4268
- });
4269
- return response.data;
4270
- } catch (e) {
4271
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4272
- }
4251
+ const response = yield axiosAPI_default.request({
4252
+ method: "get",
4253
+ url: `custom-entity/object/${schemaName}/${id}`
4254
+ });
4255
+ return response.data;
4273
4256
  });
4274
4257
  }
4275
4258
  function updateCustomObject(schemaName, id, newData) {
4276
4259
  return __async(this, null, function* () {
4277
- var _a, _b;
4278
- try {
4279
- const response = yield axiosAPI_default.request({
4280
- method: "put",
4281
- url: `custom-entity/object/${schemaName}/${id}`,
4282
- headers: {
4283
- "Content-Type": "application/json"
4284
- },
4285
- data: JSON.stringify(newData)
4286
- });
4287
- return response.data;
4288
- } catch (e) {
4289
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4290
- }
4260
+ const response = yield axiosAPI_default.request({
4261
+ method: "put",
4262
+ url: `custom-entity/object/${schemaName}/${id}`,
4263
+ headers: {
4264
+ "Content-Type": "application/json"
4265
+ },
4266
+ data: JSON.stringify(newData)
4267
+ });
4268
+ return response.data;
4291
4269
  });
4292
4270
  }
4293
4271
  function createCustomObject(schemaName, data) {
4294
4272
  return __async(this, null, function* () {
4295
- var _a, _b;
4296
- try {
4297
- const response = yield axiosAPI_default.request({
4298
- method: "post",
4299
- url: `custom-entity/object/${schemaName}`,
4300
- data
4301
- });
4302
- return response.data;
4303
- } catch (e) {
4304
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4305
- }
4273
+ const response = yield axiosAPI_default.request({
4274
+ method: "post",
4275
+ url: `custom-entity/object/${schemaName}`,
4276
+ data
4277
+ });
4278
+ return response.data;
4306
4279
  });
4307
4280
  }
4308
4281
  function deleteCustomObject(schemaName, id) {
4309
4282
  return __async(this, null, function* () {
4310
- var _a, _b;
4311
- try {
4312
- const response = yield axiosAPI_default.request({
4313
- method: "delete",
4314
- maxBodyLength: Infinity,
4315
- url: `custom-entity/object/${schemaName}/${id}`
4316
- });
4317
- return response.data;
4318
- } catch (e) {
4319
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4320
- }
4283
+ const response = yield axiosAPI_default.request({
4284
+ method: "delete",
4285
+ maxBodyLength: Infinity,
4286
+ url: `custom-entity/object/${schemaName}/${id}`
4287
+ });
4288
+ return response.data;
4321
4289
  });
4322
4290
  }
4323
4291
  function getAllObjects(_0) {
4324
4292
  return __async(this, arguments, function* (entity, queryParams = {}) {
4325
- var _a, _b;
4326
- try {
4327
- const response = yield axiosAPI_default.get(`${entity}`, {
4328
- params: queryParams
4329
- });
4330
- return response.data;
4331
- } catch (e) {
4332
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4333
- }
4293
+ const response = yield axiosAPI_default.get(`${entity}`, {
4294
+ params: queryParams
4295
+ });
4296
+ return response.data;
4334
4297
  });
4335
4298
  }
4336
4299
  function getObjectById(entity, id) {
4337
4300
  return __async(this, null, function* () {
4338
- var _a, _b;
4339
- try {
4340
- const response = yield axiosAPI_default.get(`${entity}/${id}`);
4341
- return response.data;
4342
- } catch (e) {
4343
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4344
- }
4301
+ const response = yield axiosAPI_default.get(`${entity}/${id}`);
4302
+ return response.data;
4345
4303
  });
4346
4304
  }
4347
4305
  function updateObject(entity, id, newData) {
4348
4306
  return __async(this, null, function* () {
4349
- var _a, _b;
4350
- try {
4351
- const response = yield axiosAPI_default.put(`${entity}/${id}`, newData);
4352
- return response.data;
4353
- } catch (e) {
4354
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4355
- }
4307
+ const response = yield axiosAPI_default.put(`${entity}/${id}`, newData);
4308
+ return response.data;
4356
4309
  });
4357
4310
  }
4358
4311
  function createObject(entity, data) {
4359
4312
  return __async(this, null, function* () {
4360
- var _a, _b;
4361
- try {
4362
- const response = yield axiosAPI_default.post(`${entity}`, data);
4363
- return response.data;
4364
- } catch (e) {
4365
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4366
- }
4313
+ const response = yield axiosAPI_default.post(`${entity}`, data);
4314
+ return response.data;
4367
4315
  });
4368
4316
  }
4369
4317
  function deleteObject(entity, id) {
4370
4318
  return __async(this, null, function* () {
4371
- var _a, _b;
4372
- try {
4373
- const response = yield axiosAPI_default.delete(`${entity}/${id}`);
4374
- return response.data;
4375
- } catch (e) {
4376
- throw new KonversiError(e.message + ` ${(_a = e.response) == null ? void 0 : _a.status} ${JSON.stringify((_b = e.response) == null ? void 0 : _b.data)}`, e);
4377
- }
4319
+ const response = yield axiosAPI_default.delete(`${entity}/${id}`);
4320
+ return response.data;
4378
4321
  });
4379
4322
  }
4380
4323
  function runScript(scriptNameOrId, input, sync = false) {
4381
4324
  return __async(this, null, function* () {
4382
- var _a, _b, _c, _d, _e;
4383
- try {
4384
- if (sync) {
4385
- const response2 = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run?mode=sync`, { input });
4386
- return response2.data;
4387
- }
4388
- const response = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run`, { input });
4389
- return response.data;
4390
- } catch (e) {
4391
- let errorMessage = e.message;
4392
- errorMessage = ((_b = (_a = e == null ? void 0 : e.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || errorMessage;
4393
- if (((_c = e.response) == null ? void 0 : _c.status) === 422) {
4394
- errorMessage = (_e = (_d = e.response) == null ? void 0 : _d.data) == null ? void 0 : _e.errorMessage;
4395
- }
4396
- throw new KonversiError(errorMessage, e);
4325
+ if (sync) {
4326
+ const response2 = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run?mode=sync`, { input });
4327
+ return response2.data;
4397
4328
  }
4329
+ const response = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run`, { input });
4330
+ return response.data;
4398
4331
  });
4399
4332
  }
4400
4333
  var konversiAPI = __spreadValues({
package/package.json CHANGED
@@ -1,28 +1,27 @@
1
- {
2
- "name": "@konversi/konversi-client",
3
- "version": "1.5.11",
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
- "files": [
25
- "dist"
26
- ],
27
- "packageManager": "pnpm@10.6.5+sha512.cdf928fca20832cd59ec53826492b7dc25dc524d4370b6b4adbf65803d32efaa6c1c88147c0ae4e8d579a6c9eec715757b50d4fa35eea179d868eada4ed043af"
28
- }
1
+ {
2
+ "name": "@konversi/konversi-client",
3
+ "version": "1.5.13",
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
+ "files": [
20
+ "dist"
21
+ ],
22
+ "scripts": {
23
+ "test": "echo \"Error: no test specified\" && exit 1",
24
+ "build": "tsup index.ts --format cjs,esm --dts",
25
+ "lint": "tsc"
26
+ }
27
+ }