eas-cli
Version:
EAS command line tool
39 lines (38 loc) • 1.99 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const chalk_1 = tslib_1.__importDefault(require("chalk"));
const dateformat_1 = tslib_1.__importDefault(require("dateformat"));
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
const EnvironmentSecretsQuery_1 = require("../../graphql/queries/EnvironmentSecretsQuery");
const log_1 = tslib_1.__importDefault(require("../../log"));
const formatFields_1 = tslib_1.__importDefault(require("../../utils/formatFields"));
class EnvironmentSecretList extends EasCommand_1.default {
static description = 'list environment secrets available for your current app';
static hidden = true;
static contextDefinition = {
...this.ContextOptions.ProjectId,
...this.ContextOptions.LoggedIn,
};
async runAsync() {
log_1.default.warn('This command is deprecated. Use eas env:list instead.');
log_1.default.newLine();
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(EnvironmentSecretList, {
nonInteractive: true,
});
const secrets = await EnvironmentSecretsQuery_1.EnvironmentSecretsQuery.allAsync(graphqlClient, projectId);
log_1.default.log((0, chalk_1.default) `{bold Secrets for this account and project:}`);
log_1.default.log(secrets.map(secret => formatSecret(secret)).join(`\n\n${chalk_1.default.dim('———')}\n\n`));
}
}
exports.default = EnvironmentSecretList;
function formatSecret(secret) {
return (0, formatFields_1.default)([
{ label: 'ID', value: secret.id },
{ label: 'Name', value: secret.name },
{ label: 'Scope', value: secret.scope },
{ label: 'Type', value: secret.type },
// TODO: Figure out why do we name it updated, while it's created at?
{ label: 'Updated at', value: (0, dateformat_1.default)(secret.createdAt, 'mmm dd HH:MM:ss') },
]);
}
;