@konversi/konversi-client 1.5.11 → 1.5.12

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 +52 -132
  2. package/dist/index.mjs +52 -132
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -361,26 +361,6 @@ var RULE = "rules-engine/rule";
361
361
  var INCOMING_SHIPMENT = "shipment/incoming-shipment";
362
362
  var OUTGOING_SHIPMENT = "shipment/outgoing-shipment";
363
363
 
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
364
  // generated/modules/index.ts
385
365
  var modules_exports = {};
386
366
  __export(modules_exports, {
@@ -4279,160 +4259,100 @@ function call(axiosRequest) {
4279
4259
  }
4280
4260
  function getAllCustomObjects(_0) {
4281
4261
  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);
4262
+ const response = yield axiosAPI_default.request({
4263
+ method: "get",
4264
+ url: `custom-entity/object/${schemaName}`,
4265
+ params: queryParams
4266
+ });
4267
+ if (Array.isArray(response.data)) {
4268
+ return response.data;
4269
+ } else {
4270
+ return response.data.data;
4296
4271
  }
4297
4272
  });
4298
4273
  }
4299
4274
  function getCustomObjectById(schemaName, id) {
4300
4275
  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
- }
4276
+ const response = yield axiosAPI_default.request({
4277
+ method: "get",
4278
+ url: `custom-entity/object/${schemaName}/${id}`
4279
+ });
4280
+ return response.data;
4311
4281
  });
4312
4282
  }
4313
4283
  function updateCustomObject(schemaName, id, newData) {
4314
4284
  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
- }
4285
+ const response = yield axiosAPI_default.request({
4286
+ method: "put",
4287
+ url: `custom-entity/object/${schemaName}/${id}`,
4288
+ headers: {
4289
+ "Content-Type": "application/json"
4290
+ },
4291
+ data: JSON.stringify(newData)
4292
+ });
4293
+ return response.data;
4329
4294
  });
4330
4295
  }
4331
4296
  function createCustomObject(schemaName, data) {
4332
4297
  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
- }
4298
+ const response = yield axiosAPI_default.request({
4299
+ method: "post",
4300
+ url: `custom-entity/object/${schemaName}`,
4301
+ data
4302
+ });
4303
+ return response.data;
4344
4304
  });
4345
4305
  }
4346
4306
  function deleteCustomObject(schemaName, id) {
4347
4307
  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
- }
4308
+ const response = yield axiosAPI_default.request({
4309
+ method: "delete",
4310
+ maxBodyLength: Infinity,
4311
+ url: `custom-entity/object/${schemaName}/${id}`
4312
+ });
4313
+ return response.data;
4359
4314
  });
4360
4315
  }
4361
4316
  function getAllObjects(_0) {
4362
4317
  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
- }
4318
+ const response = yield axiosAPI_default.get(`${entity}`, {
4319
+ params: queryParams
4320
+ });
4321
+ return response.data;
4372
4322
  });
4373
4323
  }
4374
4324
  function getObjectById(entity, id) {
4375
4325
  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
- }
4326
+ const response = yield axiosAPI_default.get(`${entity}/${id}`);
4327
+ return response.data;
4383
4328
  });
4384
4329
  }
4385
4330
  function updateObject(entity, id, newData) {
4386
4331
  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
- }
4332
+ const response = yield axiosAPI_default.put(`${entity}/${id}`, newData);
4333
+ return response.data;
4394
4334
  });
4395
4335
  }
4396
4336
  function createObject(entity, data) {
4397
4337
  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
- }
4338
+ const response = yield axiosAPI_default.post(`${entity}`, data);
4339
+ return response.data;
4405
4340
  });
4406
4341
  }
4407
4342
  function deleteObject(entity, id) {
4408
4343
  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
- }
4344
+ const response = yield axiosAPI_default.delete(`${entity}/${id}`);
4345
+ return response.data;
4416
4346
  });
4417
4347
  }
4418
4348
  function runScript(scriptNameOrId, input, sync = false) {
4419
4349
  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);
4350
+ if (sync) {
4351
+ const response2 = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run?mode=sync`, { input });
4352
+ return response2.data;
4435
4353
  }
4354
+ const response = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run`, { input });
4355
+ return response.data;
4436
4356
  });
4437
4357
  }
