No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

remoteconfig-versions-list.js 1.7KB

12345678910111213141516171819202122232425262728293031323334
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const logger_1 = require("../logger");
  5. const rcVersion = require("../remoteconfig/versionslist");
  6. const command_1 = require("../command");
  7. const projectUtils_1 = require("../projectUtils");
  8. const requireAuth_1 = require("../requireAuth");
  9. const requirePermissions_1 = require("../requirePermissions");
  10. const utils_1 = require("../utils");
  11. const Table = require("cli-table");
  12. const tableHead = ["Update User", "Version Number", "Update Time"];
  13. function pushTableContents(table, version) {
  14. var _a;
  15. return table.push([
  16. (_a = version.updateUser) === null || _a === void 0 ? void 0 : _a.email,
  17. version.versionNumber,
  18. version.updateTime ? (0, utils_1.datetimeString)(new Date(version.updateTime)) : "",
  19. ]);
  20. }
  21. exports.command = new command_1.Command("remoteconfig:versions:list")
  22. .description("get a list of Remote Config template versions that have been published for a Firebase project")
  23. .option("--limit <maxResults>", "limit the number of versions being returned. Pass '0' to fetch all versions.")
  24. .before(requireAuth_1.requireAuth)
  25. .before(requirePermissions_1.requirePermissions, ["cloudconfig.configs.get"])
  26. .action(async (options) => {
  27. const versionsList = await rcVersion.getVersions((0, projectUtils_1.needProjectId)(options), options.limit);
  28. const table = new Table({ head: tableHead, style: { head: ["green"] } });
  29. for (let item = 0; item < versionsList.versions.length; item++) {
  30. pushTableContents(table, versionsList.versions[item]);
  31. }
  32. logger_1.logger.info(table.toString());
  33. return versionsList;
  34. });