@cto.ai/ops
Version:
💻 CTO.ai - The CLI built for Teams 🚀
42 lines (41 loc) • 1.57 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 {
const { config, secrets } = inputs;
this.services.analytics.track('Ops CLI Secrets:List', {
username: config.user.username,
results: secrets.length,
}, config);
}
catch (err) {
this.debug('%O', err);
throw new CustomErrors_1.AnalyticsError(err);
}
};
}
async run() {
try {
await this.isLoggedIn();
const secretsListAnalyticsPipeline = (0, 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, accessToken: this.accessToken });
}
}
}
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' }),
};