firebase-tools 11.0.1 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/lib/accountImporter.js +92 -93
  2. package/lib/api.js +77 -218
  3. package/lib/apiv2.js +5 -4
  4. package/lib/auth.js +69 -47
  5. package/lib/bin/firebase.js +42 -47
  6. package/lib/checkValidTargetFilters.js +13 -12
  7. package/lib/commands/appdistribution-distribute.js +2 -1
  8. package/lib/commands/appdistribution-testers-add.js +2 -1
  9. package/lib/commands/appdistribution-testers-remove.js +2 -1
  10. package/lib/commands/apps-android-sha-create.js +2 -1
  11. package/lib/commands/apps-android-sha-delete.js +2 -1
  12. package/lib/commands/apps-android-sha-list.js +2 -1
  13. package/lib/commands/apps-create.js +2 -1
  14. package/lib/commands/apps-list.js +2 -1
  15. package/lib/commands/apps-sdkconfig.js +2 -1
  16. package/lib/commands/auth-export.js +2 -1
  17. package/lib/commands/auth-import.js +7 -10
  18. package/lib/commands/crashlytics-symbols-upload.js +2 -1
  19. package/lib/commands/database-get.js +4 -3
  20. package/lib/commands/database-instances-create.js +2 -1
  21. package/lib/commands/database-instances-list.js +3 -3
  22. package/lib/commands/database-profile.js +2 -1
  23. package/lib/commands/database-push.js +2 -1
  24. package/lib/commands/database-remove.js +2 -1
  25. package/lib/commands/database-rules-canary.js +2 -1
  26. package/lib/commands/database-rules-get.js +2 -1
  27. package/lib/commands/database-rules-list.js +2 -1
  28. package/lib/commands/database-rules-release.js +2 -1
  29. package/lib/commands/database-rules-stage.js +2 -1
  30. package/lib/commands/database-set.js +2 -1
  31. package/lib/commands/database-settings-get.js +2 -1
  32. package/lib/commands/database-settings-set.js +2 -1
  33. package/lib/commands/database-update.js +2 -1
  34. package/lib/commands/deploy.js +23 -21
  35. package/lib/commands/emulators-exec.js +2 -1
  36. package/lib/commands/emulators-export.js +2 -1
  37. package/lib/commands/emulators-start.js +2 -1
  38. package/lib/commands/experimental-functions-shell.js +10 -8
  39. package/lib/commands/ext-configure.js +2 -1
  40. package/lib/commands/ext-dev-deprecate.js +2 -1
  41. package/lib/commands/ext-dev-emulators-exec.js +2 -1
  42. package/lib/commands/ext-dev-emulators-start.js +2 -1
  43. package/lib/commands/ext-dev-extension-delete.js +2 -1
  44. package/lib/commands/ext-dev-init.js +2 -1
  45. package/lib/commands/ext-dev-list.js +2 -1
  46. package/lib/commands/ext-dev-publish.js +2 -1
  47. package/lib/commands/ext-dev-register.js +2 -1
  48. package/lib/commands/ext-dev-undeprecate.js +2 -1
  49. package/lib/commands/ext-dev-unpublish.js +2 -1
  50. package/lib/commands/ext-dev-usage.js +2 -1
  51. package/lib/commands/ext-export.js +2 -1
  52. package/lib/commands/ext-info.js +2 -1
  53. package/lib/commands/ext-install.js +2 -1
  54. package/lib/commands/ext-list.js +2 -1
  55. package/lib/commands/ext-sources-create.js +2 -1
  56. package/lib/commands/ext-uninstall.js +2 -1
  57. package/lib/commands/ext-update.js +2 -1
  58. package/lib/commands/ext.js +2 -1
  59. package/lib/commands/firestore-delete.js +2 -1
  60. package/lib/commands/firestore-indexes-list.js +2 -1
  61. package/lib/commands/functions-config-clone.js +4 -3
  62. package/lib/commands/functions-config-export.js +2 -1
  63. package/lib/commands/functions-config-get.js +2 -1
  64. package/lib/commands/functions-config-set.js +2 -1
  65. package/lib/commands/functions-config-unset.js +2 -1
  66. package/lib/commands/functions-delete.js +2 -1
  67. package/lib/commands/functions-deletegcfartifacts.js +2 -1
  68. package/lib/commands/functions-list.js +2 -1
  69. package/lib/commands/functions-log.js +2 -1
  70. package/lib/commands/functions-secrets-access.js +2 -1
  71. package/lib/commands/functions-secrets-destroy.js +2 -1
  72. package/lib/commands/functions-secrets-get.js +2 -1
  73. package/lib/commands/functions-secrets-prune.js +2 -1
  74. package/lib/commands/functions-secrets-set.js +2 -1
  75. package/lib/commands/functions-shell.js +12 -10
  76. package/lib/commands/help.js +2 -1
  77. package/lib/commands/hosting-channel-create.js +2 -1
  78. package/lib/commands/hosting-channel-delete.js +2 -1
  79. package/lib/commands/hosting-channel-deploy.js +2 -1
  80. package/lib/commands/hosting-channel-list.js +2 -1
  81. package/lib/commands/hosting-channel-open.js +2 -1
  82. package/lib/commands/hosting-clone.js +2 -1
  83. package/lib/commands/hosting-disable.js +2 -1
  84. package/lib/commands/hosting-sites-create.js +2 -1
  85. package/lib/commands/hosting-sites-delete.js +2 -1
  86. package/lib/commands/hosting-sites-get.js +2 -1
  87. package/lib/commands/hosting-sites-list.js +2 -1
  88. package/lib/commands/index.js +23 -13
  89. package/lib/commands/init.js +47 -43
  90. package/lib/commands/login-add.js +2 -1
  91. package/lib/commands/login-ci.js +2 -1
  92. package/lib/commands/login-list.js +2 -1
  93. package/lib/commands/login-use.js +2 -1
  94. package/lib/commands/login.js +2 -1
  95. package/lib/commands/logout.js +2 -1
  96. package/lib/commands/open.js +2 -1
  97. package/lib/commands/projects-addfirebase.js +2 -1
  98. package/lib/commands/projects-create.js +2 -1
  99. package/lib/commands/projects-list.js +2 -1
  100. package/lib/commands/remoteconfig-get.js +2 -1
  101. package/lib/commands/remoteconfig-rollback.js +2 -1
  102. package/lib/commands/remoteconfig-versions-list.js +2 -1
  103. package/lib/commands/serve.js +29 -27
  104. package/lib/commands/setup-emulators-database.js +2 -1
  105. package/lib/commands/setup-emulators-firestore.js +2 -1
  106. package/lib/commands/setup-emulators-pubsub.js +2 -1
  107. package/lib/commands/setup-emulators-storage.js +2 -1
  108. package/lib/commands/setup-emulators-ui.js +2 -1
  109. package/lib/commands/target-apply.js +2 -1
  110. package/lib/commands/target-clear.js +2 -1
  111. package/lib/commands/target-remove.js +2 -1
  112. package/lib/commands/target.js +2 -1
  113. package/lib/commands/use.js +54 -52
  114. package/lib/config.js +3 -3
  115. package/lib/deploy/database/deploy.js +3 -2
  116. package/lib/deploy/database/index.js +8 -5
  117. package/lib/deploy/database/prepare.js +22 -19
  118. package/lib/deploy/database/release.js +12 -9
  119. package/lib/deploy/firestore/prepare.js +2 -2
  120. package/lib/deploy/functions/build.js +32 -20
  121. package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +187 -54
  122. package/lib/deploy/functions/runtimes/node/parseTriggers.js +14 -2
  123. package/lib/deploy/functions/services/database.js +14 -0
  124. package/lib/deploy/functions/services/index.js +14 -0
  125. package/lib/deploy/index.js +3 -3
  126. package/lib/deploy/lifecycleHooks.js +23 -20
  127. package/lib/deploy/remoteconfig/prepare.js +2 -2
  128. package/lib/emulator/auth/apiSpec.js +14 -46
  129. package/lib/emulator/auth/operations.js +6 -29
  130. package/lib/emulator/auth/state.js +2 -25
  131. package/lib/emulator/controller.js +1 -1
  132. package/lib/emulator/databaseEmulator.js +2 -2
  133. package/lib/errorOut.js +2 -2
  134. package/lib/functions/events/v2.js +7 -1
  135. package/lib/functionsConfigClone.js +43 -41
  136. package/lib/gcp/cloudfunctionsv2.js +17 -2
  137. package/lib/gcp/iam.js +1 -1
  138. package/lib/gcp/index.js +10 -10
  139. package/lib/gcp/runtimeconfig.js +45 -47
  140. package/lib/index.js +29 -28
  141. package/lib/init/features/database.js +10 -2
  142. package/lib/init/features/functions/index.js +1 -1
  143. package/lib/init/features/functions/javascript.js +23 -20
  144. package/lib/init/features/functions/npm-dependencies.js +17 -14
  145. package/lib/init/features/functions/typescript.js +27 -24
  146. package/lib/init/features/hosting/github.js +5 -4
  147. package/lib/loadCJSON.js +9 -6
  148. package/lib/logError.js +15 -12
  149. package/lib/parseBoltRules.js +15 -14
  150. package/lib/profileReport.js +503 -511
  151. package/lib/profiler.js +4 -4
  152. package/lib/requireAuth.js +0 -1
  153. package/lib/responseToError.js +8 -5
  154. package/lib/scopes.js +9 -9
  155. package/npm-shrinkwrap.json +537 -193
  156. package/package.json +8 -6
