feat(turbo-gen): templates for gen event consume (handler + Payload task)
This commit is contained in:
14
turbo/generators/templates/event/consume/handler.ts.hbs
Normal file
14
turbo/generators/templates/event/consume/handler.ts.hbs
Normal file
@@ -0,0 +1,14 @@
|
||||
// packages/{{kebabCase feature}}/src/events/handlers/on-{{kebabCase publisher}}-{{kebabCase event}}.handler.ts
|
||||
import type { {{pascalCase event}}Event } from "@repo/{{kebabCase publisher}}";
|
||||
|
||||
export type IOn{{pascalCase publisher}}{{pascalCase event}}Handler = ReturnType<
|
||||
typeof on{{pascalCase publisher}}{{pascalCase event}}Handler
|
||||
>;
|
||||
|
||||
export const on{{pascalCase publisher}}{{pascalCase event}}Handler =
|
||||
() =>
|
||||
async (_event: {{pascalCase event}}Event): Promise<void> => {
|
||||
// TODO: implement the reaction. Inject dependencies via the factory's
|
||||
// constructor and use them here. The handler runs inside the consumer's
|
||||
// span+capture sandwich, so just throwing on failure is the right shape.
|
||||
};
|
||||
Reference in New Issue
Block a user