@v1ct0rbr/minivault-web 0.6.5 → 0.7.1

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.
@@ -1,4 +1,4 @@
1
- import { Backup, BackupType, ConnectionCheck, DatabaseCredentials, DbInfo, DumpOptions, ImportResult, OriginStorageConfig, PageResponse, RelationshipInfo, StorageFileItem, StorageTarget, StorageZipRequest, TableDetail, TableInfo, VerifyResult, ZipJobStatus } from '../types/minivault';
1
+ import { AllStorageConfig, Backup, BackupType, ConnectionCheck, DatabaseCredentials, DbInfo, DumpOptions, ImportResult, OriginStorageConfig, PageResponse, RelationshipInfo, StorageFileItem, StorageTarget, StorageZipRequest, TableDetail, TableInfo, VerifyResult, ZipJobStatus } from '../types/minivault';
2
2
  export interface MinivaultApiOptions {
3
3
  /**
4
4
  * URL base da API. Exemplos:
@@ -45,6 +45,7 @@ export declare class MinivaultApi {
45
45
  getDbTable(ref: string): Promise<TableDetail>;
46
46
  listDbRelationships(): Promise<RelationshipInfo[]>;
47
47
  getDiagnostics(): Promise<ConnectionCheck[]>;
48
+ getStorageConfig(): Promise<AllStorageConfig>;
48
49
  private storageQuery;
49
50
  listStorageFiles(type: string, prefix?: string, storageConfig?: OriginStorageConfig, storage?: StorageTarget): Promise<StorageFileItem[]>;
50
51
  downloadStorageFile(key: string, type: string, storageConfig?: OriginStorageConfig, storage?: StorageTarget): Promise<Blob>;
package/dist/index.d.ts CHANGED
@@ -15,4 +15,4 @@ export { DatabaseBanner } from './components/DatabaseBanner';
15
15
  export { StatusBadge } from './components/StatusBadge';
16
16
  export { useBackups, useCreateBackup, useRestoreBackup, useDeleteBackup, useDownloadBackup, useImportDump, useImportFromStorage, useDbInfo, useDbTables, useDbTableDetail, useDbRelationships, useDiagnostics, } from './hooks/useBackups';
17
17
  export { formatFileSize, formatDate, STATUS_LABELS, STATUS_BADGE, DATABASE_TYPE_LABELS } from './utils/format';
18
- export type { Backup, BackupRequest, BackupStatus, BackupType, ColumnInfo, ConnectionCheck, DatabaseCredentials, DatabaseType, DbInfo, DumpOptions, DumpFormat, ImportResult, ImportFromStorageRequest, OriginStorageConfig, PageResponse, RelationshipInfo, RestoreRequest, StorageFileItem, TableDetail, TableInfo, VerifyResult, } from './types/minivault';
18
+ export type { AllStorageConfig, Backup, BackupRequest, BackupStatus, BackupType, ColumnInfo, ConnectionCheck, DatabaseCredentials, DatabaseType, DbInfo, DumpOptions, DumpFormat, ImportResult, ImportFromStorageRequest, OriginStorageConfig, PageResponse, RelationshipInfo, ResolvedStorageInfo, RestoreRequest, StorageFileItem, StorageTarget, TableDetail, TableInfo, VerifyResult, } from './types/minivault';
@@ -138,6 +138,9 @@ var h = class extends Error {
138
138
  getDiagnostics() {
139
139
  return this.request("/api/diagnostics");
140
140
  }
141
+ getStorageConfig() {
142
+ return this.request("/api/storage/config");
143
+ }
141
144
  storageQuery(e, t) {
142
145
  let n = new URLSearchParams({ storage: e });
143
146
  return t && (t.type && n.set("type", t.type), t.endpoint && n.set("endpoint", t.endpoint), t.bucketName && n.set("bucketName", t.bucketName), t.accessKey && n.set("accessKey", t.accessKey), t.secretKey && n.set("secretKey", t.secretKey), t.region && n.set("region", t.region), t.pathStyleEnabled && n.set("pathStyleEnabled", "true"), t.localPath && n.set("localPath", t.localPath)), n;
@@ -1612,86 +1615,98 @@ function ae({ check: e }) {
1612
1615
  //#endregion
1613
1616
  //#region src/components/StorageExplorerTab.tsx
1614
1617
  var oe = 1500;
1615
- function $({ target: e = "origin", title: n = "Explorador de Storage", storageType: i = "LOCAL", storageConfig: a }) {
1616
- let s = b(), c = d(), [h, g] = o(""), [_, v] = o([]), [y, x] = o(/* @__PURE__ */ new Set()), [S, C] = o(null), [w, T] = o(null), [E, D] = o(null), [O, k] = o(!1), A = a?.type ?? i, j = e === "destination" ? "Destino" : "Origem", { data: M, isLoading: N } = u({
1618
+ function $({ target: e = "origin", title: n = "Explorador de Storage", storageType: a = "LOCAL", storageConfig: s }) {
1619
+ let c = b(), h = d(), [g, _] = o(""), [v, y] = o([]), [x, S] = o(/* @__PURE__ */ new Set()), [C, w] = o(null), [T, E] = o(null), [D, O] = o(null), [k, A] = o(!1), j = e === "destination" ? "Destino" : "Origem", { data: M, isPending: N } = u({
1620
+ queryKey: ["storage-config"],
1621
+ queryFn: () => c.getStorageConfig(),
1622
+ retry: !1
1623
+ }), P = M?.[e], F = i(() => P?.configured ? {
1624
+ type: P.type,
1625
+ ...P.localPath ? { localPath: P.localPath } : {},
1626
+ ...P.endpoint ? { endpoint: P.endpoint } : {},
1627
+ ...P.bucketName ? { bucketName: P.bucketName } : {},
1628
+ ...P.region ? { region: P.region } : {},
1629
+ ...P.pathStyleEnabled ? { pathStyleEnabled: !0 } : {}
1630
+ } : s, [P, s]), I = F?.type ?? a, { data: L, isLoading: R } = u({
1617
1631
  queryKey: [
1618
1632
  "storage-files",
1619
1633
  e,
1620
- A,
1621
- h,
1622
- a
1634
+ I,
1635
+ g,
1636
+ F
1623
1637
  ],
1624
- queryFn: () => s.listStorageFiles(A, h || void 0, a, e)
1625
- }), P = l({
1626
- mutationFn: (t) => s.deleteStorageFile(t, A, a, e),
1638
+ queryFn: () => c.listStorageFiles(I, g || void 0, F, e),
1639
+ enabled: !N
1640
+ }), z = l({
1641
+ mutationFn: (t) => c.deleteStorageFile(t, I, F, e),
1627
1642
  onSuccess: () => {
1628
- c.invalidateQueries({ queryKey: ["storage-files"] }), C(null);
1643
+ h.invalidateQueries({ queryKey: ["storage-files"] }), w(null);
1629
1644
  }
1630
- }), F = t((e) => {
1631
- g(e), v(e ? e.split("/").filter(Boolean) : []), x(/* @__PURE__ */ new Set());
1632
- }, []), I = t((e) => {
1633
- let t = _.slice(0, e + 1).join("/");
1634
- F(t);
1635
- }, [_, F]);
1645
+ }), H = t((e) => {
1646
+ _(e), y(e ? e.split("/").filter(Boolean) : []), S(/* @__PURE__ */ new Set());
1647
+ }, []), U = t((e) => {
1648
+ let t = v.slice(0, e + 1).join("/");
1649
+ H(t);
1650
+ }, [v, H]);
1636
1651
  r(() => {
1637
- v(h ? h.split("/").filter(Boolean) : []);
1638
- }, [h]);
1639
- let L = (e) => {
1640
- x((t) => {
1652
+ y(g ? g.split("/").filter(Boolean) : []);
1653
+ }, [g]);
1654
+ let W = (e) => {
1655
+ S((t) => {
1641
1656
  let n = new Set(t);
1642
1657
  return n.has(e) ? n.delete(e) : n.add(e), n;
1643
1658
  });
1644
- }, R = () => {
1645
- M && x((e) => e.size === M.length ? /* @__PURE__ */ new Set() : new Set(M.map((e) => e.path)));
1646
- }, z = (e, t) => {
1659
+ }, G = () => {
1660
+ L && S((e) => e.size === L.length ? /* @__PURE__ */ new Set() : new Set(L.map((e) => e.path)));
1661
+ }, K = (e, t) => {
1647
1662
  let n = window.URL.createObjectURL(e), r = document.createElement("a");
1648
1663
  r.href = n, r.download = t, document.body.appendChild(r), r.click(), r.remove(), window.URL.revokeObjectURL(n);
1649
- }, H = async (t, n) => {
1664
+ }, q = async (t, n) => {
1650
1665
  let r = {
1651
1666
  storage: e,
1652
- type: A,
1667
+ type: I,
1653
1668
  mode: t,
1654
1669
  keys: n
1655
1670
  };
1656
- a?.localPath && (r.localPath = a.localPath), a?.endpoint && (r.endpoint = a.endpoint), a?.bucketName && (r.bucketName = a.bucketName), a?.accessKey && (r.accessKey = a.accessKey), a?.secretKey && (r.secretKey = a.secretKey), a?.region && (r.region = a.region), a?.pathStyleEnabled && (r.pathStyleEnabled = !0), D(null);
1657
- let i = await s.createStorageZip(r);
1658
- T(i);
1659
- }, U = async (e) => {
1660
- await H("file", [e]);
1661
- }, W = async () => {
1662
- await H("zip", [...y]);
1663
- }, G = async (e) => {
1671
+ F?.localPath && (r.localPath = F.localPath), F?.endpoint && (r.endpoint = F.endpoint), F?.bucketName && (r.bucketName = F.bucketName), F?.accessKey && (r.accessKey = F.accessKey), F?.secretKey && (r.secretKey = F.secretKey), F?.region && (r.region = F.region), F?.pathStyleEnabled && (r.pathStyleEnabled = !0), O(null);
1672
+ let i = await c.createStorageZip(r);
1673
+ E(i);
1674
+ }, J = async (e) => {
1675
+ await q("file", [e]);
1676
+ }, Y = async () => {
1677
+ await q("zip", [...x]);
1678
+ }, X = async (e) => {
1664
1679
  try {
1665
- k(!0);
1666
- let t = await s.downloadStorageZip(e.jobId);
1667
- z(t, e.fileName ?? `storage_${j.toLowerCase()}.zip`);
1680
+ A(!0);
1681
+ let t = await c.downloadStorageZip(e.jobId);
1682
+ K(t, e.fileName ?? `storage_${j.toLowerCase()}.zip`);
1668
1683
  } catch (e) {
1669
- D(e instanceof Error ? e.message : String(e));
1684
+ O(e instanceof Error ? e.message : String(e));
1670
1685
  } finally {
1671
- k(!1), T(null);
1686
+ A(!1), E(null);
1672
1687
  }
1673
1688
  };
1674
1689
  r(() => {
1675
- let e = w?.jobId;
1690
+ let e = T?.jobId;
1676
1691
  if (!e) return;
1677
1692
  let t = !1, n;
1678
1693
  return n = window.setInterval(async () => {
1679
1694
  let r;
1680
1695
  try {
1681
- r = await s.getStorageZipStatus(e);
1696
+ r = await c.getStorageZipStatus(e);
1682
1697
  } catch (e) {
1683
1698
  if (window.clearInterval(n), t) return;
1684
- D(e instanceof Error ? e.message : String(e)), T(null);
1699
+ O(e instanceof Error ? e.message : String(e)), E(null);
1685
1700
  return;
1686
1701
  }
1687
- t || (T(r), r.status === "DONE" ? (window.clearInterval(n), await G(r)) : r.status === "FAILED" && (window.clearInterval(n), D(r.message)));
1702
+ t || (E(r), r.status === "DONE" ? (window.clearInterval(n), await X(r)) : r.status === "FAILED" && (window.clearInterval(n), O(r.message)));
1688
1703
  }, oe), () => {
1689
1704
  t = !0, window.clearInterval(n);
1690
1705
  };
1691
- }, [w?.jobId]);
1692
- let K = () => {
1693
- T(null), D(null);
1694
- }, q = (e) => e ? V(e) : "-";
1706
+ }, [T?.jobId]);
1707
+ let Z = () => {
1708
+ E(null), O(null);
1709
+ }, ee = (e) => e ? V(e) : "-";
1695
1710
  return /* @__PURE__ */ m("div", {
1696
1711
  className: "space-y-3",
1697
1712
  children: [
@@ -1708,50 +1723,64 @@ function $({ target: e = "origin", title: n = "Explorador de Storage", storageTy
1708
1723
  }),
1709
1724
  /* @__PURE__ */ p("span", {
1710
1725
  className: "badge bg-light text-dark border ms-1",
1711
- children: A
1726
+ children: I
1712
1727
  })
1713
1728
  ]
1714
1729
  }), /* @__PURE__ */ p("div", {
1715
1730
  className: "d-flex gap-2",
1716
- children: y.size > 0 && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("button", {
1731
+ children: x.size > 0 && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("button", {
1717
1732
  className: "btn btn-sm btn-outline-primary",
1718
- onClick: W,
1733
+ onClick: Y,
1719
1734
  children: [
1720
1735
  /* @__PURE__ */ p("i", { className: "bi bi-download me-1" }),
1721
1736
  "Baixar seleção (",
1722
- y.size,
1737
+ x.size,
1723
1738
  ")"
1724
1739
  ]
1725
1740
  }), /* @__PURE__ */ m("button", {
1726
1741
  className: "btn btn-sm btn-outline-danger",
1727
- onClick: () => C("multiple"),
1742
+ onClick: () => w("multiple"),
1728
1743
  children: [
1729
1744
  /* @__PURE__ */ p("i", { className: "bi bi-trash me-1" }),
1730
1745
  "Excluir (",
1731
- y.size,
1746
+ x.size,
1732
1747
  ")"
1733
1748
  ]
1734
1749
  })] })
1735
1750
  })]
