-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Partial #169 - MongoDB EventStore onAfterCommit
hook
#170
Partial #169 - MongoDB EventStore onAfterCommit
hook
#170
Conversation
Ended up just throwing an expect error declaration on it to prevent other build errors in emmet |
@@ -388,6 +393,15 @@ class MongoDBEventStoreImplementation implements MongoDBEventStore, Closeable { | |||
); | |||
} | |||
|
|||
await tryPublishMessagesAfterCommit<MongoDBEventStore>( | |||
// @ts-expect-error Issues with `globalPosition` not being present causing the type for metadata to expect `never` |
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.
@alex-laycalvert, that's weird; I noticed that TS got crazy on my other computer, but when I reinstalled fresh packages, then it worked fine. I'm not sure if that's the same issue, but I'll check the typing after the merge 👍
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.
Don't know for sure but I wonder if it has to do with the infer GV
usage not working if global position is not on the type itself, even if we allow undefined.
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.
Yes, because technically, it's not undefined
but optional. TypeScript is treating those cases differently. I'll have a look, it might be that I messed something out.
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.
@alex-laycalvert looks good to me, thank you!
Description
onAfterCommit
hook to theMongoDBEventStore
options modeled after the in-memory event storeinMemoryEventStore.onAfterCommit
testAdjusts the typing ofEventStoreReadEventMetadata
to allow for an undefinedGlobalPosition
. Without this change, attempting to pass the events totryPublishMessagesAfterCommit
gave a TS error because the events didn't have a global position, even though we didn't need one for mongodbTODO
Relates to #169