GSI - Employe Self Service Mobile
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.

24 lines
1.2 KiB

2 months ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const command_1 = require("../command");
  5. const requirePermissions_1 = require("../requirePermissions");
  6. const metadata = require("../database/metadata");
  7. const types_1 = require("../emulator/types");
  8. const commandUtils_1 = require("../emulator/commandUtils");
  9. const requireDatabaseInstance_1 = require("../requireDatabaseInstance");
  10. exports.command = new command_1.Command("database:rules:canary <rulesetId>")
  11. .description("mark a staged ruleset as the canary ruleset")
  12. .option("--instance <instance>", "use the database <instance>.firebaseio.com (if omitted, uses default database instance)")
  13. .before(requirePermissions_1.requirePermissions, ["firebasedatabase.instances.update"])
  14. .before(requireDatabaseInstance_1.requireDatabaseInstance)
  15. .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.DATABASE)
  16. .action(async (rulesetId, options) => {
  17. const oldLabels = await metadata.getRulesetLabels(options.instance);
  18. const newLabels = {
  19. stable: oldLabels.stable,
  20. canary: rulesetId,
  21. };
  22. await metadata.setRulesetLabels(options.instance, newLabels);
  23. return newLabels;
  24. });