flowcore-fn 9.5.1 → 9.5.3

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/dist/pkg-index.js CHANGED
@@ -5624,7 +5624,8 @@ function DocumentConfigTable({
5624
5624
  try {
5625
5625
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.getById;
5626
5626
  if (!endpoint) throw new Error("Document Configuration get-by-id endpoint is not configured.");
5627
- const result = await getApiService().get(buildGetByIdUrl(endpoint, item.id));
5627
+ const url = typeof endpoint === "function" ? endpoint(item.id) : buildGetByIdUrl(endpoint, item.id);
5628
+ const result = await getApiService().get(url);
5628
5629
  const value = (_h = (_g = (_f = (_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) != null ? _f : (_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) != null ? _g : result == null ? void 0 : result.data) != null ? _h : result;
5629
5630
  setSelectedItem(toUiItem(value != null ? value : item));
5630
5631
  setIsEditOpen(true);
@@ -5637,15 +5638,19 @@ function DocumentConfigTable({
5637
5638
  setIsDeleteOpen(true);
5638
5639
  };
5639
5640
  const handleSaveEdit = async (updatedData) => {
5640
- var _a, _b, _c, _d, _e;
5641
+ var _a, _b, _c, _d, _e, _f;
5641
5642
  try {
5642
5643
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.update;
5643
5644
  if (!endpoint) throw new Error("Document Configuration update endpoint is not configured.");
5645
+ const maxSizeMB = Number.parseFloat((_d = updatedData.maxSizeNum) != null ? _d : updatedData.maxSize);
5646
+ if (!Number.isFinite(maxSizeMB) || maxSizeMB <= 0) {
5647
+ throw new Error("Please enter a valid maximum size in MB.");
5648
+ }
5644
5649
  await getApiService().put(endpoint, {
5645
5650
  documentConfigurationId: updatedData.id,
5646
5651
  documentName: updatedData.docName.trim(),
5647
5652
  allowedExtensions: updatedData.extensions.trim(),
5648
- maxSizeMB: Number(updatedData.maxSizeNum),
5653
+ maxSizeMB,
5649
5654
  isMandatory: Boolean(updatedData.isMandatory),
5650
5655
  isActive: updatedData.status === "Active",
5651
5656
  updatedBy: "System"
@@ -5655,7 +5660,7 @@ function DocumentConfigTable({
5655
5660
  await loadData();
5656
5661
  return true;
5657
5662
  } catch (error) {
5658
- await import_sweetalert211.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to update document configuration.", "error");
5663
+ await import_sweetalert211.default.fire("Error", ((_f = (_e = error == null ? void 0 : error.response) == null ? void 0 : _e.data) == null ? void 0 : _f.message) || (error == null ? void 0 : error.message) || "Unable to update document configuration.", "error");
5659
5664
  return false;
5660
5665
  }
5661
5666
  };
@@ -5482,7 +5482,8 @@ function DocumentConfigTable({
5482
5482
  try {
5483
5483
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.getById;
5484
5484
  if (!endpoint) throw new Error("Document Configuration get-by-id endpoint is not configured.");
5485
- const result = await getApiService().get(buildGetByIdUrl(endpoint, item.id));
5485
+ const url = typeof endpoint === "function" ? endpoint(item.id) : buildGetByIdUrl(endpoint, item.id);
5486
+ const result = await getApiService().get(url);
5486
5487
  const value = (_h = (_g = (_f = (_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) != null ? _f : (_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) != null ? _g : result == null ? void 0 : result.data) != null ? _h : result;
5487
5488
  setSelectedItem(toUiItem(value != null ? value : item));
5488
5489
  setIsEditOpen(true);
@@ -5495,15 +5496,19 @@ function DocumentConfigTable({
5495
5496
  setIsDeleteOpen(true);
5496
5497
  };
5497
5498
  const handleSaveEdit = async (updatedData) => {
5498
- var _a, _b, _c, _d, _e;
5499
+ var _a, _b, _c, _d, _e, _f;
5499
5500
  try {
5500
5501
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.update;
5501
5502
  if (!endpoint) throw new Error("Document Configuration update endpoint is not configured.");
5503
+ const maxSizeMB = Number.parseFloat((_d = updatedData.maxSizeNum) != null ? _d : updatedData.maxSize);
5504
+ if (!Number.isFinite(maxSizeMB) || maxSizeMB <= 0) {
5505
+ throw new Error("Please enter a valid maximum size in MB.");
5506
+ }
5502
5507
  await getApiService().put(endpoint, {
5503
5508
  documentConfigurationId: updatedData.id,
5504
5509
  documentName: updatedData.docName.trim(),
5505
5510
  allowedExtensions: updatedData.extensions.trim(),
5506
- maxSizeMB: Number(updatedData.maxSizeNum),
5511
+ maxSizeMB,
5507
5512
  isMandatory: Boolean(updatedData.isMandatory),
5508
5513
  isActive: updatedData.status === "Active",
5509
5514
  updatedBy: "System"
@@ -5513,7 +5518,7 @@ function DocumentConfigTable({
5513
5518
  await loadData();
5514
5519
  return true;
5515
5520
  } catch (error) {
5516
- await Swal11.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to update document configuration.", "error");
5521
+ await Swal11.fire("Error", ((_f = (_e = error == null ? void 0 : error.response) == null ? void 0 : _e.data) == null ? void 0 : _f.message) || (error == null ? void 0 : error.message) || "Unable to update document configuration.", "error");
5517
5522
  return false;
5518
5523
  }
5519
5524
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowcore-fn",
3
- "version": "9.5.1",
3
+ "version": "9.5.3",
4
4
  "main": "dist/pkg-index.js",
5
5
  "module": "dist/pkg-index.mjs",
6
6
  "files": [