@v1ct0rbr/minivault-web 0.6.0 → 0.6.2

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.
@@ -312,26 +312,26 @@ var ee = new Intl.DateTimeFormat("pt-BR", {
312
312
  year: "numeric",
313
313
  hour: "2-digit",
314
314
  minute: "2-digit"
315
- }), I = [
315
+ }), te = [
316
316
  "B",
317
317
  "KB",
318
318
  "MB",
319
319
  "GB",
320
320
  "TB"
321
321
  ];
322
- function L(e) {
322
+ function I(e) {
323
323
  if (e == null || e < 0) return "—";
324
324
  if (e < 1024) return `${e} B`;
325
325
  let t = e, n = 0;
326
- for (; t >= 1024 && n < I.length - 1;) t /= 1024, n += 1;
327
- return `${Number.isInteger(t) ? t : Number(t.toFixed(1))} ${I[n]}`;
326
+ for (; t >= 1024 && n < te.length - 1;) t /= 1024, n += 1;
327
+ return `${Number.isInteger(t) ? t : Number(t.toFixed(1))} ${te[n]}`;
328
328
  }
329
- function R(e) {
329
+ function L(e) {
330
330
  if (!e) return "—";
331
331
  let t = new Date(e);
332
332
  return Number.isNaN(t.getTime()) ? "—" : ee.format(t);
333
333
  }
334
- var z = {
334
+ var R = {
335
335
  PENDING: "Pendente",
336
336
  IN_PROGRESS: "Em andamento",
337
337
  COMPLETED: "Concluído",
@@ -339,7 +339,7 @@ var z = {
339
339
  RESTORING: "Restaurando",
340
340
  RESTORED: "Restaurado",
341
341
  RESTORE_FAILED: "Falha na restauração"
342
- }, B = {
342
+ }, z = {
343
343
  PENDING: "text-bg-secondary",
344
344
  IN_PROGRESS: "text-bg-primary",
345
345
  COMPLETED: "text-bg-success",
@@ -347,17 +347,25 @@ var z = {
347
347
  RESTORING: "text-bg-warning",
348
348
  RESTORED: "text-bg-info",
349
349
  RESTORE_FAILED: "text-bg-danger"
350
- }, V = {
350
+ }, B = {
351
351
  postgresql: "PostgreSQL",
352
352
  postgres: "PostgreSQL",
353
353
  mysql: "MySQL",
354
354
  sqlserver: "SQL Server",
355
355
  mssql: "SQL Server"
356
+ }, ne = {
357
+ DATABASE: "Banco de dados",
358
+ STORAGE: "Storage",
359
+ FULL: "Completo"
360
+ }, re = {
361
+ DATABASE: "text-bg-primary",
362
+ STORAGE: "text-bg-info",
363
+ FULL: "text-bg-secondary"
356
364
  };
357
365
  //#endregion
358
366
  //#region src/components/StatusBadge.tsx
359
- function H({ status: e }) {
360
- let t = B[e] ?? "text-bg-secondary", n = z[e] ?? e;
367
+ function V({ status: e }) {
368
+ let t = z[e] ?? "text-bg-secondary", n = R[e] ?? e;
361
369
  return /* @__PURE__ */ p("span", {
362
370
  className: `badge rounded-pill ${t}`,
363
371
  children: n
@@ -365,7 +373,7 @@ function H({ status: e }) {
365
373
  }
366
374
  //#endregion
367
375
  //#region src/components/DatabaseBanner.tsx
368
- function U({ dbInfo: e, isLoading: t, error: n, label: r, compact: i = !1 }) {
376
+ function H({ dbInfo: e, isLoading: t, error: n, label: r, compact: i = !1 }) {
369
377
  if (t) return /* @__PURE__ */ p("div", {
370
378
  className: "mb-3",
371
379
  children: /* @__PURE__ */ m("small", {
@@ -384,7 +392,7 @@ function U({ dbInfo: e, isLoading: t, error: n, label: r, compact: i = !1 }) {
384
392
  "aria-hidden": !0
385
393
  }),
386
394
  "Não foi possível consultar o banco configurado: ",
387
- G(n)
395
+ W(n)
388
396
  ]
389
397
  });
390
398
  if (!e || !e.configured) return i ? /* @__PURE__ */ m("div", {
@@ -406,7 +414,7 @@ function U({ dbInfo: e, isLoading: t, error: n, label: r, compact: i = !1 }) {
406
414
  "). A criação e a importação usam esse banco."
407
415
  ]
408
416
  });
409
- let a = V[e.databaseType ?? ""] ?? e.databaseType ?? "postgresql";
417
+ let a = B[e.databaseType ?? ""] ?? e.databaseType ?? "postgresql";
410
418
  return i ? /* @__PURE__ */ m("div", {
411
419
  className: "mb-3",
412
420
  children: [
@@ -524,10 +532,10 @@ function U({ dbInfo: e, isLoading: t, error: n, label: r, compact: i = !1 }) {
524
532
  }
525
533
  //#endregion
526
534
  //#region src/components/RestoreModal.tsx
527
- function W({ backup: e, onClose: t }) {
535
+ function U({ backup: e, onClose: t }) {
528
536
  let n = A(), r = T(), i = () => {
529
537
  n.mutate({ id: e.id });
530
- }, a = n.isPending;
538
+ }, a = n.isPending, o = e.backupType === "STORAGE";
531
539
  return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", { className: "modal-backdrop show" }), /* @__PURE__ */ p("div", {
532
540
  className: "modal show d-block",
533
541
  tabIndex: -1,
@@ -563,15 +571,19 @@ function W({ backup: e, onClose: t }) {
563
571
  /* @__PURE__ */ m("div", {
564
572
  className: "modal-body",
565
573
  children: [
566
- /* @__PURE__ */ m("p", {
574
+ /* @__PURE__ */ p("p", {
567
575
  className: "text-muted small mb-3",
568
- children: [
576
+ children: o ? /* @__PURE__ */ m(f, { children: [
577
+ "O snapshot ",
578
+ /* @__PURE__ */ p("code", { children: e.filename }),
579
+ " será aplicado na pasta de storage de origem configurada no servidor."
580
+ ] }) : /* @__PURE__ */ m(f, { children: [
569
581
  "O arquivo ",
570
582
  /* @__PURE__ */ p("code", { children: e.filename }),
571
583
  " será aplicado no banco configurado abaixo."
572
- ]
584
+ ] })
573
585
  }),
574
- /* @__PURE__ */ p(U, {
586
+ !o && /* @__PURE__ */ p(H, {
575
587
  label: "Banco de destino",
576
588
  dbInfo: r.data,
577
589
  isLoading: r.isLoading,
@@ -582,7 +594,7 @@ function W({ backup: e, onClose: t }) {
582
594
  children: [/* @__PURE__ */ p("i", {
583
595
  className: "bi bi-x-circle me-2",
584
596
  "aria-hidden": !0
585
- }), G(n.error)]
597
+ }), W(n.error)]
586
598
  }),
587
599
  n.isSuccess && /* @__PURE__ */ m("div", {
588
600
  className: "alert alert-success mt-3 mb-0",
@@ -605,7 +617,7 @@ function W({ backup: e, onClose: t }) {
605
617
  type: "button",
606
618
  className: "btn btn-primary",
607
619
  onClick: i,
608
- disabled: a || !r.data?.configured,
620
+ disabled: a || !o && !r.data?.configured,
609
621
  children: [a && /* @__PURE__ */ p(f, { children: /* @__PURE__ */ p("span", {
610
622
  className: "spinner-border spinner-border-sm me-2",
611
623
  "aria-hidden": !0
@@ -617,12 +629,12 @@ function W({ backup: e, onClose: t }) {
617
629
  })
618
630
  })] });
619
631
  }
620
- function G(e) {
632
+ function W(e) {
621
633
  return e instanceof Error ? e.message : String(e);
622
634
  }
623
635
  //#endregion
624
636
  //#region src/components/BackupsTab.tsx
625
- function K() {
637
+ function G() {
626
638
  let [e, t] = o(0), [n, a] = o(null), [s, c] = o(null), [l, u] = o({}), { data: d, isLoading: f, isError: h, error: g, refetch: _, isFetching: v } = w(e, 10, !0), y = N(), b = j(), x = M();
627
639
  r(() => {
628
640
  if (!y.data || !y.variables) return;
@@ -665,7 +677,7 @@ function K() {
665
677
  "aria-hidden": !0
666
678
  }),
667
679
  "Não foi possível carregar os backups: ",
668
- q(g)
680
+ K(g)
669
681
  ]
670
682
  }),
671
683
  y.isError && /* @__PURE__ */ m("div", {
@@ -676,7 +688,7 @@ function K() {
676
688
  "aria-hidden": !0
677
689
  }),
678
690
  "Falha no download: ",
679
- q(y.error)
691
+ K(y.error)
680
692
  ]
681
693
  }),
682
694
  b.isError && /* @__PURE__ */ m("div", {
@@ -687,7 +699,7 @@ function K() {
687
699
  "aria-hidden": !0
688
700
  }),
689
701
  "Falha ao excluir: ",
690
- q(b.error)
702
+ K(b.error)
691
703
  ]
692
704
  }),
693
705
  x.isError && /* @__PURE__ */ m("div", {
@@ -698,7 +710,7 @@ function K() {
698
710
  "aria-hidden": !0
699
711
  }),
700
712
  "Falha ao verificar: ",
701
- q(x.error)
713
+ K(x.error)
702
714
  ]
703
715
  }),
704
716
  Object.entries(l).map(([e, t]) => /* @__PURE__ */ m("div", {
@@ -741,6 +753,10 @@ function K() {
741
753
  scope: "col",
742
754
  children: "Arquivo"
743
755
  }),
756
+ /* @__PURE__ */ p("th", {
757
+ scope: "col",
758
+ children: "Tipo"
759
+ }),
744
760
  /* @__PURE__ */ p("th", {
745
761
  scope: "col",
746
762
  children: "Banco"
@@ -772,7 +788,7 @@ function K() {
772
788
  children: "Ações"
773
789
  })
774
790
  ] }) }), /* @__PURE__ */ m("tbody", { children: [S.length === 0 && /* @__PURE__ */ p("tr", { children: /* @__PURE__ */ p("td", {
775
- colSpan: 9,
791
+ colSpan: 10,
776
792
  className: "text-center text-muted py-4",
777
793
  children: "Nenhum backup cadastrado."
778
794
  }) }), S.map((e) => /* @__PURE__ */ m("tr", { children: [
@@ -786,12 +802,19 @@ function K() {
786
802
  "aria-hidden": !0
787
803
  }), e.filename]
788
804
  }),
789
- /* @__PURE__ */ p("td", { children: V[e.databaseType] ?? e.databaseType }),
805
+ /* @__PURE__ */ p("td", { children: e.backupType ? /* @__PURE__ */ p("span", {
806
+ className: `badge ${re[e.backupType] ?? "text-bg-secondary"}`,
807
+ children: ne[e.backupType] ?? e.backupType
808
+ }) : /* @__PURE__ */ p("span", {
809
+ className: "text-muted",
810
+ children: "—"
811
+ }) }),
812
+ /* @__PURE__ */ p("td", { children: B[e.databaseType] ?? e.databaseType }),
790
813
  /* @__PURE__ */ p("td", {
791
814
  className: "text-end",
792
- children: L(e.fileSize)
815
+ children: I(e.fileSize)
793
816
  }),
794
- /* @__PURE__ */ p("td", { children: /* @__PURE__ */ p(H, { status: e.status }) }),
817
+ /* @__PURE__ */ p("td", { children: /* @__PURE__ */ p(V, { status: e.status }) }),
795
818
  /* @__PURE__ */ p("td", { children: e.sha256 ? /* @__PURE__ */ m("code", {
796
819
  title: e.sha256,
797
820
  style: { fontSize: "0.8em" },
@@ -814,7 +837,7 @@ function K() {
814
837
  className: "text-muted",
815
838
  children: "—"
816
839
  }) }),
817
- /* @__PURE__ */ p("td", { children: R(e.createdAt) }),
840
+ /* @__PURE__ */ p("td", { children: L(e.createdAt) }),
818
841
  /* @__PURE__ */ m("td", {
819
842
  className: "text-end text-nowrap",
820
843
  children: [
@@ -838,8 +861,8 @@ function K() {
838
861
  /* @__PURE__ */ p("button", {
839
862
  type: "button",
840
863
  className: "btn btn-sm btn-outline-primary me-1",
841
- title: "Baixar",
842
- disabled: y.isPending,
864
+ title: e.backupType === "STORAGE" ? "Backup de storage é restaurado no servidor" : "Baixar",
865
+ disabled: e.backupType === "STORAGE" || y.isPending,
843
866
  onClick: () => y.mutate({
844
867
  id: e.id,
845
868
  filename: e.filename
@@ -907,11 +930,11 @@ function K() {
907
930
  })]
908
931
  })]
909
932
  }),
910
- n && /* @__PURE__ */ p(W, {
933
+ n && /* @__PURE__ */ p(U, {
911
934
  backup: n,
912
935
  onClose: () => a(null)
913
936
  }),
914
- s && /* @__PURE__ */ p(te, {
937
+ s && /* @__PURE__ */ p(ie, {
915
938
  backup: s,
916
939
  busy: b.isPending,
917
940
  onCancel: () => c(null),
@@ -921,7 +944,7 @@ function K() {
921
944
  })
922
945
  ] });
923
946
  }
924
- function te(e) {
947
+ function ie(e) {
925
948
  let { backup: t, busy: n, onCancel: r, onConfirm: i } = e;
926
949
  return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", { className: "modal-backdrop show" }), /* @__PURE__ */ p("div", {
927
950
  className: "modal show d-block",
@@ -987,12 +1010,12 @@ function te(e) {
987
1010
  })
988
1011
  })] });
989
1012
  }
990
- function q(e) {
1013
+ function K(e) {
991
1014
  return e instanceof Error ? e.message : String(e);
992
1015
  }
993
1016
  //#endregion
994
1017
  //#region src/components/CreateBackupTab.tsx
995
- function J() {
1018
+ function q() {
996
1019
  let e = k(), t = T(), n = E(t.data?.configured), [r, a] = o(!0), [s, c] = o({
997
1020
  format: "plain",
998
1021
  includeData: !0,
@@ -1001,7 +1024,7 @@ function J() {
1001
1024
  includeIndexes: !0,
1002
1025
  includeConstraints: !0,
1003
1026
  includeRelatedTables: !1
1004
- }), [l, u] = o(() => /* @__PURE__ */ new Set()), [d, f] = o(null), [h, g] = o({}), [_, v] = o(""), y = D(d, t.data?.configured), b = i(() => new Set((t.data?.exportExcludedTables ?? []).map(re)), [t.data?.exportExcludedTables]), x = i(() => {
1027
+ }), [l, u] = o(() => /* @__PURE__ */ new Set()), [d, f] = o(null), [h, g] = o({}), [_, v] = o(""), y = D(d, t.data?.configured), b = i(() => new Set((t.data?.exportExcludedTables ?? []).map(oe)), [t.data?.exportExcludedTables]), x = i(() => {
1005
1028
  let e = n.data ?? [], t = _.trim().toLowerCase();
1006
1029
  return t ? e.filter((e) => e.fullName.toLowerCase().includes(t)) : e;
1007
1030
  }, [n.data, _]), S = i(() => Object.values(h).reduce((e, t) => e + t.length, 0), [h]), C = (e) => {
@@ -1042,7 +1065,7 @@ function J() {
1042
1065
  children: "Selecione as tabelas no grid e expanda um card para marcar colunas cujo conteúdo será nulificado na exportação. Apenas o dump do banco é enviado ao storage de destino."
1043
1066
  })]
1044
1067
  }),
1045
- /* @__PURE__ */ p(U, {
1068
+ /* @__PURE__ */ p(H, {
1046
1069
  label: "Banco de destino",
1047
1070
  dbInfo: t.data,
1048
1071
  isLoading: t.isLoading,
@@ -1101,7 +1124,7 @@ function J() {
1101
1124
  "aria-hidden": !0
1102
1125
  }),
1103
1126
  "Falha ao listar tabelas: ",
1104
- G(n.error)
1127
+ W(n.error)
1105
1128
  ]
1106
1129
  }),
1107
1130
  x.length === 0 && !n.isLoading && /* @__PURE__ */ p("div", {
@@ -1117,7 +1140,7 @@ function J() {
1117
1140
  maxHeight: 420,
1118
1141
  overflow: "auto"
1119
1142
  },
1120
- children: x.map((e) => /* @__PURE__ */ p(ne, {
1143
+ children: x.map((e) => /* @__PURE__ */ p(ae, {
1121
1144
  table: e,
1122
1145
  disabled: b.has(e.fullName),
1123
1146
  selected: l.has(e.fullName),
@@ -1278,7 +1301,7 @@ function J() {
1278
1301
  "aria-hidden": !0
1279
1302
  }),
1280
1303
  "Falha ao criar backup: ",
1281
- G(e.error)
1304
+ W(e.error)
1282
1305
  ]
1283
1306
  }),
1284
1307
  e.isSuccess && /* @__PURE__ */ m("div", {
@@ -1317,7 +1340,7 @@ function J() {
1317
1340
  })
1318
1341
  ] });
1319
1342
  }
1320
- function ne({ table: e, disabled: t, selected: n, expanded: r, excluded: i, detail: a, onToggleTable: o, onToggleExpand: s, onToggleColumn: c }) {
1343
+ function ae({ table: e, disabled: t, selected: n, expanded: r, excluded: i, detail: a, onToggleTable: o, onToggleExpand: s, onToggleColumn: c }) {
1321
1344
  return /* @__PURE__ */ p("div", {
1322
1345
  className: `card h-100 ${n ? "border-primary" : ""}`,
1323
1346
  style: { minWidth: 0 },
@@ -1381,7 +1404,7 @@ function ne({ table: e, disabled: t, selected: n, expanded: r, excluded: i, deta
1381
1404
  }),
1382
1405
  a?.isError && /* @__PURE__ */ m("small", {
1383
1406
  className: "text-danger",
1384
- children: ["Erro: ", G(a.error)]
1407
+ children: ["Erro: ", W(a.error)]
1385
1408
  }),
1386
1409
  a?.data && /* @__PURE__ */ m(f, { children: [a.data.columns.map((e) => /* @__PURE__ */ m("div", {
1387
1410
  className: "d-flex align-items-center gap-2 py-1",
@@ -1432,13 +1455,13 @@ function ne({ table: e, disabled: t, selected: n, expanded: r, excluded: i, deta
1432
1455
  })
1433
1456
  });
1434
1457
  }
1435
- function re(e) {
1458
+ function oe(e) {
1436
1459
  let t = e.trim();
1437
1460
  return t.includes(".") ? t : `public.${t}`;
1438
1461
  }
1439
1462
  //#endregion
1440
1463
  //#region src/components/DiagnosticsTab.tsx
1441
- function Y() {
1464
+ function J() {
1442
1465
  let { data: e, isLoading: t, isError: n, error: r, refetch: a, isFetching: o } = C(), s = i(() => e ? {
1443
1466
  total: e.length,
1444
1467
  okCount: e.filter((e) => e.ok).length,
@@ -1479,7 +1502,7 @@ function Y() {
1479
1502
  "aria-hidden": !0
1480
1503
  }),
1481
1504
  "Não foi possível executar as checagens: ",
1482
- G(r)
1505
+ W(r)
1483
1506
  ]
1484
1507
  }),
1485
1508
  s && /* @__PURE__ */ m("div", {
@@ -1516,7 +1539,7 @@ function Y() {
1516
1539
  className: "card",
1517
1540
  children: /* @__PURE__ */ m("ul", {
1518
1541
  className: "list-group list-group-flush",
1519
- children: [(e ?? []).map((e) => /* @__PURE__ */ p(ie, { check: e }, e.name)), e && e.length === 0 && /* @__PURE__ */ p("li", {
1542
+ children: [(e ?? []).map((e) => /* @__PURE__ */ p(se, { check: e }, e.name)), e && e.length === 0 && /* @__PURE__ */ p("li", {
1520
1543
  className: "list-group-item text-center text-muted py-4",
1521
1544
  children: "Nenhuma checagem retornada."
1522
1545
  })]
@@ -1524,7 +1547,7 @@ function Y() {
1524
1547
  })
1525
1548
  ] });
1526
1549
  }
1527
- function ie({ check: e }) {
1550
+ function se({ check: e }) {
1528
1551
  let t = e.configured ? e.ok ? "bi-check-circle-fill text-success" : "bi-x-octagon-fill text-danger" : "bi-dash-circle text-secondary", n = e.configured ? e.ok ? "text-bg-success" : "text-bg-danger" : "text-bg-secondary", r = e.configured ? e.ok ? "OK" : "Falha" : "Não configurado";
1529
1552
  return /* @__PURE__ */ m("li", {
1530
1553
  className: "list-group-item d-flex align-items-start gap-3",
@@ -1560,7 +1583,7 @@ function ie({ check: e }) {
1560
1583
  }
1561
1584
  //#endregion
1562
1585
  //#region src/components/StorageExplorerTab.tsx
1563
- function X({ storageType: e = "LOCAL", storageConfig: n }) {
1586
+ function Y({ storageType: e = "LOCAL", storageConfig: n }) {
1564
1587
  let i = b(), s = d(), [c, h] = o(""), [g, _] = o([]), [v, y] = o(/* @__PURE__ */ new Set()), [x, S] = o(null), C = n?.type ?? e, { data: w, isLoading: T } = u({
1565
1588
  queryKey: [
1566
1589
  "storage-files",
@@ -1597,7 +1620,7 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
1597
1620
  } catch {}
1598
1621
  }, N = async () => {
1599
1622
  for (let e of v) await M(e);
1600
- }, P = (e) => e ? R(e) : "-";
1623
+ }, P = (e) => e ? L(e) : "-";
1601
1624
  return /* @__PURE__ */ m("div", {
1602
1625
  className: "space-y-3",
1603
1626
  children: [
@@ -1727,7 +1750,7 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
1727
1750
  }) }),
1728
1751
  /* @__PURE__ */ p("td", {
1729
1752
  className: "text-muted small",
1730
- children: e.directory ? "-" : L(e.size)
1753
+ children: e.directory ? "-" : I(e.size)
1731
1754
  }),
1732
1755
  /* @__PURE__ */ p("td", {
1733
1756
  className: "text-muted small",
@@ -1832,7 +1855,7 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
1832
1855
  }
1833
1856
  //#endregion
1834
1857
  //#region src/components/ImportDumpTab.tsx
1835
- function Z() {
1858
+ function X() {
1836
1859
  let e = P(), t = F(), n = T(), r = a(null), [i, s] = o("upload"), [c, l] = o(null), [u, d] = o(""), [f, h] = o(!1), g = () => {
1837
1860
  i === "upload" && c ? e.mutate({ file: c }) : i === "storage" && u && t.mutate({
1838
1861
  storageType: "LOCAL",
@@ -1955,7 +1978,7 @@ function Z() {
1955
1978
  maxHeight: 350,
1956
1979
  overflow: "auto"
1957
1980
  },
1958
- children: /* @__PURE__ */ p(X, {
1981
+ children: /* @__PURE__ */ p(Y, {
1959
1982
  storageType: "LOCAL",
1960
1983
  storageConfig: {
1961
1984
  type: "LOCAL",
@@ -1978,7 +2001,7 @@ function Z() {
1978
2001
  children: [/* @__PURE__ */ p("p", {
1979
2002
  className: "small text-body-secondary mb-3",
1980
2003
  children: "O dump será aplicado no banco configurado no servidor. Tabelas bloqueadas por segurança são ignoradas automaticamente na importação."
1981
- }), /* @__PURE__ */ p(U, {
2004
+ }), /* @__PURE__ */ p(H, {
1982
2005
  label: "Banco de destino",
1983
2006
  dbInfo: n.data,
1984
2007
  isLoading: n.isLoading,
@@ -1994,7 +2017,7 @@ function Z() {
1994
2017
  "aria-hidden": !0
1995
2018
  }),
1996
2019
  "Falha na importacao: ",
1997
- G(y)
2020
+ W(y)
1998
2021
  ]
1999
2022
  }),
2000
2023
  v && /* @__PURE__ */ m("div", {
@@ -2036,7 +2059,7 @@ function Z() {
2036
2059
  }
2037
2060
  //#endregion
2038
2061
  //#region src/components/StorageBackupTab.tsx
2039
- function Q() {
2062
+ function Z() {
2040
2063
  let e = k(), t = C(), n = t.data?.find((e) => e.name === "ORIGIN_STORAGE"), r = t.data?.find((e) => e.name === "OUTPUT_STORAGE"), i = e.isPending;
2041
2064
  return /* @__PURE__ */ m("div", { children: [
2042
2065
  /* @__PURE__ */ m("div", {
@@ -2079,12 +2102,12 @@ function Q() {
2079
2102
  }),
2080
2103
  t.data && /* @__PURE__ */ m("div", {
2081
2104
  className: "d-flex flex-column gap-2",
2082
- children: [/* @__PURE__ */ p($, {
2105
+ children: [/* @__PURE__ */ p(Q, {
2083
2106
  label: n?.label ?? "Storage de origem",
2084
2107
  configured: n?.configured,
2085
2108
  ok: n?.ok,
2086
2109
  message: n?.message
2087
- }), /* @__PURE__ */ p($, {
2110
+ }), /* @__PURE__ */ p(Q, {
2088
2111
  label: r?.label ?? "Storage de destino",
2089
2112
  configured: r?.configured,
2090
2113
  ok: r?.ok,
@@ -2102,7 +2125,7 @@ function Q() {
2102
2125
  "aria-hidden": !0
2103
2126
  }),
2104
2127
  "Falha ao criar backup de storage: ",
2105
- G(e.error)
2128
+ W(e.error)
2106
2129
  ]
2107
2130
  }),
2108
2131
  e.isSuccess && /* @__PURE__ */ m("div", {
@@ -2143,7 +2166,7 @@ function Q() {
2143
2166
  })
2144
2167
  ] });
2145
2168
  }
2146
- function $({ label: e, configured: t, ok: n, message: r }) {
2169
+ function Q({ label: e, configured: t, ok: n, message: r }) {
2147
2170
  return t === !1 ? /* @__PURE__ */ m("div", {
2148
2171
  className: "d-flex align-items-center gap-2 small text-muted",
2149
2172
  children: [/* @__PURE__ */ p("i", {
@@ -2164,13 +2187,13 @@ function $({ label: e, configured: t, ok: n, message: r }) {
2164
2187
  }
2165
2188
  //#endregion
2166
2189
  //#region src/hooks/useAutoTheme.ts
2167
- function ae() {
2190
+ function $() {
2168
2191
  return typeof document < "u" && document.documentElement.classList.contains("dark");
2169
2192
  }
2170
- function oe(e) {
2171
- let [t, n] = o(ae), [i, a] = o(() => typeof window < "u" && window.matchMedia?.("(prefers-color-scheme: dark)")?.matches === !0);
2193
+ function ce(e) {
2194
+ let [t, n] = o($), [i, a] = o(() => typeof window < "u" && window.matchMedia?.("(prefers-color-scheme: dark)")?.matches === !0);
2172
2195
  return r(() => {
2173
- let e = document.documentElement, t = new MutationObserver(() => n(ae()));
2196
+ let e = document.documentElement, t = new MutationObserver(() => n($()));
2174
2197
  return t.observe(e, {
2175
2198
  attributes: !0,
2176
2199
  attributeFilter: ["class"]
@@ -2183,8 +2206,8 @@ function oe(e) {
2183
2206
  }
2184
2207
  //#endregion
2185
2208
  //#region src/components/MinivaultModule.tsx
2186
- function se(e) {
2187
- let { companyAcronym: t = "Minivault", theme: n, refetchIntervalMs: r = 15e3, storageType: i = "LOCAL", ...a } = e, l = oe(n), [u] = o(() => new s({ defaultOptions: { queries: {
2209
+ function le(e) {
2210
+ let { companyAcronym: t = "Minivault", theme: n, refetchIntervalMs: r = 15e3, storageType: i = "LOCAL", ...a } = e, l = ce(n), [u] = o(() => new s({ defaultOptions: { queries: {
2188
2211
  refetchInterval: r,
2189
2212
  retry: 1
2190
2213
  } } }));
@@ -2195,15 +2218,15 @@ function se(e) {
2195
2218
  children: /* @__PURE__ */ m("div", {
2196
2219
  className: "minivault-module h-full w-full overflow-auto",
2197
2220
  "data-minivault-theme": l,
2198
- children: [/* @__PURE__ */ p(ce, {
2221
+ children: [/* @__PURE__ */ p(ue, {
2199
2222
  companyAcronym: t,
2200
2223
  theme: l
2201
- }), /* @__PURE__ */ p(le, { storageType: i })]
2224
+ }), /* @__PURE__ */ p(de, { storageType: i })]
2202
2225
  })
2203
2226
  })
2204
2227
  });
2205
2228
  }
2206
- function ce({ companyAcronym: e, theme: t }) {
2229
+ function ue({ companyAcronym: e, theme: t }) {
2207
2230
  return /* @__PURE__ */ m("div", {
2208
2231
  className: "d-flex align-items-center justify-content-between flex-wrap gap-2 px-3 py-2 border-bottom",
2209
2232
  style: {
@@ -2232,7 +2255,7 @@ function ce({ companyAcronym: e, theme: t }) {
2232
2255
  })]
2233
2256
  });
2234
2257
  }
2235
- function le({ storageType: e }) {
2258
+ function de({ storageType: e }) {
2236
2259
  let [t, n] = o("backups");
2237
2260
  return /* @__PURE__ */ m("div", {
2238
2261
  className: "p-3",
@@ -2314,23 +2337,23 @@ function le({ storageType: e }) {
2314
2337
  })
2315
2338
  ]
2316
2339
  }),
2317
- t === "backups" && /* @__PURE__ */ p(K, {}),
2318
- t === "create" && /* @__PURE__ */ p(J, {}),
2319
- t === "createStorage" && /* @__PURE__ */ p(Q, {}),
2320
- t === "import" && /* @__PURE__ */ p(Z, {}),
2321
- t === "storage" && /* @__PURE__ */ p(X, { storageType: e }),
2322
- t === "diagnostics" && /* @__PURE__ */ p(Y, {})
2340
+ t === "backups" && /* @__PURE__ */ p(G, {}),
2341
+ t === "create" && /* @__PURE__ */ p(q, {}),
2342
+ t === "createStorage" && /* @__PURE__ */ p(Z, {}),
2343
+ t === "import" && /* @__PURE__ */ p(X, {}),
2344
+ t === "storage" && /* @__PURE__ */ p(Y, { storageType: e }),
2345
+ t === "diagnostics" && /* @__PURE__ */ p(J, {})
2323
2346
  ]
2324
2347
  });
2325
2348
  }
2326
2349
  //#endregion
2327
2350
  //#region src/components/CredentialsFields.tsx
2328
- var ue = [
2351
+ var fe = [
2329
2352
  "postgresql",
2330
2353
  "mysql",
2331
2354
  "sqlserver"
2332
2355
  ];
2333
- function de() {
2356
+ function pe() {
2334
2357
  return {
2335
2358
  host: "localhost",
2336
2359
  port: 5432,
@@ -2340,19 +2363,19 @@ function de() {
2340
2363
  databaseType: "postgresql"
2341
2364
  };
2342
2365
  }
2343
- function fe(e) {
2366
+ function me(e) {
2344
2367
  return e === "postgresql" || e === "postgres" ? 5432 : e === "mysql" ? 3306 : 1433;
2345
2368
  }
2346
- function pe({ value: e, onChange: t, onValidatedChange: n }) {
2369
+ function he({ value: e, onChange: t, onValidatedChange: n }) {
2347
2370
  let r = {
2348
- ...de(),
2371
+ ...pe(),
2349
2372
  ...e
2350
2373
  }, i = (e) => {
2351
2374
  let n = {
2352
2375
  ...r,
2353
2376
  databaseType: e
2354
2377
  };
2355
- (r.port === fe(r.databaseType) || !r.port) && (n.port = fe(e)), t(n);
2378
+ (r.port === me(r.databaseType) || !r.port) && (n.port = me(e)), t(n);
2356
2379
  }, a = (e) => {
2357
2380
  let i = {
2358
2381
  ...r,
@@ -2374,9 +2397,9 @@ function pe({ value: e, onChange: t, onValidatedChange: n }) {
2374
2397
  className: "form-select",
2375
2398
  value: r.databaseType,
2376
2399
  onChange: (e) => i(e.target.value),
2377
- children: ue.map((e) => /* @__PURE__ */ p("option", {
2400
+ children: fe.map((e) => /* @__PURE__ */ p("option", {
2378
2401
  value: e,
2379
- children: V[e] ?? e
2402
+ children: B[e] ?? e
2380
2403
  }, e))
2381
2404
  })]
2382
2405
  }),
@@ -2448,4 +2471,4 @@ function pe({ value: e, onChange: t, onValidatedChange: n }) {
2448
2471
  });
2449
2472
  }
2450
2473
  //#endregion
2451
- export { K as BackupsTab, J as CreateBackupTab, pe as CredentialsFields, V as DATABASE_TYPE_LABELS, U as DatabaseBanner, Y as DiagnosticsTab, Z as ImportDumpTab, g as MinivaultApi, h as MinivaultApiError, y as MinivaultApiProvider, se as MinivaultModule, W as RestoreModal, B as STATUS_BADGE, z as STATUS_LABELS, H as StatusBadge, Q as StorageBackupTab, X as StorageExplorerTab, R as formatDate, L as formatFileSize, w as useBackups, k as useCreateBackup, T as useDbInfo, O as useDbRelationships, D as useDbTableDetail, E as useDbTables, j as useDeleteBackup, C as useDiagnostics, N as useDownloadBackup, P as useImportDump, F as useImportFromStorage, b as useMinivaultApi, A as useRestoreBackup };
2474
+ export { G as BackupsTab, q as CreateBackupTab, he as CredentialsFields, B as DATABASE_TYPE_LABELS, H as DatabaseBanner, J as DiagnosticsTab, X as ImportDumpTab, g as MinivaultApi, h as MinivaultApiError, y as MinivaultApiProvider, le as MinivaultModule, U as RestoreModal, z as STATUS_BADGE, R as STATUS_LABELS, V as StatusBadge, Z as StorageBackupTab, Y as StorageExplorerTab, L as formatDate, I as formatFileSize, w as useBackups, k as useCreateBackup, T as useDbInfo, O as useDbRelationships, D as useDbTableDetail, E as useDbTables, j as useDeleteBackup, C as useDiagnostics, N as useDownloadBackup, P as useImportDump, F as useImportFromStorage, b as useMinivaultApi, A as useRestoreBackup };
@@ -8,6 +8,8 @@ export interface Backup {
8
8
  fileSize: number | null;
9
9
  status: BackupStatus;
10
10
  databaseType: string;
11
+ backupType: BackupType | null;
12
+ filePath: string | null;
11
13
  sha256: string | null;
12
14
  retentionDays: number | null;
13
15
  errorMessage: string | null;
@@ -1,6 +1,8 @@
1
- import { BackupStatus } from '../types/minivault';
1
+ import { BackupStatus, BackupType } from '../types/minivault';
2
2
  export declare function formatFileSize(bytes: number | null | undefined): string;
3
3
  export declare function formatDate(value: string | null | undefined): string;
4
4
  export declare const STATUS_LABELS: Record<BackupStatus, string>;
5
5
  export declare const STATUS_BADGE: Record<BackupStatus, string>;
6
6
  export declare const DATABASE_TYPE_LABELS: Record<string, string>;
7
+ export declare const BACKUP_TYPE_LABELS: Record<BackupType, string>;
8
+ export declare const BACKUP_TYPE_BADGE: Record<BackupType, string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v1ct0rbr/minivault-web",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
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",