[FR] Can firebase-admin run data-connect generated queries and mutations
I'm trying to have a firebase function run a mutation for data connect. From reading here: https://firebase.google.com/docs/data-connect/admin-sdk this seems possible:
Since the Admin SDK operates with privileges, it can execute any of your queries and mutations regardless of access levels set using @auth directives, including the NO_ACCESS level.
However, it is not possible to pass the output of getDataConnect from firebase-admin/data-connect to a generated doMutationRef as the types don't match up.
For example when I try do this:
import { getDataConnect } from 'firebase-admin/data-connect';
const dataConnect = getDataConnect({
serviceId: "PrepIt",
location: "europe-west2",
});
import { createOrganisationRef} from 'dataconnect/generated'
createOrganisationRef(dataConnect, {
organisationId: organisationID,
userId: 'userId',
role: 'Admin',
isSupport: true,
});
it gives me the following error:
Argument of type 'import("/Users/richard/Documents/PrepIt/functions/node_modules/firebase-admin/lib/data-connect/data-connect").DataConnect' is not assignable to parameter of type 'import("/Users/richard/Documents/PrepIt/node_modules/@firebase/data-connect/dist/public").DataConnect'.
Type 'DataConnect' is missing the following properties from type 'DataConnect': dataConnectOptions, isEmulator, getSettings, setInitialized, enableEmulatorts(2345)
I found a few problems with this issue:
- I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
- This issue does not seem to follow the issue template. Make sure you provide all the required information.
Thanks for filing the feature request. This feature is currently on our radar for future improvements to the Data Connect Admin SDK API. I can't promise a timeline but you could upvote it here to help it gain more traction :)
Thanks for filing the feature request. This feature is currently on our radar for future improvements to the Data Connect Admin SDK API. I can't promise a timeline but you could upvote it here to help it gain more traction :)
No updates here? It would be really useful feature, specifically for services communication
We're happy to announce that with the recent release of firebase-admin v13.6.0 and firebase-tools v14.24.0, Firebase Data Connect now features a Generated Admin SDK :)
You can check out our new documentation to learn how to enable generation of operation functions for your Generated Admin SDK the same way you do for your client SDK - just be sure to update your packages to the latest versions!
( CC: @JuiceFV + @r-bt )
We're happy to announce that with the recent release of
firebase-admin v13.6.0andfirebase-tools v14.24.0, Firebase Data Connect now features a Generated Admin SDK :)You can check out our new documentation to learn how to enable generation of operation functions for your Generated Admin SDK the same way you do for your client SDK - just be sure to update your packages to the latest versions!
( CC: @JuiceFV + @r-bt )
So glad to hear it, thanks a lot!
I am going to close this as complete :) Please open a new issue if you run into any problems with the new feature. Thanks for your patience folks!