@hotglue/cli 1.0.31 → 1.0.33

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 (39) hide show
  1. package/README.md +1 -1
  2. package/lib/cjs/index.js +9 -8
  3. package/lib/cjs/index.js.map +1 -1
  4. package/lib/mjs/index.js +9 -8
  5. package/lib/mjs/index.js.map +1 -1
  6. package/package.json +1 -1
  7. package/lib/commands/config/set.js +0 -82
  8. package/lib/commands/config.js +0 -69
  9. package/lib/commands/env/deploy.js +0 -162
  10. package/lib/commands/env/download.js +0 -169
  11. package/lib/commands/env.js +0 -32
  12. package/lib/commands/etl/delete.js +0 -171
  13. package/lib/commands/etl/deploy.js +0 -263
  14. package/lib/commands/etl/download.js +0 -205
  15. package/lib/commands/etl.js +0 -32
  16. package/lib/commands/flows/list.js +0 -104
  17. package/lib/commands/flows.js +0 -32
  18. package/lib/commands/jobs/download.js +0 -188
  19. package/lib/commands/jobs/list.js +0 -108
  20. package/lib/commands/jobs.js +0 -32
  21. package/lib/commands/snapshots/deploy.js +0 -202
  22. package/lib/commands/snapshots/download.js +0 -213
  23. package/lib/commands/snapshots.js +0 -32
  24. package/lib/commands/tenants/custom-etl.js +0 -183
  25. package/lib/commands/tenants/custom-field-map.js +0 -191
  26. package/lib/commands/tenants/delete.js +0 -150
  27. package/lib/commands/tenants/list.js +0 -97
  28. package/lib/commands/tenants/updateConfig.js +0 -188
  29. package/lib/commands/tenants.js +0 -32
  30. package/lib/helpers/api.js +0 -326
  31. package/lib/helpers/baseBuilder.js +0 -30
  32. package/lib/helpers/config.js +0 -105
  33. package/lib/helpers/debug.js +0 -19
  34. package/lib/helpers/descriptions.js +0 -137
  35. package/lib/helpers/flow.js +0 -32
  36. package/lib/helpers/print.js +0 -92
  37. package/lib/helpers/utils.js +0 -245
  38. package/lib/index.js +0 -12
  39. package/lib/main.js +0 -27