1736
1751
  }),
1752
+ !N && !P?.configured && !s && /* @__PURE__ */ m("div", {
1753
+ className: "alert alert-warning small py-1 mb-2",
1754
+ children: [
1755
+ /* @__PURE__ */ p("i", {
1756
+ className: "bi bi-exclamation-triangle me-1",
1757
+ "aria-hidden": !0
1758
+ }),
1759
+ "Servidor não configurou este storage (",
1760
+ e === "destination" ? "OUTPUT_STORAGE_*" : "ORIGIN_STORAGE_*",
1761
+ "). Configure as variáveis de ambiente ou envie ",
1762
+ /* @__PURE__ */ p("code", { children: "storageConfig" }),
1763
+ " via props."
1764
+ ]
1765
+ }),
1737
1766
  /* @__PURE__ */ p("nav", {
1738
1767
  "aria-label": "breadcrumb",
1739
1768
  children: /* @__PURE__ */ m("ol", {
1740
1769
  className: "breadcrumb mb-0 small",
1741
1770
  children: [/* @__PURE__ */ p("li", {
1742
- className: `breadcrumb-item ${_.length === 0 ? "active" : ""}`,
1743
- style: { cursor: _.length > 0 ? "pointer" : "default" },
1744
- onClick: () => F(""),
1771
+ className: `breadcrumb-item ${v.length === 0 ? "active" : ""}`,
1772
+ style: { cursor: v.length > 0 ? "pointer" : "default" },
1773
+ onClick: () => H(""),
1745
1774
  children: /* @__PURE__ */ p("i", { className: "bi bi-house" })
1746
- }), _.map((e, t) => /* @__PURE__ */ p("li", {
1747
- className: `breadcrumb-item ${t === _.length - 1 ? "active" : ""}`,
1748
- style: { cursor: t < _.length - 1 ? "pointer" : "default" },
1749
- onClick: () => t < _.length - 1 && I(t),
1775
+ }), v.map((e, t) => /* @__PURE__ */ p("li", {
1776
+ className: `breadcrumb-item ${t === v.length - 1 ? "active" : ""}`,
1777
+ style: { cursor: t < v.length - 1 ? "pointer" : "default" },
1778
+ onClick: () => t < v.length - 1 && U(t),
1750
1779
  children: e
1751
1780
  }, t))]
1752
1781
  })
1753
1782
  }),
1754
- N ? /* @__PURE__ */ m("div", {
1783
+ R || N ? /* @__PURE__ */ m("div", {
1755
1784
  className: "text-center py-5",
1756
1785
  children: [/* @__PURE__ */ p("div", {
1757
1786
  className: "spinner-border text-primary",
@@ -1760,14 +1789,14 @@ function $({ target: e = "origin", title: n = "Explorador de Storage", storageTy
1760
1789
  className: "mt-2 small text-muted",
1761
1790
  children: "Carregando arquivos..."
1762
1791
  })]
1763
- }) : !M || M.length === 0 ? /* @__PURE__ */ m("div", {
1792
+ }) : !L || L.length === 0 ? /* @__PURE__ */ m("div", {
1764
1793
  className: "text-center py-5 text-muted",
1765
1794
  children: [
1766
1795
  /* @__PURE__ */ p("i", { className: "bi bi-folder-x fs-1 d-block mb-2" }),
1767
1796
  "Nenhum arquivo encontrado",
1768
- h && /* @__PURE__ */ p("button", {
1797
+ g && /* @__PURE__ */ p("button", {
1769
1798
  className: "btn btn-sm btn-link mt-2",
1770
- onClick: () => F(""),
1799
+ onClick: () => H(""),
1771
1800
  children: "Voltar ao inicio"
1772
1801
  })
1773
1802
  ]
@@ -1775,11 +1804,11 @@ function $({ target: e = "origin", title: n = "Explorador de Storage", storageTy
1775
1804
  className: "d-flex align-items-center gap-2 mb-2",
1776
1805
  children: [/* @__PURE__ */ m("button", {
1777
1806
  className: "btn btn-sm btn-outline-secondary",
1778
- onClick: R,
1779
- children: [y.size === M.length ? "Desmarcar" : "Selecionar", " Todos"]
1807
+ onClick: G,
1808
+ children: [x.size === L.length ? "Desmarcar" : "Selecionar", " Todos"]
1780
1809
  }), /* @__PURE__ */ m("span", {
1781
1810
  className: "small text-muted",
1782
- children: [M.length, " item(ns)"]
1811
+ children: [L.length, " item(ns)"]
1783
1812
  })]
1784
1813
  }), /* @__PURE__ */ p("div", {
1785
1814
  className: "table-responsive",
@@ -1803,18 +1832,18 @@ function $({ target: e = "origin", title: n = "Explorador de Storage", storageTy
1803
1832
  children: "Acoes"
1804
1833
  })
1805
1834
  ] })
1806
- }), /* @__PURE__ */ p("tbody", { children: M.map((e) => /* @__PURE__ */ m("tr", {
1807
- className: y.has(e.path) ? "table-active" : "",
1835
+ }), /* @__PURE__ */ p("tbody", { children: L.map((e) => /* @__PURE__ */ m("tr", {
1836
+ className: x.has(e.path) ? "table-active" : "",
1808
1837
  children: [
1809
1838
  /* @__PURE__ */ p("td", { children: /* @__PURE__ */ p("input", {
1810
1839
  type: "checkbox",
1811
1840
  className: "form-check-input",
1812
- checked: y.has(e.path),
1813
- onChange: () => L(e.path)
1841
+ checked: x.has(e.path),
1842
+ onChange: () => W(e.path)
1814
1843
  }) }),
1815
1844
  /* @__PURE__ */ p("td", { children: e.directory ? /* @__PURE__ */ m("button", {
1816
1845
  className: "btn btn-sm btn-link text-decoration-none p-0 text-start",
1817
- onClick: () => F(e.path),
1846
+ onClick: () => H(e.path),
1818
1847
  children: [/* @__PURE__ */ p("i", { className: "bi bi-folder-fill text-warning me-2" }), /* @__PURE__ */ p("span", {
1819
1848
  className: "font-monospace",
1820
1849
  children: e.name
@@ -1829,19 +1858,19 @@ function $({ target: e = "origin", title: n = "Explorador de Storage", storageTy
1829
1858
  }),
1830
1859
  /* @__PURE__ */ p("td", {
1831
1860
  className: "text-muted small",
1832
- children: q(e.lastModified)
1861
+ children: ee(e.lastModified)
1833
1862
  }),
1834
1863
  /* @__PURE__ */ p("td", { children: !e.directory && /* @__PURE__ */ m("div", {
1835
1864
  className: "d-flex gap-1",
1836
1865
  children: [/* @__PURE__ */ p("button", {
1837
1866
  className: "btn btn-sm btn-outline-primary py-0",
1838
1867
  title: "Baixar",
1839
- onClick: () => U(e.path),
1868
+ onClick: () => J(e.path),
1840
1869
  children: /* @__PURE__ */ p("i", { className: "bi bi-download" })
1841
1870
  }), /* @__PURE__ */ p("button", {
1842
1871
  className: "btn btn-sm btn-outline-danger py-0",
1843
1872
  title: "Excluir",
1844
- onClick: () => C(e.path),
1873
+ onClick: () => w(e.path),
1845
1874
  children: /* @__PURE__ */ p("i", { className: "bi bi-trash" })
1846
1875
  })]
1847
1876
  }) })
@@ -1849,7 +1878,7 @@ function $({ target: e = "origin", title: n = "Explorador de Storage", storageTy
1849
1878
  }, e.path)) })]
1850
1879
  })
1851
1880
  })] }),
1852
- w && /* @__PURE__ */ p("div", {
1881
+ T && /* @__PURE__ */ p("div", {
1853
1882
  className: "modal d-block",
1854
1883
  tabIndex: -1,
1855
1884
  style: { background: "rgba(0,0,0,.5)" },
@@ -1862,10 +1891,10 @@ function $({ target: e = "origin", title: n = "Explorador de Storage", storageTy
1862
1891
  className: "modal-header",
1863
1892
  children: [/* @__PURE__ */ m("h6", {
1864
1893
  className: "modal-title",
1865
- children: [/* @__PURE__ */ p("i", { className: "bi bi-box-arrow-down me-2" }), w.mode === "ZIP" ? "Compactando e baixando" : "Baixando arquivo"]
1894
+ children: [/* @__PURE__ */ p("i", { className: "bi bi-box-arrow-down me-2" }), T.mode === "ZIP" ? "Compactando e baixando" : "Baixando arquivo"]
1866
1895
  }), /* @__PURE__ */ p("button", {
1867
1896
  className: "btn-close",
1868
- onClick: K
1897
+ onClick: Z
1869
1898
  })]
1870
1899
  }),
1871
1900
  /* @__PURE__ */ m("div", {
@@ -1884,9 +1913,9 @@ function $({ target: e = "origin", title: n = "Explorador de Storage", storageTy
1884
1913
  className: "w-100",
1885
1914
  children: [/* @__PURE__ */ m("div", {
1886
1915
  className: "d-flex justify-content-between small mb-1",
1887
- children: [/* @__PURE__ */ p("span", { children: ((e) => e.mode === "FILE" ? e.phase === "DOWNLOADING" ? e.totalBytes > 0 ? `Baixando arquivo... ${B(e.processedBytes)} / ${B(e.totalBytes)}` : "Baixando arquivo..." : e.message || "Preparando download..." : e.phase === "PREPARING" ? `Preparando ${e.processedItems}/${e.totalItems} arquivo(s)...` : e.phase === "COMPRESSING" ? `Compactando... ${e.percent}%` : e.message || "Processando...")(w) }), /* @__PURE__ */ m("span", {
1916
+ children: [/* @__PURE__ */ p("span", { children: ((e) => e.mode === "FILE" ? e.phase === "DOWNLOADING" ? e.totalBytes > 0 ? `Baixando arquivo... ${B(e.processedBytes)} / ${B(e.totalBytes)}` : "Baixando arquivo..." : e.message || "Preparando download..." : e.phase === "PREPARING" ? `Preparando ${e.processedItems}/${e.totalItems} arquivo(s)...` : e.phase === "COMPRESSING" ? `Compactando... ${e.percent}%` : e.message || "Processando...")(T) }), /* @__PURE__ */ m("span", {
1888
1917
  className: "text-muted",
1889
- children: [w.percent, "%"]
1918
+ children: [T.percent, "%"]
1890
1919
  })]
1891
1920
  }), /* @__PURE__ */ p("div", {
1892
1921
  className: "progress",
@@ -1894,39 +1923,39 @@ function $({ target: e = "origin", title: n = "Explorador de Storage", storageTy
1894
1923
  children: /* @__PURE__ */ p("div", {
1895
1924
  className: "progress-bar progress-bar-striped progress-bar-animated",
1896
1925
  role: "progressbar",
1897
- style: { width: `${Math.max(w.percent, 3)}%` }
1926
+ style: { width: `${Math.max(T.percent, 3)}%` }
1898
1927
  })
1899
1928
  })]
1900
1929
  })]
1901
1930
  }),
1902
- w.currentItem && /* @__PURE__ */ m("div", {
1931
+ T.currentItem && /* @__PURE__ */ m("div", {
1903
1932
  className: "small text-muted",
1904
- title: w.currentItem,
1933
+ title: T.currentItem,
1905
1934
  children: [/* @__PURE__ */ p("i", {
1906
1935
  className: "bi bi-file-earmark-text me-1",
1907
1936
  "aria-hidden": !0
1908
1937
  }), /* @__PURE__ */ p("span", {
1909
1938
  className: "font-monospace",
1910
- children: w.currentItem
1939
+ children: T.currentItem
1911
1940
  })]
1912
1941
  }),
1913
- w.mode === "FILE" && w.totalBytes > 0 || w.mode === "ZIP" ? /* @__PURE__ */ m("div", {
1942
+ T.mode === "FILE" && T.totalBytes > 0 || T.mode === "ZIP" ? /* @__PURE__ */ m("div", {
1914
1943
  className: "small text-muted mt-1",
1915
1944
  children: [
1916
1945
  /* @__PURE__ */ p("i", {
1917
1946
  className: "bi bi-hdd me-1",
1918
1947
  "aria-hidden": !0
1919
1948
  }),
1920
- B(w.processedBytes),
1921
- w.totalBytes > 0 ? ` / ${B(w.totalBytes)}` : ""
1949
+ B(T.processedBytes),
1950
+ T.totalBytes > 0 ? ` / ${B(T.totalBytes)}` : ""
1922
1951
  ]
1923
1952
  }) : null,
1924
- w.status === "FAILED" && /* @__PURE__ */ m("div", {
1953
+ T.status === "FAILED" && /* @__PURE__ */ m("div", {
1925
1954
  className: "alert alert-danger small mt-2 mb-0 py-1",
1926
1955
  children: [/* @__PURE__ */ p("i", {
1927
1956
  className: "bi bi-exclamation-triangle me-1",
1928
1957
  "aria-hidden": !0
1929
- }), w.message || "Falha ao preparar o download."]
1958
+ }), T.message || "Falha ao preparar o download."]
1930
1959
  })
1931
1960
  ]
1932
1961
  }),
@@ -1934,16 +1963,16 @@ function $({ target: e = "origin", title: n = "Explorador de Storage", storageTy
1934
1963
  className: "modal-footer",
1935
1964
  children: /* @__PURE__ */ p("button", {
1936
1965
  className: "btn btn-sm btn-secondary",
1937
- onClick: K,
1938
- disabled: O,
1939
- children: O ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("span", { className: "spinner-border spinner-border-sm me-1" }), "Baixando..."] }) : w.status === "DONE" || w.status === "FAILED" ? "Fechar" : "Fechar (continua em 2º plano)"
1966
+ onClick: Z,
1967
+ disabled: k,
1968
+ children: k ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("span", { className: "spinner-border spinner-border-sm me-1" }), "Baixando..."] }) : T.status === "DONE" || T.status === "FAILED" ? "Fechar" : "Fechar (continua em 2º plano)"
1940
1969
  })
1941
1970
  })
1942
1971
  ]
1943
1972
  })
1944
1973
  })
1945
1974
  }),
1946
- E && !w && /* @__PURE__ */ p("div", {
1975
+ D && !T && /* @__PURE__ */ p("div", {
1947
1976
  className: "modal d-block",
1948
1977
  tabIndex: -1,
1949
1978
  style: { background: "rgba(0,0,0,.5)" },
@@ -1959,21 +1988,21 @@ function $({ target: e = "origin", title: n = "Explorador de Storage", storageTy
1959
1988
  children: [/* @__PURE__ */ p("i", { className: "bi bi-exclamation-triangle me-2 text-danger" }), "Falha no download"]
1960
1989
  }), /* @__PURE__ */ p("button", {
1961
1990
  className: "btn-close",
1962
- onClick: () => D(null)
1991
+ onClick: () => O(null)
1963
1992
  })]
1964
1993
  }),
1965
1994
  /* @__PURE__ */ p("div", {
1966
1995
  className: "modal-body",
1967
1996
  children: /* @__PURE__ */ p("p", {
1968
1997
  className: "mb-0 text-danger small",
1969
- children: E
1998
+ children: D
1970
1999
  })
1971
2000
  }),
1972
2001
  /* @__PURE__ */ p("div", {
1973
2002
  className: "modal-footer",
1974
2003
  children: /* @__PURE__ */ p("button", {
1975
2004
  className: "btn btn-sm btn-secondary",
1976
- onClick: () => D(null),
2005
+ onClick: () => O(null),
1977
2006
  children: "Fechar"
1978
2007
  })
1979
2008
  })
@@ -1981,7 +2010,7 @@ function $({ target: e = "origin", title: n = "Explorador de Storage", storageTy
1981
2010
  })
1982
2011
  })
1983
2012
  }),
1984
- S && /* @__PURE__ */ p("div", {
2013
+ C && /* @__PURE__ */ p("div", {
1985
2014
  className: "modal d-block",
1986
2015
  tabIndex: -1,
1987
2016
  style: { background: "rgba(0,0,0,.5)" },
@@ -1997,26 +2026,26 @@ function $({ target: e = "origin", title: n = "Explorador de Storage", storageTy
1997
2026
  children: "Confirmar exclusao"
1998
2027
  }), /* @__PURE__ */ p("button", {
1999
2028
  className: "btn-close",
2000
- onClick: () => C(null)
2029
+ onClick: () => w(null)
2001
2030
  })]
2002
2031
  }),
2003
2032
  /* @__PURE__ */ m("div", {
2004
2033
  className: "modal-body",
2005
2034
  children: [
2006
- S === "multiple" ? /* @__PURE__ */ m("p", { children: [
2035
+ C === "multiple" ? /* @__PURE__ */ m("p", { children: [
2007
2036
  "Excluir ",
2008
- y.size,
2037
+ x.size,
2009
2038
  " arquivo(s) selecionado(s)?"
2010
2039
  ] }) : /* @__PURE__ */ m("p", { children: [
2011
2040
  "Excluir ",
2012
- /* @__PURE__ */ p("code", { children: S.split("/").pop() }),
2041
+ /* @__PURE__ */ p("code", { children: C.split("/").pop() }),
2013
2042
  "?"
2014
2043
  ] }),
2015
2044
  /* @__PURE__ */ p("p", {
2016
2045
  className: "text-danger small mb-0",
2017
2046
  children: "Esta acao nao pode ser desfeita."
2018
2047
  }),
2019
- P.isError && /* @__PURE__ */ m("div", {
2048
+ z.isError && /* @__PURE__ */ m("div", {
2020
2049
  className: "alert alert-danger small mt-2 mb-0 py-1",
2021
2050
  children: [
2022
2051
  /* @__PURE__ */ p("i", {
@@ -2025,7 +2054,7 @@ function $({ target: e = "origin", title: n = "Explorador de Storage", storageTy
2025
2054
  }),
2026
2055
  "Falha ao excluir:",
2027
2056
  " ",
2028
- P.error instanceof Error ? P.error.message : String(P.error)
2057
+ z.error instanceof Error ? z.error.message : String(z.error)
2029
2058
  ]
2030
2059
  })
2031
2060
  ]
@@ -2034,16 +2063,16 @@ function $({ target: e = "origin", title: n = "Explorador de Storage", storageTy
2034
2063
  className: "modal-footer",
2035
2064
  children: [/* @__PURE__ */ p("button", {
2036
2065
  className: "btn btn-sm btn-secondary",
2037
- onClick: () => C(null),
2066
+ onClick: () => w(null),
2038
2067
  children: "Cancelar"
2039
2068
  }), /* @__PURE__ */ p("button", {
2040
2069
  className: "btn btn-sm btn-danger",
2041
- disabled: P.isPending,
2070
+ disabled: z.isPending,
2042
2071
  onClick: async () => {
2043
- if (S === "multiple") for (let e of y) await P.mutateAsync(e);
2044
- else await P.mutateAsync(S);
2072
+ if (C === "multiple") for (let e of x) await z.mutateAsync(e);
2073
+ else await z.mutateAsync(C);
2045
2074
  },
2046
- children: P.isPending ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("span", { className: "spinner-border spinner-border-sm me-1" }), "Excluindo..."] }) : "Excluir"
2075
+ children: z.isPending ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("span", { className: "spinner-border spinner-border-sm me-1" }), "Excluindo..."] }) : "Excluir"
2047
2076
  })]
2048
2077
  })
2049
2078
  ]
@@ -140,6 +140,25 @@ export interface StorageFileItem {
140
140
  }
141
141
  /** Qual storage o explorador manipula: origem (ORIGIN_STORAGE_*) ou destino (OUTPUT_STORAGE_*). */
142
142
  export type StorageTarget = 'origin' | 'destination';
143
+ /**
144
+ * Descrição pública da configuração resolvida de um storage no servidor
145
+ * (via GET /api/storage/config). Nunca contém accessKey/secretKey.
146
+ */
147
+ export interface ResolvedStorageInfo {
148
+ storage: StorageTarget;
149
+ type: string;
150
+ localPath: string | null;
151
+ endpoint: string | null;
152
+ bucketName: string | null;
153
+ region: string | null;
154
+ pathStyleEnabled: boolean;
155
+ /** true se houver ao menos uma variável de ambiente do prefixo configurada no servidor. */
156
+ configured: boolean;
157
+ }
158
+ export interface AllStorageConfig {
159
+ origin: ResolvedStorageInfo;
160
+ destination: ResolvedStorageInfo;
161
+ }
143
162
  export type ZipJobStatusName = 'PENDING' | 'RUNNING' | 'DONE' | 'FAILED';
144
163
  export type ZipJobMode = 'ZIP' | 'FILE';
145
164
  export type ZipJobPhase = 'PREPARING' | 'COMPRESSING' | 'DOWNLOADING';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v1ct0rbr/minivault-web",
3
- "version": "0.6.5",
3
+ "version": "0.7.1",
4
4
  "description": "Módulo independente de gerenciamento de backups (minivault). Consumível como pacote npm em qualquer app React. Cliente do minivault REST API (acesso tipicamente via proxy autenticado).",
5
5
  "author": "Victor Queiroga (https://www.linkedin.com/in/victor-queiroga)",
6
6
  "license": "MIT",