firebase-tools 14.5.0 → 14.5.1
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/commands/login.js
CHANGED
|
@@ -27,11 +27,16 @@ exports.command = new command_1.Command("login")
|
|
|
27
27
|
return user;
|
|
28
28
|
}
|
|
29
29
|
if (!options.reauth) {
|
|
30
|
-
utils.logBullet("Firebase
|
|
30
|
+
utils.logBullet("Firebase CLI integrates with Gemini in Firebase API to provide assistant features. Learn more about using Gemini in Firebase and how we train our models: https://firebase.google.com/docs/gemini-in-firebase/set-up-gemini#required-permissions");
|
|
31
|
+
const geminiUsage = await (0, prompt_1.confirm)("Enable Gemini in Firebase features?");
|
|
32
|
+
configstore_1.configstore.set("gemini", geminiUsage);
|
|
33
|
+
logger_1.logger.info();
|
|
34
|
+
utils.logBullet("Firebase optionally collects CLI and Emulator Suite usage and error reporting information to help improve our products. Data is collected in accordance with Google's privacy policy (https://policies.google.com/privacy) and is not used to identify you.");
|
|
31
35
|
const collectUsage = await (0, prompt_1.confirm)("Allow Firebase to collect CLI and Emulator Suite usage and error reporting information?");
|
|
32
36
|
configstore_1.configstore.set("usage", collectUsage);
|
|
33
|
-
if (collectUsage) {
|
|
34
|
-
|
|
37
|
+
if (geminiUsage || collectUsage) {
|
|
38
|
+
logger_1.logger.info();
|
|
39
|
+
utils.logBullet("To change your the preference at any time, run `firebase logout` and `firebase login` again.");
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
const useLocalhost = (0, utils_1.isCloudEnvironment)() ? false : options.localhost;
|
|
@@ -16,8 +16,11 @@ async function createDatabase(context, options) {
|
|
|
16
16
|
if (!options.projectId) {
|
|
17
17
|
throw new error_1.FirebaseError("Project ID is required to create a Firestore database.");
|
|
18
18
|
}
|
|
19
|
-
if (!firestoreCfg
|
|
20
|
-
throw new error_1.FirebaseError("Firestore database configuration
|
|
19
|
+
if (!firestoreCfg) {
|
|
20
|
+
throw new error_1.FirebaseError("Firestore database configuration not found in firebase.json.");
|
|
21
|
+
}
|
|
22
|
+
if (!firestoreCfg.database) {
|
|
23
|
+
firestoreCfg.database = "(default)";
|
|
21
24
|
}
|
|
22
25
|
const api = new api_1.FirestoreApi();
|
|
23
26
|
try {
|
|
@@ -23,7 +23,6 @@ const CONNECTOR_YAML_TEMPLATE = (0, templates_1.readTemplateSync)("init/dataconn
|
|
|
23
23
|
const SCHEMA_TEMPLATE = (0, templates_1.readTemplateSync)("init/dataconnect/schema.gql");
|
|
24
24
|
const QUERIES_TEMPLATE = (0, templates_1.readTemplateSync)("init/dataconnect/queries.gql");
|
|
25
25
|
const MUTATIONS_TEMPLATE = (0, templates_1.readTemplateSync)("init/dataconnect/mutations.gql");
|
|
26
|
-
const serviceEnvVar = () => (0, utils_1.envOverride)("FDC_CONNECTOR", "") || (0, utils_1.envOverride)("FDC_SERVICE", "");
|
|
27
26
|
const emptyConnector = {
|
|
28
27
|
id: "default",
|
|
29
28
|
path: "./connector",
|
|
@@ -227,15 +226,19 @@ async function promptForExistingServices(setup, info) {
|
|
|
227
226
|
return info;
|
|
228
227
|
}
|
|
229
228
|
async function chooseExistingService(existing) {
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
serviceName
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
229
|
+
const serviceEnvVar = (0, utils_1.envOverride)("FDC_CONNECTOR", "") || (0, utils_1.envOverride)("FDC_SERVICE", "");
|
|
230
|
+
if (serviceEnvVar) {
|
|
231
|
+
const [serviceLocationFromEnvVar, serviceIdFromEnvVar] = serviceEnvVar.split("/");
|
|
232
|
+
const serviceFromEnvVar = existing.find((s) => {
|
|
233
|
+
const serviceName = (0, names_1.parseServiceName)(s.service.name);
|
|
234
|
+
return (serviceName.serviceId === serviceIdFromEnvVar &&
|
|
235
|
+
serviceName.location === serviceLocationFromEnvVar);
|
|
236
|
+
});
|
|
237
|
+
if (serviceFromEnvVar) {
|
|
238
|
+
(0, utils_1.logBullet)(`Picking up the existing service ${clc.bold(serviceLocationFromEnvVar + "/" + serviceIdFromEnvVar)}.`);
|
|
239
|
+
return serviceFromEnvVar;
|
|
240
|
+
}
|
|
241
|
+
(0, utils_1.logWarning)(`Unable to pick up an existing service based on FDC_SERVICE=${serviceEnvVar}.`);
|
|
239
242
|
}
|
|
240
243
|
const choices = existing.map((s) => {
|
|
241
244
|
const serviceName = (0, names_1.parseServiceName)(s.service.name);
|
|
@@ -14,7 +14,6 @@ const error_1 = require("../../../error");
|
|
|
14
14
|
const lodash_1 = require("lodash");
|
|
15
15
|
const utils_1 = require("../../../utils");
|
|
16
16
|
const auth_1 = require("../../../auth");
|
|
17
|
-
const connectorEnvVar = () => (0, utils_1.envOverride)("FDC_CONNECTOR", "");
|
|
18
17
|
exports.FDC_APP_FOLDER = "_FDC_APP_FOLDER";
|
|
19
18
|
async function doSetup(setup, config) {
|
|
20
19
|
const sdkInfo = await askQuestions(setup, config);
|
|
@@ -100,11 +99,14 @@ async function chooseExistingConnector(choices) {
|
|
|
100
99
|
if (choices.length === 1) {
|
|
101
100
|
return choices[0].value;
|
|
102
101
|
}
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
(
|
|
107
|
-
|
|
102
|
+
const connectorEnvVar = (0, utils_1.envOverride)("FDC_CONNECTOR", "");
|
|
103
|
+
if (connectorEnvVar) {
|
|
104
|
+
const existingConnector = choices.find((c) => c.name === connectorEnvVar);
|
|
105
|
+
if (existingConnector) {
|
|
106
|
+
(0, utils_1.logBullet)(`Picking up the existing connector ${clc.bold(connectorEnvVar)}.`);
|
|
107
|
+
return existingConnector.value;
|
|
108
|
+
}
|
|
109
|
+
(0, utils_1.logWarning)(`Unable to pick up an existing connector based on FDC_CONNECTOR=${connectorEnvVar}.`);
|
|
108
110
|
}
|
|
109
111
|
return await (0, prompt_1.select)({
|
|
110
112
|
message: "Which connector do you want set up a generated SDK for?",
|