@hotglue/cli 1.0.32 → 1.0.34
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/README.md +1 -1
- package/lib/cjs/index.js +9 -8
- package/lib/cjs/index.js.map +1 -1
- package/lib/mjs/index.js +9 -8
- package/lib/mjs/index.js.map +1 -1
- package/package.json +2 -1
- package/lib/commands/config/set.js +0 -82
- package/lib/commands/config.js +0 -69
- package/lib/commands/env/deploy.js +0 -162
- package/lib/commands/env/download.js +0 -169
- package/lib/commands/env.js +0 -32
- package/lib/commands/etl/delete.js +0 -171
- package/lib/commands/etl/deploy.js +0 -263
- package/lib/commands/etl/download.js +0 -205
- package/lib/commands/etl.js +0 -32
- package/lib/commands/flows/list.js +0 -104
- package/lib/commands/flows.js +0 -32
- package/lib/commands/jobs/download.js +0 -188
- package/lib/commands/jobs/list.js +0 -108
- package/lib/commands/jobs.js +0 -32
- package/lib/commands/snapshots/deploy.js +0 -202
- package/lib/commands/snapshots/download.js +0 -213
- package/lib/commands/snapshots.js +0 -32
- package/lib/commands/tenants/custom-etl.js +0 -183
- package/lib/commands/tenants/custom-field-map.js +0 -191
- package/lib/commands/tenants/delete.js +0 -150
- package/lib/commands/tenants/list.js +0 -97
- package/lib/commands/tenants/updateConfig.js +0 -188
- package/lib/commands/tenants.js +0 -32
- package/lib/helpers/api.js +0 -326
- package/lib/helpers/baseBuilder.js +0 -30
- package/lib/helpers/config.js +0 -105
- package/lib/helpers/debug.js +0 -19
- package/lib/helpers/descriptions.js +0 -137
- package/lib/helpers/flow.js +0 -32
- package/lib/helpers/print.js +0 -92
- package/lib/helpers/utils.js +0 -245
- package/lib/index.js +0 -12
- package/lib/main.js +0 -27
package/lib/helpers/print.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.cl = cl;
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
exports.pp = pp;
|
|
9
|
-
exports.pr = pr;
|
|
10
|
-
exports.printJSON = void 0;
|
|
11
|
-
exports.setDefault = setDefault;
|
|
12
|
-
exports.setTheme = setTheme;
|
|
13
|
-
exports.themed = void 0;
|
|
14
|
-
|
|
15
|
-
var _util = require("util");
|
|
16
|
-
|
|
17
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
18
|
-
|
|
19
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
-
|
|
21
|
-
const defaultTheme = {
|
|
22
|
-
primary: str => _chalk.default.whiteBright(str),
|
|
23
|
-
secondary: str => _chalk.default.white(str),
|
|
24
|
-
info: str => _chalk.default.green(str),
|
|
25
|
-
warn: str => _chalk.default.yellow(str),
|
|
26
|
-
error: str => _chalk.default.redBright(str),
|
|
27
|
-
success: str => _chalk.default.greenBright(str)
|
|
28
|
-
};
|
|
29
|
-
let _currentTheme = defaultTheme;
|
|
30
|
-
let _defaultColor = 'primary';
|
|
31
|
-
|
|
32
|
-
function setTheme(theme) {
|
|
33
|
-
_currentTheme = { ...defaultTheme,
|
|
34
|
-
...theme
|
|
35
|
-
};
|
|
36
|
-
return funcs;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function print(str) {
|
|
40
|
-
process.stdout.write(str);
|
|
41
|
-
} // maybe rename themed to color()
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const themed = (content, color = _defaultColor) => {
|
|
45
|
-
if (!content) return '';
|
|
46
|
-
if (typeof content === 'string') return _currentTheme[color] ? _currentTheme[color](content) : _currentTheme[_defaultColor](content); // apply limits on returned string from inspected object
|
|
47
|
-
|
|
48
|
-
const objString = (0, _util.inspect)(content, {
|
|
49
|
-
colors: true
|
|
50
|
-
});
|
|
51
|
-
return _currentTheme[color] ? _currentTheme[color](objString) : objString;
|
|
52
|
-
}; // console.log passthrough with default coloring
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
exports.themed = themed;
|
|
56
|
-
|
|
57
|
-
function cl(...contentArgs) {
|
|
58
|
-
console.log(...contentArgs);
|
|
59
|
-
return funcs;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function pr(content, color) {
|
|
63
|
-
print(themed(content, color));
|
|
64
|
-
print('\n');
|
|
65
|
-
return funcs;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function pp(content, color) {
|
|
69
|
-
print(themed(content, color));
|
|
70
|
-
return funcs;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function setDefault(color = 'primary') {
|
|
74
|
-
if (_currentTheme[color]) _defaultColor = color;
|
|
75
|
-
return funcs;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const funcs = {
|
|
79
|
-
cl,
|
|
80
|
-
pr,
|
|
81
|
-
pp,
|
|
82
|
-
setTheme,
|
|
83
|
-
setDefault
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const printJSON = data => {
|
|
87
|
-
console.log(JSON.stringify(data));
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
exports.printJSON = printJSON;
|
|
91
|
-
var _default = funcs;
|
|
92
|
-
exports.default = _default;
|
package/lib/helpers/utils.js
DELETED
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.streamToString = exports.makeSetFromArray = exports.getFolderFiles = exports.filterFiles = exports.buildChunks = void 0;
|
|
7
|
-
exports.userSetOption = userSetOption;
|
|
8
|
-
|
|
9
|
-
var _path = _interopRequireDefault(require("path"));
|
|
10
|
-
|
|
11
|
-
var _promises = require("fs/promises");
|
|
12
|
-
|
|
13
|
-
var _debug = _interopRequireDefault(require("./debug"));
|
|
14
|
-
|
|
15
|
-
var _micromatch = _interopRequireDefault(require("micromatch"));
|
|
16
|
-
|
|
17
|
-
var _print = require("./print");
|
|
18
|
-
|
|
19
|
-
var _descriptions = _interopRequireDefault(require("./descriptions"));
|
|
20
|
-
|
|
21
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
-
|
|
23
|
-
const debug = (0, _debug.default)('utils');
|
|
24
|
-
|
|
25
|
-
const makeSetFromArray = arr => {
|
|
26
|
-
const result = new Set();
|
|
27
|
-
arr.forEach(item => result.add(item));
|
|
28
|
-
return result;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Get list of files in given folder and its subfolders that match against a pattern.
|
|
32
|
-
* ex: await getSubFolderFiles(process.cwd(), ['!d/sync-output', '!d/etl-output', '!d/snapshots']);
|
|
33
|
-
* @param {string} dir starting directory
|
|
34
|
-
* @param {Array<string>} pattern The match patterns. ex: '!my_folder', 'd/uploads', '!f/exclude.txt'
|
|
35
|
-
* @returns {Array<string>} All file paths that meet the pattern criteria
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
exports.makeSetFromArray = makeSetFromArray;
|
|
40
|
-
|
|
41
|
-
const getSubFolderFiles = async (dir, pattern) => {
|
|
42
|
-
const matches = {
|
|
43
|
-
excludedDirs: new Set(),
|
|
44
|
-
excludedFiles: new Set(),
|
|
45
|
-
includedDirs: new Set(),
|
|
46
|
-
includedFiles: new Set()
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
if (pattern && pattern.length > 0) {
|
|
50
|
-
const excluded = [];
|
|
51
|
-
const included = [];
|
|
52
|
-
pattern.forEach(item => {
|
|
53
|
-
if (item.startsWith('!')) excluded.push(item.substring(1));else included.push(item);
|
|
54
|
-
});
|
|
55
|
-
included.forEach(item => {
|
|
56
|
-
if (item.startsWith('d/')) matches.includedDirs.add(item.substring(2));else if (item.startsWith('f/')) matches.includedFiles.add(item.substring(2));else {
|
|
57
|
-
matches.includedDirs.add(item);
|
|
58
|
-
matches.includedFiles.add(item);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
excluded.forEach(item => {
|
|
62
|
-
if (item.startsWith('d/')) matches.excludedDirs.add(item.substring(2));else if (item.startsWith('f/')) matches.excludedFiles.add(item.substring(2));else {
|
|
63
|
-
matches.excludedDirs.add(item);
|
|
64
|
-
matches.excludedFiles.add(item);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return _getSubFolderFiles(dir, matches);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const _getSubFolderFiles = async (dir, matches) => {
|
|
73
|
-
const files = await (0, _promises.readdir)(dir, {
|
|
74
|
-
withFileTypes: true
|
|
75
|
-
});
|
|
76
|
-
const result = [];
|
|
77
|
-
|
|
78
|
-
for (const file of files) {
|
|
79
|
-
if (!file.isSymbolicLink()) {
|
|
80
|
-
if (file.isFile() && (!matches.excludedFiles.has(file.name) || matches.includedFiles.has(file.name))) result.push(_path.default.resolve(dir, file.name));else if (file.isDirectory() && (!matches.excludedDirs.has(file.name) || matches.includedFiles.has(file.name))) {
|
|
81
|
-
const sub = await _getSubFolderFiles(_path.default.resolve(dir, file.name), matches);
|
|
82
|
-
if (sub.length > 0) result.push(...sub);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return result;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const _getFolderFiles = async (dir, options, result = []) => {
|
|
91
|
-
const {
|
|
92
|
-
includeSymLinks,
|
|
93
|
-
recursive,
|
|
94
|
-
filter
|
|
95
|
-
} = options;
|
|
96
|
-
const {
|
|
97
|
-
matcher
|
|
98
|
-
} = filter;
|
|
99
|
-
|
|
100
|
-
const fullPath = _path.default.resolve(dir);
|
|
101
|
-
|
|
102
|
-
const files = await (0, _promises.readdir)(fullPath, {
|
|
103
|
-
withFileTypes: true
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
for (const file of files) {
|
|
107
|
-
const filePath = _path.default.resolve(fullPath, file.name);
|
|
108
|
-
|
|
109
|
-
if (file.isSymbolicLink() && !includeSymLinks) {
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (matcher && !matcher(filePath)) {
|
|
114
|
-
debug('skip', filePath);
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (file.isFile()) {
|
|
119
|
-
result.push(_path.default.resolve(fullPath, file.name));
|
|
120
|
-
} else if (file.isDirectory() && recursive) {
|
|
121
|
-
await _getFolderFiles(_path.default.resolve(fullPath, file.name), options, result);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return result;
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const getFolderFiles = async (dir, options) => {
|
|
129
|
-
const _options = {
|
|
130
|
-
includeSymLinks: false,
|
|
131
|
-
recursive: false,
|
|
132
|
-
filter: {},
|
|
133
|
-
...options
|
|
134
|
-
};
|
|
135
|
-
const {
|
|
136
|
-
pattern
|
|
137
|
-
} = _options.filter;
|
|
138
|
-
|
|
139
|
-
if (pattern) {
|
|
140
|
-
_options.filter.matcher = _micromatch.default.matcher(pattern);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return _getFolderFiles(dir, _options);
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
exports.getFolderFiles = getFolderFiles;
|
|
147
|
-
|
|
148
|
-
const filterFiles = (files, filter) => {
|
|
149
|
-
debug('filter-in', files);
|
|
150
|
-
const {
|
|
151
|
-
pattern
|
|
152
|
-
} = { ...filter
|
|
153
|
-
};
|
|
154
|
-
let result = files;
|
|
155
|
-
if (pattern) result = (0, _micromatch.default)(result, pattern);
|
|
156
|
-
debug('filter-out', result);
|
|
157
|
-
return result;
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* todo: implement my variant:
|
|
161
|
-
* - explicit f/ and d/ prefixes
|
|
162
|
-
* -
|
|
163
|
-
* @param {*} pattern
|
|
164
|
-
* @returns a matcher instance
|
|
165
|
-
*/
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
exports.filterFiles = filterFiles;
|
|
169
|
-
|
|
170
|
-
function createMatcher(pattern) {
|
|
171
|
-
const matches = {
|
|
172
|
-
excludedDirs: new Set(),
|
|
173
|
-
excludedFiles: new Set(),
|
|
174
|
-
includedDirs: new Set(),
|
|
175
|
-
includedFiles: new Set()
|
|
176
|
-
};
|
|
177
|
-
const excluded = [];
|
|
178
|
-
const included = [];
|
|
179
|
-
pattern.forEach(item => {
|
|
180
|
-
if (item.startsWith('!')) excluded.push(item.substring(1));else included.push(item);
|
|
181
|
-
});
|
|
182
|
-
included.forEach(item => {
|
|
183
|
-
if (item.startsWith('d/')) matches.includedDirs.add(item.substring(2));else if (item.startsWith('f/')) matches.includedFiles.add(item.substring(2));else {
|
|
184
|
-
matches.includedDirs.add(item);
|
|
185
|
-
matches.includedFiles.add(item);
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
excluded.forEach(item => {
|
|
189
|
-
if (item.startsWith('d/')) matches.excludedDirs.add(item.substring(2));else if (item.startsWith('f/')) matches.excludedFiles.add(item.substring(2));else {
|
|
190
|
-
matches.excludedDirs.add(item);
|
|
191
|
-
matches.excludedFiles.add(item);
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
const match = path => {};
|
|
196
|
-
|
|
197
|
-
return {
|
|
198
|
-
match
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function userSetOption(option) {
|
|
203
|
-
var _descriptions$options, _descriptions$options2;
|
|
204
|
-
|
|
205
|
-
function wasArgPassed(option) {
|
|
206
|
-
return process.argv.indexOf(option) > -1;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (wasArgPassed(`--${option}`)) {
|
|
210
|
-
return true;
|
|
211
|
-
} // Handle aliases for same option
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
const aliases = ((_descriptions$options = _descriptions.default.options[option]) === null || _descriptions$options === void 0 ? void 0 : (_descriptions$options2 = _descriptions$options.config) === null || _descriptions$options2 === void 0 ? void 0 : _descriptions$options2.alias) || [];
|
|
215
|
-
|
|
216
|
-
for (let i in aliases) {
|
|
217
|
-
if (wasArgPassed(`-${aliases[i]}`)) return true;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
return false;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
const streamToString = stream => {
|
|
224
|
-
const chunks = [];
|
|
225
|
-
return new Promise((resolve, reject) => {
|
|
226
|
-
stream.on('error', reject);
|
|
227
|
-
stream.on('data', c => chunks.push(Buffer.from(c)));
|
|
228
|
-
stream.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));
|
|
229
|
-
});
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
exports.streamToString = streamToString;
|
|
233
|
-
|
|
234
|
-
const buildChunks = (array, chunkSize = 10) => {
|
|
235
|
-
const resultArray = [];
|
|
236
|
-
|
|
237
|
-
for (let i = 0; i < array.length; i += chunkSize) {
|
|
238
|
-
const chunk = array.slice(i, i + chunkSize);
|
|
239
|
-
resultArray.push(chunk);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return resultArray;
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
exports.buildChunks = buildChunks;
|
package/lib/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Set options as a parameter, environment variable, or rc file.
|
|
3
|
-
"use strict";
|
|
4
|
-
|
|
5
|
-
require = require('esm')(module
|
|
6
|
-
/*, options*/
|
|
7
|
-
);
|
|
8
|
-
|
|
9
|
-
const AWS = require('aws-sdk');
|
|
10
|
-
|
|
11
|
-
require("aws-sdk/lib/maintenance_mode_message").suppress = true;
|
|
12
|
-
module.exports = require('./main.js');
|
package/lib/main.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
require("dotenv/config");
|
|
9
|
-
|
|
10
|
-
var _yargs = _interopRequireDefault(require("yargs"));
|
|
11
|
-
|
|
12
|
-
var _helpers = require("yargs/helpers");
|
|
13
|
-
|
|
14
|
-
var _config2 = require("./helpers/config");
|
|
15
|
-
|
|
16
|
-
var _print = require("./helpers/print");
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
|
-
// set theme once here
|
|
21
|
-
const myTheme = {};
|
|
22
|
-
(0, _print.setTheme)(myTheme);
|
|
23
|
-
const yargs = (0, _yargs.default)();
|
|
24
|
-
yargs.usage((0, _print.themed)('Usage: $0 <command>')).commandDir('commands').demandCommand() // .help()
|
|
25
|
-
// .version('v')
|
|
26
|
-
.alias('v', 'version').alias('h', 'help').string('_').strictCommands() // .strictOptions()
|
|
27
|
-
.epilogue((0, _print.themed)('For more information, visit https://docs.hotglue.xyz/docs/cli-overview')).wrap(Math.min(yargs.terminalWidth(), 90)).parse((0, _helpers.hideBin)(process.argv), _config2.staticOptions); // .parse(hideBin(process.argv));
|