@@ -1,213 +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 _path = _interopRequireDefault(require("path"));
9
-
10
- var _promises = require("fs/promises");
11
-
12
- var _fs = require("fs");
13
-
14
- var _debug = _interopRequireDefault(require("../../helpers/debug"));
15
-
16
- var _ora = _interopRequireDefault(require("ora"));
17
-
18
- var _cliTable = _interopRequireDefault(require("cli-table"));
19
-
20
- var _awsSdk = _interopRequireDefault(require("aws-sdk"));
21
-
22
- var _descriptions = _interopRequireDefault(require("../../helpers/descriptions"));
23
-
24
- var _print = _interopRequireWildcard(require("../../helpers/print"));
25
-
26
- var _utils = require("../../helpers/utils");
27
-
28
- var _api = require("../../helpers/api");
29
-
30
- 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); }
31
-
32
- 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; }
33
-
34
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
-
36
- const debug = (0, _debug.default)('commands:snapshots:download');
37
- const command = 'download';
38
- exports.command = command;
39
- const desc = 'Download Snapshots';
40
- exports.desc = desc;
41
-
42
- const builder = async yargs => {
43
- debug('builder', command);
44
- return yargs.option('downloadTo', _descriptions.default.options['downloadTo'].config).demandOption('downloadTo', _descriptions.default.options['downloadTo'].demandText).option('tenant', { ..._descriptions.default.options['tenant'].config,
45
- default: 'default'
46
- }).option('overwrite', _descriptions.default.options['overwrite'].config).demandOption('overwrite', _descriptions.default.options['overwrite'].demandText);
47
- };
48
-
49
- exports.builder = builder;
50
-
51
- const handler = async argv => {
52
- debug('handler', command, argv);
53
- const {
54
- hg,
55
- json,
56
- apikey,
57
- env,
58
- tenant,
59
- downloadTo,
60
- overwrite
61
- } = argv;
62
- const {
63
- clientApiBaseUri
64
- } = hg;
65
- let message;
66
- let spinner = (0, _ora.default)();
67
-
68
- const folderPrefix = _path.default.resolve(process.cwd(), (0, _utils.userSetOption)('downloadTo') ? downloadTo : 'snapshots');
69
-
70
- try {
71
- // 1. get STS credentials
72
- message = (0, _print.themed)(`Verifying user and authorizing`);
73
- !json && spinner.start((0, _print.themed)(`In progress: ${message}...`, 'secondary'));
74
- const {
75
- accessKeyId,
76
- secretAccessKey,
77
- sessionToken
78
- } = await (0, _api.genCredentialsOnClientApi)({
79
- debug,
80
- baseUri: clientApiBaseUri,
81
- task: 'snapshot-download',
82
- env,
83
- tenant,
84
- apikey
85
- }); // created authenticated S3 instance
86
-
87
- const s3 = new _awsSdk.default.S3({
88
- accessKeyId,
89
- secretAccessKey,
90
- sessionToken
91
- });
92
- !json && spinner.succeed((0, _print.themed)(`Finished: ${message}.`, 'secondary')); // 2. verify tenant is valid
93
-
94
- message = (0, _print.themed)(`Validating tenant exists`);
95
- !json && spinner.start((0, _print.themed)(`In progress: ${message}...`, 'secondary'));
96
-
97
- try {
98
- // this may also throw access denied
99
- const {
100
- CommonPrefixes: tenantFolders
101
- } = await s3.listObjectsV2({
102
- Bucket: env,
103
- Prefix: `${tenant}/`,
104
- Delimiter: '/'
105
- }).promise();
106
- if (tenantFolders.length === 0) throw new Error('Invalid tenant');
107
- } catch (err) {
108
- debug('err', err);
109
- throw new Error(`Tenant doesn't exist. Please check your tenant (-u) argument.`);
110
- }
111
-
112
- !json && spinner.succeed((0, _print.themed)(`Finished: ${message}.`, 'secondary')); // 3. get list of downloadable files
113
-
114
- message = (0, _print.themed)(`Scanning for downloadable files`);
115
- !json && spinner.start((0, _print.themed)(`In progress: ${message}...`, 'secondary'));
116
- const keyPrefix = `${tenant}/snapshots/`;
117
- const params = {
118
- Bucket: env,
119
- Prefix: keyPrefix
120
- };
121
- const {
122
- Contents: s3Files
123
- } = await s3.listObjectsV2(params).promise();
124
- !json && spinner.succeed((0, _print.themed)(`Finished: ${message}.`, 'secondary'));
125
- debug('s3-list-res', s3Files); // filter unwanted files from source
126
-
127
- const filesToDownload = s3Files ? s3Files.map(item => item.Key).filter(item => item !== keyPrefix) : [];
128
-
129
- if (!filesToDownload || filesToDownload.length === 0) {
130
- json ? (0, _print.printJSON)({
131
- status: 'success',
132
- downloadedFiles: []
133
- }) : spinner.warn((0, _print.themed)(`Warning: ${(0, _print.themed)('Nothing to download!')}`, 'secondary'));
134
- return;
135
- } // 4. download files
136
-
137
-
138
- message = (0, _print.themed)(`Downloading snapshot files to ${(0, _print.themed)(folderPrefix, 'info')}`);
139
- !json && spinner.info((0, _print.themed)(`Info: ${message}.`, 'secondary'));
140
- const table = new _cliTable.default({
141
- head: ['File', 'Status']
142
- });
143
-
144
- for await (const file of filesToDownload) {
145
- const subPath = file.substring(keyPrefix.length);
146
-
147
- const fullPath = _path.default.resolve(folderPrefix, subPath);
148
-
149
- debug('file', fullPath);
150
-
151
- if (file.endsWith('/')) {
152
- !(0, _fs.existsSync)(fullPath) && (await (0, _promises.mkdir)(fullPath, {
153
- recursive: true
154
- }));
155
- continue;
156
- } // skip if exists and overwrite is false
157
-
158
-
159
- if (!overwrite) {
160
- try {
161
- await (0, _promises.stat)(fullPath);
162
- debug('exists, skipping');
163
- table.push([subPath, 'Skipped']);
164
- continue;
165
- } catch (err) {
166
- if (err.code !== 'ENOENT') (0, _print.cl)(err);
167
- }
168
- }
169
-
170
- message = (0, _print.themed)(`Downloading file: ${(0, _print.themed)(subPath, 'info')}`);
171
- !json && spinner.start((0, _print.themed)(`In progress: ${message}...`, 'secondary')); // ensure destination folder exists
172
-
173
- await (0, _promises.mkdir)(_path.default.dirname(fullPath), {
174
- recursive: true
175
- }); // download s3 object into destination folder
176
-
177
- const fileStream = s3.getObject({
178
- Bucket: env,
179
- Key: file
180
- }).createReadStream();
181
- await (0, _promises.writeFile)(fullPath, await (0, _utils.streamToString)(fileStream));
182
- !json && spinner.succeed((0, _print.themed)(`Finished: ${message}.`, 'secondary'));
183
- table.push([subPath, 'Downloaded']);
184
- }
185
-
186
- if (json) {
187
- (0, _print.printJSON)({
188
- status: 'success',
189
- downloadedFiles: filesToDownload
190
- });
191
- } else {
192
- // print results
193
- (0, _print.cl)(table.toString());
194
- }
195
- } catch (err) {
196
- if (json) {
197
- (0, _print.printJSON)({
198
- status: 'error',
199
- error: err
200
- });
201
- } else {
202
- spinner.fail((0, _print.themed)(`Error: ${message}.`, 'secondary'));
203
- (0, _print.pr)((0, _print.themed)(`Message: ${(0, _print.themed)(err.message)}`, 'secondary'));
204
- debug(err);
205
-
206
- if (err && err.response && err.response.data) {
207
- debug('response', err.response.data);
208
- }
209
- }
210
- }
211
- };
212
-
213
- exports.handler = handler;
@@ -1,32 +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"));
9
-
10
- var _baseBuilder = require("../helpers/baseBuilder");
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- const debug = (0, _debug.default)('commands:snapshots');
15
- const command = 'snapshots <action>';
16
- exports.command = command;
17
- const desc = 'Manage tenant snapshots';
18
- exports.desc = desc;
19
-
20
- const builder = async function (yargs) {
21
- debug('builder', command, yargs);
22
- const base = await (0, _baseBuilder.baseApiBuilder)(yargs);
23
- return base.commandDir('snapshots');
24
- };
25
-
26
- exports.builder = builder;
27
-
28
- const handler = async function (argv) {
29
- debug('handler', command, argv);
30
- };
31
-
32
- exports.handler = handler;
@@ -1,183 +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"));
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-etl');
27
- const command = 'custom-etl';
28
- exports.command = command;
29
- const desc = 'List tenants with custom ETL 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
- supportedSources
47
- }) => {
48
- // Get all linked sources of the tuple (env, flow, tenant)
49
- const linkedSources = await (0, _api.getLinkedSources)({
50
- debug,
51
- baseUri,
52
- env,
53
- flow,
54
- tenant,
55
- apikey
56
- });
57
- let result = null;
58
-
59
- for (const {
60
- tap
61
- } of [...linkedSources, ...supportedSources]) {
62
- // Generate AWS credentials in order to read the S3 tap folder
63
- // Note(davi): I'm using "etl-download" because it's a "read ETL" operation
64
- const {
65
- accessKeyId,
66
- secretAccessKey,
67
- sessionToken
68
- } = await (0, _api.genCredentialsOnClientApi)({
69
- debug,
70
- baseUri,
71
- task: 'etl-download',
72
- env,
73
- tenant,
74
- flow,
75
- tap,
76
- apikey
77
- });
78
- const s3 = new _awsSdk.default.S3({
79
- accessKeyId,
80
- secretAccessKey,
81
- sessionToken
82
- });
83
- const keyPrefix = `${tenant}/flows/${flow}/taps/${tap}/etl/`;
84
- const params = {
85
- Bucket: env,
86
- Prefix: keyPrefix
87
- }; // List all files inside the S3 tap folder
88
-
89
- const {
90
- Contents: s3Files
91
- } = await s3.listObjectsV2(params).promise(); // Check if either "etl.py" or "etl.ipynb" exist
92
-
93
- const hasCustomEtl = s3Files.some(({
94
- Key
95
- }) => Key.endsWith('etl.py') || Key.endsWith('etl.ipynb'));
96
- if (hasCustomEtl) result = tenant; // If it's true, we can break already
97
-
98
- if (result !== null) break;
99
- }
100
-
101
- return result;
102
- };
103
-
104
- const handler = async argv => {
105
- debug('handler', command, argv);
106
- const {
107
- hg,
108
- json,
109
- apikey,
110
- env,
111
- flow
112
- } = argv;
113
- let message;
114
- let spinner = (0, _ora.default)();
115
-
116
- try {
117
- message = (0, _print.themed)(`Retrieving tenants for environment ${(0, _print.themed)(env, 'info')}`);
118
- !json && spinner.start((0, _print.themed)(`In progress: ${message}...`, 'secondary'));
119
- const [allTenants, supportedSources] = await Promise.all([(0, _api.getTenants)({
120
- debug,
121
- baseUri: hg.clientApiBaseUri,
122
- apikey,
123
- env
124
- }), (0, _api.getSupportedSources)({
125
- debug,
126
- baseUri: hg.clientApiBaseUri,
127
- apikey,
128
- env,
129
- flow
130
- })]);
131
- !json && spinner.succeed((0, _print.themed)(`Finished: ${message}.`, 'secondary'));
132
- let tenantsWithCustomEtl = [];
133
- message = (0, _print.themed)(`Querying for custom ETL scripts for flow ${(0, _print.themed)(flow, 'info')}`);
134
- !json && spinner.start((0, _print.themed)(`In progress: ${message}...`, 'secondary')); // Break the tenants array in to an array of arrays so we can make
135
- // parallel calls and make it faster
136
-
137
- for (const tenants of (0, _utils.buildChunks)(allTenants)) {
138
- const maybeTenantsWithCustomEtl = await Promise.all(tenants.map(tenant => processTenant({
139
- debug,
140
- baseUri: hg.clientApiBaseUri,
141
- apikey,
142
- env,
143
- flow,
144
- tenant,
145
- supportedSources
146
- }))); // Note(davi): we need the `.filter(Boolean)` because sometimes
147
- // the function above returns `null`
148
-
149
- tenantsWithCustomEtl = tenantsWithCustomEtl.concat(maybeTenantsWithCustomEtl.filter(Boolean));
150
- }
151
-
152
- !json && spinner.succeed((0, _print.themed)(`Finished: ${message}.`, 'secondary'));
153
-
154
- if (json) {
155
- (0, _print.printJSON)(tenantsWithCustomEtl);
156
- } else {
157
- // generate results table
158
- const table = new _cliTable.default({
159
- head: ['Tenant ID']
160
- });
161
- table.push(...tenantsWithCustomEtl.map(item => [item])); // print results
162
-
163
- console.log(table.toString());
164
- }
165
- } catch (err) {
166
- if (json) {
167
- (0, _print.printJSON)({
168
- status: 'error',
169
- error: err
170
- });
171
- } else {
172
- spinner.fail((0, _print.themed)(`Error: ${message}.`, 'secondary'));
173
- (0, _print.pr)((0, _print.themed)(`Message: ${(0, _print.themed)(err.message)}`, 'secondary'));
174
- debug(err);
175
-
176
- if (err && err.response && err.response.data) {
177
- debug('response', err.response.data);
178
- }
179
- }
180
- }
181
- };
182
-
183
- exports.handler = handler;
@@ -1,191 +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"));
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"));
17
-
18
- var _print = require("../../helpers/print");
19
-
20
- var _api = require("../../helpers/api");
21
-
22
- var _utils = require("../../helpers/utils");
23
-
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
-
26
- const debug = (0, _debug.default)('commands:tenants:custom-field-map');
27
- const command = 'custom-field-map';
28
- exports.command = command;
29
- const desc = 'List tenants with custom field map 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
- // Get all linked connectors/sources of the tuple (env, flow, tenant)
49
- const linkedConnectors = isV2Flow ? await (0, _api.getLinkedConnectors)({
50
- debug,
51
- baseUri,
52
- env,
53
- flow,
54
- tenant,
55
- apikey
56
- }) : await (0, _api.getLinkedSources)({
57
- debug,
58
- baseUri,
59
- env,
60
- flow,
61
- tenant,
62
- apikey
63
- });
64
- const connectors = []; // Generate AWS credentials in order to read the S3 tap folder
65
-
66
- const {
67
- accessKeyId,
68
- secretAccessKey,
69
- sessionToken
70
- } = await (0, _api.genCredentialsOnClientApi)({
71
- debug,
72
- baseUri,
73
- task: 'field-map-download',
74
- env,
75
- tenant,
76
- flow,
77
- apikey
78
- });
79
- const s3 = new _awsSdk.default.S3({
80
- accessKeyId,
81
- secretAccessKey,
82
- sessionToken
83
- });
84
-
85
- for (const {
86
- id,
87
- tap
88
- } of linkedConnectors) {
89
- const entityLabel = isV2Flow ? 'connectors' : 'taps';
90
- const params = {
91
- Bucket: env,
92
- Key: `${tenant}/flows/${flow}/${entityLabel}/${isV2Flow ? id : tap}/fieldMap.json`
93
- };
94
-
95
- try {
96
- await s3.headObject(params).promise();
97
- connectors.push(isV2Flow ? id : tap);
98
- } catch (error) {// Does not have fieldMap.json
99
- }
100
- }
101
-
102
- return {
103
- tenant,
104
- connectors
105
- };
106
- };
107
-
108
- const handler = async argv => {
109
- debug('handler', command, argv);
110
- const {
111
- hg,
112
- json,
113
- apikey,
114
- env,
115
- flow
116
- } = argv;
117
- let message;
118
- let spinner = (0, _ora.default)();
119
-
120
- try {
121
- message = (0, _print.themed)(`Retrieving tenants for environment ${(0, _print.themed)(env, 'info')}`);
122
- !json && spinner.start((0, _print.themed)(`In progress: ${message}...`, 'secondary'));
123
- const [allTenants, supportedFlow] = await Promise.all([(0, _api.getTenants)({
124
- debug,
125
- baseUri: hg.clientApiBaseUri,
126
- apikey,
127
- env
128
- }), (0, _api.getSupportedFlow)({
129
- debug,
130
- baseUri: hg.clientApiBaseUri,
131
- apikey,
132
- env,
133
- flow
134
- })]);
135
- const isV2Flow = (supportedFlow === null || supportedFlow === void 0 ? void 0 : supportedFlow.version) === 2;
136
- !json && spinner.succeed((0, _print.themed)(`Finished: ${message}.`, 'secondary'));
137
- const tenantsWithCustomFieldMap = [];
138
- message = (0, _print.themed)(`Querying for custom field maps for flow ${(0, _print.themed)(flow, 'info')}`);
139
- !json && spinner.start((0, _print.themed)(`In progress: ${message}...`, 'secondary')); // Break the tenants array in to an array of arrays so we can make
140
- // parallel calls and make it faster
141
-
142
- for (const tenants of (0, _utils.buildChunks)(allTenants)) {
143
- const maybeTenantsWithCustomFieldMap = await Promise.all(tenants.map(tenant => processTenant({
144
- debug,
145
- baseUri: hg.clientApiBaseUri,
146
- apikey,
147
- env,
148
- flow,
149
- tenant,
150
- isV2Flow
151
- })));
152
- tenantsWithCustomFieldMap.push(...maybeTenantsWithCustomFieldMap.filter(({
153
- connectors
154
- }) => connectors.length > 0));
155
- }
156
-
157
- !json && spinner.succeed((0, _print.themed)(`Finished: ${message}.`, 'secondary'));
158
-
159
- if (json) {
160
- (0, _print.printJSON)(tenantsWithCustomFieldMap);
161
- } else {
162
- // generate results table
163
- const table = new _cliTable.default({
164
- head: ['Tenant ID', 'Connector IDs']
165
- });
166
- table.push(...tenantsWithCustomFieldMap.map(({
167
- tenant,
168
- connectors
169
- }) => [tenant, connectors.join(', ')])); // print results
170
-
171
- console.log(table.toString());
172
- }
173
- } catch (err) {
174
- if (json) {
175
- (0, _print.printJSON)({
176
- status: 'error',
177
- error: err
178
- });
179
- } else {
180
- spinner.fail((0, _print.themed)(`Error: ${message}.`, 'secondary'));
181
- (0, _print.pr)((0, _print.themed)(`Message: ${(0, _print.themed)(err.message)}`, 'secondary'));
182
- debug(err);
183
-
184
- if (err && err.response && err.response.data) {
185
- debug('response', err.response.data);
186
- }
187
- }
188
- }
189
- };
190
-
191
- exports.handler = handler;