@datatruck/cli 0.11.0 → 0.11.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/Repository/GitRepository.js +1 -1
- package/Repository/LocalRepository.js +1 -1
- package/Repository/ResticRepository.js +1 -1
- package/Task/MysqlDumpTask.js +2 -0
- package/Task/PostgresqlDumpTask.js +2 -0
- package/package.json +1 -1
- package/util/fs-util.js +1 -1
- package/util/string-util.d.ts +1 -0
- package/util/string-util.js +16 -2
- package/util/zip-util.js +1 -1
|
@@ -124,7 +124,7 @@ class GitRepository extends RepositoryAbstract_1.RepositoryAbstract {
|
|
|
124
124
|
return result;
|
|
125
125
|
if (pkgPatterns && !(0, micromatch_1.isMatch)(parsedTag.package, pkgPatterns))
|
|
126
126
|
return result;
|
|
127
|
-
if (pkgTaskPatterns && !(0,
|
|
127
|
+
if (pkgTaskPatterns && !(0, string_util_1.checkMatch)(parsedTag.task, pkgTaskPatterns))
|
|
128
128
|
return result;
|
|
129
129
|
if (data.options.tags &&
|
|
130
130
|
!parsedTag.tags.some((value) => data.options.tags?.includes(value)))
|
|
@@ -138,7 +138,7 @@ class LocalRepository extends RepositoryAbstract_1.RepositoryAbstract {
|
|
|
138
138
|
continue;
|
|
139
139
|
const metaPath = (0, path_1.join)(this.config.outPath, snapshotName);
|
|
140
140
|
const meta = await LocalRepository.parseMetaData(metaPath);
|
|
141
|
-
if (taskPatterns && !(0,
|
|
141
|
+
if (taskPatterns && !(0, string_util_1.checkMatch)(meta.task, taskPatterns))
|
|
142
142
|
continue;
|
|
143
143
|
if (data.options.ids &&
|
|
144
144
|
!data.options.ids.some((id) => meta.id.startsWith(id)))
|
|
@@ -139,7 +139,7 @@ class ResticRepository extends RepositoryAbstract_1.RepositoryAbstract {
|
|
|
139
139
|
return items;
|
|
140
140
|
if (packagePatterns && !(0, micromatch_1.isMatch)(tag.package, packagePatterns))
|
|
141
141
|
return items;
|
|
142
|
-
if (taskNamePatterns && !(0,
|
|
142
|
+
if (taskNamePatterns && !(0, string_util_1.checkMatch)(tag.task, taskNamePatterns))
|
|
143
143
|
return items;
|
|
144
144
|
const itemTags = tag.tags ?? [];
|
|
145
145
|
if (data.options.tags && !itemTags.some((t) => itemTags.includes(t)))
|
package/Task/MysqlDumpTask.js
CHANGED
|
@@ -69,6 +69,8 @@ class PostgresqlDumpTask extends SqlDumpTaskAbstract_1.SqlDumpTaskAbstract {
|
|
|
69
69
|
WHERE
|
|
70
70
|
table_catalog = '${database}' AND
|
|
71
71
|
table_schema NOT IN ('pg_catalog', 'information_schema')
|
|
72
|
+
ORDER BY
|
|
73
|
+
CONCAT(table_schema, '.', table_name)
|
|
72
74
|
`);
|
|
73
75
|
}
|
|
74
76
|
async onExportTables(tableNames, output) {
|
package/package.json
CHANGED
package/util/fs-util.js
CHANGED
|
@@ -395,7 +395,7 @@ async function cpy(options) {
|
|
|
395
395
|
stats.files++;
|
|
396
396
|
// https://github.com/nodejs/node/issues/44261
|
|
397
397
|
if (exports.isWSLSystem) {
|
|
398
|
-
const fileInfo = await (0, promises_1.stat)(
|
|
398
|
+
const fileInfo = await (0, promises_1.stat)(entrySourcePath);
|
|
399
399
|
const isWritable = (fileInfo.mode & 0o200) === 0o200;
|
|
400
400
|
if (!isWritable) {
|
|
401
401
|
await copyFileWithStreams(entrySourcePath, entryTargetPath);
|
package/util/string-util.d.ts
CHANGED
|
@@ -15,4 +15,5 @@ export declare type UriType = {
|
|
|
15
15
|
export declare function formatUri(input: UriType, hidePassword?: boolean): string;
|
|
16
16
|
export declare function formatSeconds(seconds: number): string;
|
|
17
17
|
export declare function makePathPatterns(values: string[] | undefined): string[] | undefined;
|
|
18
|
+
export declare function checkMatch(subject: string | undefined, patterns: string[]): boolean;
|
|
18
19
|
export declare function formatDateTime(datetime: string): string;
|
package/util/string-util.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatDateTime = exports.makePathPatterns = exports.formatSeconds = exports.formatUri = exports.parseStringList = exports.render = exports.snakeCase = exports.lcfirst = exports.ucfirst = exports.serialize = void 0;
|
|
3
|
+
exports.formatDateTime = exports.checkMatch = exports.makePathPatterns = exports.formatSeconds = exports.formatUri = exports.parseStringList = exports.render = exports.snakeCase = exports.lcfirst = exports.ucfirst = exports.serialize = void 0;
|
|
4
4
|
const AppError_1 = require("../Error/AppError");
|
|
5
|
+
const micromatch_1 = require("micromatch");
|
|
5
6
|
function serialize(message, data) {
|
|
6
7
|
if (data)
|
|
7
8
|
return `${message} (${JSON.stringify(data, null, 2)})`;
|
|
@@ -88,9 +89,22 @@ function formatSeconds(seconds) {
|
|
|
88
89
|
}
|
|
89
90
|
exports.formatSeconds = formatSeconds;
|
|
90
91
|
function makePathPatterns(values) {
|
|
91
|
-
return values?.flatMap((v) =>
|
|
92
|
+
return values?.flatMap((v) => {
|
|
93
|
+
if (v === "*" || v === "**" || v === "<empty>" || v === "!<empty>") {
|
|
94
|
+
return [v];
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
return [v, `${v}/**`];
|
|
98
|
+
}
|
|
99
|
+
});
|
|
92
100
|
}
|
|
93
101
|
exports.makePathPatterns = makePathPatterns;
|
|
102
|
+
function checkMatch(subject, patterns) {
|
|
103
|
+
if (!subject?.length)
|
|
104
|
+
subject = "<empty>";
|
|
105
|
+
return (0, micromatch_1.isMatch)(subject, patterns);
|
|
106
|
+
}
|
|
107
|
+
exports.checkMatch = checkMatch;
|
|
94
108
|
function formatDateTime(datetime) {
|
|
95
109
|
const date = new Date(datetime);
|
|
96
110
|
const [result] = new Date(date.getTime() - date.getTimezoneOffset() * 60000)
|
package/util/zip-util.js
CHANGED
|
@@ -31,7 +31,7 @@ function buildArguments(filters) {
|
|
|
31
31
|
}
|
|
32
32
|
exports.buildArguments = buildArguments;
|
|
33
33
|
function parseZipStream(chunk, buffer, cb) {
|
|
34
|
-
const lines = chunk.trim().split(/\r?\n/
|
|
34
|
+
const lines = chunk.replaceAll("\b", "").trim().split(/\r?\n/);
|
|
35
35
|
for (const line of lines) {
|
|
36
36
|
let matches = null;
|
|
37
37
|
if ((matches = /^(\d+)% (\d+ )?\+/.exec(line))) {
|