Ingen beskrivning
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

database-rules-release.js 1.2KB

123456789101112131415161718192021222324
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const command_1 = require("../command");
  5. const requireDatabaseInstance_1 = require("../requireDatabaseInstance");
  6. const requirePermissions_1 = require("../requirePermissions");
  7. const metadata = require("../database/metadata");
  8. const types_1 = require("../emulator/types");
  9. const commandUtils_1 = require("../emulator/commandUtils");
  10. exports.command = new command_1.Command("database:rules:release <rulesetId>")
  11. .description("mark a staged ruleset as the stable 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: rulesetId,
  20. canary: oldLabels.canary,
  21. };
  22. await metadata.setRulesetLabels(options.instance, newLabels);
  23. return newLabels;
  24. });