Skip to content

Conversation

yuchenshi
Copy link
Member

@yuchenshi yuchenshi commented Oct 7, 2025

Description

This adds a new command to execute Data Connect operations.

DO NOT MERGE: API still in review.

Scenarios Tested

image

See Sample Commands below for more.

Sample Commands

firebase dataconnect:execute MyOperation
firebase dataconnect:execute my-connector MyOperation
firebase dataconnect:execute ./my-file.gql
firebase dataconnect:execute ./my-file.gql MyOperation

Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
});
}

// Log the body to stdout to allow pipe processing (even with .errors).
Copy link
Member Author

Choose a reason for hiding this comment

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

This doesn't work quite nicely since errors thrown (below, if any) are also logged to stdout (globally handled). Piping to jq for example can choke on the extra output

} else {
if (fileOrConnector === "-") {
stdinUsedFor = "operation source code";
if (process.stdin.isTTY) {
Copy link
Member Author

Choose a reason for hiding this comment

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

As discussed internally, I tried to throw an error if options.nonInteractive but that creates a false positive when --json is passed, since --json right now implies options.nonInteractive (handled globally).

I don't think erroring on --json matches user intention, so I left that part out.

@fredzqm
Copy link
Contributor

fredzqm commented Oct 12, 2025

Can you limit the scope of this PR to a minimum set of API that has no ongoing debates? Probably will make it easier to make progress and unblock the primary seed data CUJ in quick start.

# Yes, please!
firebase dataconnect:execute ./my-file.gql

# Let's defer.
# The tests CreatePlayer example made me nervous. tests appear like the folder name for someone new to FDC.
firebase dataconnect:execute my-connector MyOperation

# Prefer to defer it. Though won't block on it.
# There is less ambiguity between file and operation name, we can detect based on convention.
# Though the alternative `-n MyOperation` is simple, unambitious. It also allows taking multiple files. Multi seed file is a super common use case.
firebase dataconnect:execute MyOperation
firebase dataconnect:execute ./my-file.gql MyOperation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants