Is your feature request related to a problem? Please describe.
I only found out how to actually construct the correct context for my use case (plugin lifecycle hook) by reading Vendures source instead of the docs. For example the section about standalone scripts just mentions:
Add some comments to my snippet to explain that you might want to provide a different user
(Optional?) Might be good to include a small note about the user field in the create function
For me it was relevant for the plugin lifecycle which also could benefit from a small example. Now it helped me following to the ProcessContext injection example but the lifecycle could show it on a plugin level instead of service level.
Small example:
import { OnApplicationBootstrap } from "@nestjs/common";
import { VendurePlugin, ProcessContext } from "@vendure/core";
@VendurePlugin({
// ...
})
export class MyPlugin implements OnApplicationBootstrap {
constructor(private processContext: ProcessContext) {}
async onApplicationBootstrap() {
if (this.processContext.isWorker) return;
// Do something on the server
}
// ...
}
Is your feature request related to a problem? Please describe.
I only found out how to actually construct the correct context for my use case (plugin lifecycle hook) by reading Vendures source instead of the docs. For example the section about standalone scripts just mentions:
but doesnt mention the
user
option which made the context fail for me in services like theRoleService
.Found a small snippet in the repo and slightly modified it, which works nicely now:
Describe the solution you'd like
create
functionSmall example:
Describe alternatives you've considered
--
Additional context
--