4438
4358
  var konversiAPI = __spreadValues({
package/dist/index.mjs CHANGED
@@ -323,26 +323,6 @@ var RULE = "rules-engine/rule";
323
323
  var INCOMING_SHIPMENT = "shipment/incoming-shipment";
324
324
  var OUTGOING_SHIPMENT = "shipment/outgoing-shipment";
325
325
 
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
326
  // generated/modules/index.ts
347
327
  var modules_exports = {};
348
328
  __export(modules_exports, {
@@ -4241,160 +4221,100 @@ function call(axiosRequest) {
4241
4221
  }
4242
4222
  function getAllCustomObjects(_0) {
4243
4223
  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);
4224
+ const response = yield axiosAPI_default.request({
4225
+ method: "get",
4226
+ url: `custom-entity/object/${schemaName}`,
4227
+ params: queryParams
4228
+ });
4229
+ if (Array.isArray(response.data)) {
4230
+ return response.data;
4231
+ } else {
4232
+ return response.data.data;
4258
4233
  }
4259
4234
  });
4260
4235
  }
4261
4236
  function getCustomObjectById(schemaName, id) {
4262
4237
  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
- }
4238
+ const response = yield axiosAPI_default.request({
4239
+ method: "get",
4240
+ url: `custom-entity/object/${schemaName}/${id}`
4241
+ });
4242
+ return response.data;
4273
4243
  });
4274
4244
  }
4275
4245
  function updateCustomObject(schemaName, id, newData) {
4276
4246
  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
- }
4247
+ const response = yield axiosAPI_default.request({
4248
+ method: "put",
4249
+ url: `custom-entity/object/${schemaName}/${id}`,
4250
+ headers: {
4251
+ "Content-Type": "application/json"
4252
+ },
4253
+ data: JSON.stringify(newData)
4254
+ });
4255
+ return response.data;
4291
4256
  });
4292
4257
  }
4293
4258
  function createCustomObject(schemaName, data) {
4294
4259
  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
- }
4260
+ const response = yield axiosAPI_default.request({
4261
+ method: "post",
4262
+ url: `custom-entity/object/${schemaName}`,
4263
+ data
4264
+ });
4265
+ return response.data;
4306
4266
  });
4307
4267
  }
4308
4268
  function deleteCustomObject(schemaName, id) {
4309
4269
  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
- }
4270
+ const response = yield axiosAPI_default.request({
4271
+ method: "delete",
4272
+ maxBodyLength: Infinity,
4273
+ url: `custom-entity/object/${schemaName}/${id}`
4274
+ });
4275
+ return response.data;
4321
4276
  });
4322
4277
  }
4323
4278
  function getAllObjects(_0) {
4324
4279
  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
- }
4280
+ const response = yield axiosAPI_default.get(`${entity}`, {
4281
+ params: queryParams
4282
+ });
4283
+ return response.data;
4334
4284
  });
4335
4285
  }
4336
4286
  function getObjectById(entity, id) {
4337
4287
  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
- }
4288
+ const response = yield axiosAPI_default.get(`${entity}/${id}`);
4289
+ return response.data;
4345
4290
  });
4346
4291
  }
4347
4292
  function updateObject(entity, id, newData) {
4348
4293
  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
- }
4294
+ const response = yield axiosAPI_default.put(`${entity}/${id}`, newData);
4295
+ return response.data;
4356
4296
  });
4357
4297
  }
4358
4298
  function createObject(entity, data) {
4359
4299
  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
- }
4300
+ const response = yield axiosAPI_default.post(`${entity}`, data);
4301
+ return response.data;
4367
4302
  });
4368
4303
  }
4369
4304
  function deleteObject(entity, id) {
4370
4305
  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
- }
4306
+ const response = yield axiosAPI_default.delete(`${entity}/${id}`);
4307
+ return response.data;
4378
4308
  });
4379
4309
  }
4380
4310
  function runScript(scriptNameOrId, input, sync = false) {
4381
4311
  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);
4312
+ if (sync) {
4313
+ const response2 = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run?mode=sync`, { input });
4314
+ return response2.data;
4397
4315
  }
4316
+ const response = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run`, { input });
4317
+ return response.data;
4398
4318
  });
4399
4319
  }
4400
4320
  var konversiAPI = __spreadValues({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konversi/konversi-client",
3
- "version": "1.5.11",
3
+ "version": "1.5.12",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",