-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add firestore 2nd gen triggers #1358
Conversation
} | ||
try { | ||
const dataBuffer = Buffer.from(data); | ||
const anyDecoded = Any.decode(dataBuffer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh strange that this middle step is needed. Do you know why this is required? (kinda reminds me of TS val as unknown as string
trick)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Firestore is sending the payload as an encoded Any.value, not sure why they chose this, but it was in their original dd
} | ||
|
||
/** DocumentOptions extend EventHandlerOptions with provided document and optional database and namespace. */ | ||
export interface DocumentOptions<Document extends string = string> extends EventHandlerOptions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TS Q: I'm not sure why we need Document extends string
here. Isn't Document always going to be string anyway?
I see similar pattern in our v1 code (Path extends string
) and I'm not sure why that's there too 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used so we can enforce strong typing in our code - https://stackoverflow.com/questions/57342018/extending-a-string-in-typescript
I think Thomas was the one that actually put the Path stuff in during a refactor.
This fixed issue #1213 |
Add support for 2nd gen firestore triggers!