@datatruck/cli 0.32.3 → 0.33.0

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 (127) hide show
  1. package/config.schema.json +374 -31
  2. package/lib/{Action → actions}/BackupAction.d.ts +5 -17
  3. package/lib/{Action → actions}/BackupAction.js +32 -85
  4. package/lib/{Action → actions}/ConfigAction.d.ts +4 -2
  5. package/lib/{Action → actions}/ConfigAction.js +16 -8
  6. package/lib/{Action → actions}/CopyAction.d.ts +17 -13
  7. package/lib/actions/CopyAction.js +285 -0
  8. package/lib/{Action → actions}/InitAction.d.ts +1 -1
  9. package/lib/{Action → actions}/InitAction.js +3 -3
  10. package/lib/{Action → actions}/PruneAction.d.ts +1 -2
  11. package/lib/{Action → actions}/PruneAction.js +2 -2
  12. package/lib/{Action → actions}/RestoreAction.d.ts +4 -13
  13. package/lib/{Action → actions}/RestoreAction.js +17 -17
  14. package/lib/{Action → actions}/SnapshotsAction.d.ts +2 -3
  15. package/lib/{Action → actions}/SnapshotsAction.js +3 -3
  16. package/lib/cli.d.ts +3 -3
  17. package/lib/cli.js +18 -17
  18. package/lib/commands/BackupCommand.d.ts +43 -0
  19. package/lib/{Command → commands}/BackupCommand.js +7 -6
  20. package/lib/{Command → commands}/CleanCacheCommand.d.ts +4 -2
  21. package/lib/{Command → commands}/CleanCacheCommand.js +6 -5
  22. package/lib/{Command → commands}/CommandAbstract.d.ts +10 -6
  23. package/lib/{Command → commands}/CommandAbstract.js +5 -3
  24. package/lib/commands/ConfigCommand.d.ts +22 -0
  25. package/lib/{Command → commands}/ConfigCommand.js +5 -5
  26. package/lib/commands/CopyCommand.d.ts +17 -0
  27. package/lib/{Command → commands}/CopyCommand.js +7 -6
  28. package/lib/commands/InitCommand.d.ts +19 -0
  29. package/lib/{Command → commands}/InitCommand.js +9 -9
  30. package/lib/{Command → commands}/PruneCommand.d.ts +7 -4
  31. package/lib/{Command → commands}/PruneCommand.js +11 -11
  32. package/lib/commands/RestoreCommand.d.ts +38 -0
  33. package/lib/{Command → commands}/RestoreCommand.js +7 -6
  34. package/lib/{Command → commands}/SnapshotsCommand.d.ts +8 -6
  35. package/lib/{Command → commands}/SnapshotsCommand.js +12 -12
  36. package/lib/{Command → commands}/StartServerCommand.d.ts +4 -2
  37. package/lib/{Command → commands}/StartServerCommand.js +5 -5
  38. package/lib/index.d.ts +20 -23
  39. package/lib/index.js +8 -8
  40. package/lib/{Repository → repositories}/DatatruckRepository.js +2 -2
  41. package/lib/{Repository → repositories}/RepositoryAbstract.d.ts +7 -7
  42. package/lib/{Repository → repositories}/ResticRepository.js +7 -6
  43. package/lib/{Task → tasks}/MssqlTask.js +2 -2
  44. package/lib/{Task → tasks}/MysqlDumpTask.js +4 -4
  45. package/lib/{Task → tasks}/ScriptTask.d.ts +2 -2
  46. package/lib/{Task → tasks}/SqlDumpTaskAbstract.js +4 -4
  47. package/lib/{Task → tasks}/TaskAbstract.d.ts +4 -4
  48. package/lib/utils/DataFormat.js +3 -3
  49. package/lib/utils/Restic.d.ts +1 -0
  50. package/lib/utils/Restic.js +12 -2
  51. package/lib/utils/cli.d.ts +9 -3
  52. package/lib/utils/cli.js +17 -1
  53. package/lib/utils/cron.d.ts +11 -0
  54. package/lib/utils/cron.js +27 -0
  55. package/lib/utils/datatruck/command.d.ts +29 -0
  56. package/lib/utils/datatruck/command.js +61 -0
  57. package/lib/{Config/RepositoryConfig.d.ts → utils/datatruck/config-repository-type.d.ts} +19 -8
  58. package/lib/{Config/TaskConfig.d.ts → utils/datatruck/config-task-type.d.ts} +6 -6
  59. package/lib/utils/datatruck/config-type.d.ts +50 -0
  60. package/lib/utils/datatruck/config.d.ts +19 -10
  61. package/lib/utils/datatruck/config.js +43 -7
  62. package/lib/utils/datatruck/cron-server.d.ts +27 -6
  63. package/lib/utils/datatruck/cron-server.js +38 -20
  64. package/lib/utils/datatruck/paths.d.ts +2 -2
  65. package/lib/utils/datatruck/report-list.d.ts +12 -0
  66. package/lib/utils/datatruck/report-list.js +57 -0
  67. package/lib/utils/datatruck/repository-server.js +3 -2
  68. package/lib/utils/datatruck/repository.d.ts +16 -0
  69. package/lib/utils/datatruck/repository.js +30 -0
  70. package/lib/utils/datatruck/snapshot.d.ts +2 -2
  71. package/lib/utils/datatruck/task.d.ts +3 -0
  72. package/lib/{Factory/TaskFactory.js → utils/datatruck/task.js} +8 -8
  73. package/lib/utils/date.js +6 -2
  74. package/lib/utils/fs.d.ts +3 -0
  75. package/lib/utils/fs.js +24 -4
  76. package/lib/utils/list.d.ts +5 -5
  77. package/lib/utils/mysql.js +5 -5
  78. package/lib/utils/object.d.ts +13 -0
  79. package/lib/utils/object.js +32 -1
  80. package/lib/utils/process.js +4 -1
  81. package/lib/utils/string.d.ts +1 -0
  82. package/lib/utils/string.js +7 -3
  83. package/lib/utils/ts.d.ts +16 -0
  84. package/lib/utils/watcher.d.ts +10 -0
  85. package/lib/utils/watcher.js +34 -0
  86. package/package.json +3 -3
  87. package/lib/Action/CopyAction.js +0 -164
  88. package/lib/Command/BackupCommand.d.ts +0 -19
  89. package/lib/Command/ConfigCommand.d.ts +0 -15
  90. package/lib/Command/CopyCommand.d.ts +0 -16
  91. package/lib/Command/InitCommand.d.ts +0 -13
  92. package/lib/Command/RestoreCommand.d.ts +0 -17
  93. package/lib/Config/Config.d.ts +0 -28
  94. package/lib/Config/PackageConfig.d.ts +0 -24
  95. package/lib/Config/PackageRepositoryConfig.d.ts +0 -15
  96. package/lib/Config/PrunePolicyConfig.d.ts +0 -2
  97. package/lib/Config/RepositoryConfig.js +0 -2
  98. package/lib/Config/TaskConfig.js +0 -2
  99. package/lib/Factory/CommandFactory.d.ts +0 -45
  100. package/lib/Factory/CommandFactory.js +0 -96
  101. package/lib/Factory/RepositoryFactory.d.ts +0 -3
  102. package/lib/Factory/RepositoryFactory.js +0 -23
  103. package/lib/Factory/TaskFactory.d.ts +0 -3
  104. /package/lib/{Action → actions}/CleanCacheAction.d.ts +0 -0
  105. /package/lib/{Action → actions}/CleanCacheAction.js +0 -0
  106. /package/lib/{Repository → repositories}/DatatruckRepository.d.ts +0 -0
  107. /package/lib/{Repository → repositories}/GitRepository.d.ts +0 -0
  108. /package/lib/{Repository → repositories}/GitRepository.js +0 -0
  109. /package/lib/{Repository → repositories}/RepositoryAbstract.js +0 -0
  110. /package/lib/{Repository → repositories}/ResticRepository.d.ts +0 -0
  111. /package/lib/{Task → tasks}/GitTask.d.ts +0 -0
  112. /package/lib/{Task → tasks}/GitTask.js +0 -0
  113. /package/lib/{Task → tasks}/MariadbTask.d.ts +0 -0
  114. /package/lib/{Task → tasks}/MariadbTask.js +0 -0
  115. /package/lib/{Task → tasks}/MssqlTask.d.ts +0 -0
  116. /package/lib/{Task → tasks}/MysqlDumpTask.d.ts +0 -0
  117. /package/lib/{Task → tasks}/PostgresqlDumpTask.d.ts +0 -0
  118. /package/lib/{Task → tasks}/PostgresqlDumpTask.js +0 -0
  119. /package/lib/{Task → tasks}/ScriptTask.js +0 -0
  120. /package/lib/{Task → tasks}/SqlDumpTaskAbstract.d.ts +0 -0
  121. /package/lib/{Task → tasks}/TaskAbstract.js +0 -0
  122. /package/lib/{Config/Config.js → utils/datatruck/config-repository-type.js} +0 -0
  123. /package/lib/{Config/PackageConfig.js → utils/datatruck/config-task-type.js} +0 -0
  124. /package/lib/{Config/PackageRepositoryConfig.js → utils/datatruck/config-type.js} +0 -0
  125. /package/lib/{Error/AppError.d.ts → utils/datatruck/error.d.ts} +0 -0
  126. /package/lib/{Error/AppError.js → utils/datatruck/error.js} +0 -0
  127. /package/lib/{Config/PrunePolicyConfig.js → utils/ts.js} +0 -0
