Skip to content
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
3bcb8a6
feat(dataconnect): add confirmation for Gemini schema generation
google-labs-jules[bot] Oct 8, 2025
ca20d04
prompts
fredzqm Oct 8, 2025
65c3517
changelog
fredzqm Oct 8, 2025
8eacec9
Merge branch 'master' into feat-dataconnect-gemini-confirm
fredzqm Oct 8, 2025
917d677
m
fredzqm Oct 8, 2025
5037519
Merge remote-tracking branch 'origin/feat-dataconnect-gemini-confirm'…
fredzqm Oct 8, 2025
28066b4
feedback
fredzqm Oct 8, 2025
3b198a7
typo
fredzqm Oct 8, 2025
8f56a02
metrics
fredzqm Oct 8, 2025
c262070
Merge branch 'master' into feat-dataconnect-gemini-confirm
fredzqm Oct 9, 2025
c54d915
Update index.ts
fredzqm Oct 9, 2025
de2e555
Merge branch 'master' into feat-dataconnect-gemini-confirm
fredzqm Oct 9, 2025
0fec8de
Add more VS Code metrics
fredzqm Oct 10, 2025
13a45a4
vars edits
fredzqm Oct 10, 2025
264cca7
merge
fredzqm Oct 10, 2025
81d8321
m
fredzqm Oct 10, 2025
b737bda
revert
fredzqm Oct 10, 2025
408ba12
save
fredzqm Oct 10, 2025
b5a280d
sve
fredzqm Oct 11, 2025
3b2c322
save
fredzqm Oct 11, 2025
70f11e6
varsHint
fredzqm Oct 11, 2025
0465394
auth & message
fredzqm Oct 11, 2025
60e602c
nullptr
fredzqm Oct 11, 2025
32ac9d6
fix ui
fredzqm Oct 12, 2025
33a3e12
fix ui
fredzqm Oct 12, 2025
78c1d5c
display
fredzqm Oct 12, 2025
7704556
style
fredzqm Oct 12, 2025
19e04b2
m
fredzqm Oct 12, 2025
5fce3cb
m
fredzqm Oct 12, 2025
e7160a4
rename
fredzqm Oct 12, 2025
68a4308
update params when history entry is selected
fredzqm Oct 13, 2025
5c63261
rerun in result view
fredzqm Oct 13, 2025
47fb77e
css
fredzqm Oct 13, 2025
b17202a
css
fredzqm Oct 13, 2025
d18149f
tweaks
fredzqm Oct 13, 2025
c22811a
fix
fredzqm Oct 13, 2025
2e8baae
tweaks
fredzqm Oct 13, 2025
de80467
polish
fredzqm Oct 13, 2025
740f7b3
clean
fredzqm Oct 13, 2025
fec96f4
rename
fredzqm Oct 13, 2025
3ab012f
rename
fredzqm Oct 13, 2025
f26d990
rename
fredzqm Oct 13, 2025
b04ed2a
m
fredzqm Oct 13, 2025
af3e7e8
Merge branch 'master' into fz/vscode-edit-vars
fredzqm Oct 13, 2025
9ab24dc
Merge branch 'master' into fz/vscode-edit-vars
fredzqm Oct 13, 2025
cdca6f2
changelog
fredzqm Oct 13, 2025
baf8aa3
Update firebase-vscode/webviews/data-connect/data-connect-execution-p…
fredzqm Oct 13, 2025
f2f428d
feedbacks
fredzqm Oct 13, 2025
71b5168
nits
fredzqm Oct 13, 2025
fad60fe
m
fredzqm Oct 13, 2025
67c60a4
m
fredzqm Oct 13, 2025
ec5a264
m
fredzqm Oct 13, 2025
8ea9345
m
fredzqm Oct 13, 2025
1456d18
merge
fredzqm Oct 14, 2025
cc8021a
Merge branch 'master' into fz/vscode-edit-vars
fredzqm Oct 14, 2025
6e9b538
Merge remote-tracking branch 'origin/master' into fz/vscode-edit-vars
fredzqm Oct 14, 2025
f9a4a50
Merge remote-tracking branch 'origin/master' into fz/vscode-edit-vars
fredzqm Oct 15, 2025
2318b8f
apply previous change
fredzqm Oct 15, 2025
20b5961
m
fredzqm Oct 15, 2025
5050106
feat: Ignore test output artifacts
fredzqm Oct 15, 2025
7d3383f
m
fredzqm Oct 15, 2025
5111f04
m
fredzqm Oct 15, 2025
bbfaa74
test
fredzqm Oct 15, 2025
b152886
imports
fredzqm Oct 15, 2025
7837c69
test-fix
fredzqm Oct 15, 2025
a339a81
Merge remote-tracking branch 'origin/master' into fz/vscode-edit-vars
fredzqm Oct 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Add a confirmation in `firebase init dataconnect` before asking for app idea description. (#9282)
4 changes: 0 additions & 4 deletions firebase-vscode/src/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ export enum DATA_CONNECT_EVENT_NAME {
RUN_PROD_MUTATION_WARNING_ACKED_ALWAYS = "run_prod_mutation_warning_acked_always",
MISSING_VARIABLES = "missing_variables",
GENERATE_OPERATION = "generate_operation",
GIF_TOS_MODAL = "gif_tos_modal",
GIF_TOS_MODAL_ACKED = "gif_tos_modal_acked",
GIF_TOS_MODAL_CLICKED = "gif_tos_modal_clicked",
GIF_TOS_MODAL_REJECTED = "gif_tos_modal_rejected",
ADD_DATA = "add_data",
READ_DATA = "read_data",
MOVE_TO_CONNECTOR = "move_to_connector",
Expand Down
12 changes: 6 additions & 6 deletions firebase-vscode/src/data-connect/ad-hoc-mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,16 @@ function getDefaultScalarValueNode(type: string): ValueNode | undefined {
}
}

export function getDefaultScalarValue(type: string): string {
export function getDefaultScalarValue(type: string): any {
switch (type) {
case "Boolean":
return "false";
return false;
case "Date":
return new Date().toISOString().substring(0, 10);
case "Float":
return "0";
return 0.0;
case "Int":
return "0";
return 0;
case "Int64":
return "0";
case "String":
Expand All @@ -303,8 +303,8 @@ export function getDefaultScalarValue(type: string): string {
case "UUID":
return "11111111222233334444555555555555";
case "Vector":
return "[]";
return [1.1, 2.2, 3.3];
default:
return "";
return undefined;
}
}
53 changes: 17 additions & 36 deletions firebase-vscode/src/data-connect/execution/execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,7 @@ export function registerExecution(
"Automatically starting emulator... Please retry `Run local` execution after it's started.",
{ modal: false },
);
analyticsLogger.logger.logUsage(
DATA_CONNECT_EVENT_NAME.START_EMULATOR_FROM_EXECUTION,
);
analyticsLogger.logger.logUsage(DATA_CONNECT_EVENT_NAME.START_EMULATOR_FROM_EXECUTION);
emulatorsController.startEmulators();
return;
}
Expand All @@ -185,35 +183,25 @@ export function registerExecution(
analyticsLogger.logger.logUsage(DATA_CONNECT_EVENT_NAME.RUN_PROD_MUTATION_WARNING);
const always = "Yes (always)";
const yes = "Yes";
analyticsLogger.logger.logUsage(DATA_CONNECT_EVENT_NAME.RUN_PROD_MUTATION_WARNING);
const result = await vscode.window.showWarningMessage(
"You are about to perform a mutation in production environment. Are you sure?",
{ modal: !process.env.VSCODE_TEST_MODE },
yes,
always,
);

switch (result) {
case yes:
analyticsLogger.logger.logUsage(
DATA_CONNECT_EVENT_NAME.RUN_PROD_MUTATION_WARNING_ACKED
);
break;
case always:
// If the user selects "always", we update User settings.
configs.update(
alwaysExecuteMutationsInProduction,
true,
ConfigurationTarget.Global,
);
analyticsLogger.logger.logUsage(
DATA_CONNECT_EVENT_NAME.RUN_PROD_MUTATION_WARNING_ACKED_ALWAYS
);
break;
default:
analyticsLogger.logger.logUsage(
DATA_CONNECT_EVENT_NAME.RUN_PROD_MUTATION_WARNING_REJECTED
);
return;
if (result !== always && result !== yes) {
return;
}

// If the user selects "always", we update User settings.
if (result === always) {
configs.update(
alwaysExecuteMutationsInProduction,
true,
ConfigurationTarget.Global,
);
}
}

Expand Down Expand Up @@ -252,16 +240,12 @@ export function registerExecution(


// if execution args is empty, reset to {}
if (!executionArgsJSON.value) {
executionArgsJSON.value = "{}";
}
executionArgsJSON.value = executionArgsJSON.value || "{}";

// Check for missing arguments
const missingArgs = await verifyMissingArgs(ast, executionArgsJSON.value);

// prompt user to continue execution or modify arguments
// Open variables panel to edit missing variables.
if (missingArgs.length > 0) {
analyticsLogger.logger.logUsage(DATA_CONNECT_EVENT_NAME.MISSING_VARIABLES);
// open a modal with option to run anyway or edit args
const editArgs = { title: "Edit variables" };
const continueExecution = { title: "Continue Execution" };
Expand Down Expand Up @@ -339,7 +323,6 @@ export function registerExecution(
}

async function generateOperation(arg: GenerateOperationInput) {
analyticsLogger.logger.logUsage(DATA_CONNECT_EVENT_NAME.GENERATE_OPERATION);
if (!arg.projectId) {
vscode.window.showErrorMessage(`Connect a Firebase project to use Gemini in Firebase features.`);
return;
Expand Down Expand Up @@ -505,14 +488,12 @@ async function verifyMissingArgs(
}
return argsWithType
.filter((arg) => arg.type?.includes("!"))
.filter((arg) => !userArgs[arg.varName]);
.filter((arg) => userArgs[arg.varName] === undefined);
}

function getDefaultArgs(args: TypedInput[]) {
return args.reduce((acc: { [key: string]: any }, arg) => {
const defaultValue = getDefaultScalarValue(arg.type as string);

acc[arg.varName] = defaultValue;
acc[arg.varName] = getDefaultScalarValue((arg.type || "").replaceAll("!", ""));
return acc;
}, {});
}
27 changes: 21 additions & 6 deletions src/init/features/dataconnect/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,22 @@ export async function askQuestions(setup: Setup): Promise<void> {
"Learn more about Gemini in Firebase and how it uses your data: https://firebase.google.com/docs/gemini-in-firebase#how-gemini-in-firebase-uses-your-data",
);
}
info.appDescription = await input({
message: `Describe your app to automatically generate a schema with Gemini [Enter to use a template]:`,
const wantToGenerate = await confirm({
message: "Do you want to generate schema and queries with Gemini?",
default: false,
});
if (info.appDescription) {
if (wantToGenerate) {
configstore.set("gemini", true);
await ensureGIFApiTos(setup.projectId);
info.appDescription = await input({
message: `Describe your app idea:`,
validate: async (s: string) => {
if (s.length > 0) {
return true;
}
return "Please enter a description for your app idea.";
},
});
}
}
if (hasBilling) {
Expand Down Expand Up @@ -161,9 +171,14 @@ export async function actuate(setup: Setup, config: Config, options: any): Promi
await sdk.actuate(setup, config);
} finally {
void trackGA4("dataconnect_init", {
project_status: setup.projectId ? (setup.isBillingEnabled ? "blaze" : "spark") : "missing",
flow: info.analyticsFlow,
provision_cloud_sql: String(info.shouldProvisionCSQL),
project_status: setup.projectId
? setup.isBillingEnabled
? info.shouldProvisionCSQL
? "blaze_provisioned_csql"
: "blaze"
: "spark"
: "missing",
});
}

Expand Down Expand Up @@ -646,7 +661,7 @@ async function promptForLocation(setup: Setup, info: RequiredInfo): Promise<void
if (info.locationId === "") {
const choices = await locationChoices(setup);
info.locationId = await select<string>({
message: "What location should the new Cloud SQL instance be in?",
message: "What location would you like to use?",
choices,
default: FDC_DEFAULT_REGION,
});
Expand Down
Loading