Open m1-nann opened 5 years ago
I was not aware that it's possible to do this way. Could you point me at the docs in JS SDK where this is mentioned?
I'd be curious to see if this works for HTTPS triggers as well (I'd assume not).
Found it (couldn't this morning): https://firebase.google.com/docs/cli/#deploy_specific_functions
for HTTPS, It does actually, because the actually function name when deployed is converted to 'alphabet-functionA' (with the dash) (assuming that was your concern)
Ok, thanks. Good to know, it might be something recent they added as I don't remember this details the last time a read this doc.
I'd probably approach it by adding a new FunctionGroup
class where users can register their functions and then using it to register the whole group. E.g.:
// This is pseudo code
class FunctionGroup {
final Object _group = newObject();
operator []=(String key, dynamic function) {
setProperty(_group, key, function);
}
}
// ...
class FirebaseFunctions {
// ...
operator []=(String key, dynamic function) {
if (function is FunctionGroup) {
setExport(key, function._group);
} else {
setExport(key, function);
}
}
}
that sounds good.
I also suggest to have and FirebaseFunction base class (or , so we can use IsFirebaseFunction
instead of dynamic
. Even if it's empty, still better for type check.
/// as Base
abstract class FirebaseFunction {}
class DatabaseFunctions extends FirebaseFunction {
final js.FirebaseFunctions _functions;
DatabaseFunctions._(this._functions);
/// Returns reference builder for specified [path] in Realtime Database.
RefBuilder ref(String path) =>
new RefBuilder._(_functions.database.ref(path));
}
/// OR as interface
class IsFirebaseFunction {}
class DatabaseFunctions implements IsFirebaseFunction {...}
What do you think?
Could we add feature to support adding function into a newObject and then to functions exports.
Let's say if I want to deploy two function functionA and functionB in group alphabet this way:
at the moment, I would set it up like this