diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e11a4a0f72..87760a610a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1 @@ -- Fixed an issue where functions deployments would silently fail (#6989) +- Renamed Data Connect displayed text to SQL Connect diff --git a/src/command.ts b/src/command.ts index 8fd0e98f5f0..495527f4fff 100644 --- a/src/command.ts +++ b/src/command.ts @@ -15,7 +15,7 @@ import { getProject } from "./management/projects"; import { reconcileStudioFirebaseProject } from "./management/studio"; import { requireAuth } from "./requireAuth"; import { Options } from "./options"; -import { logger, useConsoleLoggers } from "./logger"; +import { useConsoleLoggers } from "./logger"; import { isFirebaseStudio } from "./env"; export interface CommandModule { @@ -236,28 +236,28 @@ export class Command { }); } const duration = Math.floor((process.uptime() - start) * 1000); - try { - const trackSuccess = trackGA4( - "command_execution", - { - command_name: this.name, - result: "success", - interactive: getInheritedOption(options, "nonInteractive") ? "false" : "true", - }, - duration, - ); - const tracks = [trackSuccess]; - if (isEmulator) { - tracks.push( + const trackSuccess = trackGA4( + "command_execution", + { + command_name: this.name, + result: "success", + interactive: getInheritedOption(options, "nonInteractive") ? "false" : "true", + }, + duration, + ); + if (!isEmulator) { + await withTimeout(5000, trackSuccess); + } else { + await withTimeout( + 5000, + Promise.all([ + trackSuccess, trackEmulator("command_success", { command_name: this.name, duration, }), - ); - } - await withTimeout(1000, Promise.all(tracks)); - } catch (gaErr) { - logger.debug("Analytics tracking failed during success path:", gaErr); + ]), + ); } process.exit(); }) @@ -278,30 +278,27 @@ export class Command { }); } const duration = Math.floor((process.uptime() - start) * 1000); - try { - const trackError = trackGA4( - "command_execution", - { - command_name: this.name, - result: "error", - interactive: getInheritedOption(options, "nonInteractive") ? "false" : "true", - }, - duration, - ); - const tracks = [trackError]; - if (isEmulator) { - tracks.push( - trackEmulator("command_error", { + await withTimeout( + 5000, + Promise.all([ + trackGA4( + "command_execution", + { command_name: this.name, - duration, - error_type: err?.exit === 1 ? "user" : "unexpected", - }), - ); - } - await withTimeout(1000, Promise.all(tracks)); - } catch (gaErr) { - logger.debug("Analytics tracking failed during error path:", gaErr); - } + result: "error", + interactive: getInheritedOption(options, "nonInteractive") ? "false" : "true", + }, + duration, + ), + isEmulator + ? trackEmulator("command_error", { + command_name: this.name, + duration, + error_type: err.exit === 1 ? "user" : "unexpected", + }) + : Promise.resolve(), + ]), + ); client.errorOut(err); }); diff --git a/src/commands/dataconnect-compile.ts b/src/commands/dataconnect-compile.ts index 305133165dd..6beaf24d157 100644 --- a/src/commands/dataconnect-compile.ts +++ b/src/commands/dataconnect-compile.ts @@ -14,14 +14,14 @@ import { FirebaseError } from "../error"; type CompileOptions = Options & { service?: string; location?: string }; export const command = new Command("dataconnect:compile") - .description("compile your Data Connect schema and connector config and GQL files.") + .description("compile your SQL Connect schema and connector config and GQL files.") .option( "--service ", - "the serviceId of the Data Connect service. If not provided, compiles all services.", + "the serviceId of the SQL Connect service. If not provided, compiles all services.", ) .option( "--location ", - "the location of the Data Connect service. Only needed if service ID is used in multiple locations.", + "the location of the SQL Connect service. Only needed if service ID is used in multiple locations.", ) .action(async (options: CompileOptions) => { const projectId = getProjectId(options); @@ -29,7 +29,7 @@ export const command = new Command("dataconnect:compile") const config = options.config; if (!config || !config.has("dataconnect")) { throw new FirebaseError( - `No Data Connect project directory found. Please run ${clc.bold("firebase init dataconnect")} to set it up first.`, + `No SQL Connect project directory found. Please run ${clc.bold("firebase init dataconnect")} to set it up first.`, ); } @@ -41,7 +41,7 @@ export const command = new Command("dataconnect:compile") ); if (!serviceInfos.length) { - throw new FirebaseError("No Data Connect services found to compile."); + throw new FirebaseError("No SQL Connect services found to compile."); } for (const serviceInfo of serviceInfos) { @@ -69,7 +69,7 @@ export const command = new Command("dataconnect:compile") logLabeledSuccess( "dataconnect", - `Successfully compiled Data Connect service: ${clc.bold(serviceInfo.dataConnectYaml.serviceId)}`, + `Successfully compiled SQL Connect service: ${clc.bold(serviceInfo.dataConnectYaml.serviceId)}`, ); } }); diff --git a/src/commands/dataconnect-execute.ts b/src/commands/dataconnect-execute.ts index 23bd12f8ae9..e2c8d054d41 100644 --- a/src/commands/dataconnect-execute.ts +++ b/src/commands/dataconnect-execute.ts @@ -24,7 +24,7 @@ let stdinUsedFor: string | undefined = undefined; export const command = new Command("dataconnect:execute [file] [operationName]") .description( - "execute a Data Connect query or mutation. If FIREBASE_DATACONNECT_EMULATOR_HOST is set (such as during 'firebase emulator:exec', executes against the emulator instead.", + "execute a SQL Connect query or mutation. If FIREBASE_DATACONNECT_EMULATOR_HOST is set (such as during 'firebase emulator:exec', executes against the emulator instead.", ) .option( "--service ", diff --git a/src/commands/dataconnect-sdk-generate.ts b/src/commands/dataconnect-sdk-generate.ts index 4dfe9e02ef8..a5c3e537a3b 100644 --- a/src/commands/dataconnect-sdk-generate.ts +++ b/src/commands/dataconnect-sdk-generate.ts @@ -19,14 +19,14 @@ import { EmulatorHub } from "../emulator/hub"; type GenerateOptions = Options & { watch?: boolean; service?: string; location?: string }; export const command = new Command("dataconnect:sdk:generate") - .description("generate typed SDKs to use Data Connect in your apps") + .description("generate typed SDKs to use SQL Connect in your apps") .option( "--service ", - "the serviceId of the Data Connect service. If not provided, generates SDKs for all services.", + "the serviceId of the SQL Connect service. If not provided, generates SDKs for all services.", ) .option( "--location ", - "the location of the Data Connect service. Only needed if service ID is used in multiple locations.", + "the location of the SQL Connect service. Only needed if service ID is used in multiple locations.", ) .option( "--watch", diff --git a/src/commands/dataconnect-services-list.ts b/src/commands/dataconnect-services-list.ts index c1399a480d5..9f2e4f3010d 100644 --- a/src/commands/dataconnect-services-list.ts +++ b/src/commands/dataconnect-services-list.ts @@ -10,7 +10,7 @@ import * as Table from "cli-table3"; // TODO: Update this command to also list secondary schema information. export const command = new Command("dataconnect:services:list") - .description("list all deployed Data Connect services") + .description("list all deployed SQL Connect services") .before(requirePermissions, [ "dataconnect.services.list", "dataconnect.schemas.list", diff --git a/src/commands/dataconnect-sql-diff.ts b/src/commands/dataconnect-sql-diff.ts index 87a9e2eeda7..1786e9528ce 100644 --- a/src/commands/dataconnect-sql-diff.ts +++ b/src/commands/dataconnect-sql-diff.ts @@ -12,12 +12,12 @@ type DiffOptions = Options & { service?: string; location?: string }; export const command = new Command("dataconnect:sql:diff") .description( - "display the differences between the local Data Connect schema and your CloudSQL database's schema", + "display the differences between the local SQL Connect schema and your CloudSQL database's schema", ) - .option("--service ", "the serviceId of the Data Connect service") + .option("--service ", "the serviceId of the SQL Connect service") .option( "--location ", - "the location of the Data Connect service. Only needed if service ID is used in multiple locations.", + "the location of the SQL Connect service. Only needed if service ID is used in multiple locations.", ) .before(requirePermissions, [ "firebasedataconnect.services.list", diff --git a/src/commands/dataconnect-sql-grant.ts b/src/commands/dataconnect-sql-grant.ts index e5f8bb9b143..23f8bbe13c0 100644 --- a/src/commands/dataconnect-sql-grant.ts +++ b/src/commands/dataconnect-sql-grant.ts @@ -27,10 +27,10 @@ export const command = new Command("dataconnect:sql:grant") "-E, --email ", "The email of the user or service account we would like to grant the role to.", ) - .option("--service ", "the serviceId of the Data Connect service") + .option("--service ", "the serviceId of the SQL Connect service") .option( "--location ", - "the location of the Data Connect service. Only needed if service ID is used in multiple locations.", + "the location of the SQL Connect service. Only needed if service ID is used in multiple locations.", ) .before(requirePermissions, ["firebasedataconnect.services.list"]) .before(requireAuth) diff --git a/src/commands/dataconnect-sql-migrate.ts b/src/commands/dataconnect-sql-migrate.ts index f249e95c5fc..116f0198bb9 100644 --- a/src/commands/dataconnect-sql-migrate.ts +++ b/src/commands/dataconnect-sql-migrate.ts @@ -13,11 +13,11 @@ import { mainSchema, mainSchemaYaml } from "../dataconnect/types"; type MigrateOptions = Options & { service?: string; location?: string }; export const command = new Command("dataconnect:sql:migrate") - .description("migrate your CloudSQL database's schema to match your local Data Connect schema") - .option("--service ", "the serviceId of the Data Connect service") + .description("migrate your CloudSQL database's schema to match your local SQL Connect schema") + .option("--service ", "the serviceId of the SQL Connect service") .option( "--location ", - "the location of the Data Connect service. Only needed if service ID is used in multiple locations.", + "the location of the SQL Connect service. Only needed if service ID is used in multiple locations.", ) .before(requirePermissions, [ "firebasedataconnect.services.list", @@ -53,7 +53,7 @@ export const command = new Command("dataconnect:sql:migrate") if (diffs.length) { logLabeledSuccess( "dataconnect", - `Database schema sucessfully migrated! Run 'firebase deploy' to deploy your new schema to your Data Connect service.`, + `Database schema sucessfully migrated! Run 'firebase deploy' to deploy your new schema to your SQL Connect service.`, ); } else { logLabeledSuccess("dataconnect", "Database schema is already up to date!"); diff --git a/src/commands/dataconnect-sql-setup.ts b/src/commands/dataconnect-sql-setup.ts index cf6dcb8b99e..21dd206c11e 100644 --- a/src/commands/dataconnect-sql-setup.ts +++ b/src/commands/dataconnect-sql-setup.ts @@ -15,10 +15,10 @@ type SetupOptions = Options & { service?: string; location?: string }; export const command = new Command("dataconnect:sql:setup") .description("set up your CloudSQL database") - .option("--service ", "the serviceId of the Data Connect service") + .option("--service ", "the serviceId of the SQL Connect service") .option( "--location ", - "the location of the Data Connect service. Only needed if service ID is used in multiple locations.", + "the location of the SQL Connect service. Only needed if service ID is used in multiple locations.", ) .before(requirePermissions, [ "firebasedataconnect.services.list", diff --git a/src/commands/dataconnect-sql-shell.ts b/src/commands/dataconnect-sql-shell.ts index fb2dac7db2b..fd6225d158e 100644 --- a/src/commands/dataconnect-sql-shell.ts +++ b/src/commands/dataconnect-sql-shell.ts @@ -86,12 +86,12 @@ type ShellOptions = Options & { service?: string; location?: string }; export const command = new Command("dataconnect:sql:shell") .description( - "start a shell connected directly to your Data Connect service's linked CloudSQL instance", + "start a shell connected directly to your SQL Connect service's linked CloudSQL instance", ) - .option("--service ", "the serviceId of the Data Connect service") + .option("--service ", "the serviceId of the SQL Connect service") .option( "--location ", - "the location of the Data Connect service. Only needed if service ID is used in multiple locations.", + "the location of the SQL Connect service. Only needed if service ID is used in multiple locations.", ) .before(requirePermissions, ["firebasedataconnect.services.list", "cloudsql.instances.connect"]) .before(requireAuth) @@ -134,7 +134,7 @@ export const command = new Command("dataconnect:sql:shell") await conn.query(`SET search_path TO "${schemaName}"`); logger.info(`Logged in as ${username}`); - logger.info(clc.cyan("Welcome to Data Connect Cloud SQL Shell")); + logger.info(clc.cyan("Welcome to SQL Connect Cloud SQL Shell")); logger.info( clc.gray( "Type your your SQL query or '.exit' to quit, queries should end with ';' or add empty line to execute.", diff --git a/src/commands/init.ts b/src/commands/init.ts index 9118edd63ab..b69d7363202 100644 --- a/src/commands/init.ts +++ b/src/commands/init.ts @@ -33,7 +33,7 @@ let choices: { }[] = [ { value: "dataconnect", - name: "Data Connect: Set up a Firebase Data Connect service", + name: "SQL Connect: Set up a Firebase SQL Connect service", checked: false, }, { @@ -90,7 +90,7 @@ let choices: { }, { value: "dataconnect:sdk", - name: "Data Connect: Set up a generated SDK for your Firebase Data Connect service", + name: "SQL Connect: Set up a generated SDK for your Firebase SQL Connect service", checked: false, hidden: true, }, @@ -104,7 +104,7 @@ let choices: { if (isEnabled("fdcwebhooks")) { choices.push({ value: "dataconnect:resolver", - name: "Data Connect: Set up a custom resolver for your Firebase Data Connect service", + name: "SQL Connect: Set up a custom resolver for your Firebase SQL Connect service", checked: false, hidden: true, }); diff --git a/src/commands/open.ts b/src/commands/open.ts index 454674f7993..ceaa0d34a25 100644 --- a/src/commands/open.ts +++ b/src/commands/open.ts @@ -26,7 +26,7 @@ const LINKS: Link[] = [ { name: "Crash Reporting", arg: "crash", consolePath: "/crashlytics" }, { name: "Database: Data", arg: "database", consolePath: "/database/data" }, { name: "Database: Rules", arg: "database:rules", consolePath: "/database/rules" }, - { name: "Data Connect", arg: "dataconnect", consolePath: "/dataconnect" }, + { name: "SQL Connect", arg: "dataconnect", consolePath: "/dataconnect" }, { name: "Docs", arg: "docs", url: "https://firebase.google.com/docs" }, { name: "Dynamic Links", arg: "links", consolePath: "/durablelinks" }, { name: "Extensions", arg: "extensions", consolePath: "/extensions" }, diff --git a/src/commands/setup-emulators-dataconnect.ts b/src/commands/setup-emulators-dataconnect.ts index aa2475c71db..233fa4aa14e 100644 --- a/src/commands/setup-emulators-dataconnect.ts +++ b/src/commands/setup-emulators-dataconnect.ts @@ -12,7 +12,7 @@ export const command = new Command(`setup:emulators:${NAME}`) await downloadIfNecessary(NAME); if (!options.config) { logger.info( - "Not currently in a Firebase project directory. Run this command from a project directory to configure the Data Connect emulator.", + "Not currently in a Firebase project directory. Run this command from a project directory to configure the SQL Connect emulator.", ); return; } diff --git a/src/dataconnect/ensureApis.spec.ts b/src/dataconnect/ensureApis.spec.ts index eb62c27753b..ad881af0cb8 100644 --- a/src/dataconnect/ensureApis.spec.ts +++ b/src/dataconnect/ensureApis.spec.ts @@ -15,7 +15,7 @@ describe("ensureApis", () => { sinon.verifyAndRestore(); }); - it("should ensure Data Connect and Cloud SQL Admin APIs are enabled", async () => { + it("should ensure SQL Connect and Cloud SQL Admin APIs are enabled", async () => { ensureStub.resolves(); await apis.ensureApis("my-project"); expect(ensureStub).to.be.calledWith("my-project", api.dataconnectOrigin(), "dataconnect"); diff --git a/src/dataconnect/freeTrial.ts b/src/dataconnect/freeTrial.ts index 5a2485c431f..a19530dc9a5 100644 --- a/src/dataconnect/freeTrial.ts +++ b/src/dataconnect/freeTrial.ts @@ -31,11 +31,11 @@ export async function checkFreeTrialInstanceUsed(projectId: string): Promise { const serviceCfgs = readFirebaseJson(config); diff --git a/src/dataconnect/provisionCloudSql.ts b/src/dataconnect/provisionCloudSql.ts index a2171067d09..a7ccde7f891 100755 --- a/src/dataconnect/provisionCloudSql.ts +++ b/src/dataconnect/provisionCloudSql.ts @@ -88,14 +88,14 @@ async function upsertInstance( if (dryRun) { utils.logLabeledBullet( "dataconnect", - `Cloud SQL instance ${clc.bold(instanceId)} settings are not compatible with Firebase Data Connect. ` + + `Cloud SQL instance ${clc.bold(instanceId)} settings are not compatible with Firebase SQL Connect. ` + `It will be updated on your next deploy.` + why, ); } else { utils.logLabeledBullet( "dataconnect", - `Cloud SQL instance ${clc.bold(instanceId)} settings are not compatible with Firebase Data Connect. ` + + `Cloud SQL instance ${clc.bold(instanceId)} settings are not compatible with Firebase SQL Connect. ` + why, ); stats.action = "update"; @@ -170,7 +170,7 @@ export function cloudSQLBeingCreated( return ( `Cloud SQL Instance ${clc.bold(instanceId)} is being created.` + (isFreeTrial - ? `\nThis instance is provided under the terms of the Data Connect no-cost trial ${freeTrialTermsLink()}` + ? `\nThis instance is provided under the terms of the SQL Connect no-cost trial ${freeTrialTermsLink()}` : "") + `\n Meanwhile, your data are saved in a temporary database and will be migrated once complete.` + @@ -229,7 +229,7 @@ export function getUpdateReason(instance: Instance, requireGoogleMlIntegration: settings.ipConfiguration?.privateNetwork && !settings.ipConfiguration?.enablePrivatePathForGoogleCloudServices ) { - // Cloud SQL instances with only private IP must enable PSC for Data Connect backend to connect to it. + // Cloud SQL instances with only private IP must enable PSC for SQL Connect backend to connect to it. reason += "\n - to enable Private Path for Google Cloud Services."; } } @@ -247,7 +247,7 @@ export function getUpdateReason(instance: Instance, requireGoogleMlIntegration: } } - // Cloud SQL instances must have IAM authentication enabled to be used with Firebase Data Connect. + // Cloud SQL instances must have IAM authentication enabled to be used with Firebase SQL Connect. const isIamEnabled = settings.databaseFlags?.some( (f) => f.name === "cloudsql.iam_authentication" && f.value === "on", diff --git a/src/dataconnect/schemaMigration.spec.ts b/src/dataconnect/schemaMigration.spec.ts index 329cd80fd95..eb12778b27e 100644 --- a/src/dataconnect/schemaMigration.spec.ts +++ b/src/dataconnect/schemaMigration.spec.ts @@ -104,7 +104,7 @@ describe("getIdentifiers", () => { source: {}, }; expect(() => getIdentifiers(schema)).to.throw( - "Data Connect schema must have a postgres datasource with a database name.", + "SQL Connect schema must have a postgres datasource with a database name.", ); }); @@ -121,7 +121,7 @@ describe("getIdentifiers", () => { source: {}, }; expect(() => getIdentifiers(schema)).to.throw( - "Data Connect schema must have a postgres datasource with a CloudSQL instance.", + "SQL Connect schema must have a postgres datasource with a CloudSQL instance.", ); }); }); diff --git a/src/dataconnect/schemaMigration.ts b/src/dataconnect/schemaMigration.ts index 50dc2aa8557..d4e0e34e40c 100644 --- a/src/dataconnect/schemaMigration.ts +++ b/src/dataconnect/schemaMigration.ts @@ -375,7 +375,7 @@ export async function grantRoleToUserInSchema(options: Options, schema: Schema) // Edge case: we can't grant firebase owner unless database is greenfield. if (schemaSetupStatus !== SchemaSetupStatus.GreenField && role === "owner") { throw new FirebaseError( - `Owner rule isn't available in ${schemaSetupStatus} databases. If you would like Data Connect to manage and own your database schema, run 'firebase dataconnect:sql:setup'`, + `Owner rule isn't available in ${schemaSetupStatus} databases. If you would like SQL Connect to manage and own your database schema, run 'firebase dataconnect:sql:setup'`, ); } @@ -417,13 +417,13 @@ export function getIdentifiers(schema: Schema): { const databaseId = postgresDatasource?.postgresql?.database; if (!databaseId) { throw new FirebaseError( - "Data Connect schema must have a postgres datasource with a database name.", + "SQL Connect schema must have a postgres datasource with a database name.", ); } const instanceName = postgresDatasource?.postgresql?.cloudSql?.instance; if (!instanceName) { throw new FirebaseError( - "Data Connect schema must have a postgres datasource with a CloudSQL instance.", + "SQL Connect schema must have a postgres datasource with a CloudSQL instance.", ); } const instanceId = instanceName.split("/").pop()!; @@ -485,9 +485,9 @@ async function handleIncompatibleSchemaError(args: { const schemaInfo = await getSchemaMetadata(instanceId, databaseId, schemaName, options); if (schemaInfo.setupStatus !== SchemaSetupStatus.GreenField) { throw new FirebaseError( - `Brownfield database are protected from SQL changes by Data Connect.\n` + + `Brownfield database are protected from SQL changes by SQL Connect.\n` + `You can use the SQL diff generated by 'firebase dataconnect:sql:diff' to assist you in applying the required changes to your CloudSQL database. Connector deployment will succeed when there is no required diff changes.\n` + - `If you would like Data Connect to manage your database schema, run 'firebase dataconnect:sql:setup'`, + `If you would like SQL Connect to manage your database schema, run 'firebase dataconnect:sql:setup'`, ); } @@ -585,7 +585,7 @@ async function promptForSchemaMigration( if (!validateOnly) { // `firebase deploy --nonInteractive` performs no migrations throw new FirebaseError( - "Command aborted. Your database schema is incompatible with your Data Connect schema. Run `firebase dataconnect:sql:migrate` to migrate your database schema", + "Command aborted. Your database schema is incompatible with your SQL Connect schema. Run `firebase dataconnect:sql:migrate` to migrate your database schema", ); } else if (options.force) { // `dataconnect:sql:migrate --nonInteractive --force` performs all migrations. @@ -770,13 +770,13 @@ function displayNoSchemaDiff( case "COMPATIBLE": logLabeledSuccess( "dataconnect", - `Database schema of ${instanceId}:${databaseId} is compatible with Data Connect Schema.`, + `Database schema of ${instanceId}:${databaseId} is compatible with SQL Connect Schema.`, ); break; case "STRICT": logLabeledSuccess( "dataconnect", - `Database schema of ${instanceId}:${databaseId} matches Data Connect Schema exactly.`, + `Database schema of ${instanceId}:${databaseId} matches SQL Connect Schema exactly.`, ); break; } @@ -793,7 +793,7 @@ function displaySchemaChanges( case "COMPATIBLE": logLabeledWarning( "dataconnect", - `PostgreSQL schema is incompatible with the Data Connect Schema. + `PostgreSQL schema is incompatible with the SQL Connect Schema. Those SQL statements will migrate it to be compatible: ${diffsToString(error.diffs)} @@ -803,7 +803,7 @@ ${diffsToString(error.diffs)} case "STRICT_AFTER_COMPATIBLE": logLabeledBullet( "dataconnect", - `PostgreSQL schema contains unused SQL objects not part of the Data Connect Schema. + `PostgreSQL schema contains unused SQL objects not part of the SQL Connect Schema. Those SQL statements will migrate it to match exactly: ${diffsToString(error.diffs)} @@ -813,7 +813,7 @@ ${diffsToString(error.diffs)} case "STRICT": logLabeledWarning( "dataconnect", - `PostgreSQL schema does not match the Data Connect Schema. + `PostgreSQL schema does not match the SQL Connect Schema. Those SQL statements will migrate it to match exactly: ${diffsToString(error.diffs)} diff --git a/src/dataconnect/types.ts b/src/dataconnect/types.ts index 695686def37..94707949ff7 100644 --- a/src/dataconnect/types.ts +++ b/src/dataconnect/types.ts @@ -266,7 +266,7 @@ export function toDatasource( return {}; } -/** Returns the main schema YAML for a Data Connect YAML */ +/** Returns the main schema YAML for a SQL Connect YAML */ export function mainSchemaYaml(dataconnectYaml: DataConnectYaml): SchemaYaml { if (dataconnectYaml.schema) { return dataconnectYaml.schema; @@ -278,7 +278,7 @@ export function mainSchemaYaml(dataconnectYaml: DataConnectYaml): SchemaYaml { return mainSch; } -/** Returns the secondary schema YAMLs for a Data Connect YAML */ +/** Returns the secondary schema YAMLs for a SQL Connect YAML */ export function secondarySchemaYamls(dataconnectYaml: DataConnectYaml): SchemaYaml[] { if (dataconnectYaml.schema) { return []; diff --git a/src/dataconnect/webhook.ts b/src/dataconnect/webhook.ts index 7858d9512d6..b194a0f9abf 100644 --- a/src/dataconnect/webhook.ts +++ b/src/dataconnect/webhook.ts @@ -37,7 +37,7 @@ export async function sendVSCodeMessage(body: WebhookBody) { }); } catch (e) { logger.debug( - `Could not find VSCode notification endpoint: ${e}. If you are not running the Firebase Data Connect VSCode extension, this is expected and not an issue.`, + `Could not find VSCode notification endpoint: ${e}. If you are not running the Firebase SQL Connect VSCode extension, this is expected and not an issue.`, ); } } diff --git a/src/deploy/functions/backend.ts b/src/deploy/functions/backend.ts index 3e92b74b519..bf202de58e9 100644 --- a/src/deploy/functions/backend.ts +++ b/src/deploy/functions/backend.ts @@ -43,13 +43,13 @@ export interface HttpsTriggered { httpsTrigger: HttpsTrigger; } -/** API agnostic version of a Firebase Data Connect HTTPS trigger. */ +/** API agnostic version of a Firebase SQL Connect HTTPS trigger. */ export interface DataConnectGraphqlTrigger { invoker?: string[] | null; schemaFilePath?: string; } -/** Something that has a Data Connect HTTPS trigger */ +/** Something that has a SQL Connect HTTPS trigger */ export interface DataConnectGraphqlTriggered { dataConnectGraphqlTrigger: DataConnectGraphqlTrigger; } diff --git a/src/deploy/functions/build.ts b/src/deploy/functions/build.ts index 2958c567562..af318950579 100644 --- a/src/deploy/functions/build.ts +++ b/src/deploy/functions/build.ts @@ -72,8 +72,8 @@ export interface HttpsTrigger { } export interface DataConnectGraphqlTrigger { - // Which service account should be able to trigger this function in addition to the Firebase Data Connect P4SA. - // No value means that only the Firebase Data Connect P4SA can trigger this function. + // Which service account should be able to trigger this function in addition to the Firebase SQL Connect P4SA. + // No value means that only the Firebase SQL Connect P4SA can trigger this function. // For more context, see go/cf3-http-access-control invoker?: Array> | null; // The file path relative to the Firebase project directory where the GraphQL schema is stored. diff --git a/src/deploy/functions/release/fabricator.ts b/src/deploy/functions/release/fabricator.ts index c3051e86b8f..52d6734f8ee 100644 --- a/src/deploy/functions/release/fabricator.ts +++ b/src/deploy/functions/release/fabricator.ts @@ -425,7 +425,7 @@ export class Fabricator { .catch(rethrowAs(endpoint, "set invoker")); } } else if (backend.isDataConnectGraphqlTriggered(endpoint)) { - // Like HTTPS triggers, dataConnectGraphqlTriggers have an invoker, but the Firebase Data Connect P4SA must always be an invoker. + // Like HTTPS triggers, dataConnectGraphqlTriggers have an invoker, but the Firebase SQL Connect P4SA must always be an invoker. const invoker = endpoint.dataConnectGraphqlTrigger.invoker ?? []; invoker.push(getDataConnectP4SA(this.projectNumber)); if (!invoker.includes("private")) { diff --git a/src/deploy/functions/release/index.ts b/src/deploy/functions/release/index.ts index e8082f97ef1..886603424d3 100644 --- a/src/deploy/functions/release/index.ts +++ b/src/deploy/functions/release/index.ts @@ -152,7 +152,7 @@ export function printTriggerUrls(results: backend.Backend, projectNumber: string continue; } if (backend.isDataConnectGraphqlTriggered(httpsFunc)) { - // The Cloud Functions backend only returns the non-deterministic hashed URL, which doesn't work for Data Connect + // The Cloud Functions backend only returns the non-deterministic hashed URL, which doesn't work for SQL Connect // as we do some verification against the project number and region in the URL, so we manually construct the deterministic URL. const uri = backend.maybeDeterministicCloudRunUri(httpsFunc, projectNumber); logger.info(clc.bold("Function URL"), `(${getFunctionLabel(httpsFunc)}):`, uri); diff --git a/src/deploy/functions/release/planner.ts b/src/deploy/functions/release/planner.ts index b14b155f6ef..0fa7d2bfbd6 100644 --- a/src/deploy/functions/release/planner.ts +++ b/src/deploy/functions/release/planner.ts @@ -270,7 +270,7 @@ export function checkForIllegalUpdate(want: backend.Endpoint, have: backend.Endp if (backend.isHttpsTriggered(e)) { return "an HTTPS"; } else if (backend.isDataConnectGraphqlTriggered(e)) { - return "a Data Connect HTTPS"; + return "a SQL Connect HTTPS"; } else if (backend.isCallableTriggered(e)) { return "a callable"; } else if (backend.isEventTriggered(e)) { diff --git a/src/deploy/functions/runtimes/discovery/v1alpha1.spec.ts b/src/deploy/functions/runtimes/discovery/v1alpha1.spec.ts index 11ff2956604..e401d79c534 100644 --- a/src/deploy/functions/runtimes/discovery/v1alpha1.spec.ts +++ b/src/deploy/functions/runtimes/discovery/v1alpha1.spec.ts @@ -194,7 +194,7 @@ describe("buildFromV1Alpha", () => { }); describe("dataConnectGraphqlTriggers", () => { - it("invalid value for Data Connect https trigger key invoker", () => { + it("invalid value for SQL Connect https trigger key invoker", () => { assertParserError({ endpoints: { func: { diff --git a/src/deploy/functions/services/dataconnect.spec.ts b/src/deploy/functions/services/dataconnect.spec.ts index 560489af7e3..e763d0852ea 100644 --- a/src/deploy/functions/services/dataconnect.spec.ts +++ b/src/deploy/functions/services/dataconnect.spec.ts @@ -42,7 +42,7 @@ describe("ensureDatabaseTriggerRegion", () => { ep.eventTrigger.region = "us-west1"; expect(() => dataconnect.ensureDataConnectTriggerRegion(ep)).to.throw( - "The Firebase Data Connect trigger location must match the function region.", + "The Firebase SQL Connect trigger location must match the function region.", ); }); }); diff --git a/src/deploy/functions/services/dataconnect.ts b/src/deploy/functions/services/dataconnect.ts index fabb574059b..a26717dfc45 100644 --- a/src/deploy/functions/services/dataconnect.ts +++ b/src/deploy/functions/services/dataconnect.ts @@ -7,7 +7,7 @@ const STAGING_DATACONNECT_SA_DOMAIN = "gcp-sa-staging-dataconnect.iam.gserviceac const PROD_DATACONNECT_SA_DOMAIN = "gcp-sa-firebasedataconnect.iam.gserviceaccount.com"; /** - * Sets a Firebase Data Connect event trigger's region to the function region. + * Sets a Firebase SQL Connect event trigger's region to the function region. * @param endpoint the database endpoint */ export function ensureDataConnectTriggerRegion( @@ -18,14 +18,14 @@ export function ensureDataConnectTriggerRegion( } if (endpoint.eventTrigger.region !== endpoint.region) { throw new FirebaseError( - "The Firebase Data Connect trigger location must match the function region.", + "The Firebase SQL Connect trigger location must match the function region.", ); } return Promise.resolve(); } /** - * Gets the P4SA for Firebase Data Connect for the given project number. + * Gets the P4SA for Firebase SQL Connect for the given project number. * @param projectNumber project identifier */ export function getDataConnectP4SA(projectNumber: string): string { diff --git a/src/deploy/functions/services/index.ts b/src/deploy/functions/services/index.ts index 50a0b5f62f9..789317d590a 100644 --- a/src/deploy/functions/services/index.ts +++ b/src/deploy/functions/services/index.ts @@ -135,7 +135,7 @@ const firestoreService: Service = { unregisterTrigger: noop, }; -/** A Firebase Data Connect service object */ +/** A Firebase SQL Connect service object */ const dataconnectService: Service = { name: "dataconnect", api: "firebasedataconnect.googleapis.com", diff --git a/src/emulator/constants.ts b/src/emulator/constants.ts index 8d3a1c875ca..a070f2fa981 100644 --- a/src/emulator/constants.ts +++ b/src/emulator/constants.ts @@ -50,7 +50,7 @@ export const EMULATOR_DESCRIPTION: Record = { storage: "Storage Emulator", extensions: "Extensions Emulator", eventarc: "Eventarc Emulator", - dataconnect: "Data Connect Emulator", + dataconnect: "SQL Connect Emulator", tasks: "Cloud Tasks Emulator", }; @@ -76,10 +76,10 @@ export class Constants { // Environment variable to override SDK/CLI to point at the Realtime Database emulator. static FIREBASE_DATABASE_EMULATOR_HOST = "FIREBASE_DATABASE_EMULATOR_HOST"; - // Environment variable to discover the Data Connect emulator. + // Environment variable to discover the SQL Connect emulator. static FIREBASE_DATACONNECT_EMULATOR_HOST = "FIREBASE_DATA_CONNECT_EMULATOR_HOST"; - // Alternative (deprecated) env var for Data Connect Emulator. + // Alternative (deprecated) env var for SQL Connect Emulator. static FIREBASE_DATACONNECT_ENV_ALT = "DATA_CONNECT_EMULATOR_HOST"; // Environment variable to override SDK/CLI to point at the Firebase Auth emulator. diff --git a/src/emulator/controller.ts b/src/emulator/controller.ts index 0d012ffd1ae..8aa6e52d962 100755 --- a/src/emulator/controller.ts +++ b/src/emulator/controller.ts @@ -849,10 +849,10 @@ export async function startAll( if (listenForEmulator.dataconnect) { const config = readFirebaseJson(options.config); if (!config.length) { - throw new FirebaseError("No Data Connect service found in firebase.json"); + throw new FirebaseError("No SQL Connect service found in firebase.json"); } else if (config.length > 1) { logger.warn( - `TODO: Add support for multiple services in the Data Connect emulator. Currently emulating first service ${config[0].source}`, + `TODO: Add support for multiple services in the SQL Connect emulator. Currently emulating first service ${config[0].source}`, ); } diff --git a/src/emulator/dataconnectEmulator.ts b/src/emulator/dataconnectEmulator.ts index afff03a270d..3283e4aa8bf 100644 --- a/src/emulator/dataconnectEmulator.ts +++ b/src/emulator/dataconnectEmulator.ts @@ -144,12 +144,12 @@ export class DataConnectEmulator implements EmulatorInstance { connStr = `postgres://${connectableHost}:${pgPort}/${dbId}?sslmode=disable`; server.on("error", (err: any) => { if (err instanceof FirebaseError) { - this.logger.logLabeled("ERROR", "Data Connect", `${err}`); + this.logger.logLabeled("ERROR", "SQL Connect", `${err}`); } else { this.logger.logLabeled( "ERROR", "dataconnect", - `Postgres threw an unexpected error, shutting down the Data Connect emulator: ${err}`, + `Postgres threw an unexpected error, shutting down the SQL Connect emulator: ${err}`, ); } void cleanShutdown(); @@ -172,7 +172,7 @@ export class DataConnectEmulator implements EmulatorInstance { this.logger.logLabeled( "ERROR", "dataconnect", - "Could not connect to Data Connect emulator. Check dataconnect-debug.log for more details.", + "Could not connect to SQL Connect emulator. Check dataconnect-debug.log for more details.", ); return Promise.reject(); } @@ -184,7 +184,7 @@ export class DataConnectEmulator implements EmulatorInstance { this.logger.logLabeled( "INFO", "dataconnect", - "Skipping cleanup of Data Connect emulator, as it was not started by this process.", + "Skipping cleanup of SQL Connect emulator, as it was not started by this process.", ); return; } @@ -230,7 +230,7 @@ export class DataConnectEmulator implements EmulatorInstance { ); } else { throw new FirebaseError( - "The Data Connect emulator is currently connected to a separate Postgres instance. Export is not supported.", + "The SQL Connect emulator is currently connected to a separate Postgres instance. Export is not supported.", ); } } @@ -263,7 +263,7 @@ export class DataConnectEmulator implements EmulatorInstance { if (isIncomaptibleArchError(e)) { reject( new FirebaseError( - `Unknown system error when running the Data Connect toolkit. ` + + `Unknown system error when running the SQL Connect toolkit. ` + `You may be able to fix this by installing Rosetta: ` + `softwareupdate --install-rosetta`, ), @@ -285,19 +285,19 @@ export class DataConnectEmulator implements EmulatorInstance { const res = childProcess.spawnSync(commandInfo.binary, cmd, { encoding: "utf-8", env }); if (isIncomaptibleArchError(res.error)) { throw new FirebaseError( - `Unkown system error when running the Data Connect toolkit. ` + + `Unkown system error when running the SQL Connect toolkit. ` + `You may be able to fix this by installing Rosetta: ` + `softwareupdate --install-rosetta`, ); } if (res.error) { - throw new FirebaseError(`Error starting up Data Connect build: ${res.error.message}`, { + throw new FirebaseError(`Error starting up SQL Connect build: ${res.error.message}`, { original: res.error, }); } if (res.status !== 0) { throw new FirebaseError( - `Unable to build your Data Connect schema and connectors (exit code ${res.status}): ${res.stderr}`, + `Unable to build your SQL Connect schema and connectors (exit code ${res.status}): ${res.stderr}`, ); } @@ -319,15 +319,15 @@ export class DataConnectEmulator implements EmulatorInstance { serviceId?: string, ): Promise { if (!connectionString) { - const msg = `No Postgres connection found. The Data Connect emulator will not be able to execute operations.`; + const msg = `No Postgres connection found. The SQL Connect emulator will not be able to execute operations.`; throw new FirebaseError(msg); } - // The Data Connect emulator does not immediately start listening after started + // The SQL Connect emulator does not immediately start listening after started // so we retry this call with a brief backoff. const MAX_RETRIES = 3; for (let i = 1; i <= MAX_RETRIES; i++) { try { - this.logger.logLabeled("DEBUG", "Data Connect", `Connecting to ${connectionString}}...`); + this.logger.logLabeled("DEBUG", "SQL Connect", `Connecting to ${connectionString}}...`); connectionString.toString(); await this.emulatorClient.configureEmulator({ connectionString: connectionString.toString(), @@ -339,7 +339,7 @@ export class DataConnectEmulator implements EmulatorInstance { }); this.logger.logLabeled( "DEBUG", - "Data Connect", + "SQL Connect", `Successfully connected to ${connectionString}}`, ); return true; @@ -349,7 +349,7 @@ export class DataConnectEmulator implements EmulatorInstance { } this.logger.logLabeled( "DEBUG", - "Data Connect", + "SQL Connect", `Retrying connectToPostgress call (${i} of ${MAX_RETRIES} attempts): ${err}`, ); await new Promise((resolve) => setTimeout(resolve, 2000)); @@ -415,7 +415,7 @@ export class DataConnectEmulatorClient { return res; } catch (err: any) { if (err.status === 500) { - throw new FirebaseError(`Data Connect emulator: ${err?.context?.body?.message}`); + throw new FirebaseError(`SQL Connect emulator: ${err?.context?.body?.message}`); } throw err; } diff --git a/src/emulator/dataconnectToolkitController.ts b/src/emulator/dataconnectToolkitController.ts index 2c8c5d13d99..2f14fdfd8fd 100644 --- a/src/emulator/dataconnectToolkitController.ts +++ b/src/emulator/dataconnectToolkitController.ts @@ -5,9 +5,9 @@ import { connectableHostname } from "../utils"; import { DataConnectEmulator, DataConnectEmulatorArgs } from "./dataconnectEmulator"; import { getDownloadDetails } from "./downloadableEmulators"; -const name = "Data Connect Toolkit"; +const name = "SQL Connect Toolkit"; /** - * Static controller for the VSCode Data Connect Toolkit + * Static controller for the VSCode SQL Connect Toolkit */ export class DataConnectToolkitController { static instance: DataConnectEmulator; @@ -37,7 +37,7 @@ export class DataConnectToolkitController { await this.instance.stop(); this.isRunning = false; } catch (e: any) { - throw new FirebaseError(`Data Connect Toolkit failed to stop with error: ${e}`); + throw new FirebaseError(`SQL Connect Toolkit failed to stop with error: ${e}`); } } diff --git a/src/emulator/hub.ts b/src/emulator/hub.ts index fd4e6e1d754..43260048e06 100644 --- a/src/emulator/hub.ts +++ b/src/emulator/hub.ts @@ -170,14 +170,14 @@ export class EmulatorHub extends ExpressBasedEmulator { app.post(EmulatorHub.PATH_CLEAR_DATA_CONNECT, async (req, res) => { if (req.headers.origin) { res.status(403).json({ - message: `Clear Data Connect cannot be triggered by external callers.`, + message: `Clear SQL Connect cannot be triggered by external callers.`, }); } - utils.logLabeledBullet("emulators", `Clearing data from Data Connect data sources.`); + utils.logLabeledBullet("emulators", `Clearing data from SQL Connect data sources.`); const instance = EmulatorRegistry.get(Emulators.DATACONNECT) as DataConnectEmulator; if (!instance) { - res.status(400).json({ error: "The Data Connect emulator is not running." }); + res.status(400).json({ error: "The SQL Connect emulator is not running." }); return; } diff --git a/src/emulator/hubExport.ts b/src/emulator/hubExport.ts index e60444c0c1e..3c3fc629dec 100644 --- a/src/emulator/hubExport.ts +++ b/src/emulator/hubExport.ts @@ -350,7 +350,7 @@ export class HubExport { const instance = EmulatorRegistry.get(Emulators.DATACONNECT) as DataConnectEmulator; if (!instance) { throw new FirebaseError( - "Unable to export Data Connect emulator data: the Data Connect emulator is not running.", + "Unable to export SQL Connect emulator data: the SQL Connect emulator is not running.", ); } @@ -378,7 +378,7 @@ function fetchToFile(options: http.RequestOptions, path: fs.PathLike): Promise { const info: RequiredInfo = { @@ -175,7 +175,7 @@ export async function actuate(setup: Setup, config: Config, options: any): Promi const info = setup.featureInfo?.dataconnect; if (!info) { - throw new Error("Data Connect feature RequiredInfo is not provided"); + throw new Error("SQL Connect feature RequiredInfo is not provided"); } // Populate the default values of required fields. info.serviceId = info.serviceId || defaultServiceId(); @@ -210,13 +210,13 @@ export async function actuate(setup: Setup, config: Config, options: any): Promi if (info.appDescription) { setup.instructions.push( - `You can visualize the Data Connect Schema in Firebase Console: + `You can visualize the SQL Connect Schema in Firebase Console: https://console.firebase.google.com/project/${setup.projectId!}/dataconnect/locations/${info.locationId}/services/${info.serviceId}/schema`, ); } setup.instructions.push( - `Install the Data Connect VS Code Extensions. You can explore Data Connect Query on local pgLite and Cloud SQL Postgres Instance.`, + `Install the SQL Connect VS Code Extensions. You can explore SQL Connect Query on local pgLite and Cloud SQL Postgres Instance.`, ); } @@ -266,7 +266,7 @@ async function actuateWithInfo( // Use Gemini to generate schema. const schemaGql = await promiseWithSpinner( () => generateSchema(info.appDescription, projectId), - "Generating the Data Connect Schema...", + "Generating the SQL Connect Schema...", ); const schemaFiles = [{ path: "schema.gql", content: schemaGql }]; @@ -278,13 +278,13 @@ async function actuateWithInfo( // - MCP tool `firebase_init` may pick an existing service ID, but shouldn't set app_description at the same time. logLabeledError( "dataconnect", - `Data Connect Service ${serviceName} already exists. Skip saving them...`, + `SQL Connect Service ${serviceName} already exists. Skip saving them...`, ); info.flow += "_save_gemini_service_already_exists"; return await writeFiles(config, info, { schemaGql: schemaFiles, connectors: [] }, options); } - // Create the initial Data Connect Service and Schema generated by Gemini. + // Create the initial SQL Connect Service and Schema generated by Gemini. await promiseWithSpinner(async () => { const [saveSchemaGql, waitForCloudSQLProvision] = schemasDeploySequence( projectId, @@ -297,10 +297,10 @@ async function actuateWithInfo( // Kicks off the LRO in the background. It will take about 10min. Don't wait for it. void upsertSchema(waitForCloudSQLProvision); } - }, "Saving the Data Connect Schema..."); + }, "Saving the SQL Connect Schema..."); try { - // Generate the example Data Connect Connector and seed_data.gql with Gemini. + // Generate the example SQL Connect Connector and seed_data.gql with Gemini. // Save them to local file, but don't deploy it because they may have errors. const [operationGql, seedDataGql] = await promiseWithSpinner( () => @@ -308,7 +308,7 @@ async function actuateWithInfo( generateOperation(PROMPT_GENERATE_CONNECTOR, serviceName, projectId), generateOperation(PROMPT_GENERATE_SEED_DATA, serviceName, projectId), ]), - "Generating the Data Connect Operations...", + "Generating the SQL Connect Operations...", ); const connectors = [ { @@ -548,7 +548,7 @@ function subConnectorYamlValues(replacementValues: { connectorId: string }): str } async function promptForExistingServices(setup: Setup, info: RequiredInfo): Promise { - // Check for existing Firebase Data Connect services. + // Check for existing Firebase SQL Connect services. if (!setup.projectId) { return; } diff --git a/src/init/features/dataconnect/resolver.spec.ts b/src/init/features/dataconnect/resolver.spec.ts index d2328f27d03..225cc4013fc 100644 --- a/src/init/features/dataconnect/resolver.spec.ts +++ b/src/init/features/dataconnect/resolver.spec.ts @@ -148,7 +148,7 @@ describe("askQuestions", () => { await askQuestions(setup, config, options); } catch (err: any) { expect(err.message).to.equal( - `No Firebase Data Connect workspace found. Run ${clc.bold( + `No Firebase SQL Connect workspace found. Run ${clc.bold( "firebase init dataconnect", )} to set up a service and main schema.`, ); diff --git a/src/init/features/dataconnect/resolver.ts b/src/init/features/dataconnect/resolver.ts index 66f3898eb06..5d68239c066 100644 --- a/src/init/features/dataconnect/resolver.ts +++ b/src/init/features/dataconnect/resolver.ts @@ -37,7 +37,7 @@ export async function askQuestions(setup: Setup, config: Config, options: Option const serviceInfos = await loadAll(setup.projectId || "", config); if (!serviceInfos.length) { throw new Error( - `No Firebase Data Connect workspace found. Run ${clc.bold("firebase init dataconnect")} to set up a service and main schema.`, + `No Firebase SQL Connect workspace found. Run ${clc.bold("firebase init dataconnect")} to set up a service and main schema.`, ); } else if (serviceInfos.length === 1) { resolverInfo.serviceInfo = serviceInfos[0]; @@ -91,7 +91,7 @@ export async function actuate(setup: Setup, config: Config) { } const resolverInfo = setup.featureInfo?.dataconnectResolver; if (!resolverInfo) { - throw new Error("Data Connect resolver feature ResolverRequiredInfo not provided"); + throw new Error("SQL Connect resolver feature ResolverRequiredInfo not provided"); } const startTime = Date.now(); try { diff --git a/src/init/features/dataconnect/sdk.spec.ts b/src/init/features/dataconnect/sdk.spec.ts index 17e428614e9..9c273397fc9 100644 --- a/src/init/features/dataconnect/sdk.spec.ts +++ b/src/init/features/dataconnect/sdk.spec.ts @@ -416,10 +416,7 @@ describe("actuate", () => { await actuate(setup, config); expect( - logLabeledBulletStub.calledWith( - "dataconnect", - "No apps to setup Data Connect Generated SDKs", - ), + logLabeledBulletStub.calledWith("dataconnect", "No apps to setup SQL Connect Generated SDKs"), ).to.be.true; expect(writeProjectFileStub.called).to.be.false; expect(generateStub.called).to.be.false; @@ -531,7 +528,7 @@ describe("actuate", () => { expect( logLabeledErrorStub.calledWith( "dataconnect", - "Failed to generate Data Connect SDKs\nSDK generation failed", + "Failed to generate SQL Connect SDKs\nSDK generation failed", ), ).to.be.true; }); @@ -568,12 +565,12 @@ describe("actuate", () => { ).to.be.true; expect( logBulletStub.calledWith( - "Visit https://firebase.google.com/docs/data-connect/web-sdk#react for more information on how to set up React Generated SDKs for Firebase Data Connect", + "Visit https://firebase.google.com/docs/data-connect/web-sdk#react for more information on how to set up React Generated SDKs for Firebase SQL Connect", ), ).to.be.true; expect( logBulletStub.calledWith( - "Run `ng add @angular/fire` to install angular sdk dependencies.\nVisit https://github.com/invertase/tanstack-query-firebase/tree/main/packages/angular for more information on how to set up Angular Generated SDKs for Firebase Data Connect", + "Run `ng add @angular/fire` to install angular sdk dependencies.\nVisit https://github.com/invertase/tanstack-query-firebase/tree/main/packages/angular for more information on how to set up Angular Generated SDKs for Firebase SQL Connect", ), ).to.be.true; }); diff --git a/src/init/features/dataconnect/sdk.ts b/src/init/features/dataconnect/sdk.ts index 8f98b8b6725..9e01a8a6bcf 100644 --- a/src/init/features/dataconnect/sdk.ts +++ b/src/init/features/dataconnect/sdk.ts @@ -148,7 +148,7 @@ export async function chooseApp(): Promise { }; }); const pickedApps = await checkbox({ - message: "Which apps do you want to set up Data Connect SDKs in?", + message: "Which apps do you want to set up SQL Connect SDKs in?", choices, validate: (choices) => { if (choices.length === 0) { @@ -168,7 +168,7 @@ export async function chooseApp(): Promise { export async function actuate(setup: Setup, config: Config) { const sdkInfo = setup.featureInfo?.dataconnectSdk; if (!sdkInfo) { - throw new Error("Data Connect SDK feature RequiredInfo is not provided"); + throw new Error("SQL Connect SDK feature RequiredInfo is not provided"); } const startTime = Date.now(); try { @@ -234,7 +234,7 @@ async function actuateWithInfo(setup: Setup, config: Config, info: SdkRequiredIn // The `firebase_init` MCP tool always pass an empty `apps` list, it should setup all apps detected. info.apps = await detectApps(cwd); if (!info.apps.length) { - logLabeledBullet("dataconnect", "No apps to setup Data Connect Generated SDKs"); + logLabeledBullet("dataconnect", "No apps to setup SQL Connect Generated SDKs"); return; } } @@ -270,7 +270,7 @@ async function actuateWithInfo(setup: Setup, config: Config, info: SdkRequiredIn account, }); } catch (e: any) { - logLabeledError("dataconnect", `Failed to generate Data Connect SDKs\n${e?.message}`); + logLabeledError("dataconnect", `Failed to generate SQL Connect SDKs\n${e?.message}`); } logLabeledSuccess( @@ -286,12 +286,12 @@ async function actuateWithInfo(setup: Setup, config: Config, info: SdkRequiredIn } if (apps.some((a) => a.frameworks?.includes(Framework.REACT))) { logBullet( - "Visit https://firebase.google.com/docs/data-connect/web-sdk#react for more information on how to set up React Generated SDKs for Firebase Data Connect", + "Visit https://firebase.google.com/docs/data-connect/web-sdk#react for more information on how to set up React Generated SDKs for Firebase SQL Connect", ); } if (apps.some((a) => a.frameworks?.includes(Framework.ANGULAR))) { logBullet( - "Run `ng add @angular/fire` to install angular sdk dependencies.\nVisit https://github.com/invertase/tanstack-query-firebase/tree/main/packages/angular for more information on how to set up Angular Generated SDKs for Firebase Data Connect", + "Run `ng add @angular/fire` to install angular sdk dependencies.\nVisit https://github.com/invertase/tanstack-query-firebase/tree/main/packages/angular for more information on how to set up Angular Generated SDKs for Firebase SQL Connect", ); } } @@ -325,7 +325,7 @@ async function chooseExistingConnector(setup: Setup, config: Config): Promise { }, ]; if (!setup.featureInfo?.dataconnectResolver) { - // Data Connect resolvers do not yet support Python. + // SQL Connect resolvers do not yet support Python. choices.push({ name: "Python", value: "python", diff --git a/src/mcp/README.md b/src/mcp/README.md index e7fc1fa6f67..f0065a9aa08 100644 --- a/src/mcp/README.md +++ b/src/mcp/README.md @@ -11,8 +11,8 @@ An editor configured to use the Firebase MCP server can use its AI capabilities - **Create and manage Firebase projects** - Initialize new projects, list existing ones, and manage Firebase apps - **Manage Firebase Authentication users** - Retrieve, update, and manage user accounts -- **Work with Cloud Firestore and Firebase Data Connect** - Query, read, write, and manage database documents -- **Retrieve Firebase Data Connect schemas** - Generate schemas and operations with AI assistance +- **Work with Cloud Firestore and Firebase SQL Connect** - Query, read, write, and manage database documents +- **Retrieve Firebase SQL Connect schemas** - Generate schemas and operations with AI assistance - **Understand security rules** - Validate and retrieve security rules for Firestore, Cloud Storage, and Realtime Database - **Send messages with Firebase Cloud Messaging** - Send push notifications to devices and topics - **Access Crashlytics data** - Debug issues, view crash reports, and manage crash analytics @@ -23,7 +23,7 @@ An editor configured to use the Firebase MCP server can use its AI capabilities Some tools use [Gemini in Firebase](https://firebase.google.com/docs/ai-assistance) to help you: -- Generate Firebase Data Connect schema and operations +- Generate Firebase SQL Connect schema and operations - Consult Gemini about Firebase products > **Important:** Gemini in Firebase can generate output that seems plausible but is factually incorrect. It may respond with inaccurate information that doesn't represent Google's views. Validate all output from Gemini before you use it and don't use untested generated code in production. Don't enter personally-identifiable information (PII) or user data into the chat. @@ -178,7 +178,7 @@ The Firebase MCP server provides three types of capabilities: **Tools** (functio | firebase_create_android_sha | core | Use this to add the specified SHA certificate hash to the specified Firebase Android App. | | firebase_get_environment | core | Use this to retrieve the current Firebase **environment** configuration for the Firebase CLI and Firebase MCP server, including current authenticated user, project directory, active Firebase Project, and more. All tools require the user to be authenticated, but not all information is required for all tools. Pay attention to the tool requirements for which pieces of information are required. | | firebase_update_environment | core | Use this to update environment config for the Firebase CLI and Firebase MCP server, such as project directory, active project, active user account, accept terms of service, and more. Use `firebase_get_environment` to see the currently configured environment. | -| firebase_init | core | Use this to initialize selected Firebase services in the workspace (Cloud Firestore database, Firebase Data Connect, Firebase Realtime Database, Firebase AI Logic). All services are optional; specify only the products you want to set up. You can initialize new features into an existing project directory, but re-initializing an existing feature may overwrite configuration. To deploy the initialized features, run the `firebase deploy` command after `firebase_init` tool. | +| firebase_init | core | Use this to initialize selected Firebase services in the workspace (Cloud Firestore database, Firebase SQL Connect, Firebase Realtime Database, Firebase AI Logic). All services are optional; specify only the products you want to set up. You can initialize new features into an existing project directory, but re-initializing an existing feature may overwrite configuration. To deploy the initialized features, run the `firebase deploy` command after `firebase_init` tool. | | firebase_get_security_rules | core | Use this to retrieve the security rules for a specified Firebase service. If there are multiple instances of that service in the product, the rules for the default instance are returned. | | firebase_read_resources | core | Use this to read the contents of `firebase://` resources or list available resources | | crashlytics_create_note | crashlytics | Add a note to an issue from crashlytics. | @@ -191,9 +191,9 @@ The Firebase MCP server provides three types of capabilities: **Tools** (functio | crashlytics_update_issue | crashlytics | Use this to update the state of Crashlytics issue. | | realtimedatabase_get_data | realtimedatabase | Use this to retrieve data from the specified location in a Firebase Realtime Database. | | realtimedatabase_set_data | realtimedatabase | Use this to write data to the specified location in a Firebase Realtime Database. | -| dataconnect_build | dataconnect | Use this to compile Firebase Data Connect schema, operations, and/or connectors and check for build errors. | -| dataconnect_list_services | dataconnect | Use this to list existing local and backend Firebase Data Connect services | -| dataconnect_execute | dataconnect | Use this to execute a GraphQL operation against a Data Connect service or its emulator. | +| dataconnect_build | dataconnect | Use this to compile Firebase SQL Connect schema, operations, and/or connectors and check for build errors. | +| dataconnect_list_services | dataconnect | Use this to list existing local and backend Firebase SQL Connect services | +| dataconnect_execute | dataconnect | Use this to execute a GraphQL operation against a SQL Connect service or its emulator. | | firestore_delete_document | firestore | Use this to delete Firestore documents from a database in the current project by full document paths. Use this if you know the exact path of a document. | | firestore_get_documents | firestore | Use this to retrieve one or more Firestore documents from a database in the current project by full document paths. Use this if you know the exact path of a document. | | firestore_list_collections | firestore | Use this to retrieve a list of collections from a Firestore database in the current project. | diff --git a/src/mcp/antigravity/README.md b/src/mcp/antigravity/README.md index 619b9baf1c3..25f7fca9d3c 100644 --- a/src/mcp/antigravity/README.md +++ b/src/mcp/antigravity/README.md @@ -46,7 +46,7 @@ The Firebase MCP server provides three types of capabilities: **Tools** (functio | firebase_create_android_sha | core | Use this to add the specified SHA certificate hash to the specified Firebase Android App. | | firebase_get_environment | core | Use this to retrieve the current Firebase **environment** configuration for the Firebase CLI and Firebase MCP server, including current authenticated user, project directory, active Firebase Project, and more. | | firebase_update_environment | core | Use this to update environment config for the Firebase CLI and Firebase MCP server, such as project directory, active project, active user account, accept terms of service, and more. Use `firebase_get_environment` to see the currently configured environment. | -| firebase_init | core | Use this to initialize selected Firebase services in the workspace (Cloud Firestore database, Firebase Data Connect, Firebase Realtime Database, Firebase AI Logic). All services are optional; specify only the products you want to set up. You can initialize new features into an existing project directory, but re-initializing an existing feature may overwrite configuration. To deploy the initialized features, run the `firebase deploy` command after `firebase_init` tool. | +| firebase_init | core | Use this to initialize selected Firebase services in the workspace (Cloud Firestore database, Firebase SQL Connect, Firebase Realtime Database, Firebase AI Logic). All services are optional; specify only the products you want to set up. You can initialize new features into an existing project directory, but re-initializing an existing feature may overwrite configuration. To deploy the initialized features, run the `firebase deploy` command after `firebase_init` tool. | | firebase_get_security_rules | core | Use this to retrieve the security rules for a specified Firebase service. If there are multiple instances of that service in the product, the rules for the default instance are returned. | | firebase_read_resources | core | Use this to read the contents of `firebase://` resources or list available resources | | firestore_delete_document | firestore | Use this to delete a Firestore documents from a database in the current project by full document paths. Use this if you know the exact path of a document. | @@ -56,11 +56,11 @@ The Firebase MCP server provides three types of capabilities: **Tools** (functio | auth_get_users | auth | Use this to retrieve one or more Firebase Auth users based on a list of UIDs or a list of emails. | | auth_update_user | auth | Use this to disable, enable, or set a custom claim on a specific user's account. | | auth_set_sms_region_policy | auth | Use this to set an SMS region policy for Firebase Authentication to restrict the regions which can receive text messages based on an ALLOW or DENY list of country codes. This policy will override any existing policies when set. | -| dataconnect_build | dataconnect | Use this to compile Firebase Data Connect schema, operations, and/or connectors and check for build errors. | -| dataconnect_generate_schema | dataconnect | Use this to generate a Firebase Data Connect Schema based on the users description of an app. | -| dataconnect_generate_operation | dataconnect | Use this to generate a single Firebase Data Connect query or mutation based on the currently deployed schema and the provided prompt. | -| dataconnect_list_services | dataconnect | Use this to list existing local and backend Firebase Data Connect services | -| dataconnect_execute | dataconnect | Use this to execute a GraphQL operation against a Data Connect service or its emulator. | +| dataconnect_build | dataconnect | Use this to compile Firebase SQL Connect schema, operations, and/or connectors and check for build errors. | +| dataconnect_generate_schema | dataconnect | Use this to generate a Firebase SQL Connect Schema based on the users description of an app. | +| dataconnect_generate_operation | dataconnect | Use this to generate a single Firebase SQL Connect query or mutation based on the currently deployed schema and the provided prompt. | +| dataconnect_list_services | dataconnect | Use this to list existing local and backend Firebase SQL Connect services | +| dataconnect_execute | dataconnect | Use this to execute a GraphQL operation against a SQL Connect service or its emulator. | | storage_get_object_download_url | storage | Use this to retrieve the download URL for an object in a Cloud Storage for Firebase bucket. | | messaging_send_message | messaging | Use this to send a message to a Firebase Cloud Messaging registration token or topic. ONLY ONE of `registration_token` or `topic` may be supplied in a specific call. | | functions_get_logs | functions | Use this to retrieve a page of Cloud Functions log entries using Google Cloud Logging advanced filters. | @@ -95,7 +95,7 @@ The Firebase MCP server provides three types of capabilities: **Tools** (functio | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | backend_init_guide | Firebase Backend Init Guide: guides the coding agent through configuring Firebase backend services in the current project | | ai_init_guide | Firebase GenAI Init Guide: guides the coding agent through configuring GenAI capabilities in the current project utilizing Firebase | -| data_connect_init_guide | Firebase Data Connect Init Guide: guides the coding agent through configuring Data Connect for PostgreSQL access in the current project | +| data_connect_init_guide | Firebase SQL Connect Init Guide: guides the coding agent through configuring SQL Connect for PostgreSQL access in the current project | | firestore_init_guide | Firestore Init Guide: guides the coding agent through configuring Firestore in the current project | | firestore_rules_init_guide | Firestore Rules Init Guide: guides the coding agent through setting up Firestore security rules in the project | | rtdb_init_guide | Firebase Realtime Database Init Guide: guides the coding agent through configuring Realtime Database in the current project | diff --git a/src/mcp/index.spec.ts b/src/mcp/index.spec.ts index df82c59daaf..f219f643ec6 100644 --- a/src/mcp/index.spec.ts +++ b/src/mcp/index.spec.ts @@ -1,5 +1,4 @@ import { expect } from "chai"; -import * as mockfs from "mock-fs"; import * as sinon from "sinon"; import { FirebaseMcpServer } from "./index"; import * as requireAuthModule from "../requireAuth"; @@ -62,46 +61,3 @@ describe("FirebaseMcpServer.getAuthenticatedUser", () => { expect(requireAuthStub.calledOnce).to.be.true; }); }); - -describe("FirebaseMcpServer.detectActiveFeatures", () => { - let server: FirebaseMcpServer; - - beforeEach(() => { - sinon.stub(FirebaseMcpServer.prototype, "detectProjectSetup").resolves(); - - server = new FirebaseMcpServer({ projectRoot: "/test-dir" }); - sinon.stub(server, "ready").resolves(); - - sinon.stub(server, "getProjectId").resolves(""); - sinon.stub(server, "getAuthenticatedUser").resolves(null); - }); - - afterEach(() => { - mockfs.restore(); - sinon.restore(); - }); - - it("detects Crashlytics for a Flutter project without a prior detectProjectRoot call", async () => { - mockfs({ - "/test-dir": { - "pubspec.yaml": "dependencies:\n firebase_crashlytics: ^5.0.0", - lib: { - "firebase_options.dart": - "const FirebaseOptions android = FirebaseOptions(appId: '1:123:android:abc');", - }, - android: { - app: { - "build.gradle": "plugins { id 'com.google.firebase.crashlytics' }", - }, - src: { - main: {}, - }, - }, - }, - }); - - const detectedFeatures = await server.detectActiveFeatures(); - - expect(detectedFeatures).to.include("crashlytics"); - }); -}); diff --git a/src/mcp/index.ts b/src/mcp/index.ts index 84c38541fe5..c9aac8b48f5 100644 --- a/src/mcp/index.ts +++ b/src/mcp/index.ts @@ -199,7 +199,6 @@ export class FirebaseMcpServer { async detectActiveFeatures(): Promise { if (this.detectedFeatures?.length) return this.detectedFeatures; // memoized this.logger.debug("detecting active features of Firebase MCP server..."); - await this.detectProjectRoot(); const projectId = (await this.getProjectId()) || ""; const accountEmail = await this.getAuthenticatedUser(); const isBillingEnabled = projectId ? await this.safeCheckBillingEnabled(projectId) : false; diff --git a/src/mcp/prompts/dataconnect/schema.ts b/src/mcp/prompts/dataconnect/schema.ts index b12630eda85..024db740438 100644 --- a/src/mcp/prompts/dataconnect/schema.ts +++ b/src/mcp/prompts/dataconnect/schema.ts @@ -5,12 +5,12 @@ import { BUILTIN_SDL, MAIN_INSTRUCTIONS } from "../../util/dataconnect/content"; import { compileErrors } from "../../util/dataconnect/compile"; function renderServices(fdcServices: ServiceInfo[]) { - if (!fdcServices.length) return "Data Connect Status: "; + if (!fdcServices.length) return "SQL Connect Status: "; // TODO: Render secondary schemas as well. - return `\n\n## Data Connect Schema + return `\n\n## SQL Connect Schema -The following is the up-to-date content of existing schema files (their paths are relative to the Data Connect source directory). +The following is the up-to-date content of existing schema files (their paths are relative to the SQL Connect source directory). ${mainSchema(fdcServices[0].schemas) .source.files?.map((f) => `\`\`\`graphql ${f.path}\n${f.content}\n\`\`\``) @@ -25,7 +25,7 @@ export const schema = prompt( "core", { name: "schema", - description: "Generate or update your Firebase Data Connect schema.", + description: "Generate or update your Firebase SQL Connect schema.", arguments: [ { name: "prompt", @@ -35,7 +35,7 @@ export const schema = prompt( }, ], annotations: { - title: "Generate Data Connect Schema", + title: "Generate SQL Connect Schema", }, }, async ({ prompt }, { config, projectId, accountEmail }) => { @@ -64,7 +64,7 @@ ${prompt} ==== TASK INSTRUCTIONS ==== -1. If Data Connect is marked as \`\`, first run the \`firebase_init\` tool with \`{dataconnect: {}}\` arguments to initialize it. +1. If SQL Connect is marked as \`\`, first run the \`firebase_init\` tool with \`{dataconnect: {}}\` arguments to initialize it. 2. If there is not an existing schema to work with (or the existing schema is the commented-out default schema about a movie app), follow the user's prompt to generate a robust schema meeting the specified requirements. 3. If there is already a schema, perform edits to the existing schema file(s) based on the user's instructions. If schema build errors are present and seem relevant to your changes, attempt to fix them. 4. After you have performed edits on the schema, run the \`dataconnect_compile\` tool to build the schema and see if there are any errors. Fix errors that are related to the user's prompt or your changes. diff --git a/src/mcp/resources/guides/init_data_connect.ts b/src/mcp/resources/guides/init_data_connect.ts index 35facb55cc2..dcf64045bf0 100644 --- a/src/mcp/resources/guides/init_data_connect.ts +++ b/src/mcp/resources/guides/init_data_connect.ts @@ -4,9 +4,9 @@ export const init_data_connect = resource( { uri: "firebase://guides/init/data_connect", name: "data_connect_init_guide", - title: "Firebase Data Connect Init Guide", + title: "Firebase SQL Connect Init Guide", description: - "guides the coding agent through configuring Data Connect for PostgreSQL access in the current project", + "guides the coding agent through configuring SQL Connect for PostgreSQL access in the current project", }, async (uri) => { return { diff --git a/src/mcp/resources/guides/init_firestore.ts b/src/mcp/resources/guides/init_firestore.ts index 84e6a6b3699..8dc61caedec 100644 --- a/src/mcp/resources/guides/init_firestore.ts +++ b/src/mcp/resources/guides/init_firestore.ts @@ -19,7 +19,7 @@ export const init_firestore = resource( **Database Setup:** - Configure Firestore as the application's primary database. - Implement client-side CRUD using the Firebase SDK. -- Present the app's Firestore data model to the user. Do not confuse Firestore's document model (NoSQL) with Firebase Data Connect's schema. +- Present the app's Firestore data model to the user. Do not confuse Firestore's document model (NoSQL) with Firebase SQL Connect's schema. - Write the default \`firestore.rules\` file (see below) explain what they do, and obtain the user's confirmation before deploying. - Run \`firebase deploy --only firestore\` to create the database automatically Do not ask the user to create it in the console. - Use production environment directly (avoid emulator for initial setup) diff --git a/src/mcp/tools/core/init.ts b/src/mcp/tools/core/init.ts index ef5f1dd1ffe..f3dbe61e7a8 100644 --- a/src/mcp/tools/core/init.ts +++ b/src/mcp/tools/core/init.ts @@ -18,7 +18,7 @@ export const init = tool( { name: "init", description: - "Use this to initialize selected Firebase services in the workspace (Cloud Firestore database, Firebase Data Connect, Firebase Realtime Database, Firebase AI Logic). All services are optional; specify only the products you want to set up. " + + "Use this to initialize selected Firebase services in the workspace (Cloud Firestore database, Firebase SQL Connect, Firebase Realtime Database, Firebase AI Logic). All services are optional; specify only the products you want to set up. " + "You can initialize new features into an existing project directory, but re-initializing an existing feature may overwrite configuration. " + "To deploy the initialized features, run the `firebase deploy` command after `firebase_init` tool.", inputSchema: z.object({ @@ -72,38 +72,38 @@ export const init = tool( .string() .optional() .describe( - "The Firebase Data Connect service ID to initialize. Default to match the current folder name.", + "The Firebase SQL Connect service ID to initialize. Default to match the current folder name.", ), location_id: z .string() .optional() .default(FDC_DEFAULT_REGION) - .describe("The GCP region ID to set up the Firebase Data Connect service."), + .describe("The GCP region ID to set up the Firebase SQL Connect service."), cloudsql_instance_id: z .string() .optional() .describe( - "The GCP Cloud SQL instance ID to use in the Firebase Data Connect service. By default, use -fdc. " + + "The GCP Cloud SQL instance ID to use in the Firebase SQL Connect service. By default, use -fdc. " + "\nSet `provision_cloudsql` to true to start Cloud SQL provisioning.", ), cloudsql_database: z .string() .optional() .default("fdcdb") - .describe("The Postgres database ID to use in the Firebase Data Connect service."), + .describe("The Postgres database ID to use in the Firebase SQL Connect service."), provision_cloudsql: z .boolean() .optional() .default(false) .describe( "If true, provision the Cloud SQL instance if `cloudsql_instance_id` does not exist already. " + - `\nThe first Cloud SQL instance in the project will use the Data Connect no-cost trial. See its terms of service: ${freeTrialTermsLink()}.`, + `\nThe first Cloud SQL instance in the project will use the SQL Connect no-cost trial. See its terms of service: ${freeTrialTermsLink()}.`, ), }) .optional() .describe( - "Provide this object to initialize Firebase Data Connect with Cloud SQL Postgres in this project directory.\n" + - "It installs Data Connect Generated SDKs in all detected apps in the folder.", + "Provide this object to initialize Firebase SQL Connect with Cloud SQL Postgres in this project directory.\n" + + "It installs SQL Connect Generated SDKs in all detected apps in the folder.", ), storage: z .object({ @@ -286,7 +286,7 @@ export const init = tool( if (featureInfo.dataconnectSdk && !featureInfo.dataconnectSdk.apps.length) { setup.instructions.push( - `No app is found in the current folder. We recommend you create an app (web, ios, android) first, then re-run the 'firebase_init' MCP tool with the same input without app_description to add Data Connect SDKs to your apps. + `No app is found in the current folder. We recommend you create an app (web, ios, android) first, then re-run the 'firebase_init' MCP tool with the same input without app_description to add SQL Connect SDKs to your apps. Consider popular commands like 'npx create-react-app my-app', 'npx create-next-app my-app', 'flutter create my-app', etc`, ); } diff --git a/src/mcp/tools/dataconnect/compile.ts b/src/mcp/tools/dataconnect/compile.ts index d0d9d8a1ed6..565d6b35afc 100644 --- a/src/mcp/tools/dataconnect/compile.ts +++ b/src/mcp/tools/dataconnect/compile.ts @@ -8,7 +8,7 @@ export const compile = tool( { name: "build", description: - "Use this to compile Firebase Data Connect schema, operations, and/or connectors and check for build errors.", + "Use this to compile Firebase SQL Connect schema, operations, and/or connectors and check for build errors.", inputSchema: z.object({ error_filter: z .enum(["all", "schema", "operations"]) @@ -18,17 +18,17 @@ export const compile = tool( .string() .optional() .describe( - `Service ID of the Data Connect service to compile. Used to disambiguate when there are multiple Data Connect services in firebase.json.`, + `Service ID of the SQL Connect service to compile. Used to disambiguate when there are multiple SQL Connect services in firebase.json.`, ), location_id: z .string() .optional() .describe( - `Data Connect Service location ID to disambiguate among multiple Data Connect services.`, + `SQL Connect Service location ID to disambiguate among multiple SQL Connect services.`, ), }), annotations: { - title: "Compile Data Connect", + title: "Compile SQL Connect", readOnlyHint: true, }, _meta: { @@ -55,7 +55,7 @@ export const compile = tool( content: [ { type: "text", - text: `The following errors were encountered while compiling Data Connect:\n\n${errors.join("\n")}`, + text: `The following errors were encountered while compiling SQL Connect:\n\n${errors.join("\n")}`, }, ], isError: true, diff --git a/src/mcp/tools/dataconnect/execute.ts b/src/mcp/tools/dataconnect/execute.ts index 1be67d502df..ed00bb8da4d 100644 --- a/src/mcp/tools/dataconnect/execute.ts +++ b/src/mcp/tools/dataconnect/execute.ts @@ -12,23 +12,23 @@ export const execute = tool( { name: "execute", description: - "Use this to execute a GraphQL operation against a Data Connect service or its emulator.", + "Use this to execute a GraphQL operation against a SQL Connect service or its emulator.", inputSchema: z.object({ - query: z.string().describe(`A Firebase Data Connect GraphQL query or mutation to execute. + query: z.string().describe(`A Firebase SQL Connect GraphQL query or mutation to execute. You can use the \`dataconnect_generate_operation\` tool to generate a query. -Example Data Connect schema and example queries can be found in files ending in \`.graphql\` or \`.gql\`. +Example SQL Connect schema and example queries can be found in files ending in \`.graphql\` or \`.gql\`. `), service_id: z .string() .optional() .describe( - `Service ID of the Data Connect service to compile. Used to disambiguate when there are multiple Data Connect services in firebase.json.`, + `Service ID of the SQL Connect service to compile. Used to disambiguate when there are multiple SQL Connect services in firebase.json.`, ), location_id: z .string() .optional() .describe( - `Data Connect Service location ID to disambiguate among multiple Data Connect services.`, + `SQL Connect Service location ID to disambiguate among multiple SQL Connect services.`, ), variables_json: z .string() @@ -52,7 +52,7 @@ Example Data Connect schema and example queries can be found in files ending in ), }), annotations: { - title: "Execute Firebase Data Connect Query", + title: "Execute Firebase SQL Connect Query", }, _meta: { requiresProject: true, diff --git a/src/mcp/tools/dataconnect/list_services.ts b/src/mcp/tools/dataconnect/list_services.ts index f2ac4af684a..2c07e60b602 100644 --- a/src/mcp/tools/dataconnect/list_services.ts +++ b/src/mcp/tools/dataconnect/list_services.ts @@ -29,10 +29,10 @@ export const list_services = tool( "dataconnect", { name: "list_services", - description: "Use this to list existing local and backend Firebase Data Connect services", + description: "Use this to list existing local and backend Firebase SQL Connect services", inputSchema: z.object({}), annotations: { - title: "List existing Firebase Data Connect services", + title: "List existing Firebase SQL Connect services", readOnlyHint: true, }, _meta: { @@ -110,7 +110,7 @@ export const list_services = tool( } if (localServices.length) { - output.push(`# Local Data Connect Sources`); + output.push(`# Local SQL Connect Sources`); for (const s of localServices) { const local = s.local!; output.push(dump(local.dataConnectYaml)); @@ -128,7 +128,7 @@ export const list_services = tool( } if (remoteOnlyServices.length) { - output.push(`# Data Connect Services in project ${projectId}`); + output.push(`# SQL Connect Services in project ${projectId}`); for (const s of remoteOnlyServices) { if (s.deployed) { includeDeployedServiceInfo(s.deployed); @@ -139,14 +139,14 @@ export const list_services = tool( output.push(`\n# What's next?`); if (!localServices.length) { output.push( - `- There is no local Data Connect service in the local workspace. Consider use the \`firebase_init\` MCP tool to setup one.`, + `- There is no local SQL Connect service in the local workspace. Consider use the \`firebase_init\` MCP tool to setup one.`, ); } output.push( - `- You can use the \`dataconnect_compile\` tool to compile all local Data Connect schemas and query sources.`, + `- You can use the \`dataconnect_compile\` tool to compile all local SQL Connect schemas and query sources.`, ); output.push( - `- You run \`firebase deploy\` in command line to deploy the Data Connect schemas, connector and perform SQL migrations.`, + `- You run \`firebase deploy\` in command line to deploy the SQL Connect schemas, connector and perform SQL migrations.`, ); return toContent(output.join("\n")); }, diff --git a/src/mcp/util/dataconnect/content.ts b/src/mcp/util/dataconnect/content.ts index 417d72a73a0..e59d369e788 100644 --- a/src/mcp/util/dataconnect/content.ts +++ b/src/mcp/util/dataconnect/content.ts @@ -1,7 +1,7 @@ export const MAIN_INSTRUCTIONS = ` Closely follow the following instructions: -You are Firebase Data Connect expert that is responsible for creating data connect schemas code in GraphQL for users.You will be given a description of the desired schema using Firebase Data Connect and your task is to write the schema code in GraphQL that fulfills the requirements and correct any mistakes in your generation. +You are Firebase SQL Connect expert that is responsible for creating data connect schemas code in GraphQL for users.You will be given a description of the desired schema using Firebase SQL Connect and your task is to write the schema code in GraphQL that fulfills the requirements and correct any mistakes in your generation. For example, if I were to ask for a schema for a GraphQL database that contains a table called "users" with a field called "name" and another table called "posts" with a field called "body", I would get the following schema: \`\`\` @@ -15,7 +15,7 @@ type Post @table { } \`\`\` -Simple Firebase Data Connect schema often takes the following form: +Simple Firebase SQL Connect schema often takes the following form: \`\`\`graphql type TableName @table { uuidField: UUID @@ -40,7 +40,7 @@ type TableName @table { Leave out objects named after \`Query\` and \`Mutation\` -Firebase Data Connect implicitly adds \`id: UUID!\` to every table and implicitly makes it primary key. Therefore, leave out the \`id\` field. +Firebase SQL Connect implicitly adds \`id: UUID!\` to every table and implicitly makes it primary key. Therefore, leave out the \`id\` field. Use \`UUID\` type instead of \`ID\` type or \`String\` type for id-like fields. @@ -84,7 +84,7 @@ Leave out \`directive\`, \`enum\` and \`scalar\`. Leave out \`@view\`. -Be sure that your response contains a valid Firebase Data Connect schema in a single GraphQL code block inside of triple backticks and closely follows my instructions and description. +Be sure that your response contains a valid Firebase SQL Connect schema in a single GraphQL code block inside of triple backticks and closely follows my instructions and description. `.trim(); export const BUILTIN_SDL = ` @@ -92,12 +92,12 @@ export const BUILTIN_SDL = ` Directives define specific behaviors that can be applied to fields or types within a GraphQL schema. -## Data Connect Defined +## SQL Connect Defined ### @col on \`FIELD_DEFINITION\` {:#col} Customizes a field that represents a SQL database table column. -Data Connect maps scalar Fields on [\`@table\`](directive.md#table) type to a SQL column of +SQL Connect maps scalar Fields on [\`@table\`](directive.md#table) type to a SQL column of corresponding data type. - scalar [\`UUID\`](scalar.md#UUID) maps to [\`uuid\`](https://www.postgresql.org/docs/current/datatype-uuid.html). @@ -123,7 +123,7 @@ type Post @table { } \`\`\` -Data Connect converts it to the following SQL table schema. +SQL Connect converts it to the following SQL table schema. \`\`\`sql CREATE TABLE "public"."post" ( @@ -197,7 +197,7 @@ filter and order requirement. | Argument | Type | Description | |---|---|---| -| \`name\` | [\`String\`](scalar.md#String) | Configure the SQL database index id. If not overridden, Data Connect generates the index name: - \`{table_name}_{first_field}_{second_field}_aa_idx\` - \`{table_name}_{field_name}_idx\` | +| \`name\` | [\`String\`](scalar.md#String) | Configure the SQL database index id. If not overridden, SQL Connect generates the index name: - \`{table_name}_{first_field}_{second_field}_aa_idx\` - \`{table_name}_{field_name}_idx\` | | \`fields\` | [\`[String!]\`](scalar.md#String) | Only allowed and required when used on a [\`@table\`](directive.md#table) type. Specifies the fields to create the index on. | | \`order\` | [\`[IndexFieldOrder!]\`](enum.md#IndexFieldOrder) | Only allowed for \`BTREE\` [\`@index\`](directive.md#index) on [\`@table\`](directive.md#table) type. Specifies the order for each indexed column. Defaults to all \`ASC\`. | | \`type\` | [\`IndexType\`](enum.md#IndexType) | Customize the index type. For most index, it defaults to \`BTREE\`. For array fields, only allowed [\`IndexType\`](enum.md#IndexType) is \`GIN\`. For [\`Vector\`](scalar.md#Vector) fields, defaults to \`HNSW\`, may configure to \`IVFFLAT\`. | @@ -216,7 +216,7 @@ type OneTable @table { someField: String! } \`\`\` -Data Connect adds implicit foreign key column and relation query field. So the +SQL Connect adds implicit foreign key column and relation query field. So the above schema is equivalent to the following schema. \`\`\`graphql @@ -232,7 +232,7 @@ type OneTable @table { # manyTables_on_refField: [ManyTable!]! } \`\`\` -Data Connect generates the necessary foreign key constraint. +SQL Connect generates the necessary foreign key constraint. \`\`\`sql CREATE TABLE "public"."many_table" ( @@ -312,7 +312,7 @@ type Group @table { name: String! } type User @table { name: String! } \`\`\` -When Data Connect sees a table with two reference field as its primary key, it +When SQL Connect sees a table with two reference field as its primary key, it knows this is a join table, so expands the many-to-many query field. \`\`\`graphql @@ -416,7 +416,7 @@ type TableName @table { myField: String } \`\`\` -Data Connect adds an implicit \`id\` primary key column. So the above schema is equivalent to: +SQL Connect adds an implicit \`id\` primary key column. So the above schema is equivalent to: \`\`\`graphql type TableName @table(key: "id") { @@ -425,7 +425,7 @@ type TableName @table(key: "id") { } \`\`\` -Data Connect generates the following SQL table and CRUD operations to use it. +SQL Connect generates the following SQL table and CRUD operations to use it. \`\`\`sql CREATE TABLE "public"."table_name" ( @@ -473,7 +473,7 @@ type User @table(key: "uid") { | \`name\` | [\`String\`](scalar.md#String) | Configures the SQL database table name. Defaults to snake_case like \`table_name\`. | | \`singular\` | [\`String\`](scalar.md#String) | Configures the singular name. Defaults to the camelCase like \`tableName\`. | | \`plural\` | [\`String\`](scalar.md#String) | Configures the plural name. Defaults to infer based on English plural pattern like \`tableNames\`. | -| \`key\` | [\`[String!]\`](scalar.md#String) | Defines the primary key of the table. Defaults to a single field named \`id\`. If not present already, Data Connect adds an implicit field \`id: UUID! @default(expr: "uuidV4()")\`. | +| \`key\` | [\`[String!]\`](scalar.md#String) | Defines the primary key of the table. Defaults to a single field named \`id\`. If not present already, SQL Connect adds an implicit field \`id: UUID! @default(expr: "uuidV4()")\`. | ### @unique on \`FIELD_DEFINITION\` | \`OBJECT\` {:#unique} Defines unique constraints on [\`@table\`](directive.md#table). @@ -500,16 +500,16 @@ type may define \`@ref(references)\` to refer to fields that has a unique constr | Argument | Type | Description | |---|---|---| -| \`indexName\` | [\`String\`](scalar.md#String) | Configures the SQL database unique constraint name. If not overridden, Data Connect generates the unique constraint name: - \`table_name_first_field_second_field_uidx\` - \`table_name_only_field_name_uidx\` | +| \`indexName\` | [\`String\`](scalar.md#String) | Configures the SQL database unique constraint name. If not overridden, SQL Connect generates the unique constraint name: - \`table_name_first_field_second_field_uidx\` - \`table_name_only_field_name_uidx\` | | \`fields\` | [\`[String!]\`](scalar.md#String) | Only allowed and required when used on OBJECT, this specifies the fields to create a unique constraint on. | ### @view on \`OBJECT\` {:#view} Defines a relational database Raw SQLview. -Data Connect generates GraphQL queries with WHERE and ORDER BY clauses. +SQL Connect generates GraphQL queries with WHERE and ORDER BY clauses. However, not all SQL features has native GraphQL equivalent. -You can write **an arbitrary SQL SELECT statement**. Data Connect +You can write **an arbitrary SQL SELECT statement**. SQL Connect would map Graphql fields on [\`@view\`](directive.md#view) type to columns in your SELECT statement. * Scalar GQL fields (camelCase) should match a SQL column (snake_case) @@ -631,10 +631,10 @@ Raw SQL view doesn't have a primary key, so it doesn't support lookup. Other View cannot be mutated. You can perform CRUD operations on the underlying table to alter its content. -**Important: Data Connect doesn't parse and validate SQL** +**Important: SQL Connect doesn't parse and validate SQL** - If the SQL view is invalid or undefined, related requests may fail. -- If the SQL view return incompatible types. Firebase Data Connect may surface +- If the SQL view return incompatible types. Firebase SQL Connect may surface errors. - If a field doesn't have a corresponding column in the SQL SELECT statement, it will always be \`null\`.