Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
- Tighten --only filter resolution for functions deployment to prefer codebase names (#9353)
- Fixed an issue where the Data Connect emulator would attempt to export data when `FIREBASE_DATACONNECT_POSTGRESQL_STRING` is set (#9330)
- Added `functions.disallowLegacyRuntimeConfig` option to `firebase.json` to optionally skip fetching legacy Runtime Config during function deploys (#9354)
- Update Data Connect Dart SDK's default import path to `import 'dataconnect_generated/generated.dart';` (#9365)
3 changes: 2 additions & 1 deletion src/init/features/dataconnect/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@

// askQuestions prompts the user about the Data Connect service they want to init. Any prompting
// logic should live here, and _no_ actuation logic should live here.
export async function askQuestions(setup: Setup): Promise<void> {

Check warning on line 108 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment
const info: RequiredInfo = {
flow: "",
appDescription: "",
Expand Down Expand Up @@ -158,10 +158,10 @@

// actuate writes product specific files and makes product specifc API calls.
// It does not handle writing firebase.json and .firebaserc
export async function actuate(setup: Setup, config: Config, options: any): Promise<void> {

Check warning on line 161 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type

Check warning on line 161 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment
// Most users will want to persist data between emulator runs, so set this to a reasonable default.
const dir: string = config.get("dataconnect.source", "dataconnect");

Check warning on line 163 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
const dataDir = config.get("emulators.dataconnect.dataDir", `${dir}/.dataconnect/pgliteData`);

Check warning on line 164 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
config.set("emulators.dataconnect.dataDir", dataDir);

const info = setup.featureInfo?.dataconnect;
Expand All @@ -180,10 +180,11 @@
await sdk.actuate(setup, config);
} finally {
const sdkInfo = setup.featureInfo?.dataconnectSdk;
const source: Source = setup.featureInfo?.dataconnectSource || "init";
void trackGA4(
"dataconnect_init",
{
source: setup.featureInfo?.dataconnectSource || "init",
source,
flow: info.flow.substring(1), // Trim the leading `_`
project_status: setup.projectId
? (await isBillingEnabled(setup))
Expand All @@ -202,7 +203,7 @@
setup.instructions.push(
`You can visualize the Data Connect Schema in Firebase Console:

https://console.firebase.google.com/project/${setup.projectId!}/dataconnect/locations/${info.locationId}/services/${info.serviceId}/schema`,

Check warning on line 206 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Forbidden non-null assertion
);
}
if (!(await isBillingEnabled(setup))) {
Expand All @@ -217,7 +218,7 @@
setup: Setup,
config: Config,
info: RequiredInfo,
options: any,

Check warning on line 221 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
): Promise<void> {
const projectId = setup.projectId;
if (!projectId) {
Expand Down Expand Up @@ -324,7 +325,7 @@
{ schemaGql: schemaFiles, connectors: connectors, seedDataGql: seedDataGql },
options,
);
} catch (err: any) {

Check warning on line 328 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
logLabeledError("dataconnect", `Operation Generation failed...`);
// GiF generate operation API has stability concerns.
// Fallback to save only the generated schema.
Expand Down Expand Up @@ -398,9 +399,9 @@
config: Config,
info: RequiredInfo,
serviceGql: ServiceGQL,
options: any,

Check warning on line 402 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
): Promise<void> {
const dir: string = config.get("dataconnect.source") || "dataconnect";

Check warning on line 404 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
const subbedDataconnectYaml = subDataconnectYamlValues({
...info,
connectorDirs: serviceGql.connectors.map((c) => c.path),
Expand Down
6 changes: 4 additions & 2 deletions src/init/features/dataconnect/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { createFlutterApp, createNextApp, createReactApp } from "./create_app";
import { trackGA4 } from "../../../track";
import { dirExistsSync, listFiles } from "../../../fsutils";
import { isBillingEnabled } from "../../../gcp/cloudbilling";
import { Source } from ".";

export const FDC_APP_FOLDER = "FDC_APP_FOLDER";
export const FDC_SDK_FRAMEWORKS_ENV = "FDC_SDK_FRAMEWORKS";
Expand Down Expand Up @@ -168,10 +169,11 @@ export async function actuate(setup: Setup, config: Config) {
// Otherwise, `firebase init dataconnect` will emit those stats.
const fdcInfo = setup.featureInfo?.dataconnect;
if (!fdcInfo) {
const source: Source = setup.featureInfo?.dataconnectSource || "init_sdk";
void trackGA4(
"dataconnect_init",
{
source: setup.featureInfo?.dataconnectSource || "cli_sdk",
Copy link
Contributor Author

@fredzqm fredzqm Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made a typo here. cli_sdk wasn't a valid Source

source,
project_status: setup.projectId
? (await isBillingEnabled(setup))
? "blaze"
Expand Down Expand Up @@ -370,7 +372,7 @@ export function addSdkGenerateToConnectorYaml(
case Platform.FLUTTER: {
const dartSdk: DartSDK = {
outputDir: path.relative(connectorDir, path.join(appDir, `lib/dataconnect_generated`)),
package: "dataconnect_generated",
package: "dataconnect_generated/generated.dart",
};
if (!isArray(generate?.dartSdk)) {
generate.dartSdk = generate.dartSdk ? [generate.dartSdk] : [];
Expand Down
Loading