@@ -493,7 +493,7 @@
493
493
  }
494
494
  },
495
495
  "prunePolicy": {
496
- "$ref": "#/definitions/PrunePolicyConfig"
496
+ "$ref": "#/definitions/DatatruckPolicyConfig"
497
497
  },
498
498
  "repositoryConfigs": {
499
499
  "type": "array",
@@ -717,7 +717,7 @@
717
717
  }
718
718
  },
719
719
  "prunePolicy": {
720
- "$ref": "#/definitions/PrunePolicyConfig"
720
+ "$ref": "#/definitions/DatatruckPolicyConfig"
721
721
  }
722
722
  },
723
723
  "additionalProperties": false,
@@ -894,7 +894,7 @@
894
894
  "RepositoryEnabledObject": {
895
895
  "type": "object",
896
896
  "properties": {
897
- "snapshots": {
897
+ "backup": {
898
898
  "type": "boolean"
899
899
  },
900
900
  "init": {
@@ -903,10 +903,10 @@
903
903
  "prune": {
904
904
  "type": "boolean"
905
905
  },
906
- "backup": {
906
+ "restore": {
907
907
  "type": "boolean"
908
908
  },
909
- "restore": {
909
+ "snapshots": {
910
910
  "type": "boolean"
911
911
  },
912
912
  "defaults": {
@@ -959,21 +959,21 @@
959
959
  "path": {
960
960
  "type": "string"
961
961
  },
962
- "protocol": {
963
- "enum": [
964
- "http",
965
- "https"
966
- ],
962
+ "username": {
967
963
  "type": "string"
968
964
  },
969
965
  "host": {
970
966
  "type": "string"
971
967
  },
972
- "username": {
973
- "type": "string"
974
- },
975
968
  "port": {
976
969
  "type": "number"
970
+ },
971
+ "protocol": {
972
+ "enum": [
973
+ "http",
974
+ "https"
975
+ ],
976
+ "type": "string"
977
977
  }
978
978
  }
979
979
  },
@@ -1188,7 +1188,7 @@
1188
1188
  }
1189
1189
  }
1190
1190
  },
1191
- "PrunePolicyConfig": {
1191
+ "DatatruckPolicyConfig": {
1192
1192
  "type": "object",
1193
1193
  "properties": {
1194
1194
  "tags": {
@@ -1197,6 +1197,17 @@
1197
1197
  "type": "string"
1198
1198
  }
1199
1199
  },
1200
+ "groupBy": {
1201
+ "type": "array",
1202
+ "items": {
1203
+ "enum": [
1204
+ "packageName",
1205
+ "repositoryName",
1206
+ "repositoryType"
1207
+ ],
1208
+ "type": "string"
1209
+ }
1210
+ },
1200
1211
  "keepDaily": {
1201
1212
  "type": "number"
1202
1213
  },
@@ -1217,17 +1228,6 @@
1217
1228
  },
1218
1229
  "keepYearly": {
1219
1230
  "type": "number"
1220
- },
1221
- "groupBy": {
1222
- "type": "array",
1223
- "items": {
1224
- "enum": [
1225
- "packageName",
1226
- "repositoryName",
1227
- "repositoryType"
1228
- ],
1229
- "type": "string"
1230
- }
1231
1231
  }
1232
1232
  },
1233
1233
  "additionalProperties": false
@@ -1392,10 +1392,101 @@
1392
1392
  "CronAction": {
1393
1393
  "anyOf": [
1394
1394
  {
1395
+ "additionalProperties": false,
1395
1396
  "type": "object",
1396
1397
  "properties": {
1397
1398
  "schedule": {
1398
- "type": "string"
1399
+ "anyOf": [
1400
+ {
1401
+ "type": "object",
1402
+ "properties": {
1403
+ "minute": {
1404
+ "anyOf": [
1405
+ {
1406
+ "type": "object",
1407
+ "properties": {
1408
+ "each": {
1409
+ "type": "number"
1410
+ }
1411
+ },
1412
+ "additionalProperties": false
1413
+ },
1414
+ {
1415
+ "type": "number"
1416
+ }
1417
+ ]
1418
+ },
1419
+ "hour": {
1420
+ "anyOf": [
1421
+ {
1422
+ "type": "object",
1423
+ "properties": {
1424
+ "each": {
1425
+ "type": "number"
1426
+ }
1427
+ },
1428
+ "additionalProperties": false
1429
+ },
1430
+ {
1431
+ "type": "number"
1432
+ }
1433
+ ]
1434
+ },
1435
+ "day": {
1436
+ "anyOf": [
1437
+ {
1438
+ "type": "object",
1439
+ "properties": {
1440
+ "each": {
1441
+ "type": "number"
1442
+ }
1443
+ },
1444
+ "additionalProperties": false
1445
+ },
1446
+ {
1447
+ "type": "number"
1448
+ }
1449
+ ]
1450
+ },
1451
+ "month": {
1452
+ "anyOf": [
1453
+ {
1454
+ "type": "object",
1455
+ "properties": {
1456
+ "each": {
1457
+ "type": "number"
1458
+ }
1459
+ },
1460
+ "additionalProperties": false
1461
+ },
1462
+ {
1463
+ "type": "number"
1464
+ }
1465
+ ]
1466
+ },
1467
+ "weekDay": {
1468
+ "anyOf": [
1469
+ {
1470
+ "type": "object",
1471
+ "properties": {
1472
+ "each": {
1473
+ "type": "number"
1474
+ }
1475
+ },
1476
+ "additionalProperties": false
1477
+ },
1478
+ {
1479
+ "type": "number"
1480
+ }
1481
+ ]
1482
+ }
1483
+ },
1484
+ "additionalProperties": false
1485
+ },
1486
+ {
1487
+ "type": "string"
1488
+ }
1489
+ ]
1399
1490
  },
1400
1491
  "name": {
1401
1492
  "type": "string",
@@ -1431,14 +1522,104 @@
1431
1522
  },
1432
1523
  "additionalProperties": false
1433
1524
  }
1434
- },
1435
- "additionalProperties": false
1525
+ }
1436
1526
  },
1437
1527
  {
1528
+ "additionalProperties": false,
1438
1529
  "type": "object",
1439
1530
  "properties": {
1440
1531
  "schedule": {
1441
- "type": "string"
1532
+ "anyOf": [
1533
+ {
1534
+ "type": "object",
1535
+ "properties": {
1536
+ "minute": {
1537
+ "anyOf": [
1538
+ {
1539
+ "type": "object",
1540
+ "properties": {
1541
+ "each": {
1542
+ "type": "number"
1543
+ }
1544
+ },
1545
+ "additionalProperties": false
1546
+ },
1547
+ {
1548
+ "type": "number"
1549
+ }
1550
+ ]
1551
+ },
1552
+ "hour": {
1553
+ "anyOf": [
1554
+ {
1555
+ "type": "object",
1556
+ "properties": {
1557
+ "each": {
1558
+ "type": "number"
1559
+ }
1560
+ },
1561
+ "additionalProperties": false
1562
+ },
1563
+ {
1564
+ "type": "number"
1565
+ }
1566
+ ]
1567
+ },
1568
+ "day": {
1569
+ "anyOf": [
1570
+ {
1571
+ "type": "object",
1572
+ "properties": {
1573
+ "each": {
1574
+ "type": "number"
1575
+ }
1576
+ },
1577
+ "additionalProperties": false
1578
+ },
1579
+ {
1580
+ "type": "number"
1581
+ }
1582
+ ]
1583
+ },
1584
+ "month": {
1585
+ "anyOf": [
1586
+ {
1587
+ "type": "object",
1588
+ "properties": {
1589
+ "each": {
1590
+ "type": "number"
1591
+ }
1592
+ },
1593
+ "additionalProperties": false
1594
+ },
1595
+ {
1596
+ "type": "number"
1597
+ }
1598
+ ]
1599
+ },
1600
+ "weekDay": {
1601
+ "anyOf": [
1602
+ {
1603
+ "type": "object",
1604
+ "properties": {
1605
+ "each": {
1606
+ "type": "number"
1607
+ }
1608
+ },
1609
+ "additionalProperties": false
1610
+ },
1611
+ {
1612
+ "type": "number"
1613
+ }
1614
+ ]
1615
+ }
1616
+ },
1617
+ "additionalProperties": false
1618
+ },
1619
+ {
1620
+ "type": "string"
1621
+ }
1622
+ ]
1442
1623
  },
1443
1624
  "name": {
1444
1625
  "type": "string",
@@ -1468,10 +1649,172 @@
1468
1649
  },
1469
1650
  "additionalProperties": false
1470
1651
  }
1471
- },
1472
- "additionalProperties": false
1652
+ }
1653
+ },
1654
+ {
1655
+ "additionalProperties": false,
1656
+ "type": "object",
1657
+ "properties": {
1658
+ "schedule": {
1659
+ "anyOf": [
1660
+ {
1661
+ "type": "object",
1662
+ "properties": {
1663
+ "minute": {
1664
+ "anyOf": [
1665
+ {
1666
+ "type": "object",
1667
+ "properties": {
1668
+ "each": {
1669
+ "type": "number"
1670
+ }
1671
+ },
1672
+ "additionalProperties": false
1673
+ },
1674
+ {
1675
+ "type": "number"
1676
+ }
1677
+ ]
1678
+ },
1679
+ "hour": {
1680
+ "anyOf": [
1681
+ {
1682
+ "type": "object",
1683
+ "properties": {
1684
+ "each": {
1685
+ "type": "number"
1686
+ }
1687
+ },
1688
+ "additionalProperties": false
1689
+ },
1690
+ {
1691
+ "type": "number"
1692
+ }
1693
+ ]
1694
+ },
1695
+ "day": {
1696
+ "anyOf": [
1697
+ {
1698
+ "type": "object",
1699
+ "properties": {
1700
+ "each": {
1701
+ "type": "number"
1702
+ }
1703
+ },
1704
+ "additionalProperties": false
1705
+ },
1706
+ {
1707
+ "type": "number"
1708
+ }
1709
+ ]
1710
+ },
1711
+ "month": {
1712
+ "anyOf": [
1713
+ {
1714
+ "type": "object",
1715
+ "properties": {
1716
+ "each": {
1717
+ "type": "number"
1718
+ }
1719
+ },
1720
+ "additionalProperties": false
1721
+ },
1722
+ {
1723
+ "type": "number"
1724
+ }
1725
+ ]
1726
+ },
1727
+ "weekDay": {
1728
+ "anyOf": [
1729
+ {
1730
+ "type": "object",
1731
+ "properties": {
1732
+ "each": {
1733
+ "type": "number"
1734
+ }
1735
+ },
1736
+ "additionalProperties": false
1737
+ },
1738
+ {
1739
+ "type": "number"
1740
+ }
1741
+ ]
1742
+ }
1743
+ },
1744
+ "additionalProperties": false
1745
+ },
1746
+ {
1747
+ "type": "string"
1748
+ }
1749
+ ]
1750
+ },
1751
+ "name": {
1752
+ "type": "string",
1753
+ "const": "prune"
1754
+ },
1755
+ "options": {
1756
+ "$ref": "#/definitions/PruneCommandOptions"
1757
+ }
1758
+ }
1473
1759
  }
1474
1760
  ]
