@hotglue/cli 1.0.25 → 1.0.26
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/lib/commands/config/set.js +3 -3
- package/lib/commands/config.js +4 -6
- package/lib/commands/env/deploy.js +2 -2
- package/lib/commands/env/download.js +6 -6
- package/lib/commands/env.js +3 -5
- package/lib/commands/etl/delete.js +5 -5
- package/lib/commands/etl/deploy.js +8 -6
- package/lib/commands/etl/download.js +7 -7
- package/lib/commands/etl.js +3 -5
- package/lib/commands/flows/list.js +4 -4
- package/lib/commands/flows.js +3 -5
- package/lib/commands/jobs/download.js +6 -6
- package/lib/commands/jobs/list.js +4 -4
- package/lib/commands/jobs.js +3 -5
- package/lib/commands/snapshots/deploy.js +6 -6
- package/lib/commands/snapshots/download.js +5 -5
- package/lib/commands/snapshots.js +3 -5
- package/lib/commands/tenants/{customEtl.js → custom-etl.js} +1 -1
- package/lib/commands/tenants/{customFieldMap.js → custom-field-map.js} +5 -5
- package/lib/commands/tenants/delete.js +4 -4
- package/lib/commands/tenants/list.js +4 -4
- package/lib/commands/tenants.js +3 -5
- package/lib/helpers/api.js +1 -1
- package/lib/helpers/baseBuilder.js +3 -3
- package/lib/helpers/flow.js +1 -1
- package/lib/helpers/utils.js +4 -4
- package/lib/index.js +7 -29
- package/lib/main.js +27 -0
- package/package.json +7 -9
- package/lib/commands/config/index.js +0 -15
- package/lib/commands/env/index.js +0 -17
- package/lib/commands/etl/index.js +0 -19
- package/lib/commands/flows/index.js +0 -15
- package/lib/commands/index.js +0 -27
- package/lib/commands/jobs/index.js +0 -17
- package/lib/commands/snapshots/index.js +0 -17
- package/lib/commands/tenants/customCatalog.js +0 -199
- package/lib/commands/tenants/index.js +0 -23
- package/lib/esm/index.js +0 -2312
package/lib/index.js
CHANGED
|
@@ -1,34 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
// Set options as a parameter, environment variable, or rc file.
|
|
2
3
|
"use strict";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
require = require('esm')(module
|
|
6
|
+
/*, options*/
|
|
7
|
+
);
|
|
7
8
|
|
|
8
|
-
require(
|
|
9
|
+
const AWS = require('aws-sdk');
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _helpers = require("yargs/helpers");
|
|
13
|
-
|
|
14
|
-
var _config2 = require("./helpers/config.js");
|
|
15
|
-
|
|
16
|
-
var _print = require("./helpers/print.js");
|
|
17
|
-
|
|
18
|
-
require("aws-sdk");
|
|
19
|
-
|
|
20
|
-
var _index = require("./commands/index.js");
|
|
21
|
-
|
|
22
|
-
var _maintenance_mode_message = _interopRequireDefault(require("aws-sdk/lib/maintenance_mode_message.js"));
|
|
23
|
-
|
|
24
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
|
-
_maintenance_mode_message.default.suppress = true; // set theme once here
|
|
27
|
-
|
|
28
|
-
const myTheme = {};
|
|
29
|
-
(0, _print.setTheme)(myTheme);
|
|
30
|
-
const yargs = (0, _yargs2.default)(process.argv.slice(2));
|
|
31
|
-
yargs.usage((0, _print.themed)('Usage: $0 <command>')).command(_index.commands).demandCommand() // .help()
|
|
32
|
-
// .version('v')
|
|
33
|
-
.alias('v', 'version').alias('h', 'help').string('_').strictCommands() // .strictOptions()
|
|
34
|
-
.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));
|
|
11
|
+
require("aws-sdk/lib/maintenance_mode_message").suppress = true;
|
|
12
|
+
module.exports = require('./main.js');
|
package/lib/main.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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));
|
package/package.json
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotglue/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.26",
|
|
4
4
|
"description": "hotglue CLI tools",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
|
-
"module": "./src/
|
|
7
|
-
"type": "module",
|
|
6
|
+
"module": "./src/main.js",
|
|
8
7
|
"bin": {
|
|
9
|
-
"hotglue": "./lib/
|
|
8
|
+
"hotglue": "./lib/index.js"
|
|
10
9
|
},
|
|
11
10
|
"files": [
|
|
12
11
|
"lib"
|
|
13
12
|
],
|
|
14
13
|
"scripts": {
|
|
15
|
-
"build": "npm run build-basic && npm run build-bin
|
|
14
|
+
"build": "npm run build-basic && npm run build-bin",
|
|
16
15
|
"build-basic": "npm run build-clean && babel src -d lib",
|
|
17
16
|
"build-clean": "rm -rf ./lib/",
|
|
18
17
|
"build-bin": "chmod +x ./lib/index.js",
|
|
19
18
|
"build-bundle": "node scripts/build.js",
|
|
20
19
|
"build-extra": "npm run build-bin && npm run build-assets",
|
|
21
20
|
"build-assets": "cp -R ./src/assets ./lib/",
|
|
22
|
-
"build-esbuild": "esbuild ./src --bundle --platform=node --outfile
|
|
21
|
+
"build-esbuild": "esbuild ./src --bundle --platform=node --outfile=out.js --external:./node_modules/*",
|
|
23
22
|
"lint": "eslint src",
|
|
24
23
|
"pretty": "prettier src --write",
|
|
25
24
|
"auto-build": "nodemon --watch . --ignore lib --exec npm run build"
|
|
@@ -40,10 +39,10 @@
|
|
|
40
39
|
},
|
|
41
40
|
"homepage": "https://github.com/hotgluexyz/hotglue#readme",
|
|
42
41
|
"engines": {
|
|
43
|
-
"node": ">=
|
|
42
|
+
"node": ">=14.0.0"
|
|
44
43
|
},
|
|
45
44
|
"dependencies": {
|
|
46
|
-
"async": "^3.2.
|
|
45
|
+
"async": "^3.2.3",
|
|
47
46
|
"aws-sdk": "^2.1530.0",
|
|
48
47
|
"axios": "^1.6.5",
|
|
49
48
|
"chalk": "^4.1.2",
|
|
@@ -64,7 +63,6 @@
|
|
|
64
63
|
"@babel/core": "^7.16.7",
|
|
65
64
|
"@babel/preset-env": "^7.16.7",
|
|
66
65
|
"@babel/register": "^7.16.7",
|
|
67
|
-
"@types/async": "^3.2.24",
|
|
68
66
|
"esbuild": "^0.14.13",
|
|
69
67
|
"eslint": "^8.6.0",
|
|
70
68
|
"eslint-config-prettier": "^8.3.0",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.config = void 0;
|
|
7
|
-
|
|
8
|
-
var set = _interopRequireWildcard(require("./set.js"));
|
|
9
|
-
|
|
10
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
-
|
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
-
|
|
14
|
-
const config = [set];
|
|
15
|
-
exports.config = config;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.env = void 0;
|
|
7
|
-
|
|
8
|
-
var deploy = _interopRequireWildcard(require("./deploy.js"));
|
|
9
|
-
|
|
10
|
-
var download = _interopRequireWildcard(require("./download.js"));
|
|
11
|
-
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
|
|
16
|
-
const env = [deploy, download];
|
|
17
|
-
exports.env = env;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.etl = void 0;
|
|
7
|
-
|
|
8
|
-
var del = _interopRequireWildcard(require("./delete.js"));
|
|
9
|
-
|
|
10
|
-
var deploy = _interopRequireWildcard(require("./deploy.js"));
|
|
11
|
-
|
|
12
|
-
var download = _interopRequireWildcard(require("./download.js"));
|
|
13
|
-
|
|
14
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
|
|
16
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
18
|
-
const etl = [del, deploy, download];
|
|
19
|
-
exports.etl = etl;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.flows = void 0;
|
|
7
|
-
|
|
8
|
-
var list = _interopRequireWildcard(require("./list.js"));
|
|
9
|
-
|
|
10
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
-
|
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
-
|
|
14
|
-
const flows = [list];
|
|
15
|
-
exports.flows = flows;
|
package/lib/commands/index.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.commands = void 0;
|
|
7
|
-
|
|
8
|
-
var config = _interopRequireWildcard(require("./config.js"));
|
|
9
|
-
|
|
10
|
-
var env = _interopRequireWildcard(require("./env.js"));
|
|
11
|
-
|
|
12
|
-
var etl = _interopRequireWildcard(require("./etl.js"));
|
|
13
|
-
|
|
14
|
-
var flows = _interopRequireWildcard(require("./flows.js"));
|
|
15
|
-
|
|
16
|
-
var jobs = _interopRequireWildcard(require("./jobs.js"));
|
|
17
|
-
|
|
18
|
-
var snapshots = _interopRequireWildcard(require("./snapshots.js"));
|
|
19
|
-
|
|
20
|
-
var tenants = _interopRequireWildcard(require("./tenants.js"));
|
|
21
|
-
|
|
22
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
-
|
|
24
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
26
|
-
const commands = [config, env, etl, flows, jobs, snapshots, tenants];
|
|
27
|
-
exports.commands = commands;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.jobs = void 0;
|
|
7
|
-
|
|
8
|
-
var download = _interopRequireWildcard(require("./download.js"));
|
|
9
|
-
|
|
10
|
-
var list = _interopRequireWildcard(require("./list.js"));
|
|
11
|
-
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
|
|
16
|
-
const jobs = [download, list];
|
|
17
|
-
exports.jobs = jobs;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.snapshots = void 0;
|
|
7
|
-
|
|
8
|
-
var deploy = _interopRequireWildcard(require("./deploy.js"));
|
|
9
|
-
|
|
10
|
-
var download = _interopRequireWildcard(require("./download.js"));
|
|
11
|
-
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
|
|
16
|
-
const snapshots = [deploy, download];
|
|
17
|
-
exports.snapshots = snapshots;
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.handler = exports.desc = exports.command = exports.builder = void 0;
|
|
7
|
-
|
|
8
|
-
var _debug = _interopRequireDefault(require("../../helpers/debug.js"));
|
|
9
|
-
|
|
10
|
-
var _ora = _interopRequireDefault(require("ora"));
|
|
11
|
-
|
|
12
|
-
var _awsSdk = _interopRequireDefault(require("aws-sdk"));
|
|
13
|
-
|
|
14
|
-
var _cliTable = _interopRequireDefault(require("cli-table"));
|
|
15
|
-
|
|
16
|
-
var _descriptions = _interopRequireDefault(require("../../helpers/descriptions.js"));
|
|
17
|
-
|
|
18
|
-
var _print = require("../../helpers/print.js");
|
|
19
|
-
|
|
20
|
-
var _api = require("../../helpers/api.js");
|
|
21
|
-
|
|
22
|
-
var _utils = require("../../helpers/utils.js");
|
|
23
|
-
|
|
24
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
|
-
const debug = (0, _debug.default)('commands:tenants:custom-catalog');
|
|
27
|
-
const command = 'custom-catalog';
|
|
28
|
-
exports.command = command;
|
|
29
|
-
const desc = 'List tenants with custom catalog in a specific flow';
|
|
30
|
-
exports.desc = desc;
|
|
31
|
-
|
|
32
|
-
const builder = async yargs => {
|
|
33
|
-
debug('builder', command);
|
|
34
|
-
return yargs.option('tenant', _descriptions.default.options['tenant'].config).option('flow', _descriptions.default.options['flow'].config).demandOption('flow', _descriptions.default.options['flow'].demandText);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
exports.builder = builder;
|
|
38
|
-
|
|
39
|
-
const processTenant = async ({
|
|
40
|
-
debug,
|
|
41
|
-
baseUri,
|
|
42
|
-
apikey,
|
|
43
|
-
env,
|
|
44
|
-
flow,
|
|
45
|
-
tenant,
|
|
46
|
-
isV2Flow
|
|
47
|
-
}) => {
|
|
48
|
-
try {
|
|
49
|
-
// Get all linked connectors/sources of the tuple (env, flow, tenant)
|
|
50
|
-
const linkedConnectors = isV2Flow ? await (0, _api.getLinkedConnectors)({
|
|
51
|
-
debug,
|
|
52
|
-
baseUri,
|
|
53
|
-
env,
|
|
54
|
-
flow,
|
|
55
|
-
tenant,
|
|
56
|
-
apikey
|
|
57
|
-
}) : await (0, _api.getLinkedSources)({
|
|
58
|
-
debug,
|
|
59
|
-
baseUri,
|
|
60
|
-
env,
|
|
61
|
-
flow,
|
|
62
|
-
tenant,
|
|
63
|
-
apikey
|
|
64
|
-
});
|
|
65
|
-
const connectors = []; // Generate AWS credentials in order to read the S3 tap folder
|
|
66
|
-
|
|
67
|
-
const {
|
|
68
|
-
accessKeyId,
|
|
69
|
-
secretAccessKey,
|
|
70
|
-
sessionToken
|
|
71
|
-
} = await (0, _api.genCredentialsOnClientApi)({
|
|
72
|
-
debug,
|
|
73
|
-
baseUri,
|
|
74
|
-
task: 'field-map-download',
|
|
75
|
-
env,
|
|
76
|
-
tenant,
|
|
77
|
-
flow,
|
|
78
|
-
apikey
|
|
79
|
-
});
|
|
80
|
-
const s3 = new _awsSdk.default.S3({
|
|
81
|
-
accessKeyId,
|
|
82
|
-
secretAccessKey,
|
|
83
|
-
sessionToken
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
for (const {
|
|
87
|
-
id,
|
|
88
|
-
tap
|
|
89
|
-
} of linkedConnectors) {
|
|
90
|
-
const entityLabel = isV2Flow ? 'connectors' : 'taps';
|
|
91
|
-
const params = {
|
|
92
|
-
Bucket: env,
|
|
93
|
-
Key: `${tenant}/flows/${flow}/${entityLabel}/${isV2Flow ? id : tap}/catalog.json`
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
try {
|
|
97
|
-
await s3.headObject(params).promise();
|
|
98
|
-
connectors.push(isV2Flow ? id : tap);
|
|
99
|
-
} catch (error) {// Does not have catalog.json
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return {
|
|
104
|
-
tenant,
|
|
105
|
-
connectors
|
|
106
|
-
};
|
|
107
|
-
} catch (error) {
|
|
108
|
-
console.error(error);
|
|
109
|
-
return {
|
|
110
|
-
tenant,
|
|
111
|
-
connectors: []
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const handler = async argv => {
|
|
117
|
-
debug('handler', command, argv);
|
|
118
|
-
const {
|
|
119
|
-
hg,
|
|
120
|
-
json,
|
|
121
|
-
apikey,
|
|
122
|
-
env,
|
|
123
|
-
flow
|
|
124
|
-
} = argv;
|
|
125
|
-
let message;
|
|
126
|
-
let spinner = (0, _ora.default)();
|
|
127
|
-
|
|
128
|
-
try {
|
|
129
|
-
message = (0, _print.themed)(`Retrieving tenants for environment ${(0, _print.themed)(env, 'info')}`);
|
|
130
|
-
!json && spinner.start((0, _print.themed)(`In progress: ${message}...`, 'secondary'));
|
|
131
|
-
const [allTenants, supportedFlow] = await Promise.all([(0, _api.getTenants)({
|
|
132
|
-
debug,
|
|
133
|
-
baseUri: hg.clientApiBaseUri,
|
|
134
|
-
apikey,
|
|
135
|
-
env
|
|
136
|
-
}), (0, _api.getSupportedFlow)({
|
|
137
|
-
debug,
|
|
138
|
-
baseUri: hg.clientApiBaseUri,
|
|
139
|
-
apikey,
|
|
140
|
-
env,
|
|
141
|
-
flow
|
|
142
|
-
})]);
|
|
143
|
-
const isV2Flow = (supportedFlow === null || supportedFlow === void 0 ? void 0 : supportedFlow.version) === 2;
|
|
144
|
-
!json && spinner.succeed((0, _print.themed)(`Finished: ${message}.`, 'secondary'));
|
|
145
|
-
const tenantsWithCustomFieldMap = [];
|
|
146
|
-
message = (0, _print.themed)(`Querying for custom catalogs for flow ${(0, _print.themed)(flow, 'info')}`);
|
|
147
|
-
!json && spinner.start((0, _print.themed)(`In progress: ${message}...`, 'secondary')); // Break the tenants array in to an array of arrays so we can make
|
|
148
|
-
// parallel calls and make it faster
|
|
149
|
-
|
|
150
|
-
for (const tenants of (0, _utils.buildChunks)(allTenants)) {
|
|
151
|
-
const maybeTenantsWithCustomFieldMap = await Promise.all(tenants.map(tenant => processTenant({
|
|
152
|
-
debug,
|
|
153
|
-
baseUri: hg.clientApiBaseUri,
|
|
154
|
-
apikey,
|
|
155
|
-
env,
|
|
156
|
-
flow,
|
|
157
|
-
tenant,
|
|
158
|
-
isV2Flow
|
|
159
|
-
})));
|
|
160
|
-
tenantsWithCustomFieldMap.push(...maybeTenantsWithCustomFieldMap.filter(({
|
|
161
|
-
connectors
|
|
162
|
-
}) => connectors.length > 0));
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
!json && spinner.succeed((0, _print.themed)(`Finished: ${message}.`, 'secondary'));
|
|
166
|
-
|
|
167
|
-
if (json) {
|
|
168
|
-
(0, _print.printJSON)(tenantsWithCustomFieldMap);
|
|
169
|
-
} else {
|
|
170
|
-
// generate results table
|
|
171
|
-
const table = new _cliTable.default({
|
|
172
|
-
head: ['Tenant ID', 'Connector IDs']
|
|
173
|
-
});
|
|
174
|
-
table.push(...tenantsWithCustomFieldMap.map(({
|
|
175
|
-
tenant,
|
|
176
|
-
connectors
|
|
177
|
-
}) => [tenant, connectors.join(', ')])); // print results
|
|
178
|
-
|
|
179
|
-
console.log(table.toString());
|
|
180
|
-
}
|
|
181
|
-
} catch (err) {
|
|
182
|
-
if (json) {
|
|
183
|
-
(0, _print.printJSON)({
|
|
184
|
-
status: 'error',
|
|
185
|
-
error: err
|
|
186
|
-
});
|
|
187
|
-
} else {
|
|
188
|
-
spinner.fail((0, _print.themed)(`Error: ${message}.`, 'secondary'));
|
|
189
|
-
(0, _print.pr)((0, _print.themed)(`Message: ${(0, _print.themed)(err.message)}`, 'secondary'));
|
|
190
|
-
debug(err);
|
|
191
|
-
|
|
192
|
-
if (err && err.response && err.response.data) {
|
|
193
|
-
debug('response', err.response.data);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
exports.handler = handler;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.tenants = void 0;
|
|
7
|
-
|
|
8
|
-
var customEtl = _interopRequireWildcard(require("./customEtl.js"));
|
|
9
|
-
|
|
10
|
-
var customField = _interopRequireWildcard(require("./customFieldMap.js"));
|
|
11
|
-
|
|
12
|
-
var del = _interopRequireWildcard(require("./delete.js"));
|
|
13
|
-
|
|
14
|
-
var list = _interopRequireWildcard(require("./list.js"));
|
|
15
|
-
|
|
16
|
-
var updateConfig = _interopRequireWildcard(require("./updateConfig.js"));
|
|
17
|
-
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
|
-
const tenants = [customEtl, customField, del, list, updateConfig];
|
|
23
|
-
exports.tenants = tenants;
|