I tried several options but couldn’t find appropriate way of registering a singleton service which itself registers several functionality. For example, I’ve a Service called “Workflow” and I want to register activities inside this workflow, something like:
import {Activity1, Activity2, ....} from "/path/to/activities".
...
workflowService.register([Activity1, Activity2, ....]);
I need to run this only once, as it is expensive to call at every api call or cron jobs, or any other background stuffs. Remember I need this to only work in the server side, client side is not needed. I tried registering it with plugins/<plugin>.server.ts
, and server/plugins/<plugin>.ts
none of them works, as the context is completely different when using the service inside a cron job.
I couldn’t understand the underlying concept here, what is the best way to do this?
PLEASE HELP!!!