1761
+ },
1762
+ "PruneCommandOptions": {
1763
+ "additionalProperties": false,
1764
+ "type": "object",
1765
+ "properties": {
1766
+ "keepLast": {
1767
+ "type": "number"
1768
+ },
1769
+ "keepMinutely": {
1770
+ "type": "number"
1771
+ },
1772
+ "keepHourly": {
1773
+ "type": "number"
1774
+ },
1775
+ "keepDaily": {
1776
+ "type": "number"
1777
+ },
1778
+ "keepWeekly": {
1779
+ "type": "number"
1780
+ },
1781
+ "keepMonthly": {
1782
+ "type": "number"
1783
+ },
1784
+ "keepYearly": {
1785
+ "type": "number"
1786
+ },
1787
+ "id": {
1788
+ "type": "string"
1789
+ },
1790
+ "longId": {
1791
+ "type": "boolean"
1792
+ },
1793
+ "package": {
1794
+ "type": "string"
1795
+ },
1796
+ "repository": {
1797
+ "type": "string"
1798
+ },
1799
+ "repositoryType": {
1800
+ "type": "string"
1801
+ },
1802
+ "tag": {
1803
+ "type": "string"
1804
+ },
1805
+ "groupBy": {
1806
+ "type": "string"
1807
+ },
1808
+ "dryRun": {
1809
+ "type": "boolean"
1810
+ },
1811
+ "showAll": {
1812
+ "type": "boolean"
1813
+ },
1814
+ "confirm": {
1815
+ "type": "boolean"
1816
+ }
1817
+ }
1475
1818
  }
