@datatruck/cli 0.11.2 → 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.
@@ -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, micromatch_1.isMatch)(parsedTag.task || "", pkgTaskPatterns))
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, micromatch_1.isMatch)(meta.task || "", taskPatterns))
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, micromatch_1.isMatch)(tag.task || "", taskNamePatterns))
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datatruck/cli",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "dependencies": {
5
5
  "ajv": "^8.11.0",
6
6
  "async": "^3.2.4",
@@ -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;
@@ -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) => [v, `${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)