feat(marketing-pages): subscribe to auth.user.signed-up

Generated handler + Payload event-task via gen event consume,
threaded through symbols / both binders / cms re-export at the
configured anchors. bus.subscribe wires the in-memory delivery in
dev-seed; the __events.auth.user.signed-up.marketing-pages Payload
task closes the production-bus loop.

Also fixes two generator-level issues found during Phase 8:
- Drop publisher prompt's `when` clause so --args can supply the
  4th positional argument (Plop limitation: --args cannot bypass
  conditional prompts). Validate runs only in consume mode.
- Switch event-task.ts.hbs from TaskConfig<"slug-string"> to
  TaskConfig<{ input: ...; output: object }> since runtime-generated
  event slugs are not keys of TypedJobs['tasks'].
This commit is contained in:
2026-05-08 16:33:14 +02:00
parent c1b8a7e434
commit 6b57a34c0c
11 changed files with 114 additions and 7 deletions

View File

@@ -378,11 +378,12 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
{
type: "input",
name: "publisher",
message: "Publisher feature (kebab-case; only for consume mode):",
when(answers: { mode: string }) {
return answers.mode === "consume";
},
validate(input: string, answers: { event: string }) {
message:
"Publisher feature (kebab-case; required for consume, ignored for publish):",
// Always shown — `--args` cannot bypass conditional prompts (Plop limitation).
// Publish mode accepts any value (it's ignored by publishActions).
validate(input: string, answers: { mode: string; event: string }) {
if (answers.mode === "publish") return true;
if (!/^[a-z][a-z0-9-]*$/.test(input)) return "Must be kebab-case";
const eventKebab = answers.event.replace(/\./g, "-");
const path = join(

View File

@@ -9,7 +9,10 @@ import { {{constantCase feature}}_SYMBOLS } from "../../../di/symbols";
import type { IOn{{pascalCase publisher}}{{pascalCase event}}Handler } from "../../../events/handlers/on-{{kebabCase publisher}}-{{kebabCase event}}.handler";
import type { {{pascalCase event}}Event } from "@repo/{{kebabCase publisher}}";
export const on{{pascalCase publisher}}{{pascalCase event}}EventTask: TaskConfig<"__events.{{kebabCase publisher}}.{{event}}.{{kebabCase feature}}"> = {
export const on{{pascalCase publisher}}{{pascalCase event}}EventTask: TaskConfig<{
input: {{pascalCase event}}Event;
output: object;
}> = {
slug: "__events.{{kebabCase publisher}}.{{event}}.{{kebabCase feature}}",
inputSchema: [],
retries: { attempts: 3, backoff: { type: "exponential", delay: 1000 } },
@@ -17,7 +20,7 @@ export const on{{pascalCase publisher}}{{pascalCase event}}EventTask: TaskConfig
const handler = {{camelCase feature}}Container.get<IOn{{pascalCase publisher}}{{pascalCase event}}Handler>(
{{constantCase feature}}_SYMBOLS.IOn{{pascalCase publisher}}{{pascalCase event}}Handler,
);
await handler(input as {{pascalCase event}}Event);
await handler(input);
return { output: {} };
},
};