1476
1819
  },
1477
1820
  "$schema": "http://json-schema.org/draft-07/schema#"
@@ -1,8 +1,7 @@
1
- import type { Config } from "../Config/Config";
2
- import { PackageConfig } from "../Config/PackageConfig";
3
- import { RepositoryConfig } from "../Config/RepositoryConfig";
4
- import { PreSnapshot } from "../Repository/RepositoryAbstract";
1
+ import { PreSnapshot } from "../repositories/RepositoryAbstract";
5
2
  import { DataFormat } from "../utils/DataFormat";
3
+ import type { Config, PackageConfig, RepositoryConfig } from "../utils/datatruck/config-type";
4
+ import { ReportListTaskContext } from "../utils/datatruck/report-list";
6
5
  import { Listr3TaskResultEnd } from "../utils/list";
7
6
  import { Progress, ProgressMode } from "../utils/progress";
8
7
  import { Streams } from "../utils/stream";
@@ -44,10 +43,7 @@ type Context = {
44
43
  total: number;
45
44
  pruned: number;
46
45
  };
47
- report: {
48
- type: string;
49
- };
50
- };
46
+ } & ReportListTaskContext;
51
47
  export declare class BackupAction<TRequired extends boolean = true> {
52
48
  readonly config: Config;
53
49
  readonly options: IfRequireKeys<TRequired, BackupActionOptions>;
@@ -76,14 +72,6 @@ export declare class BackupAction<TRequired extends boolean = true> {
76
72
  streams?: Streams;
77
73
  verbose?: number;
78
74
  }): DataFormat;
79
- exec(): Promise<({
80
- key: "summary";
81
- keyIndex?: string | undefined;
82
- data: {
83
- errors: number;
84
- };
85
- elapsed: number;
86
- error?: Error | undefined;
87
- } | import("../utils/list").Listr3TaskResult<Context>)[]>;
75
+ exec(): Promise<(import("../utils/list").List3SummaryResult | import("../utils/list").Listr3TaskResult<Context>)[]>;
88
76
  }
89
77
  export {};