@cto.ai/ops
Version:
💻 CTO.ai Ops - The CLI built for Teams 🚀
48 lines (47 loc) • 1.83 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const base_1 = tslib_1.__importStar(require("../../base"));
const asyncPipe_1 = require("../../utils/asyncPipe");
const CustomErrors_1 = require("../../errors/CustomErrors");
class SecretsList extends base_1.default {
constructor() {
super(...arguments);
this.sendAnalytics = (inputs) => async () => {
try {
this.services.analytics.track({
userId: this.state.config.user.email,
teamId: this.state.config.team.id,
cliEvent: 'Secrets CLI List',
event: 'Secrets CLI List',
properties: {
email: this.state.config.user.email,
username: this.state.config.user.username,
results: inputs.secrets.length,
},
}, this.state.config.tokens.accessToken);
}
catch (err) {
this.debug('%O', err);
throw new CustomErrors_1.AnalyticsError(err);
}
};
}
async run() {
try {
await this.isLoggedIn();
const secretsListAnalyticsPipeline = asyncPipe_1.asyncPipe(this.sendAnalytics);
const inputs = await this.services.secretService.runListPipeline(this.state.config, this.services.api);
await secretsListAnalyticsPipeline(inputs);
}
catch (err) {
this.debug('%O', err);
this.config.runHook('error', { err });
}
}
}
exports.default = SecretsList;
SecretsList.description = 'List all the keys that are stored for the active team';
SecretsList.flags = {
help: base_1.flags.help({ char: 'h' }),
};