-
Notifications
You must be signed in to change notification settings - Fork 2
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
Middleware For Wizard Actions #27
Conversation
can you fix the failing ci tasks and please don't create another test folder |
…dleware with the name
12099b8
to
d207972
Compare
I made the changes you mentioned but there is a problem with CI task, can you check it? |
We're planning to move to our own microservice library instead of moleculer so wizard is not open to any new feature until then. Thanks for your great work |
Created 2 wizard API actions (createMiddleware and processMiddleware) and made minor changes on other actions.
By this definition, we have a global middleware named example :
If next is not returned back, it dont pass to next middleware,
If a data expect next is returned , the data returns as action return
We can use example middleware by stating in action creation:
We can also state middlewares with MiddlewareSchemas (return type of createMiddleware)
This usage is mostly for nameless middlewares that created by factory functions
With middlewares, we need a structure to store all data created by middlewares, so after we can use these datas
Data structure that standing for this purpose is share
After define props like that:
And of course we must define middleware types:
We can use it in middleware by stating:
When you use a middleware that access any share property for service action, we have types of that share props for handler context's share object:
The processMiddlewares method is for using it inside the package, not for user usage but it works like that:
I have made some minor changes on important and fundamental types, these need to be reviewed
And new types that comes with this pr may need reworking
I had wrote comment lines in the code with care but they had to be gone with linter for deployments :')
@giveerr