Skip to content

Commit 8dc5984

Browse files
authored
Merge branch 'master' into json-secrets-support
2 parents d01fb2f + 611930a commit 8dc5984

File tree

106 files changed

+2169
-1162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+2169
-1162
lines changed

firebase-vscode/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ resources/dist
66
.wdio-vscode-service
77
logs
88
!*.tgz
9-
prebuilt-extensions
9+
prebuilt-extensions
10+
data-connect-test-*/

firebase-vscode/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
## NEXT
22

3+
- [Fixed] Populate correct default values of missing required variables.
4+
- [Added] Display the execution variables and auth params used.
5+
- [Added] Allow rerun any executions in the history.
6+
7+
## 1.9.0
8+
39
- [Added] Refine / Generate Operation Code Lens.
410
- [Added] Support run "firebase init" without login and project.
11+
- Update internal `firebase-tools` dependency to 14.19.1
512

613
## 1.8.0
714

firebase-vscode/common/messaging/protocol.ts

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,21 @@ import { EmulatorsStatus, RunningEmulatorInfo } from "./types";
1111
import { ExecutionResult } from "graphql";
1212
import { SerializedError } from "../error";
1313

14-
export enum UserMockKind {
14+
export enum AuthParamsKind {
1515
ADMIN = "admin",
1616
UNAUTHENTICATED = "unauthenticated",
1717
AUTHENTICATED = "authenticated",
1818
}
19-
export type UserMock =
20-
| { kind: UserMockKind.ADMIN | UserMockKind.UNAUTHENTICATED }
19+
20+
export const EXAMPLE_CLAIMS = `{
21+
"email_verified": true,
22+
"sub": "exampleUserId"
23+
}`;
24+
25+
export type AuthParams =
26+
| { kind: AuthParamsKind.ADMIN | AuthParamsKind.UNAUTHENTICATED }
2127
| {
22-
kind: UserMockKind.AUTHENTICATED;
28+
kind: AuthParamsKind.AUTHENTICATED;
2329
claims: string;
2430
};
2531

@@ -84,13 +90,13 @@ export interface WebviewToExtensionParamsMap {
8490

8591
selectEmulatorImportFolder: {};
8692

87-
definedDataConnectArgs: string;
93+
/** Execution parameters */
94+
defineVariables: string;
95+
defineAuthParams: AuthParams;
8896

8997
/** Prompts the user to select a directory in which to place the quickstart */
9098
chooseQuickstartDir: {};
9199

92-
notifyAuthUserMockChange: UserMock;
93-
94100
/** Deploy connectors/services to production */
95101
"fdc.deploy": void;
96102

@@ -130,10 +136,11 @@ export interface WebviewToExtensionParamsMap {
130136
}
131137

132138
export interface DataConnectResults {
133-
query: string;
134139
displayName: string;
135-
results?: ExecutionResult | SerializedError;
136-
args?: string;
140+
query: string;
141+
results: ExecutionResult | SerializedError;
142+
variables: string;
143+
auth: AuthParams;
137144
}
138145

139146
export type ValueOrError<T> =
@@ -185,13 +192,11 @@ export interface ExtensionToWebviewParamsMap {
185192
*/
186193
notifyPreviewChannelResponse: { id: string };
187194

188-
// data connect specific
189-
notifyDataConnectArgs: string;
190-
195+
/** Update execution parameters and results panels */
196+
notifyVariables: { variables: string, fixes: string[] };
197+
notifyAuthParams: AuthParams;
191198
notifyDataConnectResults: DataConnectResults;
192199

193-
notifyLastOperation: string;
194-
195200
notifyIsLoadingUser: boolean;
196201

197202
notifyDocksLink: string;

firebase-vscode/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

firebase-vscode/package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"publisher": "GoogleCloudTools",
55
"icon": "./resources/firebase_dataconnect_logo.png",
66
"description": "Firebase Data Connect for VSCode",
7-
"version": "1.8.0",
7+
"version": "1.9.0",
88
"engines": {
99
"vscode": "^1.69.0"
1010
},
@@ -158,20 +158,21 @@
158158
"firebase-data-connect-execution-view": [
159159
{
160160
"type": "webview",
161-
"id": "data-connect-execution-configuration",
162-
"name": "Configuration",
163-
"when": "firebase-vscode.fdc.enabled"
164-
},
165-
{
166-
"id": "data-connect-execution-history",
167-
"name": "History",
161+
"id": "data-connect-execution-parameters",
162+
"name": "Parameters",
168163
"when": "firebase-vscode.fdc.enabled"
169164
},
170165
{
171166
"type": "webview",
172167
"id": "data-connect-execution-results",
173168
"name": "Results",
174169
"when": "firebase-vscode.fdc.enabled"
170+
},
171+
{
172+
"id": "data-connect-execution-history",
173+
"name": "History",
174+
"when": "firebase-vscode.fdc.enabled",
175+
"visibility": "collapsed"
175176
}
176177
]
177178
},

firebase-vscode/src/analytics.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,24 @@ export enum DATA_CONNECT_EVENT_NAME {
2121
PROJECT_SELECTED = "project_selected",
2222
RUN_LOCAL = "run_local",
2323
RUN_PROD = "run_prod",
24+
RUN_PROD_MUTATION_WARNING = "run_prod_mutation_warning",
25+
RUN_PROD_MUTATION_WARNING_REJECTED = "run_prod_mutation_warning_rejected",
26+
RUN_PROD_MUTATION_WARNING_ACKED = "run_prod_mutation_warning_acked",
27+
RUN_PROD_MUTATION_WARNING_ACKED_ALWAYS = "run_prod_mutation_warning_acked_always",
28+
RUN_AUTH_ADMIN = "run_auth_admin",
29+
RUN_AUTH_UNAUTHENTICATED = "run_auth_unauthenticated",
30+
RUN_AUTH_AUTHENTICATED = "run_auth_authenticated",
31+
RUN_UNDEFINED_VARIABLES = "run_undefined_variables",
32+
RUN_MISSING_VARIABLES = "run_missing_variables",
2433
GENERATE_OPERATION = "generate_operation",
34+
GIF_TOS_MODAL = "gif_tos_modal",
35+
GIF_TOS_MODAL_ACKED = "gif_tos_modal_acked",
36+
GIF_TOS_MODAL_CLICKED = "gif_tos_modal_clicked",
37+
GIF_TOS_MODAL_REJECTED = "gif_tos_modal_rejected",
2538
ADD_DATA = "add_data",
2639
READ_DATA = "read_data",
2740
MOVE_TO_CONNECTOR = "move_to_connector",
2841
START_EMULATOR_FROM_EXECUTION = "start_emulator_from_execution",
29-
REFUSE_START_EMULATOR_FROM_EXECUTION = "refuse_start_emulator_from_execution",
3042
INIT = "init",
3143
INIT_SDK = "init_sdk",
3244
INIT_SDK_CLI = "init_sdk_cli",
@@ -36,11 +48,6 @@ export enum DATA_CONNECT_EVENT_NAME {
3648
SESSION_CHAR_COUNT = "session_char_count",
3749
EMULATOR_EXPORT = "emulator_export",
3850
SETUP_FIREBASE_BINARY = "setup_firebase_binary",
39-
GEMINI_ERROR = "gemini_error",
40-
GEMINI_OPERATION_CALL = "gemini_operation_call",
41-
GEMINI_SCHEMA_CALL = "gemini_schema_call",
42-
GEMINI_SUCCESS = "gemini_success",
43-
TRY_GEMINI_CLICKED = "try_gemini_clicked",
4451
TRY_FIREBASE_AGENT_CLICKED = "try_firebase_agent_in_gemini_clicked",
4552
MCP_DOCS_CLICKED = "mcp_docs_clicked",
4653
GIF_TOS_CLICKED = "gif_tos_clicked",

firebase-vscode/src/auth/service.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

firebase-vscode/src/data-connect/ad-hoc-mutations.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,16 +284,16 @@ function getDefaultScalarValueNode(type: string): ValueNode | undefined {
284284
}
285285
}
286286

287-
export function getDefaultScalarValue(type: string): string {
287+
export function getDefaultScalarValue(type: string): any {
288288
switch (type) {
289289
case "Boolean":
290-
return "false";
290+
return false;
291291
case "Date":
292292
return new Date().toISOString().substring(0, 10);
293293
case "Float":
294-
return "0";
294+
return 0.0;
295295
case "Int":
296-
return "0";
296+
return 0;
297297
case "Int64":
298298
return "0";
299299
case "String":
@@ -303,8 +303,8 @@ export function getDefaultScalarValue(type: string): string {
303303
case "UUID":
304304
return "11111111222233334444555555555555";
305305
case "Vector":
306-
return "[]";
306+
return [1.1, 2.2, 3.3];
307307
default:
308-
return "";
308+
return undefined;
309309
}
310310
}

firebase-vscode/src/data-connect/ai-tools/firebase-mcp.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import {
2-
gemini,
3-
gemini as geminiToolModule,
4-
} from "../../../../src/init/features/aitools/gemini";
1+
import { gemini as geminiToolModule } from "../../../../src/init/features/aitools/gemini";
52
import * as vscode from "vscode";
63
import { firebaseConfig } from "../config";
74
import { ExtensionBrokerImpl } from "../../extension-broker";
85
import { AnalyticsLogger, DATA_CONNECT_EVENT_NAME } from "../../analytics";
6+
import { configstore } from "../../../../src/configstore";
97

108
const GEMINI_EXTENSION_ID = "google.geminicodeassist";
119

@@ -49,6 +47,7 @@ async function ensureGeminiExtension(): Promise<boolean> {
4947

5048
// Writes MCP config, then opens up Gemini with a new chat
5149
async function openGeminiChat() {
50+
configstore.set("gemini", true);
5251
writeToGeminiConfig();
5352
await vscode.commands.executeCommand("cloudcode.gemini.chatView.focus");
5453
await vscode.commands.executeCommand("geminicodeassist.agent.chat.new");

firebase-vscode/src/data-connect/code-lens-provider.ts

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import * as vscode from "vscode";
22
import { Kind, parse } from "graphql";
3-
import { OperationLocation } from "./types";
43
import { Disposable } from "vscode";
54

65
import { Signal } from "@preact/signals-core";
76
import { dataConnectConfigs, firebaseRC } from "./config";
87
import { EmulatorsController } from "../core/emulators";
9-
import { GenerateOperationInput } from "./execution/execution";
8+
import { ExecutionInput, GenerateOperationInput } from "./execution/execution";
109
import { findCommentsBlocks } from "../utils/find_comments";
1110

1211
export enum InstanceType {
@@ -91,31 +90,40 @@ export class OperationCodeLensProvider extends ComputedCodeLensProvider {
9190
const line = x.loc.startToken.line - 1;
9291
const range = new vscode.Range(line, 0, line, 0);
9392
const position = new vscode.Position(line, 0);
94-
const operationLocation: OperationLocation = {
95-
document: documentText,
96-
documentPath: document.fileName,
97-
position: position,
98-
};
99-
const service = fdcConfigs.findEnclosingServiceForPath(
100-
document.fileName,
101-
);
93+
const service = fdcConfigs.findEnclosingServiceForPath(document.fileName);
10294
if (service) {
103-
codeLenses.push(
104-
new vscode.CodeLens(range, {
105-
title: `$(play) Run (local)`,
106-
command: "firebase.dataConnect.executeOperation",
107-
tooltip: "Execute the operation (⌘+enter or Ctrl+Enter)",
108-
arguments: [x, operationLocation, InstanceType.LOCAL],
109-
}),
110-
);
95+
{
96+
const arg: ExecutionInput = {
97+
operationAst: x,
98+
document: documentText,
99+
documentPath: document.fileName,
100+
position: position,
101+
instance: InstanceType.LOCAL,
102+
};
103+
codeLenses.push(
104+
new vscode.CodeLens(range, {
105+
title: `$(play) Run (local)`,
106+
command: "firebase.dataConnect.executeOperation",
107+
tooltip: "Execute the operation (⌘+enter or Ctrl+Enter)",
108+
arguments: [arg],
109+
}),
110+
);
111+
}
111112

112113
if (projectId) {
114+
const arg: ExecutionInput = {
115+
operationAst: x,
116+
document: documentText,
117+
documentPath: document.fileName,
118+
position: position,
119+
instance: InstanceType.PRODUCTION,
120+
};
113121
codeLenses.push(
114122
new vscode.CodeLens(range, {
115123
title: `$(play) Run (Production – Project: ${projectId})`,
116124
command: "firebase.dataConnect.executeOperation",
117125
tooltip: "Execute the operation (⌘+enter or Ctrl+Enter)",
118-
arguments: [x, operationLocation, InstanceType.PRODUCTION],
126+
arguments: [arg],
119127
}),
120128
);
121129
}

0 commit comments

Comments
 (0)