@@ -1,23 +1,26 @@
1
1
  "use strict";
2
- var clc = require("cli-color");
3
- var fs = require("fs");
4
- var homeDir = require("os").homedir();
5
- var path = require("path");
6
- var { Command } = require("../command");
7
- var { Config } = require("../config");
8
- var fsutils = require("../fsutils");
9
- var { init } = require("../init");
10
- const { logger } = require("../logger");
11
- var { prompt, promptOnce } = require("../prompt");
12
- var { requireAuth } = require("../requireAuth");
13
- var utils = require("../utils");
14
- const { getAllAccounts } = require("../auth");
15
- var TEMPLATE_ROOT = path.resolve(__dirname, "../../templates/");
16
- var BANNER_TEXT = fs.readFileSync(path.join(TEMPLATE_ROOT, "banner.txt"), "utf8");
17
- var GITIGNORE_TEMPLATE = fs.readFileSync(path.join(TEMPLATE_ROOT, "_gitignore"), "utf8");
18
- var _isOutside = function (from, to) {
19
- return path.relative(from, to).match(/^\.\./);
20
- };
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
4
+ const clc = require("cli-color");
5
+ const fs = require("fs");
6
+ const os = require("os");
7
+ const path = require("path");
8
+ const command_1 = require("../command");
9
+ const config_1 = require("../config");
10
+ const auth_1 = require("../auth");
11
+ const init_1 = require("../init");
12
+ const logger_1 = require("../logger");
13
+ const prompt_1 = require("../prompt");
14
+ const requireAuth_1 = require("../requireAuth");
15
+ const fsutils = require("../fsutils");
16
+ const utils = require("../utils");
17
+ const homeDir = os.homedir();
18
+ const TEMPLATE_ROOT = path.resolve(__dirname, "../../templates/");
19
+ const BANNER_TEXT = fs.readFileSync(path.join(TEMPLATE_ROOT, "banner.txt"), "utf8");
20
+ const GITIGNORE_TEMPLATE = fs.readFileSync(path.join(TEMPLATE_ROOT, "_gitignore"), "utf8");
21
+ function isOutside(from, to) {
22
+ return !!/^\.\./.exec(path.relative(from, to));
23
+ }
21
24
  const choices = [
22
25
  {
23
26
  value: "database",
@@ -70,30 +73,30 @@ ${[...featureNames]
70
73
  .sort()
71
74
  .map((n) => `\n - ${n}`)
72
75
  .join("")}`;
73
- module.exports = new Command("init [feature]")
76
+ exports.command = new command_1.Command("init [feature]")
74
77
  .description(DESCRIPTION)
75
- .before(requireAuth)
76
- .action(function (feature, options) {
78
+ .before(requireAuth_1.requireAuth)
79
+ .action((feature, options) => {
77
80
  if (feature && !featureNames.includes(feature)) {
78
81
  return utils.reject(clc.bold(feature) +
79
82
  " is not a supported feature; must be one of " +
80
83
  featureNames.join(", ") +
81
- ".", { exit: 1 });
84
+ ".");
82
85
  }
83
- var cwd = options.cwd || process.cwd();
84
- var warnings = [];
85
- var warningText = "";
86
- if (_isOutside(homeDir, cwd)) {
86
+ const cwd = options.cwd || process.cwd();
87
+ const warnings = [];
88
+ let warningText = "";
89
+ if (isOutside(homeDir, cwd)) {
87
90
  warnings.push("You are currently outside your home directory");
88
91
  }
89
92
  if (cwd === homeDir) {
90
93
  warnings.push("You are initializing your home directory as a Firebase project directory");
91
94
  }
92
- var existingConfig = Config.load(options, true);
95
+ const existingConfig = config_1.Config.load(options, true);
93
96
  if (existingConfig) {
94
97
  warnings.push("You are initializing within an existing Firebase project directory");
95
98
  }
96
- var config = existingConfig !== null ? existingConfig : new Config({}, { projectDir: cwd, cwd: cwd });
99
+ const config = existingConfig !== null ? existingConfig : new config_1.Config({}, { projectDir: cwd, cwd: cwd });
97
100
  if (warnings.length) {
98
101
  warningText =
99
102
  "\nBefore we get started, keep in mind:\n\n " +
@@ -101,21 +104,21 @@ module.exports = new Command("init [feature]")
101
104
  warnings.join("\n " + clc.yellow.bold("* ")) +
102
105
  "\n";
103
106
  }
104
- logger.info(clc.yellow.bold(BANNER_TEXT) +
107
+ logger_1.logger.info(clc.yellow.bold(BANNER_TEXT) +
105
108
  "\nYou're about to initialize a Firebase project in this directory:\n\n " +
106
109
  clc.bold(config.projectDir) +
107
110
  "\n" +
108
111
  warningText);
109
- var setup = {
112
+ const setup = {
110
113
  config: config.src,
111
114
  rcfile: config.readProjectFile(".firebaserc", {
112
115
  json: true,
113
116
  fallback: {},
114
117
  }),
115
118
  };
116
- var next;
119
+ let next;
117
120
  if (process.platform === "win32") {
118
- next = promptOnce({
121
+ next = (0, prompt_1.promptOnce)({
119
122
  type: "confirm",
120
123
  message: "Are you ready to proceed?",
121
124
  });
@@ -124,7 +127,7 @@ module.exports = new Command("init [feature]")
124
127
  next = Promise.resolve(true);
125
128
  }
126
129
  return next
127
- .then(function (proceed) {
130
+ .then((proceed) => {
128
131
  if (!proceed) {
129
132
  return utils.reject("Aborted by user.", { exit: 1 });
130
133
  }
@@ -133,7 +136,7 @@ module.exports = new Command("init [feature]")
133
136
  setup.features = [feature];
134
137
  return undefined;
135
138
  }
136
- return prompt(setup, [
139
+ return (0, prompt_1.prompt)(setup, [
137
140
  {
138
141
  type: "checkbox",
139
142
  name: "features",
@@ -143,25 +146,26 @@ module.exports = new Command("init [feature]")
143
146
  },
144
147
  ]);
145
148
  })
146
- .then(function () {
147
- if (setup.features.length === 0) {
149
+ .then(() => {
150
+ var _a;
151
+ if (!setup.features || ((_a = setup.features) === null || _a === void 0 ? void 0 : _a.length) === 0) {
148
152
  return utils.reject("Must select at least one feature. Use " +
149
153
  clc.bold.underline("SPACEBAR") +
150
154
  " to select features, or specify a feature by running " +
151
155
  clc.bold("firebase init [feature_name]"));
152
156
  }
153
157
  setup.features.unshift("project");
154
- const allAccounts = getAllAccounts();
158
+ const allAccounts = (0, auth_1.getAllAccounts)();
155
159
  if (allAccounts.length > 1) {
156
160
  setup.features.unshift("account");
157
161
  }
158
162
  if (setup.features.includes("hosting") && setup.features.includes("hosting:github")) {
159
- setup.features = setup.features.filter((f) => f != "hosting:github");
163
+ setup.features = setup.features.filter((f) => f !== "hosting:github");
160
164
  }
161
- return init(setup, config, options);
165
+ return (0, init_1.init)(setup, config, options);
162
166
  })
163
- .then(function () {
164
- logger.info();
167
+ .then(() => {
168
+ logger_1.logger.info();
165
169
  utils.logBullet("Writing configuration info to " + clc.bold("firebase.json") + "...");
166
170
  config.writeProjectFile("firebase.json", setup.config);
167
171
  utils.logBullet("Writing project information to " + clc.bold(".firebaserc") + "...");
@@ -170,7 +174,7 @@ module.exports = new Command("init [feature]")
170
174
  utils.logBullet("Writing gitignore file to " + clc.bold(".gitignore") + "...");
171
175
  config.writeProjectFile(".gitignore", GITIGNORE_TEMPLATE);
172
176
  }
173
- logger.info();
177
+ logger_1.logger.info();
174
178
  utils.logSuccess("Firebase initialization complete!");
175
179
  });
176
180
  });
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const clc = require("cli-color");
4
5
  const command_1 = require("../command");
5
6
  const logger_1 = require("../logger");
6
7
  const utils = require("../utils");
7
8
  const error_1 = require("../error");
8
9
  const auth = require("../auth");
9
- module.exports = new command_1.Command("login:add [email]")
10
+ exports.command = new command_1.Command("login:add [email]")
10
11
  .description("authorize the CLI for an additional account")
11
12
  .option("--no-localhost", "copy and paste a code instead of starting a local server for authentication")
12
13
  .action(async (email, options) => {
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const clc = require("cli-color");
4
5
  const command_1 = require("../command");
5
6
  const error_1 = require("../error");
6
7
  const logger_1 = require("../logger");
7
8
  const auth = require("../auth");
8
9
  const utils = require("../utils");
9
- exports.default = new command_1.Command("login:ci")
10
+ exports.command = new command_1.Command("login:ci")
10
11
  .description("generate an access token for use in non-interactive environments")
11
12
  .option("--no-localhost", "copy and paste a code instead of starting a local server for authentication")
12
13
  .action(async (options) => {
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const clc = require("cli-color");
4
5
  const command_1 = require("../command");
5
6
  const logger_1 = require("../logger");
6
7
  const utils = require("../utils");
7
8
  const auth = require("../auth");
8
- module.exports = new command_1.Command("login:list")
9
+ exports.command = new command_1.Command("login:list")
9
10
  .description("list authorized CLI accounts")
10
11
  .action((options) => {
11
12
  const user = options.user;
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const clc = require("cli-color");
4
5
  const command_1 = require("../command");
5
6
  const utils = require("../utils");
6
7
  const auth = require("../auth");
7
8
  const error_1 = require("../error");
8
- module.exports = new command_1.Command("login:use <email>")
9
+ exports.command = new command_1.Command("login:use <email>")
9
10
  .description("set the default account to use for this project directory")
10
11
  .action((email, options) => {
11
12
  const allAccounts = auth.getAllAccounts();
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const _ = require("lodash");
4
5
  const clc = require("cli-color");
5
6
  const command_1 = require("../command");
@@ -10,7 +11,7 @@ const error_1 = require("../error");
10
11
  const prompt_1 = require("../prompt");
11
12
  const auth = require("../auth");
12
13
  const utils_1 = require("../utils");
13
- module.exports = new command_1.Command("login")
14
+ exports.command = new command_1.Command("login")
14
15
  .description("log the CLI into Firebase")
15
16
  .option("--no-localhost", "login from a device without an accessible localhost")
16
17
  .option("--reauth", "force reauthentication even if already logged in")
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const command_1 = require("../command");
4
5
  const logger_1 = require("../logger");
5
6
  const clc = require("cli-color");
6
7
  const utils = require("../utils");
7
8
  const auth = require("../auth");
8
9
  const prompt_1 = require("../prompt");
9
- module.exports = new command_1.Command("logout [email]")
10
+ exports.command = new command_1.Command("logout [email]")
10
11
  .description("log the CLI out of Firebase")
11
12
  .action(async (email, options) => {
12
13
  const globalToken = utils.getInheritedOption(options, "token");
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const _ = require("lodash");
4
5
  const clc = require("cli-color");
5
6
  const open = require("open");
@@ -42,7 +43,7 @@ const LINKS = [
42
43
  { name: "Test Lab", arg: "testlab", consolePath: "/testlab/histories/" },
43
44
  ];
44
45
  const CHOICES = _.map(LINKS, "name");
45
- exports.default = new command_1.Command("open [link]")
46
+ exports.command = new command_1.Command("open [link]")
46
47
  .description("quickly open a browser to relevant project resources")
47
48
  .before(requirePermissions_1.requirePermissions)
48
49
  .before(requireDatabaseInstance_1.requireDatabaseInstance)
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const command_1 = require("../command");
4
5
  const error_1 = require("../error");
5
6
  const projects_1 = require("../management/projects");
6
7
  const requireAuth_1 = require("../requireAuth");
7
- module.exports = new command_1.Command("projects:addfirebase [projectId]")
8
+ exports.command = new command_1.Command("projects:addfirebase [projectId]")
8
9
  .description("add Firebase resources to a Google Cloud Platform project")
9
10
  .before(requireAuth_1.requireAuth)
10
11
  .action(async (projectId, options) => {
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const command_1 = require("../command");
4
5
  const error_1 = require("../error");
5
6
  const projects_1 = require("../management/projects");
6
7
  const prompt_1 = require("../prompt");
7
8
  const requireAuth_1 = require("../requireAuth");
8
- module.exports = new command_1.Command("projects:create [projectId]")
9
+ exports.command = new command_1.Command("projects:create [projectId]")
9
10
  .description("creates a new Google Cloud Platform project, then adds Firebase resources to the project")
10
11
  .option("-n, --display-name <displayName>", "(optional) display name for the project")
11
12
  .option("-o, --organization <organizationId>", "(optional) ID of the parent Google Cloud Platform organization under which to create this project")
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const clc = require("cli-color");
4
5
  const ora = require("ora");
5
6
  const Table = require("cli-table");
@@ -40,7 +41,7 @@ function logProjectCount(arr = []) {
40
41
  logger_1.logger.info("");
41
42
  logger_1.logger.info(`${arr.length} project(s) total.`);
42
43
  }
43
- module.exports = new command_1.Command("projects:list")
44
+ exports.command = new command_1.Command("projects:list")
44
45
  .description("list all Firebase projects you have access to")
45
46
  .before(requireAuth_1.requireAuth)
46
47
  .action(async (options) => {
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const rcGet = require("../remoteconfig/get");
4
5
  const command_1 = require("../command");
5
6
  const requireAuth_1 = require("../requireAuth");
@@ -20,7 +21,7 @@ function checkValidOptionalNumber(versionNumber) {
20
21
  }
21
22
  throw new error_1.FirebaseError(`Could not interpret "${versionNumber}" as a valid number.`);
22
23
  }
23
- module.exports = new command_1.Command("remoteconfig:get")
24
+ exports.command = new command_1.Command("remoteconfig:get")
24
25
  .description("get a Firebase project's Remote Config template")
25
26
  .option("-v, --version-number <versionNumber>", "grabs the specified version of the template")
26
27
  .option("-o, --output [filename]", "write config output to a filename (if omitted, will use the default file path)")
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const command_1 = require("../command");
4
5
  const error_1 = require("../error");
5
6
  const prompt_1 = require("../prompt");
@@ -8,7 +9,7 @@ const rollback_1 = require("../remoteconfig/rollback");
8
9
  const requirePermissions_1 = require("../requirePermissions");
9
10
  const versionslist_1 = require("../remoteconfig/versionslist");
10
11
  const projectUtils_1 = require("../projectUtils");
11
- module.exports = new command_1.Command("remoteconfig:rollback")
12
+ exports.command = new command_1.Command("remoteconfig:rollback")
12
13
  .description("roll back a project's published Remote Config template to the one specified by the provided version number")
13
14
  .before(requireAuth_1.requireAuth)
14
15
  .before(requirePermissions_1.requirePermissions, ["cloudconfig.configs.get", "cloudconfig.configs.update"])
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const logger_1 = require("../logger");
4
5
  const rcVersion = require("../remoteconfig/versionslist");
5
6
  const command_1 = require("../command");
@@ -17,7 +18,7 @@ function pushTableContents(table, version) {
17
18
  version.updateTime ? (0, utils_1.datetimeString)(new Date(version.updateTime)) : "",
18
19
  ]);
19
20
  }
20
- module.exports = new command_1.Command("remoteconfig:versions:list")
21
+ exports.command = new command_1.Command("remoteconfig:versions:list")
21
22
  .description("get a list of Remote Config template versions that have been published for a Firebase project")
22
23
  .option("--limit <maxResults>", "limit the number of versions being returned. Pass '0' to fetch all versions.")
23
24
  .before(requireAuth_1.requireAuth)
@@ -1,27 +1,29 @@
1
1
  "use strict";
2
- var clc = require("cli-color");
3
- var _ = require("lodash");
4
- var { Command } = require("../command");
5
- const { logger } = require("../logger");
6
- var utils = require("../utils");
7
- var { requirePermissions } = require("../requirePermissions");
8
- var { requireConfig } = require("../requireConfig");
9
- var { serve } = require("../serve/index");
10
- var { filterTargets } = require("../filterTargets");
11
- var { needProjectNumber } = require("../projectUtils");
12
- var { FirebaseError } = require("../error");
13
- var VALID_TARGETS = ["hosting", "functions"];
14
- var REQUIRES_AUTH = ["hosting", "functions"];
15
- var ALL_TARGETS = _.union(VALID_TARGETS, ["database", "firestore"]);
16
- var filterOnly = (list, only) => {
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
4
+ const clc = require("cli-color");
5
+ const _ = require("lodash");
6
+ const command_1 = require("../command");
7
+ const logger_1 = require("../logger");
8
+ const utils = require("../utils");
9
+ const requirePermissions_1 = require("../requirePermissions");
10
+ const requireConfig_1 = require("../requireConfig");
11
+ const index_1 = require("../serve/index");
12
+ const filterTargets_1 = require("../filterTargets");
13
+ const projectUtils_1 = require("../projectUtils");
14
+ const error_1 = require("../error");
15
+ const VALID_TARGETS = ["hosting", "functions"];
16
+ const REQUIRES_AUTH = ["hosting", "functions"];
17
+ const ALL_TARGETS = _.union(VALID_TARGETS, ["database", "firestore"]);
18
+ function filterOnly(list, only = "") {
17
19
  if (!only) {
18
20
  return [];
19
21
  }
20
22
  return _.intersection(list, only.split(",").map((opt) => {
21
23
  return opt.split(":")[0];
22
24
  }));
23
- };
24
- module.exports = new Command("serve")
25
+ }
26
+ exports.command = new command_1.Command("serve")
25
27
  .description("start a local server for your static assets")
26
28
  .option("-p, --port <port>", "the port on which to listen (default: 5000)", 5000)
27
29
  .option("-o, --host <host>", "the host on which to listen (default: localhost)", "localhost")
@@ -33,28 +35,28 @@ module.exports = new Command("serve")
33
35
  filterOnly(REQUIRES_AUTH, options.only).length === 0) {
34
36
  return Promise.resolve();
35
37
  }
36
- return requireConfig(options)
37
- .then(() => requirePermissions(options))
38
- .then(() => needProjectNumber(options));
38
+ return (0, requireConfig_1.requireConfig)(options)
39
+ .then(() => (0, requirePermissions_1.requirePermissions)(options))
40
+ .then(() => (0, projectUtils_1.needProjectNumber)(options));
39
41
  })
40
42
  .action((options) => {
41
43
  options.targets = filterOnly(ALL_TARGETS, options.only);
42
44
  if (options.targets.includes("database") || options.targets.includes("firestore")) {
43
- throw new FirebaseError(`Please use ${clc.bold("firebase emulators:start")} to start the Realtime Database or Cloud Firestore emulators. ${clc.bold("firebase serve")} only supports Hosting and Cloud Functions.`);
45
+ throw new error_1.FirebaseError(`Please use ${clc.bold("firebase emulators:start")} to start the Realtime Database or Cloud Firestore emulators. ${clc.bold("firebase serve")} only supports Hosting and Cloud Functions.`);
44
46
  }
45
47
  options.targets = filterOnly(VALID_TARGETS, options.only);
46
48
  if (options.targets.length > 0) {
47
- return serve(options);
49
+ return (0, index_1.serve)(options);
48
50
  }
49
51
  if (options.config) {
50
- logger.info();
51
- logger.info(clc.bold(clc.white("===") + " Serving from '" + options.config.projectDir + "'..."));
52
- logger.info();
52
+ logger_1.logger.info();
53
+ logger_1.logger.info(clc.bold(clc.white("===") + " Serving from '" + options.config.projectDir + "'..."));
54
+ logger_1.logger.info();
53
55
  }
54
56
  else {
55
57
  utils.logWarning("No Firebase project directory detected. Serving static content from " +
56
58
  clc.bold(options.cwd || process.cwd()));
57
59
  }
58
- options.targets = filterTargets(options, VALID_TARGETS);
59
- return serve(options);
60
+ options.targets = (0, filterTargets_1.filterTargets)(options, VALID_TARGETS);
61
+ return (0, index_1.serve)(options);
60
62
  });
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const command_1 = require("../command");
4
5
  const download_1 = require("../emulator/download");
5
6
  const types_1 = require("../emulator/types");
6
7
  const NAME = types_1.Emulators.DATABASE;
7
- exports.default = new command_1.Command(`setup:emulators:${NAME}`)
8
+ exports.command = new command_1.Command(`setup:emulators:${NAME}`)
8
9
  .description(`downloads the ${NAME} emulator`)
9
10
  .action(() => {
10
11
  return (0, download_1.downloadEmulator)(NAME);
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const command_1 = require("../command");
4
5
  const download_1 = require("../emulator/download");
5
6
  const types_1 = require("../emulator/types");
6
7
  const NAME = types_1.Emulators.FIRESTORE;
7
- exports.default = new command_1.Command(`setup:emulators:${NAME}`)
8
+ exports.command = new command_1.Command(`setup:emulators:${NAME}`)
8
9
  .description(`downloads the ${NAME} emulator`)
9
10
  .action(() => {
10
11
  return (0, download_1.downloadEmulator)(NAME);
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const command_1 = require("../command");
4
5
  const download_1 = require("../emulator/download");
5
6
  const types_1 = require("../emulator/types");
6
7
  const EMULATOR_NAME = types_1.Emulators.PUBSUB;
7
- exports.default = new command_1.Command(`setup:emulators:${EMULATOR_NAME}`)
8
+ exports.command = new command_1.Command(`setup:emulators:${EMULATOR_NAME}`)
8
9
  .description(`downloads the ${EMULATOR_NAME} emulator`)
9
10
  .action(() => {
10
11
  return (0, download_1.downloadEmulator)(EMULATOR_NAME);
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const command_1 = require("../command");
4
5
  const download_1 = require("../emulator/download");
5
6
  const types_1 = require("../emulator/types");
6
7
  const EMULATOR_NAME = types_1.Emulators.STORAGE;
7
- exports.default = new command_1.Command(`setup:emulators:${EMULATOR_NAME}`)
8
+ exports.command = new command_1.Command(`setup:emulators:${EMULATOR_NAME}`)
8
9
  .description(`downloads the ${EMULATOR_NAME} emulator`)
9
10
  .action(() => {
10
11
  return (0, download_1.downloadEmulator)(EMULATOR_NAME);
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const command_1 = require("../command");
4
5
  const download_1 = require("../emulator/download");
5
6
  const types_1 = require("../emulator/types");
6
7
  const NAME = types_1.Emulators.UI;
7
- exports.default = new command_1.Command(`setup:emulators:${NAME}`)
8
+ exports.command = new command_1.Command(`setup:emulators:${NAME}`)
8
9
  .description(`downloads the ${NAME} emulator`)
9
10
  .action(() => {
10
11
  return (0, download_1.downloadEmulator)(NAME);
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const clc = require("cli-color");
4
5
  const command_1 = require("../command");
5
6
  const logger_1 = require("../logger");
6
7
  const requireConfig_1 = require("../requireConfig");
7
8
  const utils = require("../utils");
8
9
  const error_1 = require("../error");
9
- exports.default = new command_1.Command("target:apply <type> <name> <resources...>")
10
+ exports.command = new command_1.Command("target:apply <type> <name> <resources...>")
10
11
  .description("apply a deploy target to a resource")
11
12
  .before(requireConfig_1.requireConfig)
12
13
  .action((type, name, resources, options) => {
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const clc = require("cli-color");
4
5
  const command_1 = require("../command");
5
6
  const requireConfig_1 = require("../requireConfig");
6
7
  const utils = require("../utils");
7
- exports.default = new command_1.Command("target:clear <type> <target>")
8
+ exports.command = new command_1.Command("target:clear <type> <target>")
8
9
  .description("clear all resources from a named resource target")
9
10
  .before(requireConfig_1.requireConfig)
10
11
  .action((type, name, options) => {
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const clc = require("cli-color");
4
5
  const command_1 = require("../command");
5
6
  const requireConfig_1 = require("../requireConfig");
6
7
  const utils = require("../utils");
7
- exports.default = new command_1.Command("target:remove <type> <resource>")
8
+ exports.command = new command_1.Command("target:remove <type> <resource>")
8
9
  .description("remove a resource target")
9
10
  .before(requireConfig_1.requireConfig)
10
11
  .action((type, resource, options) => {
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = void 0;
3
4
  const clc = require("cli-color");
4
5
  const command_1 = require("../command");
5
6
  const logger_1 = require("../logger");
@@ -11,7 +12,7 @@ function logTargets(type, targets) {
11
12
  logger_1.logger.info(name, "(" + (resources || []).join(",") + ")");
12
13
  }
13
14
  }
14
- exports.default = new command_1.Command("target [type]")
15
+ exports.command = new command_1.Command("target [type]")
15
16
  .description("display configured deploy targets for the current project")
16
17
  .before(requireConfig_1.requireConfig)
17
18
  .action((type, options) => {