firebase-tools 10.1.1 → 10.1.2
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.
- package/lib/accountExporter.js +9 -8
- package/lib/accountImporter.js +10 -8
- package/lib/bin/firebase.js +1 -1
- package/lib/commands/auth-export.js +26 -25
- package/lib/commands/auth-import.js +88 -78
- package/lib/commands/ext-configure.js +1 -1
- package/lib/commands/ext-dev-init.js +1 -1
- package/lib/commands/ext-dev-publish.js +1 -1
- package/lib/commands/ext-dev-register.js +1 -1
- package/lib/commands/ext-info.js +1 -1
- package/lib/commands/ext-install.js +1 -1
- package/lib/commands/ext-uninstall.js +1 -1
- package/lib/commands/ext-update.js +1 -1
- package/lib/commands/functions-config-clone.js +22 -23
- package/lib/commands/functions-config-get.js +22 -22
- package/lib/commands/functions-config-set.js +24 -22
- package/lib/commands/functions-config-unset.js +20 -22
- package/lib/commands/help.js +12 -12
- package/lib/commands/hosting-channel-create.js +1 -1
- package/lib/commands/hosting-channel-delete.js +2 -2
- package/lib/commands/hosting-channel-deploy.js +1 -1
- package/lib/commands/hosting-clone.js +1 -1
- package/lib/commands/login-ci.js +10 -10
- package/lib/commands/remoteconfig-versions-list.js +6 -1
- package/lib/commands/setup-emulators-database.js +8 -7
- package/lib/commands/setup-emulators-firestore.js +8 -7
- package/lib/commands/setup-emulators-pubsub.js +5 -4
- package/lib/commands/setup-emulators-storage.js +3 -2
- package/lib/commands/setup-emulators-ui.js +8 -7
- package/lib/commands/target-apply.js +17 -16
- package/lib/commands/target-clear.js +11 -10
- package/lib/commands/target-remove.js +10 -9
- package/lib/commands/target.js +20 -20
- package/lib/defaultCredentials.js +3 -3
- package/lib/deploy/functions/runtimes/golang/index.js +2 -1
- package/lib/emulator/downloadableEmulators.js +3 -2
- package/lib/emulator/functionsEmulator.js +6 -0
- package/lib/emulator/functionsEmulatorRuntime.js +4 -4
- package/lib/emulator/storage/rules/runtime.js +5 -4
- package/lib/extensions/askUserForConsent.js +1 -1
- package/lib/extensions/askUserForParam.js +1 -1
- package/lib/extensions/billingMigrationHelper.js +1 -1
- package/lib/extensions/changelog.js +1 -1
- package/lib/extensions/displayExtensionInfo.js +1 -1
- package/lib/extensions/extensionsApi.js +58 -112
- package/lib/extensions/extensionsHelper.js +19 -15
- package/lib/extensions/provisioningHelper.js +7 -10
- package/lib/extensions/resolveSource.js +5 -5
- package/lib/extensions/updateHelper.js +1 -1
- package/lib/extensions/warnings.js +1 -1
- package/lib/functionsConfig.js +4 -5
- package/lib/gcp/rules.js +18 -41
- package/lib/projectUtils.js +1 -1
- package/lib/remoteconfig/get.js +14 -8
- package/lib/remoteconfig/rollback.js +13 -6
- package/lib/remoteconfig/versionslist.js +13 -7
- package/npm-shrinkwrap.json +1225 -2019
- package/package.json +12 -9
- package/lib/commands/functions-config-legacy.js +0 -45
- package/lib/prepareFirebaseRules.js +0 -58
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const clc = require("cli-color");
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const logger_1 = require("../logger");
|
|
6
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
7
|
+
const projectUtils_1 = require("../projectUtils");
|
|
8
|
+
const functionsConfig = require("../functionsConfig");
|
|
9
|
+
const runtimeconfig = require("../gcp/runtimeconfig");
|
|
10
|
+
const utils = require("../utils");
|
|
11
|
+
const error_1 = require("../error");
|
|
12
|
+
exports.default = new command_1.Command("functions:config:unset [keys...]")
|
|
12
13
|
.description("unset environment config at the specified path(s)")
|
|
13
|
-
.before(requirePermissions, [
|
|
14
|
+
.before(requirePermissions_1.requirePermissions, [
|
|
14
15
|
"runtimeconfig.configs.list",
|
|
15
16
|
"runtimeconfig.configs.create",
|
|
16
17
|
"runtimeconfig.configs.get",
|
|
@@ -23,21 +24,18 @@ module.exports = new Command("functions:config:unset [keys...]")
|
|
|
23
24
|
"runtimeconfig.variables.delete",
|
|
24
25
|
])
|
|
25
26
|
.before(functionsConfig.ensureApi)
|
|
26
|
-
.action(
|
|
27
|
+
.action(async (args, options) => {
|
|
27
28
|
if (!args.length) {
|
|
28
|
-
|
|
29
|
+
throw new error_1.FirebaseError("Must supply at least one key");
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
32
|
+
const parsed = functionsConfig.parseUnsetArgs(args);
|
|
33
|
+
await Promise.all(parsed.map((item) => {
|
|
33
34
|
if (item.varId === "") {
|
|
34
35
|
return runtimeconfig.configs.delete(projectId, item.configId);
|
|
35
36
|
}
|
|
36
37
|
return runtimeconfig.variables.delete(projectId, item.configId, item.varId);
|
|
37
|
-
}))
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
clc.bold("firebase deploy --only functions") +
|
|
41
|
-
"\n");
|
|
42
|
-
});
|
|
38
|
+
}));
|
|
39
|
+
utils.logSuccess("Environment updated.");
|
|
40
|
+
logger_1.logger.info(`\nPlease deploy your functions for the change to take effect by running ${clc.bold("firebase deploy --only functions")}\n`);
|
|
43
41
|
});
|
package/lib/commands/help.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const clc = require("cli-color");
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const logger_1 = require("../logger");
|
|
6
|
+
const utils = require("../utils");
|
|
7
|
+
exports.default = new command_1.Command("help [command]")
|
|
7
8
|
.description("display help information")
|
|
8
9
|
.action(function (commandName) {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
const client = this.client;
|
|
11
|
+
const cmd = client.getCommand(commandName);
|
|
11
12
|
if (cmd) {
|
|
12
13
|
cmd.outputHelp();
|
|
13
14
|
}
|
|
14
15
|
else if (commandName) {
|
|
15
|
-
logger.warn();
|
|
16
|
+
logger_1.logger.warn();
|
|
16
17
|
utils.logWarning(clc.bold(commandName) + " is not a valid command. See below for valid commands");
|
|
17
18
|
client.cli.outputHelp();
|
|
18
19
|
}
|
|
19
20
|
else {
|
|
20
21
|
client.cli.outputHelp();
|
|
21
|
-
logger.info();
|
|
22
|
-
logger.info(" To get help with a specific command, type", clc.bold("firebase help [command_name]"));
|
|
23
|
-
logger.info();
|
|
22
|
+
logger_1.logger.info();
|
|
23
|
+
logger_1.logger.info(" To get help with a specific command, type", clc.bold("firebase help [command_name]"));
|
|
24
|
+
logger_1.logger.info();
|
|
24
25
|
}
|
|
25
|
-
return Promise.resolve();
|
|
26
26
|
});
|
|
@@ -11,7 +11,7 @@ const requirePermissions_1 = require("../requirePermissions");
|
|
|
11
11
|
const projectUtils_1 = require("../projectUtils");
|
|
12
12
|
const logger_1 = require("../logger");
|
|
13
13
|
const requireConfig = require("../requireConfig");
|
|
14
|
-
const marked = require("marked");
|
|
14
|
+
const { marked } = require("marked");
|
|
15
15
|
const requireHostingSite_1 = require("../requireHostingSite");
|
|
16
16
|
const LOG_TAG = "hosting:channel";
|
|
17
17
|
exports.default = new command_1.Command("hosting:channel:create [channelId]")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const cli_color_1 = require("cli-color");
|
|
4
|
-
const
|
|
4
|
+
const { marked } = require("marked");
|
|
5
5
|
const command_1 = require("../command");
|
|
6
6
|
const utils_1 = require("../utils");
|
|
7
7
|
const api_1 = require("../hosting/api");
|
|
@@ -38,7 +38,7 @@ exports.default = new command_1.Command("hosting:channel:delete <channelId>")
|
|
|
38
38
|
await (0, api_1.removeAuthDomain)(projectId, channel.url);
|
|
39
39
|
}
|
|
40
40
|
catch (e) {
|
|
41
|
-
(0, utils_1.logLabeledWarning)("hosting:channel", (
|
|
41
|
+
(0, utils_1.logLabeledWarning)("hosting:channel", marked(`Unable to remove channel domain from Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
|
|
42
42
|
logger_1.logger.debug("[hosting] unable to remove auth domain", e);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -12,7 +12,7 @@ const logger_1 = require("../logger");
|
|
|
12
12
|
const requireConfig = require("../requireConfig");
|
|
13
13
|
const expireUtils_1 = require("../hosting/expireUtils");
|
|
14
14
|
const utils_1 = require("../utils");
|
|
15
|
-
const marked = require("marked");
|
|
15
|
+
const { marked } = require("marked");
|
|
16
16
|
const requireHostingSite_1 = require("../requireHostingSite");
|
|
17
17
|
const LOG_TAG = "hosting:channel";
|
|
18
18
|
exports.default = new command_1.Command("hosting:channel:deploy [channelId]")
|
|
@@ -7,7 +7,7 @@ const error_1 = require("../error");
|
|
|
7
7
|
const api_1 = require("../hosting/api");
|
|
8
8
|
const utils = require("../utils");
|
|
9
9
|
const requireAuth_1 = require("../requireAuth");
|
|
10
|
-
const marked = require("marked");
|
|
10
|
+
const { marked } = require("marked");
|
|
11
11
|
const logger_1 = require("../logger");
|
|
12
12
|
exports.default = new command_1.Command("hosting:clone <source> <targetChannel>")
|
|
13
13
|
.description("clone a version from one site to another")
|
package/lib/commands/login-ci.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const clc = require("cli-color");
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const error_1 = require("../error");
|
|
6
|
+
const logger_1 = require("../logger");
|
|
7
|
+
const auth = require("../auth");
|
|
8
|
+
const utils = require("../utils");
|
|
9
|
+
exports.default = new command_1.Command("login:ci")
|
|
8
10
|
.description("generate an access token for use in non-interactive environments")
|
|
9
11
|
.option("--no-localhost", "copy and paste a code instead of starting a local server for authentication")
|
|
10
12
|
.action(async (options) => {
|
|
11
13
|
if (options.nonInteractive) {
|
|
12
|
-
|
|
13
|
-
exit: 1,
|
|
14
|
-
});
|
|
14
|
+
throw new error_1.FirebaseError("Cannot run login:ci in non-interactive mode.");
|
|
15
15
|
}
|
|
16
16
|
const userCredentials = await auth.loginGoogle(options.localhost);
|
|
17
|
-
logger.info();
|
|
17
|
+
logger_1.logger.info();
|
|
18
18
|
utils.logSuccess("Success! Use this token to login on a CI server:\n\n" +
|
|
19
19
|
clc.bold(userCredentials.tokens.refresh_token) +
|
|
20
20
|
'\n\nExample: firebase deploy --token "$FIREBASE_TOKEN"\n');
|
|
@@ -6,11 +6,16 @@ const command_1 = require("../command");
|
|
|
6
6
|
const projectUtils_1 = require("../projectUtils");
|
|
7
7
|
const requireAuth_1 = require("../requireAuth");
|
|
8
8
|
const requirePermissions_1 = require("../requirePermissions");
|
|
9
|
+
const utils_1 = require("../utils");
|
|
9
10
|
const Table = require("cli-table");
|
|
10
11
|
const tableHead = ["Update User", "Version Number", "Update Time"];
|
|
11
12
|
function pushTableContents(table, version) {
|
|
12
13
|
var _a;
|
|
13
|
-
return table.push([
|
|
14
|
+
return table.push([
|
|
15
|
+
(_a = version.updateUser) === null || _a === void 0 ? void 0 : _a.email,
|
|
16
|
+
version.versionNumber,
|
|
17
|
+
version.updateTime ? (0, utils_1.datetimeString)(new Date(version.updateTime)) : "",
|
|
18
|
+
]);
|
|
14
19
|
}
|
|
15
20
|
module.exports = new command_1.Command("remoteconfig:versions:list")
|
|
16
21
|
.description("get a list of Remote Config template versions that have been published for a Firebase project")
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const command_1 = require("../command");
|
|
4
|
+
const download_1 = require("../emulator/download");
|
|
5
|
+
const types_1 = require("../emulator/types");
|
|
6
|
+
const NAME = types_1.Emulators.DATABASE;
|
|
7
|
+
exports.default = new command_1.Command(`setup:emulators:${NAME}`)
|
|
7
8
|
.description(`downloads the ${NAME} emulator`)
|
|
8
|
-
.action((
|
|
9
|
-
return downloadEmulator(NAME);
|
|
9
|
+
.action(() => {
|
|
10
|
+
return (0, download_1.downloadEmulator)(NAME);
|
|
10
11
|
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const command_1 = require("../command");
|
|
4
|
+
const download_1 = require("../emulator/download");
|
|
5
|
+
const types_1 = require("../emulator/types");
|
|
6
|
+
const NAME = types_1.Emulators.FIRESTORE;
|
|
7
|
+
exports.default = new command_1.Command(`setup:emulators:${NAME}`)
|
|
7
8
|
.description(`downloads the ${NAME} emulator`)
|
|
8
|
-
.action((
|
|
9
|
-
return downloadEmulator(NAME);
|
|
9
|
+
.action(() => {
|
|
10
|
+
return (0, download_1.downloadEmulator)(NAME);
|
|
10
11
|
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const command_1 = require("../command");
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
4
|
+
const download_1 = require("../emulator/download");
|
|
5
|
+
const types_1 = require("../emulator/types");
|
|
6
|
+
const EMULATOR_NAME = types_1.Emulators.PUBSUB;
|
|
7
|
+
exports.default = new command_1.Command(`setup:emulators:${EMULATOR_NAME}`)
|
|
7
8
|
.description(`downloads the ${EMULATOR_NAME} emulator`)
|
|
8
9
|
.action(() => {
|
|
9
|
-
return downloadEmulator(EMULATOR_NAME);
|
|
10
|
+
return (0, download_1.downloadEmulator)(EMULATOR_NAME);
|
|
10
11
|
});
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const command_1 = require("../command");
|
|
4
4
|
const download_1 = require("../emulator/download");
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const types_1 = require("../emulator/types");
|
|
6
|
+
const EMULATOR_NAME = types_1.Emulators.STORAGE;
|
|
7
|
+
exports.default = new command_1.Command(`setup:emulators:${EMULATOR_NAME}`)
|
|
7
8
|
.description(`downloads the ${EMULATOR_NAME} emulator`)
|
|
8
9
|
.action(() => {
|
|
9
10
|
return (0, download_1.downloadEmulator)(EMULATOR_NAME);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const command_1 = require("../command");
|
|
4
|
+
const download_1 = require("../emulator/download");
|
|
5
|
+
const types_1 = require("../emulator/types");
|
|
6
|
+
const NAME = types_1.Emulators.UI;
|
|
7
|
+
exports.default = new command_1.Command(`setup:emulators:${NAME}`)
|
|
7
8
|
.description(`downloads the ${NAME} emulator`)
|
|
8
|
-
.action((
|
|
9
|
-
return downloadEmulator(NAME);
|
|
9
|
+
.action(() => {
|
|
10
|
+
return (0, download_1.downloadEmulator)(NAME);
|
|
10
11
|
});
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const clc = require("cli-color");
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const logger_1 = require("../logger");
|
|
6
|
+
const requireConfig = require("../requireConfig");
|
|
7
|
+
const utils = require("../utils");
|
|
8
|
+
const error_1 = require("../error");
|
|
9
|
+
exports.default = new command_1.Command("target:apply <type> <name> <resources...>")
|
|
9
10
|
.description("apply a deploy target to a resource")
|
|
10
11
|
.before(requireConfig)
|
|
11
|
-
.action(
|
|
12
|
+
.action((type, name, resources, options) => {
|
|
12
13
|
if (!options.project) {
|
|
13
|
-
|
|
14
|
+
throw new error_1.FirebaseError(`Must have an active project to set deploy targets. Try ${clc.bold("firebase use --add")}`);
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
-
utils.logSuccess(
|
|
17
|
-
|
|
18
|
-
utils.logWarning(
|
|
19
|
-
}
|
|
20
|
-
logger.info();
|
|
21
|
-
logger.info(
|
|
16
|
+
const changes = options.rc.applyTarget(options.project, type, name, resources);
|
|
17
|
+
utils.logSuccess(`Applied ${type} target ${clc.bold(name)} to ${clc.bold(resources.join(", "))}`);
|
|
18
|
+
for (const change of changes) {
|
|
19
|
+
utils.logWarning(`Previous target ${clc.bold(change.target)} removed from ${clc.bold(change.resource)}`);
|
|
20
|
+
}
|
|
21
|
+
logger_1.logger.info();
|
|
22
|
+
logger_1.logger.info(`Updated: ${name} (${options.rc.target(options.project, type, name).join(",")})`);
|
|
22
23
|
});
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const clc = require("cli-color");
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const requireConfig = require("../requireConfig");
|
|
6
|
+
const utils = require("../utils");
|
|
7
|
+
exports.default = new command_1.Command("target:clear <type> <target>")
|
|
7
8
|
.description("clear all resources from a named resource target")
|
|
8
9
|
.before(requireConfig)
|
|
9
|
-
.action(
|
|
10
|
-
|
|
10
|
+
.action((type, name, options) => {
|
|
11
|
+
const existed = options.rc.clearTarget(options.project, type, name);
|
|
11
12
|
if (existed) {
|
|
12
|
-
utils.logSuccess(
|
|
13
|
+
utils.logSuccess(`Cleared ${type} target ${clc.bold(name)}`);
|
|
13
14
|
}
|
|
14
15
|
else {
|
|
15
|
-
utils.logWarning(
|
|
16
|
+
utils.logWarning(`No action taken. No ${type} target found named ${clc.bold(name)}`);
|
|
16
17
|
}
|
|
17
|
-
return
|
|
18
|
+
return existed;
|
|
18
19
|
});
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const clc = require("cli-color");
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const requireConfig = require("../requireConfig");
|
|
6
|
+
const utils = require("../utils");
|
|
7
|
+
exports.default = new command_1.Command("target:remove <type> <resource>")
|
|
7
8
|
.description("remove a resource target")
|
|
8
9
|
.before(requireConfig)
|
|
9
|
-
.action(
|
|
10
|
-
|
|
10
|
+
.action((type, resource, options) => {
|
|
11
|
+
const name = options.rc.removeTarget(options.project, type, resource);
|
|
11
12
|
if (name) {
|
|
12
|
-
utils.logSuccess(
|
|
13
|
+
utils.logSuccess(`Removed ${type} target ${clc.bold(name)} from ${clc.bold(resource)}`);
|
|
13
14
|
}
|
|
14
15
|
else {
|
|
15
|
-
utils.logWarning(
|
|
16
|
+
utils.logWarning(`No action taken. No target found for ${type} resource ${clc.bold(resource)}`);
|
|
16
17
|
}
|
|
17
18
|
return Promise.resolve(name);
|
|
18
19
|
});
|
package/lib/commands/target.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
logger.info(clc.cyan("[ " + type + " ]"));
|
|
10
|
-
|
|
11
|
-
logger.info(name, "(" + (resources || []).join(",") + ")");
|
|
12
|
-
}
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const clc = require("cli-color");
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const logger_1 = require("../logger");
|
|
6
|
+
const requireConfig = require("../requireConfig");
|
|
7
|
+
const utils = require("../utils");
|
|
8
|
+
function logTargets(type, targets) {
|
|
9
|
+
logger_1.logger.info(clc.cyan("[ " + type + " ]"));
|
|
10
|
+
for (const [name, resources] of Object.entries(targets)) {
|
|
11
|
+
logger_1.logger.info(name, "(" + (resources || []).join(",") + ")");
|
|
12
|
+
}
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
exports.default = new command_1.Command("target [type]")
|
|
15
15
|
.description("display configured deploy targets for the current project")
|
|
16
16
|
.before(requireConfig)
|
|
17
|
-
.action(
|
|
17
|
+
.action((type, options) => {
|
|
18
18
|
if (!options.project) {
|
|
19
19
|
return utils.reject("No active project, cannot list deploy targets.");
|
|
20
20
|
}
|
|
21
|
-
logger.info("Resource targets for", clc.bold(options.project) + ":");
|
|
22
|
-
logger.info();
|
|
21
|
+
logger_1.logger.info("Resource targets for", clc.bold(options.project) + ":");
|
|
22
|
+
logger_1.logger.info();
|
|
23
23
|
if (type) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return
|
|
24
|
+
const targets = options.rc.targets(options.project, type);
|
|
25
|
+
logTargets(type, targets);
|
|
26
|
+
return targets;
|
|
27
27
|
}
|
|
28
28
|
const allTargets = options.rc.allTargets(options.project);
|
|
29
29
|
for (const [targetType, targetName] of Object.entries(allTargets)) {
|
|
30
|
-
|
|
30
|
+
logTargets(targetType, targetName);
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return allTargets;
|
|
33
33
|
});
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.clearCredentials = exports.getCredentialPathAsync = void 0;
|
|
4
4
|
const fs = require("fs");
|
|
5
5
|
const path = require("path");
|
|
6
|
-
const
|
|
6
|
+
const api_1 = require("./api");
|
|
7
7
|
const logger_1 = require("./logger");
|
|
8
8
|
async function getCredentialPathAsync(account) {
|
|
9
9
|
const filePath = credFilePath(account.user);
|
|
@@ -43,8 +43,8 @@ exports.clearCredentials = clearCredentials;
|
|
|
43
43
|
function getCredential(tokens) {
|
|
44
44
|
if (tokens.refresh_token) {
|
|
45
45
|
return {
|
|
46
|
-
client_id:
|
|
47
|
-
client_secret:
|
|
46
|
+
client_id: api_1.clientId,
|
|
47
|
+
client_secret: api_1.clientSecret,
|
|
48
48
|
refresh_token: tokens.refresh_token,
|
|
49
49
|
type: "authorized_user",
|
|
50
50
|
};
|
|
@@ -82,12 +82,13 @@ class Delegate {
|
|
|
82
82
|
return Promise.resolve(() => Promise.resolve());
|
|
83
83
|
}
|
|
84
84
|
serve(port, adminPort, envs) {
|
|
85
|
+
var _a;
|
|
85
86
|
const childProcess = spawn("go", ["run", "./autogen"], {
|
|
86
87
|
env: Object.assign(Object.assign({}, envs), { PORT: port.toString(), ADMIN_PORT: adminPort.toString(), HOME: process.env.HOME, PATH: process.env.PATH, GOPATH: process.env.GOPATH }),
|
|
87
88
|
cwd: this.sourceDir,
|
|
88
89
|
stdio: ["ignore", "pipe", "inherit"],
|
|
89
90
|
});
|
|
90
|
-
childProcess.stdout.on("data", (chunk) => {
|
|
91
|
+
(_a = childProcess.stdout) === null || _a === void 0 ? void 0 : _a.on("data", (chunk) => {
|
|
91
92
|
logger_1.logger.debug(chunk.toString());
|
|
92
93
|
});
|
|
93
94
|
return Promise.resolve(async () => {
|
|
@@ -221,6 +221,7 @@ async function handleEmulatorProcessError(emulator, err) {
|
|
|
221
221
|
exports.handleEmulatorProcessError = handleEmulatorProcessError;
|
|
222
222
|
async function _runBinary(emulator, command, extraEnv) {
|
|
223
223
|
return new Promise((resolve) => {
|
|
224
|
+
var _a, _b;
|
|
224
225
|
const logger = emulatorLogger_1.EmulatorLogger.forEmulator(emulator.name);
|
|
225
226
|
emulator.stdout = fs.createWriteStream(getLogFileName(emulator.name));
|
|
226
227
|
try {
|
|
@@ -242,11 +243,11 @@ async function _runBinary(emulator, command, extraEnv) {
|
|
|
242
243
|
return;
|
|
243
244
|
}
|
|
244
245
|
logger.logLabeled("BULLET", emulator.name, `${description} logging to ${clc.bold(getLogFileName(emulator.name))}`);
|
|
245
|
-
emulator.instance.stdout.on("data", (data) => {
|
|
246
|
+
(_a = emulator.instance.stdout) === null || _a === void 0 ? void 0 : _a.on("data", (data) => {
|
|
246
247
|
logger.log("DEBUG", data.toString());
|
|
247
248
|
emulator.stdout.write(data);
|
|
248
249
|
});
|
|
249
|
-
emulator.instance.stderr.on("data", (data) => {
|
|
250
|
+
(_b = emulator.instance.stderr) === null || _b === void 0 ? void 0 : _b.on("data", (data) => {
|
|
250
251
|
logger.log("DEBUG", data.toString());
|
|
251
252
|
emulator.stdout.write(data);
|
|
252
253
|
if (data.toString().includes("java.lang.UnsupportedClassVersionError")) {
|
|
@@ -638,6 +638,12 @@ class FunctionsEmulator {
|
|
|
638
638
|
cwd: frb.cwd,
|
|
639
639
|
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
640
640
|
});
|
|
641
|
+
if (!childProcess.stderr) {
|
|
642
|
+
throw new error_1.FirebaseError(`childProcess.stderr is undefined.`);
|
|
643
|
+
}
|
|
644
|
+
if (!childProcess.stdout) {
|
|
645
|
+
throw new error_1.FirebaseError(`childProcess.stdout is undefined.`);
|
|
646
|
+
}
|
|
641
647
|
const buffers = {
|
|
642
648
|
stderr: { pipe: childProcess.stderr, value: "" },
|
|
643
649
|
stdout: { pipe: childProcess.stdout, value: "" },
|
|
@@ -389,10 +389,10 @@ async function initializeFirebaseAdminStubs(frb) {
|
|
|
389
389
|
return Proxied.getOriginal(target, "auth");
|
|
390
390
|
})
|
|
391
391
|
.finalize();
|
|
392
|
-
require.cache[adminResolution.resolution] = {
|
|
392
|
+
require.cache[adminResolution.resolution] = Object.assign(require.cache[adminResolution.resolution], {
|
|
393
393
|
exports: proxiedAdminModule,
|
|
394
394
|
path: path.dirname(adminResolution.resolution),
|
|
395
|
-
};
|
|
395
|
+
});
|
|
396
396
|
logDebug("firebase-admin has been stubbed.", {
|
|
397
397
|
adminResolution,
|
|
398
398
|
});
|
|
@@ -456,10 +456,10 @@ async function initializeFunctionsConfigHelper(frb) {
|
|
|
456
456
|
return proxiedConfig;
|
|
457
457
|
})
|
|
458
458
|
.finalize();
|
|
459
|
-
require.cache[functionsResolution.resolution] = {
|
|
459
|
+
require.cache[functionsResolution.resolution] = Object.assign(require.cache[functionsResolution.resolution], {
|
|
460
460
|
exports: proxiedFunctionsModule,
|
|
461
461
|
path: path.dirname(functionsResolution.resolution),
|
|
462
|
-
};
|
|
462
|
+
});
|
|
463
463
|
logDebug("firebase-functions has been stubbed.", {
|
|
464
464
|
functionsResolution,
|
|
465
465
|
});
|
|
@@ -62,6 +62,7 @@ class StorageRulesRuntime {
|
|
|
62
62
|
return this._alive;
|
|
63
63
|
}
|
|
64
64
|
async start(auto_download = true) {
|
|
65
|
+
var _a, _b;
|
|
65
66
|
const downloadDetails = downloadableEmulators_1.DownloadDetails[types_2.Emulators.STORAGE];
|
|
66
67
|
const hasEmulator = fs.existsSync(downloadDetails.downloadPath);
|
|
67
68
|
if (!hasEmulator) {
|
|
@@ -99,7 +100,7 @@ class StorageRulesRuntime {
|
|
|
99
100
|
this._childprocess.on("error", (err) => {
|
|
100
101
|
(0, downloadableEmulators_1.handleEmulatorProcessError)(types_2.Emulators.STORAGE, err);
|
|
101
102
|
});
|
|
102
|
-
this._childprocess.stderr.on("data", (buf) => {
|
|
103
|
+
(_a = this._childprocess.stderr) === null || _a === void 0 ? void 0 : _a.on("data", (buf) => {
|
|
103
104
|
const error = buf.toString();
|
|
104
105
|
if (error.includes("jarfile")) {
|
|
105
106
|
throw new error_1.FirebaseError("There was an issue starting the rules emulator, please run 'firebase setup:emulators:storage` again");
|
|
@@ -108,7 +109,7 @@ class StorageRulesRuntime {
|
|
|
108
109
|
emulatorLogger_1.EmulatorLogger.forEmulator(types_2.Emulators.STORAGE).log("WARN", `Unexpected rules runtime error: ${buf.toString()}`);
|
|
109
110
|
}
|
|
110
111
|
});
|
|
111
|
-
this._childprocess.stdout.on("data", (buf) => {
|
|
112
|
+
(_b = this._childprocess.stdout) === null || _b === void 0 ? void 0 : _b.on("data", (buf) => {
|
|
112
113
|
const serializedRuntimeActionResponse = buf.toString("UTF8").trim();
|
|
113
114
|
if (serializedRuntimeActionResponse != "") {
|
|
114
115
|
let rap;
|
|
@@ -148,13 +149,13 @@ class StorageRulesRuntime {
|
|
|
148
149
|
throw new error_1.FirebaseError("Attempted to send Cloud Storage rules request with stale id");
|
|
149
150
|
}
|
|
150
151
|
return new Promise((resolve) => {
|
|
151
|
-
var _a;
|
|
152
|
+
var _a, _b;
|
|
152
153
|
this._requests[runtimeActionRequest.id] = {
|
|
153
154
|
request: runtimeActionRequest,
|
|
154
155
|
handler: resolve,
|
|
155
156
|
};
|
|
156
157
|
const serializedRequest = JSON.stringify(runtimeActionRequest);
|
|
157
|
-
(_a = this._childprocess) === null || _a === void 0 ? void 0 : _a.stdin.write(serializedRequest + "\n");
|
|
158
|
+
(_b = (_a = this._childprocess) === null || _a === void 0 ? void 0 : _a.stdin) === null || _b === void 0 ? void 0 : _b.write(serializedRequest + "\n");
|
|
158
159
|
});
|
|
159
160
|
}
|
|
160
161
|
async loadRuleset(source) {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.promptForPublisherTOS = exports.displayApis = exports.displayRoles = exports.retrieveRoleInfo = exports.formatDescription = void 0;
|
|
4
4
|
const _ = require("lodash");
|
|
5
5
|
const clc = require("cli-color");
|
|
6
|
-
const marked = require("marked");
|
|
6
|
+
const { marked } = require("marked");
|
|
7
7
|
const TerminalRenderer = require("marked-terminal");
|
|
8
8
|
const error_1 = require("../error");
|
|
9
9
|
const extensionsHelper_1 = require("../extensions/extensionsHelper");
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ask = exports.getInquirerDefault = exports.promptCreateSecret = exports.askForParam = exports.checkResponse = void 0;
|
|
4
4
|
const _ = require("lodash");
|
|
5
5
|
const clc = require("cli-color");
|
|
6
|
-
const marked = require("marked");
|
|
6
|
+
const { marked } = require("marked");
|
|
7
7
|
const extensionsApi_1 = require("./extensionsApi");
|
|
8
8
|
const secretManagerApi = require("../gcp/secretManager");
|
|
9
9
|
const secretsUtils = require("./secretsUtils");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.displayNode10CreateBillingNotice = exports.displayNode10UpdateBillingNotice = void 0;
|
|
4
|
-
const marked = require("marked");
|
|
4
|
+
const { marked } = require("marked");
|
|
5
5
|
const TerminalRenderer = require("marked-terminal");
|
|
6
6
|
const error_1 = require("../error");
|
|
7
7
|
const extensionsHelper_1 = require("./extensionsHelper");
|