-
Notifications
You must be signed in to change notification settings - Fork 18
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
Core events #324
Core events #324
Conversation
@schmidsi this is the branch that one had a conflict plus it's not the module approach so i created a new branch. that one is deleted now tho |
@schmidsi @pozylon event payload
inputs....looks like there needs to be a lot more decision-making required from the group per module on what the emitted format should be and the content of the event. |
ORDER_UPDATE in general is missing (changed contact, billing, meta, ...) + ORDER_SET_PAYMENT_PROVIDER + ORDER_SET_DELIVERY_PROVIDER |
I wonder what's better when naming events: I think the Event Payload for orders should mostly just contain id's rather than actual objects. The code that hooks into an event must have access to the unchained "context" that is also passed to apollo. So it's like onEvent({ orderId }, futureSuperContext) => futureSuperContext.modules.orders.findOrder({ orderId })... to get the object |
Usually, event names are present tense. See: https://nodejs.org/api/http.html#http_class_http_clientrequest
Hmm, I had in mind that the event payload should be a JSON (no functions) and should contain all relevant data. Relevant is: So that a read only observer that observes all events of the system should be able to rebuild the state of the system at any point in time (time travel). If you put only the ID and you query for this id later (from next tick up to minutes, hours or days), the information might already have changed. |
Yeah I see what you mean. 👍Objects would allow for retrospectivity which is what we need. |
based on this event names should be CamelCase but I think we are following our own standards when we are using caps. when it comes to the name I also think they should define the action performed (ORDER_UPDATED) rather than the action requested (ORDER_UPDATE). |
forgot to put the link https://basarat.gitbook.io/typescript/main-1/typed-event |
I think we should follow community standards if possible. But if you have a really good argument, why we should use UPPER_CASE and past tense, go on.
Access control happens at the resolver level. Below, everything is open.
... after the change and only the serialisable part (JSON) of it. |
Upper case kind of signals to me that it is an enum of some kind and it gets highlighted by the IDE as such. And it's usually the style when you define types and enums in GraphQL. Event names for me are to be handled like enums. PascalCase is obviously also an option 😂 no just joking I don't care. I could personally live with present style because order_checkedout sucks compared to order_checkout |
@schmidsi which community standards about event names do you refer to? |
I just quickly looked over the event names here: https://nodejs.org/api/http.html#http_class_http_clientrequest I don't know if there is a guide. Personally, I like the UPPER_CASE also. Present tense is just shorter. |
32ea4b9
to
a29cee6
Compare
Failing test are because of rebase with master |
@schmidsi ? you suggest interface over abstract class ? |
I'm not a fan of classes in general, but sometimes they make sense. So I do not have a strong opinion there. I meant following the node.js standard and use |
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.
From what I see now, I'd suggest some more tasks. I know that most of the following is not part of the steps in the issue but I think that stuff should be part of such a feature, no?
Admin Features:
- Queries that allow to query events (only admin by default)
- Controlpanel Views to view events (only admin by default)
- (GraphQL subscription to subscribe to the event stream (only admin by default))
Additional plugins:
- Out-of-the-box redis pub/sub plugin because we already use redis heavily for apollo and thumbor caching
And:
- EventDirector should log event emit and subscription with verbose or debug log level
- Matomo should log fetch url's together with the event it subscribed with debug log level
And I'm wondering if PAGE_VIEW also catches the browser version from req?
Else, structure wise I have nothing more to say, looks very good! |
Thanks i can work with this |
I've added events to some of the other modules now. about testing Redis, yes I can get it up and running in CI but the flow is different because it's a fire and forget where do you test for the event? but this can wait for the next round. |
@Mikearaya I'll do the last minor fixes and merge it, great work! |
No description provided.