説明なし
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

database-rules-canary.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 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. });