Closed kjetilhp closed 4 months ago
I have never used database functions, so thanks for letting me know!
I see that I made the helper functions onValueCreated
, onValueDeleted
, onValueUpdated
and onValueWritten
have ref required, so it is not similar to firestore after all. I have updated the readme now, and added a new section for database example.
To fix the same naming, you could add prefix to the folder or files, or even change the functionName
in the options.
Great! Noticed the
│ │ │ ├── pubsub
│ │ │ │ ├── schedule
│ │ │ │ ├── topic
any plans to support onMessagePublished (and maybe the rest of the firebase cloud triggers)?
tested the db trigger and had to change the syntax a little to get it deployed
import { onValueCreated } from 'nx-cloud-functions-deployer';
export default onValueCreated<string>(
({ data }) => {
console.log('New gmail user created: ', data.val());
},
{
//ref: '/user/{uid=*@gmail.com}',
ref: '/user/{data.key=*@gmail.com}',
},
);
Nice! Updated the readme now :+1:
Hi, the documentation states that database and firestore will behave the same structurally. However, it seems there are some issues with using this with realtime db, first of all there are no helpers for rtdb triggers so only way is to use the onValueCreated/Deleted/Updated, but then you'll have to provide the ref yourself and the path from the structure isn't used if I understand correctly.
Also, if you have the same collections in both firestore and database the triggers will get the same names and files are overwritten. Maybe prefix (or suffix) these triggers optionally with fs and db/rt_ ?
Since rtdb triggers also have the option to have more advanced patterns inside the [] identifier (e.g ref: "/user/{uid=*@gmail.com}") and also that triggers react to both /user/123 and /user/123/notification/123/message this structure might not be suitable (or at least limitations should be documented)